|
1 | 1 | import sys
|
2 | 2 | from functools import wraps as wraps # noqa: F401
|
3 |
| -from typing import Any, Callable, Generic, List, Optional, Tuple, Type, TypeVar, Union, overload |
| 3 | +from typing import Any, Callable, Generic, List, Optional, Sequence, Tuple, Type, TypeVar, Union, overload |
4 | 4 |
|
5 | 5 | from django.db.models.base import Model
|
| 6 | +from typing_extensions import SupportsIndex |
6 | 7 |
|
7 | 8 | if sys.version_info < (3, 8):
|
8 | 9 | from typing_extensions import Protocol
|
@@ -31,10 +32,24 @@ class Promise:
|
31 | 32 | def __radd__(self, other: Any) -> Any: ...
|
32 | 33 | def __deepcopy__(self, memo: Any): ...
|
33 | 34 |
|
| 35 | +class _StrPromise(Promise, Sequence[str]): |
| 36 | + def __add__(self, __s: str) -> str: ... |
| 37 | + # Incompatible with Sequence.__contains__ |
| 38 | + def __contains__(self, __o: str) -> bool: ... # type: ignore[override] |
| 39 | + def __ge__(self, __x: str) -> bool: ... |
| 40 | + def __getitem__(self, __i: SupportsIndex | slice) -> str: ... |
| 41 | + def __gt__(self, __x: str) -> bool: ... |
| 42 | + def __le__(self, __x: str) -> bool: ... |
| 43 | + def __lt__(self, __x: str) -> bool: ... |
| 44 | + def __mod__(self, __x: Any) -> str: ... |
| 45 | + def __mul__(self, __n: SupportsIndex) -> str: ... |
| 46 | + def __rmul__(self, __n: SupportsIndex) -> str: ... |
| 47 | + def __getnewargs__(self) -> tuple[str]: ... |
| 48 | + |
34 | 49 | _C = TypeVar("_C", bound=Callable)
|
35 | 50 |
|
36 | 51 | def lazy(func: _C, *resultclasses: Any) -> _C: ...
|
37 |
| -def lazystr(text: Any) -> str: ... |
| 52 | +def lazystr(text: Any) -> _StrPromise: ... |
38 | 53 | def keep_lazy(*resultclasses: Any) -> Callable: ...
|
39 | 54 | def keep_lazy_text(func: Callable) -> Callable: ...
|
40 | 55 |
|
|
0 commit comments