-
Notifications
You must be signed in to change notification settings - Fork 210
Description
Describe the Bug
When letting pyrefly suggest type annotations on code that imports re and calls functions like re.compile, the suggested annotation do not include the full module name, at least not in VSCode.
I would have expected that if I import re, and use re.compile(), the inferred type would be re.Pattern, instead of Pattern. What if I'm also using another package that has a different something also called Pattern? I see that same pattern with argparse. If I import argparse and say ap = argparse.ArgumentParser(), the inferred type is ArgumentParser, not argparse.ArgumentParser, and the type of ap.parse_args() is inferred as NameSpace, not argparse.NameSpace.
Also, what do you think about automatically importing Any with from typing import Any if I haven't already done so and pyrefly is suggesting list[Any]? If I accept that suggestion without having imported Any, VSCode tells me it "Could not find name AnyPyrefly(unknown-name)"
Sandbox Link
(Only applicable for extension issues) IDE Information
Pyrefly 0.16.1, Code 1.100.2-1747260578, Python 3.12.3, on Ubuntu 24LTS in case that matters.
