original_docstring: Build a dictionary keyed by file length.
          length: list of files of that length
      
docstring: Build a dictionary keyed by file length.
  length: list of files of that length
docstring_tokens: Build a dictionary keyed by file length . length : list of files of that length
code: def survey_library(folders):
      """Build a dictionary keyed by file length.
          length: list of files of that length
      """
      res = {}
      cnt = 0
      for folder in folders:
          for dpath, dirs, fnames in os.walk(folder):
              for base_fname in fnames:
                  cnt += 1
                  base_fpath = os.path.join(dpath, base_fname).replace('\\', '/')
                  try:
                      flen = os.stat(base_fpath).st_size
                      fpaths = res.setdefault(flen, [])
                      fpaths.append(base_fpath)
                  except (FileNotFoundError, IOError):
                      # If it won't stat, don't consider it.  But report...
                      print("Error stat-ing:", base_fpath)
                      pass
  
      # just out of curiosity, how good it my key choice?
      # It would be perfect if no length has more than one file.
      dups = 0
      for fpaths in res.values():
          if len(fpaths) > 1:
              dups += 1
      print("nFiles:", cnt)
      print("nLengths:", len(res))
      print("Lengths with more than 1 file:", dups)
  
      return res
code_tokens: def survey_library ( folders ) : res = { } cnt = 0 for folder in folders : for dpath , dirs , fnames in os . walk ( folder ) : for base_fname in fnames : cnt += 1 base_fpath = os . path . join ( dpath , base_fname ) . replace ( '\\' , '/' ) try : flen = os . stat ( base_fpath ) . st_size fpaths = res . setdefault ( flen , [ ] ) fpaths . append ( base_fpath ) except ( FileNotFoundError , IOError ) : print ( "Error stat-ing:" , base_fpath ) pass dups = 0 for fpaths in res . values ( ) : if len ( fpaths ) > 1 : dups += 1 print ( "nFiles:" , cnt ) print ( "nLengths:" , len ( res ) ) print ( "Lengths with more than 1 file:" , dups ) return res
short_docstring: Build a dictionary keyed by file length.
short_docstring_tokens: Build a dictionary keyed by file length .
comment: """Build a dictionary keyed by file length.
          length: list of files of that length
      """$SEP$# If it won't stat, don't consider it.  But report...$SEP$# just out of curiosity, how good it my key choice?$SEP$# It would be perfect if no length has more than one file.