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
Sebastian Rittau
816a92b8e8
Add Self type var to _typeshed ( #5677 )
...
Cf. #5676
2021-06-22 22:15:27 +02:00
layday
5a256a0c70
Fix sysconfig.get_path return type ( #5659 )
...
`get_path` uses key access and raises `KeyError` for missing keys.
2021-06-18 12:45:23 +02:00
Shantanu
04fb7ceb3c
builtins: add a getattr overload for bool ( #5518 )
...
As brought up in https://github.com/python/typeshed/pull/5516
Alternatives include:
- Use another type var that has a value restriction
- Doing something fancy with Protocols that have a __bool__ that returns
a Literal (which may not work)
- Doing nothing
2021-05-29 07:09:38 -07:00
scaramallion
af33b09bf6
Use __new__ for datetime.timedelta ( #5532 )
2021-05-26 11:05:26 +02:00
scaramallion
a32d24cae0
Use __new__ for datetime.time ( #5530 )
2021-05-26 11:00:37 +03:00
Neil Vyas
8d56328a24
change getattr stubs to better type the default argument and return type ( #5516 )
...
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com >
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-05-21 16:44:11 -07:00
Jukka Lehtosalo
e5459900c0
Make html, ipaddress, reprlib and winreg only available on Python 3 ( #5502 )
...
None of these are available in Python 2.7.
2021-05-19 12:16:10 +01:00
Jukka Lehtosalo
b08a2e6dea
Fix Python 2 genericpath.commonprefix ( #5500 )
...
The more specific overload item should come first. Also
fix the return type.
2021-05-19 12:56:18 +02:00
Sebastian Rittau
f0bf6eebbd
AnyStr cleanup ( #5487 )
...
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.
Part of #5470
2021-05-17 20:45:48 +02:00
Sebastian Rittau
7a9a107a63
Move IdentityFunction to _typeshed ( #5483 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2021-05-17 12:04:35 +02:00
Akuli
17dcea4a68
Akuli and srittau: Remove Python 2 branches from Python 3 stubs ( #5461 )
...
* run script and do some manual changes (Akuli)
* do the whole thing manually (srittau)
* merge changes (Akuli)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz >
2021-05-15 15:33:39 +03:00
Akuli
15b0959cf8
stdlib/@python2: clean imports ( #5453 )
2021-05-15 01:08:37 +02:00
Akuli
5ec4f06263
clean python 3 specific stuff from stdlib/@python2 stubs ( #5451 )
2021-05-15 00:19:05 +02:00
Jelle Zijlstra
a47ee3245a
fix renamed Python 2 modules ( #5450 )
2021-05-14 14:36:00 -07:00
Sebastian Rittau
5b739e0ccb
Split stdlib into Python 2 and 3 versions ( #5442 )
...
All new files in stdlib/@python2 are straight copies of the
corresponding files in stdlib.
2021-05-14 12:04:12 -07:00
Shantanu
a91c89ea94
various path stubs: re-export to reduce duplication ( #5382 )
...
Co-authored-by: hauntsaninja <>
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-05-10 22:27:13 -07:00
Terence Honles
63696823d7
typing: type decorators so they don't count as untyped lines ( #5348 )
2021-05-06 15:57:52 -07:00
Eric Traut
58e083fef9
Marked the bool class as @final because it cannot be subclassed. ( #5286 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2021-05-01 21:38:10 -07:00
Sebastian Rittau
4ac3ccad45
black: enable skip_magic_trailing_comma ( #5252 )
...
* black: enable skip_magic_trailing_comma
* Remove spurious commas
2021-04-27 08:32:32 -07:00
Sebastian Rittau
45916045c8
Upgrade black to 21.4b0 and reformat ( #5250 )
...
This introduces newlines before decorators.
2021-04-26 13:58:27 +02:00
Sebastian Rittau
bac1918b5f
PathLike cleanup ( #5242 )
...
Copy builtins._PathLike to os.PathLike
Use os.PathLike exclusively outside of builtins
2021-04-23 10:15:07 -07:00
Sebastian Rittau
0cea325bc7
Modernize logging ( #5068 )
2021-03-22 19:26:43 -07:00
Sebastian Rittau
08b26b9e8e
Split and restore correct Python 2 version of cgi.pyi ( #5064 )
...
* Split cgi.pyi into Py2 and 3 versions
* Restore correct Python 2 version of cgi.pyi
* Remove unnecessary version checks in cgi.pyi
* Use collections.abc
* Use List in Python 2 stub
2021-02-24 14:46:03 -08:00
Henry Schreiner
e4f239edfd
plat_ver: add missing type annotations ( #5017 )
...
Matches Python 3, and the description here: https://docs.python.org/2.7/library/platform.html#mac-os-platform
2021-02-11 21:02:09 -08:00
Ivan Levkivskyi
16ae4c6120
Re-organize directory structure ( #4971 )
...
See discussion in #2491
Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com >
2021-01-27 12:00:39 +00:00