-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
If I write an annotation using sqlalchemy and then using --verifytypes with --ignoreexternal, the sqlalchemy symbol may still end up being reported as unknown, depending on how the annotation was written
Code or Screenshots
My file foo/__init__.py:
class NDFrame:
def to_sql_1(
self,
con,
) -> None:
return None
def to_sql_2(
self,
con,
) -> None:
return NoneMy file foo/__init__.pyi:
from sqlalchemy.engine import Connectable
import sqlalchemy.engine
class NDFrame:
def to_sql_1(
self,
con: str | Connectable,
) -> None: ...
def to_sql_2(
self,
con: str | sqlalchemy.engine.Connectable,
) -> None: ...The annotations should in theory be identical, as far as I understand.
However, if I run pyright --verifytypes foo --ignoreexternal, I get:
Module name: "foo"
Package directory: "/home/marcogorelli/tmp-repo/foo"
Module directory: "/home/marcogorelli/tmp-repo/foo"
Path of py.typed file: "/home/marcogorelli/tmp-repo/foo/py.typed"
Public modules: 1
foo
Symbols used in public interface:
foo.NDFrame.to_sql_2
/home/marcogorelli/tmp-repo/foo/__init__.pyi:11:9 - error: Type of parameter "con" is partially unknown
Parameter type is "str | Unknown"
Symbols exported by "foo": 3
With known type: 1
With ambiguous type: 0
With unknown type: 2
(Ignoring unknown types imported from other packages)
Other symbols referenced but not exported by "foo": 0
With known type: 0
With ambiguous type: 0
With unknown type: 0
Symbols without documentation:
Functions without docstring: 2
Functions without default param: 0
Classes without docstring: 1
Type completeness score: 33.3%
Completed in -0.202sec
Note how:
conis treated fine (ignored by--ignoreexternal) into_sql_1- but not in
to_sql_2where it showsType of parameter "con" is partially unknown
VS Code extension or command-line
$ pyright --version
pyright 1.1.407Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working