Gabe Joseph
92aecadf6b
Memoryview.cast: shape= can be tuple of any number of ints (#5918 )
2021-08-13 00:04:35 +02:00
Bas van Beek
7edad1034e
Use a typevar in object.__new__ ( #5891 )
2021-08-08 20:45:22 +02:00
Akuli
ce11072dbe
Big diff: use lower-case list and dict ( #5888 )
2021-08-08 09:26:35 -07:00
Akuli
ef5b4b6820
setattr: Any --> object ( #5877 )
2021-08-08 11:12:23 +02:00
Akuli
ee487304d7
Big diff: Use new "|" union syntax ( #5872 )
2021-08-08 11:05:21 +02:00
Ron Frederick
309e7bda32
Update builtins.pyi ( #5874 )
...
Change getattr/hasattr first argument from Any to object
Fixes #5848
2021-08-07 20:46:03 -07:00
Bas van Beek
475417fa97
Mark final and unhashable classes in types as such ( #5837 )
2021-08-02 13:46:14 -07:00
Bas van Beek
7c37d6117d
Allow reversed to take any object implementing __len__ and __getitem__ ( #5820 )
...
`reversed` is currently annotated as accepting either a `Sequence` or objects implementing the `__reversed__` protocol.
This however is too strict as, per its [docs](https://docs.python.org/3/library/functions.html#reversed ), it can take any object that implements `__len__` and `__getitem__`.
2021-07-29 07:48:14 -07:00
Bas van Beek
5e23e2c19a
Use SupportsIndex where applicable in builtins.pyi ( #5739 )
...
* Use `SupportsIndex` where applicable in `builtins.pyi`
* Remove `None` from the `int.__round__` ndigits parameter
2021-07-09 13:08:19 +03:00
Akuli
b06352556d
Use Literal["little", "big"] for byteorder ( #5715 )
2021-06-30 13:15:50 -07:00
Anton Grübel
c38171a0b3
Use _typeshed.Self with __enter__ ( #5712 )
2021-06-29 15:19:25 -07:00
Bas van Beek
50f5858a56
Use SupportsIndex where applicable for 5 classes ( #5694 )
...
Use `SupportsIndex` where applicable:
* `str`
* `bytes`
* `bytearray`
* `memoryview`
* `markupsafe.Markup`
2021-06-26 19:05:40 +03:00
Sebastian Speitel
04d81a8499
Allow merging dicts of different types ( #5520 )
2021-06-16 06:03:15 -07:00
Ethan Smith
cb76f32826
Allow passing complex to complex constructor ( #5609 )
2021-06-09 22:58:22 +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
Jelle Zijlstra
c4da3757d7
Improve tuple.__add__ type ( #5522 )
...
Noticed this while browsing the stub. This feels safe but we'll see what mypy-primer has to say.
2021-05-26 22:17:30 +02: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
Andrey
dbaaa3a103
PEP 604: Add ror operator and modify isinstance and subclass ( #5509 )
...
Add operators or and ror for types.Union and ror to the type class.
Also, add modified isinstance and issubclass signatures to support old-style and new-style unions inside.
2021-05-21 16:30:27 -07:00
Sebastian Rittau
acca3181ed
Improve dict.fromkeys() with None value ( #5514 )
...
Closes : #5512
2021-05-21 20:30:33 +03: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
Adrian Freund
a2058829fa
Make memoryview inherit from Sequence ( #5393 )
2021-05-10 12:46:17 +02:00
sachindavra
1048250c04
ror implementation ( #5369 )
...
Signed-off-by: sachindavra <raju.davra@gmail.com >
2021-05-07 21:10:07 +03:00
James
dbaf4c6390
Improve `type.__new__` ( #5331 )
...
Fixes #3386
2021-05-03 18:33:29 -07:00
Shantanu
1517438aba
builtins: more updates for py310 ( #5290 )
2021-05-01 21:58:39 -07:00
Shantanu
0ea437f02a
builtins: use SupportsLessThan over SupportsLessThanT if possible ( #5288 )
...
Co-authored-by: hauntsaninja <>
2021-05-01 21:39:25 -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
Shantanu
445a86f4c9
builtins: add aiter, anext ( #5289 )
2021-05-01 21:10:30 -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
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
hatal175
fc0775664d
Use native SupportsIndex in builtins ( #5229 )
2021-04-20 22:24:39 -07:00
hatal175
f44f38fda3
Fixes #1110 . Use SupportsIndex in str, bytes and bytesarray functions wh… ( #5228 )
...
* Fixes #1110 . Use SupportsIndex in str, bytes, bytesarray functions where applicable.
2021-04-17 22:27:58 +03:00
hatal175
d3b2cafa85
builtins stubtest exceptions ( #5219 )
2021-04-16 10:41:04 -07:00
Andrey
31d1c30606
PEP 604: Add or operator to class type ( #5151 )
...
Co-authored-by: andrey.matveev <andrey.matveev@jetbrains.com >
2021-04-08 07:45:31 -07:00
Sebastian Rittau
29061d36ae
Fix dict type if constructing with kwargs ( #4987 )
...
Closes #4846
2021-03-22 19:30:01 -07:00
Eric Traut
29c3d67626
Improved definition of divmod function in builtins ( #5114 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2021-03-15 11:10:09 +01:00
Jelle Zijlstra
30fc2b8cd0
fix positional-only arguments to str and bytes ( #5112 )
2021-03-12 15:33:25 -08:00
Andrew Crabtree
a3cfb4e507
Add missing msg type to ImportError ( #5111 )
...
Fixes #5107
2021-03-12 11:20:46 -08:00
Eric Traut
c92e3cb228
Update pyright CI test to use the latest version of pyright (1.1.118). ( #5092 )
...
Update pyright CI test to use the latest version of pyright (1.1.118). Enable all but one of pyright's strictest checks. Add a "# type: ignore" to `__new__` method in `weakref.KeyRef` because it uses a non-standard name for the `cls` parameter, which is flagged as an error by pyright.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2021-03-05 12:12:18 -08:00
Eric Traut
e2967a8bee
Eliminated the use of "bare" TypeVars in stdlib stubs ( #5041 )
...
Eliminated the use of "bare" TypeVars (i.e. a TypeVar that appears only once) within generic methods. While not considered an error in PEP 484, these are a common source of bugs in code, and some type checkers (including pytype and pyright) flag them as errors.
Co-authored-by: Eric Traut <erictr@microsoft.com >
2021-02-27 19:43:45 -08:00
Akuli
64575f4ec2
make WindowsError available only on windows ( #5036 )
2021-02-20 13:36:21 +01:00
Akuli
1184e6e42b
make WindowsError an alias of OSError (new in Python 3.3) ( #5032 )
...
make WindowsError an alias of OSError (new in Python 3.3)
2021-02-19 15:45:40 +01:00
Yehuda Davis
fffa66ff97
Remove unnecessary overload of round() ( #5030 )
...
The overloads with float is unnecessary because the float class implements the SupportsRound protocol.
2021-02-17 17:00:38 -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