MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / load_file_list

Function load_file_list

tensorlayer/files/utils.py:2325–2359  ·  view source on GitHub ↗

r"""Return a file list in a folder by given a path and regular expression. Parameters ---------- path : str or None A folder path, if `None`, use the current directory. regx : str The regx of file name. printable : boolean Whether to print the files infom

(path=None, regx='\.jpg', printable=True, keep_prefix=False)

Source from the content-addressed store, hash-verified

2323
2324
2325def load_file_list(path=None, regx='\.jpg', printable=True, keep_prefix=False):
2326 r"""Return a file list in a folder by given a path and regular expression.
2327
2328 Parameters
2329 ----------
2330 path : str or None
2331 A folder path, if `None`, use the current directory.
2332 regx : str
2333 The regx of file name.
2334 printable : boolean
2335 Whether to print the files infomation.
2336 keep_prefix : boolean
2337 Whether to keep path in the file name.
2338
2339 Examples
2340 ----------
2341 >>> file_list = tl.files.load_file_list(path=None, regx='w1pre_[0-9]+\.(npz)')
2342
2343 """
2344 if path is None:
2345 path = os.getcwd()
2346 file_list = os.listdir(path)
2347 return_list = []
2348 for _, f in enumerate(file_list):
2349 if re.search(regx, f):
2350 return_list.append(f)
2351 # return_list.sort()
2352 if keep_prefix:
2353 for i, f in enumerate(return_list):
2354 return_list[i] = os.path.join(path, f)
2355
2356 if printable:
2357 logging.info('Match file list = %s' % return_list)
2358 logging.info('Number of files = %d' % len(return_list))
2359 return return_list
2360
2361
2362def load_folder_list(path=""):

Callers 13

load_flickr25k_datasetFunction · 0.90
load_celebA_datasetFunction · 0.90
load_flickr1M_datasetFunction · 0.90
load_voc_datasetFunction · 0.90
load_mpii_pose_datasetFunction · 0.90
load_image_from_folderFunction · 0.90
load_flickr25k_datasetFunction · 0.85
load_flickr1M_datasetFunction · 0.85
load_image_from_folderFunction · 0.85
load_celebA_datasetFunction · 0.85
load_voc_datasetFunction · 0.85
load_mpii_pose_datasetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…