Alex Waygood
646993c211
Improve imp._FileLike.__exit__ ( #7577 )
...
The signature of this method currently doesn't work quite as intended: see https://github.com/PyCQA/flake8-pyi/pull/199#issuecomment-1086087342
Classes will [still be accepted](https://mypy-play.net/?mypy=latest&python=3.10&gist=77efe095d01edeb1a4614166f0c9cf68 ) as conforming to this protocol if they have more permissive signatures such as `def __exit__(self, *args: object) -> None: ...`
2022-04-01 18:01:23 +01:00
Alex Waygood
ec27c00ca2
Third-party stubs: Improve several __exit__ methods ( #7575 )
2022-04-01 08:03:12 -07:00
Sebastian Rittau
4c9dc43c87
Update SQLalchemy to 1.4.34 ( #7573 )
...
Closes : #7572
2022-04-01 14:22:00 +01:00
Alex Waygood
ae6ff79c0e
flake8 config: remove line that exists only for Python-2 checking ( #7570 )
2022-04-01 08:07:16 +02:00
Alex Waygood
da3e69d093
stdlib: Improve a bunch of __(a)exit__ methods ( #7571 )
2022-04-01 08:05:25 +02:00
Alex Waygood
85f060b26d
Exclude the Python-2 stdlib from flake8 CI check ( #7569 )
...
We should hopefully be getting rid of this entire subdirectory soon anyway (#7367 ). This will make PRs to flake8-pyi a lot easier.
2022-03-31 23:35:45 +01:00
Collin Anderson
e719f54432
_imp.create_dynamic returns ModuleType ( #7568 )
2022-03-31 22:38:43 +02:00
Steven Troxler
2d1d4b982f
logging/handlers.pyi: atTime is datetime.time ( #7566 )
...
It is marked as having type `datetime.datetime` but `atTime`
refers to a time of day; only the fields on `datetime.time`
are used. The [docs](https://docs.python.org/3/library/logging.handlers.html#timedrotatingfilehandler )
clearly state that it is a `time`.
2022-03-30 19:17:36 +01:00
luzpaz
6550a30fdc
Fix source comment typo ( #7567 )
...
Found downstream in mypy
2022-03-30 18:06:09 +01:00
Sebastian Rittau
9687d53b65
Use explicit type aliases in _typeshed ( #7534 )
2022-03-30 11:06:07 +02:00
Hans Aarne Liblik
e8fe316a74
Add a few classes to vmodl and vmodl.fault ( #7565 )
2022-03-29 22:07:25 +02:00
Alex Waygood
1245bbcc8d
Use type alias to simplify overloads in unittest.mock ( #7563 )
2022-03-29 08:19:26 +02:00
Henry Schreiner
da08cd30d0
locale: getlocale may return None's ( #7562 )
...
According to the docs at https://docs.python.org/3/library/locale.html#locale.getlocale , this function may return None for either of the two items in the return sequence, which is missed in the current form.
Also adjust `locale.setlocale()`, which can accept a tuple of `(None, None)` for the second argument.
2022-03-28 23:23:03 +01:00
Alex Waygood
a3245db63c
Remove unneeded # noqa comments, fix broken # noqa comments ( #7561 )
2022-03-28 23:17:44 +02:00
Alex Waygood
478e7527aa
mypy_test: Add two more config options (#7560 )
...
`--enable-error-code ignore-without-code` means that mypy will ignore any type: ignore comments that don't have mypy error codes. It doesn't appear to have any effect on type: ignore comments that mypy_test doesn't use (e.g. because they're pyright- or stubtest-specific).
`--strict-equality` means that mypy will raise errors if we do something silly like `if sys.version_info == "linux"`. flake8-pyi should also check this for us, but I don't see any reason not to have mypy check this as well.
2022-03-28 16:06:13 +01:00
Sebastian Rittau
c41034c354
passlib: Annotate various handler methods and fields ( #7521 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2022-03-26 20:53:05 -07:00
Kalle Møller
9aa64fdc22
requests: Update adapters.pyi ( #7544 )
...
The cert can be
* A string / bytes which is a path to a certfile
* A tuple with two string / bytes, where the first is the certfile and the second is a keyfile
* None (optional)
The tuple could be anything indexable, but there are strict requirement to actualle have two items, don't know if there is something more generic
See https://github.com/psf/requests/blob/main/requests/adapters.py#L242-L248
2022-03-26 20:41:25 -07:00
Alex Waygood
61b22db692
Add many missing __match_args__ attributes ( #7556 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2022-03-26 19:36:28 +00:00
Alex Waygood
1192db784c
Use flake8-pyi 22.3.0 ( #7557 )
...
Hot off the presses!
2022-03-26 19:27:11 +00:00
Stefan Zabka
f40747f81d
Add Server to asyncio.base_events' __all__ ( #7554 )
...
Add Server to asyncio.base_events' __all__
Closes #7552
2022-03-25 20:32:28 +00:00
Jelle Zijlstra
0322fb0905
errno: fix typo and add missing constants ( #7553 )
2022-03-25 20:30:26 +01:00
Sebastian Rittau
9a76b13127
Add _typeshed.Incomplete ( #7535 )
...
Closes : #5613
2022-03-25 10:18:09 +01:00
Alex Waygood
b63c963077
Use conditional overloads to simplify several stdlib functions ( #7540 )
2022-03-25 08:47:03 +01:00
Harry
b69d64df60
allow start_server to accept a Sequence of hosts ( #7546 )
2022-03-24 19:44:45 +01:00
Alex Waygood
d086488e0e
Revert "Use import instead of type alias in email/message.pyi" ( #7548 )
...
Let's see if this is fixed in mypy 0.942.
This reverts the changes made in #7022 , which was a hack to fix #7019
2022-03-24 11:22:30 -07:00
Alex Waygood
4b63f345ad
Upgrade mypy version to 0.942 ( #7547 )
2022-03-24 18:42:26 +01:00
Sebastian Rittau
41160cc294
Fix primer comment workflow ( #7545 )
2022-03-24 08:02:54 -07:00
dset0x
a018110980
DateTimeRange: __contains__ accepts datetime.datetime ( #7541 )
2022-03-24 11:39:19 +01:00
Sebastian Rittau
00f1807836
Update black target version to py310 ( #7538 )
...
This makes no difference to existing files, but allows scripts to use
the match statement.
2022-03-23 07:57:17 -07:00
Sebastian Rittau
251dd52b57
Remove backports_abc third-party package ( #7533 )
...
The last release was in 2016 and it's not required in any currently
supported Python 3 version.
2022-03-22 11:43:59 -07:00
kasium
dd1265c0e6
Mark pre/post tasks in invoke tasks as iterable ( #7531 )
2022-03-22 16:06:22 +01:00
kasium
108c3ab710
Fix wrong return type of invoke decorator ( #7536 )
...
Closes #7530
2022-03-22 14:30:51 +01:00
Sebastian Rittau
b307142f62
Update pytype to 2022.3.21 ( #7532 )
2022-03-22 08:30:03 +00:00
Rebecca Chen
f39f20c4dd
Fix the type signature of multiprocessing.managers.BaseManager.__exit__ ( #7529 )
...
All parameters should accept None.
2022-03-22 07:32:15 +01:00
Harry
eb252afb18
random.sample no longer accepts sets in Python 3.11 ( #7528 )
...
As of 3.11, population must be a Sequence. Automatic conversion of sets to lists is no longer supported.
2022-03-21 18:58:22 -07:00
Harry
71d14b3ee1
random.sample: counts takes Iterable[int] ( #7527 )
2022-03-21 18:18:24 -07:00
Shantanu
0af746d048
mypy_primer: mention if output is truncated ( #7525 )
2022-03-21 23:41:31 +01:00
Jelle Zijlstra
fa9074366b
Revert "Remove google/__init__.pyi ( #6106 )" ( #7522 )
...
This reverts commit a11a6643a7 .
2022-03-21 19:49:00 +01:00
Alex Waygood
74ecce5b68
Improve host parameter of socket.getaddrinfo() ( #7518 )
...
As pointed out by @srittau in #7517 , `bytearray` [is redundant](https://docs.python.org/3/library/typing.html#typing.ByteString ) in a union where `bytes` is also in the union.
2022-03-20 23:35:03 +00:00
kasium
7d77e9c5c1
Fix invoke task decorator ( #7511 )
...
The decorator can be called with and without (). The current types only consider the first case
2022-03-20 16:13:02 -07:00
Nipunn Koorapati
a11a6643a7
Remove google/__init__.pyi ( #6106 )
...
Since google is a namespace package, it won't have an init.
Depends on https://github.com/typeshed-internal/stub_uploader/pull/33
2022-03-20 14:41:16 -07:00
Alex Grönholm
3a8d121890
Fix type of the "host" parameter in asyncio getaddrinfo() ( #7517 )
2022-03-20 13:17:55 +00:00
Jelle Zijlstra
b7d129f727
PEP 604: Remove some more uses of Union/Optional ( #7515 )
...
The following patterns still break mypy:
1. `type[]` at top level fails
2. `tuple[T1, T2]` at top level fails (but `tuple[T1, ...]` is fine)
3. `T1 | Callable[..., T2 | T3]` fails, but only <=3.9
This PR cleans up usage of `Union` and `Optional` outside these patterns.
2022-03-19 08:23:00 -07:00
Alex Waygood
1acc8f3bd6
Use PEP 604 syntax wherever possible, part II ( #7514 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2022-03-19 14:27:35 +00:00
Alex Waygood
340c6c97ed
Add mypy error codes to type: ignores, remove unused ignores ( #7504 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2022-03-19 13:10:00 +00:00
Alex Waygood
4308915e06
Make __hash__ a ClassVar for several classes where it is set to None ( #7485 )
2022-03-19 05:59:10 -07:00
Jelle Zijlstra
d9f1f7b81f
pytz: utcoffset only returns None if dt is None ( #7510 )
2022-03-19 08:19:09 +00:00
Alex Waygood
5c44ae4f8c
Improve various signatures that shouldn't be async def, but currently are ( #7491 )
...
Co-authored-by: Thomas Grainger <tagrain@gmail.com >
2022-03-18 20:54:39 -07:00
Marc Mueller
37a981920f
Use TypeVar for pkgutil.extend_path ( #7473 )
2022-03-18 20:44:38 -07:00
Jelle Zijlstra
4d23919200
Add typing.TypeVarTuple, Unpack, assert_type ( #7501 )
...
python/cpython#31021 and python/cpython#30843 .
2022-03-18 18:03:45 +00:00