Skip to content

Commit a68c56f

Browse files
authored
[reportlab] Update to 5.1.0 (#16311)
1 parent 376b537 commit a68c56f

13 files changed

Lines changed: 83 additions & 24 deletions

File tree

‎stubs/reportlab/@tests/stubtest_allowlist.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.EVEN_ODD
7676
reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.FILL_EVEN_ODD
7777
reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.FILL_NON_ZERO
7878
reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.NON_ZERO_WINDING
79-
reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.STATE_DEFAULTS
8079
reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.decimalSymbol
8180
reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.pi
8281
reportlab\.graphics\.render(base|PDF|PM|PS|SVG)\.shapeChecking

‎stubs/reportlab/METADATA.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "5.0.0"
1+
version = "5.1.0"
22
# GitHub mirror of https://hg.reportlab.com/hg-public/reportlab/file
33
upstream-repository = "https://github.com/MrBitBucket/reportlab-mirror"
44

‎stubs/reportlab/reportlab/graphics/charts/legends.pyi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class TotalAnnotator(LegendColEndCallout):
7171
self,
7272
lText: str = "Total",
7373
rText: str = "0.0",
74-
fontName="Times-Roman",
74+
fontName: str | None = None,
7575
fontSize: int = 10,
7676
fillColor=...,
7777
strokeWidth: float = 0.5,

‎stubs/reportlab/reportlab/graphics/shapes.pyi‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ __version__: Final[str]
105105
isOpacity: NoneOr
106106
NON_ZERO_WINDING: Final[str]
107107
EVEN_ODD: Final[str]
108-
STATE_DEFAULTS: Final[Incomplete]
108+
109+
class RL_STATE_DEFAULTS(dict[str, Any]):
110+
def get(self, x: str, default: Any = None) -> Any: ... # type: ignore[override]
111+
def copy(self) -> dict[str, Any]: ...
112+
113+
STATE_DEFAULTS: Final[RL_STATE_DEFAULTS]
109114

110115
class _DrawTimeResizeable: ...
111116

‎stubs/reportlab/reportlab/graphics/utils.pyi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def text2Path(
66
text,
77
x: int = 0,
88
y: int = 0,
9-
fontName="Times-Roman",
9+
fontName: str | None = None,
1010
fontSize: int = 1000,
1111
anchor: str = "start",
1212
truncate: int = 1,

‎stubs/reportlab/reportlab/lib/extformat.pyi‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎stubs/reportlab/reportlab/lib/rl_safe_eval.pyi‎

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,25 @@ import ast
22
import math
33
import re
44
import time
5+
import types
56
from _typeshed import Incomplete
6-
from collections.abc import Generator
7+
from collections.abc import Generator, Iterable
8+
from typing import Any, type_check_only
79
from typing_extensions import Never, Self
810

911
eval_debug: int
1012
strTypes: tuple[type[bytes], type[str]]
1113
isPy39: bool
1214
isPy313: bool
1315

16+
class FilteredModule:
17+
def __init__(
18+
self, m: types.ModuleType, mnames: str | tuple[str, ...] = (), mpattern: re.Pattern[str] | None = None
19+
) -> None: ...
20+
# Forwarded to the module passed to __init__; disallowed submodules raise AttributeError
21+
def __getattr__(self, a: str) -> Any: ...
22+
def __eq__(self, other: object) -> bool: ...
23+
1424
class BadCode(ValueError): ...
1525

1626
augOps: dict[ast.operator, str]
@@ -164,6 +174,7 @@ def safer_globals(g=None): ...
164174

165175
math_log10 = math.log10
166176
__rl_undef__: Incomplete
177+
GenericAlias = types.GenericAlias
167178

168179
class __RL_SAFE_ENV__:
169180
__time_time__ = time.time
@@ -176,6 +187,7 @@ class __RL_SAFE_ENV__:
176187
real_bi: Incomplete
177188
bi_replace: Incomplete
178189
__rl_builtins__: Incomplete
190+
__rl_mpattern__: re.Pattern[str] | None
179191
def __init__(self, timeout=None, allowed_magic_methods=None, allowed_magic_names=None) -> None: ...
180192
def __rl_type__(self, *args): ...
181193
def __rl_check__(self) -> None: ...
@@ -198,9 +210,12 @@ class __RL_SAFE_ENV__:
198210
def __rl_frozenset__(self, it=()): ...
199211
def __rl_iter_unpack_sequence__(self, it, spec, _getiter_) -> Generator[Incomplete]: ...
200212
def __rl_unpack_sequence__(self, it, spec, _getiter_): ...
213+
def __rl_allowed_obj__(self, obj) -> None: ...
201214
def __rl_is_allowed_name__(self, name, crash: bool = True) -> bool: ...
202215
def __rl_getattr__(self, obj, a, *args): ...
203216
def __rl_getitem__(self, obj, a): ...
217+
def __inner_rl_getitem__(self, obj, a): ...
218+
def __rl_setattr__(self, obj, a, v, *args): ...
204219
__rl_tmax__: int
205220
__rl_max_len__: int
206221
__rl_max_pow_digits__: int
@@ -216,14 +231,34 @@ class __RL_SAFE_ENV__:
216231
): ...
217232
__rl_limit__: Incomplete
218233
def __rl_safe_eval__(
219-
self, expr, g, l, mode, timeout=None, allowed_magic_methods=None, __frame_depth__: int = 3, allowed_magic_names=None
234+
self,
235+
expr,
236+
g,
237+
l,
238+
mode,
239+
timeout=None,
240+
allowed_magic_methods=None,
241+
__frame_depth__: int = 3,
242+
allowed_magic_names=None,
243+
mnames: str | tuple[str, ...] = (),
244+
excluded_names: Iterable[str] | None = None,
220245
): ...
221246

222247
class __rl_safe_eval__:
223248
mode: str
224249
env: Incomplete
225250
def __init__(self) -> None: ...
226-
def __call__(self, expr, g=None, l=None, timeout=None, allowed_magic_methods=None, allowed_magic_names=None): ...
251+
def __call__(
252+
self,
253+
expr,
254+
g=None,
255+
l=None,
256+
timeout=None,
257+
allowed_magic_methods=None,
258+
allowed_magic_names=None,
259+
mnames: str | tuple[str, ...] = (),
260+
excluded_names: Iterable[str] | None = None,
261+
): ...
227262

228263
class __rl_safe_exec__(__rl_safe_eval__):
229264
mode: str
@@ -235,3 +270,14 @@ rl_safe_eval: __rl_safe_eval__
235270

236271
def __fix_set__(value, default=...): ...
237272
def rl_less_safe_eval(expr, NS): ...
273+
274+
@type_check_only
275+
class _DefaultNamespace:
276+
class ModuleChangeDetector(types.ModuleType):
277+
def __setattr__(self, a: str, v: object) -> None: ...
278+
def __delattr__(self, a: str) -> None: ...
279+
280+
def __call__(self, warn: bool = False) -> dict[str, Any]: ...
281+
def check(self, strict: bool = False) -> None: ...
282+
283+
DefaultNamespace: _DefaultNamespace
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
def get_rl_tempdir(*subdirs: str) -> str: ...
22
def get_rl_tempfile(fn: str | None = None) -> str: ...
33

4-
# The duplicate entry matches the runtime __all__.
5-
__all__ = ("get_rl_tempdir", "get_rl_tempdir") # ruff: ignore[duplicate-entry-in-dunder-all]
4+
__all__ = ("get_rl_tempdir", "get_rl_tempfile")

‎stubs/reportlab/reportlab/lib/utils.pyi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class ArgvDictValue:
8989
def getArgvDict(**kw): ...
9090
def getHyphenater(hDict=None): ...
9191
def open_for_read_by_name(name, mode: str = "b"): ...
92-
def rlUrlRead(name: str, headers: MutableMapping[str, str] | None = None) -> _UrlopenRet: ...
92+
def rlUrlRead(url: str, headers: MutableMapping[str, str] | None = None) -> _UrlopenRet: ...
9393
def open_for_read(name, mode: str = "b"): ...
9494
def open_and_read(name, mode: str = "b"): ...
9595
def open_and_readlines(name, mode: str = "t"): ...

‎stubs/reportlab/reportlab/pdfbase/pdfmetrics.pyi‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
from _typeshed import Incomplete, StrOrBytesPath
2-
from typing import Final, Literal
2+
from typing import ClassVar, Final, Literal
33

44
from reportlab.lib.rl_accel import unicode2T1 as unicode2T1
55
from reportlab.pdfbase.pdfdoc import PDFDictionary
66

77
__version__: Final[str]
88
standardFonts: Incomplete
99
standardEncodings: Incomplete
10+
reportlab_fonts_dir: str
11+
font2fnrMap: dict[str, str]
12+
13+
def __standardFontsChange__() -> None: ...
1014

1115
class FontError(Exception): ...
1216
class FontNotFoundError(Exception): ...
@@ -67,14 +71,16 @@ class EmbeddedType1Face(TypeFace):
6771
afmFileName: Incomplete
6872
pfbFileName: Incomplete
6973
requiredEncoding: Incomplete
70-
def __init__(self, afmFileName, pfbFileName) -> None: ...
74+
def __init__(self, afmFileName, pfbFileName, faceName: str | None = None) -> None: ...
7175
def getFontFiles(self) -> list[Incomplete]: ...
7276
def addObjects(self, doc): ...
7377

7478
def registerTypeFace(face) -> None: ...
7579
def registerEncoding(enc) -> None: ...
76-
def registerFontFamily(family, normal=None, bold=None, italic=None, boldItalic=None) -> None: ...
80+
def registerFontFamily(family, normal=None, bold=None, italic=None, boldItalic=None, baseFontFor: str = "") -> None: ...
7781
def registerFont(font) -> None: ...
82+
def faceFromAFM(afm: str, faceName: str | None = None) -> EmbeddedType1Face: ...
83+
def faceFromRLFD(fnr: str, faceName: str) -> EmbeddedType1Face: ...
7884
def getTypeFace(faceName) -> TypeFace: ...
7985
def getEncoding(encName) -> Encoding: ...
8086
def findFontAndRegister(fontName: str) -> Font: ...
@@ -86,5 +92,14 @@ def getRegisteredFontNames() -> list[Incomplete]: ...
8692
def stringWidth(text: str | bytes, fontName: str, fontSize: float, encoding: str = "utf8") -> float: ...
8793
def dumpFontData() -> None: ...
8894
def test3widths(texts) -> None: ...
95+
96+
class BaseFontName:
97+
__k2t__: ClassVar[tuple[tuple[tuple[str, ...], tuple[int, int]], ...]]
98+
def __init__(self, bfna: str) -> None: ...
99+
def __call__(self, kind: str = "normal", default: str | None = None) -> str: ...
100+
101+
baseGFont: BaseFontName
102+
baseCFont: BaseFontName
103+
89104
def testStringWidthAlgorithms() -> None: ...
90105
def test() -> None: ...

0 commit comments

Comments
 (0)