mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
Sync with typeshed @ 460537c7f69ea36aa9ad12ca1bfb48ea56239462
Fixes PY-53839, PY-56090, PY-55053, PY-57120, PY-53965, PY-56368, PY-54532 GitOrigin-RevId: 1b80465a7c72f89f48b22d35b69e4da4ea1efd46
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2835cd9d0d
commit
293bb95998
@@ -18,27 +18,25 @@
|
||||
# F405 defined from star imports
|
||||
|
||||
# Rules that we'd like to enable in the future:
|
||||
# Y026 Use typing_extensions.TypeAlias for type aliases (blocked by #4913)
|
||||
# Y027 Disallow importing typing.ContextManager, typing.OrderedDict &
|
||||
# typing_extensions.OrderedDict (cannot be globally enabled while typeshed
|
||||
# still contains stubs supporting Python 2).
|
||||
# Y034 Detect common errors where certain methods are annotated as having a fixed
|
||||
# return type, despite returning self at runtime (temporarily disabled for
|
||||
# typing.pyi, enabled elsewhere).
|
||||
# Y037 Use PEP 604 syntax instead of `typing.Union` and `typing.Optional`.
|
||||
# Currently can't be enabled due to a few lingering bugs in mypy regarding
|
||||
# PEP 604 type aliases (see #4819).
|
||||
|
||||
[flake8]
|
||||
per-file-ignores =
|
||||
*.py: E203, E501
|
||||
*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026
|
||||
*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y037
|
||||
# Since typing.pyi defines "overload" this is not recognized by flake8 as typing.overload.
|
||||
# Unfortunately, flake8 does not allow to "noqa" just a specific error inside the file itself.
|
||||
# https://github.com/PyCQA/flake8/issues/1079
|
||||
# F811 redefinition of unused '...'
|
||||
stubs/*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026, Y027
|
||||
stdlib/@python2/*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026, Y027
|
||||
stdlib/@python2/typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y026, Y027
|
||||
stdlib/typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y026, Y034
|
||||
stubs/*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y027, Y037
|
||||
stdlib/typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y034, Y037
|
||||
|
||||
# We are checking with Python 3 but many of the stubs are Python 2 stubs.
|
||||
builtins = buffer,file,long,raw_input,unicode,xrange
|
||||
exclude = .venv*,.git,*_pb2.pyi
|
||||
exclude = .venv*,.git,*_pb2.pyi,stdlib/@python2/*
|
||||
|
||||
@@ -21,9 +21,7 @@ jobs:
|
||||
matrix:
|
||||
# macos-11 does not have tcl/tk installed, needed for stubtesting tkinter
|
||||
os: ["ubuntu-latest", "windows-latest", "macos-10.15"]
|
||||
# Python 3.9 and 3.10 temporarily pinned due to incompatibilities
|
||||
# between micro versions.
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9.10", "3.10.2"]
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
@@ -35,18 +33,14 @@ jobs:
|
||||
- name: Update pip
|
||||
run: python -m pip install -U pip
|
||||
- name: Install dependencies
|
||||
# Use pre-release stubtest. Keep the following in sync:
|
||||
# - get_mypy_req in tests/stubtest_third_party.py
|
||||
# - stubtest-stdlib in .github/workflows/daily.yml
|
||||
# - stubtest-stdlib in .github/workflows/tests.yml
|
||||
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@c7a81620bef7585cca6905861bb7ef34ec12da2f
|
||||
run: pip install $(grep tomli== requirements-tests.txt) $(grep mypy== requirements-tests.txt)
|
||||
- name: Run stubtest
|
||||
run: python tests/stubtest_stdlib.py
|
||||
|
||||
stubtest-third-party:
|
||||
name: Check third party stubs with stubtest
|
||||
if: github.repository == 'python/typeshed'
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
shard-index: [0, 1, 2, 3]
|
||||
@@ -59,7 +53,9 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pip install $(grep tomli== requirements-tests.txt)
|
||||
- name: Install apt packages
|
||||
run: sudo apt install -y $(python tests/get_apt_packages.py)
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y $(python tests/get_apt_packages.py)
|
||||
- name: Run stubtest
|
||||
run: python tests/stubtest_third_party.py --num-shards 4 --shard-index ${{ matrix.shard-index }}
|
||||
|
||||
|
||||
@@ -38,9 +38,8 @@ jobs:
|
||||
fs.writeFileSync("diff.zip", Buffer.from(download.data));
|
||||
|
||||
- run: unzip diff.zip
|
||||
# 30000 bytes is about 300 lines, posting comment fails if too long
|
||||
- run: |
|
||||
cat diff_*.txt | head -c 30000 | tee fulldiff.txt
|
||||
cat diff_*.txt | tee fulldiff.txt
|
||||
|
||||
- name: Post comment
|
||||
id: post-comment
|
||||
@@ -49,7 +48,11 @@ jobs:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const fs = require('fs')
|
||||
const data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
|
||||
let data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
|
||||
// posting comment fails if too long, so truncate
|
||||
if (data.length > 30000) {
|
||||
data = data.substring(0, 30000) + `\n\n... (truncated ${data.length - 30000} chars) ...\n`
|
||||
}
|
||||
|
||||
let body
|
||||
if (data.trim()) {
|
||||
|
||||
@@ -45,17 +45,17 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.9
|
||||
python-version: "3.10"
|
||||
- run: pip install -r requirements-tests.txt
|
||||
- run: ./tests/pytype_test.py
|
||||
- run: ./tests/pytype_test.py --print-stderr
|
||||
|
||||
mypy:
|
||||
name: Run mypy against the stubs
|
||||
name: Run mypy against typeshed
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform: ["linux", "win32", "darwin"]
|
||||
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"]
|
||||
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
- run: ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}
|
||||
|
||||
pyright:
|
||||
name: Run pyright against the stubs
|
||||
name: Run pyright against typeshed
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
fail-fast: false
|
||||
env:
|
||||
PYRIGHT_VERSION: 1.1.218 # Must match pyright_test.py.
|
||||
PYRIGHT_VERSION: 1.1.240 # Must match pyright_test.py.
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: jakebailey/pyright-action@v1
|
||||
@@ -96,9 +96,7 @@ jobs:
|
||||
matrix:
|
||||
# macos-11 does not have tcl/tk installed, needed for stubtesting tkinter
|
||||
os: ["ubuntu-latest", "windows-latest", "macos-10.15"]
|
||||
# Python 3.9 and 3.10 temporarily pinned due to incompatibilities
|
||||
# between micro versions.
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9.10", "3.10.2"]
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
@@ -110,17 +108,13 @@ jobs:
|
||||
- name: Update pip
|
||||
run: python -m pip install -U pip
|
||||
- name: Install dependencies
|
||||
# Use pre-release stubtest. Keep the following in sync:
|
||||
# - get_mypy_req in tests/stubtest_third_party.py
|
||||
# - stubtest-stdlib in .github/workflows/daily.yml
|
||||
# - stubtest-stdlib in .github/workflows/tests.yml
|
||||
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@c7a81620bef7585cca6905861bb7ef34ec12da2f
|
||||
run: pip install $(grep tomli== requirements-tests.txt) $(grep mypy== requirements-tests.txt)
|
||||
- name: Run stubtest
|
||||
run: python tests/stubtest_stdlib.py
|
||||
|
||||
stubtest-third-party:
|
||||
name: Check third party stubs with stubtest
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.event_name == 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -144,7 +138,7 @@ jobs:
|
||||
APT_PACKAGES=$(python tests/get_apt_packages.py $STUBS)
|
||||
if test -n "$APT_PACKAGES"; then
|
||||
echo "Installing apt packages: $APT_PACKAGES"
|
||||
sudo apt install -y $APT_PACKAGES
|
||||
sudo apt update && sudo apt install -y $APT_PACKAGES
|
||||
fi
|
||||
python tests/stubtest_third_party.py $STUBS
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.1.0 # must match requirements-tests.txt
|
||||
rev: 22.3.0 # must match requirements-tests.txt
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3.9
|
||||
|
||||
@@ -126,10 +126,6 @@ contains the following:
|
||||
* `METADATA.toml`, describing the package. See below for details.
|
||||
* Stubs (i.e. `*.pyi` files) for packages and modules that are shipped in the
|
||||
source distribution.
|
||||
* If the stubs are either Python 2-only, or if the Python 2 and Python 3 stubs
|
||||
are separate, the Python 2 stubs are put in a `@python2` subdirectory.
|
||||
Stubs outside `@python2` are always used with Python 3,
|
||||
and also with Python 2 if `python2 = true` is set in `METADATA.toml` (see below).
|
||||
* (Rarely) some docs specific to a given type stub package in `README` file.
|
||||
|
||||
When a third party stub is added or
|
||||
@@ -163,8 +159,6 @@ supported:
|
||||
When the stubs are updated to a newer version
|
||||
of the library, the version of the stub should be bumped (note that
|
||||
previous versions are still available on PyPI).
|
||||
* `python2` (default: `false`): If set to `true`, the top-level stubs
|
||||
support both Python 2 and Python 3.
|
||||
* `requires` (optional): A list of other stub packages or packages with type
|
||||
information that are imported by the stubs in this package. Only packages
|
||||
generated by typeshed or required by the upstream package are allowed to
|
||||
|
||||
@@ -11,8 +11,17 @@ At present the active maintainers are (alphabetically):
|
||||
* Alex Waygood (@AlexWaygood)
|
||||
* Jelle Zijlstra (@JelleZijlstra)
|
||||
|
||||
Former and inactive maintainers include:
|
||||
Former maintainers include:
|
||||
|
||||
* David Fisher (@ddfisher)
|
||||
* Łukasz Langa (@ambv)
|
||||
* Matthias Kramm (@matthiaskramm)
|
||||
* Greg Price (@gnprice)
|
||||
|
||||
For security reasons, maintainers who haven't been active for twelve months
|
||||
(no PR reviews or merges, no opened PRs, no significant participation in
|
||||
issues or on typing-sig) will have their access rights removed. They will
|
||||
also be moved to the "former maintainers" section here.
|
||||
|
||||
Former maintainers who want their access rights restored should open
|
||||
an issue or mail one of the active maintainers.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.black]
|
||||
line_length = 130
|
||||
target_version = ["py37"]
|
||||
target_version = ["py310"]
|
||||
force-exclude = ".*_pb2.pyi"
|
||||
skip_magic_trailing_comma = true
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"typeshedPath": ".",
|
||||
"include": [
|
||||
"stdlib",
|
||||
"stubs"
|
||||
"stubs",
|
||||
"test_cases"
|
||||
],
|
||||
"exclude": [
|
||||
"**/@python2"
|
||||
@@ -31,8 +32,6 @@
|
||||
"reportUntypedNamedTuple": "error",
|
||||
"reportPrivateUsage": "none",
|
||||
"reportConstantRedefinition": "error",
|
||||
"reportIncompatibleMethodOverride": "error",
|
||||
"reportIncompatibleVariableOverride": "error",
|
||||
"reportInvalidStringEscapeSequence": "error",
|
||||
"reportUnknownArgumentType": "error",
|
||||
"reportUnknownLambdaType": "error",
|
||||
@@ -44,6 +43,10 @@
|
||||
"reportPropertyTypeMismatch": "error",
|
||||
"reportSelfClsParameterName": "error",
|
||||
"reportUnsupportedDunderAll": "error",
|
||||
// Incompatible overrides are out of typeshed's control as they are
|
||||
// inherited from the implementation.
|
||||
"reportIncompatibleMethodOverride": "none",
|
||||
"reportIncompatibleVariableOverride": "none",
|
||||
// Overlapping overloads cannot be enabled at this time because
|
||||
// of the "fractions.Fraction.__pow__" method and "tasks.gather" function.
|
||||
// Mypy's overlapping overload logic misses these issues (see mypy
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
"typeshedPath": ".",
|
||||
"include": [
|
||||
"stdlib",
|
||||
"stubs"
|
||||
"stubs",
|
||||
"test_cases"
|
||||
],
|
||||
"exclude": [
|
||||
"**/@python2",
|
||||
@@ -21,7 +22,6 @@
|
||||
"stubs/aws-xray-sdk",
|
||||
"stubs/babel",
|
||||
"stubs/backports.ssl_match_hostname",
|
||||
"stubs/backports_abc",
|
||||
"stubs/bleach",
|
||||
"stubs/boto",
|
||||
"stubs/beautifulsoup4",
|
||||
@@ -58,6 +58,7 @@
|
||||
"stubs/Pygments",
|
||||
"stubs/PyMySQL",
|
||||
"stubs/python-dateutil",
|
||||
"stubs/python-jose",
|
||||
"stubs/pyvmomi",
|
||||
"stubs/PyYAML",
|
||||
"stubs/redis",
|
||||
@@ -97,8 +98,6 @@
|
||||
"reportUntypedNamedTuple": "error",
|
||||
"reportPrivateUsage": "none",
|
||||
"reportConstantRedefinition": "error",
|
||||
"reportIncompatibleMethodOverride": "error",
|
||||
"reportIncompatibleVariableOverride": "error",
|
||||
"reportInvalidStringEscapeSequence": "error",
|
||||
"reportUnknownParameterType": "error",
|
||||
"reportUnknownArgumentType": "error",
|
||||
@@ -113,6 +112,10 @@
|
||||
"reportPropertyTypeMismatch": "error",
|
||||
"reportSelfClsParameterName": "error",
|
||||
"reportUnsupportedDunderAll": "error",
|
||||
// Incompatible overrides are out of typeshed's control as they are
|
||||
// inherited from the implementation.
|
||||
"reportIncompatibleMethodOverride": "none",
|
||||
"reportIncompatibleVariableOverride": "none",
|
||||
// Overlapping overloads cannot be enabled at this time because
|
||||
// of the "fractions.Fraction.__pow__" method and "tasks.gather" function.
|
||||
// Mypy's overlapping overload logic misses these issues (see mypy
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
mypy==0.931
|
||||
pytype==2022.2.23; platform_system != "Windows" and python_version < "3.10"
|
||||
mypy==0.950
|
||||
pytype==2022.4.26; platform_system != "Windows"
|
||||
# must match .pre-commit-config.yaml
|
||||
black==22.1.0
|
||||
black==22.3.0
|
||||
flake8==4.0.1
|
||||
flake8-bugbear==21.11.29
|
||||
flake8-pyi==22.2.0
|
||||
flake8-pyi==22.4.1
|
||||
# must match .pre-commit-config.yaml
|
||||
isort==5.10.1
|
||||
tomli==1.2.2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from socket import SocketType
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, Text, Union
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, Text
|
||||
|
||||
class BaseServer:
|
||||
address_family: int
|
||||
|
||||
@@ -12,6 +12,7 @@ from typing import (
|
||||
BinaryIO,
|
||||
ByteString,
|
||||
Callable,
|
||||
ClassVar,
|
||||
Container,
|
||||
Dict,
|
||||
FrozenSet,
|
||||
@@ -347,7 +348,7 @@ class unicode(basestring, Sequence[unicode]):
|
||||
def __ge__(self, x: unicode) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
# The argument type is incompatible with Sequence
|
||||
def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore
|
||||
def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore[override]
|
||||
def __iter__(self) -> Iterator[unicode]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
@@ -427,7 +428,7 @@ class str(Sequence[str], basestring):
|
||||
def zfill(self, __width: int) -> str: ...
|
||||
def __add__(self, s: AnyStr) -> AnyStr: ...
|
||||
# Incompatible with Sequence.__contains__
|
||||
def __contains__(self, o: str | Text) -> bool: ... # type: ignore
|
||||
def __contains__(self, o: str | Text) -> bool: ... # type: ignore[override]
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ge__(self, x: Text) -> bool: ...
|
||||
def __getitem__(self, i: int | slice) -> str: ...
|
||||
@@ -507,7 +508,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __repr__(self) -> str: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
__hash__: None # type: ignore
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
@@ -523,7 +524,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __add__(self, s: bytes) -> bytearray: ...
|
||||
def __mul__(self, n: int) -> bytearray: ...
|
||||
# Incompatible with Sequence.__contains__
|
||||
def __contains__(self, o: int | bytes) -> bool: ... # type: ignore
|
||||
def __contains__(self, o: int | bytes) -> bool: ... # type: ignore[override]
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: bytes) -> bool: ...
|
||||
@@ -591,7 +592,7 @@ class slice(object):
|
||||
def __init__(self, stop: Any) -> None: ...
|
||||
@overload
|
||||
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
|
||||
__hash__: None # type: ignore
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def indices(self, len: int) -> Tuple[int, int, int]: ...
|
||||
|
||||
class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
@@ -639,7 +640,7 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
__hash__: None # type: ignore
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
@@ -702,7 +703,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __delitem__(self, v: _KT) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __str__(self) -> str: ...
|
||||
__hash__: None # type: ignore
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class set(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
@@ -745,7 +746,7 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __lt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
__hash__: None # type: ignore
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
|
||||
def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...
|
||||
@@ -805,10 +806,10 @@ class property(object):
|
||||
|
||||
long = int
|
||||
|
||||
class _NotImplementedType(Any): # type: ignore
|
||||
class _NotImplementedType(Any): # type: ignore[misc]
|
||||
# A little weird, but typing the __call__ as NotImplemented makes the error message
|
||||
# for NotImplemented() much better
|
||||
__call__: NotImplemented # type: ignore
|
||||
__call__: NotImplemented # type: ignore[valid-type]
|
||||
|
||||
NotImplemented: _NotImplementedType
|
||||
|
||||
@@ -980,7 +981,7 @@ def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ...
|
||||
@overload
|
||||
def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...
|
||||
def quit(code: object = ...) -> NoReturn: ...
|
||||
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... # noqa: F811
|
||||
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ...
|
||||
def raw_input(__prompt: Any = ...) -> str: ...
|
||||
@overload
|
||||
def reduce(__function: Callable[[_T, _S], _T], __iterable: Iterable[_S], __initializer: _T) -> _T: ...
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import codecs
|
||||
import sys
|
||||
from typing import Any, Callable, Text, Union
|
||||
from typing import Any, Callable, Text
|
||||
|
||||
# For convenience:
|
||||
_Handler = Callable[[Exception], tuple[Text, int]]
|
||||
_String = Union[bytes, str]
|
||||
_Errors = Union[str, Text, None]
|
||||
_Decodable = Union[bytes, Text]
|
||||
_Encodable = Union[bytes, Text]
|
||||
_String = bytes | str
|
||||
_Errors = str | Text | None
|
||||
_Decodable = bytes | Text
|
||||
_Encodable = bytes | Text
|
||||
|
||||
# This type is not exposed; it is defined in unicodeobject.c
|
||||
class _EncodingMap(object):
|
||||
def size(self) -> int: ...
|
||||
|
||||
_MapT = Union[dict[int, int], _EncodingMap]
|
||||
_MapT = dict[int, int] | _EncodingMap
|
||||
|
||||
def register(__search_function: Callable[[str], Any]) -> None: ...
|
||||
def register_error(__errors: str | Text, __handler: _Handler) -> None: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import IO, Any, BinaryIO, Union, overload
|
||||
from typing import IO, Any, BinaryIO, overload
|
||||
|
||||
_chtype = Union[str, bytes, int]
|
||||
_chtype = str | bytes | int
|
||||
|
||||
# ACS codes are only initialized after initscr is called
|
||||
ACS_BBSS: int
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, Text
|
||||
from typing import Any, Callable, Iterable, Mapping, Text
|
||||
|
||||
# TODO recursive type
|
||||
_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
|
||||
_TF = Callable[[FrameType, str, Any], Callable[..., Any] | None]
|
||||
|
||||
_PF = Callable[[FrameType, str, Any], None]
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from _typeshed import Self
|
||||
from mmap import mmap
|
||||
from typing import IO, Any, BinaryIO, Iterable, Text, TextIO, Union
|
||||
from typing import IO, Any, BinaryIO, Iterable, Text, TextIO
|
||||
|
||||
_bytearray_like = Union[bytearray, mmap]
|
||||
_bytearray_like = bytearray | mmap
|
||||
|
||||
DEFAULT_BUFFER_SIZE: int
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ if sys.platform == "win32":
|
||||
def Modify(self, mode: int, record: _Record) -> None: ...
|
||||
def Close(self) -> None: ...
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
# Actual typename Summary, not exposed by the implementation
|
||||
class _Summary:
|
||||
def GetProperty(self, propid: int) -> str | bytes | None: ...
|
||||
@@ -19,8 +19,8 @@ if sys.platform == "win32":
|
||||
def SetProperty(self, propid: int, value: str | bytes) -> None: ...
|
||||
def Persist(self) -> None: ...
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
# Actual typename Database, not exposed by the implementation
|
||||
class _Database:
|
||||
def OpenView(self, sql: str) -> _View: ...
|
||||
@@ -28,8 +28,8 @@ if sys.platform == "win32":
|
||||
def GetSummaryInformation(self, updateCount: int) -> _Summary: ...
|
||||
def Close(self) -> None: ...
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
# Actual typename Record, not exposed by the implementation
|
||||
class _Record:
|
||||
def GetFieldCount(self) -> int: ...
|
||||
@@ -40,8 +40,8 @@ if sys.platform == "win32":
|
||||
def SetInteger(self, field: int, int: int) -> None: ...
|
||||
def ClearData(self) -> None: ...
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
def UuidCreate() -> str: ...
|
||||
def FCICreate(cabname: str, files: list[str]) -> None: ...
|
||||
def OpenDatabase(name: str, flags: int) -> _Database: ...
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import array
|
||||
import mmap
|
||||
from typing import Any, Container, Iterable, Protocol, Text, TypeVar, Union
|
||||
from typing import Any, Container, Iterable, Protocol, Text, TypeVar
|
||||
from typing_extensions import Literal, final
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
@@ -28,7 +28,7 @@ _T_contra = TypeVar("_T_contra", contravariant=True)
|
||||
|
||||
# Use for "self" annotations:
|
||||
# def __enter__(self: Self) -> Self: ...
|
||||
Self = TypeVar("Self") # noqa Y001
|
||||
Self = TypeVar("Self") # noqa: Y001
|
||||
|
||||
class IdentityFunction(Protocol):
|
||||
def __call__(self, __x: _T) -> _T: ...
|
||||
@@ -104,7 +104,7 @@ OpenTextModeUpdating = Literal[
|
||||
]
|
||||
OpenTextModeWriting = Literal["w", "wt", "tw", "a", "at", "ta", "x", "xt", "tx"]
|
||||
OpenTextModeReading = Literal["r", "rt", "tr", "U", "rU", "Ur", "rtU", "rUt", "Urt", "trU", "tUr", "Utr"]
|
||||
OpenTextMode = Union[OpenTextModeUpdating, OpenTextModeWriting, OpenTextModeReading]
|
||||
OpenTextMode = OpenTextModeUpdating | OpenTextModeWriting | OpenTextModeReading
|
||||
OpenBinaryModeUpdating = Literal[
|
||||
"rb+",
|
||||
"r+b",
|
||||
@@ -133,13 +133,13 @@ OpenBinaryModeUpdating = Literal[
|
||||
]
|
||||
OpenBinaryModeWriting = Literal["wb", "bw", "ab", "ba", "xb", "bx"]
|
||||
OpenBinaryModeReading = Literal["rb", "br", "rbU", "rUb", "Urb", "brU", "bUr", "Ubr"]
|
||||
OpenBinaryMode = Union[OpenBinaryModeUpdating, OpenBinaryModeReading, OpenBinaryModeWriting]
|
||||
OpenBinaryMode = OpenBinaryModeUpdating | OpenBinaryModeReading | OpenBinaryModeWriting
|
||||
|
||||
class HasFileno(Protocol):
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
FileDescriptor = int
|
||||
FileDescriptorLike = Union[int, HasFileno]
|
||||
FileDescriptorLike = int | HasFileno
|
||||
|
||||
class SupportsRead(Protocol[_T_co]):
|
||||
def read(self, __length: int = ...) -> _T_co: ...
|
||||
@@ -153,8 +153,8 @@ class SupportsNoArgReadline(Protocol[_T_co]):
|
||||
class SupportsWrite(Protocol[_T_contra]):
|
||||
def write(self, __s: _T_contra) -> Any: ...
|
||||
|
||||
ReadableBuffer = Union[bytes, bytearray, memoryview, array.array[Any], mmap.mmap, buffer]
|
||||
WriteableBuffer = Union[bytearray, memoryview, array.array[Any], mmap.mmap, buffer]
|
||||
ReadableBuffer = bytes | bytearray | memoryview | array.array[Any] | mmap.mmap | buffer
|
||||
WriteableBuffer = bytearray | memoryview | array.array[Any] | mmap.mmap | buffer
|
||||
|
||||
# Used by type checkers for checks involving None (does not exist at runtime)
|
||||
@final
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# file. They are provided for type checking purposes.
|
||||
|
||||
from sys import _OptExcInfo
|
||||
from typing import Any, Callable, Iterable, Optional, Protocol, Text
|
||||
from typing import Any, Callable, Iterable, Protocol, Text
|
||||
|
||||
class StartResponse(Protocol):
|
||||
def __call__(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Any, Union
|
||||
from typing import Any
|
||||
|
||||
if sys.platform == "win32":
|
||||
_KeyType = Union[HKEYType, int]
|
||||
_KeyType = HKEYType | int
|
||||
def CloseKey(__hkey: _KeyType) -> None: ...
|
||||
def ConnectRegistry(__computer_name: str | None, __key: _KeyType) -> HKEYType: ...
|
||||
def CreateKey(__key: _KeyType, __sub_key: str | None) -> HKEYType: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import IO, Any, NamedTuple, Text, Union, overload
|
||||
from typing import IO, Any, NamedTuple, Text, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
class Error(Exception): ...
|
||||
@@ -11,7 +11,7 @@ class _aifc_params(NamedTuple):
|
||||
comptype: bytes
|
||||
compname: bytes
|
||||
|
||||
_File = Union[Text, IO[bytes]]
|
||||
_File = Text | IO[bytes]
|
||||
_Marker = tuple[int, int, bytes]
|
||||
|
||||
class Aifc_read:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from typing import IO, Any, Callable, Generator, Iterable, NoReturn, Pattern, Protocol, Sequence, Text, TypeVar, Union, overload
|
||||
from typing import IO, Any, Callable, Generator, Iterable, NoReturn, Pattern, Protocol, Sequence, Text, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_ActionT = TypeVar("_ActionT", bound=Action)
|
||||
_N = TypeVar("_N")
|
||||
|
||||
_Text = Union[str, unicode]
|
||||
_Text = str | unicode
|
||||
|
||||
ONE_OR_MORE: str
|
||||
OPTIONAL: str
|
||||
@@ -107,11 +107,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
@overload
|
||||
def parse_args(self, args: Sequence[Text] | None = ...) -> Namespace: ...
|
||||
@overload
|
||||
def parse_args(self, args: Sequence[Text] | None, namespace: None) -> Namespace: ... # type: ignore
|
||||
def parse_args(self, args: Sequence[Text] | None, namespace: None) -> Namespace: ... # type: ignore[misc]
|
||||
@overload
|
||||
def parse_args(self, args: Sequence[Text] | None, namespace: _N) -> _N: ...
|
||||
@overload
|
||||
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore
|
||||
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore[misc]
|
||||
@overload
|
||||
def parse_args(self, *, namespace: _N) -> _N: ...
|
||||
def add_subparsers(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from _typeshed import Self
|
||||
from typing import Any, BinaryIO, Generic, Iterable, MutableSequence, Text, TypeVar, Union, overload
|
||||
from typing import Any, BinaryIO, Generic, Iterable, MutableSequence, Text, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_IntTypeCode = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"]
|
||||
_FloatTypeCode = Literal["f", "d"]
|
||||
_UnicodeTypeCode = Literal["u"]
|
||||
_TypeCode = Union[_IntTypeCode, _FloatTypeCode, _UnicodeTypeCode]
|
||||
_TypeCode = _IntTypeCode | _FloatTypeCode | _UnicodeTypeCode
|
||||
|
||||
_T = TypeVar("_T", int, float, Text)
|
||||
|
||||
@@ -28,7 +28,7 @@ class array(MutableSequence[_T], Generic[_T]):
|
||||
def fromfile(self, __f: BinaryIO, __n: int) -> None: ...
|
||||
def fromlist(self, __list: list[_T]) -> None: ...
|
||||
def fromunicode(self, __ustr: str) -> None: ...
|
||||
def index(self, __v: _T) -> int: ... # type: ignore # Overrides Sequence
|
||||
def index(self, __v: _T) -> int: ... # Overrides Sequence
|
||||
def insert(self, __i: int, __v: _T) -> None: ...
|
||||
def pop(self, __i: int = ...) -> _T: ...
|
||||
def read(self, f: BinaryIO, n: int) -> None: ...
|
||||
@@ -45,7 +45,7 @@ class array(MutableSequence[_T], Generic[_T]):
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> array[_T]: ...
|
||||
@overload # type: ignore # Overrides MutableSequence
|
||||
@overload # type: ignore[override]
|
||||
def __setitem__(self, i: int, o: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: array[_T]) -> None: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from socket import SocketType
|
||||
from typing import Any, Optional, overload
|
||||
from typing import Any, overload
|
||||
|
||||
# cyclic dependence with asynchat
|
||||
_maptype = dict[int, Any]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import IO, Union
|
||||
from typing import IO
|
||||
|
||||
_encodable = Union[bytes, unicode]
|
||||
_decodable = Union[bytes, unicode]
|
||||
_encodable = bytes | unicode
|
||||
_decodable = bytes | unicode
|
||||
|
||||
def b64encode(s: _encodable, altchars: bytes | None = ...) -> bytes: ...
|
||||
def b64decode(s: _decodable, altchars: bytes | None = ..., validate: bool = ...) -> bytes: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import IO, Any, Union
|
||||
from typing import IO, Any
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
@@ -13,7 +13,7 @@ class FInfo:
|
||||
Flags: int
|
||||
|
||||
_FileInfoTuple = tuple[str, FInfo, int, int]
|
||||
_FileHandleUnion = Union[str, IO[bytes]]
|
||||
_FileHandleUnion = str | IO[bytes]
|
||||
|
||||
def getfileinfo(name: str) -> _FileInfoTuple: ...
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ from typing import (
|
||||
BinaryIO,
|
||||
ByteString,
|
||||
Callable,
|
||||
ClassVar,
|
||||
Container,
|
||||
Dict,
|
||||
FrozenSet,
|
||||
@@ -347,7 +348,7 @@ class unicode(basestring, Sequence[unicode]):
|
||||
def __ge__(self, x: unicode) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
# The argument type is incompatible with Sequence
|
||||
def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore
|
||||
def __contains__(self, s: unicode | bytes) -> bool: ... # type: ignore[override]
|
||||
def __iter__(self) -> Iterator[unicode]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
@@ -427,7 +428,7 @@ class str(Sequence[str], basestring):
|
||||
def zfill(self, __width: int) -> str: ...
|
||||
def __add__(self, s: AnyStr) -> AnyStr: ...
|
||||
# Incompatible with Sequence.__contains__
|
||||
def __contains__(self, o: str | Text) -> bool: ... # type: ignore
|
||||
def __contains__(self, o: str | Text) -> bool: ... # type: ignore[override]
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ge__(self, x: Text) -> bool: ...
|
||||
def __getitem__(self, i: int | slice) -> str: ...
|
||||
@@ -507,7 +508,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __repr__(self) -> str: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
__hash__: None # type: ignore
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
@@ -523,7 +524,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def __add__(self, s: bytes) -> bytearray: ...
|
||||
def __mul__(self, n: int) -> bytearray: ...
|
||||
# Incompatible with Sequence.__contains__
|
||||
def __contains__(self, o: int | bytes) -> bool: ... # type: ignore
|
||||
def __contains__(self, o: int | bytes) -> bool: ... # type: ignore[override]
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: bytes) -> bool: ...
|
||||
@@ -745,7 +746,7 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __lt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[object]) -> bool: ...
|
||||
def __gt__(self, s: AbstractSet[object]) -> bool: ...
|
||||
__hash__: None # type: ignore
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
|
||||
class frozenset(AbstractSet[_T_co], Generic[_T_co]):
|
||||
def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...
|
||||
@@ -805,10 +806,10 @@ class property(object):
|
||||
|
||||
long = int
|
||||
|
||||
class _NotImplementedType(Any): # type: ignore
|
||||
class _NotImplementedType(Any): # type: ignore[misc]
|
||||
# A little weird, but typing the __call__ as NotImplemented makes the error message
|
||||
# for NotImplemented() much better
|
||||
__call__: NotImplemented # type: ignore
|
||||
__call__: NotImplemented # type: ignore[valid-type]
|
||||
|
||||
NotImplemented: _NotImplementedType
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import io
|
||||
from _typeshed import ReadableBuffer, Self, WriteableBuffer
|
||||
from typing import IO, Any, Iterable, Text, Union
|
||||
from typing import IO, Any, Iterable, Text
|
||||
from typing_extensions import SupportsIndex
|
||||
|
||||
_PathOrFile = Union[Text, IO[bytes]]
|
||||
_PathOrFile = Text | IO[bytes]
|
||||
|
||||
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
|
||||
def decompress(data: bytes) -> bytes: ...
|
||||
@@ -13,7 +13,7 @@ class BZ2File(io.BufferedIOBase, IO[bytes]):
|
||||
def __init__(self, filename: _PathOrFile, mode: str = ..., buffering: Any | None = ..., compresslevel: int = ...) -> None: ...
|
||||
def read(self, size: int | None = ...) -> bytes: ...
|
||||
def read1(self, size: int = ...) -> bytes: ...
|
||||
def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore
|
||||
def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore[override]
|
||||
def readinto(self, b: WriteableBuffer) -> int: ...
|
||||
def readlines(self, size: SupportsIndex = ...) -> list[bytes]: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> int: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import datetime
|
||||
from time import struct_time
|
||||
from typing import Any, Iterable, Optional, Sequence
|
||||
from typing import Any, Iterable, Sequence
|
||||
|
||||
_LocaleType = tuple[Optional[str], Optional[str]]
|
||||
_LocaleType = tuple[str | None, str | None]
|
||||
|
||||
class IllegalMonthError(ValueError):
|
||||
def __init__(self, month: int) -> None: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from typing import SupportsComplex, SupportsFloat, Union
|
||||
from typing import SupportsComplex, SupportsFloat
|
||||
|
||||
e: float
|
||||
pi: float
|
||||
_C = Union[SupportsFloat, SupportsComplex, complex]
|
||||
_C = SupportsFloat | SupportsComplex | complex
|
||||
|
||||
def acos(__z: _C) -> complex: ...
|
||||
def acosh(__z: _C) -> complex: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import types
|
||||
from _typeshed import Self
|
||||
from abc import abstractmethod
|
||||
from typing import IO, Any, BinaryIO, Callable, Generator, Iterable, Iterator, Protocol, Text, TextIO, Union, overload
|
||||
from typing import IO, Any, BinaryIO, Callable, Generator, Iterable, Iterator, Protocol, Text, TextIO, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
# TODO: this only satisfies the most common interface, where
|
||||
@@ -55,11 +55,11 @@ _BytesToBytesEncodingT = Literal[
|
||||
@overload
|
||||
def encode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ...
|
||||
@overload
|
||||
def encode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> str: ... # type: ignore
|
||||
def encode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> str: ...
|
||||
@overload
|
||||
def encode(obj: _Decoded, encoding: str = ..., errors: str = ...) -> _Encoded: ...
|
||||
@overload
|
||||
def decode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... # type: ignore
|
||||
def decode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... # type: ignore[misc]
|
||||
@overload
|
||||
def decode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> Text: ...
|
||||
@overload
|
||||
@@ -243,7 +243,7 @@ class StreamRecoder(BinaryIO):
|
||||
def next(self) -> bytes: ...
|
||||
def __iter__(self: Self) -> Self: ...
|
||||
def write(self, data: bytes) -> int: ...
|
||||
def writelines(self, list: Iterable[bytes]) -> int: ... # type: ignore # it's supposed to return None
|
||||
def writelines(self, list: Iterable[bytes]) -> int: ... # type: ignore[override] # it's supposed to return None
|
||||
def reset(self) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Optional, Protocol, TypeVar
|
||||
from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Protocol, TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -7,7 +7,7 @@ _T_co = TypeVar("_T_co", covariant=True)
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
_ExitFunc = Callable[[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool]
|
||||
_ExitFunc = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], bool]
|
||||
|
||||
class GeneratorContextManager(ContextManager[_T_co]):
|
||||
def __call__(self, func: _F) -> _F: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Any, Callable, Hashable, Optional, SupportsInt, TypeVar, Union
|
||||
from typing import Any, Callable, Hashable, SupportsInt, TypeVar, Union
|
||||
|
||||
_TypeT = TypeVar("_TypeT", bound=type)
|
||||
_Reduce = Union[tuple[Callable[..., _TypeT], tuple[Any, ...]], tuple[Callable[..., _TypeT], tuple[Any, ...], Optional[Any]]]
|
||||
_Reduce = Union[tuple[Callable[..., _TypeT], tuple[Any, ...]], tuple[Callable[..., _TypeT], tuple[Any, ...], Any | None]]
|
||||
|
||||
__all__ = ["pickle", "constructor", "add_extension", "remove_extension", "clear_extension_cache"]
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Any, Callable, Hashable, Optional, SupportsInt, TypeVar, Union
|
||||
from typing import Any, Callable, Hashable, SupportsInt, TypeVar, Union
|
||||
|
||||
_TypeT = TypeVar("_TypeT", bound=type)
|
||||
_Reduce = Union[tuple[Callable[..., _TypeT], tuple[Any, ...]], tuple[Callable[..., _TypeT], tuple[Any, ...], Optional[Any]]]
|
||||
_Reduce = Union[tuple[Callable[..., _TypeT], tuple[Any, ...]], tuple[Callable[..., _TypeT], tuple[Any, ...], Any | None]]
|
||||
|
||||
__all__ = ["pickle", "constructor", "add_extension", "remove_extension", "clear_extension_cache"]
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ from typing import (
|
||||
Iterable,
|
||||
Iterator,
|
||||
Mapping,
|
||||
Optional,
|
||||
Sequence,
|
||||
Text,
|
||||
TypeVar,
|
||||
@@ -59,16 +58,16 @@ pythonapi: PyDLL
|
||||
# Anything that implements the read-write buffer interface.
|
||||
# The buffer interface is defined purely on the C level, so we cannot define a normal Protocol
|
||||
# for it. Instead we have to list the most common stdlib buffer classes in a Union.
|
||||
_WritableBuffer = _UnionT[bytearray, memoryview, array[Any], _CData]
|
||||
_WritableBuffer = bytearray | memoryview | array[Any] | _CData
|
||||
# Same as _WritableBuffer, but also includes read-only buffer types (like bytes).
|
||||
_ReadOnlyBuffer = _UnionT[_WritableBuffer, bytes]
|
||||
_ReadOnlyBuffer = _WritableBuffer | bytes
|
||||
|
||||
class _CDataMeta(type):
|
||||
# By default mypy complains about the following two methods, because strictly speaking cls
|
||||
# might not be a Type[_CT]. However this can never actually happen, because the only class that
|
||||
# uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here.
|
||||
def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore
|
||||
def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore
|
||||
def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc]
|
||||
def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc]
|
||||
|
||||
class _CData(metaclass=_CDataMeta):
|
||||
_b_base: int = ...
|
||||
@@ -81,18 +80,18 @@ class _CData(metaclass=_CDataMeta):
|
||||
@classmethod
|
||||
def from_address(cls: type[Self], address: int) -> Self: ...
|
||||
@classmethod
|
||||
def from_param(cls: type[_CT], obj: Any) -> _UnionT[_CT, _CArgObject]: ...
|
||||
def from_param(cls: type[_CT], obj: Any) -> _CT | _CArgObject: ...
|
||||
@classmethod
|
||||
def in_dll(cls: type[Self], library: CDLL, name: str) -> Self: ...
|
||||
|
||||
class _CanCastTo(_CData): ...
|
||||
class _PointerLike(_CanCastTo): ...
|
||||
|
||||
_ECT = Callable[[Optional[type[_CData]], _FuncPointer, tuple[_CData, ...]], _CData]
|
||||
_ECT = Callable[[type[_CData] | None, _FuncPointer, tuple[_CData, ...]], _CData]
|
||||
_PF = _UnionT[tuple[int], tuple[int, str], tuple[int, str, Any]]
|
||||
|
||||
class _FuncPointer(_PointerLike, _CData):
|
||||
restype: _UnionT[type[_CData], Callable[[int], Any], None] = ...
|
||||
restype: type[_CData] | Callable[[int], Any] | None = ...
|
||||
argtypes: Sequence[type[_CData]] = ...
|
||||
errcheck: _ECT = ...
|
||||
@overload
|
||||
@@ -125,25 +124,25 @@ class _CArgObject: ...
|
||||
|
||||
# Any type that can be implicitly converted to c_void_p when passed as a C function argument.
|
||||
# (bytes is not included here, see below.)
|
||||
_CVoidPLike = _UnionT[_PointerLike, Array[Any], _CArgObject, int]
|
||||
_CVoidPLike = _PointerLike | Array[Any] | _CArgObject | int
|
||||
# Same as above, but including types known to be read-only (i. e. bytes).
|
||||
# This distinction is not strictly necessary (ctypes doesn't differentiate between const
|
||||
# and non-const pointers), but it catches errors like memmove(b'foo', buf, 4)
|
||||
# when memmove(buf, b'foo', 4) was intended.
|
||||
_CVoidConstPLike = _UnionT[_CVoidPLike, bytes]
|
||||
_CVoidConstPLike = _CVoidPLike | bytes
|
||||
|
||||
def addressof(obj: _CData) -> int: ...
|
||||
def alignment(obj_or_type: _UnionT[_CData, type[_CData]]) -> int: ...
|
||||
def alignment(obj_or_type: _CData | type[_CData]) -> int: ...
|
||||
def byref(obj: _CData, offset: int = ...) -> _CArgObject: ...
|
||||
|
||||
_CastT = TypeVar("_CastT", bound=_CanCastTo)
|
||||
|
||||
def cast(obj: _UnionT[_CData, _CArgObject, int], typ: type[_CastT]) -> _CastT: ...
|
||||
def create_string_buffer(init: _UnionT[int, bytes], size: int | None = ...) -> Array[c_char]: ...
|
||||
def cast(obj: _CData | _CArgObject | int, typ: type[_CastT]) -> _CastT: ...
|
||||
def create_string_buffer(init: int | bytes, size: int | None = ...) -> Array[c_char]: ...
|
||||
|
||||
c_buffer = create_string_buffer
|
||||
|
||||
def create_unicode_buffer(init: _UnionT[int, Text], size: int | None = ...) -> Array[c_wchar]: ...
|
||||
def create_unicode_buffer(init: int | Text, size: int | None = ...) -> Array[c_wchar]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def DllCanUnloadNow() -> int: ...
|
||||
@@ -183,7 +182,7 @@ def set_errno(value: int) -> int: ...
|
||||
if sys.platform == "win32":
|
||||
def set_last_error(value: int) -> int: ...
|
||||
|
||||
def sizeof(obj_or_type: _UnionT[_CData, type[_CData]]) -> int: ...
|
||||
def sizeof(obj_or_type: _CData | type[_CData]) -> int: ...
|
||||
def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
@@ -198,10 +197,10 @@ class _SimpleCData(Generic[_T], _CData):
|
||||
class c_byte(_SimpleCData[int]): ...
|
||||
|
||||
class c_char(_SimpleCData[bytes]):
|
||||
def __init__(self, value: _UnionT[int, bytes] = ...) -> None: ...
|
||||
def __init__(self, value: int | bytes = ...) -> None: ...
|
||||
|
||||
class c_char_p(_PointerLike, _SimpleCData[Optional[bytes]]):
|
||||
def __init__(self, value: _UnionT[int, bytes] | None = ...) -> None: ...
|
||||
class c_char_p(_PointerLike, _SimpleCData[bytes | None]):
|
||||
def __init__(self, value: int | bytes | None = ...) -> None: ...
|
||||
|
||||
class c_double(_SimpleCData[float]): ...
|
||||
class c_longdouble(_SimpleCData[float]): ...
|
||||
@@ -225,11 +224,11 @@ class c_uint64(_SimpleCData[int]): ...
|
||||
class c_ulong(_SimpleCData[int]): ...
|
||||
class c_ulonglong(_SimpleCData[int]): ...
|
||||
class c_ushort(_SimpleCData[int]): ...
|
||||
class c_void_p(_PointerLike, _SimpleCData[Optional[int]]): ...
|
||||
class c_void_p(_PointerLike, _SimpleCData[int | None]): ...
|
||||
class c_wchar(_SimpleCData[Text]): ...
|
||||
|
||||
class c_wchar_p(_PointerLike, _SimpleCData[Optional[Text]]):
|
||||
def __init__(self, value: _UnionT[int, Text] | None = ...) -> None: ...
|
||||
class c_wchar_p(_PointerLike, _SimpleCData[Text | None]):
|
||||
def __init__(self, value: int | Text | None = ...) -> None: ...
|
||||
|
||||
class c_bool(_SimpleCData[bool]):
|
||||
def __init__(self, value: bool = ...) -> None: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from _typeshed import Self
|
||||
from time import struct_time
|
||||
from typing import AnyStr, ClassVar, SupportsAbs, Union, overload
|
||||
from typing import AnyStr, ClassVar, SupportsAbs, overload
|
||||
|
||||
_Text = Union[str, unicode]
|
||||
_Text = str | unicode
|
||||
|
||||
MINYEAR: int
|
||||
MAXYEAR: int
|
||||
@@ -214,13 +214,13 @@ class datetime(date):
|
||||
def utcoffset(self) -> timedelta | None: ...
|
||||
def tzname(self) -> str | None: ...
|
||||
def dst(self) -> timedelta | None: ...
|
||||
def __le__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __lt__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __ge__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __gt__(self, other: datetime) -> bool: ... # type: ignore
|
||||
def __le__(self, other: datetime) -> bool: ... # type: ignore[override]
|
||||
def __lt__(self, other: datetime) -> bool: ... # type: ignore[override]
|
||||
def __ge__(self, other: datetime) -> bool: ... # type: ignore[override]
|
||||
def __gt__(self, other: datetime) -> bool: ... # type: ignore[override]
|
||||
def __add__(self, other: timedelta) -> datetime: ...
|
||||
def __radd__(self, other: timedelta) -> datetime: ...
|
||||
@overload # type: ignore
|
||||
@overload # type: ignore[override]
|
||||
def __sub__(self, other: datetime) -> timedelta: ...
|
||||
@overload
|
||||
def __sub__(self, other: timedelta) -> datetime: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Iterator, MutableMapping, Union
|
||||
from typing import Iterator, MutableMapping
|
||||
from typing_extensions import Literal
|
||||
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
_KeyType = str | bytes
|
||||
_ValueType = str | bytes
|
||||
|
||||
class _Database(MutableMapping[_KeyType, bytes]):
|
||||
def close(self) -> None: ...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Iterator, MutableMapping, Union
|
||||
from typing import Iterator, MutableMapping
|
||||
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
_KeyType = str | bytes
|
||||
_ValueType = str | bytes
|
||||
|
||||
error = OSError
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import TypeVar, Union, overload
|
||||
from typing import TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
_KeyType = str | bytes
|
||||
_ValueType = str | bytes
|
||||
|
||||
class error(OSError): ...
|
||||
|
||||
@@ -30,7 +30,7 @@ class _gdbm:
|
||||
def keys(self) -> list[bytes]: ...
|
||||
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
|
||||
def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _gdbm: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import TypeVar, Union, overload
|
||||
from typing import TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_KeyType = Union[str, bytes]
|
||||
_ValueType = Union[str, bytes]
|
||||
_KeyType = str | bytes
|
||||
_ValueType = str | bytes
|
||||
|
||||
class error(OSError): ...
|
||||
|
||||
@@ -29,7 +29,7 @@ class _dbm:
|
||||
def keys(self) -> list[bytes]: ...
|
||||
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
|
||||
# Don't exist at runtime
|
||||
__new__: None # type: ignore
|
||||
__init__: None # type: ignore
|
||||
__new__: None # type: ignore[assignment]
|
||||
__init__: None # type: ignore[assignment]
|
||||
|
||||
def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _dbm: ...
|
||||
|
||||
@@ -2,9 +2,9 @@ from _typeshed import Self
|
||||
from types import TracebackType
|
||||
from typing import Any, Container, NamedTuple, Sequence, Text, Union
|
||||
|
||||
_Decimal = Union[Decimal, int]
|
||||
_Decimal = Decimal | int
|
||||
_DecimalNew = Union[Decimal, float, Text, tuple[int, Sequence[int], int]]
|
||||
_ComparableNum = Union[Decimal, float]
|
||||
_ComparableNum = Decimal | float
|
||||
|
||||
class DecimalTuple(NamedTuple):
|
||||
sign: int
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, Text, TypeVar, Union, overload
|
||||
from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, Text, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# Aliases can't point to type vars, so we need to redeclare AnyStr
|
||||
_StrType = TypeVar("_StrType", Text, bytes)
|
||||
|
||||
_JunkCallback = Union[Callable[[Text], bool], Callable[[str], bool]]
|
||||
_JunkCallback = Callable[[Text], bool] | Callable[[str], bool]
|
||||
|
||||
class Match(NamedTuple):
|
||||
a: int
|
||||
@@ -29,9 +29,7 @@ class SequenceMatcher(Generic[_T]):
|
||||
|
||||
# mypy thinks the signatures of the overloads overlap, but the types still work fine
|
||||
@overload
|
||||
def get_close_matches( # type: ignore
|
||||
word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...
|
||||
) -> list[AnyStr]: ...
|
||||
def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...) -> list[AnyStr]: ... # type: ignore[misc]
|
||||
@overload
|
||||
def get_close_matches(
|
||||
word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ...
|
||||
|
||||
@@ -13,12 +13,12 @@ from opcode import (
|
||||
opmap as opmap,
|
||||
opname as opname,
|
||||
)
|
||||
from typing import Any, Callable, Iterator, Union
|
||||
from typing import Any, Callable, Iterator
|
||||
|
||||
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
|
||||
# for functions (python/mypy#3171)
|
||||
_have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]]
|
||||
_have_code_or_string = Union[_have_code, str, bytes]
|
||||
_have_code = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any]
|
||||
_have_code_or_string = _have_code | str | bytes
|
||||
|
||||
COMPILER_FLAG_NAMES: dict[int, str]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Callable, Optional, Union
|
||||
from typing import Any, Callable, Union
|
||||
|
||||
_Macro = Union[tuple[str], tuple[str, Optional[str]]]
|
||||
_Macro = Union[tuple[str], tuple[str, str | None]]
|
||||
|
||||
def gen_lib_options(
|
||||
compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Mapping, Optional, overload
|
||||
from typing import Any, Mapping, overload
|
||||
|
||||
_Option = tuple[str, Optional[str], str]
|
||||
_Option = tuple[str, str | None, str]
|
||||
_GR = tuple[list[str], OptionDummy]
|
||||
|
||||
def fancy_getopt(
|
||||
|
||||
@@ -20,7 +20,7 @@ class StrictVersion(Version):
|
||||
prerelease: tuple[Text, int] | None
|
||||
def __init__(self, vstring: Text | None = ...) -> None: ...
|
||||
def parse(self: Self, vstring: Text) -> Self: ...
|
||||
def __str__(self) -> str: ... # noqa Y029
|
||||
def __str__(self) -> str: ... # noqa: Y029
|
||||
def __cmp__(self: _T, other: _T | str) -> bool: ...
|
||||
|
||||
class LooseVersion(Version):
|
||||
@@ -29,5 +29,5 @@ class LooseVersion(Version):
|
||||
version: tuple[Text | int, ...]
|
||||
def __init__(self, vstring: Text | None = ...) -> None: ...
|
||||
def parse(self: Self, vstring: Text) -> Self: ...
|
||||
def __str__(self) -> str: ... # noqa Y029
|
||||
def __str__(self) -> str: ... # noqa: Y029
|
||||
def __cmp__(self: _T, other: _T | str) -> bool: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from typing import Callable, Optional, Union
|
||||
from typing import Callable, Union
|
||||
|
||||
_ParamsType = Union[str, None, tuple[str, Optional[str], str]]
|
||||
_ParamsType = Union[str, None, tuple[str, str | None, str]]
|
||||
|
||||
class MIMEApplication(MIMENonMultipart):
|
||||
def __init__(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import AnyStr, Iterable, Union
|
||||
from typing import AnyStr, Iterable
|
||||
|
||||
_EitherStr = Union[str, unicode]
|
||||
_EitherStr = str | unicode
|
||||
|
||||
def fnmatch(filename: _EitherStr, pattern: _EitherStr) -> bool: ...
|
||||
def fnmatchcase(filename: _EitherStr, pattern: _EitherStr) -> bool: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from _typeshed import Self
|
||||
from decimal import Decimal
|
||||
from numbers import Integral, Rational, Real
|
||||
from typing import Union, overload
|
||||
from typing import overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_ComparableNum = Union[int, float, Decimal, Real]
|
||||
_ComparableNum = int | float | Decimal | Real
|
||||
|
||||
@overload
|
||||
def gcd(a: int, b: int) -> int: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from _typeshed import SupportsRead, SupportsReadline
|
||||
from socket import socket
|
||||
from ssl import SSLContext
|
||||
from typing import Any, BinaryIO, Callable, Text, Union
|
||||
from typing import Any, BinaryIO, Callable, Text
|
||||
from typing_extensions import Literal
|
||||
|
||||
_IntOrStr = Union[int, Text]
|
||||
_IntOrStr = int | Text
|
||||
|
||||
MSG_OOB: int
|
||||
FTP_PORT: int
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
from _typeshed import SupportsLessThanT
|
||||
from typing import Sequence, Text, Union, overload
|
||||
from typing import Sequence, Text, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
# All overloads can return empty string. Ideally, Literal[""] would be a valid
|
||||
# Iterable[T], so that Union[List[T], Literal[""]] could be used as a return
|
||||
# type. But because this only works when T is str, we need Sequence[T] instead.
|
||||
@overload
|
||||
def commonprefix(m: Sequence[str]) -> str | Literal[""]: ... # type: ignore
|
||||
def commonprefix(m: Sequence[str]) -> str | Literal[""]: ... # type: ignore[misc]
|
||||
@overload
|
||||
def commonprefix(m: Sequence[Text]) -> Text: ... # type: ignore
|
||||
def commonprefix(m: Sequence[Text]) -> Text: ...
|
||||
@overload
|
||||
def commonprefix(m: Sequence[list[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ...
|
||||
@overload
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
from typing import Union
|
||||
|
||||
_DataType = Union[str, unicode, bytearray, buffer, memoryview]
|
||||
_DataType = str | unicode | bytearray | buffer | memoryview
|
||||
|
||||
class _hash(object): # This is not actually in the module namespace.
|
||||
@property
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from types import ModuleType
|
||||
from typing import Any, AnyStr, Callable, Union, overload
|
||||
from typing import Any, AnyStr, Callable, overload
|
||||
|
||||
# TODO more precise type for object of hashlib
|
||||
_Hash = Any
|
||||
_DigestMod = Union[str, Callable[[], _Hash], ModuleType]
|
||||
_DigestMod = str | Callable[[], _Hash] | ModuleType
|
||||
|
||||
digest_size: None
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ import time
|
||||
from builtins import list as List # alias to avoid name clashes with `IMAP4.list`
|
||||
from socket import socket as _socket
|
||||
from ssl import SSLSocket
|
||||
from typing import IO, Any, Callable, Pattern, Text, Union
|
||||
from typing import IO, Any, Callable, Pattern, Text
|
||||
from typing_extensions import Literal
|
||||
|
||||
# TODO: Commands should use their actual return types, not this type alias.
|
||||
# E.g. tuple[Literal["OK"], list[bytes]]
|
||||
_CommandResults = tuple[str, list[Any]]
|
||||
|
||||
_AnyResponseData = Union[list[None], list[Union[bytes, tuple[bytes, bytes]]]]
|
||||
_AnyResponseData = list[None] | list[bytes | tuple[bytes, bytes]]
|
||||
|
||||
class IMAP4:
|
||||
error: type[Exception] = ...
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from typing import Any, BinaryIO, Callable, Protocol, Text, Union, overload
|
||||
from typing import Any, BinaryIO, Callable, Protocol, Text, overload
|
||||
|
||||
class _ReadableBinary(Protocol):
|
||||
def tell(self) -> int: ...
|
||||
def read(self, size: int) -> bytes: ...
|
||||
def seek(self, offset: int) -> Any: ...
|
||||
|
||||
_File = Union[Text, _ReadableBinary]
|
||||
_File = Text | _ReadableBinary
|
||||
|
||||
@overload
|
||||
def what(file: _File, h: None = ...) -> str | None: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from types import CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType
|
||||
from typing import Any, AnyStr, Callable, NamedTuple, Optional, Sequence, Union
|
||||
from typing import Any, AnyStr, Callable, NamedTuple, Sequence, Union
|
||||
|
||||
# Types and members
|
||||
class EndOfBlock(Exception): ...
|
||||
@@ -104,9 +104,9 @@ class Traceback(NamedTuple):
|
||||
lineno: int
|
||||
function: str
|
||||
code_context: list[str] | None
|
||||
index: int | None # type: ignore
|
||||
index: int | None # type: ignore[assignment]
|
||||
|
||||
_FrameInfo = tuple[FrameType, str, int, str, Optional[list[str]], Optional[int]]
|
||||
_FrameInfo = tuple[FrameType, str, int, str, list[str] | None, int | None]
|
||||
|
||||
def getouterframes(frame: FrameType, context: int = ...) -> list[_FrameInfo]: ...
|
||||
def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _typeshed import Self, StrPath
|
||||
from typing import Optional, Text
|
||||
from typing import Text
|
||||
|
||||
_Label = tuple[int, Optional[Text]]
|
||||
_Label = tuple[int, Text | None]
|
||||
_DFA = list[list[tuple[int, int]]]
|
||||
_DFAS = tuple[_DFA, dict[int, int]]
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from _typeshed import Self
|
||||
from lib2to3.pgen2.grammar import Grammar
|
||||
from typing import Any, Callable, Iterator, Optional, Text, TypeVar, Union
|
||||
from typing import Any, Callable, Iterator, Text, TypeVar
|
||||
|
||||
_P = TypeVar("_P")
|
||||
_NL = Union[Node, Leaf]
|
||||
_NL = Node | Leaf
|
||||
_Context = tuple[Text, int, int]
|
||||
_Results = dict[Text, _NL]
|
||||
_RawNode = tuple[int, Text, _Context, Optional[list[_NL]]]
|
||||
_RawNode = tuple[int, Text, _Context, list[_NL] | None]
|
||||
_Convert = Callable[[Grammar, _RawNode], Any]
|
||||
|
||||
HUGE: int
|
||||
|
||||
@@ -2,13 +2,13 @@ import threading
|
||||
from _typeshed import StrPath, SupportsWrite
|
||||
from time import struct_time
|
||||
from types import FrameType, TracebackType
|
||||
from typing import IO, Any, Callable, Generic, Mapping, MutableMapping, Optional, Sequence, Text, TypeVar, Union, overload
|
||||
from typing import IO, Any, Callable, Generic, Mapping, MutableMapping, Sequence, Text, TypeVar, Union, overload
|
||||
|
||||
_SysExcInfoType = Union[tuple[type, BaseException, Optional[TracebackType]], tuple[None, None, None]]
|
||||
_ExcInfoType = Union[None, bool, _SysExcInfoType]
|
||||
_SysExcInfoType = Union[tuple[type, BaseException, TracebackType | None], tuple[None, None, None]]
|
||||
_ExcInfoType = None | bool | _SysExcInfoType
|
||||
_ArgsType = Union[tuple[Any, ...], Mapping[str, Any]]
|
||||
_FilterType = Union[Filter, Callable[[LogRecord], int]]
|
||||
_Level = Union[int, Text]
|
||||
_FilterType = Filter | Callable[[LogRecord], int]
|
||||
_Level = int | Text
|
||||
|
||||
raiseExceptions: bool
|
||||
logThreads: bool
|
||||
|
||||
@@ -52,7 +52,7 @@ class SocketHandler(Handler):
|
||||
def createSocket(self) -> None: ...
|
||||
|
||||
class DatagramHandler(SocketHandler):
|
||||
def makeSocket(self) -> SocketType: ... # type: ignore
|
||||
def makeSocket(self) -> SocketType: ... # type: ignore[override]
|
||||
|
||||
class SysLogHandler(Handler):
|
||||
LOG_EMERG: int
|
||||
|
||||
@@ -1,26 +1,11 @@
|
||||
import email.message
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
AnyStr,
|
||||
Callable,
|
||||
Generic,
|
||||
Iterable,
|
||||
Iterator,
|
||||
Mapping,
|
||||
Protocol,
|
||||
Sequence,
|
||||
Text,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Mapping, Protocol, Sequence, Text, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_MessageT = TypeVar("_MessageT", bound=Message)
|
||||
_MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]]
|
||||
_MessageData = email.message.Message | bytes | str | IO[str] | IO[bytes]
|
||||
|
||||
class _HasIteritems(Protocol):
|
||||
def iteritems(self) -> Iterator[tuple[str, _MessageData]]: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Mapping, Sequence, Union
|
||||
from typing import Mapping, Sequence
|
||||
|
||||
_Cap = dict[str, Union[str, int]]
|
||||
_Cap = dict[str, str | int]
|
||||
|
||||
def findmatch(
|
||||
caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ...
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
if sys.platform == "win32":
|
||||
|
||||
_SequenceType = list[tuple[str, Optional[str], int]]
|
||||
_SequenceType = list[tuple[str, str | None, int]]
|
||||
|
||||
AdminExecuteSequence: _SequenceType
|
||||
AdminUISequence: _SequenceType
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Optional, Text
|
||||
from typing import Text
|
||||
|
||||
class NetrcParseError(Exception):
|
||||
filename: str | None
|
||||
@@ -7,7 +7,7 @@ class NetrcParseError(Exception):
|
||||
def __init__(self, msg: str, filename: Text | None = ..., lineno: int | None = ...) -> None: ...
|
||||
|
||||
# (login, account, password) tuple
|
||||
_NetrcTuple = tuple[str, Optional[str], Optional[str]]
|
||||
_NetrcTuple = tuple[str, str | None, str | None]
|
||||
|
||||
class netrc:
|
||||
hosts: dict[str, _NetrcTuple]
|
||||
|
||||
@@ -3,9 +3,9 @@ import socket
|
||||
import ssl
|
||||
from _typeshed import Self
|
||||
from builtins import list as List # alias to avoid a name clash with a method named `list` in `_NNTPBase`
|
||||
from typing import IO, Any, Iterable, NamedTuple, Union
|
||||
from typing import IO, Any, Iterable, NamedTuple
|
||||
|
||||
_File = Union[IO[bytes], bytes, str, None]
|
||||
_File = IO[bytes] | bytes | str | None
|
||||
|
||||
class NNTPError(Exception):
|
||||
response: str
|
||||
|
||||
@@ -16,7 +16,6 @@ from typing import (
|
||||
Sequence,
|
||||
Text,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
@@ -269,7 +268,7 @@ def execlpe(file: Text, __arg0: bytes | Text, *args: Any) -> NoReturn: ...
|
||||
|
||||
# The docs say `args: tuple or list of strings`
|
||||
# The implementation enforces tuple or list so we can't use Sequence.
|
||||
_ExecVArgs = Union[tuple[Union[bytes, Text], ...], list[bytes], list[Text], list[Union[bytes, Text]]]
|
||||
_ExecVArgs = tuple[bytes | Text, ...] | list[bytes] | list[Text] | list[bytes | Text]
|
||||
|
||||
def execv(path: Text, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execve(path: Text, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import IO, Any, Callable, Iterator, Optional, Union
|
||||
from typing import IO, Any, Callable, Iterator, Union
|
||||
|
||||
HIGHEST_PROTOCOL: int
|
||||
bytes_types: tuple[type[Any], ...] # undocumented
|
||||
@@ -16,8 +16,8 @@ _reducedtype = Union[
|
||||
str,
|
||||
tuple[Callable[..., Any], tuple[Any, ...]],
|
||||
tuple[Callable[..., Any], tuple[Any, ...], Any],
|
||||
tuple[Callable[..., Any], tuple[Any, ...], Any, Optional[Iterator[Any]]],
|
||||
tuple[Callable[..., Any], tuple[Any, ...], Any, Optional[Iterator[Any]], Optional[Iterator[Any]]],
|
||||
tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None],
|
||||
tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None, Iterator[Any] | None],
|
||||
]
|
||||
|
||||
class Pickler:
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
from _typeshed import SupportsRead
|
||||
from typing import IO, Any, Callable, Iterable, Iterator, Union
|
||||
from typing import IO, Any, Callable, Iterable, Iterator, TypeVar
|
||||
|
||||
Loader = Any
|
||||
MetaPathFinder = Any
|
||||
PathEntryFinder = Any
|
||||
|
||||
_ModuleInfoLike = tuple[Union[MetaPathFinder, PathEntryFinder], str, bool]
|
||||
_PathT = TypeVar("_PathT", bound=Iterable[str])
|
||||
_ModuleInfoLike = tuple[MetaPathFinder | PathEntryFinder, str, bool]
|
||||
|
||||
def extend_path(path: list[str], name: str) -> list[str]: ...
|
||||
def extend_path(path: _PathT, name: str) -> _PathT: ...
|
||||
|
||||
class ImpImporter:
|
||||
def __init__(self, path: str | None = ...) -> None: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import IO, Any, Mapping, Text, Union
|
||||
from typing import IO, Any, Mapping, Text
|
||||
|
||||
_Path = Union[str, Text]
|
||||
_Path = str | Text
|
||||
|
||||
def readPlist(pathOrFile: _Path | IO[bytes]) -> Any: ...
|
||||
def writePlist(value: Mapping[str, Any], pathOrFile: _Path | IO[bytes]) -> None: ...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from _typeshed import Self
|
||||
from cProfile import Profile as _cProfile
|
||||
from profile import Profile
|
||||
from typing import IO, Any, Iterable, Text, TypeVar, Union, overload
|
||||
from typing import IO, Any, Iterable, Text, TypeVar, overload
|
||||
|
||||
_Selector = Union[str, float, int]
|
||||
_Selector = str | float | int
|
||||
_T = TypeVar("_T", bound=Stats)
|
||||
|
||||
class Stats:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Text, Union
|
||||
from typing import Text
|
||||
|
||||
_EitherStr = Union[bytes, Text]
|
||||
_EitherStr = bytes | Text
|
||||
|
||||
class PyCompileError(Exception):
|
||||
exc_type_name: str
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import pyexpat.errors as errors
|
||||
import pyexpat.model as model
|
||||
from _typeshed import SupportsRead
|
||||
from typing import Any, Callable, Optional, Text
|
||||
from typing import Any, Callable, Text
|
||||
|
||||
EXPAT_VERSION: str # undocumented
|
||||
version_info: tuple[int, int, int] # undocumented
|
||||
@@ -19,7 +19,7 @@ XML_PARAM_ENTITY_PARSING_NEVER: int
|
||||
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE: int
|
||||
XML_PARAM_ENTITY_PARSING_ALWAYS: int
|
||||
|
||||
_Model = tuple[int, int, Optional[str], tuple[Any, ...]]
|
||||
_Model = tuple[int, int, str | None, tuple[Any, ...]]
|
||||
|
||||
class XMLParserType(object):
|
||||
def Parse(self, __data: Text | bytes, __isfinal: bool = ...) -> int: ...
|
||||
|
||||
@@ -2,8 +2,8 @@ import sys
|
||||
from typing import Callable, Optional, Sequence, Text
|
||||
|
||||
if sys.platform != "win32":
|
||||
_CompleterT = Optional[Callable[[str, int], Optional[str]]]
|
||||
_CompDispT = Optional[Callable[[str, Sequence[str], int], None]]
|
||||
_CompleterT = Optional[Callable[[str, int], str | None]]
|
||||
_CompDispT = Callable[[str, Sequence[str], int], None] | None
|
||||
def parse_and_bind(__string: str) -> None: ...
|
||||
def read_init_file(__filename: Text | None = ...) -> None: ...
|
||||
def get_line_buffer() -> str: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Union
|
||||
from typing import Any
|
||||
|
||||
_Text = Union[str, unicode]
|
||||
_Text = str | unicode
|
||||
|
||||
class Completer:
|
||||
def __init__(self, namespace: dict[str, Any] | None = ...) -> None: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from _typeshed import Self
|
||||
from typing import Any, Hashable, Iterable, Iterator, MutableMapping, TypeVar, Union
|
||||
from typing import Any, Hashable, Iterable, Iterator, MutableMapping, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_Setlike = Union[BaseSet[_T], Iterable[_T]]
|
||||
_Setlike = BaseSet[_T] | Iterable[_T]
|
||||
|
||||
class BaseSet(Iterable[_T]):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import SupportsRead, SupportsWrite
|
||||
from typing import Any, AnyStr, Callable, Iterable, Sequence, Text, TypeVar, Union
|
||||
from typing import Any, AnyStr, Callable, Iterable, Sequence, Text, TypeVar
|
||||
|
||||
_AnyStr = TypeVar("_AnyStr", str, unicode)
|
||||
_AnyPath = TypeVar("_AnyPath", str, unicode)
|
||||
@@ -21,7 +21,7 @@ def copytree(
|
||||
) -> _PathReturn: ...
|
||||
def rmtree(path: _AnyPath, ignore_errors: bool = ..., onerror: Callable[[Any, _AnyPath, Any], Any] | None = ...) -> None: ...
|
||||
|
||||
_CopyFn = Union[Callable[[str, str], None], Callable[[Text, Text], None]]
|
||||
_CopyFn = Callable[[str, str], None] | Callable[[Text, Text], None]
|
||||
|
||||
def move(src: Text, dst: Text) -> _PathReturn: ...
|
||||
def make_archive(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from types import FrameType
|
||||
from typing import Callable, Union
|
||||
from typing import Callable
|
||||
|
||||
SIG_DFL: int
|
||||
SIG_IGN: int
|
||||
@@ -55,7 +55,7 @@ CTRL_BREAK_EVENT: int
|
||||
|
||||
class ItimerError(IOError): ...
|
||||
|
||||
_HANDLER = Union[Callable[[int, FrameType], None], int, None]
|
||||
_HANDLER = Callable[[int, FrameType], None] | int | None
|
||||
|
||||
def alarm(time: int) -> int: ...
|
||||
def getsignal(signalnum: int) -> _HANDLER: ...
|
||||
|
||||
@@ -9,8 +9,7 @@ class SMTPChannel(asynchat.async_chat):
|
||||
COMMAND: int
|
||||
DATA: int
|
||||
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...) -> None: ...
|
||||
# base asynchat.async_chat.push() accepts bytes
|
||||
def push(self, msg: Text) -> None: ... # type: ignore
|
||||
def push(self, msg: Text) -> None: ...
|
||||
def collect_incoming_data(self, data: bytes) -> None: ...
|
||||
def found_terminator(self) -> None: ...
|
||||
def smtp_HELO(self, arg: str) -> None: ...
|
||||
@@ -35,11 +34,7 @@ class SMTPServer(asyncore.dispatcher):
|
||||
class DebuggingServer(SMTPServer): ...
|
||||
|
||||
class PureProxy(SMTPServer):
|
||||
def process_message( # type: ignore
|
||||
self, peer: _Address, mailfrom: str, rcpttos: list[Text], data: bytes | str
|
||||
) -> str | None: ...
|
||||
def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[Text], data: bytes | str) -> str | None: ... # type: ignore[override]
|
||||
|
||||
class MailmanProxy(PureProxy):
|
||||
def process_message( # type: ignore
|
||||
self, peer: _Address, mailfrom: str, rcpttos: list[Text], data: bytes | str
|
||||
) -> str | None: ...
|
||||
def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[Text], data: bytes | str) -> str | None: ... # type: ignore[override]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Text, Union
|
||||
from typing import Text
|
||||
|
||||
_SndHeaders = tuple[str, int, int, int, Union[int, str]]
|
||||
_SndHeaders = tuple[str, int, int, int, int | str]
|
||||
|
||||
def what(filename: Text) -> _SndHeaders | None: ...
|
||||
def whathdr(filename: Text) -> _SndHeaders | None: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, BinaryIO, Iterable, Text, Union, overload
|
||||
from typing import Any, BinaryIO, Iterable, Text, overload
|
||||
|
||||
# ----- Constants -----
|
||||
# Some socket families are listed in the "Socket families" section of the docs,
|
||||
@@ -373,11 +373,11 @@ class timeout(error):
|
||||
|
||||
# Addresses can be either tuples of varying lengths (AF_INET, AF_INET6,
|
||||
# AF_NETLINK, AF_TIPC) or strings (AF_UNIX).
|
||||
_Address = Union[tuple[Any, ...], str]
|
||||
_Address = tuple[Any, ...] | str
|
||||
_RetAddress = Any
|
||||
# TODO Most methods allow bytes as address objects
|
||||
|
||||
_WriteBuffer = Union[bytearray, memoryview]
|
||||
_WriteBuffer = bytearray | memoryview
|
||||
|
||||
_CMSG = tuple[int, int, bytes]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterable, Match, Optional, Pattern as _Pattern, Union
|
||||
from typing import Any, Iterable, Match, Pattern as _Pattern
|
||||
|
||||
SPECIAL_CHARS: str
|
||||
REPEAT_CHARS: str
|
||||
@@ -21,12 +21,12 @@ class Pattern:
|
||||
def closegroup(self, gid: int) -> None: ...
|
||||
def checkgroup(self, gid: int) -> bool: ...
|
||||
|
||||
_OpSubpatternType = tuple[Optional[int], int, int, SubPattern]
|
||||
_OpSubpatternType = tuple[int | None, int, int, SubPattern]
|
||||
_OpGroupRefExistsType = tuple[int, SubPattern, SubPattern]
|
||||
_OpInType = list[tuple[str, int]]
|
||||
_OpBranchType = tuple[None, list[SubPattern]]
|
||||
_AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType]
|
||||
_CodeType = Union[str, _AvType]
|
||||
_AvType = _OpInType | _OpBranchType | Iterable[SubPattern] | _OpGroupRefExistsType | _OpSubpatternType
|
||||
_CodeType = str | _AvType
|
||||
|
||||
class SubPattern:
|
||||
pattern: str
|
||||
@@ -56,7 +56,7 @@ def isdigit(char: str) -> bool: ...
|
||||
def isname(name: str) -> bool: ...
|
||||
def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ...
|
||||
|
||||
_Template = tuple[list[tuple[int, int]], list[Optional[int]]]
|
||||
_Template = tuple[list[tuple[int, int]], list[int | None]]
|
||||
|
||||
def parse_template(source: str, pattern: _Pattern[Any]) -> _Template: ...
|
||||
def expand_template(template: _Template, match: Match[Any]) -> str: ...
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import socket
|
||||
import sys
|
||||
from _typeshed import Self, StrPath
|
||||
from typing import Any, Callable, ClassVar, Iterable, NamedTuple, Optional, Text, Union, overload
|
||||
from typing import Any, Callable, ClassVar, Iterable, NamedTuple, Text, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_PCTRTT = tuple[tuple[str, str], ...]
|
||||
_PCTRTTT = tuple[_PCTRTT, ...]
|
||||
_PeerCertRetDictType = dict[str, Union[str, _PCTRTTT, _PCTRTT]]
|
||||
_PeerCertRetType = Union[_PeerCertRetDictType, bytes, None]
|
||||
_PeerCertRetDictType = dict[str, str | _PCTRTTT | _PCTRTT]
|
||||
_PeerCertRetType = _PeerCertRetDictType | bytes | None
|
||||
_EnumRetType = list[tuple[bytes, str, Union[set[str], bool]]]
|
||||
_PasswordType = Union[Callable[[], Union[str, bytes]], str, bytes]
|
||||
_PasswordType = Union[Callable[[], str | bytes], str, bytes]
|
||||
|
||||
_SC1ArgT = SSLSocket
|
||||
_SrvnmeCbType = Callable[[_SC1ArgT, Optional[str], SSLSocket], Optional[int]]
|
||||
_SrvnmeCbType = Callable[[_SC1ArgT, str | None, SSLSocket], int | None]
|
||||
|
||||
class SSLError(OSError):
|
||||
library: str
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from array import array
|
||||
from mmap import mmap
|
||||
from typing import Any, Text, Union
|
||||
from typing import Any, Text
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
_FmtType = Union[bytes, Text]
|
||||
_BufferType = Union[array[int], bytes, bytearray, buffer, memoryview, mmap]
|
||||
_WriteBufferType = Union[array[Any], bytearray, buffer, memoryview, mmap]
|
||||
_FmtType = bytes | Text
|
||||
_BufferType = array[int] | bytes | bytearray | buffer | memoryview | mmap
|
||||
_WriteBufferType = array[Any] | bytearray | buffer | memoryview | mmap
|
||||
|
||||
def pack(fmt: _FmtType, *v: Any) -> bytes: ...
|
||||
def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from typing import IO, Any, Callable, Generic, Mapping, Optional, Sequence, Text, TypeVar, Union
|
||||
from typing import IO, Any, Callable, Generic, Mapping, Sequence, Text, TypeVar
|
||||
|
||||
_FILE = Union[None, int, IO[Any]]
|
||||
_TXT = Union[bytes, Text]
|
||||
_CMD = Union[_TXT, Sequence[_TXT]]
|
||||
_ENV = Union[Mapping[bytes, _TXT], Mapping[Text, _TXT]]
|
||||
_FILE = None | int | IO[Any]
|
||||
_TXT = bytes | Text
|
||||
_CMD = _TXT | Sequence[_TXT]
|
||||
_ENV = Mapping[bytes, _TXT] | Mapping[Text, _TXT]
|
||||
|
||||
# Same args as Popen.__init__
|
||||
def call(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import IO, Any, NoReturn, Text, Union
|
||||
from typing import IO, Any, NoReturn, Text
|
||||
|
||||
_File = Union[Text, IO[bytes]]
|
||||
_File = Text | IO[bytes]
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from typing import Any, Union
|
||||
from typing import Any
|
||||
|
||||
if sys.platform != "win32":
|
||||
_Attr = list[Union[int, list[Union[bytes, int]]]]
|
||||
_Attr = list[int | list[bytes | int]]
|
||||
|
||||
# TODO constants not really documented
|
||||
B0: int
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, Text, TypeVar
|
||||
from typing import Any, Callable, Iterable, Mapping, Text, TypeVar
|
||||
|
||||
# TODO recursive type
|
||||
_TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
|
||||
_TF = Callable[[FrameType, str, Any], Callable[..., Any] | None]
|
||||
|
||||
_PF = Callable[[FrameType, str, Any], None]
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from typing import IO, Any, Callable, Sequence, Text, Union
|
||||
from typing import IO, Any, Callable, Sequence, Text
|
||||
|
||||
_str = Union[str, Text]
|
||||
_str = str | Text
|
||||
_Timer = Callable[[], float]
|
||||
_stmt = Union[_str, Callable[[], Any]]
|
||||
_stmt = _str | Callable[[], Any]
|
||||
|
||||
default_timer: _Timer
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import types
|
||||
from _typeshed import StrPath
|
||||
from typing import Any, Callable, Mapping, Optional, Sequence, TypeVar
|
||||
from typing import Any, Callable, Mapping, Sequence, TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
_localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]]
|
||||
_fileModuleFunction = tuple[str, Optional[str], str]
|
||||
_fileModuleFunction = tuple[str, str | None, str]
|
||||
|
||||
class CoverageResults:
|
||||
def __init__(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from types import FrameType, TracebackType
|
||||
from typing import IO, Optional
|
||||
from typing import IO
|
||||
|
||||
_PT = tuple[str, int, str, Optional[str]]
|
||||
_PT = tuple[str, int, str, str | None]
|
||||
|
||||
def print_tb(tb: TracebackType | None, limit: int | None = ..., file: IO[str] | None = ...) -> None: ...
|
||||
def print_exception(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from typing import IO, Union
|
||||
from typing import IO
|
||||
|
||||
_FD = Union[int, IO[str]]
|
||||
_FD = int | IO[str]
|
||||
|
||||
if sys.platform != "win32":
|
||||
# XXX: Undocumented integer constants
|
||||
|
||||
@@ -15,7 +15,7 @@ _AnyColor = Any
|
||||
# TODO: Replace this with a TypedDict once it becomes standardized.
|
||||
_PenState = dict[str, Any]
|
||||
|
||||
_Speed = Union[str, float]
|
||||
_Speed = str | float
|
||||
_PolygonCoords = Sequence[tuple[float, float]]
|
||||
|
||||
# TODO: Type this more accurately
|
||||
@@ -175,7 +175,7 @@ class TPen(object):
|
||||
def isvisible(self) -> bool: ...
|
||||
# Note: signatures 1 and 2 overlap unsafely when no arguments are provided
|
||||
@overload
|
||||
def pen(self) -> _PenState: ... # type: ignore
|
||||
def pen(self) -> _PenState: ... # type: ignore[misc]
|
||||
@overload
|
||||
def pen(
|
||||
self,
|
||||
@@ -215,7 +215,7 @@ class RawTurtle(TPen, TNavigator):
|
||||
def shape(self, name: str) -> None: ...
|
||||
# Unsafely overlaps when no arguments are provided
|
||||
@overload
|
||||
def shapesize(self) -> tuple[float, float, float]: ... # type: ignore
|
||||
def shapesize(self) -> tuple[float, float, float]: ... # type: ignore[misc]
|
||||
@overload
|
||||
def shapesize(
|
||||
self, stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ...
|
||||
@@ -423,7 +423,7 @@ def isvisible() -> bool: ...
|
||||
|
||||
# Note: signatures 1 and 2 overlap unsafely when no arguments are provided
|
||||
@overload
|
||||
def pen() -> _PenState: ... # type: ignore
|
||||
def pen() -> _PenState: ... # type: ignore[misc]
|
||||
@overload
|
||||
def pen(
|
||||
pen: _PenState | None = ...,
|
||||
@@ -459,7 +459,7 @@ def shape(name: str) -> None: ...
|
||||
|
||||
# Unsafely overlaps when no arguments are provided
|
||||
@overload
|
||||
def shapesize() -> tuple[float, float, float]: ... # type: ignore
|
||||
def shapesize() -> tuple[float, float, float]: ... # type: ignore[misc]
|
||||
@overload
|
||||
def shapesize(stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ...) -> None: ...
|
||||
def settiltangle(angle: float) -> None: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import abc
|
||||
from _typeshed import Self
|
||||
from typing import ( # noqa Y022
|
||||
from typing import ( # noqa: Y022
|
||||
TYPE_CHECKING as TYPE_CHECKING,
|
||||
Any,
|
||||
Callable,
|
||||
@@ -47,8 +47,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
# Using NoReturn so that only calls using mypy plugin hook that specialize the signature
|
||||
# can go through.
|
||||
def setdefault(self, k: NoReturn, default: object) -> object: ...
|
||||
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ...
|
||||
def update(self: _T, __m: _T) -> None: ...
|
||||
def has_key(self, k: str) -> bool: ...
|
||||
def viewitems(self) -> ItemsView[str, object]: ...
|
||||
|
||||
@@ -10,7 +10,7 @@ _FT = TypeVar("_FT")
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
_ExceptionType = Union[type[BaseException], tuple[type[BaseException], ...]]
|
||||
_Regexp = Union[Text, Pattern[Text]]
|
||||
_Regexp = Text | Pattern[Text]
|
||||
|
||||
_SysExcInfoType = Union[tuple[type[BaseException], BaseException, types.TracebackType], tuple[None, None, None]]
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import ssl
|
||||
from httplib import HTTPConnectionProtocol, HTTPResponse
|
||||
from typing import Any, AnyStr, Callable, Mapping, Sequence, Text, Union
|
||||
from typing import Any, AnyStr, Callable, Mapping, Sequence, Text
|
||||
from urllib import addinfourl
|
||||
|
||||
_string = Union[str, unicode]
|
||||
_string = str | unicode
|
||||
|
||||
class URLError(IOError):
|
||||
reason: str | BaseException
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import AnyStr, NamedTuple, Sequence, Union, overload
|
||||
from typing import AnyStr, NamedTuple, Sequence, overload
|
||||
|
||||
_String = Union[str, unicode]
|
||||
_String = str | unicode
|
||||
|
||||
uses_relative: list[str]
|
||||
uses_netloc: list[str]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import BinaryIO, Text, Union
|
||||
from typing import BinaryIO, Text
|
||||
|
||||
_File = Union[Text, BinaryIO]
|
||||
_File = Text | BinaryIO
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import IO, Any, BinaryIO, NoReturn, Text, Union
|
||||
from typing import IO, Any, BinaryIO, NoReturn, Text
|
||||
|
||||
_File = Union[Text, IO[bytes]]
|
||||
_File = Text | IO[bytes]
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
|
||||
class KeyedRef(ref[_T], Generic[_KT, _T]):
|
||||
key: _KT
|
||||
# This __new__ method uses a non-standard name for the "cls" parameter
|
||||
def __new__(type, ob: _T, callback: Callable[[_T], Any], key: _KT) -> KeyedRef[_KT, _T]: ... # type: ignore
|
||||
def __new__(type, ob: _T, callback: Callable[[_T], Any], key: _KT) -> KeyedRef[_KT, _T]: ...
|
||||
def __init__(self, ob: _T, callback: Callable[[_T], Any], key: _KT) -> None: ...
|
||||
|
||||
class WeakKeyDictionary(MutableMapping[_KT, _VT]):
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user