ds_resource_plugin_py_lib.libs.utils

File: __init__.py Region: ds_resource_plugin_py_lib/libs/utils

Description

Internal shared libraries used by this package (utilities).

Submodules

Functions

import_string(→ Any)

Import a dotted module path and return the attribute/class designated by the last name in the path.

sanitize_version(→ str)

Sanitize version string to ensure it follows a consistent format.

Package Contents

ds_resource_plugin_py_lib.libs.utils.import_string(dotted_path: str) Any[source]

Import a dotted module path and return the attribute/class designated by the last name in the path. :param dotted_path: The dotted module path to import.

Returns:

The attribute/class designated by the last name in the path.

Raise ImportError if the import failed.

ds_resource_plugin_py_lib.libs.utils.sanitize_version(version: str) str[source]

Sanitize version string to ensure it follows a consistent format. We can receive versions written as semver (v1.0.0) or just the number (1.0.0). This function will strip any leading ‘v’ and whitespace.

Parameters:

version – The version string to sanitize.

Returns:

A sanitized version string.