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
if source looks like a package add it to source_pkgs #1030
Conversation
I don't understand what the re.match is trying to determine. Can you write a few sentences (docs?) about what this change does? |
even if it's a dir too
b9f6189
to
9f0bde7
Compare
@@ -108,6 +110,14 @@ def module_has_file(mod): | |||
return os.path.exists(mod__file__) | |||
|
|||
|
|||
_IS_PKG_RE = re.compile( |
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.
on python3.8 _IS_PKG_RE is
re.compile(r"\A(((?!False|None|True|and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\w+)\.?)+\Z")
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.
a bit like:
all(s.isidentifier() and not keyword.iskeyword(s) for s in v.split("."))
but s.isidentifier()
is not on python2 and the RE is faster
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.
@nedbat something like this?
_IS_PKG_RE = re.compile( | |
# a dot delimited string of names that are not keywords | |
_module_name_re = re.compile( |
This seems like too much guessing to me. And it would change the behavior of |
Yep, makes sense |
an alternative to #1026 in which ambiguous
source
definitions use the package and the dir