Skip to content

Commit de7daeb

Browse files
authored
[reportlab] Use TypeIs for utils (#15451)
1 parent 0cb9381 commit de7daeb

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

stubs/reportlab/reportlab/lib/utils.pyi

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import datetime
22
import zipimport
33
from _typeshed import Incomplete, SupportsItems
4+
from builtins import _ClassInfo
45
from collections.abc import Generator, Iterable, MutableMapping
56
from os import PathLike
67
from time import _TimeTuple, struct_time
78
from types import TracebackType
89
from typing import AnyStr, Final, Literal, TypeVar, overload, type_check_only
10+
from typing_extensions import TypeIs
911
from urllib.request import _UrlopenRet
1012

1113
from reportlab.lib.rltempfile import get_rl_tempdir as get_rl_tempdir, get_rl_tempfile as get_rl_tempfile
@@ -31,10 +33,10 @@ __UNSET__: Final[_UNSET_]
3133
isPyPy: bool
3234

3335
def isFunction(v: object) -> bool: ...
34-
def isMethod(v: object, mt=...) -> bool: ...
36+
def isMethod(v: object, mt: type = ...) -> bool: ...
3537
def isModule(v: object) -> bool: ...
36-
def isSeq(v: object, _st=...) -> bool: ...
37-
def isNative(v: object) -> bool: ...
38+
def isSeq(v: object, _st: _ClassInfo = ...) -> bool: ...
39+
def isNative(v: object) -> TypeIs[str]: ...
3840

3941
strTypes: tuple[type[str], type[bytes]]
4042

@@ -43,10 +45,10 @@ def asUnicode(v: str | bytes, enc: str = "utf8") -> str: ...
4345
def asUnicodeEx(v: str | bytes, enc: str = "utf8") -> str: ...
4446
def asNative(v: str | bytes, enc: str = "utf8") -> str: ...
4547
def int2Byte(i: int) -> bytes: ...
46-
def isStr(v: object) -> bool: ...
47-
def isBytes(v: object) -> bool: ...
48-
def isUnicode(v: object) -> bool: ...
49-
def isClass(v: object) -> bool: ...
48+
def isStr(v: object) -> TypeIs[str | bytes]: ...
49+
def isBytes(v: object) -> TypeIs[bytes]: ...
50+
def isUnicode(v: object) -> TypeIs[str]: ...
51+
def isClass(v: object) -> TypeIs[type]: ...
5052
def isNonPrimitiveInstance(x: object) -> bool: ...
5153
def instantiated(v: object) -> bool: ...
5254
def bytestr(x: object, enc: str = "utf8") -> bytes: ...

0 commit comments

Comments
 (0)