Replies: 1 comment 1 reply
-
The
This is related to this issue which will be addressed in the next release of pyright.
I can think of a few options:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using watchfiles library and strict checking in Pylance/Pyright. When importing
awatch
function I get a warning that its type is partially unknown:Unknown here comes from
stop_event
in the signature, when navigating to the library code it looks like this:And
AnyEvent
in turn looks like this:The thing is, I don't have
trio
installed in my environment (it's not required bywatchfiles
) sotrio.Event
resolves asUnknown
.My question as a simple user is, why is it
Unknown
and notAny
? For example, mypy resolves the type toAny
:Another related question is why is it
stop_event: Event | Unknown | None = None
and notstop_event: anyio.Event | asyncio.Event | Unknown | None = None
?This is how the signature looks when
trio
is installed:Do you think this should be fixed on
watchfiles
side and if so what would be the best fix? I see that regular syncwatch
is typed withAbstractEvent
protocol, is it the way to go? 🤔Beta Was this translation helpful? Give feedback.
All reactions