Nikita Sobolev
64bc0590a6
Remove un-needed __hash__ methods from stdlib ( #8465 )
2022-08-06 14:55:27 +01:00
Alex Waygood
edc0ecd857
Remove Python 3.6 branches from typeshed ( #8269 )
2022-07-11 10:55:17 +02:00
Alex Waygood
97a74bc1aa
Import from collections.abc wherever possible ( #7635 )
2022-04-18 12:50:37 +02:00
Alex Waygood
f4ae363b56
stdlib: correct many pos-or-kw arg names in dunder methods ( #7451 )
2022-03-07 16:40:03 +01:00
Alex Waygood
947724a5cb
stdlib: Add several missing @abstractmethod decorators ( #7443 )
2022-03-06 16:41:13 -08:00
Shantanu
9796b9ed69
Improve open overloads when mode is a literal union ( #7428 )
...
As pointed out by @gvanrossum in https://github.com/python/typing/issues/1096
Improves type inference in cases when we know that mode is
OpenBinaryMode, but don't know anything more specific:
```
def my_open(name: str, write: bool):
mode: Literal['rb', 'wb'] = 'wb' if write else 'rb'
with open(name, mode) as f:
reveal_type(f) # previously typing.IO[Any], now typing.BinaryIO
```
You may be tempted into thinking this is some limitation of type
checkers. mypy does in fact have logic for detecting if we match
multiple overloads and union-ing up the return types of matched
overloads. The problem is the last overload interferes with this logic.
That is, if you remove the fallback overload (prior to this PR), you'd get
"Union[io.BufferedReader, io.BufferedWriter]" in the above example.
Co-authored-by: hauntsaninja <>
2022-03-06 15:45:34 -08:00
Alex Waygood
a0b41959ec
stdlib: fix many attributes which are read-only at runtime but read-write in the stub ( #7395 )
2022-02-27 16:23:09 -08:00
Alex Waygood
d6ce3abd68
Add __all__ to most modules beginning with 'n', 'o' and 'p' ( #7345 )
2022-02-21 17:57:03 -08:00
Alex Waygood
fbc279e3f5
stdlib: Add many missing dunder overrides ( #7231 )
2022-02-16 06:25:47 -08:00
Alex Waygood
68e2a74a79
pathlib.Path.__exit__ always returns None (#7192 )
...
Source code here: 0ae4019179/Lib/pathlib.py (L893)
It has always returned `None`, by the looks of things.
2022-02-13 17:14:13 -08:00
Alex Waygood
03dbe2206c
Improve pathlib stubs ( #7181 )
2022-02-12 18:42:04 -08:00
Shantanu
b88a6f19cd
Upgrade black version ( #7089 )
2022-01-30 16:27:06 -08:00
Alex Waygood
96c9abb058
Always use _typeshed.Self, where applicable ( #6880 )
...
* Always use `_typeshed.Self`, where applicable
* Revert changes to `google-cloud-ndb` (ambiguous)
* Remove empty line added by script
* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi`
* Manually add a few more that the script missed
* Improve `filelock` annotation
Source code here: 79ec7b2826/src/filelock/_api.py (L207)
* Improve `opentracing/scope` annotation
Source code here: 3e1d357a34/opentracing/scope.py (L71)
* Improve `redis/client` stub
Source code here: 15f315a496/redis/client.py (L1217)
* Improve `redis/lock` annotation
Source code here: 15f315a496/redis/lock.py (L155)
* Improve `requests/models` annotation
Source code here: d718e75383/requests/models.py (L653)
2022-01-09 19:16:19 -08:00
Alex Waygood
a40d79a4e6
Use lowercase type everywhere ( #6853 )
2022-01-08 16:09:29 +01:00
Alex Waygood
8d5d2520ac
Use PEP 585 syntax wherever possible ( #6717 )
2021-12-28 11:31:43 +01:00
Shantanu
38ab20926f
pathlib: update for py310 ( #6225 )
2021-11-02 20:23:30 -07:00
Yehuda Davis
3d5f35c33b
pathlib: add newline to write_text() method ( #6224 )
...
Closes #6223
2021-11-02 19:46:50 -07:00
Estelle Poulin
15cec1da8e
Change Traversable to be inline with pathlib.Path ( #5818 )
...
`pathlib.Path` objects are now valid `importlib.abc.Traversable`s.
2021-09-21 21:36:10 +03:00
Akuli
ce11072dbe
Big diff: use lower-case list and dict ( #5888 )
2021-08-08 09:26:35 -07:00
Akuli
ee487304d7
Big diff: Use new "|" union syntax ( #5872 )
2021-08-08 11:05:21 +02:00
Anton Grübel
96e0660fba
Use _typeshed.Self with __enter__ ( #5717 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-07-01 12:32:32 +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
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