重新格式化一下文件列表, 去除不需要的信息

        这一操作主要是为了便于接下来的查找工作.
        文件的path都被提取出来, 然后放到了一个list中.
967944
def display_files(self, pcs_files):
        '''
        '''
        tree_iters = []
        for pcs_file in pcs_files:
            path = pcs_file['path']
            pixbuf, type_ = self.app.mime.get(path, pcs_file['isdir'],
                                              icon_size=self.ICON_SIZE)
            name = os.path.split(path)[NAME_COL]
            tooltip = gutil.escape(name)
            size = pcs_file.get('size', 0)
            if pcs_file['isdir']:
                human_size = '--'
            else:
                human_size = util.get_human_size(pcs_file['size'])[0]
            mtime = pcs_file.get('server_mtime', 0)
            human_mtime = time.ctime(mtime)
            tree_iter = self.liststore.append([
                pixbuf, name, path, tooltip, size, human_size,
                pcs_file['isdir'], mtime, human_mtime, type_,
                json.dumps(pcs_file)
            ])
            tree_iters.append(tree_iter)
        cache_path = Config.get_cache_path(self.app.profile['username'])
        gutil.async_call(gutil.update_liststore_image, self.liststore,
                         tree_iters, PIXBUF_COL, pcs_files, cache_path,
                         self.ICON_SIZE)
567618
def list_gtfs(path: Path) -> DataFrame:
    
    path = Path(path)
    if not path.exists():
        raise ValueError(f"Path {path} does not exist")

    # Collect rows of DataFrame
    rows = []
    if path.is_file():
        # Zip file
        with zipfile.ZipFile(str(path)) as src:
            for x in src.infolist():
                if x.filename == "./":
                    continue
                d = {}
                d["file_name"] = x.filename
                d["file_size"] = x.file_size
                rows.append(d)
    else:
        # Directory
        for x in path.iterdir():
            d = {}
            d["file_name"] = x.name
            d["file_size"] = x.stat().st_size
            rows.append(d)

    return pd.DataFrame(rows)
22099
def file_to_list(path):
    
    if not os.path.exists(path):
        ui.error(c.MESSAGES["path_missing"], path)
        sys.exit(1)

    with codecs.open(path, "r", "UTF-8") as contents:
        lines = contents.read().splitlines()

    return lines
1120546
function updateIosPlist (targetFilePath, configItems) {
        var infoPlist = plist.parse(fs.readFileSync(targetFilePath, 'utf-8')),
            tempInfoPlist;

        _.each(configItems, function (item) {
            var key = item.parent;
            var plistXml = '<plist><dict><key>' + key + '</key>';
            plistXml += eltreeToXmlString(item.data) + '</dict></plist>';

            var configPlistObj = plist.parse(plistXml);
            infoPlist[key] = configPlistObj[key];
            logger.verbose("Write to plist; key="+key+"; value="+tostr(configPlistObj[key]));
        });

        tempInfoPlist = plist.build(infoPlist);
        tempInfoPlist = tempInfoPlist.replace(/<string>[\s\r\n]*<\/string>/g,'<string></string>');
        fs.writeFileSync(targetFilePath, tempInfoPlist, 'utf-8');
    }
733165
def list(path='.'):
    """"""
    import os
    for f in os.listdir(path):
        if isfile(join(path, f)):
            yield join(path, f) if path != '.' else f
1061889
def make_file_list(upload_path):
   
   newlist = []
   for el in sorted(os.listdir(upload_path)):
      if ' ' in el:
         raise Exception('Error: Spaces are not allowed in file names!\n')
      newlist.append(os.path.normpath(upload_path+'/'+el))
   debug.log('InputFiles: %s\n'%newlist)
   return newlist
837672
function firstItemInPath( path, list ) {
		if ( !list )
			list = path.contains( this.context );

		return list && path.block && path.block.equals( list.getFirst( listItem ) );
	}
