Anyone know why Python string import inference rej...
# development
b
Anyone know why Python string import inference rejects middle dirs that are capitalized? E.g.
a.B.c
1
Copy code
>>> x = re.compile(r"^([a-z_][a-z_\d]*\.){2,}[a-zA-Z_]\w*$", re.UNICODE)
>>> x.match("a.b.c")
<re.Match object; span=(0, 5), match='a.b.c'>
>>> x.match("a.B.c")
>>>
b
Right, but why did we make that regex so? Is it on purpose?
I'm porting the behavior so I wanna make sure I'm not missing something obvious
f
that I do not know
b
git blame
time
c
if
import a.B.c
is a valid thing, then this seems like a bug to me
b
Yeah I can't see why not. Bugs going to be fixed soon
👍 1
h
The whole thing is a heuristic, and that capitalization is very non-standard (although, of course, allowed), so it seemed like the odds of it being a false positive were higher than it being a false negative.
So it's not a "bug" per se, just an attempt to keep the heuristic contained.
Maybe the alternative is better, maybe not
b
The new world will be very permissive, as if we're wrong we just silently ignore the string
Assets are much more false-positive likely, but still. Likelihood should be low since string == target