Developer utility functions
Function versioning
- indsl.versioning.get(name: str, version: str | None = None) Callable[[...], Any]
Return one of the versions of a function.
If version is None, the latest version is returned
- indsl.versioning.get_changelog(func: Callable[[...], Any]) str | None
Return changelog of this version.
If the function is not registered, None is returned
- indsl.versioning.get_name(func: Callable[[...], Any]) str
Return the name with which the function was registered.
- indsl.versioning.get_registered_functions() List[str]
Return the list of registered function names.
- indsl.versioning.get_version(func: Callable[[...], Any]) str | None
Return the version of a function.
If the function is not registered, None is returned
- indsl.versioning.get_versions(name: str) List[str]
Return the list of available versions of a function name.
Sorted from low to highest version
- indsl.versioning.is_deprecated(func: Callable[[...], Any]) bool | None
Return true if the version is deprecated.
If the function is not registered, None is returned
- indsl.versioning.is_versioned(func: Callable[[...], Any]) bool
Return true if the version is versioned.
- indsl.versioning.register(version: str, name: str | None = None, deprecated: bool | None = False, changelog: str | None = None) Callable[[...], Any]
Decorator to register a new versioned function.
- Parameters:
version –
Version number of the function The version number follows the standard version scheme for Python packages as defined in PEP 440.
The following are valid version numbers (shown in the order that would be obtained by sorting according to the supplied cmp function):
0.4 0.4.0 (these two are equivalent) 0.4.1 0.5a1 0.5b3 0.5 0.9.6 1.0 1.0.4a3 1.0.4b1 1.0.4
The following are examples of invalid version numbers:
1.3pl1 a
name – Name of the function The name under which the function should be registered. If no name is specified, the name of the function is used.
deprecated – Flag if function is deprecated. Default: False
changelog – Description of what has changed since the previous version. Default: None
- indsl.versioning.run(name: str, version: str | None = None, args: Sequence | None = None, kwargs: dict | None = None) Any
Run a version of a function.
If version is None, the latest version is executed
Exceptions
- exception indsl.exceptions.UserException
Exception raised when the error is due to the user.
- exception indsl.exceptions.UserRuntimeError
Exception raised when the error in runtime is due to the user.
- exception indsl.exceptions.UserTypeError
Exception raised when the user provides a value with the wrong type.
- exception indsl.exceptions.UserValueError
Exception raised when the user provides a wrong value.
Validation functions
- indsl.validations.validate_series_has_minimum_length(series: Series, min_len: int) None
Helper method to validate if provided pandas.Series has the minimum length specified.
- indsl.validations.validate_series_has_time_index(data: Series) None
Helper method to validate if provided pandas.Series is of type pandas.DatetimeIndex.
- indsl.validations.validate_series_is_not_empty(series: Series | DataFrame) None
Helper method to validate if provided pandas.Series has more than 0 values.
- indsl.validations.validate_timedelta(timedelta: Timedelta) None
Helper method to validate if the provided pd.Timedelta valid: not NaT and strictly larger than zero.
- indsl.validations.validate_timedelta_unit(timedelta: Timedelta) None
Helper method to validate if the provided pd.Timedelta is larger or equal to 1 second.
Type checking
- indsl.validations.validate_series_has_minimum_length(series: Series, min_len: int) None
Helper method to validate if provided pandas.Series has the minimum length specified.
- indsl.validations.validate_series_has_time_index(data: Series) None
Helper method to validate if provided pandas.Series is of type pandas.DatetimeIndex.
- indsl.validations.validate_series_is_not_empty(series: Series | DataFrame) None
Helper method to validate if provided pandas.Series has more than 0 values.
- indsl.validations.validate_timedelta(timedelta: Timedelta) None
Helper method to validate if the provided pd.Timedelta valid: not NaT and strictly larger than zero.
- indsl.validations.validate_timedelta_unit(timedelta: Timedelta) None
Helper method to validate if the provided pd.Timedelta is larger or equal to 1 second.