flakeheaven._patched package

class flakeheaven._patched.FlakeHeavenApplication(program='flake8', version='4.0.1')[source]

Bases: flake8.main.application.Application

Reloaded flake8 original entrypoint to provide support for some features: + pyproject.toml support + replace CheckersManager to support for plugins option + register custom formatters

Initialize our application.

Parameters
  • program (str) – The name of the program/application that we’re executing.

  • version (str) – The version of the program/application we’re executing.

static extract_toml_config_path(argv: List[str]) Tuple[Optional[pathlib.Path], List[str]][source]
find_plugins(config_finder) None[source]

Find and load the plugins for this application.

Set the check_plugins and formatting_plugins attributes based on the discovered plugins found.

Parameters

config_finder (config.ConfigFileFinder) – The finder for finding and reading configuration files.

get_toml_config(path: Optional[pathlib.Path] = None, *, enforce_keys_from: Dict[str, flake8.options.manager.Option]) Dict[str, Any][source]

Extract config from TOML.

Parameters
  • path – toml filepath. If not set, searches in cwd parents.

  • enforce_keys_from – Mapping of configuration option names to Option instances. It is used to convert dashed-names in toml to ConfigParser namespace so it can be updated via its __dict__. Typically, it comes from either config_options, or directly from config_options_dict.

guide: flakeheaven._patched._style_guide.FlakeHeavenStyleGuideManager

The flake8.style_guide.StyleGuideManager built from the user’s options

make_file_checker_manager() None[source]

Initialize our FileChecker Manager.

make_formatter(*args, **kwargs) None[source]

Initialize a formatter based on the parsed options.

make_guide() None[source]

Patched StyleGuide creation just to use FlakeHeavenStyleGuideManager instead of original one.

property option_manager

We overload this property only to specify setter.

parse_configuration_and_cli(config_finder, argv: List[str]) None[source]

Parse configuration files and the CLI options.

Parameters
  • config_finder (config.ConfigFileFinder) – The finder for finding and reading configuration files.

  • argv (list) – Command-line arguments passed in directly.

parse_preliminary_options(argv: List[str]) Tuple[argparse.Namespace, List[str]][source]

Get preliminary options from the CLI, pre-plugin-loading.

We need to know the values of a few standard options so that we can locate configuration files and configure logging.

Since plugins aren’t loaded yet, there may be some as-yet-unknown options; we ignore those for now, they’ll be parsed later when we do real option parsing.

Parameters

argv (list) – Command-line arguments passed in directly.

Returns

Populated namespace and list of remaining argument strings.

Return type

(argparse.Namespace, list)

run_checks()[source]

Run the actual checks with the FileChecker Manager.

This method encapsulates the logic to make a Manger instance run the checks it is managing.

Parameters

files (list) – List of filenames to process

Submodules