Commit Graph
49 Commits
Author SHA1 Message Date
Stephen MortonandGitHub 097581ea47 Update to mypy 1.14 (#13272) 2024-12-20 17:29:38 -08:00
Sebastian RittauandGitHub b13bb947c3 [aiofiles] Update to 24.1 (#12207) 2024-06-25 16:51:01 -07:00
Max MuotoandGitHub f2d96aea32 Add missing delete on close arg for aiofiles.NamedTemporaryFile (#12110) 2024-06-22 12:19:27 -07:00
Sebastian RittauandGitHub 6d19a17f57 [aiofiles] Annotate AiofilesContextManagerTempDir (#11705) 2024-04-02 15:44:44 +02:00
Sebastian RittauandGitHub 33de88879f Remove bare Incomplete annotations in third-party stubs (#11671) 2024-03-30 18:34:51 -07:00
ShantanuandGitHub 88fa182253 Use PEP 570 syntax in third party stubs (#11554) 2024-03-10 14:11:43 +01:00
4d8ae17776 Bump mypy to 1.9, add to json.encoder, small fixups (#11549)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-03-09 14:25:00 -08:00
Sebastian RittauandGitHub b6eaadcfe5 Update typing_extensions imports in third-party stubs (#11245) 2024-01-05 15:40:13 +01:00
Sebastian RittauandGitHub 695d41f487 Bump aiofiles to 23.2.* (#10584) 2023-08-16 12:05:42 +01:00
Sebastian RittauandGitHub afe18e95a9 Add an upstream_repository field to METADATA.toml (#10487)
Closes: #10478
2023-07-20 16:45:41 +02:00
Sebastian RittauandGitHub 786bd22343 [aiofiles] Use file mode alias from _typeshed (#10233) 2023-06-07 06:14:03 -07:00
AbtinandGitHub 31f4b8cf80 add typing support to more aiofiles wrapped functions (#10175)
add stubs for missing functions:

- renames
- unlink
- link
- listdir
2023-05-22 07:44:00 -07:00
Jelle ZijlstraandGitHub 17edf76275 aiofiles: use ReadableBuffer (#10105)
Part of #9006
2023-04-29 15:50:48 +01:00
Alex WaygoodandGitHub b9fedd20ce Add defaults for third-party stubs A-D (#9952) 2023-03-27 16:49:58 +01:00
390058eb39 Update aiofiles for v23.1.* (#9711)
Co-authored-by: Mehdi Drissi <mdrissi@snapchat.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-09 17:25:03 +00:00
AvasamandGitHub ed6748fb32 Stubtest settings: change ignore_missing_stub default to false (#9779)
If you're reading about this commit from an autogenerated changelog entry, this should have no user-visible impact on how the stubs are interpreted by a type checker; it's just an internal change to how typeshed's tests work.
2023-02-20 22:37:45 +00:00
Alex WaygoodandGitHub 7180d0223b Use typing_extensions.Self instead of _typeshed.Self (#9702) 2023-02-15 11:32:43 +01:00
AvasamandGitHub 372073d35b Use _typeshed.FileDescriptorOrPath in stubs (#9695) 2023-02-09 08:30:19 +01:00
Alex WaygoodandGitHub a4e3cfefac Improve pre-commit config (#9563)
- Add a few more hooks. These are all very fast, and I've found them useful in other projects:
  - Autofixes:
    - `trailing-whitespace`: fixes trailing whitespace
    - `requirements-txt-fixer`: alphabetises items in `requirements.txt` files
    - `end-of-file-fixer`: makes sure every file ends with a single newline character
    - `mixed-line-ending`: Makes sure Windows users don't accidentally introduce CRLF line endings into a file that uses LF line endings
  - None-autofixes:
    - `check-yaml`: loads YAML files to validate syntax
    - `check-toml`: loads TOML files to validate syntax
    - `check-merge-conflict`: detects merge-conflict strings in files and blocks them from accidentally being committed
    - `check-case-conflict`: checks for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT; blocks them from being committed.
  - Change the bot schedule to quarterly, to reduce noisy PRs
  - Change the `black` language target-version to Python 3.10, synching the setting here with the changes that were made to our `pyproject.toml` file in #7538
2023-01-18 06:29:18 -08:00
Alex WaygoodandGitHub 4fea314594 Replace Any with Incomplete in many places (#9558) 2023-01-18 08:48:16 +00:00
Maxwell GandGitHub 553e7d46f0 Add aiofiles.os.scandir (#9280) 2022-11-25 18:36:00 -08:00
AvasamandGitHub 033d21e775 Complete stubtest for aiofiles + fix on Windows (#9184) 2022-11-13 06:45:20 -08:00
Nikita SobolevandGitHub c0e9038f0d Fix and allow classes with missing metaclasses (#9136) 2022-11-08 18:13:59 +00:00
Nikita SobolevandGitHub 10f05d3fb6 Remove aiofiles/tempfile/temptypes.pyi from pyright exclude (#9104) 2022-11-05 07:10:50 -07:00
8a8db9c6d4 [stubsabot] Bump aiofiles to 22.1.* (#8714)
Co-authored-by: stubsabot <>
2022-09-08 18:25:46 -07:00
Alex WaygoodandGitHub e2211cb420 Delete some unused # noqa comments (#8639) 2022-08-29 12:56:06 +01:00
Alex WaygoodandGitHub 35616b439f Run pycln as a pre-commit hook in CI (#8304) 2022-07-18 09:27:28 +02:00
043d9dac61 Add missing aiofiles.tempfile classes (#7523)
Fixes: #6524

Co-authored-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2022-07-05 23:50:19 +02:00
Alex WaygoodandGitHub 653f2c6ba4 Third-party stubs: import from collections.abc where possible (#7637) 2022-04-16 14:52:57 +01:00
Alex WaygoodandGitHub 740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Alex WaygoodandGitHub a3245db63c Remove unneeded # noqa comments, fix broken # noqa comments (#7561) 2022-03-28 23:17:44 +02:00
Alex WaygoodandGitHub 3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
ShantanuGitHubhauntsaninja <>
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
Joseph YoungandGitHub 13e31aa3bf Add stubs for aiofiles.os.path (#6787) 2022-01-13 12:31:19 +02:00
Alex WaygoodandGitHub a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
4538770404 Add missing functions and keyword arguments to aiofiles.os (#6785)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-01-02 20:08:00 +02:00
Alex WaygoodandGitHub 8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Sebastian RittauandGitHub d065ee4aef Enable stubtest for aiofiles (#6698) 2021-12-26 15:54:42 +02:00
bb77f39b7c Add a 'stubtest' flag to METADATA.toml (#6687)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-12-25 17:02:57 +02:00
bb24e77404 Update remaining versions for third-party stubs (#6094)
Also remove the python2 markers of packages that don't list Python 2
as supported in the latest version.

Don't special case version '0.1'

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-10-12 12:30:45 +02:00
AkuliandGitHub ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
AkuliandGitHub ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Jelle ZijlstraandGitHub 80591d9f99 Fix aiofiles.base.AsyncBase.__iter__ (#5750)
Fixes #5725.

This doesn't actually work properly in mypy.
2021-07-11 10:58:10 +03:00
AkuliandGitHub 42247feefb use Self in async context managers (#5724) 2021-07-06 08:47:49 +02:00
ShantanuandGitHub 7244ea1f71 Test third party stubs with stubtest (#5615) 2021-06-13 00:17:40 +02:00
Sebastian RittauandGitHub 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
ShantanuGitHubhauntsaninja <>
fc660d6d41 Move typing_extensions to stdlib (#5233)
I'm not sure what the best way to do this is. This effectively orphans
types-typing-extensions, but maybe that's not really a problem. (We can
yank the package too)

See https://github.com/python/typeshed/pull/5229#issuecomment-822234125
for some details

Co-authored-by: hauntsaninja <>
2021-04-20 21:55:48 -07:00
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
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