Skip to content

Commit bc62943

Browse files
committed
python-ldap: Add package stubs
1 parent 2315638 commit bc62943

42 files changed

Lines changed: 1153 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ exclude = [
2424
".git",
2525
".mypy_cache",
2626
".pytype",
27+
"python-ldap",
2728
]
2829

2930
[tool.ruff.lint]

pyrightconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"stubs/geopandas",
1313
// test cases use a custom config file
1414
"**/@tests/test_cases",
15+
"python-ldap"
1516
],
1617
"typeCheckingMode": "strict",
1718
// Allowed in base settings for incomplete stubs, checked in stricter settings

pyrightconfig.stricter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"stubs/python-dateutil",
8787
"stubs/python-http-client",
8888
"stubs/python-jose",
89+
"stubs/python-ldap",
8990
"stubs/pywin32",
9091
"stubs/pyxdg",
9192
"stubs/PyYAML",

python-ldap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit cbcbb6275ca8f4dc36eb2f131f37e2f03814a400

stubs/python-ldap/METADATA.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version = "3.4.*"
2+
requires = ["types-pyasn1"]
3+
upstream_repository = "https://github.com/python-ldap/python-ldap"
4+
extra_description = """
5+
Type stubs for python-ldap, covering the public API as documented at
6+
https://www.python-ldap.org/doc/html/api.html.
7+
"""
8+
partial_stub = true
9+
10+
[tool.stubtest]
11+
stubtest_requirements = ["python-ldap"]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from typing import Any
2+
3+
__version__: str
4+
__author__: str
5+
__license__: str
6+
7+
LIBLDAP_API_INFO: Any
8+
OPT_NAMES_DICT: dict[Any, Any]
9+
OPT_ERROR_STRING: int
10+
OPT_DIAGNOSTIC_MESSAGE: int
11+
12+
class LDAPLock:
13+
def __init__(self, lock_class: Any = ..., desc: str = ...) -> None: ...
14+
def acquire(self) -> None: ...
15+
def release(self) -> None: ...
16+
17+
_ldap_module_lock: LDAPLock
18+
19+
def initialize(
20+
uri: str,
21+
trace_level: int = ...,
22+
trace_file: Any = ...,
23+
trace_stack_limit: Any = ...,
24+
bytes_mode: Any = ...,
25+
fileno: Any = ...,
26+
**kwargs: Any,
27+
) -> Any: ...
28+
def get_option(option: Any) -> Any: ...
29+
def set_option(option: Any, invalue: Any) -> None: ...
30+
def escape_str(escape_func: Any, s: Any, *args: Any) -> Any: ...
31+
def strf_secs(secs: Any) -> Any: ...
32+
def strp_secs(dt_str: Any) -> Any: ...
33+
34+
class NO_UNIQUE_ENTRY(Exception): ...
35+
class LDAPBytesWarning(Warning): ...
36+
37+
from ldap.dn import explode_dn as explode_dn, explode_rdn as explode_rdn

stubs/python-ldap/ldap/async.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from ldap.asyncsearch import *
2+
from ldap.asyncsearch import __version__ as __version__
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
from typing import Any
2+
from ldap import __version__ as __version__
3+
4+
SEARCH_RESULT_TYPES: set[int]
5+
ENTRY_RESULT_TYPES: set[int]
6+
7+
class WrongResultType(Exception):
8+
9+
receivedResultType: Any
10+
expectedResultTypes: Any
11+
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
12+
13+
class AsyncSearchHandler:
14+
15+
beginResultsDropped: int
16+
endResultBreak: int
17+
def __init__(self, l: Any) -> None: ...
18+
def startSearch(
19+
self,
20+
searchRoot: Any,
21+
searchScope: Any,
22+
filterStr: Any,
23+
attrList: Any = ...,
24+
attrsOnly: int = 0,
25+
timeout: int = -1,
26+
sizelimit: int = 0,
27+
serverctrls: Any = ...,
28+
clientctrls: Any = ...,
29+
) -> None: ...
30+
def preProcessing(self) -> None: ...
31+
def afterFirstResult(self) -> None: ...
32+
def postProcessing(self) -> None: ...
33+
def processResults(self, ignoreResultsNumber: int = 0, processResultsCount: int = 0, timeout: int = -1) -> bool: ...
34+
35+
class List(AsyncSearchHandler):
36+
37+
allResults: list[Any]
38+
def __init__(self, l: Any) -> None: ...
39+
40+
class Dict(AsyncSearchHandler):
41+
42+
allEntries: dict[Any, Any]
43+
def __init__(self, l: Any) -> None: ...
44+
45+
class IndexedDict(Dict):
46+
47+
indexed_attrs: Any
48+
index: Any
49+
def __init__(self, l: Any, indexed_attrs: Any = ...) -> None: ...
50+
51+
class FileWriter(AsyncSearchHandler):
52+
53+
headerStr: str
54+
footerStr: str
55+
def __init__(self, l: Any, f: Any, headerStr: str = "", footerStr: str = "") -> None: ...
56+
def preProcessing(self) -> None: ...
57+
def postProcessing(self) -> None: ...
58+
59+
class LDIFWriter(FileWriter):
60+
def __init__(self, l: Any, writer_obj: Any, headerStr: str = "", footerStr: str = "") -> None: ...

stubs/python-ldap/ldap/cidict.pyi

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from typing import Any
2+
3+
class cidict(dict[Any, Any]):
4+
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
5+
def __getitem__(self, key: Any) -> Any: ...
6+
def __setitem__(self, key: Any, value: Any) -> None: ...
7+
def __delitem__(self, key: Any) -> None: ...
8+
def __contains__(self, key: Any) -> bool: ...
9+
def get(self, key: Any, default: Any = ...) -> Any: ...
10+
def setdefault(self, key: Any, default: Any = ...) -> Any: ...
11+
def update(self, *args: Any, **kwargs: Any) -> None: ...
12+
def pop(self, key: Any, default: Any = ...) -> Any: ...
13+
def popitem(self) -> tuple[Any, Any]: ...
14+
def clear(self) -> None: ...
15+
def copy(self) -> cidict: ...
16+
def keys(self) -> Any: ...
17+
def items(self) -> Any: ...
18+
def values(self) -> Any: ...
19+
def __eq__(self, other: object) -> bool: ...
20+
def __ne__(self, other: object) -> bool: ...
21+
22+
def strlist_minus(a: Any, b: Any) -> Any: ...
23+
def strlist_intersection(a: Any, b: Any) -> Any: ...
24+
def strlist_union(a: Any, b: Any) -> Any: ...

stubs/python-ldap/ldap/compat.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from collections import UserDict
2+
from collections.abc import MutableMapping as MutableMapping
3+
from shutil import which as which
4+
from urllib.parse import quote as quote, quote_plus as quote_plus, unquote as unquote, urlparse as urlparse
5+
from urllib.request import urlopen as urlopen
6+
7+
IterableUserDict = UserDict
8+
9+
def reraise(exc_type, exc_value, exc_traceback) -> None: ...

0 commit comments

Comments
 (0)