summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2021-04-18 09:17:48 -0700
committerAnthony Sottile <asottile@umich.edu>2021-04-18 09:23:48 -0700
commitaf1668bf04079b1a8db5910a5e3697c7c8db8fc9 (patch)
tree65405b4d3c2c5e1a90fa5eb3d7c8d6b7d4c18c68 /src
parenta7174759e9a651405ef37db511ac1168e3bbdec5 (diff)
downloadflake8-af1668bf04079b1a8db5910a5e3697c7c8db8fc9.tar.gz
extend black formatting to tests as well
Diffstat (limited to 'src')
-rw-r--r--src/flake8/__init__.py4
-rw-r--r--src/flake8/checker.py4
-rw-r--r--src/flake8/exceptions.py4
-rw-r--r--src/flake8/options/config.py4
-rw-r--r--src/flake8/plugins/manager.py3
-rw-r--r--src/flake8/processor.py4
-rw-r--r--src/flake8/style_guide.py10
-rw-r--r--src/flake8/utils.py7
8 files changed, 10 insertions, 30 deletions
diff --git a/src/flake8/__init__.py b/src/flake8/__init__.py
index fb9cec5..b2df39d 100644
--- a/src/flake8/__init__.py
+++ b/src/flake8/__init__.py
@@ -17,9 +17,7 @@ LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())
__version__ = "3.9.1"
-__version_info__ = tuple(
- int(i) for i in __version__.split(".") if i.isdigit()
-)
+__version_info__ = tuple(int(i) for i in __version__.split(".") if i.isdigit())
# There is nothing lower than logging.DEBUG (10) in the logging library,
diff --git a/src/flake8/checker.py b/src/flake8/checker.py
index 6f8c0c1..bfd3f4d 100644
--- a/src/flake8/checker.py
+++ b/src/flake8/checker.py
@@ -241,9 +241,7 @@ class Manager:
"""
results_reported = results_found = 0
for checker in self._all_checkers:
- results = sorted(
- checker.results, key=lambda tup: (tup[1], tup[2])
- )
+ results = sorted(checker.results, key=lambda tup: (tup[1], tup[2]))
filename = checker.display_name
with self.style_guide.processing_file(filename):
results_reported += self._handle_results(filename, results)
diff --git a/src/flake8/exceptions.py b/src/flake8/exceptions.py
index a8d2f6e..4b0ddd1 100644
--- a/src/flake8/exceptions.py
+++ b/src/flake8/exceptions.py
@@ -39,9 +39,7 @@ class InvalidSyntax(Flake8Exception):
def __init__(self, exception: Exception) -> None:
"""Initialize our InvalidSyntax exception."""
self.original_exception = exception
- self.error_message = (
- f"{type(exception).__name__}: {exception.args[0]}"
- )
+ self.error_message = f"{type(exception).__name__}: {exception.args[0]}"
self.error_code = "E902"
self.line_number = 1
self.column_number = 0
diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py
index 0a2ee63..e920e58 100644
--- a/src/flake8/options/config.py
+++ b/src/flake8/options/config.py
@@ -369,6 +369,4 @@ def get_local_plugins(config_finder):
return local_plugins
-LocalPlugins = collections.namedtuple(
- "LocalPlugins", "extension report paths"
-)
+LocalPlugins = collections.namedtuple("LocalPlugins", "extension report paths")
diff --git a/src/flake8/plugins/manager.py b/src/flake8/plugins/manager.py
index 3779b20..6f32e1f 100644
--- a/src/flake8/plugins/manager.py
+++ b/src/flake8/plugins/manager.py
@@ -472,8 +472,7 @@ class Checkers(PluginTypeManager):
plugin.to_dictionary() for plugin in self.logical_line_plugins
],
"physical_line_plugins": [
- plugin.to_dictionary()
- for plugin in self.physical_line_plugins
+ plugin.to_dictionary() for plugin in self.physical_line_plugins
],
}
diff --git a/src/flake8/processor.py b/src/flake8/processor.py
index 5fd78a8..86709c1 100644
--- a/src/flake8/processor.py
+++ b/src/flake8/processor.py
@@ -289,9 +289,7 @@ class FileProcessor:
except (tokenize.TokenError, SyntaxError) as exc:
raise exceptions.InvalidSyntax(exception=exc)
- def _noqa_line_range(
- self, min_line: int, max_line: int
- ) -> Dict[int, str]:
+ def _noqa_line_range(self, min_line: int, max_line: int) -> Dict[int, str]:
line_range = range(min_line, max_line + 1)
joined = "".join(self.lines[min_line - 1 : max_line])
return dict.fromkeys(line_range, joined)
diff --git a/src/flake8/style_guide.py b/src/flake8/style_guide.py
index d862691..aca743a 100644
--- a/src/flake8/style_guide.py
+++ b/src/flake8/style_guide.py
@@ -368,9 +368,7 @@ class StyleGuideManager:
:rtype:
:class:`~flake8.style_guide.StyleGuide`
"""
- per_file = utils.parse_files_to_codes_mapping(
- options.per_file_ignores
- )
+ per_file = utils.parse_files_to_codes_mapping(options.per_file_ignores)
for filename, violations in per_file:
yield self.default_style_guide.copy(
filename=filename, extend_ignore_with=violations
@@ -579,11 +577,7 @@ class StyleGuide:
)
is_not_inline_ignored = error.is_inline_ignored(disable_noqa) is False
is_included_in_diff = error.is_in(self._parsed_diff)
- if (
- error_is_selected
- and is_not_inline_ignored
- and is_included_in_diff
- ):
+ if error_is_selected and is_not_inline_ignored and is_included_in_diff:
self.formatter.handle(error)
self.stats.record(error)
return 1
diff --git a/src/flake8/utils.py b/src/flake8/utils.py
index 96c3485..9c46359 100644
--- a/src/flake8/utils.py
+++ b/src/flake8/utils.py
@@ -271,13 +271,10 @@ def parse_unified_diff(diff: Optional[str] = None) -> Dict[str, Set[int]]:
# comparing.
if hunk_match:
(row, number_of_rows) = [
- 1 if not group else int(group)
- for group in hunk_match.groups()
+ 1 if not group else int(group) for group in hunk_match.groups()
]
assert current_path is not None
- parsed_paths[current_path].update(
- range(row, row + number_of_rows)
- )
+ parsed_paths[current_path].update(range(row, row + number_of_rows))
# We have now parsed our diff into a dictionary that looks like:
# {'file.py': set(range(10, 16), range(18, 20)), ...}