Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ exclude = [
# cache directories, etc.:
".git",
".mypy_cache",
".pytype",
"python-ldap",
]

[tool.ruff.lint]
Expand Down
1 change: 1 addition & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"stubs/geopandas",
// test cases use a custom config file
"**/@tests/test_cases",
"python-ldap"
],
"typeCheckingMode": "strict",
// Allowed in base settings for incomplete stubs, checked in stricter settings
Expand Down
1 change: 1 addition & 0 deletions pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"stubs/PyMySQL",
"stubs/pyogrio",
"stubs/python-jose",
"stubs/python-ldap",
"stubs/pywin32",
"stubs/PyYAML",
"stubs/reportlab",
Expand Down
1 change: 1 addition & 0 deletions python-ldap
Submodule python-ldap added at cbcbb6
11 changes: 11 additions & 0 deletions stubs/python-ldap/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version = "3.4.*"
dependencies = ["types-pyasn1"]
upstream-repository = "https://github.com/python-ldap/python-ldap"
extra-description = """
Type stubs for python-ldap, covering the public API as documented at
https://www.python-ldap.org/doc/html/api.html.
"""
partial-stub = true

[tool.stubtest]
stubtest-dependencies = ["python-ldap"]
37 changes: 37 additions & 0 deletions stubs/python-ldap/ldap/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from typing import Any

__version__: str
__author__: str
__license__: str

LIBLDAP_API_INFO: Any
OPT_NAMES_DICT: dict[Any, Any]
OPT_ERROR_STRING: int
OPT_DIAGNOSTIC_MESSAGE: int

class LDAPLock:
def __init__(self, lock_class: Any = ..., desc: str = ...) -> None: ...
def acquire(self) -> None: ...
def release(self) -> None: ...

_ldap_module_lock: LDAPLock

def initialize(
uri: str,
trace_level: int = ...,
trace_file: Any = ...,
trace_stack_limit: Any = ...,
bytes_mode: Any = ...,
fileno: Any = ...,
**kwargs: Any,
) -> Any: ...
def get_option(option: Any) -> Any: ...
def set_option(option: Any, invalue: Any) -> None: ...
def escape_str(escape_func: Any, s: Any, *args: Any) -> Any: ...
def strf_secs(secs: Any) -> Any: ...
def strp_secs(dt_str: Any) -> Any: ...

class NO_UNIQUE_ENTRY(Exception): ...
class LDAPBytesWarning(Warning): ...

from ldap.dn import explode_dn as explode_dn, explode_rdn as explode_rdn
2 changes: 2 additions & 0 deletions stubs/python-ldap/ldap/async.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from ldap.asyncsearch import *
from ldap.asyncsearch import __version__ as __version__
60 changes: 60 additions & 0 deletions stubs/python-ldap/ldap/asyncsearch.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from typing import Any
from ldap import __version__ as __version__

SEARCH_RESULT_TYPES: set[int]
ENTRY_RESULT_TYPES: set[int]

class WrongResultType(Exception):

receivedResultType: Any
expectedResultTypes: Any
def __init__(self, *args: Any, **kwargs: Any) -> None: ...

class AsyncSearchHandler:

beginResultsDropped: int
endResultBreak: int
def __init__(self, l: Any) -> None: ...
def startSearch(
self,
searchRoot: Any,
searchScope: Any,
filterStr: Any,
attrList: Any = ...,
attrsOnly: int = 0,
timeout: int = -1,
sizelimit: int = 0,
serverctrls: Any = ...,
clientctrls: Any = ...,
) -> None: ...
def preProcessing(self) -> None: ...
def afterFirstResult(self) -> None: ...
def postProcessing(self) -> None: ...
def processResults(self, ignoreResultsNumber: int = 0, processResultsCount: int = 0, timeout: int = -1) -> bool: ...

class List(AsyncSearchHandler):

allResults: list[Any]
def __init__(self, l: Any) -> None: ...

class Dict(AsyncSearchHandler):

allEntries: dict[Any, Any]
def __init__(self, l: Any) -> None: ...

class IndexedDict(Dict):

indexed_attrs: Any
index: Any
def __init__(self, l: Any, indexed_attrs: Any = ...) -> None: ...

class FileWriter(AsyncSearchHandler):

headerStr: str
footerStr: str
def __init__(self, l: Any, f: Any, headerStr: str = "", footerStr: str = "") -> None: ...
def preProcessing(self) -> None: ...
def postProcessing(self) -> None: ...

class LDIFWriter(FileWriter):
def __init__(self, l: Any, writer_obj: Any, headerStr: str = "", footerStr: str = "") -> None: ...
24 changes: 24 additions & 0 deletions stubs/python-ldap/ldap/cidict.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from typing import Any

