mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-09 22:34:17 +00:00
fix memory leak caused by lru_cache of a method
This commit is contained in:
parent
94ed800b2a
commit
befc26f78e
1 changed files with 5 additions and 2 deletions
|
|
@ -240,6 +240,10 @@ class StyleGuideManager:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.style_guide_for = functools.lru_cache(maxsize=None)(
|
||||||
|
self._style_guide_for
|
||||||
|
)
|
||||||
|
|
||||||
def populate_style_guides_with(
|
def populate_style_guides_with(
|
||||||
self, options: argparse.Namespace
|
self, options: argparse.Namespace
|
||||||
) -> Generator["StyleGuide", None, None]:
|
) -> Generator["StyleGuide", None, None]:
|
||||||
|
|
@ -256,8 +260,7 @@ class StyleGuideManager:
|
||||||
filename=filename, extend_ignore_with=violations
|
filename=filename, extend_ignore_with=violations
|
||||||
)
|
)
|
||||||
|
|
||||||
@functools.lru_cache(maxsize=None)
|
def _style_guide_for(self, filename: str) -> "StyleGuide":
|
||||||
def style_guide_for(self, filename: str) -> "StyleGuide":
|
|
||||||
"""Find the StyleGuide for the filename in particular."""
|
"""Find the StyleGuide for the filename in particular."""
|
||||||
guides = sorted(
|
guides = sorted(
|
||||||
(g for g in self.style_guides if g.applies_to(filename)),
|
(g for g in self.style_guides if g.applies_to(filename)),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue