TYP: add pyrefly#695
Conversation
| ctx: contextlib.AbstractContextManager[object] | ||
| ctx: ( | ||
| contextlib.AbstractContextManager[object] | ||
| | contextlib.AbstractContextManager[None] | ||
| ) |
There was a problem hiding this comment.
pyrefly is not happy for contextlib.nullcontext() to fall under contextlib.AbstractContextManager[object]
There was a problem hiding this comment.
Sounds like a bug in Pyrefly, because the first typar of AbstractContextManager is supposed to be covariant: https://github.com/python/typeshed/blob/eec9fe9aa9ce87df8987de5c1401f743e179378a/stdlib/contextlib.pyi#L48
Do you want to report it or should I?
There was a problem hiding this comment.
Go for it if you're happy to!
There was a problem hiding this comment.
| assert is_array_api_obj(x) | ||
| assert is_array_api_strict_namespace(xp) | ||
| x = cast(Array, x) |
There was a problem hiding this comment.
otherwise x stays narrowed by TypeGuard[_ArrayApiObj], where:
Argument type is partially unknown
Argument corresponds to parameter "x" in function "is_cupy_array"
Argument type is "ndarray[tuple[Any, ...], dtype[Any]] | Unknown | Array | SupportsArrayNamespace[Any]
| import array_api_strict as xp | ||
| from numpy.testing import assert_array_equal | ||
|
|
||
| from vendor_tests.array_api_compat.common._typing import ( # type: ignore[import-not-found] |
There was a problem hiding this comment.
maybe we should be cloning the vendored libraries into place for the static analysis — not sure
| import dask | ||
|
|
||
| metas: list[Array] = [arg._meta for arg in array_args] # pylint: disable=protected-access # pyright: ignore[reportAttributeAccessIssue] | ||
| metas: list[Array] = [arg._meta for arg in array_args] # pylint: disable=protected-access # pyright: ignore[reportAttributeAccessIssue] # pyrefly: ignore[missing-attribute] |
There was a problem hiding this comment.
If you want to avoid long lines, then this should also do the trick I believe:
| metas: list[Array] = [arg._meta for arg in array_args] # pylint: disable=protected-access # pyright: ignore[reportAttributeAccessIssue] # pyrefly: ignore[missing-attribute] | |
| # pyrefly: ignore[missing-attribute] | |
| metas: list[Array] = [arg._meta for arg in array_args] # pylint: disable=protected-access # pyright: ignore[reportAttributeAccessIssue] |
There was a problem hiding this comment.
could do, but tbh I don't mind long lines as long as they are just comments to the machine
lucascolley
left a comment
There was a problem hiding this comment.
I guess I'll merge this if it seems alright @jorenham ?
|
thanks Joren |
@jorenham could I possibly interest you to review?
closes gh-694