nitpick.style.fetchers.file module

Basic local file fetcher.

class nitpick.style.fetchers.file.FileFetcher(session: CachedSession | None = None, protocols: tuple[str, ...] = (<Scheme.FILE: 'file'>, ), domains: tuple[str, ...] = ())[source]

Bases: StyleFetcher

Fetch a style from a local file.

domains: tuple[str, ...] = ()
fetch(url: furl) str[source]

Fetch a style from a local file.

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.

preprocess_relative_url(url: str) str[source]

Preprocess a relative URL.

Only called for urls that lack a scheme (at the very least), being resolved against a base URL that matches this specific fetcher.

Relative paths are file paths; any ~ home reference is expanded at this point.

protocols: tuple[str, ...] = (<Scheme.FILE: 'file'>,)
requires_connection: ClassVar[bool] = False
session: CachedSession | None = None