class cidict(dict[Any, Any]):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def __getitem__(self, key: Any) -> Any: ...
def __setitem__(self, key: Any, value: Any) -> None: ...
def __delitem__(self, key: Any) -> None: ...
def __contains__(self, key: Any) -> bool: ...
def get(self, key: Any, default: Any = ...) -> Any: ...
def setdefault(self, key: Any, default: Any = ...) -> Any: ...
def update(self, *args: Any, **kwargs: Any) -> None: ...
def pop(self, key: Any, default: Any = ...) -> Any: ...
def popitem(self) -> tuple[Any, Any]: ...
def clear(self) -> None: ...
def copy(self) -> cidict: ...
def keys(self) -> Any: ...
def items(self) -> Any: ...
def values(self) -> Any: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

def strlist_minus(a: Any, b: Any) -> Any: ...
def strlist_intersection(a: Any, b: Any) -> Any: ...
def strlist_union(a: Any, b: Any) -> Any: ...
9 changes: 9 additions & 0 deletions stubs/python-ldap/ldap/compat.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from collections import UserDict
from collections.abc import MutableMapping as MutableMapping
from shutil import which as which
from urllib.parse import quote as quote, quote_plus as quote_plus, unquote as unquote, urlparse as urlparse
from urllib.request import urlopen as urlopen

IterableUserDict = UserDict

def reraise(exc_type, exc_value, exc_traceback) -> None: ...
29 changes: 29 additions & 0 deletions stubs/python-ldap/ldap/constants.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from typing import Any

class Constant:
name: Any
requirements: Any
doc: Any
def __init__(self, name: str, optional: bool = False, requirements: Any = ..., doc: Any = ...) -> None: ...

class Error(Constant):
c_template: str

class Int(Constant):
c_template: str

class TLSInt(Int):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...

class Feature(Constant):
c_template: Any
c_feature: Any
def __init__(self, name: str, c_feature: Any, **kwargs: Any) -> None: ...

class Str(Constant):
c_template: str

API_2004: str
CONSTANTS: Any

def print_header() -> None: ...
47 changes: 47 additions & 0 deletions stubs/python-ldap/ldap/controls/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from typing import Any
from ldap.controls.simple import BooleanControl, ManageDSAITControl, RelaxRulesControl, ValueLessRequestControl
from ldap.controls.libldap import AssertionControl, MatchedValuesControl, SimplePagedResultsControl

__all__ = [
"KNOWN_RESPONSE_CONTROLS",
"AssertionControl",
"BooleanControl",
"LDAPControl",
"ManageDSAITControl",
"MatchedValuesControl",
"RelaxRulesControl",
"RequestControl",
"ResponseControl",
"SimplePagedResultsControl",
"ValueLessRequestControl",
"RequestControlTuples",
"DecodeControlTuples",
]

KNOWN_RESPONSE_CONTROLS: Any

class RequestControl:
controlType: Any
criticality: Any
encodedControlValue: Any
def __init__(self, controlType: Any = ..., criticality: bool = False, encodedControlValue: Any = ...) -> None: ...
def encodeControlValue(self) -> Any: ...

class ResponseControl:
controlType: Any
criticality: Any
encodedControlValue: Any
def __init__(self, controlType: Any = ..., criticality: bool = False) -> None: ...
def decodeControlValue(self, encodedControlValue: Any) -> Any: ...

class LDAPControl(RequestControl, ResponseControl):
controlType: Any
criticality: Any
controlValue: Any
encodedControlValue: Any
def __init__(
self, controlType: Any = ..., criticality: bool = False, controlValue: Any = ..., encodedControlValue: Any = ...
) -> None: ...

def RequestControlTuples(ldapControls: Any) -> Any: ...
def DecodeControlTuples(ldapControlTuples: Any, knownLDAPControls: Any = ...) -> Any: ...
12 changes: 12 additions & 0 deletions stubs/python-ldap/ldap/controls/deref.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import Any
from ldap.controls import LDAPControl

DEREF_CONTROL_OID: str

class DereferenceControl(LDAPControl):
controlType: Any
derefSpecs: Any
def __init__(self, criticality: bool = False, derefSpecs: Any = ...) -> None: ...
def encodeControlValue(self): ...
derefRes: Any
def decodeControlValue(self, encodedControlValue) -> None: ...
28 changes: 28 additions & 0 deletions stubs/python-ldap/ldap/controls/libldap.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from typing import Any
from ldap.controls import (
KNOWN_RESPONSE_CONTROLS as KNOWN_RESPONSE_CONTROLS,
LDAPControl as LDAPControl,
RequestControl as RequestControl,
ResponseControl as ResponseControl,
)
from ldap.pkginfo import __version__ as __version__

