From 9ccf4589a0cc8f0c5a8cc2c07c485da6d7118767 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Thu, 7 Jul 2022 13:18:44 +0100 Subject: [PATCH] Fix various `TypeAlias` issues (#8248) --- stubs/Flask-Cors/flask_cors/core.pyi | 2 +- stubs/gdb/gdb/__init__.pyi | 6 +-- stubs/ldap3/ldap3/protocol/microsoft.pyi | 12 ++--- stubs/ldap3/ldap3/protocol/novell.pyi | 46 +++++++++---------- .../ldap3/ldap3/protocol/persistentSearch.pyi | 10 ++-- stubs/ldap3/ldap3/protocol/rfc2696.pyi | 12 ++--- stubs/ldap3/ldap3/protocol/rfc3062.pyi | 16 +++---- stubs/ldap3/ldap3/utils/asn1.pyi | 4 +- 8 files changed, 54 insertions(+), 54 deletions(-) diff --git a/stubs/Flask-Cors/flask_cors/core.pyi b/stubs/Flask-Cors/flask_cors/core.pyi index 7d760a187..edf326cdf 100644 --- a/stubs/Flask-Cors/flask_cors/core.pyi +++ b/stubs/Flask-Cors/flask_cors/core.pyi @@ -36,7 +36,7 @@ ACL_REQUEST_HEADERS: str ALL_METHODS: list[str] CONFIG_OPTIONS: list[str] FLASK_CORS_EVALUATED: str -RegexObject: TypeAlias = Pattern[str] +RegexObject: type[Pattern[str]] DEFAULT_OPTIONS: _Options def parse_resources(resources: dict[str, _Options] | Iterable[str] | str | Pattern[str]) -> list[tuple[str, _Options]]: ... diff --git a/stubs/gdb/gdb/__init__.pyi b/stubs/gdb/gdb/__init__.pyi index e3e92736a..7c31ee7ab 100644 --- a/stubs/gdb/gdb/__init__.pyi +++ b/stubs/gdb/gdb/__init__.pyi @@ -242,7 +242,7 @@ class Unwinder: def inferiors() -> tuple[Inferior, ...]: ... def selected_inferior() -> Inferior: ... -BufferType: TypeAlias = _typeshed.ReadableBuffer +_BufferType: TypeAlias = _typeshed.ReadableBuffer class Inferior: num: int @@ -255,8 +255,8 @@ class Inferior: def threads(self) -> tuple[InferiorThread, ...]: ... def architecture(self) -> Architecture: ... def read_memory(self, address: _ValueOrInt, length: int) -> memoryview: ... - def write_memory(self, address: _ValueOrInt, buffer: BufferType, length: int = ...) -> memoryview: ... - def search_memory(self, address: _ValueOrInt, length: int, pattern: BufferType) -> int | None: ... + def write_memory(self, address: _ValueOrInt, buffer: _BufferType, length: int = ...) -> memoryview: ... + def search_memory(self, address: _ValueOrInt, length: int, pattern: _BufferType) -> int | None: ... def thread_from_handle(self, handle: Value) -> InferiorThread: ... # Threads diff --git a/stubs/ldap3/ldap3/protocol/microsoft.pyi b/stubs/ldap3/ldap3/protocol/microsoft.pyi index 8c3f8ddc1..2200343b2 100644 --- a/stubs/ldap3/ldap3/protocol/microsoft.pyi +++ b/stubs/ldap3/ldap3/protocol/microsoft.pyi @@ -3,22 +3,22 @@ from typing_extensions import TypeAlias # Enable when pyasn1 gets stubs: # from pyasn1.type.univ import Sequence -Sequence: TypeAlias = Any +_Sequence: TypeAlias = Any -class SicilyBindResponse(Sequence): +class SicilyBindResponse(_Sequence): tagSet: Any componentType: Any -class DirSyncControlRequestValue(Sequence): +class DirSyncControlRequestValue(_Sequence): componentType: Any -class DirSyncControlResponseValue(Sequence): +class DirSyncControlResponseValue(_Sequence): componentType: Any -class SdFlags(Sequence): +class SdFlags(_Sequence): componentType: Any -class ExtendedDN(Sequence): +class ExtendedDN(_Sequence): componentType: Any def dir_sync_control(criticality, object_security, ancestors_first, public_data_only, incremental_values, max_length, cookie): ... diff --git a/stubs/ldap3/ldap3/protocol/novell.pyi b/stubs/ldap3/ldap3/protocol/novell.pyi index 97cd30705..60c5c913a 100644 --- a/stubs/ldap3/ldap3/protocol/novell.pyi +++ b/stubs/ldap3/ldap3/protocol/novell.pyi @@ -3,71 +3,71 @@ from typing_extensions import TypeAlias # Enable when pyasn1 gets stubs: # from pyasn1.type.univ import Integer, OctetString, Sequence, SequenceOf -Integer: TypeAlias = Any -OctetString: TypeAlias = Any -Sequence: TypeAlias = Any -SequenceOf: TypeAlias = Any +_Integer: TypeAlias = Any +_OctetString: TypeAlias = Any +_Sequence: TypeAlias = Any +_SequenceOf: TypeAlias = Any NMAS_LDAP_EXT_VERSION: int -class Identity(OctetString): +class Identity(_OctetString): encoding: str -class LDAPDN(OctetString): +class LDAPDN(_OctetString): tagSet: Any encoding: str -class Password(OctetString): +class Password(_OctetString): tagSet: Any encoding: str -class LDAPOID(OctetString): +class LDAPOID(_OctetString): tagSet: Any encoding: str -class GroupCookie(Integer): +class GroupCookie(_Integer): tagSet: Any -class NmasVer(Integer): +class NmasVer(_Integer): tagSet: Any -class Error(Integer): +class Error(_Integer): tagSet: Any -class NmasGetUniversalPasswordRequestValue(Sequence): +class NmasGetUniversalPasswordRequestValue(_Sequence): componentType: Any -class NmasGetUniversalPasswordResponseValue(Sequence): +class NmasGetUniversalPasswordResponseValue(_Sequence): componentType: Any -class NmasSetUniversalPasswordRequestValue(Sequence): +class NmasSetUniversalPasswordRequestValue(_Sequence): componentType: Any -class NmasSetUniversalPasswordResponseValue(Sequence): +class NmasSetUniversalPasswordResponseValue(_Sequence): componentType: Any -class ReplicaList(SequenceOf): +class ReplicaList(_SequenceOf): componentType: Any -class ReplicaInfoRequestValue(Sequence): +class ReplicaInfoRequestValue(_Sequence): tagSet: Any componentType: Any -class ReplicaInfoResponseValue(Sequence): +class ReplicaInfoResponseValue(_Sequence): tagSet: Any componentType: Any -class CreateGroupTypeRequestValue(Sequence): +class CreateGroupTypeRequestValue(_Sequence): componentType: Any -class CreateGroupTypeResponseValue(Sequence): +class CreateGroupTypeResponseValue(_Sequence): componentType: Any -class EndGroupTypeRequestValue(Sequence): +class EndGroupTypeRequestValue(_Sequence): componentType: Any -class EndGroupTypeResponseValue(Sequence): +class EndGroupTypeResponseValue(_Sequence): componentType: Any -class GroupingControlValue(Sequence): +class GroupingControlValue(_Sequence): componentType: Any diff --git a/stubs/ldap3/ldap3/protocol/persistentSearch.pyi b/stubs/ldap3/ldap3/protocol/persistentSearch.pyi index 5714e7db6..3d19c087d 100644 --- a/stubs/ldap3/ldap3/protocol/persistentSearch.pyi +++ b/stubs/ldap3/ldap3/protocol/persistentSearch.pyi @@ -3,16 +3,16 @@ from typing_extensions import TypeAlias # Enable when pyasn1 gets stubs: # from pyasn1.type.univ import Enumerated, Sequence -Enumerated: TypeAlias = Any -Sequence: TypeAlias = Any +_Enumerated: TypeAlias = Any +_Sequence: TypeAlias = Any -class PersistentSearchControl(Sequence): +class PersistentSearchControl(_Sequence): componentType: Any -class ChangeType(Enumerated): +class ChangeType(_Enumerated): namedValues: Any -class EntryChangeNotificationControl(Sequence): +class EntryChangeNotificationControl(_Sequence): componentType: Any def persistent_search_control(change_types, changes_only: bool = ..., return_ecs: bool = ..., criticality: bool = ...): ... diff --git a/stubs/ldap3/ldap3/protocol/rfc2696.pyi b/stubs/ldap3/ldap3/protocol/rfc2696.pyi index 829e5e83a..c131194a6 100644 --- a/stubs/ldap3/ldap3/protocol/rfc2696.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc2696.pyi @@ -3,20 +3,20 @@ from typing_extensions import TypeAlias # Enable when pyasn1 gets stubs: # from pyasn1.type.univ import Integer, OctetString, Sequence -Integer: TypeAlias = Any -OctetString: TypeAlias = Any -Sequence: TypeAlias = Any +_Integer: TypeAlias = Any +_OctetString: TypeAlias = Any +_Sequence: TypeAlias = Any MAXINT: Any rangeInt0ToMaxConstraint: Any -class Integer0ToMax(Integer): +class Integer0ToMax(_Integer): subtypeSpec: Any class Size(Integer0ToMax): ... -class Cookie(OctetString): ... +class Cookie(_OctetString): ... -class RealSearchControlValue(Sequence): +class RealSearchControlValue(_Sequence): componentType: Any def paged_search_control(criticality: bool = ..., size: int = ..., cookie: Any | None = ...): ... diff --git a/stubs/ldap3/ldap3/protocol/rfc3062.pyi b/stubs/ldap3/ldap3/protocol/rfc3062.pyi index 945468e3e..7076147ce 100644 --- a/stubs/ldap3/ldap3/protocol/rfc3062.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc3062.pyi @@ -3,27 +3,27 @@ from typing_extensions import TypeAlias # Enable when pyasn1 gets stubs: # from pyasn1.type.univ import OctetString, Sequence -OctetString: TypeAlias = Any -Sequence: TypeAlias = Any +_OctetString: TypeAlias = Any +_Sequence: TypeAlias = Any -class UserIdentity(OctetString): +class UserIdentity(_OctetString): tagSet: Any encoding: str -class OldPasswd(OctetString): +class OldPasswd(_OctetString): tagSet: Any encoding: str -class NewPasswd(OctetString): +class NewPasswd(_OctetString): tagSet: Any encoding: str -class GenPasswd(OctetString): +class GenPasswd(_OctetString): tagSet: Any encoding: str -class PasswdModifyRequestValue(Sequence): +class PasswdModifyRequestValue(_Sequence): componentType: Any -class PasswdModifyResponseValue(Sequence): +class PasswdModifyResponseValue(_Sequence): componentType: Any diff --git a/stubs/ldap3/ldap3/utils/asn1.pyi b/stubs/ldap3/ldap3/utils/asn1.pyi index 475514ff1..6af8d2c53 100644 --- a/stubs/ldap3/ldap3/utils/asn1.pyi +++ b/stubs/ldap3/ldap3/utils/asn1.pyi @@ -3,11 +3,11 @@ from typing_extensions import TypeAlias # Enable when pyasn1 gets stubs: # from pyasn1.codec.ber.encoder import AbstractItemEncoder -AbstractItemEncoder: TypeAlias = Any +_AbstractItemEncoder: TypeAlias = Any CLASSES: Any -class LDAPBooleanEncoder(AbstractItemEncoder): +class LDAPBooleanEncoder(_AbstractItemEncoder): supportIndefLenMode: bool # Requires pyasn1 > 0.3.7 def encodeValue(self, value, asn1Spec, encodeFun, **options): ...