1228949
function listDirSync (path, originalPath) {
  if (!originalPath) {
    originalPath = path + separator;
  }

  var list = [];

  var files = fs.readdirSync(path);

  files.forEach(function (file) {
    var absolutePath = join(path, file);

    var isDirectory = fs.statSync(absolutePath).isDirectory();

    // if directory, read it
    // and merge results
    if (isDirectory) {
      var subList = listDirSync(absolutePath, originalPath);

      list = list.concat(subList);

      return;
    }

    // return relative paths
    var relativePath = absolutePath.replace(originalPath, '');

    list.push(relativePath);
  });

  return list;
}
1260611
def path(self, *path):
        """"""
        path = list(filter(None, path))
        path = self.unprefix(path)
        items = [self.prefix_] + path
        return self.join(*items)
447120
private void populateFileList(ResourceFileList list, File root, boolean recurse) 
	throws IOException {
		if(root.isDirectory()) {
			File[] files = root.listFiles();
			if(files != null) {
				for(File file : files) {
					if(file.isFile() && filter.accept(root, file.getName())) {
						ResourceFileLocation location = new ResourceFileLocation(
								file.getName(),file.getAbsolutePath());
						list.add(location);
					} else if(recurse && file.isDirectory()){
						populateFileList(list, file, recurse);
					}
				}
			}
		} else {
			LOGGER.warning(root.getAbsolutePath() +	" is not a directory.");
			return;
		}
	}
410399
def list_path(root_dir):
    
    res = []
    if os.path.isdir(root_dir):
        for name in os.listdir(root_dir):
            res.append(name)
    return res
395600
public static void listStatusForLeafDir(FileSystem fs,
      FileStatus pathStatus,
      List<FileStatus> acc) throws IOException {
    if (!pathStatus.isDir())
      return;
    FileStatus[] fileStatusResults = fs.listStatus(pathStatus.getPath());
    if (fileStatusResults == null) {
      throw new IOException("Path does not exist: " + pathStatus.getPath());
    }

    boolean leafDir = true;
    for (FileStatus f : fileStatusResults) {
      if (f.isDir()) {
        leafDir = false;
        listStatusForLeafDir(fs, f, acc);
      }
    }
    if (leafDir) {
      acc.add(pathStatus); // Accumulate leaf dir
    }
  }
655016
def file_put_contents(self, path, data):
        

        path = self.get_full_file_path(path)

        # if file exists, create a temp copy to allow rollback
        if os.path.isfile(path):
            tmp_path = self.new_tmp()
            self.do_action({
                'do'   : ['copy', path, tmp_path],
                'undo' : ['move', tmp_path, path]})

        self.do_action(
            {'do'   : ['write', path, data],
             'undo' : ['backup', path]})
189874
@Override
  public String []list(String path) throws IOException
  {
    if (path.startsWith("/")) {
      path = path.substring(1);
    }
    
    if (! path.endsWith("/")) {
      path = path + "/";
    }

    ArrayList<String> names = new ArrayList<>();
    
    try (ZipInputStream zIn = new ZipInputStream(getBacking().openRead())) {
      ZipEntry entry;
      
      while ((entry = zIn.getNextEntry()) != null) {
        String name = entry.getName();

        if (name.startsWith(path)) {
          String tail = name.substring(path.length());
          int p = tail.indexOf('/');
          
          if (p >= 0) {
            tail = tail.substring(0, p);
          }
          
          if (! tail.equals("") && ! names.contains(tail)) {
            names.add(tail);
          }
        }
      }
    }
    
    String []list = new String[names.size()];
    
    names.toArray(list);
    
    return list;
  }
288714
def listdir(self, path):
        
        bucket, obj = self._path_to_bucket_and_key(path)

        obj_prefix = self._add_path_delimiter(obj)
        if self._is_root(obj_prefix):
            obj_prefix = ''

        obj_prefix_len = len(obj_prefix)
        for it in self._list_iter(bucket, obj_prefix):
            yield self._add_path_delimiter(path) + it['name'][obj_prefix_len:]
597686
def set_path(self, path):
        ''''''
        self._path = path
        return self._listitem.setPath(path)
123003
def cli(list_files, config, ignore, path):
    
    files = MarkdownFileFinder.find_files(path)
    if list_files:
        echo_files(files)

    lint_config = get_lint_config(config)
    lint_config.apply_on_csv_string(ignore, lint_config.disable_rule)

    linter = MarkdownLinter(lint_config)
    error_count = linter.lint_files(files)
    exit(error_count)