Skip to content

file module

Module with FileData.


FileData class

FileData(
    wrapper,
    data,
    single_key=True,
    classes=None,
    level_name=None,
    fetch_kwargs=None,
    returned_kwargs=None,
    last_index=None,
    delisted=None,
    tz_localize=None,
    tz_convert=None,
    missing_index=None,
    missing_columns=None,
    **kwargs
)

Data class for fetching file data.

Superclasses

Inherited members

Subclasses


is_dir_match class method

FileData.is_dir_match(
    path
)

Return whether a directory is a valid match.


is_file_match class method

FileData.is_file_match(
    path
)

Return whether a file is a valid match.


list_paths class method

FileData.list_paths(
    path='.',
    **match_path_kwargs
)

List all features or symbols under a path.


match_path class method

FileData.match_path(
    path,
    match_regex=None,
    sort_paths=True,
    recursive=True,
    extension=None,
    **kwargs
)

Get the list of all paths matching a path.

If FileData.is_dir_match() returns True for a directory, it gets returned as-is. Otherwise, iterates through all files in that directory and invokes FileData.is_file_match(). If a pattern was provided, these methods aren't invoked.


path_to_key class method

FileData.path_to_key(
    path,
    **kwargs
)

Convert a path into a feature or symbol.


pull class method

FileData.pull(
    keys=None,
    *,
    keys_are_features=None,
    features=None,
    symbols=None,
    paths=None,
    match_paths=None,
    match_regex=None,
    sort_paths=None,
    match_path_kwargs=None,
    path_to_key_kwargs=None,
    **kwargs
)

Override Data.pull() to take care of paths.

Use either features, symbols, or paths to specify the path to one or multiple files. Allowed are paths in a string or pathlib.Path format, or string expressions accepted by glob.glob.

Set match_paths to False to not parse paths and behave like a regular Data instance.

For defaults, see custom.local in data.