stylist.style — Stylist 0.3.dev1 documentation

# stylist.style

Classes relating to styles made up of rules.

Functions

`determine_style`(configuration[, style_name]) | Builds a style from those defined in the configuration.

Classes

`Style`(rules) | Abstract parent of all style lists.

class stylist.style.Style(rules)

  Bases: `object`

  Abstract parent of all style lists.

  Parameters

    rules (`Union`[`List`[`Rule`], `Rule`]) – Rules which make up this style.

  check(source)

    Applies every rule in this style to a source code.

    Parameters

      source (`SourceTree`) – Source code to inspect.

    Return type

      `List`[`Issue`]

    Returns

      All issues found in the source.

  list_rules()

    Gets a list of the rules which make up this style.

    Return type

      `List`[`Rule`]

stylist.style.determine_style(configuration, style_name=None)

  Builds a style from those defined in the configuration.

  Parameters

    - configuration (`Configuration`) – Tool configuration.

    - style_name (`Optional`[`str`]) – If not specified the first style defined in the configuration is used.

  Return type

    `Style`

  Returns

    Selected style.