Commit Graph
100 Commits
Author SHA1 Message Date
Jelle Zijlstra 38569b6bb4 stubtest: fix path (#11884) 2024-05-10 10:44:42 +02:00
Jelle Zijlstra 9c8c9c769c Add stubs for unidiff (#11860) 2024-05-04 17:33:09 +02:00
Jelle Zijlstra 1dff589dd4 Use TypeIs for various stdlib functions (#11823) 2024-04-26 16:43:19 -07:00
Jelle Zijlstra f40076c0da Upgrade to mypy 1.10.0 (#11829) 2024-04-24 07:48:40 -07:00
1a275547b4 CONTRIBUTING.md: Add PR closing policy (#11596)
Closes #11583

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
Co-authored-by: Avasam <samuel.06@hotmail.com>
2024-03-14 22:06:26 -07:00
Jelle Zijlstra a6bdb25991 typing: Deprecate creating a NamedTuple with kwargs (#11567)
https://github.com/python/cpython/blob/c5fa796619a8cae5a1a8a4a043d05a99adec713d/Lib/typing.py#L2874
2024-03-10 16:20:35 -07:00
Jelle Zijlstra f94bbfbcc4 Update the README (#11553)
Read through the README and changed anything that no longer made sense. In particular, the documentation of our stub versioning scheme was outdated.
2024-03-09 15:59:15 -08:00
Jelle Zijlstra 5b1fd121e0 asyncio: Fix type of add_child_handler callback (#11548) 2024-03-09 17:02:05 +01:00
Jelle Zijlstra 6d20ea636c html5lib: Fix type alias (#11480)
Pretty sure this is what I meant to write in the first place.

Fixes #11478
2024-02-27 11:55:29 -08:00
Jelle Zijlstra c62fedc190 tarfile: Remove @deprecated (#11476)
Fixes #11472.

As noted in the issue, it is possible to set the filter on the class, but that will still cause type checkers to show deprecation warnings. Therefore, we unfortunately cannot enforce this deprecation in the type system.
2024-02-27 06:34:26 -08:00
Jelle Zijlstra 78b7dc6167 html5lib: Add various types (#11429)
I started out investigating comments in #11411 and ended up adding a few other
types that were reasonably obvious from the source code. For reference:
https://github.com/html5lib/html5lib-python/tree/master/html5lib
2024-02-20 00:18:17 -08:00
Jelle ZijlstraandSebastian Rittau 84572bbfe6 importlib.metadata: Use the SimplePath protocol (#11445)
Closes #9217. Followup from #11436.

This mostly makes a simpler set of changes than #9217; in particular
it does not make PathDistribution generic. I think this is in line with
how the protocol is supposed to be used, though not always in line with
the runtime type annotations (which don't all make sense).

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2024-02-18 21:05:33 -08:00
Jelle Zijlstra e8c029fbd3 openpyxl: Add stubtest allowlist entry (#11449)
Fixes #11448
2024-02-19 05:37:54 +01:00
Jelle ZijlstraandAlex Waygood bba8cbd6f8 stdlib: more deprecations (#11009)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-18 06:50:29 -08:00
Jelle Zijlstra 705744af4c Update for typing_extensions 4.10 (#11438) 2024-02-18 00:59:48 -08:00
Jelle Zijlstraandlayday e5d25a7605 importlib.metadata: Improve and test SimplePath protocol (#11436)
Co-authored-by: layday <layday@protonmail.com>
2024-02-18 00:36:01 -08:00
Jelle Zijlstra 504cbd40fe deps: upgrade pytype (#11434) 2024-02-16 22:06:25 -08:00
Jelle Zijlstra c2c8d7cf5d stdlib: Apply some simple deprecations (#11044) 2023-11-23 09:03:01 +01:00
Jelle Zijlstra 42875bcbf1 ibm-db: Add SQL_ATTR_TXN_ISOLATION (#11060) 2023-11-23 09:00:33 +01:00
Jelle Zijlstra 5fd2e9bf61 CONTRIBUTING: Add @deprecated, other updates (#11005)
Fixes #11004.

I started out just documenting conventions with `@deprecated`, but
found some other things in need of updates.

- PEP 585 and 612 are now fully supported
- Add several other PEPs that we fully support
- Use updated links to PEPs
- Split off a few sections from the long "Conventions" section
- PEP 688 was accepted
2023-11-18 12:55:18 -08:00
Jelle Zijlstra 0c7bdffa90 third-party: make some protocol params pos-only (#11006) 2023-11-10 07:40:10 +01:00
Jelle Zijlstra 4deef7550f stdlib: Fix more signatures with unrepresentable defaults (#11007) 2023-11-09 18:20:09 -08:00
Jelle ZijlstraandAlex Waygood d9311f946e stdlib: fix signatures for some functions with unrepresentable defaults (#11000)
Found with python/mypy#16433

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-09 08:14:36 -08:00
Jelle Zijlstra 17f8a82376 ast: mark ast.Num etc. as deprecated (#10994) 2023-11-08 19:40:22 +01:00
Jelle Zijlstra b36f3c5229 asyncio: remove overly specific protocols (#10984)
The _warn parameter to these methods is just there to work around
some finalization issues and should never be used by users. In
addition, these protocols are out of date (the "stacklevel" argument
is not used by current CPython main). I don't think we gain anything
by trying to maintain these protocol definitions.
2023-11-07 19:26:25 -08:00
Jelle Zijlstra 3229b36644 stdlib: More pos-only parameters to Protocols (#10987) 2023-11-06 23:45:12 +01:00
Jelle Zijlstra 5030b7419b stdlib: Use pos-only parameters for many Protocols (#10985) 2023-11-06 18:09:04 +01:00
Jelle Zijlstra 9fb52127ab jsonschema: move addionalItems (#10955)
https://github.com/python-jsonschema/jsonschema/commit/daa40b3eaf55f72f6154f9a48e557d895617b24a

Fixes #10953
2023-10-30 17:40:28 -07:00
Jelle ZijlstraandAlex Waygood 9d345b4df4 Add stubs for portpicker (#10944)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-10-29 01:13:25 +01:00
f9f30cc0f2 Update mypy-protobuf (#10914)
Co-authored-by: Avasam <samuel.06@hotmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-10-22 16:31:02 -07:00
Jelle Zijlstra cb688d2577 psutil: updates (#10894) 2023-10-15 18:22:11 -07:00
Jelle Zijlstra cc38a75587 aws-xray-sdk: update and remove spurious re-exports (#10874)
Fixes #10873

Remove some obsolete compatibility functions that are no longer in the latest
release, and stop re-exporting symbols that clearly weren't meant to be re-exported.
2023-10-12 18:20:47 -07:00
Jelle Zijlstra 31495e53bd typing.pyi: IO.name may be bytes (#10738) 2023-09-20 08:24:22 +02:00
Jelle Zijlstra f577c4c133 Update typing_extensions for 4.7.* (#10344) 2023-07-22 12:51:22 +01:00
Jelle ZijlstraandSebastian Rittau 5beddbe883 Add PEP 706 filters to tarfile (#10316)
Fixes #10315

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2023-06-14 15:08:32 +01:00
Jelle Zijlstra 628c88d995 Update ast for 3.12 (#10201) 2023-06-02 17:11:13 -07:00
Jelle Zijlstra 7bc4be08d8 Update some dependencies (#10243) 2023-06-02 16:54:52 -07:00
Jelle Zijlstra 0d0cbb6b97 Allowlist requests.compat.bytes.__buffer__ (#10231) 2023-05-28 21:23:00 -07:00
Jelle ZijlstraandAlex Waygood c0a0c34020 Use PEP 688 (#10225)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-27 19:55:30 -07:00
Jelle Zijlstra 2f65ca5cd4 Update pyscreeze stubs (#10223) 2023-05-26 15:11:56 +02:00
Jelle Zijlstra 4817408103 Update pyautogui (#10209)
Fixes #10207
2023-05-25 00:44:23 -07:00
Jelle Zijlstra 185adf01a9 Clean up stubtest allowlist for typing (#10205) 2023-05-24 20:33:46 +01:00
Jelle ZijlstraandAlex Waygood e4dcfccbd5 Update typing-extensions; some 3.12 updates (#10200)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-24 11:06:55 -07:00
Jelle Zijlstra 8e24885da7 paramiko: Improve various bytes-related types (#10109) 2023-05-03 15:53:54 +02:00
Jelle Zijlstra 0f270e61bf docutils: Input can take bytearray (#10108)
Part of #9006
2023-04-29 16:09:14 +01:00
Jelle Zijlstra b9e9540db4 chardet: UniversalDetector.feed accepts bytearray (#10107)
Technically it accepts any buffer, but the inline type annotations
now say bytes | bytearray, so let's stick to that.

Part of #9006
2023-04-29 16:08:37 +01:00
Jelle Zijlstra 4e52cf1b71 bs4: NavigableString accepts ReadableBuffer (#10106)
It delegates to str.__new__.
2023-04-29 15:54:09 +01:00
Jelle Zijlstra 17edf76275 aiofiles: use ReadableBuffer (#10105)
Part of #9006
2023-04-29 15:50:48 +01:00
Jelle Zijlstra 40975222b4 multiprocessing: Queue does not inherit from queues.Queue (#10104)
Fixes #3404
2023-04-29 15:39:11 +01:00
Jelle Zijlstra bff9d7a7df psutil: sconn.pid can be None (#9853)
Found out about this the hard way.

The code path that allows None is here: https://github.com/giampaolo/psutil/blob/2da99502238852f18f74db05304e67a01ee77005/psutil/_pslinux.py#L923
2023-03-07 22:07:54 +00:00
Jelle Zijlstra e17ee201f5 yaml: allow ReadableBuffer in represent_binary (#9701) 2023-02-09 16:03:49 +01:00
Jelle Zijlstra c65a87481d colorama: Preserve input type for wrap_stream (#9677) 2023-02-06 06:50:21 -08:00
Jelle Zijlstra 5b24c7bb41 stdlib: Run stubdefaulter on Linux for 3.9 (#9663) 2023-02-03 00:39:22 +00:00
Jelle Zijlstra 0fc3a567fc stdlib: add defaults for modules accessible on MacOS (#9659)
Ran stubdefaulter with standard options on a Mac.
2023-02-01 22:46:55 +00:00
Jelle Zijlstra bc463a0677 Remove default for size parameter to multiprocessing.heap.Heap (#9658)
It's system-dependent. stubdefaulter told me `multiprocessing.heap.Heap: parameter size: stub default 4096 != runtime default 16384`, which presumably means it's 4096 on @AlexWaygood's system and 16384 on mine. I looked in the code and the default is set to `mmap.PAGESIZE`, which in turn is set from some system call at import time.
2023-02-01 22:43:50 +00:00
Jelle Zijlstra af2ce282d5 builtins: do the TODO on compile() (#9567) 2023-01-18 11:48:48 -08:00
Jelle Zijlstra aa4d6d87ae asyncio: fix default for subprocess_exec (#9561) 2023-01-18 15:03:22 +01:00
Jelle Zijlstra ddfaca3200 stdlib: add argument default values (#9501) 2023-01-18 09:37:34 +01:00
Jelle Zijlstra b43e1db47b ssl, sysconfig: fix issues with defaults (#9507)
- ssl._create_unverified_context allows None since 3.10:
  https://github.com/python/cpython/commit/2875c603b2a7691b55c2046aca54831c91efda8e#diff-f6439be9c66350dde4c35dbeea0352c96cc970ba12b0478f6ae36f10725bd8c5
- sysconfig.is_python_build ignores its argument since 3.11:
  https://github.com/python/cpython/commit/067597522a9002f3b8aff7f46033f10acb2381e4
  (was backported into 3.11)
2023-01-12 10:19:41 -08:00
Jelle ZijlstraandAlex Waygood f64807a468 socketserver: improve bytes handling (#9096)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-01-12 16:46:20 +00:00
Jelle Zijlstra b9eab637cb subprocess: Improve bytes-related types (#9100) 2023-01-11 20:10:26 -08:00
Jelle Zijlstra 6a366c99a9 venv: add logger (#9508)
Not particularly useful but unreleased stubtest will require this:
https://github.com/python/typeshed/actions/runs/3898630022/jobs/6657546205
2023-01-11 19:33:16 -08:00
Jelle Zijlstra 1ce1c1ad17 subprocess: universal_newlines may be None (#9509)
All the way back to 3.7:
https://github.com/python/cpython/blob/3.7/Lib/subprocess.py#L684

It's treated like False
2023-01-11 19:15:40 -08:00
Jelle Zijlstra d2829ecdf7 urllib.parse.urlencode: encoding and errors can be None (#9506)
The runtime defaults are None. Found in #9501.
2023-01-11 18:55:38 -08:00
Jelle Zijlstra 7ca7b0c659 Add Nikita Sobolev to maintainers (#9351) 2022-12-11 09:43:59 +03:00
Jelle ZijlstraandAlex Waygood 388d7839d9 regr_test.py: improve interaction between --all and --quiet flags (#9349)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-12-10 21:39:33 +00:00
Jelle Zijlstra 00483b63e6 http.client.HTTPConnection.request accepts str as the body (#9322)
See code around https://github.com/python/cpython/blob/ab02262cd0385a2fb5eb8a6ee3cedd4b4bb969f3/Lib/http/client.py#L1328
2022-12-02 10:49:33 -08:00
Jelle Zijlstra 9452ce539c xmlrpc: improve bytes handling (#9166) 2022-11-25 19:33:53 -08:00
Jelle Zijlstra 59f35b51b2 pyflakes: fix stubtest (#9273)
Fixes #9272
2022-11-25 09:34:37 +01:00
Jelle Zijlstra 8da1e8c31d marshal: specify allowed types (#9165) 2022-11-24 22:54:09 -08:00
Jelle Zijlstra d2da97d99c urllib: improve bytes handling (#9167) 2022-11-22 16:38:28 -08:00
Jelle ZijlstraandShantanu 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
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
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
Jelle Zijlstra 7299b07790 multiprocessing: improve bytes handling (#9085) 2022-11-04 10:58:58 +01:00
Jelle Zijlstra 2199115822 dateparser: add new parameter (#9081)
Fixes #9079
2022-11-03 19:53:54 -07: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
Jelle Zijlstra 6b702452b6 http: improve types (#9055) 2022-11-03 09:55:56 +01:00
Jelle Zijlstra 460158fc40 imaplib: _Authenticator also works with bytearray (#9056) 2022-11-02 20:55:41 -07:00
Jelle Zijlstra 62ddebb65c fcntl: fix fcntl arg type (s#) (#9052) 2022-11-01 12:34:04 +01:00
Jelle Zijlstra 4d40fc6c8a logging: StreamHandler.send takes ReadableBuffer (#9057) 2022-11-01 11:52:30 +01:00
Jelle Zijlstra 7ab933f3c3 email: improve bytes handling (#9032) 2022-11-01 10:13:30 +01:00
Jelle Zijlstra 3e46f9a9ee dbm: fix bytes handling (#9030) 2022-11-01 10:10:37 +01:00
Jelle Zijlstra 39936cd18a hmac: also support bytearray in 3.7 branch (#9054) 2022-10-31 23:28:53 -07:00
Jelle Zijlstra 524cd53d73 gzip: remove Any usage (#9053) 2022-10-31 23:14:12 -07:00
Jelle Zijlstra 3d8d744eb4 ctypes: improve bytes handling (#9029) 2022-10-31 15:26:09 +01:00