Commit Graph

84 Commits

Author SHA1 Message Date
Amy Pircher
8a07787f48 Add precise overloads for SSLContext.get_ca_certs (#7933) 2022-05-23 17:06:09 -07:00
Jukka Lehtosalo
cd039c9b73 Ignore mypy errors in Python 2 builtins and typing (#7894)
Similar errors are already ignored in Python 3 stubs. The
errors break Python 2 tests of mypy.

See https://github.com/python/typeshed/issues/7367#issuecomment-1131472225
for context.
2022-05-20 15:27:09 +01:00
Alex Waygood
a3245db63c Remove unneeded # noqa comments, fix broken # noqa comments (#7561) 2022-03-28 23:17:44 +02:00
Alex Waygood
1acc8f3bd6 Use PEP 604 syntax wherever possible, part II (#7514)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-19 14:27:35 +00:00
Alex Waygood
340c6c97ed Add mypy error codes to type: ignores, remove unused ignores (#7504)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-19 13:10:00 +00:00
Alex Waygood
4308915e06 Make __hash__ a ClassVar for several classes where it is set to None (#7485) 2022-03-19 05:59:10 -07:00
Marc Mueller
37a981920f Use TypeVar for pkgutil.extend_path (#7473) 2022-03-18 20:44:38 -07:00
Alex Waygood
3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Henry Schreiner
967f83db09 rlcompleter: add attr_matches, global_matches (#7453)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-03-08 00:07:58 +00:00
Nikita Sobolev
1903038adb Backport ossaudiodev availability to @python2 (#7236) 2022-02-16 11:22:51 +01:00
Alex Waygood
4b75ecbbe2 Use Self in Python 2's array.__imul__ (#7167) 2022-02-08 10:54:16 -08:00
Alex Waygood
5f830d023f Backport more Self-related changes to Python 2 (#7166) 2022-02-08 09:52:43 -08:00
Alex Waygood
348c38a0dd Improve __all__ definitions for threading and _dummy_threading modules (#7135) 2022-02-05 08:07:02 -08:00
Alex Waygood
287c8c3d79 Add __all__ to copyreg stubs (#7137) 2022-02-05 07:28:15 -08:00
Alex Waygood
004f12a1eb Add __all__ to _osx_support (#7136) 2022-02-05 07:27:01 -08:00
Alex Waygood
51cdd2c6be Backport many Self-related changes to the Python-2 stdlib (#7128) 2022-02-04 10:10:05 -08:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Alex Waygood
45a2dad83c Reduce use of Any in equality methods (#7081)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-01-30 00:59:00 +02:00
Alex Waygood
99cec2d16b Reduce duplication of code between typing and typing_extensions (#7075) 2022-01-29 07:44:42 -08:00
Alex Waygood
7e79706ddd Clarify why some module-level objects in typing have default values (#7037) 2022-01-28 17:38:25 -08:00
Sebastian Rittau
b87ebc5375 Don't use a literal for TYPE_CHECKING (#7062)
Partly addresses #7061
2022-01-27 23:51:22 -08:00
Alex Waygood
dbb5488b31 Do not use True or False as default values in assignments (#7060) 2022-01-27 13:51:36 -08:00
Alex Waygood
f7a7e0b386 Improve unittest.removeHandler in Python 2 (#7055)
This brings the signature in line with the signature of `removeHandler` in Python 3:

a54e21992c/stdlib/unittest/signals.pyi (L11-L14)
2022-01-27 09:04:18 -08:00
Alex Waygood
2d8decd237 Backport many ParamSpec-related changes to Python 2 (#7054) 2022-01-27 07:57:26 -08:00
Tom Parker-Shemilt
01510448a9 Python 2: io.IOBase.readline accepts None (#7041) 2022-01-26 11:32:20 +02:00
Alex Waygood
5d07ebc864 Use PEP 585 syntax in typing and typing_extensions, and remove module-level defaults where possible (#7036) 2022-01-25 16:13:36 +01:00
Nikita Sobolev
9a89e09753 Removed unused # noqa: F403 (#7032) 2022-01-25 09:21:11 +01:00
Jelle Zijlstra
de5ec6a0d1 fix incorrect tuple[T] (#6996)
Found from PyCQA/flake8-pyi#135.
2022-01-22 09:37:14 -08:00
Alex Waygood
bcd9ca47f6 Remove unneeded # noqa comment (#6979) 2022-01-20 14:11:23 +01:00
Christian Bundy
4d085fbfc1 Fix strtobool type annotation (#6970)
Problem: strtobool returns either 0 or 1, not bool.

Solution: Fix type annotation.
2022-01-19 21:57:47 -08:00
Alex Waygood
aea52b35d1 Remove nearly all __str__ and __repr__ methods from typeshed (#6968) 2022-01-20 00:45:11 +01:00
Alex Waygood
cd93461225 Use PEP 585 syntax in @python2/_ast, convert more TypeVars to _typeshed.Self, & # noqa a SQLAlchemy line (#6954)
* Manual fixes for `_ast` and `SQLAlchemy`

* Change more `TypeVar`s to `Self`, using script
2022-01-18 11:15:34 -08:00
Alex Waygood
8af5e0d340 Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949) 2022-01-18 07:14:03 -08:00
Alex Waygood
6a88d5e7ae Use _typeshed.Self in Python 2, too (#6932) 2022-01-16 14:44:51 -08:00
Jelle Zijlstra
0949e9e90d remove quoted strings (#6933) 2022-01-16 14:29:13 -08:00
Jelle Zijlstra
339bfbbfaa remove "= ..." from top-level values (#6930) 2022-01-16 18:38:00 +02:00
Alex Waygood
425ba77bb2 Remove even more unused TypeVars (#6928) 2022-01-16 08:07:32 -08:00
Alex Waygood
af8e37d273 Add # noqa comments to typing.AnyStr (#6925)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-01-16 14:23:22 +02:00
Nikita Sobolev
35c1d4f879 Remove __slots__ from builtins.object (#6800) 2022-01-09 18:27:24 +02:00
Julien Danjou
1bfcf30a50 FrameType.f_lineno can be None (#6769) 2022-01-02 16:26:58 +01:00
Nikita Sobolev
6da5eb2d04 Backport platform specific code to python2 (#6772) 2022-01-01 13:26:20 +01:00
Nikita Sobolev
f65d93618d Mark bdist_msi to be Windows-only on python2 (#6768) 2021-12-31 13:15:47 +01:00
Numerlor
1ae4adac4b Fix ctypes.FormatError code parameter to be optional (#6635) 2021-12-20 15:30:24 -08:00
Stephen Rosen
df0a724c0f Always import Protocol from typing in stubs (#6617) 2021-12-17 13:12:22 +01:00
Jukka Lehtosalo
25649bc1e5 Add getattr overload variants to help mypy type inference (#6355)
These silence errors about missing type annotations for calls
like these:

```
x = getattr(o, 'a', [])
y = getattr(o, 'b', {})
```

This is basically a generalization of #5518 and other overloads we already
have.

This works around python/mypy#11572. I encountered the issue in several
places when testing recent typeshed against an internal repo.
2021-11-22 11:08:40 +00:00
Nikita Sobolev
a2f0dbfb2b Do not use ClassVars with generic variables (#6348) 2021-11-21 07:20:05 -08:00
Alex Waygood
fbb89f9fd5 Fix isort w.r.t. _ast/_collections_abc/_tracemalloc/_warnings (#6329) 2021-11-17 08:29:44 -08:00
Jukka Lehtosalo
25ba2bad06 logging: Make LoggerAdapter and StreamHandler generic in Python 2 (#6330)
Without this writing straddling code is quite tricky, as these are
generic in Python 3.
2021-11-17 16:28:44 +00:00
luzpaz
b95b729b9e Fix typos (#6263)
Found via `codespell -q 3 -L alo,asend,ba,nams,spawnve`
2021-11-08 18:23:15 -08:00
Marti Raudsepp
c38c03bab8 builtins: next() does not allow keyword args for default (#6169) 2021-10-14 09:51:58 +02:00