nitpick.style module

Style files.

class nitpick.style.Style[source]

Bases: object

Include styles recursively from one another.

fetch_style_from_local_path(partial_file_name: str) → Optional[pathlib.Path][source]

Fetch a style file from a local path.

fetch_style_from_url(url: str) → Optional[pathlib.Path][source]

Fetch a style file from a URL, saving the contents in the cache dir.

static file_field_pair(file_name: str, base_file_class: Type[nitpick.plugins.base.NitpickPlugin]) → Dict[str, marshmallow.fields.Field][source]

Return a schema field with info from a config file class.

find_initial_styles(configured_styles: Union[str, List[str]])[source]

Find the initial style(s) and include them.

static get_default_style_url()[source]

Return the URL of the default style for the current version.

get_style_path(style_uri: str) → Optional[pathlib.Path][source]

Get the style path from the URI. Add the .toml extension if it’s missing.

include_multiple_styles(chosen_styles: Union[str, List[str]])None[source]

Include a list of styles (or just one) into this style tree.

merge_toml_dict() → Dict[str, Any][source]

Merge all included styles into a TOML (actually JSON) dictionary.

rebuild_dynamic_schema(data: Dict[str, Any] = None)None[source]

Rebuild the dynamic Marshmallow schema when needed, adding new fields that were found on the style.

validate_style(style_file_name: str, original_data: Dict[str, Any])[source]

Validate a style file (TOML) against a Marshmallow schema.