summaryrefslogtreecommitdiff
path: root/src/flake8/statistics.py
diff options
context:
space:
mode:
authorIan Stapleton Cordasco <graffatcolmingov@gmail.com>2018-10-20 07:31:42 -0500
committerIan Stapleton Cordasco <graffatcolmingov@gmail.com>2018-10-20 12:37:14 -0500
commitc58a4662d8920cf70ea688edd9eaf9d783a856a7 (patch)
tree6dda552de1b7250ccd1347a7ebc62dc69b9ff0c0 /src/flake8/statistics.py
parenta2b7a7e4c590d73acc77a17ff8b0450e3b9b81d8 (diff)
downloadflake8-c58a4662d8920cf70ea688edd9eaf9d783a856a7.tar.gz
Use black to reformat Flake8
Instead of just using Flake8 and pylint to keep Flake8 clean, let's also use black to make it less manual for clean-up.
Diffstat (limited to 'src/flake8/statistics.py')
-rw-r--r--src/flake8/statistics.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/flake8/statistics.py b/src/flake8/statistics.py
index d39750a..f2131b5 100644
--- a/src/flake8/statistics.py
+++ b/src/flake8/statistics.py
@@ -56,13 +56,14 @@ class Statistics(object):
:returns:
Generator of instances of :class:`Statistic`
"""
- matching_errors = sorted(key for key in self._store
- if key.matches(prefix, filename))
+ matching_errors = sorted(
+ key for key in self._store if key.matches(prefix, filename)
+ )
for error_code in matching_errors:
yield self._store[error_code]
-class Key(collections.namedtuple('Key', ['filename', 'code'])):
+class Key(collections.namedtuple("Key", ["filename", "code"])):
"""Simple key structure for the Statistics dictionary.
To make things clearer, easier to read, and more understandable, we use a
@@ -75,10 +76,7 @@ class Key(collections.namedtuple('Key', ['filename', 'code'])):
@classmethod
def create_from(cls, error):
"""Create a Key from :class:`flake8.style_guide.Violation`."""
- return cls(
- filename=error.filename,
- code=error.code,
- )
+ return cls(filename=error.filename, code=error.code)
def matches(self, prefix, filename):
"""Determine if this key matches some constraints.
@@ -94,9 +92,9 @@ class Key(collections.namedtuple('Key', ['filename', 'code'])):
:rtype:
bool
"""
- return (self.code.startswith(prefix) and
- (filename is None or
- self.filename == filename))
+ return self.code.startswith(prefix) and (
+ filename is None or self.filename == filename
+ )
class Statistic(object):