nitpick.style.fetchers.pypackage module
Support for py
schemes.
- class nitpick.style.fetchers.pypackage.BuiltinStyle(*, py_url: furl, py_url_without_ext: furl, path_from_repo_root: str, path_from_resources_root: str)[source]
Bases:
object
A built-in style file in TOML format.
Method generated by attrs for class BuiltinStyle.
- classmethod from_path(resource_path: Path) BuiltinStyle [source]
Create a built-in style from a resource path.
- py_url: furl
- py_url_without_ext: furl
- pypackage_url: PythonPackageURL
- class nitpick.style.fetchers.pypackage.PythonPackageFetcher(session: CachedSession | None = None, protocols: tuple[str, ...] = (<Scheme.PY: 'py'>, <Scheme.PYPACKAGE: 'pypackage'>), domains: tuple[str, ...] = ())[source]
Bases:
StyleFetcher
Fetch a style from an installed Python package.
URL schemes: -
py://import/path/of/style/file/<style_file_name>
-pypackage://import/path/of/style/file/<style_file_name>
E.g.
py://some_package/path/nitpick.toml
.- normalize(url: furl) furl
Normalize a URL.
Produces a canonical URL, meant to be used to uniquely identify a style resource.
The base name has .toml appended if not already ending in that extension
Individual fetchers can further normalize the path and scheme.
- class nitpick.style.fetchers.pypackage.PythonPackageURL(import_path: str, resource_name: str)[source]
Bases:
object
Represent a resource file in installed Python package.
- property content_path: Path
Raw path of resource file.
- classmethod from_furl(url: furl) PythonPackageURL [source]
Create an instance from a parsed URL in any accepted format.
See the code for
test_parsing_python_package_urls()
for more examples.