Skip to content

Commit

Permalink
Merge branch 'main' into Bump-networkx-to-3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Jan 30, 2024
2 parents 8598451 + c50a641 commit fb561be
Show file tree
Hide file tree
Showing 24 changed files with 133 additions and 148 deletions.
1 change: 1 addition & 0 deletions pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"stdlib/distutils/dist.pyi",
"stdlib/importlib/readers.pyi",
"stdlib/lib2to3/fixes/*.pyi",
"stdlib/numbers.pyi",
"stdlib/_tkinter.pyi",
"stdlib/tkinter/__init__.pyi",
"stdlib/tkinter/filedialog.pyi",
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pytype==2023.12.18; platform_system != "Windows" and python_version < "3.12"
ruff==0.1.11 # must match .pre-commit-config.yaml and tests.yml

# Libraries used by our various scripts.
aiohttp==3.9.1
aiohttp==3.9.2
packaging==23.2
pathspec>=0.11.1
pyyaml==6.0.1
Expand Down
81 changes: 41 additions & 40 deletions stdlib/numbers.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Note: these stubs are incomplete. The more complex type
# signatures are currently omitted.

from _typeshed import Incomplete
from abc import ABCMeta, abstractmethod
from typing import Any, SupportsFloat, overload
from typing import SupportsFloat, overload

__all__ = ["Number", "Complex", "Real", "Rational", "Integral"]

Expand All @@ -16,36 +17,36 @@ class Complex(Number):
def __bool__(self) -> bool: ...
@property
@abstractmethod
def real(self) -> Any: ...
def real(self): ...
@property
@abstractmethod
def imag(self) -> Any: ...
def imag(self): ...
@abstractmethod
def __add__(self, other: Any) -> Any: ...
def __add__(self, other): ...
@abstractmethod
def __radd__(self, other: Any) -> Any: ...
def __radd__(self, other): ...
@abstractmethod
def __neg__(self) -> Any: ...
def __neg__(self): ...
@abstractmethod
def __pos__(self) -> Any: ...
def __sub__(self, other: Any) -> Any: ...
def __rsub__(self, other: Any) -> Any: ...
def __pos__(self): ...
def __sub__(self, other): ...
def __rsub__(self, other): ...
@abstractmethod
def __mul__(self, other: Any) -> Any: ...
def __mul__(self, other): ...
@abstractmethod
def __rmul__(self, other: Any) -> Any: ...
def __rmul__(self, other): ...
@abstractmethod
def __truediv__(self, other: Any) -> Any: ...
def __truediv__(self, other): ...
@abstractmethod
def __rtruediv__(self, other: Any) -> Any: ...
def __rtruediv__(self, other): ...
@abstractmethod
def __pow__(self, exponent: Any) -> Any: ...
def __pow__(self, exponent): ...
@abstractmethod
def __rpow__(self, base: Any) -> Any: ...
def __rpow__(self, base): ...
@abstractmethod
def __abs__(self) -> Real: ...
@abstractmethod
def conjugate(self) -> Any: ...
def conjugate(self): ...
@abstractmethod
def __eq__(self, other: object) -> bool: ...

Expand All @@ -63,27 +64,27 @@ class Real(Complex, SupportsFloat):
def __round__(self, ndigits: None = None) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: int) -> Any: ...
def __divmod__(self, other: Any) -> Any: ...
def __rdivmod__(self, other: Any) -> Any: ...
def __round__(self, ndigits: int): ...
def __divmod__(self, other): ...
def __rdivmod__(self, other): ...
@abstractmethod
def __floordiv__(self, other: Any) -> int: ...
def __floordiv__(self, other) -> int: ...
@abstractmethod
def __rfloordiv__(self, other: Any) -> int: ...
def __rfloordiv__(self, other) -> int: ...
@abstractmethod
def __mod__(self, other: Any) -> Any: ...
def __mod__(self, other): ...
@abstractmethod
def __rmod__(self, other: Any) -> Any: ...
def __rmod__(self, other): ...
@abstractmethod
def __lt__(self, other: Any) -> bool: ...
def __lt__(self, other) -> bool: ...
@abstractmethod
def __le__(self, other: Any) -> bool: ...
def __le__(self, other) -> bool: ...
def __complex__(self) -> complex: ...
@property
def real(self) -> Any: ...
def real(self): ...
@property
def imag(self) -> Any: ...
def conjugate(self) -> Any: ...
def imag(self): ...
def conjugate(self): ...

