diff --git a/stubs/reportlab/reportlab/lib/PyFontify.pyi b/stubs/reportlab/reportlab/lib/PyFontify.pyi index c1bcc0d67e05..cf5a8f4c7b38 100644 --- a/stubs/reportlab/reportlab/lib/PyFontify.pyi +++ b/stubs/reportlab/reportlab/lib/PyFontify.pyi @@ -1,3 +1,4 @@ +import re from _typeshed import Incomplete from typing import Final @@ -5,17 +6,17 @@ __version__: Final[str] def replace(src, sep, rep): ... -keywordsList: Incomplete +keywordsList: list[str] commentPat: str pat: str -quotePat: Incomplete -tripleQuotePat: Incomplete +quotePat: str +tripleQuotePat: str nonKeyPat: str -keyPat: Incomplete -matchPat: Incomplete -matchRE: Incomplete +keyPat: str +matchPat: str +matchRE: re.Pattern[str] idKeyPat: str -idRE: Incomplete +idRE: re.Pattern[str] -def fontify(pytext, searchfrom: int = 0, searchto=None): ... +def fontify(pytext, searchfrom: int = 0, searchto=None) -> list[tuple[str, int, int, Incomplete]]: ... def test(path) -> None: ... diff --git a/stubs/reportlab/reportlab/lib/arciv.pyi b/stubs/reportlab/reportlab/lib/arciv.pyi index 0fa1d8aee78c..501f1df37996 100644 --- a/stubs/reportlab/reportlab/lib/arciv.pyi +++ b/stubs/reportlab/reportlab/lib/arciv.pyi @@ -1,9 +1,9 @@ class ArcIV: def __init__(self, key) -> None: ... def reset(self) -> None: ... - def encode(self, S): ... + def encode(self, S: str | bytes | list[int]) -> bytes: ... -def encode(text, key): ... -def decode(text, key): ... +def encode(text: str | bytes | list[int], key) -> bytes: ... +def decode(text: str | bytes | list[int], key) -> bytes: ... __all__ = ["ArcIV", "encode", "decode"] diff --git a/stubs/reportlab/reportlab/lib/attrmap.pyi b/stubs/reportlab/reportlab/lib/attrmap.pyi index ac586aadc7f1..a951823e0b91 100644 --- a/stubs/reportlab/reportlab/lib/attrmap.pyi +++ b/stubs/reportlab/reportlab/lib/attrmap.pyi @@ -19,8 +19,8 @@ class AttrMapValue: class AttrMap(dict[str, AttrMapValue]): def __init__(self, BASE=None, UNWANTED=[], **kw) -> None: ... def remove(self, unwanted) -> None: ... - def clone(self, UNWANTED=[], **kw): ... + def clone(self, UNWANTED=[], **kw) -> AttrMap: ... def validateSetattr(obj, name, value) -> None: ... -def hook__setattr__(obj): ... +def hook__setattr__(obj) -> None: ... def addProxyAttribute(src, name, validate=None, desc=None, initial=None, dst=None) -> None: ... diff --git a/stubs/reportlab/reportlab/lib/boxstuff.pyi b/stubs/reportlab/reportlab/lib/boxstuff.pyi index 1bd2d1f13466..24343fe30f39 100644 --- a/stubs/reportlab/reportlab/lib/boxstuff.pyi +++ b/stubs/reportlab/reportlab/lib/boxstuff.pyi @@ -1,6 +1,14 @@ -from typing import Final +from _typeshed import Incomplete +from typing import Final, Literal, overload __version__: Final[str] -def rectCorner(x, y, width, height, anchor: str = "sw", dims: bool = False): ... -def aspectRatioFix(preserve, anchor, x, y, width, height, imWidth, imHeight, anchorAtXY: bool = False): ... +@overload +def rectCorner( + x, y, width, height, anchor: str = "sw", dims: Literal[True] = ... +) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... +@overload +def rectCorner(x, y, width, height, anchor: str = "sw", dims: Literal[False] | None = False) -> tuple[Incomplete, Incomplete]: ... +def aspectRatioFix( + preserve, anchor, x, y, width, height, imWidth, imHeight, anchorAtXY: bool = False +) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete]: ... diff --git a/stubs/reportlab/reportlab/lib/codecharts.pyi b/stubs/reportlab/reportlab/lib/codecharts.pyi index 2f514340c0b1..b91508e6c77a 100644 --- a/stubs/reportlab/reportlab/lib/codecharts.pyi +++ b/stubs/reportlab/reportlab/lib/codecharts.pyi @@ -1,11 +1,12 @@ from _typeshed import Incomplete from typing import Final +from reportlab.graphics.shapes import Group from reportlab.graphics.widgetbase import Widget from reportlab.platypus import Flowable __version__: Final[str] -adobe2codec: Incomplete +adobe2codec: dict[str, str] class CodeChartBase(Flowable): rows: Incomplete @@ -14,7 +15,7 @@ class CodeChartBase(Flowable): ylist: Incomplete xlist: Incomplete def calcLayout(self) -> None: ... - def formatByte(self, byt): ... + def formatByte(self, byt) -> str: ... def drawChars(self, charList) -> None: ... def drawLabels(self, topLeft: str = "") -> None: ... @@ -35,7 +36,7 @@ class SingleByteEncodingChart(CodeChartBase): boxSize: int = 14, hex: int = 1, ) -> None: ... - def draw(self): ... + def draw(self) -> None: ... class KutenRowCodeChart(CodeChartBase): row: Incomplete @@ -49,7 +50,7 @@ class KutenRowCodeChart(CodeChartBase): encodingName: Incomplete fontName: Incomplete def __init__(self, row, faceName, encodingName) -> None: ... - def makeRow(self, row): ... + def makeRow(self, row) -> list[bytes | list[None]]: ... def draw(self) -> None: ... class Big5CodeChart(CodeChartBase): @@ -64,7 +65,7 @@ class Big5CodeChart(CodeChartBase): rowLabels: Incomplete fontName: Incomplete def __init__(self, row, faceName, encodingName) -> None: ... - def makeRow(self, row): ... + def makeRow(self, row) -> list[bytes | list[None]]: ... def draw(self) -> None: ... def hBoxText(msg, canvas, x, y, fontName) -> None: ... @@ -75,6 +76,6 @@ class CodeWidget(Widget): width: int height: int def __init__(self) -> None: ... - def draw(self): ... + def draw(self) -> Group: ... def test() -> None: ... diff --git a/stubs/reportlab/reportlab/lib/corp.pyi b/stubs/reportlab/reportlab/lib/corp.pyi index 59df816f8c0f..9c71b4a4cc9f 100644 --- a/stubs/reportlab/reportlab/lib/corp.pyi +++ b/stubs/reportlab/reportlab/lib/corp.pyi @@ -1,6 +1,8 @@ from _typeshed import Incomplete +from collections.abc import Iterable from typing import Final +from reportlab.graphics.shapes import Drawing, Group from reportlab.graphics.widgetbase import Widget from reportlab.lib.attrmap import * from reportlab.lib.validators import * @@ -24,10 +26,10 @@ class RL_CorpLogo(Widget): pageColors: Incomplete prec: Incomplete def __init__(self) -> None: ... - def demo(self): ... + def demo(self) -> Drawing: ... @staticmethod def applyPrec(P, prec): ... - def draw(self): ... + def draw(self) -> Group: ... class RL_CorpLogoReversed(RL_CorpLogo): background: Incomplete @@ -42,8 +44,8 @@ class RL_CorpLogoThin(Widget): height: Incomplete width: Incomplete def __init__(self) -> None: ... - def demo(self): ... - def draw(self): ... + def demo(self) -> Drawing: ... + def draw(self) -> Group: ... class ReportLabLogo: origin: Incomplete @@ -73,7 +75,7 @@ class RL_BusinessCard(Widget): web: str rh_blurb_top: Incomplete def __init__(self) -> None: ... - def demo(self): ... - def draw(self): ... + def demo(self) -> Drawing: ... + def draw(self) -> Group: ... -def test(formats=["pdf", "eps", "jpg", "gif", "svg"]) -> None: ... +def test(formats: Iterable[str] = ["pdf", "eps", "jpg", "gif", "svg"]) -> None: ... diff --git a/stubs/reportlab/reportlab/lib/extformat.pyi b/stubs/reportlab/reportlab/lib/extformat.pyi index b63e249399ae..4d9f857e35f8 100644 --- a/stubs/reportlab/reportlab/lib/extformat.pyi +++ b/stubs/reportlab/reportlab/lib/extformat.pyi @@ -1,6 +1,9 @@ -from typing import Final +from collections.abc import Mapping +from typing import Any, Final __version__: Final[str] -def dictformat(_format, L={}, G={}): ... -def magicformat(format): ... +def dictformat( + _format: str, L: Mapping[str, object] | None = {}, G: dict[str, Any] | None = {} # `L` and `G` are passed to `eval` function +) -> str: ... +def magicformat(format: str) -> str: ... diff --git a/stubs/reportlab/reportlab/lib/fontfinder.pyi b/stubs/reportlab/reportlab/lib/fontfinder.pyi index 05370969b197..1cbcb05c185e 100644 --- a/stubs/reportlab/reportlab/lib/fontfinder.pyi +++ b/stubs/reportlab/reportlab/lib/fontfinder.pyi @@ -1,20 +1,21 @@ from _typeshed import Incomplete from typing import Final +from typing_extensions import LiteralString __version__: Final[str] -def asNative(s): ... +def asNative(s) -> str: ... -EXTENSIONS: Incomplete -FF_FIXED: Incomplete -FF_SERIF: Incomplete -FF_SYMBOLIC: Incomplete -FF_SCRIPT: Incomplete -FF_NONSYMBOLIC: Incomplete -FF_ITALIC: Incomplete -FF_ALLCAP: Incomplete -FF_SMALLCAP: Incomplete -FF_FORCEBOLD: Incomplete +EXTENSIONS: Final = [".ttf", ".ttc", ".otf", ".pfb", ".pfa"] +FF_FIXED: Final = 1 +FF_SERIF: Final = 2 +FF_SYMBOLIC: Final = 4 +FF_SCRIPT: Final = 8 +FF_NONSYMBOLIC: Final = 32 +FF_ITALIC: Final = 64 +FF_ALLCAP: Final = 65536 +FF_SMALLCAP: Final = 131072 +FF_FORCEBOLD: Final = 262144 class FontDescriptor: name: Incomplete @@ -30,7 +31,7 @@ class FontDescriptor: metricsFileName: Incomplete timeModified: int def __init__(self) -> None: ... - def getTag(self): ... + def getTag(self) -> LiteralString: ... class FontFinder: useCache: Incomplete @@ -41,11 +42,11 @@ class FontFinder: ) -> None: ... def addDirectory(self, dirName, recur=None) -> None: ... def addDirectories(self, dirNames, recur=None) -> None: ... - def getFamilyNames(self): ... + def getFamilyNames(self) -> list[bytes]: ... def getFontsInFamily(self, familyName): ... - def getFamilyXmlReport(self): ... - def getFontsWithAttributes(self, **kwds): ... - def getFont(self, familyName, bold: bool = False, italic: bool = False): ... + def getFamilyXmlReport(self) -> LiteralString: ... + def getFontsWithAttributes(self, **kwds) -> list[FontDescriptor]: ... + def getFont(self, familyName, bold: bool = False, italic: bool = False) -> FontDescriptor: ... def save(self, fileName) -> None: ... def load(self, fileName) -> None: ... def search(self) -> None: ... diff --git a/stubs/reportlab/reportlab/lib/formatters.pyi b/stubs/reportlab/reportlab/lib/formatters.pyi index c88692bc1331..bb46a3be1d94 100644 --- a/stubs/reportlab/reportlab/lib/formatters.pyi +++ b/stubs/reportlab/reportlab/lib/formatters.pyi @@ -1,19 +1,23 @@ from _typeshed import Incomplete +from typing import Literal +from typing_extensions import LiteralString class Formatter: - pattern: Incomplete - def __init__(self, pattern) -> None: ... - def format(self, obj): ... - def __call__(self, x): ... + pattern: str + def __init__(self, pattern: str) -> None: ... + def format(self, obj: object) -> str: ... + def __call__(self, x: object) -> str: ... class DecimalFormatter(Formatter): calcPlaces: Incomplete - places: Incomplete + places: int dot: Incomplete comma: Incomplete prefix: Incomplete suffix: Incomplete - def __init__(self, places: int = 2, decimalSep: str = ".", thousandSep=None, prefix=None, suffix=None) -> None: ... - def format(self, num): ... + def __init__( + self, places: int | Literal["auto"] = 2, decimalSep: str = ".", thousandSep=None, prefix=None, suffix=None + ) -> None: ... + def format(self, num) -> LiteralString: ... __all__ = ("Formatter", "DecimalFormatter") diff --git a/stubs/reportlab/reportlab/lib/geomutils.pyi b/stubs/reportlab/reportlab/lib/geomutils.pyi index a3d70aa15bd5..1fec093fb40c 100644 --- a/stubs/reportlab/reportlab/lib/geomutils.pyi +++ b/stubs/reportlab/reportlab/lib/geomutils.pyi @@ -2,4 +2,4 @@ from typing import Final __version__: Final[str] -def normalizeTRBL(p): ... +def normalizeTRBL(p: float | tuple[float, ...] | list[float]) -> tuple[float, ...]: ... diff --git a/stubs/reportlab/reportlab/lib/logger.pyi b/stubs/reportlab/reportlab/lib/logger.pyi index 5e802c369ef2..ce7635c168ee 100644 --- a/stubs/reportlab/reportlab/lib/logger.pyi +++ b/stubs/reportlab/reportlab/lib/logger.pyi @@ -10,15 +10,15 @@ class Logger: def write(self, text) -> None: ... def __call__(self, text) -> None: ... -logger: Incomplete +logger: Logger class WarnOnce: - uttered: Incomplete - pfx: Incomplete - enabled: int + uttered: dict[Incomplete, Incomplete] + pfx: str + enabled: bool | int def __init__(self, kind: str = "Warn") -> None: ... def once(self, warning) -> None: ... def __call__(self, warning) -> None: ... -warnOnce: Incomplete -infoOnce: Incomplete +warnOnce: WarnOnce +infoOnce: WarnOnce diff --git a/stubs/reportlab/reportlab/lib/normalDate.pyi b/stubs/reportlab/reportlab/lib/normalDate.pyi index 0d26498cb29e..98e40086381d 100644 --- a/stubs/reportlab/reportlab/lib/normalDate.pyi +++ b/stubs/reportlab/reportlab/lib/normalDate.pyi @@ -1,82 +1,83 @@ -from _typeshed import Incomplete -from typing import Final +from _typeshed import ConvertibleToInt +from typing import Final, Literal +from typing_extensions import Self __version__: Final[str] -def getStdMonthNames(): ... -def getStdShortMonthNames(): ... -def getStdDayNames(): ... -def getStdShortDayNames(): ... -def isLeapYear(year): ... +def getStdMonthNames() -> list[str]: ... +def getStdShortMonthNames() -> list[str]: ... +def getStdDayNames() -> list[str]: ... +def getStdShortDayNames() -> list[str]: ... +def isLeapYear(year: int) -> Literal[0, 1]: ... class NormalDateException(Exception): ... class NormalDate: def __init__(self, normalDate=None) -> None: ... def add(self, days) -> None: ... - def __add__(self, days): ... - def __radd__(self, days): ... - def clone(self): ... - def __lt__(self, other): ... - def __le__(self, other): ... - def __eq__(self, other): ... - def __ne__(self, other): ... - def __ge__(self, other): ... - def __gt__(self, other): ... - def day(self): ... - def dayOfWeek(self): ... + def __add__(self, days: int) -> Self: ... + def __radd__(self, days: int) -> Self: ... + def clone(self) -> Self: ... + def __lt__(self, other) -> bool: ... + def __le__(self, other) -> bool: ... + def __eq__(self, other) -> bool: ... + def __ne__(self, other) -> bool: ... + def __ge__(self, other) -> bool: ... + def __gt__(self, other) -> bool: ... + def day(self) -> int: ... + def dayOfWeek(self) -> int: ... @property def __day_of_week_name__(self): ... def dayOfWeekAbbrev(self): ... def dayOfWeekName(self): ... - def dayOfYear(self): ... - def daysBetweenDates(self, normalDate): ... - def equals(self, target): ... - def endOfMonth(self): ... - def firstDayOfMonth(self): ... - def formatUS(self): ... - def formatUSCentury(self): ... + def dayOfYear(self) -> int: ... + def daysBetweenDates(self, normalDate) -> int: ... + def equals(self, target) -> bool | Literal[0]: ... + def endOfMonth(self) -> Self: ... + def firstDayOfMonth(self) -> Self: ... + def formatUS(self) -> str: ... + def formatUSCentury(self) -> str: ... def formatMS(self, fmt): ... - def __hash__(self): ... + def __hash__(self) -> int: ... def __int__(self) -> int: ... - def isLeapYear(self): ... - def lastDayOfMonth(self): ... - def localeFormat(self): ... - def month(self): ... + def isLeapYear(self) -> Literal[0, 1]: ... + def lastDayOfMonth(self) -> int: ... + def localeFormat(self) -> str: ... + def month(self) -> int: ... @property def __month_name__(self): ... def monthAbbrev(self): ... def monthName(self): ... def normalize(self, scalar) -> None: ... - def range(self, days): ... - def scalar(self): ... + def range(self, days) -> list[NormalDate]: ... + def scalar(self) -> int: ... def setDay(self, day) -> None: ... def setMonth(self, month) -> None: ... - normalDate: Incomplete + normalDate: int | None def setNormalDate(self, normalDate) -> None: ... def setYear(self, year) -> None: ... def __sub__(self, v): ... def __rsub__(self, v): ... - def toTuple(self): ... - def year(self): ... + def toTuple(self) -> tuple[int, int, int]: ... + def year(self) -> int: ... -def bigBang(): ... -def bigCrunch(): ... -def dayOfWeek(y, m, d): ... -def firstDayOfYear(year): ... +def bigBang() -> NormalDate: ... +def bigCrunch() -> NormalDate: ... +def dayOfWeek(y: int, m: int, d: int) -> int: ... +def firstDayOfYear(year: int) -> int: ... def FND(d): ... -Epoch: Incomplete +Epoch: NormalDate ND = NormalDate -BDEpoch: Incomplete +BDEpoch: ND BDEpochScalar: int class BusinessDate(NormalDate): - def add(self, days) -> None: ... - def __add__(self, days): ... + def add(self, days: int) -> None: ... + def __add__(self, days: int) -> Self: ... def __sub__(self, v): ... - def asNormalDate(self): ... - def daysBetweenDates(self, normalDate): ... - def normalize(self, i) -> None: ... + def asNormalDate(self) -> ND: ... + def daysBetweenDates(self, normalDate) -> int: ... + def normalize(self, i: ConvertibleToInt) -> None: ... def scalar(self): ... def setNormalDate(self, normalDate) -> None: ... diff --git a/stubs/reportlab/reportlab/lib/pdfencrypt.pyi b/stubs/reportlab/reportlab/lib/pdfencrypt.pyi index d81d451618ec..50e9e4ba13de 100644 --- a/stubs/reportlab/reportlab/lib/pdfencrypt.pyi +++ b/stubs/reportlab/reportlab/lib/pdfencrypt.pyi @@ -7,17 +7,17 @@ from reportlab.platypus.flowables import Flowable __version__: Final[str] -def xorKey(num, key): ... +def xorKey(num: int, key: bytes) -> bytes: ... CLOBBERID: int CLOBBERPERMISSIONS: int -DEBUG: Incomplete +DEBUG: int reserved1: int -reserved2: Incomplete -printable: Incomplete -modifiable: Incomplete -copypastable: Incomplete -annotatable: Incomplete +reserved2: int +printable: int +modifiable: int +copypastable: int +annotatable: int higherbits: int os_urandom = os.urandom @@ -43,8 +43,8 @@ class StandardEncryption: strength=None, ) -> None: ... def setAllPermissions(self, value) -> None: ... - def permissionBits(self): ... - def encode(self, t): ... + def permissionBits(self) -> int: ... + def encode(self, t) -> bytes: ... P: Incomplete key: Incomplete U: Incomplete @@ -55,32 +55,32 @@ class StandardEncryption: def prepare(self, document, overrideID=None) -> None: ... version: Incomplete def register(self, objnum, version) -> None: ... - def info(self): ... + def info(self) -> StandardEncryptionDictionary: ... class StandardEncryptionDictionary(PDFObject): __RefOnly__: int revision: Incomplete def __init__(self, O, OE, U, UE, P, Perms, revision) -> None: ... - def format(self, document): ... + def format(self, document) -> bytes: ... padding: str -def hexText(text): ... -def unHexText(hexText): ... +def hexText(text: str | bytes | bytearray) -> str: ... +def unHexText(hexText) -> bytes: ... -PadString: Incomplete +PadString: bytes def checkRevision(revision): ... -def encryptionkey(password, OwnerKey, Permissions, FileId1, revision=None): ... -def computeO(userPassword, ownerPassword, revision): ... +def encryptionkey(password, OwnerKey, Permissions, FileId1, revision=None) -> bytes: ... +def computeO(userPassword, ownerPassword, revision) -> bytes: ... def computeU( encryptionkey, encodestring=b"(\xbfN^Nu\x8aAd\x00NV\xff\xfa\x01\x08..\x00\xb6\xd0h>\x80/\x0c\xa9\xfedSiz", revision=None, documentId=None, -): ... +) -> bytes: ... def checkU(encryptionkey, U) -> None: ... -def encodePDF(key, objectNumber, generationNumber, string, revision=None): ... +def encodePDF(key, objectNumber, generationNumber, string, revision=None) -> bytes: ... def equalityCheck(observed, expected, label) -> None: ... def test() -> None: ... def encryptCanvas( @@ -117,7 +117,7 @@ def encryptPdfInMemory( canCopy: int = 1, canAnnotate: int = 1, strength: int = 40, -): ... +) -> bytes: ... def encryptPdfOnDisk( inputFileName, outputFileName, @@ -128,6 +128,6 @@ def encryptPdfOnDisk( canCopy: int = 1, canAnnotate: int = 1, strength: int = 40, -): ... +) -> int: ... def scriptInterp() -> None: ... def main() -> None: ... diff --git a/stubs/reportlab/reportlab/lib/pygments2xpre.pyi b/stubs/reportlab/reportlab/lib/pygments2xpre.pyi index f31768798b46..b18d5296345f 100644 --- a/stubs/reportlab/reportlab/lib/pygments2xpre.pyi +++ b/stubs/reportlab/reportlab/lib/pygments2xpre.pyi @@ -1,3 +1,3 @@ -def pygments2xpre(s, language: str = "python"): ... - __all__ = ("pygments2xpre",) + +def pygments2xpre(s, language: str = "python"): ... diff --git a/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi b/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi index 6c2eed8f2074..8ba0650d1fec 100644 --- a/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi +++ b/stubs/reportlab/reportlab/lib/rl_safe_eval.pyi @@ -5,6 +5,7 @@ import time from _typeshed import Incomplete from collections.abc import Generator from typing import NoReturn +from typing_extensions import Self eval_debug: int strTypes: tuple[type[bytes], type[str]] @@ -25,42 +26,42 @@ class UntrustedAstTransformer(ast.NodeTransformer): nameIsAllowed: Incomplete def __init__(self, names_seen=None, nameIsAllowed=None) -> None: ... @property - def tmpName(self): ... + def tmpName(self) -> str: ... def error(self, node, msg) -> NoReturn: ... def guard_iter(self, node): ... def is_starred(self, ob): ... - def gen_unpack_spec(self, tpl): ... - def protect_unpack_sequence(self, target, value): ... - def gen_unpack_wrapper(self, node, target, ctx: str = "store"): ... - def gen_lambda(self, args, body): ... - def gen_del_stmt(self, name_to_del): ... + def gen_unpack_spec(self, tpl) -> ast.Dict: ... + def protect_unpack_sequence(self, target, value) -> ast.Call: ... + def gen_unpack_wrapper(self, node, target, ctx: str = "store") -> tuple[ast.Name, ast.Try]: ... + def gen_lambda(self, args, body) -> ast.Lambda: ... + def gen_del_stmt(self, name_to_del) -> ast.Delete: ... def transform_slice(self, slice_): ... def isAllowedName(self, node, name) -> None: ... def check_function_argument_names(self, node) -> None: ... - def check_import_names(self, node): ... - def gen_attr_check(self, node, attr_name): ... - def visit_Constant(self, node): ... - def visit_Name(self, node): ... - def visit_Call(self, node): ... - def visit_Attribute(self, node): ... - def visit_Subscript(self, node): ... + def check_import_names(self, node) -> ast.AST: ... + def gen_attr_check(self, node, attr_name) -> ast.BoolOp: ... + def visit_Constant(self, node) -> ast.AST: ... + def visit_Name(self, node) -> ast.AST: ... + def visit_Call(self, node) -> ast.AST: ... + def visit_Attribute(self, node) -> ast.AST: ... + def visit_Subscript(self, node) -> ast.AST: ... def visit_Assign(self, node): ... - def visit_AugAssign(self, node): ... + def visit_AugAssign(self, node) -> ast.Assign: ... # Bug in `reportlab`'s source code: def visit_While(node): ... # type: ignore[override] - def visit_ExceptHandler(self, node): ... - def visit_With(self, node): ... - def visit_FunctionDef(self, node): ... - def visit_Lambda(self, node): ... - def visit_ClassDef(self, node): ... - def visit_Import(self, node): ... + def visit_ExceptHandler(self, node) -> ast.AST: ... + def visit_With(self, node) -> ast.AST: ... + def visit_FunctionDef(self, node) -> ast.AST: ... + def visit_Lambda(self, node) -> ast.AST: ... + def visit_ClassDef(self, node) -> ast.stmt: ... + def visit_Import(self, node) -> ast.AST: ... def visit_BinOp(self, node): ... visit_ImportFrom = visit_Import # pyright: ignore[reportAssignmentType] visit_For = guard_iter visit_comprehension = guard_iter def generic_visit(self, node: ast.AST) -> None: ... # type: ignore[override] def not_allowed(self, node: ast.AST) -> NoReturn: ... - def visit_children(self, node): ... + def visit_children(self, node) -> ast.AST: ... def visit(self, node): ... visit_Ellipsis = not_allowed visit_MatMult = not_allowed @@ -154,7 +155,7 @@ class __rl_SafeIter__: __rl_iter__: Incomplete __rl_owner__: Incomplete def __init__(self, it, owner) -> None: ... - def __iter__(self): ... + def __iter__(self) -> Self: ... def __next__(self): ... next = __next__ diff --git a/stubs/reportlab/reportlab/lib/rparsexml.pyi b/stubs/reportlab/reportlab/lib/rparsexml.pyi index 62816ccd098f..5feac4c061e5 100644 --- a/stubs/reportlab/reportlab/lib/rparsexml.pyi +++ b/stubs/reportlab/reportlab/lib/rparsexml.pyi @@ -1,5 +1,6 @@ -from _typeshed import Incomplete -from typing import type_check_only +from _typeshed import FileDescriptorOrPath, Unused +from collections.abc import Iterable +from typing import Final, type_check_only RequirePyRXP: int simpleparse: int @@ -7,23 +8,23 @@ simpleparse: int @type_check_only class _smartDecode: @staticmethod - def __call__(s): ... + def __call__(s: str | bytes | bytearray) -> str: ... smartDecode: _smartDecode -NONAME: str -NAMEKEY: int -CONTENTSKEY: int -CDATAMARKER: str -LENCDATAMARKER: Incomplete -CDATAENDMARKER: str -replacelist: Incomplete +NONAME: Final = "" +NAMEKEY: Final = 0 +CONTENTSKEY: Final = 1 +CDATAMARKER: Final = "" +replacelist: list[tuple[str, str]] -def unEscapeContentList(contentList): ... -def parsexmlSimple(xmltext, oneOutermostTag: int = 0, eoCB=None, entityReplacer=...): ... +def unEscapeContentList(contentList: Iterable[str]) -> list[str]: ... +def parsexmlSimple(xmltext, oneOutermostTag: int = 0, eoCB: Unused = None, entityReplacer=...): ... parsexml = parsexmlSimple -def parseFile(filename): ... +def parseFile(filename: FileDescriptorOrPath): ... verbose: int diff --git a/stubs/reportlab/reportlab/lib/sequencer.pyi b/stubs/reportlab/reportlab/lib/sequencer.pyi index 1973b8138cdc..ce2461bd9848 100644 --- a/stubs/reportlab/reportlab/lib/sequencer.pyi +++ b/stubs/reportlab/reportlab/lib/sequencer.pyi @@ -1,29 +1,38 @@ +from collections.abc import Callable + __all__ = ["Sequencer", "getSequencer", "setSequencer"] +from typing import overload + class _Counter: + _value: int def __init__(self) -> None: ... - def setFormatter(self, formatFunc) -> None: ... - def reset(self, value=None) -> None: ... - def next(self): ... + def setFormatter(self, formatFunc: Callable[[int], str]) -> None: ... + def reset(self, value: int | None = None) -> None: ... + def next(self) -> int: ... __next__ = next - def nextf(self): ... - def thisf(self): ... - def chain(self, otherCounter) -> None: ... + def _this(self) -> int: ... + def nextf(self) -> str: ... + def thisf(self) -> str: ... + def chain(self, otherCounter: _Counter) -> None: ... class Sequencer: def __init__(self) -> None: ... - def __next__(self): ... - def next(self, counter=None): ... - def thisf(self, counter=None): ... - def nextf(self, counter=None): ... + def __next__(self) -> int: ... + def next(self, counter=None) -> int: ... + def thisf(self, counter=None) -> str: ... + def nextf(self, counter=None) -> str: ... def setDefaultCounter(self, default=None) -> None: ... - def registerFormat(self, format, func) -> None: ... - def setFormat(self, counter, format) -> None: ... + def registerFormat(self, format: str, func: Callable[[int], str]) -> None: ... + def setFormat(self, counter, format: str) -> None: ... def reset(self, counter=None, base: int = 0) -> None: ... def chain(self, parent, child) -> None: ... - def __getitem__(self, key): ... - def format(self, template): ... + def __getitem__(self, key: str) -> str: ... + def format(self, template: str) -> str: ... def dump(self) -> None: ... -def getSequencer(): ... -def setSequencer(seq): ... +def getSequencer() -> Sequencer: ... +@overload +def setSequencer(seq: Sequencer) -> Sequencer: ... +@overload +def setSequencer(seq: None) -> None: ... diff --git a/stubs/reportlab/reportlab/lib/textsplit.pyi b/stubs/reportlab/reportlab/lib/textsplit.pyi index beb2241de85b..8ad3489c99a2 100644 --- a/stubs/reportlab/reportlab/lib/textsplit.pyi +++ b/stubs/reportlab/reportlab/lib/textsplit.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete +import re +from _typeshed import Incomplete, ReadableBuffer from collections.abc import Sequence from typing import Final @@ -8,12 +9,12 @@ ALL_CANNOT_START: Final[str] CANNOT_END_LINE: Final[Sequence[str]] ALL_CANNOT_END: Final[str] -def is_multi_byte(ch): ... -def getCharWidths(word, fontName, fontSize): ... -def wordSplit(word, maxWidths, fontName, fontSize, encoding: str = "utf8"): ... -def dumbSplit(word, widths, maxWidths): ... +def is_multi_byte(ch: str | bytes | bytearray) -> bool: ... +def getCharWidths(word: str, fontName: str, fontSize: float) -> list[float]: ... +def wordSplit(word, maxWidths, fontName, fontSize, encoding: str = "utf8") -> list[list[Incomplete]]: ... +def dumbSplit(word, widths, maxWidths) -> list[list[Incomplete]]: ... def kinsokuShoriSplit(word, widths, availWidth) -> None: ... -rx: Incomplete +rx: re.Pattern[str] -def cjkwrap(text, width, encoding: str = "utf8"): ... +def cjkwrap(text: ReadableBuffer, width: float, encoding: str = "utf8"): ... diff --git a/stubs/reportlab/reportlab/lib/validators.pyi b/stubs/reportlab/reportlab/lib/validators.pyi index 689aa1ffb60e..a739cafe87df 100644 --- a/stubs/reportlab/reportlab/lib/validators.pyi +++ b/stubs/reportlab/reportlab/lib/validators.pyi @@ -123,7 +123,7 @@ class DerivedValue: class Inherit(DerivedValue): def getValue(self, renderer, attr): ... -inherit: Incomplete +inherit: Inherit class NumericAlign(str): def __new__(cls, dp: str = ".", dpLen: int = 0): ... diff --git a/stubs/reportlab/reportlab/lib/yaml.pyi b/stubs/reportlab/reportlab/lib/yaml.pyi index 2c4af45d955c..62cd8164c841 100644 --- a/stubs/reportlab/reportlab/lib/yaml.pyi +++ b/stubs/reportlab/reportlab/lib/yaml.pyi @@ -1,26 +1,27 @@ +from _typeshed import FileDescriptorOrPath from typing import Final __version__: Final[str] -PLAIN: int -PREFORMATTED: int -BULLETCHAR: str +PLAIN: Final = 1 +PREFORMATTED: Final = 2 +BULLETCHAR: Final = "\267" class BaseParser: def __init__(self) -> None: ... def reset(self) -> None: ... - def parseFile(self, filename): ... - def parseText(self, textBlock): ... - def readLine(self, line) -> None: ... + def parseFile(self, filename: FileDescriptorOrPath) -> list[tuple[str, str] | tuple[str, str, str]]: ... + def parseText(self, textBlock: str) -> list[tuple[str, str] | tuple[str, str, str]]: ... + def readLine(self, line: str) -> None: ... def endPara(self) -> None: ... - def beginPre(self, stylename) -> None: ... + def beginPre(self, stylename: str) -> None: ... def endPre(self) -> None: ... - def image(self, filename) -> None: ... + def image(self, filename: str) -> None: ... class Parser(BaseParser): def vSpace(self, points) -> None: ... def pageBreak(self) -> None: ... - def custom(self, moduleName, funcName) -> None: ... - def nextPageTemplate(self, templateName) -> None: ... + def custom(self, moduleName: str, funcName: str) -> None: ... + def nextPageTemplate(self, templateName: str) -> None: ... -def parseFile(filename): ... -def parseText(textBlock): ... +def parseFile(filename: FileDescriptorOrPath) -> list[tuple[str, str] | tuple[str, str, str]]: ... +def parseText(textBlock: str) -> list[tuple[str, str] | tuple[str, str, str]]: ...