11import datetime
2+ import zipimport
23from _typeshed import Incomplete , SupportsItems
3- from collections .abc import Generator
4- from typing import Final , Literal , TypeVar
4+ from collections .abc import Generator , Iterable
5+ from os import PathLike
6+ from types import TracebackType
7+ from typing import AnyStr , Final , Literal , TypeVar , overload
58
69from reportlab .lib .rltempfile import get_rl_tempdir as get_rl_tempdir , get_rl_tempfile as get_rl_tempfile
710
@@ -24,37 +27,37 @@ __UNSET__: Final[_UNSET_]
2427
2528isPyPy : bool
2629
27- def isFunction (v ) : ...
28- def isMethod (v , mt = ...): ...
29- def isModule (v ) : ...
30- def isSeq (v , _st = ...): ...
31- def isNative (v ) : ...
32-
33- strTypes : Incomplete
34-
35- def asBytes (v , enc : str = "utf8" ): ...
36- def asUnicode (v , enc : str = "utf8" ): ...
37- def asUnicodeEx (v , enc : str = "utf8" ): ...
38- def asNative (v , enc : str = "utf8" ): ...
39- def int2Byte (i ) : ...
40- def isStr (v ) : ...
41- def isBytes (v ) : ...
42- def isUnicode (v ) : ...
43- def isClass (v ) : ...
44- def isNonPrimitiveInstance (x ) : ...
45- def instantiated (v ) : ...
46- def bytestr (x , enc : str = "utf8" ): ...
47- def encode_label (args ): ...
48- def decode_label (label ): ...
49- def rawUnicode (s ) : ...
50- def rawBytes (s ) : ...
51-
52- rl_exec : Incomplete
53-
54- def char2int (s ) : ...
55- def rl_reraise (t , v , b : Incomplete | None = None ) -> None : ...
30+ def isFunction (v : object ) -> bool : ...
31+ def isMethod (v : object , mt = ...) -> bool : ...
32+ def isModule (v : object ) -> bool : ...
33+ def isSeq (v : object , _st = ...) -> bool : ...
34+ def isNative (v : object ) -> bool : ...
35+
36+ strTypes : tuple [ type [ str ], type [ bytes ]]
37+
38+ def asBytes (v : str | bytes , enc : str = "utf8" ) -> bytes : ...
39+ def asUnicode (v : str | bytes , enc : str = "utf8" ) -> str : ...
40+ def asUnicodeEx (v : str | bytes , enc : str = "utf8" ) -> str : ...
41+ def asNative (v : str | bytes , enc : str = "utf8" ) -> str : ...
42+ def int2Byte (i : int ) -> bytes : ...
43+ def isStr (v : object ) -> bool : ...
44+ def isBytes (v : object ) -> bool : ...
45+ def isUnicode (v : object ) -> bool : ...
46+ def isClass (v : object ) -> bool : ...
47+ def isNonPrimitiveInstance (x : object ) -> bool : ...
48+ def instantiated (v : object ) -> bool : ...
49+ def bytestr (x : object , enc : str = "utf8" ) -> bytes : ...
50+ def encode_label (args ) -> str : ...
51+ def decode_label (label : str ): ...
52+ def rawUnicode (s : str | bytes ) -> str : ...
53+ def rawBytes (s : str | bytes ) -> bytes : ...
54+
55+ rl_exec = exec
56+
57+ def char2int (s : int | str | bytes ) -> int : ...
58+ def rl_reraise (t , v : BaseException , b : TracebackType | None = None ) -> None : ...
5659def rl_add_builtins (** kwd ) -> None : ...
57- def zipImported (ldr : Incomplete | None = None ): ...
60+ def zipImported (ldr : zipimport . zipimporter | None = None ) -> zipimport . zipimporter | None : ...
5861
5962class CIDict (dict [_KT , _VT ]):
6063 def __init__ (self , * args , ** kwds ) -> None : ...
@@ -64,14 +67,14 @@ def markfilename(filename, creatorcode: Incomplete | None = None, filetype: Inco
6467
6568__rl_loader__ : Incomplete
6669
67- def rl_glob (pattern , glob = ...): ...
68- def isFileSystemDistro (): ...
69- def isCompactDistro (): ...
70- def isSourceDistro (): ...
71- def normalize_path (p ) : ...
70+ def rl_glob (pattern : AnyStr , glob = ...) -> list [ AnyStr ] : ...
71+ def isFileSystemDistro () -> bool : ...
72+ def isCompactDistro () -> bool : ...
73+ def isSourceDistro () -> bool : ...
74+ def normalize_path (p : PathLike [ AnyStr ]) -> PathLike [ AnyStr ] : ...
7275def recursiveImport (modulename , baseDir : Incomplete | None = None , noCWD : int = 0 , debug : int = 0 ): ...
7376
74- haveImages : Incomplete
77+ haveImages : Final [ bool ]
7578
7679class ArgvDictValue :
7780 value : Incomplete
@@ -147,15 +150,18 @@ class _FmtSelfDict:
147150
148151class FmtSelfDict : ...
149152
150- def simpleSplit (text , fontName , fontSize , maxWidth ): ...
151- def escapeTextOnce (text ): ...
153+ def simpleSplit (text : str | bytes , fontName : str | None , fontSize : float , maxWidth : float | None ): ...
154+ @overload
155+ def escapeTextOnce (text : None ) -> None : ...
156+ @overload
157+ def escapeTextOnce (text : str | bytes ) -> str : ...
152158def fileName2FSEnc (fn ): ...
153159def prev_this_next (items ): ...
154- def commasplit (s ) : ...
155- def commajoin (l ) : ...
160+ def commasplit (s : str | bytes ) -> list [ str ] : ...
161+ def commajoin (l : Iterable [ str | bytes ]) -> str : ...
156162def findInPaths (fn , paths , isfile : bool = True , fail : bool = False ): ...
157- def annotateException (msg , enc : str = "utf8" , postMsg : str = "" , sep : str = " " ) -> None : ...
158- def escapeOnce (data ) : ...
163+ def annotateException (msg : str , enc : str = "utf8" , postMsg : str = "" , sep : str = " " ) -> None : ...
164+ def escapeOnce (data : str ) -> str : ...
159165
160166class IdentStr (str ):
161167 def __new__ (cls , value ): ...
@@ -188,3 +194,12 @@ def recursiveGetAttr(obj, name, g: Incomplete | None = None): ...
188194def recursiveSetAttr (obj , name , value ) -> None : ...
189195def recursiveDelAttr (obj , name ) -> None : ...
190196def yieldNoneSplits (L ) -> Generator [Incomplete , None , None ]: ...
197+
198+ class KlassStore :
199+ lim : int
200+ store : dict [str , type ]
201+ def __init__ (self , lim : int = 127 ) -> None : ...
202+ def add (self , k : str , v : type ) -> None : ...
203+ def __contains__ (self , k ) -> bool : ...
204+ def __getitem__ (self , k : str ) -> type : ...
205+ def get (self , k , default = None ): ...
0 commit comments