Skip to content

Commit c4507e4

Browse files
authored
Merge pull request #114 from adriengcql/patch-2
Use built-in Self type in __init__.pyi when available
2 parents a9744d6 + f620a31 commit c4507e4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/frozendict/__init__.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
import sys
4+
35
from typing import (
46
TypeVar,
57
overload,
@@ -19,11 +21,15 @@ except ImportError:
1921
Tuple = tuple
2022
Type = type
2123

24+
if sys.version_info >= (3, 11):
25+
from typing import Self as SelfT
26+
else:
27+
SelfT = TypeVar("SelfT", bound=frozendict[K, V])
28+
2229
K = TypeVar("K")
2330
V = TypeVar("V", covariant=True)
2431
K2 = TypeVar("K2")
2532
V2 = TypeVar("V2", covariant=True)
26-
SelfT = TypeVar("SelfT", bound=frozendict[K, V])
2733

2834
# noinspection PyPep8Naming
2935
class frozendict(Mapping[K, V]):

0 commit comments

Comments
 (0)