pyevoc.utils#

Utility functions for I/O, bundled resource access, validation, and shared helpers.

General utility functions used across PyEvoc.

pyevoc.utils.ensure_dir(path)[source]#

Create path and all missing parent directories, then return it.

Equivalent to mkdir -p; safe to call on a directory that already exists.

Parameters:

path (str | Path) – Directory path to create.

Returns:

The resolved Path object.

Return type:

Path

pyevoc.utils.list_bundled_models()[source]#

List bundled resource files.

Return type:

list[str]

pyevoc.utils.model_path(name)[source]#

Return a path to a bundled resource in pyevoc.models.

Parameters:

name (str) – File name or relative path inside pyevoc/models.

Return type:

Path

pyevoc.utils.read_table(path, **kwargs)[source]#

Read a tabular data file into a pandas.DataFrame.

Dispatches to the appropriate pandas reader based on the file extension. Supported formats: .csv, .tsv / .tab, .xlsx / .xls, .parquet, and .json.

Parameters:
  • path (str | Path) – Path to the data file.

  • **kwargs – Extra keyword arguments forwarded to the underlying pandas reader.

Returns:

A DataFrame containing the file contents.

Raises:

ValueError – If the file extension is not supported.

Return type:

DataFrame

pyevoc.utils.user_model_path(name)[source]#

Return the standard user-level model path, creating the directory.

Parameters:

name (str)

Return type:

Path

pyevoc.utils.validate_column_map(column_map)[source]#

Validate mapping toward the canonical PyEvoc schema.

Parameters:

column_map (Mapping[str, str])

Return type:

None

pyevoc.utils.validate_columns(columns, required=REQUIRED_COLUMNS)[source]#

Validate that all required columns are present.

Parameters:
Return type:

None

Modules#