Skip to content

Commit 7538e45

Browse files
committed
refactor: declare TypeAliases explicitly
Issue: #368
1 parent 334a22b commit 7538e45

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

Lib/ldap/schema/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from __future__ import annotations
88
import sys
99

10-
from typing import ClassVar, TYPE_CHECKING
10+
from typing import ClassVar, TypeAlias, TYPE_CHECKING
1111
from collections.abc import Iterator, MutableMapping
1212
if TYPE_CHECKING:
1313
from typing_extensions import Self
@@ -22,7 +22,7 @@
2222
LDAPTokenDict
2323
)
2424

25-
EntryBase = MutableMapping[str, list[bytes]]
25+
EntryBase: TypeAlias = MutableMapping[str, list[bytes]]
2626

2727

2828
NOT_HUMAN_READABLE_LDAP_SYNTAXES = {

Lib/ldap/schema/tokenizer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import re
1010
import warnings
1111

12-
from typing import Any, Mapping, Union
12+
from typing import Any, Mapping, Union, TypeAlias
1313

14-
LDAPTokenDictValue = Union[tuple[()], tuple[str, ...]]
14+
LDAPTokenDictValue: TypeAlias = Union[tuple[()], tuple[str, ...]]
1515
"""The kind of values which may be found in a token dict."""
1616

17-
LDAPTokenDict = Mapping[str, LDAPTokenDictValue]
17+
LDAPTokenDict: TypeAlias = Mapping[str, LDAPTokenDictValue]
1818
"""The type of the dict used to keep track of tokens while parsing schema
1919
(Mapping because of variance)."""
2020

Lib/ldapurl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from collections.abc import MutableMapping
2222
from urllib.parse import quote, unquote
2323

24-
from typing import Iterator
24+
from typing import Iterator, TypeAlias
2525

2626
LDAP_SCOPE_BASE = 0
2727
LDAP_SCOPE_ONELEVEL = 1
@@ -141,7 +141,7 @@ def __ne__(self, other: object) -> bool:
141141
return not self.__eq__(other)
142142

143143

144-
LDAPUrlExtensionsBase = MutableMapping[str, LDAPUrlExtension]
144+
LDAPUrlExtensionsBase: TypeAlias = MutableMapping[str, LDAPUrlExtension]
145145

146146
class LDAPUrlExtensions(LDAPUrlExtensionsBase):
147147
"""

0 commit comments

Comments
 (0)