rail.projects.file_template module
- class rail.projects.file_template.RailProjectFileInstance(**kwargs)[source]
Bases:
ConfigurableSimple class for holding information about a single file
- Parameters:
kwargs (Any)
- check_file(**kwargs)[source]
Check to see if the file exists
- Return type:
bool- Parameters:
kwargs (dict[str, Any])
Notes
When called more than once, this uses the cached value unless called with update=True
-
config_options:
dict[str,StageParameter] = {'name': Parameter(File name, type: <class 'str'>, default: None [required]), 'path': Parameter(Template for path to file, type: <class 'str'>, default: None [required])}
-
yaml_tag:
str= 'FileInstance'
- class rail.projects.file_template.RailProjectFileTemplate(**kwargs)[source]
Bases:
ConfigurableSimple class for holding a template that can be resolved to a single file
For example the path_template might be ‘a_file/{flavor}_data.hdf5’ and the interpolants would be [‘flavor’]
When called with a dict such as flavor: ‘baseline path_template would get expanded out to a_file/baseline_data.hdf5
- Parameters:
kwargs (Any)
-
config_options:
dict[str,StageParameter] = {'name': Parameter(Dataset name, type: <class 'str'>, default: None [required]), 'path_template': Parameter(Template for path to file files, type: <class 'str'>, default: None [required])}
- make_file_instance(name, **kwargs)[source]
Resolve the interpolants and construct a RailProjectFileInstance
- Return type:
- Parameters:
name (str) – Name for the FileInstance object
**kwargs (dict[str, Any]) – Interpolants needed to resolve the path template
- Returns:
Newly created object
- Return type:
-
yaml_tag:
str= 'FileTemplate'