flake8 の API リファレンス
flake8 (pycqa/flake8) の公開 API 166 件 —— クラス 36、関数 31、メソッド 99。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。
リポジトリ: pycqa/flake8
| 種別 | 件数 |
|---|---|
| クラス | 36 |
| 関数 | 31 |
| メソッド | 99 |
API 一覧
class
example-plugin.src.flake8_example_plugin.off_by_default.ExampleTwoSecond Example Plugin.
method
example-plugin.src.flake8_example_plugin.off_by_default.ExampleTwo.run()Do nothing.
class
example-plugin.src.flake8_example_plugin.on_by_default.ExampleOneFirst Example Plugin.
method
example-plugin.src.flake8_example_plugin.on_by_default.ExampleOne.run()Do nothing.
class
src.flake8.api.legacy.ReportPublic facing object that mimic's Flake8 2.0's API.
method
src.flake8.api.legacy.Report.get_statistics(violation:str) -> list[str]Get the list of occurrences of a violation.
method
src.flake8.api.legacy.Report.total_errors() -> intReturn the total number of errors.
class
src.flake8.api.legacy.StyleGuidePublic facing object that mimic's Flake8 2.0's StyleGuide.
method
src.flake8.api.legacy.StyleGuide.check_files(paths:list[str] | None=None) -> ReportRun collected checks on the files provided.
method
src.flake8.api.legacy.StyleGuide.excluded(filename:str, parent:str | None=None) -> boolDetermine if a file is excluded.
method
src.flake8.api.legacy.StyleGuide.init_report(reporter:type[formatter.BaseFormatter] | None=None) -> NoneSet up a formatter for this run of Flake8.
method
src.flake8.api.legacy.StyleGuide.input_file(filename:str, lines:Any | None=None, expected:Any | None=None, line_offset:Any | None=0) -> ReportRun collected checks on a single file.
method
src.flake8.api.legacy.StyleGuide.options() -> argparse.NamespaceReturn application's options.
method
src.flake8.api.legacy.StyleGuide.paths() -> list[str]Return the extra arguments passed as paths.
func
src.flake8.api.legacy.get_style_guide(**kwargs:Any) -> StyleGuideProvision a StyleGuide for use.
class
src.flake8.checker.FileCheckerManage running checks for a file and aggregate the results.
method
src.flake8.checker.FileChecker.handle_newline(token_type:int) -> NoneHandle the logic when encountering a newline token.
method
src.flake8.checker.FileChecker.process_tokens() -> NoneProcess tokens and trigger checks.
method
src.flake8.checker.FileChecker.report(error_code:str | None, line_number:int, column:int, text:str) -> strReport an error by storing it in the results list.
method
src.flake8.checker.FileChecker.run_ast_checks() -> NoneRun all checks expecting an abstract syntax tree.
method
src.flake8.checker.FileChecker.run_check(plugin:LoadedPlugin, **arguments:Any) -> AnyRun the check in a single plugin.
method
src.flake8.checker.FileChecker.run_checks() -> tuple[str, Results, dict[str, int]]Run checks against the file.
method
src.flake8.checker.FileChecker.run_logical_checks() -> NoneRun all checks expecting a logical line.
method
src.flake8.checker.FileChecker.run_physical_checks(physical_line:str) -> NoneRun all checks for a given physical line.
class
src.flake8.checker.ManagerManage the parallelism and checker instances for each plugin and file.
method
src.flake8.checker.Manager.report() -> tuple[int, int]Report all of the errors found in the managed file checkers.
method
src.flake8.checker.Manager.run() -> NoneRun all the checkers.
method
src.flake8.checker.Manager.run_parallel() -> NoneRun the checkers in parallel.
method
src.flake8.checker.Manager.run_serial() -> NoneRun the checkers in serial.
method
src.flake8.checker.Manager.start() -> NoneStart checking files.
method
src.flake8.checker.Manager.stop() -> NoneStop checking files.
func
src.flake8.checker.find_offset(offset:int, mapping:processor._LogicalMapping) -> tuple[int, int]Find the offset tuple for a single offset.
func
src.flake8.configure_logging(verbosity:int, filename:str | None=None, logformat:str=LOG_FORMAT) -> NoneConfigure logging for flake8.
class
src.flake8.exceptions.EarlyQuitExcept raised when encountering a KeyboardInterrupt.
class
src.flake8.exceptions.ExecutionErrorException raised during execution of Flake8.
class
src.flake8.exceptions.FailedToLoadPluginException raised when a plugin fails to load.
class
src.flake8.exceptions.Flake8ExceptionPlain Flake8 exception.
class
src.flake8.exceptions.PluginExecutionFailedThe plugin failed during execution.
class
src.flake8.exceptions.PluginRequestedUnknownParametersThe plugin requested unknown parameters.
class
src.flake8.formatting.base.BaseFormatterClass defining the formatter interface.
method
src.flake8.formatting.base.BaseFormatter.after_init() -> NoneInitialize the formatter further.
method
src.flake8.formatting.base.BaseFormatter.beginning(filename:str) -> NoneNotify the formatter that we're starting to process a file.
method
src.flake8.formatting.base.BaseFormatter.finished(filename:str) -> NoneNotify the formatter that we've finished processing a file.
method
src.flake8.formatting.base.BaseFormatter.format(error:Violation) -> str | NoneFormat an error reported by Flake8.
method
src.flake8.formatting.base.BaseFormatter.handle(error:Violation) -> NoneHandle an error reported by Flake8.
method
src.flake8.formatting.base.BaseFormatter.show_benchmarks(benchmarks:list[tuple[str, float]]) -> NoneFormat and print the benchmarks.
method
src.flake8.formatting.base.BaseFormatter.show_source(error:Violation) -> str | NoneShow the physical line generating the error.
method
src.flake8.formatting.base.BaseFormatter.show_statistics(statistics:Statistics) -> NoneFormat and print the statistics.
method
src.flake8.formatting.base.BaseFormatter.start() -> NonePrepare the formatter to receive input.
method
src.flake8.formatting.base.BaseFormatter.stop() -> NoneClean up after reporting is finished.
method
src.flake8.formatting.base.BaseFormatter.write(line:str | None, source:str | None) -> NoneWrite the line either to the output file or stdout.
class
src.flake8.formatting.default.DefaultDefault formatter for Flake8.
method
src.flake8.formatting.default.Default.after_init() -> NoneCheck for a custom format string.
class
src.flake8.formatting.default.FilenameOnlyOnly print filenames, e.g., flake8 -q.
method
src.flake8.formatting.default.FilenameOnly.after_init() -> NoneInitialize our set of filenames.
method
src.flake8.formatting.default.FilenameOnly.format(error:Violation) -> str | NoneEnsure we only print each error once.
method
src.flake8.formatting.default.FilenameOnly.show_source(error:Violation) -> str | NoneDo not include the source code.
class
src.flake8.formatting.default.NothingPrint absolutely nothing.
method
src.flake8.formatting.default.Nothing.format(error:Violation) -> str | NoneDo nothing.
method
src.flake8.formatting.default.Nothing.show_source(error:Violation) -> str | NoneDo not print the source.
class
src.flake8.formatting.default.PylintPylint formatter for Flake8.
method
src.flake8.formatting.default.SimpleFormatter.format(error:Violation) -> str | NoneFormat and write error out.
class
src.flake8.main.application.ApplicationAbstract our application into a class.
method
src.flake8.main.application.Application.exit_code() -> intReturn the program exit code.
method
src.flake8.main.application.Application.initialize(argv:Sequence[str]) -> NoneInitialize the application to be run.
method
src.flake8.main.application.Application.make_file_checker_manager(argv:Sequence[str]) -> NoneInitialize our FileChecker Manager.
method
src.flake8.main.application.Application.make_formatter() -> NoneInitialize a formatter based on the parsed options.
method
src.flake8.main.application.Application.make_guide() -> NoneInitialize our StyleGuide.
method
src.flake8.main.application.Application.report() -> NoneReport errors, statistics, and benchmarks.
method
src.flake8.main.application.Application.report_errors() -> NoneReport all the errors found by flake8 3.0.
method
src.flake8.main.application.Application.report_statistics() -> NoneAggregate and report statistics from this run.
method
src.flake8.main.application.Application.run(argv:Sequence[str]) -> NoneRun our application.
method
src.flake8.main.application.Application.run_checks() -> NoneRun the actual checks with the FileChecker Manager.
func
src.flake8.main.cli.main(argv:Sequence[str] | None=None) -> intExecute the main bit of the application.
func
src.flake8.main.debug.information(version:str, plugins:Plugins) -> dict[str, Any]Generate the information to be printed for the bug report.
class
src.flake8.main.options.JobsArgumentType callback for the --jobs argument.
func
src.flake8.main.options.register_default_options(option_manager:OptionManager) -> NoneRegister the default options on our OptionManager.
func
src.flake8.options.config.load_config(config:str | None, extra:list[str], *isolated:bool=False) -> tuple[configparser.RawConfigParser, str]Load the configuration given the user options.
func
src.flake8.options.config.parse_config(option_manager:OptionManager, cfg:configparser.RawConfigParser, cfg_dir:str) -> dict[str, Any]Parse and normalize the typed configuration options.
class
src.flake8.options.manager.OptionOur wrapper around an argparse argument parsers to add features.
method
src.flake8.options.manager.Option.filtered_option_kwargs() -> dict[str, Any]Return any actually-specified arguments.
method
src.flake8.options.manager.Option.normalize(value:Any, *normalize_args:str) -> AnyNormalize the value based on the option configuration.
method
src.flake8.options.manager.OptionManager.add_option(*args:Any, **kwargs:Any) -> NoneCreate and register a new option.
method
src.flake8.options.manager.OptionManager.register_plugins(plugins:Plugins) -> NoneRegister the plugin options (if needed).
func
src.flake8.options.parse_args.parse_args(argv:Sequence[str]) -> tuple[finder.Plugins, argparse.Namespace]Procedure for parsing args, config, loading plugins.
class
src.flake8.plugins.finder.CheckersClassified plugins needed for checking.
class
src.flake8.plugins.finder.LoadedPluginRepresents a plugin after being imported.
method
src.flake8.plugins.finder.LoadedPlugin.entry_name() -> strReturn the name given in the packaging metadata.
class
src.flake8.plugins.finder.PluginA plugin before loading.
class
src.flake8.plugins.finder.PluginOptionsOptions related to plugin loading.
method
src.flake8.plugins.finder.PluginOptions.blank() -> PluginOptionsMake a blank PluginOptions, mostly used for tests.
class
src.flake8.plugins.finder.PluginsClassified plugins.
method
src.flake8.plugins.finder.Plugins.all_plugins() -> Generator[LoadedPlugin]Return an iterator over all :class:`LoadedPlugin`s.
method
src.flake8.plugins.finder.Plugins.versions_str() -> strReturn a user-displayed list of plugin versions.
func
src.flake8.plugins.finder.find_plugins(cfg:configparser.RawConfigParser, opts:PluginOptions) -> list[Plugin]Discovers all plugins (but does not load them).
func
src.flake8.plugins.finder.load_plugins(plugins:list[Plugin], opts:PluginOptions) -> PluginsLoad and classify all flake8 plugins.
func
src.flake8.plugins.finder.parse_plugin_options(cfg:configparser.RawConfigParser, cfg_dir:str, *enable_extensions:str | None, *require_plugins:str | None) -> PluginOptionsParse plugin loading related options.
func
src.flake8.plugins.pycodestyle.pycodestyle_physical(indent_char:Any, line_number:Any, lines:Any, max_line_length:Any, multiline:Any, noqa:Any, physical_line:Any, total_lines:Any) -> Generator[tuple[int, str]]Run pycodestyle physical checks.
method
src.flake8.plugins.pyflakes.FlakesChecker.add_options(parser:OptionManager) -> NoneRegister options for PyFlakes on the Flake8 OptionManager.
method
src.flake8.plugins.pyflakes.FlakesChecker.parse_options(options:argparse.Namespace) -> NoneParse option values from Flake8's OptionManager.
method
src.flake8.plugins.pyflakes.FlakesChecker.run() -> Generator[tuple[int, int, str, type[Any]]]Run the plugin.
func
src.flake8.plugins.reporter.make(reporters:dict[str, LoadedPlugin], options:argparse.Namespace) -> BaseFormatterMake the formatter from the requested user options.
class
src.flake8.processor.FileProcessorProcesses a file and holds state.
method
src.flake8.processor.FileProcessor.build_ast() -> ast.ASTBuild an abstract syntax tree from the list of lines.
method
src.flake8.processor.FileProcessor.delete_first_token() -> NoneDelete the first token in the list of tokens.
method
src.flake8.processor.FileProcessor.file_tokens() -> list[tokenize.TokenInfo]Return the complete set of tokens for a file.
method
src.flake8.processor.FileProcessor.fstring_start(lineno:int) -> NoneSignal the beginning of an fstring.
method
src.flake8.processor.FileProcessor.generate_tokens() -> Generator[tokenize.TokenInfo]Tokenize the file and yield the tokens.
method
src.flake8.processor.FileProcessor.multiline_string(token:tokenize.TokenInfo) -> Generator[str]Iterate through the lines of a multiline string.
method
src.flake8.processor.FileProcessor.next_line() -> strGet the next line from the list.
method
src.flake8.processor.FileProcessor.next_logical_line() -> NoneRecord the previous logical line.
method
src.flake8.processor.FileProcessor.noqa_line_for(line_number:int) -> str | NoneRetrieve the line which will be used to determine noqa.
method
src.flake8.processor.FileProcessor.read_lines() -> list[str]Read the lines for this file checker.
method
src.flake8.processor.FileProcessor.read_lines_from_filename() -> list[str]Read the lines for a file.
method
src.flake8.processor.FileProcessor.read_lines_from_stdin() -> list[str]Read the lines from standard in.
method
src.flake8.processor.FileProcessor.reset_blank_before() -> NoneReset the blank_before attribute to zero.
method
src.flake8.processor.FileProcessor.strip_utf_bom() -> NoneStrip the UTF bom from the lines of the file.
method
src.flake8.processor.FileProcessor.tstring_start(lineno:int) -> NoneSignal the beginning of an tstring.
method
src.flake8.processor.FileProcessor.update_checker_state_for(plugin:LoadedPlugin) -> NoneUpdate the checker_state attribute for the plugin.
method
src.flake8.processor.FileProcessor.update_state(mapping:_LogicalMapping) -> NoneUpdate the indent level based on the logical line mapping.
method
src.flake8.processor.FileProcessor.visited_new_blank_line() -> NoneNote that we visited a new blank line.
func
src.flake8.processor.count_parentheses(current_parentheses_count:int, token_text:str) -> intCount the number of parentheses.
func
src.flake8.processor.expand_indent(line:str) -> intReturn the amount of indentation.
func
src.flake8.processor.is_eol_token(token:tokenize.TokenInfo) -> boolCheck if the token is an end-of-line token.
func
src.flake8.processor.is_multiline_string(token:tokenize.TokenInfo) -> boolCheck if this is a multiline string.
func
src.flake8.processor.mutate_string(text:str) -> strReplace contents with 'xxx' to prevent syntax matching.
func
src.flake8.processor.token_is_newline(token:tokenize.TokenInfo) -> boolCheck if the token type is a newline token type.
class
src.flake8.statistics.KeySimple key structure for the Statistics dictionary.
method
src.flake8.statistics.Key.create_from(error:Violation) -> KeyCreate a Key from :class:`flake8.violation.Violation`.
method
src.flake8.statistics.Key.matches(prefix:str, filename:str | None) -> boolDetermine if this key matches some constraints.
class
src.flake8.statistics.StatisticSimple wrapper around the logic of each statistic.
method
src.flake8.statistics.Statistic.create_from(error:Violation) -> StatisticCreate a Statistic from a :class:`flake8.violation.Violation`.
class
src.flake8.statistics.StatisticsManager of aggregated statistics for a run of Flake8.
method
src.flake8.statistics.Statistics.error_codes() -> list[str]Return all unique error codes stored.
method
src.flake8.statistics.Statistics.record(error:Violation) -> NoneAdd the fact that the error was seen in the file.
method
src.flake8.statistics.Statistics.statistics_for(prefix:str, filename:str | None=None) -> Generator[Statistic]Generate statistics for the prefix and filename.
class
src.flake8.style_guide.DecisionEnum representing whether a code should be ignored or selected.
class
src.flake8.style_guide.DecisionEngineA class for managing the decision process around violations.
method
src.flake8.style_guide.DecisionEngine.decision_for(code:str) -> DecisionReturn the decision for a specific code.
method
src.flake8.style_guide.DecisionEngine.make_decision(code:str) -> DecisionDecide if code should be ignored or selected.
method
src.flake8.style_guide.DecisionEngine.was_ignored(code:str) -> Selected | IgnoredDetermine if the code has been ignored by the user.
method
src.flake8.style_guide.DecisionEngine.was_selected(code:str) -> Selected | IgnoredDetermine if the code has been selected by the user.
class
src.flake8.style_guide.IgnoredEnum representing an explicitly or implicitly ignored code.
class
src.flake8.style_guide.SelectedEnum representing an explicitly or implicitly selected code.
class
src.flake8.style_guide.StyleGuideManage a Flake8 user's style guide.
method
src.flake8.style_guide.StyleGuide.applies_to(filename:str) -> boolCheck if this StyleGuide applies to the file.
method
src.flake8.style_guide.StyleGuide.copy(filename:str | None=None, extend_ignore_with:Sequence[str] | None=None) -> StyleGuideCreate a copy of this style guide with different values.
method
src.flake8.style_guide.StyleGuide.handle_error(code:str, filename:str, line_number:int, column_number:int, text:str, physical_line:str | None=None) -> intHandle an error reported by a check.
method
src.flake8.style_guide.StyleGuide.processing_file(filename:str) -> Generator[StyleGuide]Record the fact that we're processing the file's results.
method
src.flake8.style_guide.StyleGuide.should_report_error(code:str) -> DecisionDetermine if the error code should be reported or ignored.
class
src.flake8.style_guide.StyleGuideManagerManage multiple style guides for a single run.
method
src.flake8.style_guide.StyleGuideManager.handle_error(code:str, filename:str, line_number:int, column_number:int, text:str, physical_line:str | None=None) -> intHandle an error reported by a check.
method
src.flake8.style_guide.StyleGuideManager.processing_file(filename:str) -> Generator[StyleGuide]Record the fact that we're processing the file's results.
func
src.flake8.utils.fnmatch(filename:str, patterns:Sequence[str]) -> boolWrap :func:`fnmatch.fnmatch` to add some functionality.
func
src.flake8.utils.get_python_version() -> strFind and format the python implementation and version.
func
src.flake8.utils.is_using_stdin(paths:list[str]) -> boolDetermine if we're going to read from stdin.
func
src.flake8.utils.matches_filename(path:str, patterns:Sequence[str], log_message:str, logger:logging.Logger) -> boolUse fnmatch to discern if a path exists in patterns.
func
src.flake8.utils.normalize_path(path:str, parent:str=os.curdir) -> strNormalize a single-path.
func
src.flake8.utils.normalize_paths(paths:Sequence[str], parent:str=os.curdir) -> list[str]Normalize a list of paths relative to a parent directory.
func
src.flake8.utils.normalize_pypi_name(s:str) -> strNormalize a distribution name according to PEP 503.
func
src.flake8.utils.parse_comma_separated_list(value:str, regexp:Pattern[str]=COMMA_SEPARATED_LIST_RE) -> list[str]Parse a comma-separated list.
func
src.flake8.utils.parse_files_to_codes_mapping(value_:Sequence[str] | str) -> list[tuple[str, list[str]]]Parse a files-to-codes mapping.
func
src.flake8.utils.stdin_get_lines() -> list[str]Return lines of stdin split according to file splitting.
func
src.flake8.utils.stdin_get_value() -> strGet and cache it so plugins can use it.
class
src.flake8.violation.ViolationClass representing a violation reported by Flake8.
method
src.flake8.violation.Violation.is_inline_ignored(disable_noqa:bool) -> boolDetermine if a comment has been added to ignore this line.
この情報について
掲載しているシグネチャは pycqa/flake8 の公開ソースコードを
Python の ast モジュールで静的解析し、引数名・デフォルト値・
型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。
詳しくは仕組みの解説をご覧ください。