class AssertionControl(RequestControl):
controlType: Any
assertion: Any
def __init__(self, assertion: Any, criticality: bool = False) -> None: ...
def encodeControlValue(self): ...

class MatchedValuesControl(ResponseControl):
controlType: Any
matchedValues: Any
def __init__(self, matchedValues: Any, criticality: bool = False) -> None: ...
def decodeControlValue(self, encodedControlValue) -> None: ...

class SimplePagedResultsControl(RequestControl):
controlType: Any
size: int
cookie: Any
def __init__(self, size: int = 0, cookie: Any = ...) -> None: ...
def encodeControlValue(self): ...
def decodeControlValue(self, encodedControlValue) -> None: ...
20 changes: 20 additions & 0 deletions stubs/python-ldap/ldap/controls/openldap.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from typing import Any

from ldap.controls import ResponseControl, ValueLessRequestControl
from pyasn1.type import univ

__all__ = ["SearchNoOpControl", "SearchNoOpMixIn"]

class SearchNoOpControl(ValueLessRequestControl, ResponseControl):
controlType: str
criticality: Any # TODO: Precise type
def __init__(self, criticality: bool = False) -> None: ...

class SearchNoOpControlValue(univ.Sequence): ...
resultCode: Any # TODO: Precise type
numSearchResults: Any # TODO: Precise type
numSearchContinuations: Any # TODO: Precise type
def decodeControlValue(self, encodedControlValue) -> None: ...

class SearchNoOpMixIn:
def noop_search_st(self, base, scope=..., filterstr: str = "(objectClass=*)", timeout: int = -1): ...
10 changes: 10 additions & 0 deletions stubs/python-ldap/ldap/controls/pagedresults.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Any
from ldap.controls import RequestControl, ResponseControl

class SimplePagedResultsControl(RequestControl, ResponseControl):
controlType: Any
size: int
cookie: Any
def __init__(self, size: int = 0, cookie: Any = ...) -> None: ...
def encodeControlValue(self): ...
def decodeControlValue(self, encodedControlValue) -> None: ...
20 changes: 20 additions & 0 deletions stubs/python-ldap/ldap/controls/ppolicy.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from typing import Any
from ldap.controls import LDAPControl, ResponseControl

__all__ = ["PasswordExpiringControl", "PasswordExpiredControl"]

class PasswordPolicyControl(LDAPControl):
controlType: Any
def __init__(self, criticality: bool = False) -> None: ...
def encodeControlValue(self): ...
def decodeControlValue(self, encodedControlValue) -> None: ...

class PasswordExpiringControl(ResponseControl):
controlType: str
gracePeriod: Any # TODO: Precise type
def decodeControlValue(self, encodedControlValue) -> None: ...

class PasswordExpiredControl(ResponseControl):
controlType: str
passwordExpired: Any # TODO: Precise type
def decodeControlValue(self, encodedControlValue) -> None: ...
10 changes: 10 additions & 0 deletions stubs/python-ldap/ldap/controls/psearch.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Any
from ldap.controls import LDAPControl

class PersistentSearchControl(LDAPControl):
controlType: Any
def __init__(
self, criticality: bool = False, changeTypes: Any = ..., changesOnly: bool = False, returnECs: bool = False
) -> None: ...
def encodeControlValue(self): ...
def decodeControlValue(self, encodedControlValue) -> None: ...
15 changes: 15 additions & 0 deletions stubs/python-ldap/ldap/controls/pwdpolicy.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from typing import Any

from ldap.controls import ResponseControl

__all__ = ["PasswordExpiringControl", "PasswordExpiredControl"]

class PasswordExpiringControl(ResponseControl):
controlType: str
gracePeriod: Any # TODO: Precise type
def decodeControlValue(self, encodedControlValue) -> None: ...

class PasswordExpiredControl(ResponseControl):
controlType: str
passwordExpired: Any # TODO: Precise type
def decodeControlValue(self, encodedControlValue) -> None: ...
16 changes: 16 additions & 0 deletions stubs/python-ldap/ldap/controls/readentry.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from typing import Any

from ldap.controls import KNOWN_RESPONSE_CONTROLS as KNOWN_RESPONSE_CONTROLS, LDAPControl as LDAPControl

class ReadEntryControl(LDAPControl):
def __init__(self, criticality: bool = False, attrList: Any | None = None) -> None: ... # TODO: Precise type for attrList
def encodeControlValue(self): ...
dn: Any # TODO: Precise type
entry: Any # TODO: Precise type
def decodeControlValue(self, encodedControlValue) -> None: ...

class PreReadControl(ReadEntryControl):
controlType: Any # TODO: Precise type

class PostReadControl(ReadEntryControl):
controlType: Any # TODO: Precise type
Loading
Loading