From 97e09acde4c6f2186caedf74a4eac9ce126a85d2 Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 6 Jan 2023 14:59:14 -0500 Subject: [PATCH 1/7] Use pyasn1 in ldap3 --- stubs/ldap3/METADATA.toml | 2 +- .../ldap3/extend/novell/endTransaction.pyi | 12 +- stubs/ldap3/ldap3/extend/novell/getBindDn.pyi | 4 +- .../ldap3/extend/novell/listReplicas.pyi | 10 +- .../novell/nmasGetUniversalPassword.pyi | 10 +- .../novell/nmasSetUniversalPassword.pyi | 10 +- .../ldap3/extend/novell/startTransaction.pyi | 12 +- stubs/ldap3/ldap3/extend/operation.pyi | 28 +- .../ldap3/extend/standard/modifyPassword.pyi | 20 +- stubs/ldap3/ldap3/protocol/microsoft.pyi | 31 +-- stubs/ldap3/ldap3/protocol/novell.pyi | 90 +++---- .../ldap3/ldap3/protocol/persistentSearch.pyi | 22 +- stubs/ldap3/ldap3/protocol/rfc2696.pyi | 28 +- stubs/ldap3/ldap3/protocol/rfc3062.pyi | 34 ++- stubs/ldap3/ldap3/protocol/rfc4511.pyi | 246 +++++++++--------- stubs/ldap3/ldap3/utils/asn1.pyi | 60 +++-- 16 files changed, 310 insertions(+), 309 deletions(-) diff --git a/stubs/ldap3/METADATA.toml b/stubs/ldap3/METADATA.toml index 77ff5706c1d9..d47a19ed354b 100644 --- a/stubs/ldap3/METADATA.toml +++ b/stubs/ldap3/METADATA.toml @@ -1,2 +1,2 @@ version = "2.9.*" -requires = [] # requires types-pyasn1 (not available yet) +requires = ["types-pyasn1"] diff --git a/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi b/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi index f0e8c5896949..f9a6ca613df8 100644 --- a/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi +++ b/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi @@ -1,14 +1,16 @@ -from typing import Any +from _typeshed import Incomplete + +from ldap3.protocol.novell import EndGroupTypeResponseValue from ...extend.operation import ExtendedOperation class EndTransaction(ExtendedOperation): request_name: str response_name: str - request_value: Any - asn1_spec: Any + request_value: Incomplete + asn1_spec: EndGroupTypeResponseValue | None def config(self) -> None: ... - def __init__(self, connection, commit: bool = ..., controls: Any | None = ...) -> None: ... + def __init__(self, connection, commit: bool = ..., controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... - response_value: Any + response_value: Incomplete def set_response(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi b/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi index 4c194ce82909..9cff46ad38a9 100644 --- a/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi +++ b/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi @@ -1,4 +1,4 @@ -from typing import Any +from ldap3.protocol.novell import Identity from ...extend.operation import ExtendedOperation @@ -6,6 +6,6 @@ class GetBindDn(ExtendedOperation): request_name: str response_name: str response_attribute: str - asn1_spec: Any + asn1_spec: Identity | None def config(self) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi b/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi index 0c7b6e7a80af..95eded5956eb 100644 --- a/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi +++ b/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi @@ -1,13 +1,15 @@ -from typing import Any +from _typeshed import Incomplete + +from ldap3.protocol.novell import ReplicaList from ...extend.operation import ExtendedOperation class ListReplicas(ExtendedOperation): request_name: str response_name: str - request_value: Any - asn1_spec: Any + request_value: Incomplete + asn1_spec: ReplicaList | None response_attribute: str def config(self) -> None: ... - def __init__(self, connection, server_dn, controls: Any | None = ...) -> None: ... + def __init__(self, connection, server_dn, controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi b/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi index 59d0f1ca37ac..b9684c90d40d 100644 --- a/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi +++ b/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi @@ -1,13 +1,15 @@ -from typing import Any +from _typeshed import Incomplete + +from ldap3.protocol.novell import NmasGetUniversalPasswordResponseValue from ...extend.operation import ExtendedOperation class NmasGetUniversalPassword(ExtendedOperation): request_name: str response_name: str - request_value: Any - asn1_spec: Any + request_value: Incomplete + asn1_spec: NmasGetUniversalPasswordResponseValue | None response_attribute: str def config(self) -> None: ... - def __init__(self, connection, user, controls: Any | None = ...) -> None: ... + def __init__(self, connection, user, controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi b/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi index a35b984ba8f2..8264a535f5cd 100644 --- a/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi +++ b/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi @@ -1,13 +1,15 @@ -from typing import Any +from _typeshed import Incomplete + +from ldap3.protocol.novell import NmasSetUniversalPasswordResponseValue from ...extend.operation import ExtendedOperation class NmasSetUniversalPassword(ExtendedOperation): request_name: str response_name: str - request_value: Any - asn1_spec: Any + request_value: Incomplete + asn1_spec: NmasSetUniversalPasswordResponseValue | None response_attribute: str def config(self) -> None: ... - def __init__(self, connection, user, new_password, controls: Any | None = ...) -> None: ... + def __init__(self, connection, user, new_password, controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi b/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi index 74dd78c5cf06..75466eabd4cd 100644 --- a/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi +++ b/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi @@ -1,14 +1,16 @@ -from typing import Any +from _typeshed import Incomplete + +from ldap3.protocol.novell import CreateGroupTypeResponseValue from ...extend.operation import ExtendedOperation class StartTransaction(ExtendedOperation): request_name: str response_name: str - request_value: Any - asn1_spec: Any + request_value: Incomplete + asn1_spec: CreateGroupTypeResponseValue | None def config(self) -> None: ... - def __init__(self, connection, controls: Any | None = ...) -> None: ... + def __init__(self, connection, controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... - response_value: Any + response_value: Incomplete def set_response(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/operation.pyi b/stubs/ldap3/ldap3/extend/operation.pyi index 4b14b4b5333d..f7952a585e33 100644 --- a/stubs/ldap3/ldap3/extend/operation.pyi +++ b/stubs/ldap3/ldap3/extend/operation.pyi @@ -1,19 +1,21 @@ -from typing import Any +from _typeshed import Incomplete + +from pyasn1.type.base import Asn1Type class ExtendedOperation: - connection: Any - decoded_response: Any - result: Any - asn1_spec: Any - request_name: Any - response_name: Any - request_value: Any - response_value: Any - response_attribute: Any - controls: Any - def __init__(self, connection, controls: Any | None = ...) -> None: ... + connection: Incomplete + decoded_response: Incomplete + result: Incomplete + asn1_spec: Asn1Type | None + request_name: Incomplete + response_name: Incomplete + request_value: Incomplete + response_value: Incomplete + response_attribute: Incomplete + controls: Incomplete + def __init__(self, connection, controls: Incomplete | None = ...) -> None: ... def send(self): ... def populate_result(self) -> None: ... - def decode_response(self, response: Any | None = ...) -> None: ... + def decode_response(self, response: Incomplete | None = ...) -> None: ... def set_response(self) -> None: ... def config(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi b/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi index 5df4b6d1ecbd..1e37bd332a10 100644 --- a/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi +++ b/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi @@ -1,21 +1,23 @@ -from typing import Any +from _typeshed import Incomplete + +from ldap3.protocol.rfc3062 import PasswdModifyResponseValue from ...extend.operation import ExtendedOperation class ModifyPassword(ExtendedOperation): request_name: str - request_value: Any - asn1_spec: Any + request_value: Incomplete + asn1_spec: PasswdModifyResponseValue | None response_attribute: str def config(self) -> None: ... def __init__( self, connection, - user: Any | None = ..., - old_password: Any | None = ..., - new_password: Any | None = ..., - hash_algorithm: Any | None = ..., - salt: Any | None = ..., - controls: Any | None = ..., + user: Incomplete | None = ..., + old_password: Incomplete | None = ..., + new_password: Incomplete | None = ..., + hash_algorithm: Incomplete | None = ..., + salt: Incomplete | None = ..., + controls: Incomplete | None = ..., ) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/protocol/microsoft.pyi b/stubs/ldap3/ldap3/protocol/microsoft.pyi index 2200343b2426..c2961a7d5017 100644 --- a/stubs/ldap3/ldap3/protocol/microsoft.pyi +++ b/stubs/ldap3/ldap3/protocol/microsoft.pyi @@ -1,25 +1,22 @@ -from typing import Any -from typing_extensions import TypeAlias +from pyasn1.type.namedtype import NamedTypes +from pyasn1.type.tag import TagSet +from pyasn1.type.univ import Sequence -# Enable when pyasn1 gets stubs: -# from pyasn1.type.univ import Sequence -_Sequence: TypeAlias = Any +class SicilyBindResponse(Sequence): + tagSet: TagSet + componentType: NamedTypes -class SicilyBindResponse(_Sequence): - tagSet: Any - componentType: Any +class DirSyncControlRequestValue(Sequence): + componentType: NamedTypes -class DirSyncControlRequestValue(_Sequence): - componentType: Any +class DirSyncControlResponseValue(Sequence): + componentType: NamedTypes -class DirSyncControlResponseValue(_Sequence): - componentType: Any +class SdFlags(Sequence): + componentType: NamedTypes -class SdFlags(_Sequence): - componentType: Any - -class ExtendedDN(_Sequence): - componentType: Any +class ExtendedDN(Sequence): + componentType: NamedTypes def dir_sync_control(criticality, object_security, ancestors_first, public_data_only, incremental_values, max_length, cookie): ... def extended_dn_control(criticality: bool = ..., hex_format: bool = ...): ... diff --git a/stubs/ldap3/ldap3/protocol/novell.pyi b/stubs/ldap3/ldap3/protocol/novell.pyi index 60c5c913a75d..e7ff4e91e0b9 100644 --- a/stubs/ldap3/ldap3/protocol/novell.pyi +++ b/stubs/ldap3/ldap3/protocol/novell.pyi @@ -1,73 +1,67 @@ -from typing import Any -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 +from pyasn1.type.namedtype import NamedTypes +from pyasn1.type.tag import TagSet +from pyasn1.type.univ import Integer, OctetString, Sequence, SequenceOf NMAS_LDAP_EXT_VERSION: int -class Identity(_OctetString): +class Identity(OctetString): encoding: str -class LDAPDN(_OctetString): - tagSet: Any +class LDAPDN(OctetString): + tagSet: TagSet encoding: str -class Password(_OctetString): - tagSet: Any +class Password(OctetString): + tagSet: TagSet encoding: str -class LDAPOID(_OctetString): - tagSet: Any +class LDAPOID(OctetString): + tagSet: TagSet encoding: str -class GroupCookie(_Integer): - tagSet: Any +class GroupCookie(Integer): + tagSet: TagSet -class NmasVer(_Integer): - tagSet: Any +class NmasVer(Integer): + tagSet: TagSet -class Error(_Integer): - tagSet: Any +class Error(Integer): + tagSet: TagSet -class NmasGetUniversalPasswordRequestValue(_Sequence): - componentType: Any +class NmasGetUniversalPasswordRequestValue(Sequence): + componentType: NamedTypes -class NmasGetUniversalPasswordResponseValue(_Sequence): - componentType: Any +class NmasGetUniversalPasswordResponseValue(Sequence): + componentType: NamedTypes -class NmasSetUniversalPasswordRequestValue(_Sequence): - componentType: Any +class NmasSetUniversalPasswordRequestValue(Sequence): + componentType: NamedTypes -class NmasSetUniversalPasswordResponseValue(_Sequence): - componentType: Any +class NmasSetUniversalPasswordResponseValue(Sequence): + componentType: NamedTypes -class ReplicaList(_SequenceOf): - componentType: Any +class ReplicaList(SequenceOf): + componentType: NamedTypes -class ReplicaInfoRequestValue(_Sequence): - tagSet: Any - componentType: Any +class ReplicaInfoRequestValue(Sequence): + tagSet: TagSet + componentType: NamedTypes -class ReplicaInfoResponseValue(_Sequence): - tagSet: Any - componentType: Any +class ReplicaInfoResponseValue(Sequence): + tagSet: TagSet + componentType: NamedTypes -class CreateGroupTypeRequestValue(_Sequence): - componentType: Any +class CreateGroupTypeRequestValue(Sequence): + componentType: NamedTypes -class CreateGroupTypeResponseValue(_Sequence): - componentType: Any +class CreateGroupTypeResponseValue(Sequence): + componentType: NamedTypes -class EndGroupTypeRequestValue(_Sequence): - componentType: Any +class EndGroupTypeRequestValue(Sequence): + componentType: NamedTypes -class EndGroupTypeResponseValue(_Sequence): - componentType: Any +class EndGroupTypeResponseValue(Sequence): + componentType: NamedTypes -class GroupingControlValue(_Sequence): - componentType: Any +class GroupingControlValue(Sequence): + componentType: NamedTypes diff --git a/stubs/ldap3/ldap3/protocol/persistentSearch.pyi b/stubs/ldap3/ldap3/protocol/persistentSearch.pyi index 3d19c087d4de..c584d407060d 100644 --- a/stubs/ldap3/ldap3/protocol/persistentSearch.pyi +++ b/stubs/ldap3/ldap3/protocol/persistentSearch.pyi @@ -1,18 +1,14 @@ -from typing import Any -from typing_extensions import TypeAlias +from pyasn1.type.namedtype import NamedTypes +from pyasn1.type.namedval import NamedValues +from pyasn1.type.univ import Enumerated, Sequence -# Enable when pyasn1 gets stubs: -# from pyasn1.type.univ import Enumerated, Sequence -_Enumerated: TypeAlias = Any -_Sequence: TypeAlias = Any +class PersistentSearchControl(Sequence): + componentType: NamedTypes -class PersistentSearchControl(_Sequence): - componentType: Any +class ChangeType(Enumerated): + namedValues: NamedValues -class ChangeType(_Enumerated): - namedValues: Any - -class EntryChangeNotificationControl(_Sequence): - componentType: Any +class EntryChangeNotificationControl(Sequence): + componentType: NamedTypes 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 c131194a662f..28159c273ee0 100644 --- a/stubs/ldap3/ldap3/protocol/rfc2696.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc2696.pyi @@ -1,22 +1,20 @@ -from typing import Any -from typing_extensions import TypeAlias +from _typeshed import Incomplete +from typing_extensions import Final -# Enable when pyasn1 gets stubs: -# from pyasn1.type.univ import Integer, OctetString, Sequence -_Integer: TypeAlias = Any -_OctetString: TypeAlias = Any -_Sequence: TypeAlias = Any +from pyasn1.type.constraint import ConstraintsIntersection, ValueRangeConstraint +from pyasn1.type.namedtype import NamedTypes +from pyasn1.type.univ import Integer, OctetString, Sequence -MAXINT: Any -rangeInt0ToMaxConstraint: Any +MAXINT: Final[Integer] +rangeInt0ToMaxConstraint: ValueRangeConstraint -class Integer0ToMax(_Integer): - subtypeSpec: Any +class Integer0ToMax(Integer): + subtypeSpec: ConstraintsIntersection class Size(Integer0ToMax): ... -class Cookie(_OctetString): ... +class Cookie(OctetString): ... -class RealSearchControlValue(_Sequence): - componentType: Any +class RealSearchControlValue(Sequence): + componentType: NamedTypes -def paged_search_control(criticality: bool = ..., size: int = ..., cookie: Any | None = ...): ... +def paged_search_control(criticality: bool = ..., size: int = ..., cookie: Incomplete | None = ...): ... diff --git a/stubs/ldap3/ldap3/protocol/rfc3062.pyi b/stubs/ldap3/ldap3/protocol/rfc3062.pyi index 7076147ce5bf..4a97a374a37f 100644 --- a/stubs/ldap3/ldap3/protocol/rfc3062.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc3062.pyi @@ -1,29 +1,25 @@ -from typing import Any -from typing_extensions import TypeAlias +from pyasn1.type.namedtype import NamedTypes +from pyasn1.type.tag import TagSet +from pyasn1.type.univ import OctetString, Sequence -# Enable when pyasn1 gets stubs: -# from pyasn1.type.univ import OctetString, Sequence -_OctetString: TypeAlias = Any -_Sequence: TypeAlias = Any - -class UserIdentity(_OctetString): - tagSet: Any +class UserIdentity(OctetString): + tagSet: TagSet encoding: str -class OldPasswd(_OctetString): - tagSet: Any +class OldPasswd(OctetString): + tagSet: TagSet encoding: str -class NewPasswd(_OctetString): - tagSet: Any +class NewPasswd(OctetString): + tagSet: TagSet encoding: str -class GenPasswd(_OctetString): - tagSet: Any +class GenPasswd(OctetString): + tagSet: TagSet encoding: str -class PasswdModifyRequestValue(_Sequence): - componentType: Any +class PasswdModifyRequestValue(Sequence): + componentType: NamedTypes -class PasswdModifyResponseValue(_Sequence): - componentType: Any +class PasswdModifyResponseValue(Sequence): + componentType: NamedTypes diff --git a/stubs/ldap3/ldap3/protocol/rfc4511.pyi b/stubs/ldap3/ldap3/protocol/rfc4511.pyi index 070910ae3868..18c32e68226b 100644 --- a/stubs/ldap3/ldap3/protocol/rfc4511.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc4511.pyi @@ -1,32 +1,26 @@ -from typing import Any as _Any - -# Enable when pyasn1 gets stubs: -# from pyasn1.type.univ import Boolean, Choice, Enumerated, Integer, Null, OctetString, Sequence, SequenceOf, SetOf -Boolean = _Any -Choice = _Any -Enumerated = _Any -Integer = _Any -Null = _Any -OctetString = _Any -Sequence = _Any -SequenceOf = _Any -SetOf = _Any - -LDAP_MAX_INT: int -MAXINT: _Any -rangeInt0ToMaxConstraint: _Any -rangeInt1To127Constraint: _Any -size1ToMaxConstraint: _Any -responseValueConstraint: _Any -numericOIDConstraint: _Any -distinguishedNameConstraint: _Any -nameComponentConstraint: _Any -attributeDescriptionConstraint: _Any -uriConstraint: _Any -attributeSelectorConstraint: _Any +from typing_extensions import Final as _Final + +from pyasn1.type.constraint import ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint +from pyasn1.type.namedtype import NamedTypes +from pyasn1.type.namedval import NamedValues +from pyasn1.type.tag import TagSet +from pyasn1.type.univ import Boolean, Choice, Enumerated, Integer, Null, OctetString, Sequence, SequenceOf, SetOf + +LDAP_MAX_INT: _Final = 2147483647 +MAXINT: _Final[Integer] +rangeInt0ToMaxConstraint: ValueRangeConstraint +rangeInt1To127Constraint: ValueRangeConstraint +size1ToMaxConstraint: ValueSizeConstraint +responseValueConstraint: SingleValueConstraint +numericOIDConstraint = None +distinguishedNameConstraint = None +nameComponentConstraint = None +attributeDescriptionConstraint = None +uriConstraint = None +attributeSelectorConstraint = None class Integer0ToMax(Integer): - subtypeSpec: _Any + subtypeSpec: ConstraintsIntersection class LDAPString(OctetString): encoding: str @@ -44,71 +38,71 @@ class AssertionValue(OctetString): encoding: str class AttributeValueAssertion(Sequence): - componentType: _Any + componentType: NamedTypes class MatchingRuleId(LDAPString): ... class Vals(SetOf): - componentType: _Any + componentType: NamedTypes class ValsAtLeast1(SetOf): - componentType: _Any - subtypeSpec: _Any + componentType: NamedTypes + subtypeSpec: ConstraintsIntersection class PartialAttribute(Sequence): - componentType: _Any + componentType: NamedTypes class Attribute(Sequence): - componentType: _Any + componentType: NamedTypes class AttributeList(SequenceOf): - componentType: _Any + componentType: NamedTypes class Simple(OctetString): - tagSet: _Any + tagSet: TagSet encoding: str class Credentials(OctetString): encoding: str class SaslCredentials(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class SicilyPackageDiscovery(OctetString): - tagSet: _Any + tagSet: TagSet encoding: str class SicilyNegotiate(OctetString): - tagSet: _Any + tagSet: TagSet encoding: str class SicilyResponse(OctetString): - tagSet: _Any + tagSet: TagSet encoding: str class AuthenticationChoice(Choice): - componentType: _Any + componentType: NamedTypes class Version(Integer): - subtypeSpec: _Any + subtypeSpec: ConstraintsIntersection class ResultCode(Enumerated): - namedValues: _Any - subTypeSpec: _Any + namedValues: NamedValues + subTypeSpec: ConstraintsIntersection class URI(LDAPString): ... class Referral(SequenceOf): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class ServerSaslCreds(OctetString): - tagSet: _Any + tagSet: TagSet encoding: str class LDAPResult(Sequence): - componentType: _Any + componentType: NamedTypes class Criticality(Boolean): defaultValue: bool @@ -117,207 +111,207 @@ class ControlValue(OctetString): encoding: str class Control(Sequence): - componentType: _Any + componentType: NamedTypes class Controls(SequenceOf): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class Scope(Enumerated): - namedValues: _Any + namedValues: NamedValues class DerefAliases(Enumerated): - namedValues: _Any + namedValues: NamedValues class TypesOnly(Boolean): ... class Selector(LDAPString): ... class AttributeSelection(SequenceOf): - componentType: _Any + componentType: NamedTypes class MatchingRule(MatchingRuleId): - tagSet: _Any + tagSet: TagSet class Type(AttributeDescription): - tagSet: _Any + tagSet: TagSet class MatchValue(AssertionValue): - tagSet: _Any + tagSet: TagSet class DnAttributes(Boolean): - tagSet: _Any - defaultValue: _Any + tagSet: TagSet + defaultValue: Boolean class MatchingRuleAssertion(Sequence): - componentType: _Any + componentType: NamedTypes class Initial(AssertionValue): - tagSet: _Any + tagSet: TagSet class Any(AssertionValue): - tagSet: _Any + tagSet: TagSet class Final(AssertionValue): - tagSet: _Any + tagSet: TagSet class Substring(Choice): - componentType: _Any + componentType: NamedTypes class Substrings(SequenceOf): - subtypeSpec: _Any - componentType: _Any + subtypeSpec: ConstraintsIntersection + componentType: NamedTypes class SubstringFilter(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class And(SetOf): - tagSet: _Any - subtypeSpec: _Any + tagSet: TagSet + subtypeSpec: ConstraintsIntersection class Or(SetOf): - tagSet: _Any - subtypeSpec: _Any + tagSet: TagSet + subtypeSpec: ConstraintsIntersection class Not(Choice): ... class EqualityMatch(AttributeValueAssertion): - tagSet: _Any + tagSet: TagSet class GreaterOrEqual(AttributeValueAssertion): - tagSet: _Any + tagSet: TagSet class LessOrEqual(AttributeValueAssertion): - tagSet: _Any + tagSet: TagSet class Present(AttributeDescription): - tagSet: _Any + tagSet: TagSet class ApproxMatch(AttributeValueAssertion): - tagSet: _Any + tagSet: TagSet class ExtensibleMatch(MatchingRuleAssertion): - tagSet: _Any + tagSet: TagSet class Filter(Choice): - componentType: _Any + componentType: NamedTypes class PartialAttributeList(SequenceOf): - componentType: _Any + componentType: NamedTypes class Operation(Enumerated): - namedValues: _Any + namedValues: NamedValues class Change(Sequence): - componentType: _Any + componentType: NamedTypes class Changes(SequenceOf): - componentType: _Any + componentType: NamedTypes class DeleteOldRDN(Boolean): ... class NewSuperior(LDAPDN): - tagSet: _Any + tagSet: TagSet class RequestName(LDAPOID): - tagSet: _Any + tagSet: TagSet class RequestValue(OctetString): - tagSet: _Any + tagSet: TagSet encoding: str class ResponseName(LDAPOID): - tagSet: _Any + tagSet: TagSet class ResponseValue(OctetString): - tagSet: _Any + tagSet: TagSet encoding: str class IntermediateResponseName(LDAPOID): - tagSet: _Any + tagSet: TagSet class IntermediateResponseValue(OctetString): - tagSet: _Any + tagSet: TagSet encoding: str class BindRequest(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class BindResponse(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class UnbindRequest(Null): - tagSet: _Any + tagSet: TagSet class SearchRequest(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class SearchResultReference(SequenceOf): - tagSet: _Any - subtypeSpec: _Any - componentType: _Any + tagSet: TagSet + subtypeSpec: ConstraintsIntersection + componentType: NamedTypes class SearchResultEntry(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class SearchResultDone(LDAPResult): - tagSet: _Any + tagSet: TagSet class ModifyRequest(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class ModifyResponse(LDAPResult): - tagSet: _Any + tagSet: TagSet class AddRequest(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class AddResponse(LDAPResult): - tagSet: _Any + tagSet: TagSet class DelRequest(LDAPDN): - tagSet: _Any + tagSet: TagSet class DelResponse(LDAPResult): - tagSet: _Any + tagSet: TagSet class ModifyDNRequest(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class ModifyDNResponse(LDAPResult): - tagSet: _Any + tagSet: TagSet class CompareRequest(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class CompareResponse(LDAPResult): - tagSet: _Any + tagSet: TagSet class AbandonRequest(MessageID): - tagSet: _Any + tagSet: TagSet class ExtendedRequest(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class ExtendedResponse(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class IntermediateResponse(Sequence): - tagSet: _Any - componentType: _Any + tagSet: TagSet + componentType: NamedTypes class ProtocolOp(Choice): - componentType: _Any + componentType: NamedTypes class LDAPMessage(Sequence): - componentType: _Any + componentType: NamedTypes diff --git a/stubs/ldap3/ldap3/utils/asn1.pyi b/stubs/ldap3/ldap3/utils/asn1.pyi index 6af8d2c5366b..c76e5ed23c04 100644 --- a/stubs/ldap3/ldap3/utils/asn1.pyi +++ b/stubs/ldap3/ldap3/utils/asn1.pyi @@ -1,37 +1,49 @@ -from typing import Any -from typing_extensions import TypeAlias +from _typeshed import Incomplete, IndexableBuffer, SliceableBuffer +from collections.abc import Callable, Mapping +from typing import Any, TypeVar, overload +from typing_extensions import Final, TypeAlias -# Enable when pyasn1 gets stubs: -# from pyasn1.codec.ber.encoder import AbstractItemEncoder -_AbstractItemEncoder: TypeAlias = Any +from pyasn1.codec.ber.encoder import AbstractItemEncoder, tagMap, typeMap -CLASSES: Any +# Use _typeshed.SupportsGetItemBuffer after PEP 688 +SupportsGetItemBuffer: TypeAlias = SliceableBuffer | IndexableBuffer +_Unused: TypeAlias = object +_R = TypeVar("_R") +_B = TypeVar("_B", bound=SupportsGetItemBuffer) +# The possible return type is a union of all other decode methods, ie: AnyOf[Incomplete | bool] +_AllDecodersReturnType: TypeAlias = Any -class LDAPBooleanEncoder(_AbstractItemEncoder): +CLASSES: Final[dict[tuple[bool, bool], int]] + +class LDAPBooleanEncoder(AbstractItemEncoder): supportIndefLenMode: bool # Requires pyasn1 > 0.3.7 - def encodeValue(self, value, asn1Spec, encodeFun, **options): ... + def encodeValue(self, value: bool | int, asn1Spec: _Unused, encodeFun: _Unused, **options: _Unused): ... -customTagMap: Any -customTypeMap: Any +customTagMap = tagMap +customTypeMap = typeMap def compute_ber_size(data): ... def decode_message_fast(message): ... -def decode_sequence(message, start, stop, context_decoders: Any | None = ...): ... -def decode_integer(message, start, stop, context_decoders: Any | None = ...): ... -def decode_octet_string(message, start, stop, context_decoders: Any | None = ...): ... -def decode_boolean(message, start, stop, context_decoders: Any | None = ...): ... -def decode_bind_response(message, start, stop, context_decoders: Any | None = ...): ... -def decode_extended_response(message, start, stop, context_decoders: Any | None = ...): ... -def decode_intermediate_response(message, start, stop, context_decoders: Any | None = ...): ... -def decode_controls(message, start, stop, context_decoders: Any | None = ...): ... +@overload +def decode_sequence(message: _B, start, stop, context_decoders: Mapping[int, Callable[[_B, int, int], _R]]) -> _R: ... +@overload +def decode_sequence(message: SupportsGetItemBuffer, start, stop, context_decoders: None = ...) -> _AllDecodersReturnType: ... +def decode_integer(message, start, stop, context_decoders: _Unused = ...): ... +def decode_octet_string(message, start, stop, context_decoders: _Unused = ...): ... +def decode_boolean(message, start, stop, context_decoders: _Unused = ...): ... +def decode_bind_response(message, start, stop, context_decoders: _Unused = ...): ... +def decode_extended_response(message, start, stop, context_decoders: _Unused = ...): ... +def decode_intermediate_response(message, start, stop, context_decoders: _Unused = ...): ... +def decode_controls(message, start, stop, context_decoders: _Unused = ...): ... def ldap_result_to_dict_fast(response): ... def get_byte(x): ... def get_bytes(x): ... -DECODERS: Any -BIND_RESPONSE_CONTEXT: Any -EXTENDED_RESPONSE_CONTEXT: Any -INTERMEDIATE_RESPONSE_CONTEXT: Any -LDAP_MESSAGE_CONTEXT: Any -CONTROLS_CONTEXT: Any +# The possible return type is a union of all other decode methods, ie: AnyOf[Incomplete | bool] +DECODERS: dict[tuple[int, int], Callable[..., _AllDecodersReturnType]] +BIND_RESPONSE_CONTEXT: dict[int, Callable[..., Incomplete]] +EXTENDED_RESPONSE_CONTEXT: dict[int, Callable[..., Incomplete]] +INTERMEDIATE_RESPONSE_CONTEXT: dict[int, Callable[..., Incomplete]] +LDAP_MESSAGE_CONTEXT: dict[int, Callable[..., Incomplete]] +CONTROLS_CONTEXT: dict[int, Callable[..., Incomplete]] From dc9febd2c639c2f75ce111b6dc0e6f2ab3ef0419 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 8 Jan 2023 03:55:27 -0500 Subject: [PATCH 2/7] Update types --- stubs/ldap3/ldap3/protocol/novell.pyi | 2 +- stubs/ldap3/ldap3/protocol/rfc4511.pyi | 34 +++++++++++++------------- stubs/ldap3/ldap3/utils/asn1.pyi | 13 ++++------ 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/stubs/ldap3/ldap3/protocol/novell.pyi b/stubs/ldap3/ldap3/protocol/novell.pyi index e7ff4e91e0b9..bfa4a1cdc14a 100644 --- a/stubs/ldap3/ldap3/protocol/novell.pyi +++ b/stubs/ldap3/ldap3/protocol/novell.pyi @@ -41,7 +41,7 @@ class NmasSetUniversalPasswordResponseValue(Sequence): componentType: NamedTypes class ReplicaList(SequenceOf): - componentType: NamedTypes + componentType: OctetString # type: ignore[assignment] class ReplicaInfoRequestValue(Sequence): tagSet: TagSet diff --git a/stubs/ldap3/ldap3/protocol/rfc4511.pyi b/stubs/ldap3/ldap3/protocol/rfc4511.pyi index 18c32e68226b..d26d2c0c9cec 100644 --- a/stubs/ldap3/ldap3/protocol/rfc4511.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc4511.pyi @@ -6,18 +6,18 @@ from pyasn1.type.namedval import NamedValues from pyasn1.type.tag import TagSet from pyasn1.type.univ import Boolean, Choice, Enumerated, Integer, Null, OctetString, Sequence, SequenceOf, SetOf -LDAP_MAX_INT: _Final = 2147483647 +LDAP_MAX_INT: _Final = 2147483647 # noqa: Y015 # name conflict MAXINT: _Final[Integer] rangeInt0ToMaxConstraint: ValueRangeConstraint rangeInt1To127Constraint: ValueRangeConstraint size1ToMaxConstraint: ValueSizeConstraint responseValueConstraint: SingleValueConstraint -numericOIDConstraint = None -distinguishedNameConstraint = None -nameComponentConstraint = None -attributeDescriptionConstraint = None -uriConstraint = None -attributeSelectorConstraint = None +numericOIDConstraint: None +distinguishedNameConstraint: None +nameComponentConstraint: None +attributeDescriptionConstraint: None +uriConstraint: None +attributeSelectorConstraint: None class Integer0ToMax(Integer): subtypeSpec: ConstraintsIntersection @@ -43,10 +43,10 @@ class AttributeValueAssertion(Sequence): class MatchingRuleId(LDAPString): ... class Vals(SetOf): - componentType: NamedTypes + componentType: AttributeValue # type: ignore[assignment] class ValsAtLeast1(SetOf): - componentType: NamedTypes + componentType: AttributeValue # type: ignore[assignment] subtypeSpec: ConstraintsIntersection class PartialAttribute(Sequence): @@ -56,7 +56,7 @@ class Attribute(Sequence): componentType: NamedTypes class AttributeList(SequenceOf): - componentType: NamedTypes + componentType: Attribute # type: ignore[assignment] class Simple(OctetString): tagSet: TagSet @@ -95,7 +95,7 @@ class URI(LDAPString): ... class Referral(SequenceOf): tagSet: TagSet - componentType: NamedTypes + componentType: URI # type: ignore[assignment] class ServerSaslCreds(OctetString): tagSet: TagSet @@ -115,7 +115,7 @@ class Control(Sequence): class Controls(SequenceOf): tagSet: TagSet - componentType: NamedTypes + componentType: Control # type: ignore[assignment] class Scope(Enumerated): namedValues: NamedValues @@ -127,7 +127,7 @@ class TypesOnly(Boolean): ... class Selector(LDAPString): ... class AttributeSelection(SequenceOf): - componentType: NamedTypes + componentType: Selector # type: ignore[assignment] class MatchingRule(MatchingRuleId): tagSet: TagSet @@ -159,7 +159,7 @@ class Substring(Choice): class Substrings(SequenceOf): subtypeSpec: ConstraintsIntersection - componentType: NamedTypes + componentType: Substring # type: ignore[assignment] class SubstringFilter(Sequence): tagSet: TagSet @@ -197,7 +197,7 @@ class Filter(Choice): componentType: NamedTypes class PartialAttributeList(SequenceOf): - componentType: NamedTypes + componentType: PartialAttribute # type: ignore[assignment] class Operation(Enumerated): namedValues: NamedValues @@ -206,7 +206,7 @@ class Change(Sequence): componentType: NamedTypes class Changes(SequenceOf): - componentType: NamedTypes + componentType: Change # type: ignore[assignment] class DeleteOldRDN(Boolean): ... @@ -252,7 +252,7 @@ class SearchRequest(Sequence): class SearchResultReference(SequenceOf): tagSet: TagSet subtypeSpec: ConstraintsIntersection - componentType: NamedTypes + componentType: URI # type: ignore[assignment] class SearchResultEntry(Sequence): tagSet: TagSet diff --git a/stubs/ldap3/ldap3/utils/asn1.pyi b/stubs/ldap3/ldap3/utils/asn1.pyi index c76e5ed23c04..a5a564f0fc9e 100644 --- a/stubs/ldap3/ldap3/utils/asn1.pyi +++ b/stubs/ldap3/ldap3/utils/asn1.pyi @@ -3,13 +3,13 @@ from collections.abc import Callable, Mapping from typing import Any, TypeVar, overload from typing_extensions import Final, TypeAlias -from pyasn1.codec.ber.encoder import AbstractItemEncoder, tagMap, typeMap +from pyasn1.codec.ber.encoder import AbstractItemEncoder -# Use _typeshed.SupportsGetItemBuffer after PEP 688 -SupportsGetItemBuffer: TypeAlias = SliceableBuffer | IndexableBuffer +# Use _typeshed._SupportsGetItemBuffer after PEP 688 +_SupportsGetItemBuffer: TypeAlias = SliceableBuffer | IndexableBuffer _Unused: TypeAlias = object _R = TypeVar("_R") -_B = TypeVar("_B", bound=SupportsGetItemBuffer) +_B = TypeVar("_B", bound=_SupportsGetItemBuffer) # The possible return type is a union of all other decode methods, ie: AnyOf[Incomplete | bool] _AllDecodersReturnType: TypeAlias = Any @@ -20,15 +20,12 @@ class LDAPBooleanEncoder(AbstractItemEncoder): # Requires pyasn1 > 0.3.7 def encodeValue(self, value: bool | int, asn1Spec: _Unused, encodeFun: _Unused, **options: _Unused): ... -customTagMap = tagMap -customTypeMap = typeMap - def compute_ber_size(data): ... def decode_message_fast(message): ... @overload def decode_sequence(message: _B, start, stop, context_decoders: Mapping[int, Callable[[_B, int, int], _R]]) -> _R: ... @overload -def decode_sequence(message: SupportsGetItemBuffer, start, stop, context_decoders: None = ...) -> _AllDecodersReturnType: ... +def decode_sequence(message: _SupportsGetItemBuffer, start, stop, context_decoders: None = ...) -> _AllDecodersReturnType: ... def decode_integer(message, start, stop, context_decoders: _Unused = ...): ... def decode_octet_string(message, start, stop, context_decoders: _Unused = ...): ... def decode_boolean(message, start, stop, context_decoders: _Unused = ...): ... From 397e78338b5baeef1b67f79085d67219500b2d6b Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 11 Jan 2023 00:08:32 -0500 Subject: [PATCH 3/7] PR comments --- stubs/ldap3/@tests/stubtest_allowlist.txt | 4 ++++ stubs/ldap3/ldap3/core/connection.pyi | 10 ++++++++-- stubs/ldap3/ldap3/extend/novell/endTransaction.pyi | 7 +++---- stubs/ldap3/ldap3/extend/novell/listReplicas.pyi | 5 +++-- .../ldap3/extend/novell/nmasGetUniversalPassword.pyi | 7 +++---- .../ldap3/extend/novell/nmasSetUniversalPassword.pyi | 7 +++---- .../ldap3/extend/novell/partition_entry_count.pyi | 7 ++++--- stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi | 7 ++++--- stubs/ldap3/ldap3/extend/novell/startTransaction.pyi | 7 +++---- stubs/ldap3/ldap3/extend/operation.pyi | 2 +- stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi | 7 +++---- stubs/ldap3/ldap3/operation/extended.pyi | 6 ++++-- 12 files changed, 43 insertions(+), 33 deletions(-) diff --git a/stubs/ldap3/@tests/stubtest_allowlist.txt b/stubs/ldap3/@tests/stubtest_allowlist.txt index 71eb99da0822..b09dba8540e8 100644 --- a/stubs/ldap3/@tests/stubtest_allowlist.txt +++ b/stubs/ldap3/@tests/stubtest_allowlist.txt @@ -1 +1,5 @@ ldap3.protocol.sasl.kerberos # requires gssapi package to import + +# stubtest bug +ldap3.protocol.rfc4511.Or.componentType +ldap3.protocol.rfc4511.And.componentType diff --git a/stubs/ldap3/ldap3/core/connection.pyi b/stubs/ldap3/ldap3/core/connection.pyi index 11a4ecd09cba..6516cf663ea8 100644 --- a/stubs/ldap3/ldap3/core/connection.pyi +++ b/stubs/ldap3/ldap3/core/connection.pyi @@ -1,9 +1,11 @@ from _collections_abc import Generator, dict_keys -from _typeshed import Self +from _typeshed import ReadableBuffer, Self from types import TracebackType from typing import Any from typing_extensions import Literal, TypeAlias +from pyasn1.type.base import Asn1Item + from .pooling import ServerPool from .server import Server @@ -156,7 +158,11 @@ class Connection: ): ... def abandon(self, message_id, controls: Any | None = ...): ... def extended( - self, request_name, request_value: Any | None = ..., controls: Any | None = ..., no_encode: Any | None = ... + self, + request_name, + request_value: Asn1Item | ReadableBuffer | None = ..., + controls: Any | None = ..., + no_encode: bool | None = ..., ): ... def start_tls(self, read_server_info: bool = ...): ... def do_sasl_bind(self, controls): ... diff --git a/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi b/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi index f9a6ca613df8..d0b07c285f3d 100644 --- a/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi +++ b/stubs/ldap3/ldap3/extend/novell/endTransaction.pyi @@ -1,14 +1,13 @@ from _typeshed import Incomplete -from ldap3.protocol.novell import EndGroupTypeResponseValue - from ...extend.operation import ExtendedOperation +from ...protocol.novell import EndGroupTypeRequestValue, EndGroupTypeResponseValue class EndTransaction(ExtendedOperation): request_name: str response_name: str - request_value: Incomplete - asn1_spec: EndGroupTypeResponseValue | None + request_value: EndGroupTypeRequestValue + asn1_spec: EndGroupTypeResponseValue def config(self) -> None: ... def __init__(self, connection, commit: bool = ..., controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi b/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi index 95eded5956eb..ca8065b09ac8 100644 --- a/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi +++ b/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi @@ -3,12 +3,13 @@ from _typeshed import Incomplete from ldap3.protocol.novell import ReplicaList from ...extend.operation import ExtendedOperation +from ...protocol.rfc4511 import LDAPDN class ListReplicas(ExtendedOperation): request_name: str response_name: str - request_value: Incomplete - asn1_spec: ReplicaList | None + request_value: LDAPDN + asn1_spec: ReplicaList response_attribute: str def config(self) -> None: ... def __init__(self, connection, server_dn, controls: Incomplete | None = ...) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi b/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi index b9684c90d40d..bc467cd51048 100644 --- a/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi +++ b/stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi @@ -1,14 +1,13 @@ from _typeshed import Incomplete -from ldap3.protocol.novell import NmasGetUniversalPasswordResponseValue - from ...extend.operation import ExtendedOperation +from ...protocol.novell import NmasGetUniversalPasswordRequestValue, NmasGetUniversalPasswordResponseValue class NmasGetUniversalPassword(ExtendedOperation): request_name: str response_name: str - request_value: Incomplete - asn1_spec: NmasGetUniversalPasswordResponseValue | None + request_value: NmasGetUniversalPasswordRequestValue + asn1_spec: NmasGetUniversalPasswordResponseValue response_attribute: str def config(self) -> None: ... def __init__(self, connection, user, controls: Incomplete | None = ...) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi b/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi index 8264a535f5cd..de23d84d411b 100644 --- a/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi +++ b/stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi @@ -1,14 +1,13 @@ from _typeshed import Incomplete -from ldap3.protocol.novell import NmasSetUniversalPasswordResponseValue - from ...extend.operation import ExtendedOperation +from ...protocol.novell import NmasSetUniversalPasswordRequestValue, NmasSetUniversalPasswordResponseValue class NmasSetUniversalPassword(ExtendedOperation): request_name: str response_name: str - request_value: Incomplete - asn1_spec: NmasSetUniversalPasswordResponseValue | None + request_value: NmasSetUniversalPasswordRequestValue + asn1_spec: NmasSetUniversalPasswordResponseValue response_attribute: str def config(self) -> None: ... def __init__(self, connection, user, new_password, controls: Incomplete | None = ...) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/partition_entry_count.pyi b/stubs/ldap3/ldap3/extend/novell/partition_entry_count.pyi index a9127983afcf..cd2e1c077e93 100644 --- a/stubs/ldap3/ldap3/extend/novell/partition_entry_count.pyi +++ b/stubs/ldap3/ldap3/extend/novell/partition_entry_count.pyi @@ -1,12 +1,13 @@ -from typing import Any +from _typeshed import Incomplete +from ...protocol.rfc4511 import LDAPDN from ..operation import ExtendedOperation class PartitionEntryCount(ExtendedOperation): request_name: str response_name: str - request_value: Any + request_value: LDAPDN response_attribute: str def config(self) -> None: ... - def __init__(self, connection, partition_dn, controls: Any | None = ...) -> None: ... + def __init__(self, connection, partition_dn, controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi b/stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi index 6a4358053f43..a9405d21deed 100644 --- a/stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi +++ b/stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi @@ -1,12 +1,13 @@ -from typing import Any +from _typeshed import Incomplete +from ...protocol.novell import ReplicaInfoRequestValue from ..operation import ExtendedOperation class ReplicaInfo(ExtendedOperation): request_name: str response_name: str - request_value: Any + request_value: ReplicaInfoRequestValue response_attribute: str def config(self) -> None: ... - def __init__(self, connection, server_dn, partition_dn, controls: Any | None = ...) -> None: ... + def __init__(self, connection, server_dn, partition_dn, controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi b/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi index 75466eabd4cd..e013b81a2b64 100644 --- a/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi +++ b/stubs/ldap3/ldap3/extend/novell/startTransaction.pyi @@ -1,14 +1,13 @@ from _typeshed import Incomplete -from ldap3.protocol.novell import CreateGroupTypeResponseValue - from ...extend.operation import ExtendedOperation +from ...protocol.novell import CreateGroupTypeRequestValue, CreateGroupTypeResponseValue class StartTransaction(ExtendedOperation): request_name: str response_name: str - request_value: Incomplete - asn1_spec: CreateGroupTypeResponseValue | None + request_value: CreateGroupTypeRequestValue + asn1_spec: CreateGroupTypeResponseValue def config(self) -> None: ... def __init__(self, connection, controls: Incomplete | None = ...) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/extend/operation.pyi b/stubs/ldap3/ldap3/extend/operation.pyi index f7952a585e33..e76894d7c924 100644 --- a/stubs/ldap3/ldap3/extend/operation.pyi +++ b/stubs/ldap3/ldap3/extend/operation.pyi @@ -9,7 +9,7 @@ class ExtendedOperation: asn1_spec: Asn1Type | None request_name: Incomplete response_name: Incomplete - request_value: Incomplete + request_value: Asn1Type | None response_value: Incomplete response_attribute: Incomplete controls: Incomplete diff --git a/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi b/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi index 1e37bd332a10..37698dcee782 100644 --- a/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi +++ b/stubs/ldap3/ldap3/extend/standard/modifyPassword.pyi @@ -1,13 +1,12 @@ from _typeshed import Incomplete -from ldap3.protocol.rfc3062 import PasswdModifyResponseValue - from ...extend.operation import ExtendedOperation +from ...protocol.rfc3062 import PasswdModifyRequestValue, PasswdModifyResponseValue class ModifyPassword(ExtendedOperation): request_name: str - request_value: Incomplete - asn1_spec: PasswdModifyResponseValue | None + request_value: PasswdModifyRequestValue + asn1_spec: PasswdModifyResponseValue response_attribute: str def config(self) -> None: ... def __init__( diff --git a/stubs/ldap3/ldap3/operation/extended.pyi b/stubs/ldap3/ldap3/operation/extended.pyi index 2cc46be69181..55fda674a6f8 100644 --- a/stubs/ldap3/ldap3/operation/extended.pyi +++ b/stubs/ldap3/ldap3/operation/extended.pyi @@ -1,6 +1,8 @@ -from typing import Any +from _typeshed import ReadableBuffer -def extended_operation(request_name, request_value: Any | None = ..., no_encode: Any | None = ...): ... +from pyasn1.type.base import Asn1Item + +def extended_operation(request_name, request_value: Asn1Item | ReadableBuffer | None = ..., no_encode: bool | None = ...): ... def extended_request_to_dict(request): ... def extended_response_to_dict(response): ... def intermediate_response_to_dict(response): ... From 97dafe418e966babf926db56ec7825335c9670b3 Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 11 Jan 2023 00:10:51 -0500 Subject: [PATCH 4/7] All relative imports in ldap3 --- stubs/ldap3/ldap3/extend/novell/getBindDn.pyi | 3 +-- stubs/ldap3/ldap3/extend/novell/listReplicas.pyi | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi b/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi index 9cff46ad38a9..ae50226389a3 100644 --- a/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi +++ b/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi @@ -1,6 +1,5 @@ -from ldap3.protocol.novell import Identity - from ...extend.operation import ExtendedOperation +from ...protocol.novell import Identity class GetBindDn(ExtendedOperation): request_name: str diff --git a/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi b/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi index ca8065b09ac8..ec94538a1cba 100644 --- a/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi +++ b/stubs/ldap3/ldap3/extend/novell/listReplicas.pyi @@ -1,8 +1,7 @@ from _typeshed import Incomplete -from ldap3.protocol.novell import ReplicaList - from ...extend.operation import ExtendedOperation +from ...protocol.novell import ReplicaList from ...protocol.rfc4511 import LDAPDN class ListReplicas(ExtendedOperation): From 5af90f1138f20036ae249e60d06a04ebe98209d1 Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 11 Jan 2023 00:58:13 -0500 Subject: [PATCH 5/7] Fix And/Or componentType --- stubs/ldap3/@tests/stubtest_allowlist.txt | 4 ---- stubs/ldap3/ldap3/protocol/rfc4511.pyi | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/stubs/ldap3/@tests/stubtest_allowlist.txt b/stubs/ldap3/@tests/stubtest_allowlist.txt index b09dba8540e8..71eb99da0822 100644 --- a/stubs/ldap3/@tests/stubtest_allowlist.txt +++ b/stubs/ldap3/@tests/stubtest_allowlist.txt @@ -1,5 +1 @@ ldap3.protocol.sasl.kerberos # requires gssapi package to import - -# stubtest bug -ldap3.protocol.rfc4511.Or.componentType -ldap3.protocol.rfc4511.And.componentType diff --git a/stubs/ldap3/ldap3/protocol/rfc4511.pyi b/stubs/ldap3/ldap3/protocol/rfc4511.pyi index d26d2c0c9cec..02584e6a5d4a 100644 --- a/stubs/ldap3/ldap3/protocol/rfc4511.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc4511.pyi @@ -168,10 +168,12 @@ class SubstringFilter(Sequence): class And(SetOf): tagSet: TagSet subtypeSpec: ConstraintsIntersection + componentType: Filter # type: ignore[assignment] class Or(SetOf): tagSet: TagSet subtypeSpec: ConstraintsIntersection + componentType: Filter # type: ignore[assignment] class Not(Choice): ... From 4eef3410d524e368dd3e5c8bb7bf210f32c340cb Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 11 Jan 2023 17:56:34 -0500 Subject: [PATCH 6/7] PR comments --- stubs/ldap3/ldap3/core/connection.pyi | 147 +++++++++--------- stubs/ldap3/ldap3/extend/novell/getBindDn.pyi | 2 +- stubs/ldap3/ldap3/operation/extended.pyi | 6 +- stubs/ldap3/ldap3/protocol/rfc4511.pyi | 3 +- stubs/ldap3/ldap3/utils/asn1.pyi | 20 +-- 5 files changed, 93 insertions(+), 85 deletions(-) diff --git a/stubs/ldap3/ldap3/core/connection.pyi b/stubs/ldap3/ldap3/core/connection.pyi index 6516cf663ea8..fe7acb4673d2 100644 --- a/stubs/ldap3/ldap3/core/connection.pyi +++ b/stubs/ldap3/ldap3/core/connection.pyi @@ -1,7 +1,6 @@ from _collections_abc import Generator, dict_keys -from _typeshed import ReadableBuffer, Self +from _typeshed import Incomplete, ReadableBuffer, Self from types import TracebackType -from typing import Any from typing_extensions import Literal, TypeAlias from pyasn1.type.base import Asn1Item @@ -9,62 +8,62 @@ from pyasn1.type.base import Asn1Item from .pooling import ServerPool from .server import Server -SASL_AVAILABLE_MECHANISMS: Any -CLIENT_STRATEGIES: Any +SASL_AVAILABLE_MECHANISMS: Incomplete +CLIENT_STRATEGIES: Incomplete _ServerSequence: TypeAlias = ( - set[Server] | list[Server] | tuple[Server, ...] | Generator[Server, None, None] | dict_keys[Server, Any] + set[Server] | list[Server] | tuple[Server, ...] | Generator[Server, None, None] | dict_keys[Server, Incomplete] ) class Connection: - connection_lock: Any + connection_lock: Incomplete last_error: str - strategy_type: Any - user: Any - password: Any - authentication: Any - version: Any - auto_referrals: Any - request: Any - response: Any | None - result: Any + strategy_type: Incomplete + user: Incomplete + password: Incomplete + authentication: Incomplete + version: Incomplete + auto_referrals: Incomplete + request: Incomplete + response: Incomplete | None + result: Incomplete bound: bool listening: bool closed: bool - auto_bind: Any - sasl_mechanism: Any - sasl_credentials: Any - socket: Any + auto_bind: Incomplete + sasl_mechanism: Incomplete + sasl_credentials: Incomplete + socket: Incomplete tls_started: bool sasl_in_progress: bool - read_only: Any - lazy: Any - pool_name: Any + read_only: Incomplete + lazy: Incomplete + pool_name: Incomplete pool_size: int | None - cred_store: Any - pool_lifetime: Any - pool_keepalive: Any + cred_store: Incomplete + pool_lifetime: Incomplete + pool_keepalive: Incomplete starting_tls: bool - check_names: Any - raise_exceptions: Any - auto_range: Any - extend: Any - fast_decoder: Any - receive_timeout: Any - empty_attributes: Any - use_referral_cache: Any - auto_escape: Any - auto_encode: Any - source_address: Any - source_port_list: Any - server_pool: Any | None - server: Any - strategy: Any - send: Any - open: Any - get_response: Any - post_send_single_response: Any - post_send_search: Any + check_names: Incomplete + raise_exceptions: Incomplete + auto_range: Incomplete + extend: Incomplete + fast_decoder: Incomplete + receive_timeout: Incomplete + empty_attributes: Incomplete + use_referral_cache: Incomplete + auto_escape: Incomplete + auto_encode: Incomplete + source_address: Incomplete + source_port_list: Incomplete + server_pool: Incomplete | None + server: Incomplete + strategy: Incomplete + send: Incomplete + open: Incomplete + get_response: Incomplete + post_send_single_response: Incomplete + post_send_search: Incomplete def __init__( self, server: Server | str | _ServerSequence | ServerPool, @@ -88,7 +87,7 @@ class Connection: auto_referrals: bool = ..., auto_range: bool = ..., sasl_mechanism: str | None = ..., - sasl_credentials: Any | None = ..., + sasl_credentials: Incomplete | None = ..., check_names: bool = ..., collect_usage: bool = ..., read_only: bool = ..., @@ -97,17 +96,17 @@ class Connection: pool_name: str | None = ..., pool_size: int | None = ..., pool_lifetime: int | None = ..., - cred_store: Any | None = ..., + cred_store: Incomplete | None = ..., fast_decoder: bool = ..., - receive_timeout: Any | None = ..., + receive_timeout: Incomplete | None = ..., return_empty_attributes: bool = ..., use_referral_cache: bool = ..., auto_escape: bool = ..., auto_encode: bool = ..., - pool_keepalive: Any | None = ..., + pool_keepalive: Incomplete | None = ..., source_address: str | None = ..., source_port: int | None = ..., - source_port_list: Any | None = ..., + source_port_list: Incomplete | None = ..., ) -> None: ... def repr_with_sensitive_data_stripped(self): ... @property @@ -120,48 +119,50 @@ class Connection: def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> Literal[False] | None: ... - def bind(self, read_server_info: bool = ..., controls: Any | None = ...): ... + def bind(self, read_server_info: bool = ..., controls: Incomplete | None = ...): ... def rebind( self, - user: Any | None = ..., - password: Any | None = ..., - authentication: Any | None = ..., - sasl_mechanism: Any | None = ..., - sasl_credentials: Any | None = ..., + user: Incomplete | None = ..., + password: Incomplete | None = ..., + authentication: Incomplete | None = ..., + sasl_mechanism: Incomplete | None = ..., + sasl_credentials: Incomplete | None = ..., read_server_info: bool = ..., - controls: Any | None = ..., + controls: Incomplete | None = ..., ): ... - def unbind(self, controls: Any | None = ...): ... + def unbind(self, controls: Incomplete | None = ...): ... def search( self, search_base: str, search_filter: str, search_scope: Literal["BASE", "LEVEL", "SUBTREE"] = ..., dereference_aliases: Literal["NEVER", "SEARCH", "FINDING_BASE", "ALWAYS"] = ..., - attributes: Any | None = ..., + attributes: Incomplete | None = ..., size_limit: int = ..., time_limit: int = ..., types_only: bool = ..., get_operational_attributes: bool = ..., - controls: Any | None = ..., + controls: Incomplete | None = ..., paged_size: int | None = ..., paged_criticality: bool = ..., paged_cookie: str | bytes | None = ..., auto_escape: bool | None = ..., ): ... - def compare(self, dn, attribute, value, controls: Any | None = ...): ... - def add(self, dn, object_class: Any | None = ..., attributes: Any | None = ..., controls: Any | None = ...): ... - def delete(self, dn, controls: Any | None = ...): ... - def modify(self, dn, changes, controls: Any | None = ...): ... + def compare(self, dn, attribute, value, controls: Incomplete | None = ...): ... + def add( + self, dn, object_class: Incomplete | None = ..., attributes: Incomplete | None = ..., controls: Incomplete | None = ... + ): ... + def delete(self, dn, controls: Incomplete | None = ...): ... + def modify(self, dn, changes, controls: Incomplete | None = ...): ... def modify_dn( - self, dn, relative_dn, delete_old_dn: bool = ..., new_superior: Any | None = ..., controls: Any | None = ... + self, dn, relative_dn, delete_old_dn: bool = ..., new_superior: Incomplete | None = ..., controls: Incomplete | None = ... ): ... - def abandon(self, message_id, controls: Any | None = ...): ... + def abandon(self, message_id, controls: Incomplete | None = ...): ... def extended( self, request_name, request_value: Asn1Item | ReadableBuffer | None = ..., - controls: Any | None = ..., + controls: Incomplete | None = ..., no_encode: bool | None = ..., ): ... def start_tls(self, read_server_info: bool = ...): ... @@ -170,19 +171,19 @@ class Connection: def refresh_server_info(self) -> None: ... def response_to_ldif( self, - search_result: Any | None = ..., + search_result: Incomplete | None = ..., all_base64: bool = ..., - line_separator: Any | None = ..., - sort_order: Any | None = ..., - stream: Any | None = ..., + line_separator: Incomplete | None = ..., + sort_order: Incomplete | None = ..., + stream: Incomplete | None = ..., ): ... def response_to_json( self, raw: bool = ..., - search_result: Any | None = ..., + search_result: Incomplete | None = ..., indent: int = ..., sort: bool = ..., - stream: Any | None = ..., + stream: Incomplete | None = ..., checked_attributes: bool = ..., include_empty: bool = ..., ): ... diff --git a/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi b/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi index ae50226389a3..3e9e9c40b490 100644 --- a/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi +++ b/stubs/ldap3/ldap3/extend/novell/getBindDn.pyi @@ -5,6 +5,6 @@ class GetBindDn(ExtendedOperation): request_name: str response_name: str response_attribute: str - asn1_spec: Identity | None + asn1_spec: Identity def config(self) -> None: ... def populate_result(self) -> None: ... diff --git a/stubs/ldap3/ldap3/operation/extended.pyi b/stubs/ldap3/ldap3/operation/extended.pyi index 55fda674a6f8..470849ed2fb6 100644 --- a/stubs/ldap3/ldap3/operation/extended.pyi +++ b/stubs/ldap3/ldap3/operation/extended.pyi @@ -2,7 +2,11 @@ from _typeshed import ReadableBuffer from pyasn1.type.base import Asn1Item -def extended_operation(request_name, request_value: Asn1Item | ReadableBuffer | None = ..., no_encode: bool | None = ...): ... +from ..protocol.rfc4511 import ExtendedRequest + +def extended_operation( + request_name, request_value: Asn1Item | ReadableBuffer | None = ..., no_encode: bool | None = ... +) -> ExtendedRequest: ... def extended_request_to_dict(request): ... def extended_response_to_dict(response): ... def intermediate_response_to_dict(response): ... diff --git a/stubs/ldap3/ldap3/protocol/rfc4511.pyi b/stubs/ldap3/ldap3/protocol/rfc4511.pyi index 02584e6a5d4a..a12222b73f20 100644 --- a/stubs/ldap3/ldap3/protocol/rfc4511.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc4511.pyi @@ -1,3 +1,4 @@ +# Alias the import to avoid name clash with a class called "Final" from typing_extensions import Final as _Final from pyasn1.type.constraint import ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint @@ -6,7 +7,7 @@ from pyasn1.type.namedval import NamedValues from pyasn1.type.tag import TagSet from pyasn1.type.univ import Boolean, Choice, Enumerated, Integer, Null, OctetString, Sequence, SequenceOf, SetOf -LDAP_MAX_INT: _Final = 2147483647 # noqa: Y015 # name conflict +LDAP_MAX_INT: _Final = 2147483647 # noqa: Y015 MAXINT: _Final[Integer] rangeInt0ToMaxConstraint: ValueRangeConstraint rangeInt1To127Constraint: ValueRangeConstraint diff --git a/stubs/ldap3/ldap3/utils/asn1.pyi b/stubs/ldap3/ldap3/utils/asn1.pyi index a5a564f0fc9e..811397e7ec9c 100644 --- a/stubs/ldap3/ldap3/utils/asn1.pyi +++ b/stubs/ldap3/ldap3/utils/asn1.pyi @@ -23,16 +23,18 @@ class LDAPBooleanEncoder(AbstractItemEncoder): def compute_ber_size(data): ... def decode_message_fast(message): ... @overload -def decode_sequence(message: _B, start, stop, context_decoders: Mapping[int, Callable[[_B, int, int], _R]]) -> _R: ... +def decode_sequence(message: _B, start: int, stop: int, context_decoders: Mapping[int, Callable[[_B, int, int], _R]]) -> _R: ... @overload -def decode_sequence(message: _SupportsGetItemBuffer, start, stop, context_decoders: None = ...) -> _AllDecodersReturnType: ... -def decode_integer(message, start, stop, context_decoders: _Unused = ...): ... -def decode_octet_string(message, start, stop, context_decoders: _Unused = ...): ... -def decode_boolean(message, start, stop, context_decoders: _Unused = ...): ... -def decode_bind_response(message, start, stop, context_decoders: _Unused = ...): ... -def decode_extended_response(message, start, stop, context_decoders: _Unused = ...): ... -def decode_intermediate_response(message, start, stop, context_decoders: _Unused = ...): ... -def decode_controls(message, start, stop, context_decoders: _Unused = ...): ... +def decode_sequence( + message: _SupportsGetItemBuffer, start: int, stop: int, context_decoders: None = ... +) -> _AllDecodersReturnType: ... +def decode_integer(message, start: int, stop: int, context_decoders: _Unused = ...): ... +def decode_octet_string(message, start: int, stop: int, context_decoders: _Unused = ...): ... +def decode_boolean(message, start: int, stop: int, context_decoders: _Unused = ...): ... +def decode_bind_response(message, start: int, stop: int, context_decoders: _Unused = ...): ... +def decode_extended_response(message, start: int, stop: int, context_decoders: _Unused = ...): ... +def decode_intermediate_response(message, start: int, stop: int, context_decoders: _Unused = ...): ... +def decode_controls(message, start: int, stop: int, context_decoders: _Unused = ...): ... def ldap_result_to_dict_fast(response): ... def get_byte(x): ... def get_bytes(x): ... From e3564c8ec7e671b29b19e066b66992d07fc8f362 Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 11 Jan 2023 18:03:55 -0500 Subject: [PATCH 7/7] Updated comments --- stubs/ldap3/ldap3/extend/operation.pyi | 12 ++++++------ stubs/ldap3/ldap3/protocol/rfc4511.pyi | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/stubs/ldap3/ldap3/extend/operation.pyi b/stubs/ldap3/ldap3/extend/operation.pyi index e76894d7c924..e07b8142106a 100644 --- a/stubs/ldap3/ldap3/extend/operation.pyi +++ b/stubs/ldap3/ldap3/extend/operation.pyi @@ -4,14 +4,14 @@ from pyasn1.type.base import Asn1Type class ExtendedOperation: connection: Incomplete - decoded_response: Incomplete - result: Incomplete + decoded_response: Incomplete | None + result: Incomplete | None asn1_spec: Asn1Type | None - request_name: Incomplete - response_name: Incomplete + request_name: Incomplete | None + response_name: Incomplete | None request_value: Asn1Type | None - response_value: Incomplete - response_attribute: Incomplete + response_value: Incomplete | None + response_attribute: Incomplete | None controls: Incomplete def __init__(self, connection, controls: Incomplete | None = ...) -> None: ... def send(self): ... diff --git a/stubs/ldap3/ldap3/protocol/rfc4511.pyi b/stubs/ldap3/ldap3/protocol/rfc4511.pyi index a12222b73f20..b673e67433b9 100644 --- a/stubs/ldap3/ldap3/protocol/rfc4511.pyi +++ b/stubs/ldap3/ldap3/protocol/rfc4511.pyi @@ -7,12 +7,13 @@ from pyasn1.type.namedval import NamedValues from pyasn1.type.tag import TagSet from pyasn1.type.univ import Boolean, Choice, Enumerated, Integer, Null, OctetString, Sequence, SequenceOf, SetOf -LDAP_MAX_INT: _Final = 2147483647 # noqa: Y015 +LDAP_MAX_INT: _Final = 2147483647 MAXINT: _Final[Integer] rangeInt0ToMaxConstraint: ValueRangeConstraint rangeInt1To127Constraint: ValueRangeConstraint size1ToMaxConstraint: ValueSizeConstraint responseValueConstraint: SingleValueConstraint +# Custom constraints. They have yet to be implemented so ldap3 keeps them as None. numericOIDConstraint: None distinguishedNameConstraint: None nameComponentConstraint: None