David Peter
David Peter
Thank you for reporting this. `__file__` is annotated as having type `str | None` in [typeshed](https://github.com/python/typeshed/blob/ae1b471e5b96d34182b781700b9e277a369f766d/stdlib/types.pyi#L350) because there are modules for which `__file__` is actually `None`, like namespace modules. That...
Thank you for reporting this. Our error message is different from the other type checkers, but it looks like all other type checkers also issue an error. If this should...
I think this would be an appropriate place to use a suppression comment (`# type: ignore` or `# ty: ignore, see https://docs.astral.sh/ty/suppression/).
Looks like this was discussed before: * https://github.com/python/typeshed/issues/1857 * https://github.com/python/mypy/issues/5062 * https://github.com/python/mypy/issues/708
Closing this for now, let me know if anyone thinks there is something we could do in ty to address this.
See https://github.com/astral-sh/ty/issues/908 for a case where this leads to a `unsupported-operator` diagnostic for [`torch.Tensor.__pow__`](https://github.com/pytorch/pytorch/blob/f3913ea641d871f04fa2b6588a77f63efeeb9f10/torch/_tensor.py#L1084-L1092).
I chose to close this for now. I implemented two heuristics to improve the situation here. They are described at the end of [this document](https://github.com/astral-sh/ruff/blob/main/crates/ty_python_semantic/resources/mdtest/call/callables_as_descriptors.md). Together, they removed a lot...
Based on a discussion with Carl: It looks like the remaining inconsistency between ty and mypy/pyright/pyrefly comes from the fact that other type checkers assume that all `FunctionType` attributes exist...
> Another example for this issue: I don't think so, this is different. I wrote a [FAQ entry](https://github.com/astral-sh/ty/pull/2055) just this morning explaining why that is happening. The PR is not...
> Currently the type of a `functools.cached_property` is `Unknown`, as the standardlibrary `functools` does not have type annotations. ty vendors a copy of typeshed, which does include type annotations for...