Describe the Bug
pyrefly 1.2.0 produces the following:
$ pyrefly check --preset all example.py
ERROR `Tensor` is not exported from module `torch` [implicit-reexport]
--> example.py:1:19
|
1 | from torch import Tensor
| ^^^^^^
|
`Tensor` is imported by `torch` but not re-exported (via `import ... as Tensor`, `__all__`, or a wildcard import)
INFO 1 error
torch/__init__.py does include Tensor in __all__ at the beginning of the file:
__all__ = [
...
"Tensor",
...
]
But then has the following import in the middle of the file (1900 lines down):
from torch._tensor import Tensor # usort: skip
My guess is that the order of __all__ and this import is causing pyrefly to incorrectly mark it as implicit.
Sandbox Link
No sandbox due to torch
(Only applicable for extension issues) IDE Information
No response
Describe the Bug
pyrefly1.2.0 produces the following:torch/__init__.pydoes includeTensorin__all__at the beginning of the file:But then has the following import in the middle of the file (1900 lines down):
My guess is that the order of
__all__and this import is causingpyreflyto incorrectly mark it as implicit.Sandbox Link
No sandbox due to torch
(Only applicable for extension issues) IDE Information
No response