Skip to content

Commit 3f4872a

Browse files
authored
Merge pull request #1628 from mxr/patch-1
Remove needless sort in `_style_guide_for`
2 parents c7c6218 + b0cad55 commit 3f4872a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/flake8/style_guide.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,10 @@ def populate_style_guides_with(
254254

255255
def _style_guide_for(self, filename: str) -> "StyleGuide":
256256
"""Find the StyleGuide for the filename in particular."""
257-
guides = sorted(
257+
return max(
258258
(g for g in self.style_guides if g.applies_to(filename)),
259259
key=lambda g: len(g.filename or ""),
260260
)
261-
if len(guides) > 1:
262-
return guides[-1]
263-
return guides[0]
264261

265262
@contextlib.contextmanager
266263
def processing_file(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy