Skip to content

Commit

Permalink
Merge pull request #1628 from mxr/patch-1
Browse files Browse the repository at this point in the history
Remove needless sort in `_style_guide_for`
  • Loading branch information
asottile committed Jul 31, 2022
2 parents c7c6218 + b0cad55 commit 3f4872a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/flake8/style_guide.py
Expand Up @@ -254,13 +254,10 @@ def populate_style_guides_with(

def _style_guide_for(self, filename: str) -> "StyleGuide":
"""Find the StyleGuide for the filename in particular."""
guides = sorted(
return max(
(g for g in self.style_guides if g.applies_to(filename)),
key=lambda g: len(g.filename or ""),
)
if len(guides) > 1:
return guides[-1]
return guides[0]

@contextlib.contextmanager
def processing_file(
Expand Down

0 comments on commit 3f4872a

Please sign in to comment.