utils

pcs.utils.clear_cache_path(cache_path: pathlib.Path, assume_yes: bool)
pcs.utils.generate_dummy_dev_registry(version_string: str = 'for_tests_dummy_dev_registry') Dict
pcs.utils.parse_github_web_ui_url(github_url: str) -> (<class 'str'>, typing.Optional[str], typing.Optional[str])

Parses a GitHub web UI URL pointing to a project root, of form:

https://github.com/<project>/<repo>/

or pointing to a specific file in a project, of form:

https://github.com/<project>/<repo>/{blob,raw}/<branch>/<path>

This will replace an SSH URL (i.e. one that starts with git@github.com:) into a URL that starts with https://github.com/.

This returns a 4-tuple of:

  1. The GitHub project name

  2. The GitHub repo name

  3. The branch_name or commit hash contained in the URL (None if URL is of the project root form)

  4. The path of the file contained in the suffix of the URL (None if URL is of the project root form)