mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -34,7 +34,7 @@ class CDLL(object):
|
||||
_handle: int = ...
|
||||
_FuncPtr: Type[_FuncPointer] = ...
|
||||
def __init__(
|
||||
self, name: Optional[str], mode: int = ..., handle: Optional[int] = ..., use_errno: bool = ..., use_last_error: bool = ...
|
||||
self, name: str | None, mode: int = ..., handle: int | None = ..., use_errno: bool = ..., use_last_error: bool = ...
|
||||
) -> None: ...
|
||||
def __getattr__(self, name: str) -> _NamedFuncPointer: ...
|
||||
def __getitem__(self, name: str) -> _NamedFuncPointer: ...
|
||||
@@ -75,7 +75,7 @@ class _CDataMeta(type):
|
||||
class _CData(metaclass=_CDataMeta):
|
||||
_b_base: int = ...
|
||||
_b_needsfree_: bool = ...
|
||||
_objects: Optional[Mapping[Any, int]] = ...
|
||||
_objects: Mapping[Any, int] | None = ...
|
||||
@classmethod
|
||||
def from_buffer(cls: Type[_CT], source: _WritableBuffer, offset: int = ...) -> _CT: ...
|
||||
@classmethod
|
||||
@@ -113,15 +113,15 @@ class _NamedFuncPointer(_FuncPointer):
|
||||
class ArgumentError(Exception): ...
|
||||
|
||||
def CFUNCTYPE(
|
||||
restype: Optional[Type[_CData]], *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
|
||||
restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
|
||||
) -> Type[_FuncPointer]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def WINFUNCTYPE(
|
||||
restype: Optional[Type[_CData]], *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
|
||||
restype: Type[_CData] | None, *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ...
|
||||
) -> Type[_FuncPointer]: ...
|
||||
|
||||
def PYFUNCTYPE(restype: Optional[Type[_CData]], *argtypes: Type[_CData]) -> Type[_FuncPointer]: ...
|
||||
def PYFUNCTYPE(restype: Type[_CData] | None, *argtypes: Type[_CData]) -> Type[_FuncPointer]: ...
|
||||
|
||||
class _CArgObject: ...
|
||||
|
||||
@@ -141,11 +141,11 @@ 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: Optional[int] = ...) -> Array[c_char]: ...
|
||||
def create_string_buffer(init: _UnionT[int, bytes], size: int | None = ...) -> Array[c_char]: ...
|
||||
|
||||
c_buffer = create_string_buffer
|
||||
|
||||
def create_unicode_buffer(init: _UnionT[int, Text], size: Optional[int] = ...) -> Array[c_wchar]: ...
|
||||
def create_unicode_buffer(init: _UnionT[int, Text], size: int | None = ...) -> Array[c_wchar]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def DllCanUnloadNow() -> int: ...
|
||||
@@ -189,7 +189,7 @@ def sizeof(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ...
|
||||
def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def WinError(code: Optional[int] = ..., descr: Optional[str] = ...) -> OSError: ...
|
||||
def WinError(code: int | None = ..., descr: str | None = ...) -> OSError: ...
|
||||
|
||||
def wstring_at(address: _CVoidConstPLike, size: int = ...) -> str: ...
|
||||
|
||||
@@ -203,7 +203,7 @@ class c_char(_SimpleCData[bytes]):
|
||||
def __init__(self, value: _UnionT[int, bytes] = ...) -> None: ...
|
||||
|
||||
class c_char_p(_PointerLike, _SimpleCData[Optional[bytes]]):
|
||||
def __init__(self, value: Optional[_UnionT[int, bytes]] = ...) -> None: ...
|
||||
def __init__(self, value: _UnionT[int, bytes] | None = ...) -> None: ...
|
||||
|
||||
class c_double(_SimpleCData[float]): ...
|
||||
class c_longdouble(_SimpleCData[float]): ...
|
||||
@@ -231,7 +231,7 @@ class c_void_p(_PointerLike, _SimpleCData[Optional[int]]): ...
|
||||
class c_wchar(_SimpleCData[Text]): ...
|
||||
|
||||
class c_wchar_p(_PointerLike, _SimpleCData[Optional[Text]]):
|
||||
def __init__(self, value: Optional[_UnionT[int, Text]] = ...) -> None: ...
|
||||
def __init__(self, value: _UnionT[int, Text] | None = ...) -> None: ...
|
||||
|
||||
class c_bool(_SimpleCData[bool]):
|
||||
def __init__(self, value: bool = ...) -> None: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
def find_library(name: str) -> Optional[str]: ...
|
||||
def find_library(name: str) -> str | None: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def find_msvcrt() -> Optional[str]: ...
|
||||
def find_msvcrt() -> str | None: ...
|
||||
|
||||
Reference in New Issue
Block a user