original_docstring: parsing mechanism: cli
  
          Function cli() defines the cli type output parsing mechanism which
          typically contains 3 steps: exe
          cuting, transforming, returning
          
docstring: parsing mechanism: cli
  Function cli() defines the cli type output parsing mechanism which
  typically contains 3 steps: exe
  cuting, transforming, returning
docstring_tokens: parsing mechanism : cli Function cli () defines the cli type output parsing mechanism which typically contains 3 steps : exe cuting transforming returning
code: def cli(self, output=None):
          """parsing mechanism: cli
  
          Function cli() defines the cli type output parsing mechanism which
          typically contains 3 steps: exe
          cuting, transforming, returning
          """
          if output is None:
              out = self.device.execute(self.cli_command)
          else:
              out = output
  
          dir_dict = {}
          for line in out.splitlines():
              line = line.rstrip()
  
              # dir
              p1 = re.compile(
                  r'^\s*[Dd]irectory +of +(?P<dir>.+)$')
              m = p1.match(line)
              if m:
                  dir1 = m.groupdict()['dir']
                  if 'dir' not in dir_dict:
                      dir_dict['dir'] = {}
                  if dir1 not in dir_dict['dir']:
                      dir_dict['dir'][dir1] = {}
                      dir_dict['dir']['dir'] = dir1
                  continue
  
              # filename, index, permissions, size and last_modified_date
              p2 = re.compile(
                  r'\s*(?P<index>\d+) +(?P<permissions>\S+) +(?P<size>\d+) +(?P<last_modified_date>\S+ +\d+ +\d+ +\d+\:\d+\:\d+ +\S+) +(?P<filename>.+)$')
              m = p2.match(line)
              if m:
                  filename = m.groupdict()['filename']
                  if 'files' not in dir_dict['dir'][dir1]:
                      dir_dict['dir'][dir1]['files'] = {}
                  if filename not in dir_dict['dir'][dir1]['files']:
                      dir_dict['dir'][dir1]['files'][filename] = {}
                  dir_dict['dir'][dir1]['files'][filename]['index'] = m.groupdict()['index']
                  dir_dict['dir'][dir1]['files'][filename]['permissions'] = m.groupdict()['permissions']
                  dir_dict['dir'][dir1]['files'][filename]['size'] = m.groupdict()['size']
                  dir_dict['dir'][dir1]['files'][filename]['last_modified_date'] = m.groupdict()['last_modified_date']
                  continue
  
              # bytes_total and bytes_free
              p3 = re.compile(
                  r'\s*(?P<bytes_total>\d+) +bytes +total +\((?P<bytes_free>\d+) +bytes +free\)')
              m = p3.match(line)
              if m:
                  dir_dict['dir'][dir1]['bytes_total'] = m.groupdict()['bytes_total']
                  dir_dict['dir'][dir1]['bytes_free'] = m.groupdict()['bytes_free']
                  continue
  
          return dir_dict
code_tokens: def cli ( self , output = None ) : if output is None : out = self . device . execute ( self . cli_command ) else : out = output dir_dict = { } for line in out . splitlines ( ) : line = line . rstrip ( ) p1 = re . compile ( r'^\s*[Dd]irectory +of +(?P<dir>.+)$' ) m = p1 . match ( line ) if m : dir1 = m . groupdict ( ) [ 'dir' ] if 'dir' not in dir_dict : dir_dict [ 'dir' ] = { } if dir1 not in dir_dict [ 'dir' ] : dir_dict [ 'dir' ] [ dir1 ] = { } dir_dict [ 'dir' ] [ 'dir' ] = dir1 continue p2 = re . compile ( r'\s*(?P<index>\d+) +(?P<permissions>\S+) +(?P<size>\d+) +(?P<last_modified_date>\S+ +\d+ +\d+ +\d+\:\d+\:\d+ +\S+) +(?P<filename>.+)$' ) m = p2 . match ( line ) if m : filename = m . groupdict ( ) [ 'filename' ] if 'files' not in dir_dict [ 'dir' ] [ dir1 ] : dir_dict [ 'dir' ] [ dir1 ] [ 'files' ] = { } if filename not in dir_dict [ 'dir' ] [ dir1 ] [ 'files' ] : dir_dict [ 'dir' ] [ dir1 ] [ 'files' ] [ filename ] = { } dir_dict [ 'dir' ] [ dir1 ] [ 'files' ] [ filename ] [ 'index' ] = m . groupdict ( ) [ 'index' ] dir_dict [ 'dir' ] [ dir1 ] [ 'files' ] [ filename ] [ 'permissions' ] = m . groupdict ( ) [ 'permissions' ] dir_dict [ 'dir' ] [ dir1 ] [ 'files' ] [ filename ] [ 'size' ] = m . groupdict ( ) [ 'size' ] dir_dict [ 'dir' ] [ dir1 ] [ 'files' ] [ filename ] [ 'last_modified_date' ] = m . groupdict ( ) [ 'last_modified_date' ] continue p3 = re . compile ( r'\s*(?P<bytes_total>\d+) +bytes +total +\((?P<bytes_free>\d+) +bytes +free\)' ) m = p3 . match ( line ) if m : dir_dict [ 'dir' ] [ dir1 ] [ 'bytes_total' ] = m . groupdict ( ) [ 'bytes_total' ] dir_dict [ 'dir' ] [ dir1 ] [ 'bytes_free' ] = m . groupdict ( ) [ 'bytes_free' ] continue return dir_dict
short_docstring: parsing mechanism: cli
  Function cli() defines the cli type output parsing mechanism which
  typically contains 3 steps: exe
  cuting, transforming, returning
short_docstring_tokens: parsing mechanism : cli Function cli () defines the cli type output parsing mechanism which typically contains 3 steps : exe cuting transforming returning
comment: """parsing mechanism: cli
  
          Function cli() defines the cli type output parsing mechanism which
          typically contains 3 steps: exe
          cuting, transforming, returning
          """$SEP$# dir$SEP$# filename, index, permissions, size and last_modified_date$SEP$# bytes_total and bytes_free