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
David Robertson
498f1aa41d
Mark sqlite3.Cursor.rowcount as an int ( #6150 )
2021-10-11 14:54:30 +02:00
SupImDos
e4c2c0f302
Add SysLogHandler.address attribute ( #6037 )
2021-09-14 13:58:02 +02:00
Bas van Beek
a1ca55037a
Update the xxhash and hashlib stubs ( #6031 )
...
* `name`, `block_size`, `digest_size` and `digestsize` attributes of hash objects were made read-only.
* It is now a type-checking error to subclass `xxhash` classes, such as `xxhash.xxh32`. Previously it was an error only at runtime.
* `xxhash` functions now accept strings as input and any object with `__index__()` method for `seed` (instead of requiring an integer). They also fail the type checking if no arguments are given.
2021-09-14 12:01:11 +03:00
Oleg Höfling
ff63953188
Switch to PEP-604 syntax in python2 stubs ( #5915 )
...
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com >
2021-08-14 11:12:30 +02:00
Akuli
e3f662b648
switch to lower-case "# undocumented" comments ( #5871 )
2021-08-07 08:00:41 -07:00
Ran Benita
2d0f3c5211
python2/tempfile: dir argument can be None ( #5836 )
2021-08-02 11:36:19 +02:00
Anton Grübel
c38171a0b3
Use _typeshed.Self with __enter__ ( #5712 )
2021-06-29 15:19:25 -07:00
Charly C
389b92cb04
fix the stub files for the stdlib mmap module ( #5705 )
...
In Python 3:
- The `mmap` type is `Iterable[int]`, not `Iterable[bytes]`.
- The `read_byte` method returns an `int`, and the `write_byte` method only accepts an `int` as its first and only argument.
- The `__setitem__` method accepts any `ReadableBuffer` object, not just `bytes`.
In both Python 2 and 3:
- The `__delitem__` method always raises a `TypeError`, so the proper return type is `NoReturn`.
- The `mmap` type isn't generic, so I've simplified the stubs by removing the unnecessary `_mmap` class.
2021-06-29 08:01:32 -07:00
Thomas Grainger
2cd7e6511b
fix abcmeta.ABCMeta type ( #5688 )
...
Add __abstractmethods__, __instancecheck__ and __subclasscheck__
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-06-24 16:56:09 +03:00