MCPcopy Create free account
hub / github.com/SwinTransformer/Transformer-SSL / list_files

Method list_files

data/zipreader.py:67–83  ·  view source on GitHub ↗
(path, extension=None)

Source from the content-addressed store, hash-verified

65
66 @staticmethod
67 def list_files(path, extension=None):
68 if extension is None:
69 extension = ['.*']
70 zip_path, folder_path = ZipReader.split_zip_style_path(path)
71
72 zfile = ZipReader.get_zipfile(zip_path)
73 file_lists = []
74 for file_foler_name in zfile.namelist():
75 file_foler_name = str.strip(file_foler_name, '/')
76 if file_foler_name.startswith(folder_path) and \
77 str.lower(os.path.splitext(file_foler_name)[-1]) in extension:
78 if len(folder_path) == 0:
79 file_lists.append(file_foler_name)
80 else:
81 file_lists.append(file_foler_name[len(folder_path) + 1:])
82
83 return file_lists
84
85 @staticmethod
86 def read(path):

Callers

nothing calls this directly

Calls 2

split_zip_style_pathMethod · 0.80
get_zipfileMethod · 0.80

Tested by

no test coverage detected