mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 18:56:53 +00:00
Merge branch 'comprehensions' into 'master'
Clean up some uses of set, list, and dict See merge request !181
This commit is contained in:
commit
deb4936f5d
8 changed files with 41 additions and 41 deletions
|
|
@ -19,7 +19,7 @@ from flake8 import utils
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
SERIAL_RETRY_ERRNOS = set([
|
||||
SERIAL_RETRY_ERRNOS = {
|
||||
# ENOSPC: Added by sigmavirus24
|
||||
# > On some operating systems (OSX), multiprocessing may cause an
|
||||
# > ENOSPC error while trying to trying to create a Semaphore.
|
||||
|
|
@ -32,7 +32,7 @@ SERIAL_RETRY_ERRNOS = set([
|
|||
# on the lines before the error code and always append your error
|
||||
# code. Further, please always add a trailing `,` to reduce the visual
|
||||
# noise in diffs.
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
class Manager(object):
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ IGNORE = (
|
|||
SELECT = ('E', 'F', 'W', 'C90')
|
||||
MAX_LINE_LENGTH = 79
|
||||
|
||||
TRUTHY_VALUES = set(['true', '1', 't'])
|
||||
TRUTHY_VALUES = {'true', '1', 't'}
|
||||
|
||||
# Other constants
|
||||
WHITESPACE = frozenset(' \t')
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ class Application(object):
|
|||
List of filenames to process
|
||||
"""
|
||||
if self.running_against_diff:
|
||||
files = list(sorted(self.parsed_diff.keys()))
|
||||
files = sorted(self.parsed_diff.keys())
|
||||
self.file_checker_manager.start(files)
|
||||
self.file_checker_manager.run()
|
||||
LOG.info('Finished running')
|
||||
|
|
|
|||
|
|
@ -133,10 +133,10 @@ class MergedConfigParser(object):
|
|||
|
||||
#: Set of types that should use the
|
||||
#: :meth:`~configparser.RawConfigParser.getint` method.
|
||||
GETINT_TYPES = set(['int', 'count'])
|
||||
GETINT_TYPES = {'int', 'count'}
|
||||
#: Set of actions that should use the
|
||||
#: :meth:`~configparser.RawConfigParser.getbool` method.
|
||||
GETBOOL_ACTIONS = set(['store_true', 'store_false'])
|
||||
GETBOOL_ACTIONS = {'store_true', 'store_false'}
|
||||
|
||||
def __init__(self, option_manager, extra_config_files=None, args=None):
|
||||
"""Initialize the MergedConfigParser instance.
|
||||
|
|
|
|||
|
|
@ -17,35 +17,35 @@ import pyflakes.checker
|
|||
from flake8 import utils
|
||||
|
||||
|
||||
FLAKE8_PYFLAKES_CODES = dict([line.split()[::-1] for line in (
|
||||
'F401 UnusedImport',
|
||||
'F402 ImportShadowedByLoopVar',
|
||||
'F403 ImportStarUsed',
|
||||
'F404 LateFutureImport',
|
||||
'F405 ImportStarUsage',
|
||||
'F406 ImportStarNotPermitted',
|
||||
'F407 FutureFeatureNotDefined',
|
||||
'F601 MultiValueRepeatedKeyLiteral',
|
||||
'F602 MultiValueRepeatedKeyVariable',
|
||||
'F621 TooManyExpressionsInStarredAssignment',
|
||||
'F622 TwoStarredExpressions',
|
||||
'F631 AssertTuple',
|
||||
'F701 BreakOutsideLoop',
|
||||
'F702 ContinueOutsideLoop',
|
||||
'F703 ContinueInFinally',
|
||||
'F704 YieldOutsideFunction',
|
||||
'F705 ReturnWithArgsInsideGenerator',
|
||||
'F706 ReturnOutsideFunction',
|
||||
'F707 DefaultExceptNotLast',
|
||||
'F721 DoctestSyntaxError',
|
||||
'F811 RedefinedWhileUnused',
|
||||
'F812 RedefinedInListComp',
|
||||
'F821 UndefinedName',
|
||||
'F822 UndefinedExport',
|
||||
'F823 UndefinedLocal',
|
||||
'F831 DuplicateArgument',
|
||||
'F841 UnusedVariable',
|
||||
)])
|
||||
FLAKE8_PYFLAKES_CODES = {
|
||||
'UnusedImport': 'F401',
|
||||
'ImportShadowedByLoopVar': 'F402',
|
||||
'ImportStarUsed': 'F403',
|
||||
'LateFutureImport': 'F404',
|
||||
'ImportStarUsage': 'F405',
|
||||
'ImportStarNotPermitted': 'F406',
|
||||
'FutureFeatureNotDefined': 'F407',
|
||||
'MultiValueRepeatedKeyLiteral': 'F601',
|
||||
'MultiValueRepeatedKeyVariable': 'F602',
|
||||
'TooManyExpressionsInStarredAssignment': 'F621',
|
||||
'TwoStarredExpressions': 'F622',
|
||||
'AssertTuple': 'F631',
|
||||
'BreakOutsideLoop': 'F701',
|
||||
'ContinueOutsideLoop': 'F702',
|
||||
'ContinueInFinally': 'F703',
|
||||
'YieldOutsideFunction': 'F704',
|
||||
'ReturnWithArgsInsideGenerator': 'F705',
|
||||
'ReturnOutsideFunction': 'F706',
|
||||
'DefaultExceptNotLast': 'F707',
|
||||
'DoctestSyntaxError': 'F721',
|
||||
'RedefinedWhileUnused': 'F811',
|
||||
'RedefinedInListComp': 'F812',
|
||||
'UndefinedName': 'F821',
|
||||
'UndefinedExport': 'F822',
|
||||
'UndefinedLocal': 'F823',
|
||||
'DuplicateArgument': 'F831',
|
||||
'UnusedVariable': 'F841',
|
||||
}
|
||||
|
||||
|
||||
def patch_pyflakes():
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class Statistics(object):
|
|||
:rtype:
|
||||
list(str)
|
||||
"""
|
||||
return list(sorted(set(key.code for key in self._store.keys())))
|
||||
return sorted({key.code for key in self._store.keys()})
|
||||
|
||||
def record(self, error):
|
||||
"""Add the fact that the error was seen in the file.
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ def test_information(system, pyversion, pyimpl):
|
|||
},
|
||||
}
|
||||
option_manager = mock.Mock(
|
||||
registered_plugins=set([('pycodestyle', '2.0.0'),
|
||||
('mccabe', '0.5.9')]),
|
||||
registered_plugins={('pycodestyle', '2.0.0'),
|
||||
('mccabe', '0.5.9')},
|
||||
version='3.1.0',
|
||||
)
|
||||
assert expected == debug.information(option_manager)
|
||||
|
|
|
|||
|
|
@ -209,9 +209,9 @@ def test_extend_default_ignore(optmanager):
|
|||
assert optmanager.extended_default_ignore == set()
|
||||
|
||||
optmanager.extend_default_ignore(['T100', 'T101', 'T102'])
|
||||
assert optmanager.extended_default_ignore == set(['T100',
|
||||
'T101',
|
||||
'T102'])
|
||||
assert optmanager.extended_default_ignore == {'T100',
|
||||
'T101',
|
||||
'T102'}
|
||||
|
||||
|
||||
def test_parse_known_args(optmanager):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue