mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 04:56:54 +00:00
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.
This commit is contained in:
parent
a2b7a7e4c5
commit
c58a4662d8
27 changed files with 1052 additions and 812 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue