mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 02:46:52 +00:00
Merge branch 'keys' into 'master'
Prefer iter(dict) instead of dict.keys() See merge request !186
This commit is contained in:
commit
ec5405d2a8
5 changed files with 6 additions and 6 deletions
|
|
@ -261,7 +261,7 @@ class Application(object):
|
|||
List of filenames to process
|
||||
"""
|
||||
if self.running_against_diff:
|
||||
files = sorted(self.parsed_diff.keys())
|
||||
files = sorted(self.parsed_diff)
|
||||
self.file_checker_manager.start(files)
|
||||
self.file_checker_manager.run()
|
||||
LOG.info('Finished running')
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@ def install(option, option_string, value, parser):
|
|||
|
||||
def choices():
|
||||
"""Return the list of VCS choices."""
|
||||
return list(_INSTALLERS.keys())
|
||||
return list(_INSTALLERS)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class TrieNode(object):
|
|||
if not self.children:
|
||||
return
|
||||
|
||||
for prefix in sorted(self.children.keys()):
|
||||
for prefix in sorted(self.children):
|
||||
child = self.children[prefix]
|
||||
yield child
|
||||
for child in child.traverse():
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class Statistics(object):
|
|||
:rtype:
|
||||
list(str)
|
||||
"""
|
||||
return sorted({key.code for key in self._store.keys()})
|
||||
return sorted({key.code for key in self._store})
|
||||
|
||||
def record(self, error):
|
||||
"""Add the fact that the error was seen in the file.
|
||||
|
|
@ -55,7 +55,7 @@ class Statistics(object):
|
|||
:returns:
|
||||
Generator of instances of :class:`Statistic`
|
||||
"""
|
||||
matching_errors = sorted(key for key in self._store.keys()
|
||||
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]
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class FakePluginTypeManager(manager.NotifierBuilderMixin):
|
|||
|
||||
def __init__(self, manager):
|
||||
"""Initialize with our fake manager."""
|
||||
self.names = sorted(manager.keys())
|
||||
self.names = sorted(manager)
|
||||
self.manager = manager
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue