typeshed
typeshed copied to clipboard
Collection of library stubs for Python, with static types
When we submitted PR that adds the `stdlib/_ctypes.pyi`(#8582), imports some stuffs from `ctypes`. But [the implementation imports some stuffs from `_ctypes` to `ctypes`](https://github.com/python/cpython/blob/0ace820bec8892d621a4aadc1feb6c56e25560bf/Lib/ctypes/__init__.py#L8-L14). - also related to https://github.com/python/typeshed/issues/8571#issuecomment-1221316973 However, trying...
```python from datetime import date from dateutil.rrule import MONTHLY, rrule datetimes = [dt for dt in rrule(MONTHLY, dtstart=date(2001, 1, 1), until=date(2005, 1, 1))] reveal_type(datetimes) # Revealed type is "builtins.list[Any]" ```
I've encountered cases where the changes from `int` to a literal type in stubs causes regressions for mypy users. Here's one (simplified) example: ```py import logging class C: def __init__(self)...
_Originally posted [here](https://github.com/python/mypy/issues/4128#issuecomment-1196762683)_ Let me know if I need to scope this better. Even if this gets closed, it's also fine - if you have a better scope / new...
now: `_ECT = Callable[[Optional[Type[_CData]], _FuncPointer, Tuple[_CData, ...]], _CData]` should be: `_ECT = Callable[[Optional[_CData], _FuncPointer, Tuple[_CData, ...]], _CData]` Because, at least, the return type of this function must be the same...
An extension of #2566, seems like the typings for `parse_known_args`, `parse_intermixed_args`, `parse_known_intermixed_args` (and the undocumented `_parse_known_args`) of `argparse.ArgumentParser` were overlooked, as they all share the same pattern as `parse_args` for...
#6858 added stubs for urllib3. It might have been a mistake, because urllib3 seems to have its own type annotations and even a `py.typed` marker, making the stubs unnecessary.
Consider the following: ```python3 names: set[str] = {"a", "b"} name: str | None = None names.discard(name) ``` It would be nice if this wasn't a type checker error. Unlike `.remove()`,...
The type of the first parameter of `http.server.BaseHTTPRequestHandler.__init__` shall be `socketserver._RequestType`, not `bytes`. To fix this issue, simply remove the `__init__` method and make `BaseHTTPRequestHandler` inherit from `StreamRequestHandler`.