Exemplo n.º 1
0
 def get_file_info(self, paths):
     infos = []
     for path in paths:
         try:
             info = self.fs.info(path)
         except FileNotFoundError:
             infos.append(FileInfo(path, FileType.NotFound))
         else:
             infos.append(self._create_file_info(path, info))
     return infos
Exemplo n.º 2
0
 def _create_file_info(path, info):
     size = info["size"]
     if info["type"] == "file":
         ftype = FileType.File
     elif info["type"] == "directory":
         ftype = FileType.Directory
         # some fsspec filesystems include a file size for directories
         size = None
     else:
         ftype = FileType.Unknown
     return FileInfo(path, ftype, size=size, mtime=info.get("mtime", None))