towhee.utils.repo_normalize.RepoNormalize¶
- class towhee.utils.repo_normalize.RepoNormalize(uri: str)[source]¶
Bases:
object
To normalize the repo.
- Parameters:
uri (str) – The uri of the repo.
Methods
Check if the repo name matches the format.
Check if the uri matches the format.
Get the full uri.
Get the name for repo: normalized repo name, module name, and class name.
Get the required name for operator: normalized repo name, python file name, yaml file name and class name.
Get the required name for pipeline: normalized repo name and yaml file name.
Mapping the path(endswith']'), like repo[framework] to repo-framework.
Parse the uri.
url_valid
Attributes
has_ns
- static check_repo(repo: str) bool [source]¶
Check if the repo name matches the format.
- Parameters:
repo (str) – Repo name.
- Returns:
- (bool)
Check if matched.
- Raises:
(ValueError) – Raise error if false.
- check_uri() bool [source]¶
Check if the uri matches the format.
- Returns:
- (bool)
Check if passed.
- Raises:
(ValueError) – Raise error when false.
- static get_name(repo: str) OpResult [source]¶
Get the name for repo: normalized repo name, module name, and class name.
- Parameters:
repo (str) – Repo name.
- Returns:
- (NamedTuple[str, str, str])
Return the name for repo: repo_name, module_name, class_name.
- static get_op(repo: str) OpResult [source]¶
Get the required name for operator: normalized repo name, python file name, yaml file name and class name.
- Parameters:
repo (str) – Repo name.
- Returns:
- (NamedTuple[str, str, str, str])
Return the required name for operator: repo, py_file, yaml_file, class_name.
- static get_pipeline(repo: str) PipelineResult [source]¶
Get the required name for pipeline: normalized repo name and yaml file name.
- Parameters:
repo (str) – Repo name.
- Returns:
- (NamedTuple[str, str])
Return the required name for operator: repo, yaml_file.