Jelle Zijlstra
9452ce539c
xmlrpc: improve bytes handling ( #9166 )
2022-11-25 19:33:53 -08:00
Jelle Zijlstra
8da1e8c31d
marshal: specify allowed types ( #9165 )
2022-11-24 22:54:09 -08:00
Avasam
be1da49957
Suggestion: SliceableBuffer type alias ( #9115 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2022-11-24 20:14:09 -08:00
Nikita Sobolev
bd75ceb0b6
Fix stdlib stubtest failures on main ( #9255 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2022-11-23 10:07:05 +00:00
Nikita Sobolev
ae58142e6e
Fix typings of ExceptionGroup and BaseExceptionGroup ( #9230 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
Co-authored-by: AlexWaygood <alex.waygood@gmail.com >
2022-11-22 20:46:03 -08:00
Jelle Zijlstra
d2da97d99c
urllib: improve bytes handling ( #9167 )
2022-11-22 16:38:28 -08:00
Nikita Sobolev
e1aa4d5285
Add types to multiprocessing/reduction.pyi ( #9171 )
2022-11-22 14:02:14 +00:00
Nikita Sobolev
18e2ae762b
Mark first argument of __[get|set|del]attr__ as str ( #9245 )
2022-11-22 11:06:50 +00:00
chaojie
620e37fd02
Add type-hints for _vformat in string.Formatter ( #9228 )
2022-11-20 18:22:36 -08:00
Hong Minhee (洪 民憙)
49fca14a15
Narrower return type for east_asian_width() ( #9223 )
...
Narrower return type for east_asian_width()
2022-11-18 21:58:13 -08:00
Bruce Merry
de12b1413d
Refine types for asyncio transports ( #9209 )
...
- Change the return type of create_connection, start_tls,
connect_accepted_socket, create_unix_connection to Transport
rather than BaseTransport (closes #9199 ).
- Change the return type of create_datagram_endpoint to
DatagramTransport rather than BaseTransport.
- Change the argument of sendfile to WriteTransport rather than
BaseTransport.
I considered also changing the argument of start_tls to Transport, but
I think that will give false positives for code that implements a custom
transport class that inherits from both ReadTransport and WriteTransport
but not from Transport, and I'm not sure if typing has a way to express
an intersection of types. Since users are not normally expected to
implement transports that may be overthinking things.
2022-11-16 07:00:38 -08:00
Nikita Sobolev
e8111ea017
DecimalTuple can have string exponent (#9194 )
2022-11-14 11:09:16 +01:00
Nikita Sobolev
0bd4e3ce1a
ip_interface can have tuple arguments (#9195 )
2022-11-14 11:02:56 +01:00
kasium
f9cd5ee859
Improve ast types; revert several "redundant numeric union" changes from #7906 ( #9130 )
...
* Adapt number types in ast
Since mypy 0.990 type promotions was limited.
This means that complex is not longer promoted to int/float, therefore
we should adapt the types to list all possible types
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: AlexWaygood <alex.waygood@gmail.com >
2022-11-14 09:41:23 +00:00
Anh71me
39d37ec54c
types: add __getitem__ on GenericAlias ( #9172 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2022-11-13 06:45:56 -08:00
Akuli
02f2bc30e7
Make peewee stubs compatible with peewee 3.15.4 ( #9176 )
2022-11-12 16:12:55 -08:00
Ben Blank
f5459640f8
Add None as a valid type in SAXParseException's second argument ( #9162 )
...
Closes #9161
2022-11-11 12:18:22 -08:00
Nikita Sobolev
70c4af4b73
Refactor round and add tests ( #9151 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2022-11-11 18:19:51 +00:00
Nikita Sobolev
0f33721c52
Remove sqlite3/dbapi2.pyi from pyright excludelist ( #9148 )
2022-11-11 12:00:19 +00:00
Nikita Sobolev
0baadae0c9
urllib.parse: improve bytes handling ( #9103 )
2022-11-10 20:47:57 -08:00
Jelle Zijlstra
ec4ec33639
xml: improve bytes types ( #9110 )
...
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com >
2022-11-10 20:43:26 -08:00
Jelle Zijlstra
8b59dfd10b
termios: improve comments, add more constants ( #9101 )
2022-11-10 17:44:52 +00:00
Jelle Zijlstra
c7820b401d
socket: constructor accepts bytes on Windows ( #9095 )
...
https://github.com/python/cpython/blob/d04899abb0da4cc7c0a390f5bc52d57ace8955fd/Modules/socketmodule.c#L5318
This is used in `socket.fromshare`. It must be bytes, not some other buffer.
2022-11-10 15:10:44 +00:00
Nikita Sobolev
f8dd877e48
Improve math.{ceil,floor,trunc} ( #9141 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2022-11-10 14:45:07 +00:00
Anh71me
cc66167c38
inspect: use Literal type for Attribute.kind ( #9149 )
2022-11-10 14:15:36 +00:00
Alex Waygood
068b0b488a
Improve builtins.vars() ( #9146 )
2022-11-10 12:14:05 +01:00
Samuel T
796bdc2eb0
Improve accuracy of six byte index methods ( #9117 )
2022-11-09 19:22:33 -08:00
Nikita Sobolev
a74acc8225
urllib.response: improve bytes handling ( #9142 )
2022-11-09 18:21:13 -08:00
Jelle Zijlstra
afa2a8e3dd
mailbox: improve bytes handling ( #9083 )
...
- The _MessageData alias refers to objects handled in the
_dump_message method: https://github.com/python/cpython/blob/016c7d37b6acfe2203542a2655080c6402b3be1f/Lib/mailbox.py#L210
- The path passed to __init__ should be a str path because there are
many places in the file (search for self._path) where we join it
with a str, which won't work with a bytes path.
2022-11-08 21:50:51 +00:00
Nikita Sobolev
62a6c3d616
Annotate known magic-method return types ( #9131 )
2022-11-08 18:28:42 +00:00
Alex Waygood
739460291b
Use recursive type aliases in builtins and _typeshed ( #9134 )
2022-11-08 17:04:09 +00:00
Alex Waygood
4f381af4c5
Upgrade mypy to 0.990 ( #9123 )
2022-11-07 11:20:47 -08:00
Jelle Zijlstra
68924e00e5
os: improve bytes handling ( #9072 )
2022-11-06 21:32:46 -08:00
Jelle Zijlstra
340eb1264b
unicodedata: accepts ReadOnlyBuffer ( #9106 )
2022-11-06 21:17:06 -08:00
Jelle Zijlstra
1d4eed1c9d
zipfile: improve bytes handling ( #9109 )
...
Technically some uses of `pwd` accept more types, but others
use `isinstance()` to enforce only `bytes`. It seems better to
keep the same type throughout the module.
2022-11-06 21:16:27 -08:00
Jelle Zijlstra
6639e2e14c
sqlite3: Blob.write accepts buffer ( #9097 )
2022-11-06 21:06:55 -08:00
Jelle Zijlstra
1f7648976c
unittest: cannot use bytes regexes ( #9107 )
...
```
>>> from unittest.case import TestCase
>>> c = TestCase()
>>> with c.assertRaisesRegex(Exception, b"x"): 1/0
...
ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/case.py", line 274, in __exit__
if not expected_regex.search(str(exc_value)):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot use a bytes pattern on a string-like object
```
2022-11-05 14:14:53 -07:00
Jelle Zijlstra
3d64286f9e
winsound: accepts buffers ( #9108 )
...
https://github.com/python/cpython/blob/b5f711185bd11819566068ddf2a74a1402340e2d/PC/winsound.c#L93
2022-11-05 13:52:31 -07:00
Jelle Zijlstra
0e1ca279a4
struct: add missing pos-only markers ( #9099 )
2022-11-04 23:00:33 -07:00
Jelle Zijlstra
f678fac75a
tokenize: you can tokenize bytearrays too ( #9102 )
2022-11-04 22:59:05 -07:00
Jelle Zijlstra
cff08b674a
isort: Add more to extra_standard_library ( #9098 )
2022-11-04 22:56:40 -07:00
Jelle Zijlstra
7ef7029f88
smtplib: Improve bytes handling ( #9094 )
2022-11-04 20:08:10 -07:00
Nikita Sobolev
9f0d0b9af7
zipimport: improve bytes handling ( #9087 )
2022-11-04 17:58:59 -07:00
Jelle Zijlstra
7299b07790
multiprocessing: improve bytes handling ( #9085 )
2022-11-04 10:58:58 +01:00
Nikita Sobolev
e68567a1b4
tarfile: improve bytes handling ( #9076 )
2022-11-03 10:15:46 -07:00
Nikita Sobolev
86f9d93003
Update pyright to 1.1.278 ( #9077 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2022-11-03 15:32:10 +00:00
Jelle Zijlstra
a17fa5001a
pickletools: accepts bytearray, use protocol from _typeshed ( #9073 )
2022-11-03 16:20:03 +01:00
Jelle Zijlstra
2f3f8da90a
msvcrt: improve bytes handling ( #9071 )
2022-11-03 12:11:36 +01:00
Jelle Zijlstra
43631078f0
importlib: improve bytes handling ( #9070 )
2022-11-03 12:00:24 +01:00
Jelle Zijlstra
82bf494534
quopri: improve types ( #9074 )
2022-11-03 11:37:59 +01:00