class Rational(Real):
@property
Expand All @@ -99,29 +100,29 @@ class Integral(Rational):
def __int__(self) -> int: ...
def __index__(self) -> int: ...
@abstractmethod
def __pow__(self, exponent: Any, modulus: Any | None = None) -> Any: ...
def __pow__(self, exponent, modulus: Incomplete | None = None): ...
@abstractmethod
def __lshift__(self, other: Any) -> Any: ...
def __lshift__(self, other): ...
@abstractmethod
def __rlshift__(self, other: Any) -> Any: ...
def __rlshift__(self, other): ...
@abstractmethod
def __rshift__(self, other: Any) -> Any: ...
def __rshift__(self, other): ...
@abstractmethod
def __rrshift__(self, other: Any) -> Any: ...
def __rrshift__(self, other): ...
@abstractmethod
def __and__(self, other: Any) -> Any: ...
def __and__(self, other): ...
@abstractmethod
def __rand__(self, other: Any) -> Any: ...
def __rand__(self, other): ...
@abstractmethod
def __xor__(self, other: Any) -> Any: ...
def __xor__(self, other): ...
@abstractmethod
def __rxor__(self, other: Any) -> Any: ...
def __rxor__(self, other): ...
@abstractmethod
def __or__(self, other: Any) -> Any: ...
def __or__(self, other): ...
@abstractmethod
def __ror__(self, other: Any) -> Any: ...
def __ror__(self, other): ...
@abstractmethod
def __invert__(self) -> Any: ...
def __invert__(self): ...
def __float__(self) -> float: ...
@property
def numerator(self) -> int: ...
Expand Down
5 changes: 2 additions & 3 deletions stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ from . import path as _path
if sys.version_info >= (3, 9):
from types import GenericAlias

if sys.platform != "win32":
from resource import struct_rusage

# This unnecessary alias is to work around various errors
path = _path

Expand Down Expand Up @@ -978,6 +975,8 @@ else:

def waitid(__idtype: int, __ident: int, __options: int) -> waitid_result | None: ...

from resource import struct_rusage

