argdigest.pipelines package#

Submodules#

argdigest.pipelines.base module#

argdigest.pipelines.base.feature_base(obj, ctx)[source]#
Parameters:

obj (Any)

argdigest.pipelines.base.feature_shape(obj, ctx)[source]#
Parameters:

obj (Any)

argdigest.pipelines.coercers module#

argdigest.pipelines.coercers.lower(value, ctx=None)[source]#

Converts to lowercase if value is a string.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.coercers.strip(value, ctx=None)[source]#

Strips whitespace if value is a string.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.coercers.to_bool(value, ctx=None)[source]#

Converts value to boolean. Handles strings: ‘true’, ‘1’, ‘yes’, ‘on’ are True.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

bool

argdigest.pipelines.coercers.to_list(value, ctx=None)[source]#

Ensures value is a list. If it’s a scalar (including string), wraps it: [value]. If it’s a tuple or other iterable (excluding str), converts to list.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

list[Any]

argdigest.pipelines.coercers.to_tuple(value, ctx=None)[source]#

Ensures value is a tuple.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

tuple[Any, …]

argdigest.pipelines.coercers.upper(value, ctx=None)[source]#

Converts to uppercase if value is a string.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.data module#

Pipelines for data science structures (Numpy, Pandas, etc.).

argdigest.pipelines.data.has_columns(columns)[source]#

Factory: Validates that a DataFrame has specific columns.

Parameters:

columns (List[str])

Return type:

Callable[[Any, Any], Any]

argdigest.pipelines.data.has_ndim(n)[source]#

Factory: Validates number of dimensions.

Parameters:

n (int)

Return type:

Callable[[Any, Any], Any]

argdigest.pipelines.data.is_dtype(dtype)[source]#

Factory: Validates numpy dtype.

Parameters:

dtype (Any)

Return type:

Callable[[Any, Any], Any]

argdigest.pipelines.data.is_shape(shape)[source]#

Factory: Validates array shape. Use None for any size in a dimension: (None, 3).

Parameters:

shape (Tuple[int | None, ...])

Return type:

Callable[[Any, Any], Any]

argdigest.pipelines.data.min_rows(n)[source]#

Factory: Validates minimum number of rows in a DataFrame or Array.

Parameters:

n (int)

Return type:

Callable[[Any, Any], Any]

argdigest.pipelines.data.to_dataframe(value, ctx=None)[source]#

Coerces input to a pandas DataFrame.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.data.to_numpy(value, ctx=None)[source]#

Coerces input to a numpy array.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.validators module#

argdigest.pipelines.validators.is_dir(value, ctx=None)[source]#

Validates that value is an existing directory.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.validators.is_file(value, ctx=None)[source]#

Validates that value is an existing file path.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.validators.is_int(value, ctx=None)[source]#

Strictly checks for int type.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

int

argdigest.pipelines.validators.is_non_negative(value, ctx=None)[source]#

Validates that value is >= 0.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.validators.is_positive(value, ctx=None)[source]#

Validates that value is > 0.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

Any

argdigest.pipelines.validators.is_str(value, ctx=None)[source]#

Strictly checks for str type.

Parameters:
  • value (Any)

  • ctx (Any)

Return type:

str

Module contents#