mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-10 14:54:17 +00:00
Merge pull request #1509 from asottile/type_legacy_pt1
type api.legacy.Report
This commit is contained in:
commit
0d4128db48
1 changed files with 5 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ In 3.0 we no longer have an "engine" module but we maintain the API from it.
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
|
from typing import List
|
||||||
|
|
||||||
import flake8
|
import flake8
|
||||||
from flake8.formatting import base as formatter
|
from flake8.formatting import base as formatter
|
||||||
|
|
@ -183,21 +184,22 @@ class Report:
|
||||||
.. versionchanged:: 3.0.0
|
.. versionchanged:: 3.0.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, application):
|
def __init__(self, application: app.Application) -> None:
|
||||||
"""Initialize the Report for the user.
|
"""Initialize the Report for the user.
|
||||||
|
|
||||||
.. warning:: This should not be instantiated by users.
|
.. warning:: This should not be instantiated by users.
|
||||||
"""
|
"""
|
||||||
|
assert application.guide is not None
|
||||||
self._application = application
|
self._application = application
|
||||||
self._style_guide = application.guide
|
self._style_guide = application.guide
|
||||||
self._stats = self._style_guide.stats
|
self._stats = self._style_guide.stats
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def total_errors(self):
|
def total_errors(self) -> int:
|
||||||
"""Return the total number of errors."""
|
"""Return the total number of errors."""
|
||||||
return self._application.result_count
|
return self._application.result_count
|
||||||
|
|
||||||
def get_statistics(self, violation):
|
def get_statistics(self, violation: str) -> List[str]:
|
||||||
"""Get the list of occurrences of a violation.
|
"""Get the list of occurrences of a violation.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue