Akuli

Results 359 comments of Akuli
trafficstars

You really shouldn't have to care. The type annotation in this case should IMO be something simple that doesn't get in the way, not something full of `None, None` that...

So if I understood correctly, your function looks like this: ``` @contextlib.contextmanager def foo() -> Iterator[int]: return bar() ``` and it broke when `bar()` was changed to return an iterator...

It's technically not wrong: ``` >>> import contextlib >>> @contextlib.contextmanager ... def foo(): ... return iter([1]) ... >>> with foo(): ... print("Hi") ... Hi ``` but this is very unlikely...

Minimal reproducer: ```python3 from typing import * T = TypeVar("T") def f(dict_factory: Callable[[list[tuple[str, Any]]], T]) -> T: ... f(dict) ``` Error: `Argument 1 to "f" has incompatible type "Type[Dict[Any, Any]]";...

https://github.com/python/typeshed/blob/9aa66f0c37a633ed70ee3570778a437b8be82c29/stdlib/typing.pyi#L459-L462 We should probably change `_KT` to `_KT | None` in both overloads. Technically the first argument can be anything that overlaps with `_KT`, but in practice, allowing `None` is...

We could probably make it work well enough in practice by special-casing `None`s.

> false positives for places that use `wraps()` but change the signature These are arguably true positives, as one reason to use `wraps()` is that it copies the signature. A...

Detecting this at type check time doesn't seem to be possible, as it depends on `self.watching` and `self.explicit_transaction`, both of which can change after instantiating: https://github.com/andymccurdy/redis-py/blob/9ed5cd7808789f791fdc7ee368bd268307ac9847/redis/client.py#L1587-L1591 This would be yet...

A possible downside: If the tests of a third-party stub break for some reason, e.g. because a new version of the corresponding non-stub package is released, the problem will remain...