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.
- find_plugins(config_finder) None [source]¶
Find and load the plugins for this application.
Set the
check_plugins
andformatting_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 convertdashed-names
in toml toConfigParser
namespace so it can be updated via its__dict__
. Typically, it comes from eitherconfig_options
, or directly fromconfig_options_dict
.
- guide: flakeheaven._patched._style_guide.FlakeHeavenStyleGuideManager¶
The
flake8.style_guide.StyleGuideManager
built from the user’s 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)