def wait3(options: int) -> tuple[int, int, struct_rusage]: ...
def wait4(pid: int, options: int) -> tuple[int, int, struct_rusage]: ...
def WCOREDUMP(__status: int) -> bool: ...
Expand Down
8 changes: 4 additions & 4 deletions stdlib/posixpath.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from _typeshed import AnyOrLiteralStr, BytesPath, FileDescriptorOrPath, StrOrBytesPath, StrPath
from collections.abc import Sequence
from collections.abc import Iterable
from genericpath import (
commonprefix as commonprefix,
exists as exists,
Expand Down Expand Up @@ -102,11 +102,11 @@ def normpath(path: PathLike[AnyStr]) -> AnyStr: ...
@overload
def normpath(path: AnyOrLiteralStr) -> AnyOrLiteralStr: ...
@overload
def commonpath(paths: Sequence[LiteralString]) -> LiteralString: ...
def commonpath(paths: Iterable[LiteralString]) -> LiteralString: ...
@overload
def commonpath(paths: Sequence[StrPath]) -> str: ...
def commonpath(paths: Iterable[StrPath]) -> str: ...
@overload
def commonpath(paths: Sequence[BytesPath]) -> bytes: ...
def commonpath(paths: Iterable[BytesPath]) -> bytes: ...

# First parameter is not actually pos-only,
# but must be defined as pos-only in the stub or cross-platform code doesn't type-check,
Expand Down
8 changes: 8 additions & 0 deletions stubs/RPi.GPIO/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = "0.7.*"
upstream_repository = "https://sourceforge.net/p/raspberry-gpio-python/code/"

[tool.stubtest]
# When stubtest tries to import this module:
# error: RPi.GPIO failed to import. RuntimeError: This module can only be run on a Raspberry Pi!
# https://sourceforge.net/p/raspberry-gpio-python/code/ci/08048dd1894a6b09a104557b6eaa6bb68b6baac5/tree/source/py_gpio.c#l1008
skip = true
60 changes: 60 additions & 0 deletions stubs/RPi.GPIO/RPi/GPIO/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from collections.abc import Callable
from typing import Literal, TypedDict
from typing_extensions import TypeAlias

class _RPi_Info(TypedDict):
P1_REVISION: int
REVISION: str
TYPE: str
MANUFACTURER: str
PROCESSOR: str
RAM: str

VERSION: str
RPI_INFO: _RPi_Info
RPI_REVISION: int

HIGH: Literal[1]
LOW: Literal[0]

OUT: int
IN: int
HARD_PWM: int
SERIAL: int
I2C: int
SPI: int
UNKNOWN: int

BOARD: int
BCM: int

PUD_OFF: int
PUD_UP: int
PUD_DOWN: int

RISING: int
FALLING: int
BOTH: int

_EventCallback: TypeAlias = Callable[[int], object]

def setup(channel: int, dir: int, pull_up_down: int = ..., initial: int = ...) -> None: ...
def cleanup(channel: int = 0) -> None: ...
def output(channel: int, state: int | bool) -> None: ...
def input(channel: int) -> int: ...
def setmode(mode: int) -> None: ...
def getmode() -> int: ...
def add_event_detect(channel: int, edge: int, callback: _EventCallback | None, bouncetime: int = ...) -> None: ...
def remove_event_detect(channel: int) -> None: ...
def event_detected(channel: int) -> bool: ...
def add_event_callback(channel: int, callback: _EventCallback) -> None: ...
def wait_for_edge(channel: int, edge: int, bouncetime: int = ..., timeout: int = ...) -> int | None: ...
def gpio_function(channel: int) -> int: ...
def setwarnings(gpio_warnings: bool) -> None: ...

class PWM:
def __init__(self, channel: int, frequency: float) -> None: ...
def start(self, dutycycle: float) -> None: ...
def ChangeDutyCycle(self, dutycycle: float) -> None: ...
def ChangeFrequence(self, frequency: float) -> None: ...
def stop(self) -> None: ...
Empty file added stubs/RPi.GPIO/RPi/__init__.pyi
Empty file.
6 changes: 0 additions & 6 deletions stubs/flake8-plugin-utils/@tests/stubtest_allowlist.txt

This file was deleted.

7 changes: 0 additions & 7 deletions stubs/flake8-plugin-utils/METADATA.toml

This file was deleted.

9 changes: 0 additions & 9 deletions stubs/flake8-plugin-utils/flake8_plugin_utils/__init__.pyi

This file was deleted.

41 changes: 0 additions & 41 deletions stubs/flake8-plugin-utils/flake8_plugin_utils/plugin.pyi

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion stubs/pyOpenSSL/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "23.3.*"
version = "24.0.*"
upstream_repository = "https://github.com/pyca/pyopenssl"
# Requires a version of cryptography with a `py.typed` file
requires = ["cryptography>=35.0.0"]
Expand Down
1 change: 1 addition & 0 deletions stubs/pyOpenSSL/OpenSSL/SSL.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class Connection:
def get_peer_finished(self) -> bytes | None: ...
def set_alpn_protos(self, protos: Sequence[bytes]) -> None: ...
def get_alpn_proto_negotiated(self) -> bytes: ...
def get_selected_srtp_profile(self) -> bytes: ...
def request_ocsp(self) -> None: ...

_T = TypeVar("_T")
Expand Down
2 changes: 1 addition & 1 deletion stubs/pytz/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "2023.3.post1"
version = "2023.4"
# This is a mirror of https://git.launchpad.net/pytz/tree, see https://pythonhosted.org/pytz/#latest-versions
upstream_repository = "https://github.com/stub42/pytz"
3 changes: 2 additions & 1 deletion stubs/pywin32/@tests/stubtest_allowlist_win32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pythoncom.MakeTime
# Deprecated and makes a buffer of random junk. Use something like `b"\x00" * bufferSize` instead
(win32.)?win(32|xp)gui.PyMakeBuffer

# Axdebug is not built on Python 3.11 anyway: https://github.com/mhammond/pywin32/blob/main/setup.py#L403-L405
#
# failed to import, ImportError: DLL load failed while importing axdebug: The specified module could not be found.
win32com.axdebug.axdebug
win32com(ext)?.axdebug.codecontainer
Expand All @@ -66,7 +68,6 @@ win32com(ext)?.axdebug.documents
win32com(ext)?.axdebug.expressions
# failed to import, ModuleNotFoundError: No module named 'expressions'
win32com(ext)?.axdebug.stackframe
# Axdebug is not built on Python 3.11: https://github.com/mhammond/pywin32/blob/main/setup.py#L405
# failed to import, ImportError: cannot import name 'axdebug' from 'win32com.axdebug'
win32com.axdebug.gateways
win32comext.axdebug.gateways
Expand Down
Loading

0 comments on commit fb561be

Please sign in to comment.