From 71271d58e7c094a2b1c27e2c94ada788113b27ab Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Fri, 23 Oct 2020 15:55:12 -0700 Subject: [PATCH] add back in caching --- mypy/find_sources.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mypy/find_sources.py b/mypy/find_sources.py index 8db929eb95ba..20605f727fe5 100644 --- a/mypy/find_sources.py +++ b/mypy/find_sources.py @@ -1,5 +1,6 @@ """Routines for finding the sources that mypy will check""" +import functools import os.path from typing import List, Sequence, Set, Tuple, Optional, Dict @@ -140,6 +141,8 @@ def crawl_up(self, path: str) -> Tuple[str, str]: return module, base_dir + # Add a cache in case many files are passed to mypy + @functools.lru_cache() def crawl_up_dir(self, dir: str) -> Tuple[str, str]: """Given a directory name, return the corresponding module name and base directory.""" parent_dir, base = os.path.split(dir)