Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pyasn1 in ldap3 #9470

Merged
merged 12 commits into from
Jan 11, 2023
2 changes: 1 addition & 1 deletion stubs/ldap3/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "2.9.*"
requires = [] # requires types-pyasn1 (not available yet)
requires = ["types-pyasn1"]
153 changes: 80 additions & 73 deletions stubs/ldap3/ldap3/core/connection.pyi
Original file line number Diff line number Diff line change
@@ -1,68 +1,69 @@
from _collections_abc import Generator, dict_keys
from _typeshed import 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

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,
Expand All @@ -86,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 = ...,
Expand All @@ -95,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
Expand All @@ -118,65 +119,71 @@ 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: Any | None = ..., controls: Any | None = ..., no_encode: Any | None = ...
self,
request_name,
request_value: Asn1Item | ReadableBuffer | None = ...,
controls: Incomplete | None = ...,
no_encode: bool | None = ...,
): ...
def start_tls(self, read_server_info: bool = ...): ...
def do_sasl_bind(self, controls): ...
def do_ntlm_bind(self, controls): ...
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 = ...,
): ...
Expand Down
11 changes: 6 additions & 5 deletions stubs/ldap3/ldap3/extend/novell/endTransaction.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from typing import Any
from _typeshed import Incomplete

from ...extend.operation import ExtendedOperation
from ...protocol.novell import EndGroupTypeRequestValue, EndGroupTypeResponseValue

class EndTransaction(ExtendedOperation):
request_name: str
response_name: str
request_value: Any
asn1_spec: Any
request_value: EndGroupTypeRequestValue
asn1_spec: EndGroupTypeResponseValue
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: ...
5 changes: 2 additions & 3 deletions stubs/ldap3/ldap3/extend/novell/getBindDn.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from typing import Any

from ...extend.operation import ExtendedOperation
from ...protocol.novell import Identity

class GetBindDn(ExtendedOperation):
request_name: str
response_name: str
response_attribute: str
asn1_spec: Any
asn1_spec: Identity
def config(self) -> None: ...
def populate_result(self) -> None: ...
10 changes: 6 additions & 4 deletions stubs/ldap3/ldap3/extend/novell/listReplicas.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from typing import Any
from _typeshed import Incomplete

from ...extend.operation import ExtendedOperation
from ...protocol.novell import ReplicaList
from ...protocol.rfc4511 import LDAPDN

class ListReplicas(ExtendedOperation):
request_name: str
response_name: str
request_value: Any
asn1_spec: Any
request_value: LDAPDN
asn1_spec: ReplicaList
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: ...
9 changes: 5 additions & 4 deletions stubs/ldap3/ldap3/extend/novell/nmasGetUniversalPassword.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from typing import Any
from _typeshed import Incomplete

from ...extend.operation import ExtendedOperation
from ...protocol.novell import NmasGetUniversalPasswordRequestValue, NmasGetUniversalPasswordResponseValue

class NmasGetUniversalPassword(ExtendedOperation):
request_name: str
response_name: str
request_value: Any
asn1_spec: Any
request_value: NmasGetUniversalPasswordRequestValue
asn1_spec: NmasGetUniversalPasswordResponseValue
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: ...
9 changes: 5 additions & 4 deletions stubs/ldap3/ldap3/extend/novell/nmasSetUniversalPassword.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from typing import Any
from _typeshed import Incomplete

from ...extend.operation import ExtendedOperation
from ...protocol.novell import NmasSetUniversalPasswordRequestValue, NmasSetUniversalPasswordResponseValue

class NmasSetUniversalPassword(ExtendedOperation):
request_name: str
response_name: str
request_value: Any
asn1_spec: Any
request_value: NmasSetUniversalPasswordRequestValue
asn1_spec: NmasSetUniversalPasswordResponseValue
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: ...
7 changes: 4 additions & 3 deletions stubs/ldap3/ldap3/extend/novell/partition_entry_count.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
7 changes: 4 additions & 3 deletions stubs/ldap3/ldap3/extend/novell/replicaInfo.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
11 changes: 6 additions & 5 deletions stubs/ldap3/ldap3/extend/novell/startTransaction.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from typing import Any
from _typeshed import Incomplete

from ...extend.operation import ExtendedOperation
from ...protocol.novell import CreateGroupTypeRequestValue, CreateGroupTypeResponseValue

class StartTransaction(ExtendedOperation):
request_name: str
response_name: str
request_value: Any
asn1_spec: Any
request_value: CreateGroupTypeRequestValue
asn1_spec: CreateGroupTypeResponseValue
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: ...
Loading