-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Cache package names in create_source_list #4848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's refactor this so that crawl_up()
etc. are methods on a new class that owns the package cache and wraps the fscache.
mypy/find_sources.py
Outdated
|
||
parent_dir, base = os.path.split(dir) | ||
if not dir or not get_init_file(fscache, dir) or not base: | ||
return '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this result should not be cached?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two nits.
mypy/find_sources.py
Outdated
mod = base | ||
else: | ||
mod = base + '.' + mod | ||
Use package_cache to cache results.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the """ to the next line (by itself). There's no need for a subsequent blank line then.
mypy/find_sources.py
Outdated
|
||
def expand_dir(self, arg: str, mod_prefix: str = '') -> List[BuildSource]: | ||
"""Convert a directory name to a list of sources to build.""" | ||
f = get_init_file(self.fscache, arg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps make get_init_file() also a method here? (Since it uses fscache.)
On my testing MBP, this shaves about 200ms off of every fine-grained check of S.