idmtools.assets.file_list module¶
idmtools FileList classes.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- class idmtools.assets.file_list.FileList(root=None, files_in_root=None, recursive=False, ignore_missing=False, relative_path=None, max_depth=3)¶
Bases:
object
Special utility class to help handling user files.
- __init__(root=None, files_in_root=None, recursive=False, ignore_missing=False, relative_path=None, max_depth=3)¶
Represents a set of files that are specified RELATIVE to root.
e.g. /a/b/c.json could be : root: ‘/a’ files_in_root: [‘b/c.json’] :param root: The dir all files_in_root are relative to. :param files_in_root: The listed files
- add_asset_file(af)¶
Method used to add asset file.
- Parameters:
af – asset file to add
Returns: None
- add_file(path, relative_path='')¶
Method used to add a file.
- Parameters:
path – file oath
relative_path – file relative path
Returns: None
- add_path(path, files_in_dir=None, relative_path=None, recursive=False)¶
Add a path to the file list.
- Parameters:
path – The path to add (needs to be a dictionary)
files_in_dir – If we want to only retrieve certain files in this path
relative_path – relative_path: The relative path prefixed to each added files
recursive – Do we want to browse recursively
Returns: None
- to_asset_collection() AssetCollection ¶
Convert a file list to an asset collection.
- Returns:
AssetCollection version of filelist
- static from_asset_collection(asset_collection: AssetCollection) FileList ¶
Create a FileList from a AssetCollection.
- Parameters:
asset_collection – AssetCollection to convert.
- Returns:
FileList version of AssetCollection