From 4ba81e82a52d9aa90386d2508fa0c9fae57bb12d Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Mon, 28 Apr 2025 16:27:34 +0400 Subject: [PATCH] Bump reportlab to 4.4.* (#13857) --- stubs/reportlab/@tests/stubtest_allowlist.txt | 1 - stubs/reportlab/METADATA.toml | 2 +- .../reportlab/reportlab/graphics/renderPM.pyi | 18 +++- stubs/reportlab/reportlab/lib/rl_accel.pyi | 16 ++-- stubs/reportlab/reportlab/lib/utils.pyi | 95 +++++++++++-------- .../reportlab/pdfbase/pdfmetrics.pyi | 30 +++--- stubs/reportlab/reportlab/pdfbase/ttfonts.pyi | 56 +++++------ stubs/reportlab/reportlab/pdfgen/canvas.pyi | 5 +- .../reportlab/reportlab/pdfgen/textobject.pyi | 24 ++++- .../reportlab/platypus/flowables.pyi | 28 +++++- stubs/reportlab/reportlab/platypus/tables.pyi | 4 +- stubs/reportlab/reportlab/rl_config.pyi | 18 ++-- stubs/reportlab/reportlab/rl_settings.pyi | 20 ++-- 13 files changed, 195 insertions(+), 122 deletions(-) diff --git a/stubs/reportlab/@tests/stubtest_allowlist.txt b/stubs/reportlab/@tests/stubtest_allowlist.txt index b11ffbf4b..c96ce50c3 100644 --- a/stubs/reportlab/@tests/stubtest_allowlist.txt +++ b/stubs/reportlab/@tests/stubtest_allowlist.txt @@ -20,7 +20,6 @@ reportlab.graphics.shapes.Drawing.wrap reportlab\.platypus\.(doctemplate\.|flowables\.|tableofcontents\.)?[A-Za-z_]+\.split reportlab\.platypus\.(doctemplate\.|flowables\.|tableofcontents\.)?[A-Za-z_]+\.wrap reportlab.platypus.multicol.MultiCol.split -reportlab.platypus.multicol.MultiCol.wrap reportlab.platypus.para.FastPara.split reportlab.platypus.para.FastPara.wrap reportlab.platypus.para.Para.split diff --git a/stubs/reportlab/METADATA.toml b/stubs/reportlab/METADATA.toml index 6159d1b17..d1a58be6e 100644 --- a/stubs/reportlab/METADATA.toml +++ b/stubs/reportlab/METADATA.toml @@ -1,4 +1,4 @@ -version = "4.3.1" +version = "4.4.*" # GitHub mirror of https://hg.reportlab.com/hg-public/reportlab/file upstream_repository = "https://github.com/MrBitBucket/reportlab-mirror" diff --git a/stubs/reportlab/reportlab/graphics/renderPM.pyi b/stubs/reportlab/reportlab/graphics/renderPM.pyi index 41974b755..75d6b2ea2 100644 --- a/stubs/reportlab/reportlab/graphics/renderPM.pyi +++ b/stubs/reportlab/reportlab/graphics/renderPM.pyi @@ -50,9 +50,20 @@ class PMCanvas: def fillstrokepath(self, stroke: int = 1, fill: int = 1) -> None: ... def bezierArcCCW(self, cx, cy, rx, ry, theta0, theta1): ... def addEllipsoidalArc(self, cx, cy, rx, ry, ang1, ang2) -> None: ... - def drawCentredString(self, x, y, text, text_anchor: str = "middle") -> None: ... - def drawRightString(self, text, x, y) -> None: ... - def drawString(self, x, y, text, _fontInfo: Incomplete | None = None, text_anchor: str = "left") -> None: ... + def drawCentredString( + self, x: float, y: float, text: str, text_anchor: str = "middle", direction: str | None = None, shaping: bool = False + ) -> None: ... + def drawRightString(self, text: str, x: float, y: float, direction: str | None = None) -> None: ... + def drawString( + self, + x: float, + y: float, + text: str, + _fontInfo: Incomplete | None = None, + text_anchor: str = "left", + direction: str | None = None, + shaping: bool = False, + ) -> None: ... def line(self, x1, y1, x2, y2) -> None: ... def rect(self, x, y, width, height, stroke: int = 1, fill: int = 1) -> None: ... def roundRect(self, x, y, width, height, rx, ry) -> None: ... @@ -73,7 +84,6 @@ class PMCanvas: strokeWidth: Incomplete def setLineWidth(self, width) -> None: ... def stringWidth(self, text, fontName: Incomplete | None = None, fontSize: Incomplete | None = None): ... - def shapedText(self, text) -> tuple[Incomplete, Incomplete]: ... def drawToPMCanvas( d: Drawing, diff --git a/stubs/reportlab/reportlab/lib/rl_accel.pyi b/stubs/reportlab/reportlab/lib/rl_accel.pyi index b0a933622..48a6d66e9 100644 --- a/stubs/reportlab/reportlab/lib/rl_accel.pyi +++ b/stubs/reportlab/reportlab/lib/rl_accel.pyi @@ -1,14 +1,16 @@ +from typing import Literal + def fp_str(*a): ... def unicode2T1(utext, fonts): ... -def instanceStringWidthT1(self, text, size, encoding: str = "utf8"): ... -def instanceStringWidthTTF(self, text, size, encoding: str = "utf8"): ... -def hex32(i): ... -def add32(x, y): ... -def calcChecksum(data): ... +def instanceStringWidthT1(self, text: str, size: float, encoding: str = "utf8") -> float: ... +def instanceStringWidthTTF(self, text: str, size: float, encoding: str = "utf8") -> float: ... +def hex32(i) -> str: ... +def add32(x: int, y: int) -> int: ... +def calcChecksum(data: str | bytes) -> int: ... def escapePDF(s): ... -def asciiBase85Encode(input): ... +def asciiBase85Encode(input: str) -> str: ... def asciiBase85Decode(input): ... -def sameFrag(f, g): ... +def sameFrag(f, g) -> bool | Literal[0]: ... __all__ = [ "fp_str", diff --git a/stubs/reportlab/reportlab/lib/utils.pyi b/stubs/reportlab/reportlab/lib/utils.pyi index 0eb199be8..08485eb2d 100644 --- a/stubs/reportlab/reportlab/lib/utils.pyi +++ b/stubs/reportlab/reportlab/lib/utils.pyi @@ -1,7 +1,10 @@ import datetime +import zipimport from _typeshed import Incomplete, SupportsItems -from collections.abc import Generator -from typing import Final, Literal, TypeVar +from collections.abc import Generator, Iterable +from os import PathLike +from types import TracebackType +from typing import AnyStr, Final, Literal, TypeVar, overload from reportlab.lib.rltempfile import get_rl_tempdir as get_rl_tempdir, get_rl_tempfile as get_rl_tempfile @@ -24,37 +27,37 @@ __UNSET__: Final[_UNSET_] isPyPy: bool -def isFunction(v): ... -def isMethod(v, mt=...): ... -def isModule(v): ... -def isSeq(v, _st=...): ... -def isNative(v): ... +def isFunction(v: object) -> bool: ... +def isMethod(v: object, mt=...) -> bool: ... +def isModule(v: object) -> bool: ... +def isSeq(v: object, _st=...) -> bool: ... +def isNative(v: object) -> bool: ... -strTypes: Incomplete +strTypes: tuple[type[str], type[bytes]] -def asBytes(v, enc: str = "utf8"): ... -def asUnicode(v, enc: str = "utf8"): ... -def asUnicodeEx(v, enc: str = "utf8"): ... -def asNative(v, enc: str = "utf8"): ... -def int2Byte(i): ... -def isStr(v): ... -def isBytes(v): ... -def isUnicode(v): ... -def isClass(v): ... -def isNonPrimitiveInstance(x): ... -def instantiated(v): ... -def bytestr(x, enc: str = "utf8"): ... -def encode_label(args): ... -def decode_label(label): ... -def rawUnicode(s): ... -def rawBytes(s): ... +def asBytes(v: str | bytes, enc: str = "utf8") -> bytes: ... +def asUnicode(v: str | bytes, enc: str = "utf8") -> str: ... +def asUnicodeEx(v: str | bytes, enc: str = "utf8") -> str: ... +def asNative(v: str | bytes, enc: str = "utf8") -> str: ... +def int2Byte(i: int) -> bytes: ... +def isStr(v: object) -> bool: ... +def isBytes(v: object) -> bool: ... +def isUnicode(v: object) -> bool: ... +def isClass(v: object) -> bool: ... +def isNonPrimitiveInstance(x: object) -> bool: ... +def instantiated(v: object) -> bool: ... +def bytestr(x: object, enc: str = "utf8") -> bytes: ... +def encode_label(args) -> str: ... +def decode_label(label: str): ... +def rawUnicode(s: str | bytes) -> str: ... +def rawBytes(s: str | bytes) -> bytes: ... -rl_exec: Incomplete +rl_exec = exec -def char2int(s): ... -def rl_reraise(t, v, b: Incomplete | None = None) -> None: ... +def char2int(s: int | str | bytes) -> int: ... +def rl_reraise(t, v: BaseException, b: TracebackType | None = None) -> None: ... def rl_add_builtins(**kwd) -> None: ... -def zipImported(ldr: Incomplete | None = None): ... +def zipImported(ldr: zipimport.zipimporter | None = None) -> zipimport.zipimporter | None: ... class CIDict(dict[_KT, _VT]): def __init__(self, *args, **kwds) -> None: ... @@ -64,14 +67,14 @@ def markfilename(filename, creatorcode: Incomplete | None = None, filetype: Inco __rl_loader__: Incomplete -def rl_glob(pattern, glob=...): ... -def isFileSystemDistro(): ... -def isCompactDistro(): ... -def isSourceDistro(): ... -def normalize_path(p): ... +def rl_glob(pattern: AnyStr, glob=...) -> list[AnyStr]: ... +def isFileSystemDistro() -> bool: ... +def isCompactDistro() -> bool: ... +def isSourceDistro() -> bool: ... +def normalize_path(p: PathLike[AnyStr]) -> PathLike[AnyStr]: ... def recursiveImport(modulename, baseDir: Incomplete | None = None, noCWD: int = 0, debug: int = 0): ... -haveImages: Incomplete +haveImages: Final[bool] class ArgvDictValue: value: Incomplete @@ -147,15 +150,18 @@ class _FmtSelfDict: class FmtSelfDict: ... -def simpleSplit(text, fontName, fontSize, maxWidth): ... -def escapeTextOnce(text): ... +def simpleSplit(text: str | bytes, fontName: str | None, fontSize: float, maxWidth: float | None): ... +@overload +def escapeTextOnce(text: None) -> None: ... +@overload +def escapeTextOnce(text: str | bytes) -> str: ... def fileName2FSEnc(fn): ... def prev_this_next(items): ... -def commasplit(s): ... -def commajoin(l): ... +def commasplit(s: str | bytes) -> list[str]: ... +def commajoin(l: Iterable[str | bytes]) -> str: ... def findInPaths(fn, paths, isfile: bool = True, fail: bool = False): ... -def annotateException(msg, enc: str = "utf8", postMsg: str = "", sep: str = " ") -> None: ... -def escapeOnce(data): ... +def annotateException(msg: str, enc: str = "utf8", postMsg: str = "", sep: str = " ") -> None: ... +def escapeOnce(data: str) -> str: ... class IdentStr(str): def __new__(cls, value): ... @@ -188,3 +194,12 @@ def recursiveGetAttr(obj, name, g: Incomplete | None = None): ... def recursiveSetAttr(obj, name, value) -> None: ... def recursiveDelAttr(obj, name) -> None: ... def yieldNoneSplits(L) -> Generator[Incomplete, None, None]: ... + +class KlassStore: + lim: int + store: dict[str, type] + def __init__(self, lim: int = 127) -> None: ... + def add(self, k: str, v: type) -> None: ... + def __contains__(self, k) -> bool: ... + def __getitem__(self, k: str) -> type: ... + def get(self, k, default=None): ... diff --git a/stubs/reportlab/reportlab/pdfbase/pdfmetrics.pyi b/stubs/reportlab/reportlab/pdfbase/pdfmetrics.pyi index dfe023a09..3eac7bcd4 100644 --- a/stubs/reportlab/reportlab/pdfbase/pdfmetrics.pyi +++ b/stubs/reportlab/reportlab/pdfbase/pdfmetrics.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, StrOrBytesPath from typing import Final from reportlab.lib.rl_accel import unicode2T1 as unicode2T1 @@ -10,7 +10,7 @@ standardEncodings: Incomplete class FontError(Exception): ... class FontNotFoundError(Exception): ... -def parseAFMFile(afmFileName): ... +def parseAFMFile(afmFileName: StrOrBytesPath) -> tuple[dict[Incomplete, Incomplete], list[Incomplete]]: ... class TypeFace: name: Incomplete @@ -51,15 +51,15 @@ class Font: encoding: Incomplete encName: Incomplete substitutionFonts: Incomplete - isShaped: bool + shapable: bool def __init__(self, name, faceName, encName, substitutionFonts: Incomplete | None = None) -> None: ... - def stringWidth(self, text, size, encoding: str = "utf8"): ... + def stringWidth(self, text: str | bytes, size: float, encoding: str = "utf8") -> float: ... def addObjects(self, doc) -> None: ... -PFB_MARKER: Incomplete -PFB_ASCII: Incomplete -PFB_BINARY: Incomplete -PFB_EOF: Incomplete +PFB_MARKER: Final[str] +PFB_ASCII: Final[str] +PFB_BINARY: Final[str] +PFB_EOF: Final[str] class EmbeddedType1Face(TypeFace): afmFileName: Incomplete @@ -81,13 +81,13 @@ def registerFontFamily( def registerFont(font) -> None: ... def getTypeFace(faceName): ... def getEncoding(encName): ... -def findFontAndRegister(fontName): ... -def getFont(fontName): ... -def getAscentDescent(fontName, fontSize: Incomplete | None = None): ... -def getAscent(fontName, fontSize: Incomplete | None = None): ... -def getDescent(fontName, fontSize: Incomplete | None = None): ... -def getRegisteredFontNames(): ... -def stringWidth(text, fontName, fontSize, encoding: str = "utf8"): ... +def findFontAndRegister(fontName: str) -> Font: ... +def getFont(fontName: str) -> Font: ... +def getAscentDescent(fontName: str, fontSize: float | None = None): ... +def getAscent(fontName: str, fontSize: float | None = None): ... +def getDescent(fontName: str, fontSize: float | None = None): ... +def getRegisteredFontNames() -> list[Incomplete]: ... +def stringWidth(text: str | bytes, fontName: str, fontSize: float, encoding: str = "utf8") -> float: ... def dumpFontData() -> None: ... def test3widths(texts) -> None: ... def testStringWidthAlgorithms() -> None: ... diff --git a/stubs/reportlab/reportlab/pdfbase/ttfonts.pyi b/stubs/reportlab/reportlab/pdfbase/ttfonts.pyi index 231744908..7a77835e4 100644 --- a/stubs/reportlab/reportlab/pdfbase/ttfonts.pyi +++ b/stubs/reportlab/reportlab/pdfbase/ttfonts.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, ReadableBuffer, StrOrBytesPath from typing import Final, NamedTuple from typing_extensions import Self +from weakref import WeakKeyDictionary from reportlab.pdfbase import pdfdoc, pdfmetrics @@ -8,25 +9,25 @@ __version__: Final[str] class TTFError(pdfdoc.PDFError): ... -def SUBSETN(n, table=...): ... -def makeToUnicodeCMap(fontname, subset): ... +def SUBSETN(n, table: ReadableBuffer | None = ...) -> bytes: ... +def makeToUnicodeCMap(fontname: str, subset) -> str: ... def splice(stream, offset, value): ... -GF_ARG_1_AND_2_ARE_WORDS: Incomplete -GF_ARGS_ARE_XY_VALUES: Incomplete -GF_ROUND_XY_TO_GRID: Incomplete -GF_WE_HAVE_A_SCALE: Incomplete -GF_RESERVED: Incomplete -GF_MORE_COMPONENTS: Incomplete -GF_WE_HAVE_AN_X_AND_Y_SCALE: Incomplete -GF_WE_HAVE_A_TWO_BY_TWO: Incomplete -GF_WE_HAVE_INSTRUCTIONS: Incomplete -GF_USE_MY_METRICS: Incomplete -GF_OVERLAP_COMPOUND: Incomplete -GF_SCALED_COMPONENT_OFFSET: Incomplete -GF_UNSCALED_COMPONENT_OFFSET: Incomplete +GF_ARG_1_AND_2_ARE_WORDS: Final = 1 +GF_ARGS_ARE_XY_VALUES: Final = 2 +GF_ROUND_XY_TO_GRID: Final = 4 +GF_WE_HAVE_A_SCALE: Final = 8 +GF_RESERVED: Final = 16 +GF_MORE_COMPONENTS: Final = 32 +GF_WE_HAVE_AN_X_AND_Y_SCALE: Final = 64 +GF_WE_HAVE_A_TWO_BY_TWO: Final = 128 +GF_WE_HAVE_INSTRUCTIONS: Final = 256 +GF_USE_MY_METRICS: Final = 512 +GF_OVERLAP_COMPOUND: Final = 1024 +GF_SCALED_COMPONENT_OFFSET: Final = 2048 +GF_UNSCALED_COMPONENT_OFFSET: Final = 4096 -def TTFOpenFile(fn): ... +def TTFOpenFile(fn: StrOrBytesPath) -> tuple[StrOrBytesPath,]: ... class TTFontParser: ttfVersions: Incomplete @@ -138,18 +139,18 @@ class TTFont: subsets: Incomplete def __init__(self, asciiReadable: Incomplete | None = None, ttf: Incomplete | None = None) -> None: ... - fontName: Incomplete - face: Incomplete - encoding: Incomplete - state: Incomplete + fontName: str + face: TTFontFace + encoding: TTEncoding + state: WeakKeyDictionary[Incomplete, State] def __init__( self, - name, + name: str, filename, validate: int = 0, subfontIndex: int = 0, - asciiReadable: Incomplete | None = None, - shaped: Incomplete | None = None, + asciiReadable: int | None = None, + shapable: bool = True, ) -> None: ... def stringWidth(self, text, size, encoding: str = "utf8"): ... def splitString(self, text, doc, encoding: str = "utf-8"): ... @@ -159,9 +160,9 @@ class TTFont: def hbFace(self) -> Incomplete | None: ... def hbFont(self, fontSize: float = 10): ... @property - def isShaped(self) -> bool: ... - @isShaped.setter - def isShaped(self, v) -> None: ... + def shapable(self) -> bool: ... + @shapable.setter + def shapable(self, v) -> None: ... def pdfScale(self, v): ... def unregister(self) -> None: ... @@ -179,6 +180,7 @@ class ShapedStr(str): def __new__(cls, s, shapeData: ShapeData | None = None) -> Self: ... def __radd__(self, other) -> Self: ... +def shapeStr(s: str, fontName: str, fontSize: float): ... def freshTTFont(ttfn, ttfpath, **kwds) -> TTFont: ... def makeShapedFragWord(w, K: list[Incomplete] = [], V: list[Incomplete] = []) -> type[ShapedFragWord]: ... def shapeFragWord(w, features: Incomplete | None = None): ... diff --git a/stubs/reportlab/reportlab/pdfgen/canvas.pyi b/stubs/reportlab/reportlab/pdfgen/canvas.pyi index 96351502e..7240c2159 100644 --- a/stubs/reportlab/reportlab/pdfgen/canvas.pyi +++ b/stubs/reportlab/reportlab/pdfgen/canvas.pyi @@ -239,6 +239,7 @@ class Canvas(_PDFColorSetter): charSpace: float = 0, direction: Literal["LTR", "RTL"] | None = None, wordSpace: float | None = None, + shaping: bool = False, ) -> None: ... def drawRightString( self, @@ -249,6 +250,7 @@ class Canvas(_PDFColorSetter): charSpace: float = 0, direction: Literal["LTR", "RTL"] | None = None, wordSpace: float | None = None, + shaping: bool = False, ) -> None: ... def drawCentredString( self, @@ -259,6 +261,7 @@ class Canvas(_PDFColorSetter): charSpace: float = 0, direction: Literal["LTR", "RTL"] | None = None, wordSpace: float | None = None, + shaping: bool = False, ) -> None: ... def drawAlignedString( self, @@ -270,6 +273,7 @@ class Canvas(_PDFColorSetter): charSpace: float = 0, direction: Literal["LTR", "RTL"] | None = None, wordSpace: float | None = None, + shaping: bool = False, ) -> None: ... def getAvailableFonts(self): ... def listLoadedFonts0(self): ... @@ -304,6 +308,5 @@ class Canvas(_PDFColorSetter): @property def acroForm(self): ... def drawBoundary(self, sb, x1: float, y1: float, width: float, height: float) -> None: ... - def shapedText(self, text) -> tuple[Incomplete, Incomplete]: ... __all__ = ["Canvas", "ShowBoundaryValue"] diff --git a/stubs/reportlab/reportlab/pdfgen/textobject.pyi b/stubs/reportlab/reportlab/pdfgen/textobject.pyi index 457832b6b..e0162746b 100644 --- a/stubs/reportlab/reportlab/pdfgen/textobject.pyi +++ b/stubs/reportlab/reportlab/pdfgen/textobject.pyi @@ -1,16 +1,36 @@ +from _typeshed import Incomplete, Unused +from collections.abc import Callable from typing import Final, Literal from typing_extensions import TypeAlias from reportlab.lib.colors import Color +from reportlab.pdfbase.ttfonts import ShapedStr from reportlab.pdfgen.canvas import Canvas # NOTE: This is slightly different from what toColor accepts and interprets _Color: TypeAlias = Color | tuple[float, float, float, float] | tuple[float, float, float] | list[float] | str __version__: Final[str] -log2vis: None +log2vis: Callable[..., str | None] +BidiStr: type[str] +BidiList: type[list[Incomplete]] +BidiIndex: Incomplete -def fribidiText(text: str, direction: str) -> str: ... +def bidiText(text: str, direction: str | None) -> str: ... +def bidiShapedText( + text: str, direction: str = "RTL", clean: bool = True, fontName: str = "Helvetica", fontSize: int = 10, shaping: bool = False +) -> tuple[ShapedStr | str, float]: ... +def isBidiStr(_: Unused) -> bool: ... +def isBidiList(_: Unused) -> bool: ... +def innerBidiStrWrap(s: str, bidiV: int = -1, bidiL: int = -1) -> str: ... +def bidiStrWrap(s: str, orig: str) -> str: ... +def bidiListWrap(L, orig) -> list[Incomplete]: ... +def bidiFragWord(w: str, direction: str | None = None, bidiV: int = -1, bidiL: int = -1, clean: bool = True): ... +def bidiWordList( + words: list[str] | tuple[str], direction: str = "RTL", clean: bool = True, wx: bool = False +) -> list[Incomplete]: ... + +rtlSupport: bool class _PDFColorSetter: def setFillColorCMYK(self, c: float, m: float, y: float, k: float, alpha: float | None = None) -> None: ... diff --git a/stubs/reportlab/reportlab/platypus/flowables.pyi b/stubs/reportlab/reportlab/platypus/flowables.pyi index ee384d99c..328a145ca 100644 --- a/stubs/reportlab/reportlab/platypus/flowables.pyi +++ b/stubs/reportlab/reportlab/platypus/flowables.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete, SupportsRead +from _typeshed import Incomplete, SupportsRead, Unused from collections.abc import Callable, Iterable, Sequence from typing import Any, Literal, NoReturn, Protocol from typing_extensions import Self, TypeAlias @@ -52,6 +52,7 @@ __all__ = [ "XBox", "splitLine", "splitLines", + "PlacedStory", ] _HAlignment: TypeAlias = Literal["LEFT", "CENTER", "CENTRE", "RIGHT", 0, 1, 2] @@ -98,7 +99,7 @@ class Flowable: # make everyone happy here, sigh... def drawOn(self, canvas: Canvas, x: float, y: float) -> None: ... def wrapOn(self, canv: Canvas, aW: float, aH: float) -> tuple[float, float]: ... - def wrap(self, aW: float, aH: float, /) -> tuple[float, float]: ... + def wrap(self, aW: float, aH: float) -> tuple[float, float]: ... def minWidth(self) -> float: ... def splitOn(self, canv: Canvas, aW: float, aH: float) -> list[Flowable]: ... def split(self, aW: float, aH: float, /) -> list[Flowable]: ... @@ -217,7 +218,7 @@ class ParagraphAndImage(Flowable): def draw(self) -> None: ... class FailOnWrap(NullDraw): - def wrap(self, aW: float, aH: float, /) -> NoReturn: ... + def wrap(self, aW: float, aH: float) -> NoReturn: ... class FailOnDraw(Flowable): def draw(self) -> NoReturn: ... @@ -271,6 +272,27 @@ class KeepInFrame(_Container, Flowable): fakeWidth: bool | None = None, ) -> None: ... +class PlacedStory(Flowable): + def __init__( + self, + x, + y, + maxWidth: float, + maxHeight: float, + content: list[Flowable] = [], + mergeSpace: Incomplete | None = 1, + mode: Literal["error", "continue", "shrink", "truncate"] = "shrink", + name: str = "", + anchor: str = "sw", + fakeWidth: bool | None = None, + hAlign: str = "LEFT", + vAlign: str = "BOTTOM", + showBoundary=None, + origin="page", + ) -> None: ... + def wrap(self, _aW: Unused, _aH: Unused) -> tuple[Literal[0], Literal[0]]: ... + def drawOn(self, canv: Canvas, lx: float, ly: float, _sW=0) -> None: ... + class _FindSplitterMixin: ... class ImageAndFlowables(_Container, _FindSplitterMixin, Flowable): diff --git a/stubs/reportlab/reportlab/platypus/tables.pyi b/stubs/reportlab/reportlab/platypus/tables.pyi index 88893f074..3bcaa2f87 100644 --- a/stubs/reportlab/reportlab/platypus/tables.pyi +++ b/stubs/reportlab/reportlab/platypus/tables.pyi @@ -40,7 +40,9 @@ class CellStyle(PropertySet): background: _Color valign: Literal["TOP", "MIDDLE", "BOTTOM"] href: str | None - destination: Incomplete + direction: str | None + shaping: Incomplete | None + destination: Incomplete | None def __init__(self, name: str, parent: CellStyle | None = None) -> None: ... def copy(self, result: CellStyle | None = None) -> CellStyle: ... diff --git a/stubs/reportlab/reportlab/rl_config.pyi b/stubs/reportlab/reportlab/rl_config.pyi index 965f6d0d9..7d530a71f 100644 --- a/stubs/reportlab/reportlab/rl_config.pyi +++ b/stubs/reportlab/reportlab/rl_config.pyi @@ -1,5 +1,6 @@ from _typeshed import Incomplete from collections.abc import Callable +from typing import Literal def register_reset(func: Callable[[], Callable[[], object] | None]) -> None: ... def _reset() -> None: ... @@ -26,7 +27,7 @@ longTableOptimize: int autoConvertEncoding: int _FUZZ: float wrapA85: int -fsEncodings: Incomplete +fsEncodings: tuple[Literal["utf8"], Literal["cp1252"], Literal["cp430"]] odbc_driver: str platypus_link_underline: int canvas_basefontname: str @@ -39,7 +40,6 @@ ttfAsciiReadable: int pdfMultiLine: int pdfComments: int debug: int -rtlSupport: int listWrapOnFakeWidth: int underlineWidth: str underlineOffset: str @@ -50,7 +50,7 @@ strikeGap: str decimalSymbol: str errorOnDuplicatePageLabelPage: int autoGenerateMissingTTFName: int -allowTTFSubsetting: Incomplete +allowTTFSubsetting: list[str] spaceShrinkage: float hyphenationLang: str uriWasteReduce: int @@ -59,14 +59,14 @@ hyphenationMinWordLength: int reserveTTFNotdef: int documentLang: Incomplete encryptionStrength: int -trustedHosts: Incomplete -trustedSchemes: Incomplete +trustedHosts: list[str] | None +trustedSchemes: list[str] renderPMBackend: str xmlParser: str textPaths: str toColorCanUse: str defCWRF: float -T1SearchPath: Incomplete -TTFSearchPath: Incomplete -CMapSearchPath: Incomplete -shapedFontGlob: list[Incomplete] +unShapedFontGlob: list[str] | None +T1SearchPath: list[str] +TTFSearchPath: list[str] +CMapSearchPath: list[str] diff --git a/stubs/reportlab/reportlab/rl_settings.pyi b/stubs/reportlab/reportlab/rl_settings.pyi index 2c2201691..8e36a529b 100644 --- a/stubs/reportlab/reportlab/rl_settings.pyi +++ b/stubs/reportlab/reportlab/rl_settings.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete -from typing import Final +from typing import Final, Literal __version__: Final[str] @@ -27,7 +27,7 @@ longTableOptimize: Final[int] autoConvertEncoding: Final[int] _FUZZ: Final[float] wrapA85: Final[int] -fsEncodings: Final[Incomplete] +fsEncodings: Final[tuple[Literal["utf8"], Literal["cp1252"], Literal["cp430"]]] odbc_driver: Final[str] platypus_link_underline: Final[int] canvas_basefontname: Final[str] @@ -40,7 +40,6 @@ ttfAsciiReadable: Final[int] pdfMultiLine: Final[int] pdfComments: Final[int] debug: Final[int] -rtlSupport: Final[int] listWrapOnFakeWidth: Final[int] underlineWidth: Final[str] underlineOffset: Final[str] @@ -51,7 +50,7 @@ strikeGap: Final[str] decimalSymbol: Final[str] errorOnDuplicatePageLabelPage: Final[int] autoGenerateMissingTTFName: Final[int] -allowTTFSubsetting: Final[Incomplete] +allowTTFSubsetting: Final[list[str]] spaceShrinkage: Final[float] hyphenationLang: Final[str] uriWasteReduce: Final[int] @@ -61,16 +60,16 @@ reserveTTFNotdef: Final[int] documentLang: Final[Incomplete] encryptionStrength: Final[int] trustedHosts: Final[Incomplete] -trustedSchemes: Final[Incomplete] +trustedSchemes: Final[list[str]] renderPMBackend: Final[str] xmlParser: Final[str] textPaths: Final[str] toColorCanUse: Final[str] defCWRF: Final[float] -T1SearchPath: Final[Incomplete] -TTFSearchPath: Final[Incomplete] -CMapSearchPath: Final[Incomplete] -shapedFontGlob: Final[Incomplete | None] +unShapedFontGlob: list[str] | None +T1SearchPath: Final[tuple[str, ...]] +TTFSearchPath: Final[tuple[str, ...]] +CMapSearchPath: Final[tuple[str, ...]] __all__ = ( "allowTableBoundsErrors", @@ -108,7 +107,6 @@ __all__ = ( "pdfMultiLine", "pdfComments", "debug", - "rtlSupport", "listWrapOnFakeWidth", "T1SearchPath", "TTFSearchPath", @@ -138,5 +136,5 @@ __all__ = ( "textPaths", "toColorCanUse", "defCWRF", - "shapedFontGlob", + "unShapedFontGlob", )