diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 1dbcf8f3475a..56343ebc54f1 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -38,7 +38,6 @@ "stubs/docker", "stubs/docutils", "stubs/Flask-SocketIO", - "stubs/fpdf2", "stubs/gdb", "stubs/geojson", "stubs/geopandas", diff --git a/stubs/fpdf2/@tests/stubtest_allowlist.txt b/stubs/fpdf2/@tests/stubtest_allowlist.txt deleted file mode 100644 index 549327b0abaa..000000000000 --- a/stubs/fpdf2/@tests/stubtest_allowlist.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Argument has default at runtime, but using it raises a TypeError. -fpdf.fpdf.FPDF.set_creation_date - -# fonttools shims since we can't import it -fpdf._fonttools_shims - -# Only present if harfbuzz is installed -fpdf.fonts.HarfBuzzFont - -# Stubtest wants us to use Literals, but that is unreasonable. -fpdf.unicode_script.UNICODE_RANGE_TO_SCRIPT - -# Ignore stubtest weirdness "fpdf.fonts.Glyph._DT is not present at runtime" -# https://github.com/python/mypy/issues/18811 -fpdf.fonts.Glyph._DT diff --git a/stubs/fpdf2/METADATA.toml b/stubs/fpdf2/METADATA.toml deleted file mode 100644 index bc7b19c18581..000000000000 --- a/stubs/fpdf2/METADATA.toml +++ /dev/null @@ -1,7 +0,0 @@ -version = "2.8.4" -upstream-repository = "https://github.com/py-pdf/fpdf2" -dependencies = ["Pillow>=10.3.0"] -obsolete-since = { version = "2.8.6", date = "2026-02-19" } - -[tool.stubtest] -stubtest-dependencies = ["cryptography"] diff --git a/stubs/fpdf2/fpdf/__init__.pyi b/stubs/fpdf2/fpdf/__init__.pyi deleted file mode 100644 index 6151095247d7..000000000000 --- a/stubs/fpdf2/fpdf/__init__.pyi +++ /dev/null @@ -1,36 +0,0 @@ -from pathlib import Path - -from .enums import Align as Align, TextMode as TextMode, XPos as XPos, YPos as YPos -from .fonts import FontFace as FontFace, TextStyle as TextStyle -from .fpdf import FPDF as FPDF, FPDFException as FPDFException, TitleStyle as TitleStyle -from .html import HTML2FPDF as HTML2FPDF, HTMLMixin as HTMLMixin -from .prefs import ViewerPreferences as ViewerPreferences -from .template import FlexTemplate as FlexTemplate, Template as Template -from .util import get_scale_factor as get_scale_factor - -__license__: str -__version__: str -FPDF_VERSION: str -FPDF_FONT_DIR: Path - -__all__ = [ - "__version__", - "__license__", - "FPDF", - "FPDFException", - "FontFace", - "Align", - "TextMode", - "XPos", - "YPos", - "Template", - "FlexTemplate", - "TitleStyle", - "TextStyle", - "ViewerPreferences", - "HTMLMixin", - "HTML2FPDF", - "FPDF_VERSION", - "FPDF_FONT_DIR", - "get_scale_factor", -] diff --git a/stubs/fpdf2/fpdf/_fonttools_shims.pyi b/stubs/fpdf2/fpdf/_fonttools_shims.pyi deleted file mode 100644 index 761a6ca68b3d..000000000000 --- a/stubs/fpdf2/fpdf/_fonttools_shims.pyi +++ /dev/null @@ -1,55 +0,0 @@ -# from fontTools.misc.loggingTools -from abc import ABCMeta, abstractmethod -from collections.abc import Mapping -from logging import Logger -from typing import Any, Protocol, TypeAlias, type_check_only - -# from fonttools.ttLib.ttGlyphSet -@type_check_only -class _TTGlyph(Protocol): - def __init__(self, glyphSet: _TTGlyphSet, glyphName: str) -> None: ... - def draw(self, pen) -> None: ... - def drawPoints(self, pen) -> None: ... - -_TTGlyphSet: TypeAlias = Mapping[str, _TTGlyph] # Simplified for our needs - -# fonttools.ttLib.TTFont -_TTFont: TypeAlias = Any # noqa: Y047 - -# from fontTools.misc.loggingTools - -class LogMixin: - @property - def log(self) -> Logger: ... - -# from fontTools.pens.basePen -class AbstractPen: - @abstractmethod - def moveTo(self, pt: tuple[float, float]) -> None: ... - @abstractmethod - def lineTo(self, pt: tuple[float, float]) -> None: ... - @abstractmethod - def curveTo(self, *points: tuple[float, float]) -> None: ... - @abstractmethod - def qCurveTo(self, *points: tuple[float, float]) -> None: ... - def closePath(self) -> None: ... - def endPath(self) -> None: ... - @abstractmethod - def addComponent(self, glyphName: str, transformation: tuple[float, float, float, float, float, float]) -> None: ... - -class LoggingPen(LogMixin, AbstractPen, metaclass=ABCMeta): ... - -class DecomposingPen(LoggingPen, metaclass=ABCMeta): - skipMissingComponents: bool - glyphSet: _TTGlyphSet | None - def __init__(self, glyphSet: _TTGlyphSet | None) -> None: ... - def addComponent(self, glyphName: str, transformation: tuple[float, float, float, float, float, float]) -> None: ... - -class BasePen(DecomposingPen): - def __init__(self, glyphSet: _TTGlyphSet | None = ...) -> None: ... - def closePath(self) -> None: ... - def endPath(self) -> None: ... - def moveTo(self, pt: tuple[float, float]) -> None: ... - def lineTo(self, pt: tuple[float, float]) -> None: ... - def curveTo(self, *points: tuple[float, float]) -> None: ... - def qCurveTo(self, *points: tuple[float, float]) -> None: ... diff --git a/stubs/fpdf2/fpdf/actions.pyi b/stubs/fpdf2/fpdf/actions.pyi deleted file mode 100644 index 98c9dc82ba08..000000000000 --- a/stubs/fpdf2/fpdf/actions.pyi +++ /dev/null @@ -1,36 +0,0 @@ -from _typeshed import Incomplete -from abc import ABC, abstractmethod - -from .syntax import PDFObject - -class Action(ABC): - next: PDFObject | str | None - def __init__(self, next_action: PDFObject | str | None = None) -> None: ... - @abstractmethod - def serialize(self) -> str: ... - -class URIAction(Action): - uri: str - def __init__(self, uri: str, next_action: PDFObject | str | None = None) -> None: ... - def serialize(self) -> str: ... - -class NamedAction(Action): - action_name: str - def __init__(self, action_name: str, next_action: PDFObject | str | None = None) -> None: ... - def serialize(self) -> str: ... - -class GoToAction(Action): - dest: Incomplete - def __init__(self, dest, next_action: PDFObject | str | None = None) -> None: ... - def serialize(self) -> str: ... - -class GoToRemoteAction(Action): - file: str - dest: Incomplete - def __init__(self, file: str, dest, next_action: PDFObject | str | None = None) -> None: ... - def serialize(self) -> str: ... - -class LaunchAction(Action): - file: str - def __init__(self, file: str, next_action: PDFObject | str | None = None) -> None: ... - def serialize(self) -> str: ... diff --git a/stubs/fpdf2/fpdf/annotations.pyi b/stubs/fpdf2/fpdf/annotations.pyi deleted file mode 100644 index b55b30978dff..000000000000 --- a/stubs/fpdf2/fpdf/annotations.pyi +++ /dev/null @@ -1,102 +0,0 @@ -from _typeshed import Incomplete -from datetime import datetime -from typing import NamedTuple - -from .actions import Action -from .enums import AnnotationFlag, AnnotationName, FileAttachmentAnnotationName -from .syntax import Destination, Name, PDFContentStream, PDFObject - -DEFAULT_ANNOT_FLAGS: tuple[AnnotationFlag, ...] - -class AnnotationMixin: - type: Name - subtype: Name - rect: str - border: str - f_t: Name | None - v: Incomplete | None - f: int # AnnotationFlags bitmask - contents: str | None - a: Action | None - dest: Destination | None - c: str | None - t: str | None - m: str | None - quad_points: str | None - p: Incomplete | None - name: AnnotationName | FileAttachmentAnnotationName | None - ink_list: str | None - f_s: str | None - d_a: str | None - def __init__( - self, - subtype: str, - x: int, - y: int, - width: int, - height: int, - flags: tuple[AnnotationFlag | str, ...] = ..., - contents: str | None = None, - dest: Destination | None = None, - action: Action | None = None, - color: tuple[int, int, int] | None = None, - modification_time: datetime | None = None, - title: str | None = None, - quad_points: tuple[float, ...] | None = None, # multiple of 8 floats - border_width: int = 0, - name: AnnotationName | FileAttachmentAnnotationName | None = None, - ink_list: tuple[int, ...] = (), - file_spec: str | None = None, - field_type: str | None = None, - value=None, - default_appearance: str | None = None, - ) -> None: ... - -class PDFAnnotation(AnnotationMixin, PDFObject): ... - -class AnnotationDict(AnnotationMixin): - __slots__ = ( - "type", - "subtype", - "rect", - "border", - "f_t", - "v", - "f", - "contents", - "a", - "dest", - "c", - "t", - "quad_points", - "p", - "name", - "ink_list", - "f_s", - "d_a", - ) - def serialize(self) -> str: ... - -class PDFEmbeddedFile(PDFContentStream): - type: Name - params: str - def __init__( - self, - basename: str, - contents: bytes, - desc: str = "", - creation_date: datetime | None = None, - modification_date: datetime | None = None, - compress: bool = False, - checksum: bool = False, - ) -> None: ... - def globally_enclosed(self) -> bool: ... - def set_globally_enclosed(self, value: bool) -> None: ... - def basename(self) -> str: ... - def file_spec(self) -> FileSpec: ... - -class FileSpec(NamedTuple): - embedded_file: PDFEmbeddedFile - basename: str - desc: str - def serialize(self) -> str: ... diff --git a/stubs/fpdf2/fpdf/bidi.pyi b/stubs/fpdf2/fpdf/bidi.pyi deleted file mode 100644 index c748e733f349..000000000000 --- a/stubs/fpdf2/fpdf/bidi.pyi +++ /dev/null @@ -1,68 +0,0 @@ -from _typeshed import Incomplete -from collections.abc import Sequence -from dataclasses import dataclass -from typing import Final, Literal, TypedDict, type_check_only - -from .enums import TextDirection - -MAX_DEPTH: Final = 125 - -@type_check_only -class _BracketInfo(TypedDict): - pair: str - type: Literal["o", "c"] - -BIDI_BRACKETS: Final[dict[str, _BracketInfo]] - -class BidiCharacter: - __slots__ = ["character_index", "character", "bidi_class", "original_bidi_class", "embedding_level", "direction"] - character_index: int - character: str - bidi_class: str - original_bidi_class: str - embedding_level: str - direction: Incomplete | None - - def __init__(self, character_index: int, character: str, embedding_level: str, debug: bool) -> None: ... - def get_direction_from_level(self) -> Literal["L", "R"]: ... - def set_class(self, cls: str) -> None: ... - -@dataclass -class DirectionalStatus: - __slots__ = ["embedding_level", "directional_override_status", "directional_isolate_status"] - embedding_level: int # between 0 and MAX_DEPTH - directional_override_status: Literal["N", "L", "R"] - directional_isolate_status: bool - -class IsolatingRun: - __slots__ = ["characters", "previous_direction", "next_direction"] - characters: list[BidiCharacter] - previous_direction: str - next_direction: str - def __init__(self, characters: list[BidiCharacter], sos: str, eos: str) -> None: ... - def resolve_weak_types(self) -> None: ... - def pair_brackets(self) -> list[tuple[int, int]]: ... - def resolve_neutral_types(self) -> None: ... - def resolve_implicit_levels(self) -> None: ... - -def auto_detect_base_direction(string: str, stop_at_pdi: bool = False, debug: bool = False) -> TextDirection: ... -def calculate_isolate_runs(paragraph: Sequence[BidiCharacter]) -> list[IsolatingRun]: ... - -class BidiParagraph: - __slots__ = ("text", "base_direction", "debug", "base_embedding_level", "characters") - text: str - base_direction: TextDirection - debug: bool - base_embedding_level: int - characters: list[BidiCharacter] - - def __init__(self, text: str, base_direction: TextDirection | None = None, debug: bool = False) -> None: ... - def get_characters(self) -> list[BidiCharacter]: ... - def get_characters_with_embedding_level(self) -> list[BidiCharacter]: ... - def get_reordered_characters(self) -> list[BidiCharacter]: ... - def get_all(self) -> tuple[list[BidiCharacter], tuple[BidiCharacter, ...]]: ... - def get_reordered_string(self) -> str: ... - def get_bidi_fragments(self) -> tuple[tuple[str, Literal["L", "R"]], ...]: ... - def get_bidi_characters(self) -> None: ... - def split_bidi_fragments(self) -> tuple[tuple[str, Literal["L", "R"]], ...]: ... - def reorder_resolved_levels(self) -> tuple[BidiCharacter, ...]: ... diff --git a/stubs/fpdf2/fpdf/deprecation.pyi b/stubs/fpdf2/fpdf/deprecation.pyi deleted file mode 100644 index 7766bb38ab4c..000000000000 --- a/stubs/fpdf2/fpdf/deprecation.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from types import ModuleType -from typing import Any -from typing_extensions import Never - -def support_deprecated_txt_arg(fn): ... - -class WarnOnDeprecatedModuleAttributes(ModuleType): - def __call__(self) -> Never: ... - def __getattr__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - -def get_stack_level() -> int: ... diff --git a/stubs/fpdf2/fpdf/drawing.pyi b/stubs/fpdf2/fpdf/drawing.pyi deleted file mode 100644 index 20ba4daaf838..000000000000 --- a/stubs/fpdf2/fpdf/drawing.pyi +++ /dev/null @@ -1,502 +0,0 @@ -import decimal -from _typeshed import Incomplete, SupportsWrite -from collections import OrderedDict -from collections.abc import Callable, Generator, Iterable, Sequence -from contextlib import contextmanager -from re import Pattern -from types import EllipsisType -from typing import Any, ClassVar, Literal, NamedTuple, Protocol, TypeAlias, TypeVar, overload, type_check_only -from typing_extensions import Self - -from .enums import PathPaintRule -from .syntax import Name, Raw - -__pdoc__: dict[str, bool] - -_T = TypeVar("_T") -_CallableT = TypeVar("_CallableT", bound=Callable[..., Any]) - -@type_check_only -class _SupportsSerialize(Protocol): - def serialize(self) -> str: ... - -@type_check_only -class _SupportsEndPoint(Protocol): - @property - def end_point(self) -> Point: ... - -def force_nodocument(item: _CallableT) -> _CallableT: ... -def force_document(item: _CallableT) -> _CallableT: ... - -Number: TypeAlias = int | float | decimal.Decimal -NumberClass: tuple[type, ...] -WHITESPACE: frozenset[str] -EOL_CHARS: frozenset[str] -DELIMITERS: frozenset[str] -STR_ESC: Pattern[str] -STR_ESC_MAP: dict[str, str] -_Primitive: TypeAlias = ( - _SupportsSerialize - | Number - | str - | bytes - | bool - | Raw - | list[_Primitive] - | tuple[_Primitive, ...] - | dict[Name, _Primitive] - | None -) - -class GraphicsStateDictRegistry(OrderedDict[Raw, Name]): - def register_style(self, style: GraphicsStyle) -> Name | None: ... - -def number_to_str(number: Number) -> str: ... -def render_pdf_primitive(primitive: _Primitive) -> Raw: ... - -@type_check_only -class _DeviceRGBBase(NamedTuple): - r: Number - g: Number - b: Number - a: Number | None - -class DeviceRGB(_DeviceRGBBase): - OPERATOR: ClassVar[str] - def __new__(cls, r: Number, g: Number, b: Number, a: Number | None = None) -> Self: ... - @property - def colors(self) -> tuple[Number, Number, Number]: ... - @property - def colors255(self) -> tuple[Number, Number, Number]: ... - def serialize(self) -> str: ... - -@type_check_only -class _DeviceGrayBase(NamedTuple): - g: Number - a: Number | None - -class DeviceGray(_DeviceGrayBase): - OPERATOR: ClassVar[str] - def __new__(cls, g: Number, a: Number | None = None) -> Self: ... - @property - def colors(self) -> tuple[Number, Number, Number]: ... - @property - def colors255(self) -> tuple[Number, Number, Number]: ... - def serialize(self) -> str: ... - -@type_check_only -class _DeviceCMYKBase(NamedTuple): - c: Number - m: Number - y: Number - k: Number - a: Number | None - -class DeviceCMYK(_DeviceCMYKBase): - OPERATOR: ClassVar[str] - def __new__(cls, c: Number, m: Number, y: Number, k: Number, a: Number | None = None) -> Self: ... - @property - def colors(self) -> tuple[Number, Number, Number, Number]: ... - def serialize(self) -> str: ... - -def rgb8(r: Number, g: Number, b: Number, a: Number | None = None) -> DeviceRGB: ... -def gray8(g: Number, a: Number | None = None) -> DeviceGray: ... - -@overload -def convert_to_device_color(r: DeviceCMYK) -> DeviceCMYK: ... -@overload -def convert_to_device_color(r: DeviceGray) -> DeviceGray: ... -@overload -def convert_to_device_color(r: DeviceRGB) -> DeviceRGB: ... -@overload -def convert_to_device_color(r: str) -> DeviceRGB: ... -@overload -def convert_to_device_color(r: int, g: Literal[-1] = -1, b: Literal[-1] = -1) -> DeviceGray: ... -@overload -def convert_to_device_color(r: Sequence[int] | int, g: int, b: int) -> DeviceGray | DeviceRGB: ... - -def cmyk8(c, m, y, k, a=None) -> DeviceCMYK: ... -def color_from_hex_string(hexstr: str) -> DeviceRGB: ... -def color_from_rgb_string(rgbstr: str) -> DeviceRGB: ... - -class Point(NamedTuple): - x: Number - y: Number - def render(self) -> str: ... - def dot(self, other: Point) -> Number: ... - def angle(self, other: Point) -> float: ... - def mag(self) -> Number: ... - def __add__(self, other: Point) -> Point: ... # type: ignore[override] - def __sub__(self, other: Point) -> Point: ... - def __neg__(self) -> Point: ... - def __mul__(self, other: Number) -> Point: ... # type: ignore[override] - def __rmul__(self, other: Number) -> Point: ... # type: ignore[override] - def __truediv__(self, other: Number) -> Point: ... - def __floordiv__(self, other: Number) -> Point: ... - def __matmul__(self, other: Transform) -> Point: ... - -class Transform(NamedTuple): - a: Number - b: Number - c: Number - d: Number - e: Number - f: Number - @classmethod - def identity(cls) -> Self: ... - @classmethod - def translation(cls, x: Number, y: Number) -> Self: ... - @classmethod - def scaling(cls, x: Number, y: Number | None = None) -> Self: ... - @classmethod - def rotation(cls, theta: Number) -> Self: ... - @classmethod - def rotation_d(cls, theta_d: Number) -> Self: ... - @classmethod - def shearing(cls, x: Number, y: Number | None = None) -> Self: ... - def translate(self, x: Number, y: Number) -> Self: ... - def scale(self, x: Number, y: Number | None = None) -> Self: ... - def rotate(self, theta: Number) -> Self: ... - def rotate_d(self, theta_d: Number) -> Self: ... - def shear(self, x: Number, y: Number | None = None) -> Self: ... - def about(self, x: Number, y: Number) -> Transform: ... - def __mul__(self, other: Number) -> Transform: ... # type: ignore[override] - def __rmul__(self, other: Number) -> Transform: ... # type: ignore[override] - def __matmul__(self, other: Transform) -> Self: ... - def render(self, last_item: _T) -> tuple[str, _T]: ... - -class GraphicsStyle: - INHERIT: ClassVar[EllipsisType] - MERGE_PROPERTIES: ClassVar[tuple[str, ...]] - TRANSPARENCY_KEYS: ClassVar[tuple[Name, ...]] - PDF_STYLE_KEYS: ClassVar[tuple[Name, ...]] - @classmethod - def merge(cls, parent, child) -> Self: ... - def __init__(self) -> None: ... - def __deepcopy__(self, memo) -> Self: ... - - @property - def allow_transparency(self): ... - @allow_transparency.setter - def allow_transparency(self, new): ... - - @property - def paint_rule(self) -> PathPaintRule | EllipsisType: ... - @paint_rule.setter - def paint_rule(self, new: PathPaintRule | str | EllipsisType | None) -> None: ... - - @property - def auto_close(self) -> bool | EllipsisType: ... - @auto_close.setter - def auto_close(self, new: bool | EllipsisType) -> None: ... - - @property - def intersection_rule(self): ... - @intersection_rule.setter - def intersection_rule(self, new) -> None: ... - - @property - def fill_color(self): ... - @fill_color.setter - def fill_color(self, color) -> None: ... - - @property - def fill_opacity(self): ... - @fill_opacity.setter - def fill_opacity(self, new) -> None: ... - - @property - def stroke_color(self): ... - @stroke_color.setter - def stroke_color(self, color: str | DeviceRGB | DeviceGray | DeviceCMYK | EllipsisType | None) -> None: ... - - @property - def stroke_opacity(self): ... - @stroke_opacity.setter - def stroke_opacity(self, new) -> None: ... - - @property - def blend_mode(self): ... - @blend_mode.setter - def blend_mode(self, value) -> None: ... - - @property - def stroke_width(self): ... - @stroke_width.setter - def stroke_width(self, width: Number | EllipsisType | None) -> None: ... - - @property - def stroke_cap_style(self): ... - @stroke_cap_style.setter - def stroke_cap_style(self, value) -> None: ... - - @property - def stroke_join_style(self): ... - @stroke_join_style.setter - def stroke_join_style(self, value) -> None: ... - - @property - def stroke_miter_limit(self): ... - @stroke_miter_limit.setter - def stroke_miter_limit(self, value: Number | EllipsisType) -> None: ... - - @property - def stroke_dash_pattern(self): ... - @stroke_dash_pattern.setter - def stroke_dash_pattern(self, value: Number | Iterable[Number] | EllipsisType | None) -> None: ... - - @property - def stroke_dash_phase(self): ... - @stroke_dash_phase.setter - def stroke_dash_phase(self, value: Number | EllipsisType): ... - - def serialize(self) -> Raw | None: ... - def resolve_paint_rule(self) -> PathPaintRule: ... - -class Move(NamedTuple): - pt: Point - @property - def end_point(self) -> Point: ... - def render( - self, gsd_registry: GraphicsStateDictRegistry, style: GraphicsStyle, last_item: _SupportsEndPoint, initial_point: Point - ) -> tuple[str, Self, Point]: ... - def render_debug( - self, - gsd_registry: GraphicsStateDictRegistry, - style: GraphicsStyle, - last_item: _SupportsEndPoint, - initial_point: Point, - debug_stream: SupportsWrite[str], - pfx: str, - ) -> tuple[str, Self, Point]: ... - -class RelativeMove(NamedTuple): - pt: Point - def render( - self, gsd_registry: GraphicsStateDictRegistry, style: GraphicsStyle, last_item: _SupportsEndPoint, initial_point: Point - ) -> tuple[str, Move, Point]: ... - def render_debug( - self, - gsd_registry: GraphicsStateDictRegistry, - style: GraphicsStyle, - last_item: _SupportsEndPoint, - initial_point: Point, - debug_stream: SupportsWrite[str], - pfx: str, - ) -> tuple[str, Move, Point]: ... - -class Line(NamedTuple): - pt: Point - @property - def end_point(self) -> Point: ... - def render( - self, gsd_registry: GraphicsStateDictRegistry, style: GraphicsStyle, last_item: _SupportsEndPoint, initial_point: Point - ) -> tuple[str, Self, Point]: ... - def render_debug( - self, - gsd_registry: GraphicsStateDictRegistry, - style: GraphicsStyle, - last_item: _SupportsEndPoint, - initial_point: Point, - debug_stream: SupportsWrite[str], - pfx: str, - ) -> tuple[str, Self, Point]: ... - -class RelativeLine(NamedTuple): - pt: Point - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class HorizontalLine(NamedTuple): - x: Number - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class RelativeHorizontalLine(NamedTuple): - x: Number - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class VerticalLine(NamedTuple): - y: Number - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class RelativeVerticalLine(NamedTuple): - y: Number - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class BezierCurve(NamedTuple): - c1: Point - c2: Point - end: Point - @property - def end_point(self) -> Point: ... - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class RelativeBezierCurve(NamedTuple): - c1: Point - c2: Point - end: Point - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class QuadraticBezierCurve(NamedTuple): - ctrl: Point - end: Point - @property - def end_point(self) -> Point: ... - def to_cubic_curve(self, start_point): ... - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class RelativeQuadraticBezierCurve(NamedTuple): - ctrl: Point - end: Point - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class Arc(NamedTuple): - radii: Point - rotation: Number - large: bool - sweep: bool - end: Point - @staticmethod - def subdivde_sweep(sweep_angle: Number) -> Generator[tuple[Point, Point, Point]]: ... - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class RelativeArc(NamedTuple): - radii: Point - rotation: Number - large: bool - sweep: bool - end: Point - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class Rectangle(NamedTuple): - org: Point - size: Point - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class RoundedRectangle(NamedTuple): - org: Point - size: Point - corner_radii: Point - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class Ellipse(NamedTuple): - radii: Point - center: Point - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class ImplicitClose(NamedTuple): - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class Close(NamedTuple): - def render(self, gsd_registry, style, last_item, initial_point): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class DrawingContext: - def __init__(self) -> None: ... - def add_item(self, item, _copy: bool = True) -> None: ... - def render(self, gsd_registry, first_point, scale, height, starting_style): ... - def render_debug(self, gsd_registry, first_point, scale, height, starting_style, debug_stream): ... - -class PaintedPath: - def __init__(self, x: Number = 0, y: Number = 0) -> None: ... - def __deepcopy__(self, memo) -> Self: ... - @property - def style(self) -> GraphicsStyle: ... - - @property - def transform(self): ... - @transform.setter - def transform(self, tf) -> None: ... - - @property - def auto_close(self): ... - @auto_close.setter - def auto_close(self, should) -> None: ... - - @property - def paint_rule(self): ... - @paint_rule.setter - def paint_rule(self, style) -> None: ... - - @property - def clipping_path(self): ... - @clipping_path.setter - def clipping_path(self, new_clipath) -> None: ... - - @contextmanager - def transform_group(self, transform) -> Generator[Self]: ... - def add_path_element(self, item, _copy: bool = True) -> None: ... - def remove_last_path_element(self) -> None: ... - def rectangle(self, x: Number, y: Number, w: Number, h: Number, rx: Number = 0, ry: Number = 0) -> Self: ... - def circle(self, cx: Number, cy: Number, r: Number) -> Self: ... - def ellipse(self, cx: Number, cy: Number, rx: Number, ry: Number) -> Self: ... - def move_to(self, x: Number, y: Number) -> Self: ... - def move_relative(self, x: Number, y: Number) -> Self: ... - def line_to(self, x: Number, y: Number) -> Self: ... - def line_relative(self, dx: Number, dy: Number) -> Self: ... - def horizontal_line_to(self, x: Number) -> Self: ... - def horizontal_line_relative(self, dx: Number) -> Self: ... - def vertical_line_to(self, y: Number) -> Self: ... - def vertical_line_relative(self, dy: Number) -> Self: ... - def curve_to(self, x1: Number, y1: Number, x2: Number, y2: Number, x3: Number, y3: Number) -> Self: ... - def curve_relative(self, dx1: Number, dy1: Number, dx2: Number, dy2: Number, dx3: Number, dy3: Number) -> Self: ... - def quadratic_curve_to(self, x1: Number, y1: Number, x2: Number, y2: Number) -> Self: ... - def quadratic_curve_relative(self, dx1: Number, dy1: Number, dx2: Number, dy2: Number) -> Self: ... - def arc_to( - self, rx: Number, ry: Number, rotation: Number, large_arc: bool, positive_sweep: bool, x: Number, y: Number - ) -> Self: ... - def arc_relative( - self, rx: Number, ry: Number, rotation: Number, large_arc: bool, positive_sweep: bool, dx: Number, dy: Number - ) -> Self: ... - def close(self) -> None: ... - def render(self, gsd_registry, style, last_item, initial_point, debug_stream=None, pfx=None): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class ClippingPath(PaintedPath): - paint_rule: PathPaintRule - def __init__(self, x: Number = 0, y: Number = 0) -> None: ... - def render(self, gsd_registry, style, last_item, initial_point, debug_stream=None, pfx=None): ... - def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ... - -class GraphicsContext: - style: GraphicsStyle - path_items: list[Incomplete] - def __init__(self) -> None: ... - def __deepcopy__(self, memo) -> Self: ... - - @property - def transform(self) -> Transform | None: ... - @transform.setter - def transform(self, tf) -> None: ... - - @property - def clipping_path(self) -> ClippingPath | None: ... - @clipping_path.setter - def clipping_path(self, new_clipath) -> None: ... - - def add_item(self, item, _copy: bool = True) -> None: ... - def remove_last_item(self) -> None: ... - def merge(self, other_context) -> None: ... - def build_render_list( - self, gsd_registry, style, last_item, initial_point, debug_stream=None, pfx=None, _push_stack: bool = True - ): ... - def render( - self, gsd_registry, style: DrawingContext, last_item, initial_point, debug_stream=None, pfx=None, _push_stack: bool = True - ): ... - def render_debug( - self, gsd_registry, style: DrawingContext, last_item, initial_point, debug_stream, pfx, _push_stack: bool = True - ): ... diff --git a/stubs/fpdf2/fpdf/encryption.pyi b/stubs/fpdf2/fpdf/encryption.pyi deleted file mode 100644 index 6a02f052d0ec..000000000000 --- a/stubs/fpdf2/fpdf/encryption.pyi +++ /dev/null @@ -1,111 +0,0 @@ -from _typeshed import Incomplete, SupportsLenAndGetItem -from collections.abc import Generator, Iterable -from logging import Logger -from typing import ClassVar, Protocol, TypeAlias, TypeVar, overload, type_check_only - -from .enums import AccessPermission, EncryptionMethod -from .fpdf import FPDF -from .syntax import Name, PDFObject - -_Key: TypeAlias = SupportsLenAndGetItem[int] -_T_co = TypeVar("_T_co", covariant=True) - -LOGGER: Logger - -import_error: ImportError | None - -@type_check_only -class _SupportsGetItem(Protocol[_T_co]): - def __getitem__(self, k: int, /) -> _T_co: ... - -class ARC4: - MOD: ClassVar[int] - def KSA(self, key: _Key) -> list[int]: ... - def PRGA(self, S: _SupportsGetItem[int]) -> Generator[int]: ... - def encrypt(self, key: _Key, text: Iterable[int]) -> list[int]: ... - -class CryptFilter: - type: Name - c_f_m: Name - length: int - def __init__(self, mode: str, length: int) -> None: ... - def serialize(self) -> str: ... - -class EncryptionDictionary(PDFObject): - filter: Name - length: int - r: int - o: str - u: str - v: int - p: int - encrypt_metadata: str # not always defined - c_f: str # not always defined - stm_f: Name - str_f: Name - def __init__(self, security_handler: StandardSecurityHandler) -> None: ... - -class StandardSecurityHandler: - DEFAULT_PADDING: ClassVar[bytes] - fpdf: FPDF - access_permission: int - owner_password: str - user_password: str - encryption_method: EncryptionMethod | None - cf: CryptFilter | None - key_length: int - version: int - revision: int - encrypt_metadata: bool - - # The following fields are only defined after a call to generate_passwords(). - file_id: Incomplete - info_id: Incomplete - o: str - k: str - u: str - # The following field is only defined after a call to generate_user_password_rev6(). - ue: Incomplete - # The following field is only defined after a call to generate_owner_password_rev6(). - oe: Incomplete - # The following field is only defined after a call to generate_perms_rev6(). - perms_rev6: Incomplete - - def __init__( - self, - fpdf: FPDF, - owner_password: str, - user_password: str | None = None, - permission: AccessPermission = ..., - encryption_method: EncryptionMethod = ..., - encrypt_metadata: bool = False, - ) -> None: ... - def generate_passwords(self, file_id: str) -> None: ... - def get_encryption_obj(self) -> EncryptionDictionary: ... - - @overload - def encrypt(self, text: bytes | bytearray, obj_id: int) -> bytes: ... - @overload - def encrypt(self, text: str, obj_id: int) -> str: ... - - def encrypt_string(self, string: str, obj_id: int) -> str: ... - def encrypt_stream(self, stream: bytes | bytearray, obj_id: int) -> bytes: ... - def is_aes_algorithm(self) -> bool: ... - def encrypt_bytes(self, data: bytes | bytearray, obj_id: int) -> list[int]: ... - def encrypt_AES_cryptography(self, key: bytes, data: bytes | bytearray) -> bytes: ... - @classmethod - def get_random_bytes(cls, size: int) -> bytes: ... - @classmethod - def prepare_string(cls, string: str) -> bytes: ... - def padded_password(self, password: str) -> bytearray: ... - def generate_owner_password(self) -> str: ... - def generate_user_password(self) -> str: ... - @classmethod - def compute_hash(cls, input_password: bytes | bytearray, salt: bytes, user_key: bytes | bytearray = ...) -> bytes: ... - def generate_user_password_rev6(self) -> None: ... - def generate_owner_password_rev6(self) -> None: ... - def generate_perms_rev6(self) -> None: ... - def generate_encryption_key(self) -> bytes: ... - -def md5(data: bytes | bytearray) -> bytes: ... -def int32(n: int) -> int: ... diff --git a/stubs/fpdf2/fpdf/enums.pyi b/stubs/fpdf2/fpdf/enums.pyi deleted file mode 100644 index 076d48c0af6b..000000000000 --- a/stubs/fpdf2/fpdf/enums.pyi +++ /dev/null @@ -1,421 +0,0 @@ -from abc import ABC, abstractmethod -from collections.abc import Sequence -from dataclasses import dataclass -from enum import Enum, Flag, IntEnum, IntFlag -from typing import Final, Literal, TypeAlias -from typing_extensions import Self - -from .drawing import DeviceCMYK, DeviceGray, DeviceRGB -from .syntax import Name - -_Color: TypeAlias = str | int | Sequence[int] | DeviceCMYK | DeviceGray | DeviceRGB - -class SignatureFlag(IntEnum): - SIGNATURES_EXIST = 1 - APPEND_ONLY = 2 - -class CoerciveEnum(Enum): # type: ignore[misc] # Enum with no members - @classmethod - def coerce(cls, value: Self | str, case_sensitive: bool = False) -> Self: ... - -class CoerciveIntEnum(IntEnum): # type: ignore[misc] # Enum with no members - @classmethod - def coerce(cls, value: Self | str | int) -> Self: ... - -class CoerciveIntFlag(IntFlag): # type: ignore[misc] # Enum with no members - @classmethod - def coerce(cls, value: Self | str | int) -> Self: ... - -class WrapMode(CoerciveEnum): - WORD = "WORD" - CHAR = "CHAR" - -class CharVPos(CoerciveEnum): - SUP = "SUP" - SUB = "SUB" - NOM = "NOM" - DENOM = "DENOM" - LINE = "LINE" - -class Align(CoerciveEnum): - C = "CENTER" - X = "X_CENTER" - L = "LEFT" - R = "RIGHT" - J = "JUSTIFY" - - @classmethod - def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] - -_Align: TypeAlias = Align | Literal["CENTER", "X_CENTER", "LEFT", "RIGHT", "JUSTIFY"] # noqa: Y047 - -class VAlign(CoerciveEnum): - M = "MIDDLE" - T = "TOP" - B = "BOTTOM" - - @classmethod - def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] - -class TextEmphasis(CoerciveIntFlag): - NONE = 0 - B = 1 - I = 2 - U = 4 - S = 8 - - @property - def style(self) -> str: ... - def add(self, value: TextEmphasis) -> TextEmphasis: ... - def remove(self, value: TextEmphasis) -> TextEmphasis: ... - -class MethodReturnValue(CoerciveIntFlag): - PAGE_BREAK = 1 - LINES = 2 - HEIGHT = 4 - -class CellBordersLayout(CoerciveIntFlag): - NONE = 0 - LEFT = 1 - RIGHT = 2 - TOP = 4 - BOTTOM = 8 - ALL = 15 - INHERIT = 16 - -@dataclass -class TableBorderStyle: - thickness: float | None = None - color: int | tuple[int, int, int] | None = None - dash: float | None = None - gap: float = 0.0 - phase: float = 0.0 - - @staticmethod - def from_bool(should_draw: TableBorderStyle | bool | None) -> TableBorderStyle: ... - @property - def dash_dict(self) -> dict[str, float | None]: ... - def changes_stroke(self, pdf) -> bool: ... - def should_render(self) -> bool: ... - def get_change_stroke_commands(self, scale: float) -> list[str]: ... - @staticmethod - def get_line_command(x1: float, y1: float, x2: float, y2: float) -> list[str]: ... - def get_draw_commands(self, pdf, x1: float, y1: float, x2: float, y2: float) -> list[str]: ... - -@dataclass -class TableCellStyle: - left: bool | TableBorderStyle = False - bottom: bool | TableBorderStyle = False - right: bool | TableBorderStyle = False - top: bool | TableBorderStyle = False - - @staticmethod - def get_change_fill_color_command(color: _Color | None) -> list[str]: ... - def get_draw_commands( - self, pdf, x1: float, y1: float, x2: float, y2: float, fill_color: _Color | None = None - ) -> list[str]: ... - def override_cell_border(self, cell_border: CellBordersLayout) -> Self: ... - def draw_cell_border(self, pdf, x1: float, y1: float, x2: float, y2: float, fill_color: _Color | None = None) -> None: ... - -class TableBordersLayout(ABC): - ALL: Final[TableBordersLayoutAll] - NONE: Final[TableBordersLayoutNone] - INTERNAL: Final[TableBordersLayoutInternal] - MINIMAL: Final[TableBordersLayoutMinimal] - HORIZONTAL_LINES: Final[TableBordersLayoutHorizontalLines] - NO_HORIZONTAL_LINES: Final[TableBordersLayoutNoHorizontalLines] - SINGLE_TOP_LINE: Final[TableBordersLayoutSingleTopLine] - @abstractmethod - def cell_style_getter( - self, row_idx: int, col_idx: int, col_pos: int, num_heading_rows: int, num_rows: int, num_col_idx: int, num_col_pos: int - ) -> TableCellStyle: ... - @classmethod - def coerce(cls, value: Self | str) -> Self: ... - -class TableBordersLayoutAll(TableBordersLayout): - def cell_style_getter( - self, row_idx: int, col_idx: int, col_pos: int, num_heading_rows: int, num_rows: int, num_col_idx: int, num_col_pos: int - ) -> TableCellStyle: ... - -class TableBordersLayoutNone(TableBordersLayout): - def cell_style_getter( - self, row_idx: int, col_idx: int, col_pos: int, num_heading_rows: int, num_rows: int, num_col_idx: int, num_col_pos: int - ) -> TableCellStyle: ... - -class TableBordersLayoutInternal(TableBordersLayout): - def cell_style_getter( - self, row_idx: int, col_idx: int, col_pos: int, num_heading_rows: int, num_rows: int, num_col_idx: int, num_col_pos: int - ) -> TableCellStyle: ... - -class TableBordersLayoutMinimal(TableBordersLayout): - def cell_style_getter( - self, row_idx: int, col_idx: int, col_pos: int, num_heading_rows: int, num_rows: int, num_col_idx: int, num_col_pos: int - ) -> TableCellStyle: ... - -class TableBordersLayoutHorizontalLines(TableBordersLayout): - def cell_style_getter( - self, row_idx: int, col_idx: int, col_pos: int, num_heading_rows: int, num_rows: int, num_col_idx: int, num_col_pos: int - ) -> TableCellStyle: ... - -class TableBordersLayoutNoHorizontalLines(TableBordersLayout): - def cell_style_getter( - self, row_idx: int, col_idx: int, col_pos: int, num_heading_rows: int, num_rows: int, num_col_idx: int, num_col_pos: int - ) -> TableCellStyle: ... - -class TableBordersLayoutSingleTopLine(TableBordersLayout): - def cell_style_getter( - self, row_idx: int, col_idx: int, col_pos: int, num_heading_rows: int, num_rows: int, num_col_idx: int, num_col_pos: int - ) -> TableCellStyle: ... - -class TableCellFillMode(CoerciveEnum): - NONE = "NONE" - ALL = "ALL" - ROWS = "ROWS" - COLUMNS = "COLUMNS" - EVEN_ROWS = "EVEN_ROWS" - EVEN_COLUMNS = "EVEN_COLUMNS" - - def should_fill_cell(self, i: int, j: int) -> bool: ... - @classmethod - def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] - -class TableSpan(CoerciveEnum): - ROW = "ROW" - COL = "COL" - -class TableHeadingsDisplay(CoerciveIntEnum): - NONE = 0 - ON_TOP_OF_EVERY_PAGE = 1 - -class RenderStyle(CoerciveEnum): - D = "DRAW" - F = "FILL" - DF = "DRAW_FILL" - @property - def operator(self) -> str: ... - @property - def is_draw(self) -> bool: ... - @property - def is_fill(self) -> bool: ... - @classmethod - def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] - -class TextMode(CoerciveIntEnum): - FILL = 0 - STROKE = 1 - FILL_STROKE = 2 - INVISIBLE = 3 - FILL_CLIP = 4 - STROKE_CLIP = 5 - FILL_STROKE_CLIP = 6 - CLIP = 7 - -class XPos(CoerciveEnum): - LEFT = "LEFT" - RIGHT = "RIGHT" - START = "START" - END = "END" - WCONT = "WCONT" - CENTER = "CENTER" - LMARGIN = "LMARGIN" - RMARGIN = "RMARGIN" - -class YPos(CoerciveEnum): - TOP = "TOP" - LAST = "LAST" - NEXT = "NEXT" - TMARGIN = "TMARGIN" - BMARGIN = "BMARGIN" - -class Angle(CoerciveIntEnum): - NORTH = 90 - EAST = 0 - SOUTH = 270 - WEST = 180 - NORTHEAST = 45 - SOUTHEAST = 315 - SOUTHWEST = 225 - NORTHWEST = 135 - -class PageLayout(CoerciveEnum): - SINGLE_PAGE = Name("SinglePage") - ONE_COLUMN = Name("OneColumn") - TWO_COLUMN_LEFT = Name("TwoColumnLeft") - TWO_COLUMN_RIGHT = Name("TwoColumnRight") - TWO_PAGE_LEFT = Name("TwoPageLeft") - TWO_PAGE_RIGHT = Name("TwoPageRight") - -class PageMode(CoerciveEnum): - USE_NONE = Name("UseNone") - USE_OUTLINES = Name("UseOutlines") - USE_THUMBS = Name("UseThumbs") - FULL_SCREEN = Name("FullScreen") - USE_OC = Name("UseOC") - USE_ATTACHMENTS = Name("UseAttachments") - -class TextMarkupType(CoerciveEnum): - HIGHLIGHT = Name("Highlight") - UNDERLINE = Name("Underline") - SQUIGGLY = Name("Squiggly") - STRIKE_OUT = Name("StrikeOut") - -class BlendMode(CoerciveEnum): - NORMAL = Name("Normal") - MULTIPLY = Name("Multiply") - SCREEN = Name("Screen") - OVERLAY = Name("Overlay") - DARKEN = Name("Darken") - LIGHTEN = Name("Lighten") - COLOR_DODGE = Name("ColorDodge") - COLOR_BURN = Name("ColorBurn") - HARD_LIGHT = Name("HardLight") - SOFT_LIGHT = Name("SoftLight") - DIFFERENCE = Name("Difference") - EXCLUSION = Name("Exclusion") - HUE = Name("Hue") - SATURATION = Name("Saturation") - COLOR = Name("Color") - LUMINOSITY = Name("Luminosity") - -class AnnotationFlag(CoerciveIntEnum): - INVISIBLE = 1 - HIDDEN = 2 - PRINT = 4 - NO_ZOOM = 8 - NO_ROTATE = 16 - NO_VIEW = 32 - READ_ONLY = 64 - LOCKED = 128 - TOGGLE_NO_VIEW = 256 - LOCKED_CONTENTS = 512 - -class AnnotationName(CoerciveEnum): - NOTE = Name("Note") - COMMENT = Name("Comment") - HELP = Name("Help") - PARAGRAPH = Name("Paragraph") - NEW_PARAGRAPH = Name("NewParagraph") - INSERT = Name("Insert") - -class FileAttachmentAnnotationName(CoerciveEnum): - PUSH_PIN = Name("PushPin") - GRAPH_PUSH_PIN = Name("GraphPushPin") - PAPERCLIP_TAG = Name("PaperclipTag") - -class IntersectionRule(CoerciveEnum): - NONZERO = "nonzero" - EVENODD = "evenodd" - -class PathPaintRule(CoerciveEnum): - STROKE = "S" - FILL_NONZERO = "f" - FILL_EVENODD = "f*" - STROKE_FILL_NONZERO = "B" - STROKE_FILL_EVENODD = "B*" - DONT_PAINT = "n" - AUTO = "auto" - -class ClippingPathIntersectionRule(CoerciveEnum): - NONZERO = "W" - EVENODD = "W*" - -class StrokeCapStyle(CoerciveIntEnum): - BUTT = 0 - ROUND = 1 - SQUARE = 2 - -class StrokeJoinStyle(CoerciveIntEnum): - MITER = 0 - ROUND = 1 - BEVEL = 2 - -class PDFStyleKeys(Enum): - FILL_ALPHA = Name("ca") - BLEND_MODE = Name("BM") - STROKE_ALPHA = Name("CA") - STROKE_ADJUSTMENT = Name("SA") - STROKE_WIDTH = Name("LW") - STROKE_CAP_STYLE = Name("LC") - STROKE_JOIN_STYLE = Name("LJ") - STROKE_MITER_LIMIT = Name("ML") - STROKE_DASH_PATTERN = Name("D") - -class Corner(CoerciveEnum): - TOP_RIGHT = "TOP_RIGHT" - TOP_LEFT = "TOP_LEFT" - BOTTOM_RIGHT = "BOTTOM_RIGHT" - BOTTOM_LEFT = "BOTTOM_LEFT" - -class FontDescriptorFlags(Flag): - FIXED_PITCH = 1 - SYMBOLIC = 4 - ITALIC = 64 - FORCE_BOLD = 262144 - -class AccessPermission(IntFlag): - PRINT_LOW_RES = 4 - MODIFY = 8 - COPY = 16 - ANNOTATION = 32 - FILL_FORMS = 256 - COPY_FOR_ACCESSIBILITY = 512 - ASSEMBLE = 1024 - PRINT_HIGH_RES = 2048 - @classmethod - def all(cls) -> int: ... - @classmethod - def none(cls) -> Literal[0]: ... - -class EncryptionMethod(Enum): - NO_ENCRYPTION = 0 - RC4 = 1 - AES_128 = 2 - AES_256 = 3 - -class TextDirection(CoerciveEnum): - LTR = "LTR" - RTL = "RTL" - TTB = "TTB" - BTT = "BTT" - -class OutputIntentSubType(CoerciveEnum): - PDFX = "GTS_PDFX" - PDFA = "GTS_PDFA1" - ISOPDF = "ISO_PDFE1" - -class PageLabelStyle(CoerciveEnum): - NUMBER = "D" - UPPER_ROMAN = "R" - LOWER_ROMAN = "r" - UPPER_LETTER = "A" - LOWER_LETTER = "a" - NONE = None - -class Duplex(CoerciveEnum): - SIMPLEX = "Simplex" - DUPLEX_FLIP_SHORT_EDGE = "DuplexFlipShortEdge" - DUPLEX_FLIP_LONG_EDGE = "DuplexFlipLongEdge" - -class PageBoundaries(CoerciveEnum): - ART_BOX = "ArtBox" - BLEED_BOX = "BleedBox" - CROP_BOX = "CropBox" - MEDIA_BOX = "MediaBox" - TRIM_BOX = "TrimBox" - -class PageOrientation(CoerciveEnum): - PORTRAIT = "P" - LANDSCAPE = "L" - - @classmethod - def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] - -class PDFResourceType(Enum): - EXT_G_STATE = "ExtGState" - COLOR_SPACE = "ColorSpace" - PATTERN = "Pattern" - SHADDING = "Shading" - X_OBJECT = "XObject" - FONT = "Font" - PROC_SET = "ProcSet" - PROPERTIES = "Properties" diff --git a/stubs/fpdf2/fpdf/errors.pyi b/stubs/fpdf2/fpdf/errors.pyi deleted file mode 100644 index a2aff7bb139b..000000000000 --- a/stubs/fpdf2/fpdf/errors.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Any - -class FPDFException(Exception): ... - -class FPDFPageFormatException(FPDFException): - argument: Any - unknown: Any - one: Any - def __init__(self, argument, unknown: bool = False, one: bool = False) -> None: ... - -class FPDFUnicodeEncodingException(FPDFException): - def __init__(self, text_index, character, font_name) -> None: ... diff --git a/stubs/fpdf2/fpdf/fonts.pyi b/stubs/fpdf2/fpdf/fonts.pyi deleted file mode 100644 index 3b57d67408e8..000000000000 --- a/stubs/fpdf2/fpdf/fonts.pyi +++ /dev/null @@ -1,182 +0,0 @@ -import dataclasses -from _typeshed import Incomplete, Unused -from collections import defaultdict -from collections.abc import Generator -from dataclasses import dataclass -from logging import Logger -from typing import Final, overload -from typing_extensions import Self, deprecated - -from ._fonttools_shims import _TTFont -from .drawing import DeviceGray, DeviceRGB, Number -from .enums import Align, TextEmphasis -from .syntax import PDFObject - -LOGGER: Logger - -# Only defined if harfbuzz is installed. -class HarfBuzzFont(Incomplete): # derives from uharfbuzz.Font - def __deepcopy__(self, _memo: object) -> Self: ... - -@dataclass -class FontFace: - __slots__ = ("family", "emphasis", "size_pt", "color", "fill_color") - family: str | None - emphasis: TextEmphasis | None - size_pt: int | None - color: DeviceGray | DeviceRGB | None - fill_color: DeviceGray | DeviceRGB | None - - def __init__( - self, - family: str | None = None, - emphasis=None, - size_pt: int | None = None, - color: int | tuple[Number, Number, Number] | DeviceGray | DeviceRGB | None = None, - fill_color: int | tuple[Number, Number, Number] | DeviceGray | DeviceRGB | None = None, - ) -> None: ... - - replace = dataclasses.replace - - @overload - @staticmethod - def combine(default_style: None, override_style: None) -> None: ... # type: ignore[misc] - @overload - @staticmethod - def combine(default_style: FontFace | None, override_style: FontFace | None) -> FontFace: ... - -class TextStyle(FontFace): - t_margin: int - l_margin: int | Align - b_margin: int - def __init__( - self, - font_family: str | None = None, - font_style: str | None = None, - font_size_pt: int | None = None, - color: int | tuple[int, int, int] | None = None, - fill_color: int | tuple[int, int, int] | None = None, - underline: bool = False, - t_margin: int | None = None, - l_margin: int | Align | str | None = None, - b_margin: int | None = None, - ): ... - def replace( # type: ignore[override] - self, - /, - font_family: str | None = None, - emphasis: TextEmphasis | None = None, - font_size_pt: int | None = None, - color: int | tuple[int, int, int] | None = None, - fill_color: int | tuple[int, int, int] | None = None, - t_margin: int | None = None, - l_margin: int | None = None, - b_margin: int | None = None, - ) -> TextStyle: ... - -@deprecated("fpdf.TitleStyle is deprecated since 2.7.10. It has been replaced by fpdf.TextStyle.") -class TitleStyle(TextStyle): ... - -__pdoc__: Final[dict[str, bool]] - -class CoreFont: - __slots__ = ("i", "type", "name", "sp", "ss", "up", "ut", "cw", "fontkey", "emphasis") - i: int - type: str - name: str - up: int - ut: int - sp: int - ss: int - cw: int - fontkey: str - emphasis: TextEmphasis - def __init__(self, fpdf, fontkey: str, style: int) -> None: ... - def get_text_width(self, text: str, font_size_pt: int, _: Unused) -> float: ... - def encode_text(self, text: str) -> str: ... - -class TTFFont: - __slots__ = ( - "i", - "type", - "name", - "desc", - "glyph_ids", - "hbfont", - "sp", - "ss", - "up", - "ut", - "cw", - "ttffile", - "fontkey", - "emphasis", - "scale", - "subset", - "cmap", - "ttfont", - "missing_glyphs", - ) - i: int - type: str - ttffile: Incomplete - fontkey: str - ttfont: _TTFont - scale: float - desc: PDFFontDescriptor - cw: defaultdict[str, int] - cmap: Incomplete - glyph_ids: dict[Incomplete, Incomplete] - missing_glyphs: list[Incomplete] - name: str - up: int - ut: int - sp: int - ss: int - emphasis: TextEmphasis - subset: SubsetMap - hbfont: HarfBuzzFont | None # Not always defined. - def __init__(self, fpdf, font_file_path, fontkey: str, style: int) -> None: ... - def __deepcopy__(self, memo) -> Self: ... - def close(self) -> None: ... - def get_text_width(self, text: str, font_size_pt: int, text_shaping_params): ... - def shaped_text_width(self, text: str, font_size_pt: int, text_shaping_params): ... - def perform_harfbuzz_shaping(self, text: str, font_size_pt: int, text_shaping_params): ... - def encode_text(self, text: str) -> str: ... - def shape_text(self, text: str, font_size_pt: int, text_shaping_params): ... - -class PDFFontDescriptor(PDFObject): - type: Incomplete - ascent: Incomplete - descent: Incomplete - cap_height: Incomplete - flags: Incomplete - font_b_box: Incomplete - italic_angle: Incomplete - stem_v: Incomplete - missing_width: Incomplete - font_name: Incomplete - def __init__(self, ascent, descent, cap_height, flags, font_b_box, italic_angle, stem_v, missing_width) -> None: ... - -@dataclass(order=True) -class Glyph: - __slots__ = ("glyph_id", "unicode", "glyph_name", "glyph_width") - glyph_id: int - unicode: tuple[Incomplete, ...] - glyph_name: str - glyph_width: int - def __hash__(self) -> int: ... - -class SubsetMap: - font: TTFFont - def __init__(self, font: TTFFont) -> None: ... - def __len__(self) -> int: ... - def items(self) -> Generator[Incomplete]: ... - def pick(self, unicode: int): ... - def pick_glyph(self, glyph): ... - def get_glyph(self, glyph=None, unicode=None, glyph_name=None, glyph_width=None) -> Glyph: ... - def get_all_glyph_names(self): ... - -CORE_FONTS: dict[str, str] -COURIER_FONT: dict[str, int] -CORE_FONTS_CHARWIDTHS: dict[str, dict[str, int]] diff --git a/stubs/fpdf2/fpdf/fpdf.pyi b/stubs/fpdf2/fpdf/fpdf.pyi deleted file mode 100644 index 0ba3b314e0ee..000000000000 --- a/stubs/fpdf2/fpdf/fpdf.pyi +++ /dev/null @@ -1,723 +0,0 @@ -import datetime -from _typeshed import Incomplete, StrPath, Unused -from collections.abc import Callable, Generator, Iterable, Sequence -from contextlib import _GeneratorContextManager -from io import BytesIO -from pathlib import PurePath -from re import Pattern -from typing import Any, ClassVar, Final, Literal, NamedTuple, TypeAlias, overload -from typing_extensions import deprecated - -from fpdf import ViewerPreferences -from fpdf.outline import OutlineSection -from PIL import Image - -from .annotations import AnnotationDict, PDFEmbeddedFile -from .drawing import DeviceGray, DeviceRGB, DrawingContext, PaintedPath -from .enums import ( - AccessPermission, - Align, - AnnotationFlag, - AnnotationName, - Corner, - EncryptionMethod, - FileAttachmentAnnotationName, - MethodReturnValue, - OutputIntentSubType, - PageLabelStyle, - PageLayout, - PageMode, - PageOrientation, - PathPaintRule, - RenderStyle, - TableBordersLayout, - TableCellFillMode, - TableHeadingsDisplay, - TextDirection, - TextEmphasis, - TextMarkupType, - TextMode as TextMode, - VAlign, - WrapMode as WrapMode, - XPos as XPos, - YPos as YPos, - _Align, -) -from .errors import FPDFException as FPDFException -from .fonts import CoreFont, FontFace, TextStyle, TitleStyle as TitleStyle, TTFFont -from .graphics_state import GraphicsStateMixin -from .html import HTML2FPDF -from .image_datastructures import ( - ImageCache, - ImageInfo as ImageInfo, - RasterImageInfo as RasterImageInfo, - VectorImageInfo as VectorImageInfo, - _TextAlign, -) -from .output import OutputProducer, PDFICCProfile, PDFPage -from .recorder import FPDFRecorder -from .structure_tree import StructureTreeBuilder -from .syntax import DestinationXYZ -from .table import Table -from .transitions import Transition -from .util import Padding, _Unit - -__all__ = [ - "FPDF", - "XPos", - "YPos", - "get_page_format", - "ImageInfo", - "RasterImageInfo", - "VectorImageInfo", - "TextMode", - "TitleStyle", - "PAGE_FORMATS", -] - -_Orientation: TypeAlias = Literal["", "portrait", "p", "P", "landscape", "l", "L"] -_Format: TypeAlias = Literal["", "a3", "A3", "a4", "A4", "a5", "A5", "letter", "Letter", "legal", "Legal"] -_FontStyle: TypeAlias = Literal["", "B", "I", "BI"] -_FontStyles: TypeAlias = Literal[ - "", - "B", - "I", - "U", - "S", - "BU", - "UB", - "BI", - "IB", - "IU", - "UI", - "BS", - "SB", - "IS", - "SI", - "BIU", - "BUI", - "IBU", - "IUB", - "UBI", - "UIB", - "BIS", - "BSI", - "IBS", - "ISB", - "SBI", - "SIB", -] - -FPDF_VERSION: Final[str] -PAGE_FORMATS: Final[dict[_Format, tuple[float, float]]] - -class ToCPlaceholder(NamedTuple): - render_function: Callable[[FPDF, list[OutlineSection]], object] - start_page: int - y: int - page_orientation: str - pages: int = 1 - reset_page_indices: bool = True - -def get_page_format(format: _Format | tuple[float, float], k: float | None = None) -> tuple[float, float]: ... - -class FPDF(GraphicsStateMixin): - MARKDOWN_BOLD_MARKER: ClassVar[str] - MARKDOWN_ITALICS_MARKER: ClassVar[str] - MARKDOWN_STRIKETHROUGH_MARKER: ClassVar[str] - MARKDOWN_UNDERLINE_MARKER: ClassVar[str] - MARKDOWN_ESCAPE_CHARACTER: ClassVar[str] - MARKDOWN_LINK_REGEX: ClassVar[Pattern[str]] - MARKDOWN_LINK_COLOR: ClassVar[Incomplete | None] - MARKDOWN_LINK_UNDERLINE: ClassVar[bool] - - HTML2FPDF_CLASS: ClassVar[type[HTML2FPDF]] - - page: int - pages: dict[int, PDFPage] - fonts: dict[str, CoreFont | TTFFont] - fonts_used_per_page_number: dict[int, set[int]] - links: dict[int, DestinationXYZ] - embedded_files: list[PDFEmbeddedFile] - image_cache: ImageCache - images_used_per_page_number: dict[int, set[int]] - - in_footer: bool - str_alias_nb_pages: str - - xmp_metadata: str | None - page_duration: int - page_transition: Incomplete | None - allow_images_transparency: bool - oversized_images: Incomplete | None - oversized_images_ratio: float - struct_builder: StructureTreeBuilder - toc_placeholder: ToCPlaceholder | None - in_toc_rendering: bool - title: str | None - section_title_styles: dict[int, TextStyle] - - core_fonts: dict[str, str] - core_fonts_encoding: str - font_aliases: dict[str, str] - k: float - - page_background: Incomplete | None - - dw_pt: float - dh_pt: float - def_orientation: Literal["P", "L"] - x: float - y: float - l_margin: float - t_margin: float - c_margin: float - viewer_preferences: ViewerPreferences | None - compress: bool - pdf_version: str - creation_date: datetime.datetime - - buffer: bytearray | None - - # Set during call to _set_orientation(), called from __init__(). - cur_orientation: PageOrientation - w_pt: float - h_pt: float - w: float - h: float - - def __init__( - self, - orientation: _Orientation = "portrait", - unit: _Unit | float = "mm", - format: _Format | tuple[float, float] = "A4", - font_cache_dir: Literal["DEPRECATED"] = "DEPRECATED", - ) -> None: ... - def set_encryption( - self, - owner_password: str, - user_password: str | None = None, - encryption_method: EncryptionMethod | str = ..., - permissions: AccessPermission = ..., - encrypt_metadata: bool = False, - ) -> None: ... - # args and kwargs are passed to HTML2FPDF_CLASS constructor. - def write_html(self, text: str, *args: Any, **kwargs: Any) -> None: ... - @property - def emphasis(self) -> TextEmphasis: ... - @property - def is_ttf_font(self) -> bool: ... - - @property - def page_mode(self) -> PageMode: ... - @page_mode.setter - def page_mode(self, page_mode: PageMode) -> None: ... - - @property - def output_intents(self): ... - def add_output_intent( - self, - subtype: OutputIntentSubType, - output_condition_identifier: str | None = None, - output_condition: str | None = None, - registry_name: str | None = None, - dest_output_profile: PDFICCProfile | None = None, - info: str | None = None, - ) -> None: ... - @property - def epw(self) -> float: ... - @property - def eph(self) -> float: ... - @property - def pages_count(self) -> int: ... - def set_margin(self, margin: float) -> None: ... - def set_margins(self, left: float, top: float, right: float = -1) -> None: ... - def set_left_margin(self, margin: float) -> None: ... - def set_top_margin(self, margin: float) -> None: ... - r_margin: float - def set_right_margin(self, margin: float) -> None: ... - auto_page_break: bool - b_margin: float - page_break_trigger: float - def set_auto_page_break(self, auto: bool, margin: float = 0) -> None: ... - @property - def default_page_dimensions(self) -> tuple[float, float]: ... - zoom_mode: Literal["fullpage", "fullwidth", "real", "default"] | float - page_layout: PageLayout | None - def set_display_mode( - self, - zoom: Literal["fullpage", "fullwidth", "real", "default"] | float, - layout: Literal["single", "continuous", "two", "default"] = "continuous", - ) -> None: ... - def set_text_shaping( - self, - use_shaping_engine: bool = True, - features: dict[str, bool] | None = None, - direction: Literal["ltr", "rtl"] | TextDirection | None = None, - script: str | None = None, - language: str | None = None, - ) -> None: ... - def set_compression(self, compress: bool) -> None: ... - def set_title(self, title: str) -> None: ... - lang: str - def set_lang(self, lang: str) -> None: ... - subject: str - def set_subject(self, subject: str) -> None: ... - author: str - def set_author(self, author: str) -> None: ... - keywords: str - def set_keywords(self, keywords: str) -> None: ... - creator: str - def set_creator(self, creator: str) -> None: ... - producer: str - def set_producer(self, producer: str) -> None: ... - def set_creation_date(self, date: datetime.datetime) -> None: ... - def set_xmp_metadata(self, xmp_metadata: str) -> None: ... - def set_doc_option(self, opt: str, value: str) -> None: ... - def set_image_filter(self, image_filter: str) -> None: ... - def alias_nb_pages(self, alias: str = "{nb}") -> None: ... - def set_page_label( - self, label_style: PageLabelStyle | str | None = None, label_prefix: str | None = None, label_start: int | None = None - ) -> None: ... - def add_page( - self, - orientation: _Orientation = "", - format: _Format | tuple[float, float] = "", - same: bool = False, - duration: float = 0, - transition: Transition | None = None, - label_style: PageLabelStyle | str | None = None, - label_prefix: str | None = None, - label_start: int | None = None, - ) -> None: ... - def header(self) -> None: ... - def footer(self) -> None: ... - def page_no(self) -> int: ... - def get_page_label(self) -> str: ... - def set_draw_color(self, r: int, g: int = -1, b: int = -1) -> None: ... - def set_fill_color(self, r: int, g: int = -1, b: int = -1) -> None: ... - def set_text_color(self, r: int, g: int = -1, b: int = -1) -> None: ... - def get_string_width(self, s: str, normalized: bool = False, markdown: bool = False) -> float: ... - def set_line_width(self, width: float) -> None: ... - def set_page_background(self, background) -> None: ... - def drawing_context(self, debug_stream=None) -> _GeneratorContextManager[DrawingContext]: ... - def new_path( - self, x: float = 0, y: float = 0, paint_rule: PathPaintRule = ..., debug_stream=None - ) -> _GeneratorContextManager[PaintedPath]: ... - def draw_path(self, path: PaintedPath, debug_stream=None) -> None: ... - def set_dash_pattern(self, dash: float = 0, gap: float = 0, phase: float = 0) -> None: ... - def line(self, x1: float, y1: float, x2: float, y2: float) -> None: ... - def polyline( - self, - point_list: list[tuple[float, float]], - fill: bool = False, - polygon: bool = False, - style: RenderStyle | str | None = None, - ) -> None: ... - def polygon( - self, point_list: list[tuple[float, float]], fill: bool = False, style: RenderStyle | str | None = None - ) -> None: ... - def dashed_line(self, x1, y1, x2, y2, dash_length: int = 1, space_length: int = 1) -> None: ... - def rect( - self, - x: float, - y: float, - w: float, - h: float, - style: RenderStyle | str | None = None, - round_corners: tuple[str, ...] | tuple[Corner, ...] | bool = False, - corner_radius: float = 0, - ) -> None: ... - def ellipse(self, x: float, y: float, w: float, h: float, style: RenderStyle | str | None = None) -> None: ... - def circle(self, x: float, y: float, radius: float, style: RenderStyle | str | None = None) -> None: ... - def regular_polygon( - self, - x: float, - y: float, - numSides: int, - polyWidth: float, - rotateDegrees: float = 0, - style: RenderStyle | str | None = None, - ): ... - def star( - self, - x: float, - y: float, - r_in: float, - r_out: float, - corners: int, - rotate_degrees: float = 0, - style: RenderStyle | str | None = None, - ): ... - def arc( - self, - x: float, - y: float, - a: float, - start_angle: float, - end_angle: float, - b: float | None = None, - inclination: float = 0, - clockwise: bool = False, - start_from_center: bool = False, - end_at_center: bool = False, - style: RenderStyle | str | None = None, - ) -> None: ... - def solid_arc( - self, - x: float, - y: float, - a: float, - start_angle: float, - end_angle: float, - b: float | None = None, - inclination: float = 0, - clockwise: bool = False, - style: RenderStyle | str | None = None, - ) -> None: ... - def bezier( - self, - point_list: Sequence[tuple[int, int]], - closed: bool = False, - style: RenderStyle | Literal["D", "F", "DF", "FD"] | None = None, - ) -> None: ... - def use_pattern(self, shading) -> _GeneratorContextManager[None]: ... - def add_font( - self, - family: str | None = None, - style: _FontStyle = "", - fname: str | PurePath | None = None, - uni: bool | Literal["DEPRECATED"] = "DEPRECATED", - ) -> None: ... - def set_font(self, family: str | None = None, style: _FontStyles | TextEmphasis = "", size: int = 0) -> None: ... - def set_font_size(self, size: float) -> None: ... - def set_char_spacing(self, spacing: float) -> None: ... - def set_stretching(self, stretching: float) -> None: ... - def set_fallback_fonts(self, fallback_fonts: Iterable[str], exact_match: bool = True) -> None: ... - def add_link(self, y: float = 0, x: float = 0, page: int = -1, zoom: float | Literal["null"] = "null") -> int: ... - def set_link(self, link, y: float = 0, x: float = 0, page: int = -1, zoom: float | Literal["null"] = "null") -> None: ... - def link( - self, - x: float, - y: float, - w: float, - h: float, - link: str | int, - alt_text: str | None = None, - *, - border_width: int = 0, - **kwargs, # accepts AnnotationDict arguments - ) -> AnnotationDict: ... - def embed_file( - self, - file_path: StrPath | None = None, - bytes: bytes | None = None, - basename: str | None = None, - modification_date: datetime.datetime | None = None, - *, - creation_date: datetime.datetime | None = ..., - desc: str = ..., - compress: bool = ..., - checksum: bool = ..., - ) -> str: ... - def file_attachment_annotation( - self, - file_path: StrPath, - x: float, - y: float, - w: float = 1, - h: float = 1, - name: FileAttachmentAnnotationName | str | None = None, - flags: Iterable[AnnotationFlag | str] = ..., - *, - bytes: bytes | None = ..., - basename: str | None = ..., - creation_date: datetime.datetime | None = ..., - modification_date: datetime.datetime | None = ..., - desc: str = ..., - compress: bool = ..., - checksum: bool = ..., - ) -> AnnotationDict: ... - def text_annotation( - self, - x: float, - y: float, - text: str, - w: float = 1, - h: float = 1, - name: AnnotationName | str | None = None, - *, - flags: tuple[AnnotationFlag, ...] | tuple[str, ...] = ..., - **kwargs, # accepts AnnotationDict arguments - ) -> AnnotationDict: ... - def free_text_annotation( - self, - text: str, - x: float | None = None, - y: float | None = None, - w: float | None = None, - h: float | None = None, - *, - flags: tuple[AnnotationFlag, ...] | tuple[str, ...] = ..., - **kwargs, # accepts AnnotationDict arguments - ) -> AnnotationDict: ... - def add_action( - self, action, x: float, y: float, w: float, h: float, **kwargs # accepts AnnotationDict arguments - ) -> AnnotationDict: ... - def highlight( - self, - text: str, - type: TextMarkupType | str = "Highlight", - color: tuple[float, float, float] = (1, 1, 0), - modification_time: datetime.datetime | None = None, - *, - title: str | None = None, - **kwargs, # accepts AnnotationDict arguments - ) -> _GeneratorContextManager[None]: ... - add_highlight = highlight - def add_text_markup_annotation( - self, - type: str, - text: str, - quad_points: Sequence[int], - color: tuple[float, float, float] = (1, 1, 0), - modification_time: datetime.datetime | None = None, - page: int | None = None, - *, - title: str | None = None, - **kwargs, # accepts AnnotationDict arguments - ) -> AnnotationDict: ... - def ink_annotation( - self, - coords: Iterable[Incomplete], - text: str = "", - color: Sequence[float] = (1, 1, 0), - border_width: float = 1, - *, - title: str | None = None, - **kwargs, # accepts AnnotationDict arguments - ) -> AnnotationDict: ... - def text(self, x: float, y: float, text: str = "") -> None: ... - def rotate(self, angle: float, x: float | None = None, y: float | None = None) -> None: ... - def rotation(self, angle: float, x: float | None = None, y: float | None = None) -> _GeneratorContextManager[None]: ... - def skew( - self, ax: float = 0, ay: float = 0, x: float | None = None, y: float | None = None - ) -> _GeneratorContextManager[None]: ... - def mirror(self, origin, angle) -> Generator[None]: ... - def local_context( - self, - *, - font_family=None, - font_style=None, - font_size_pt=None, - line_width=None, - draw_color=None, - fill_color=None, - text_color=None, - dash_pattern=None, - font_size=..., # semi-deprecated, prefer font_size_pt - char_vpos=..., - char_spacing=..., - current_font=..., - denom_lift=..., - denom_scale=..., - font_stretching=..., - nom_lift=..., - nom_scale=..., - sub_lift=..., - sub_scale=..., - sup_lift=..., - sup_scale=..., - text_mode=..., - text_shaping=..., - underline=..., - paint_rule=..., - allow_transparency=..., - auto_close=..., - intersection_rule=..., - fill_opacity=..., - stroke_color=..., - stroke_opacity=..., - blend_mode=..., - stroke_width=..., - stroke_cap_style=..., - stroke_join_style=..., - stroke_miter_limit=..., - stroke_dash_pattern=..., - stroke_dash_phase=..., - ) -> _GeneratorContextManager[None]: ... - @property - def accept_page_break(self) -> bool: ... - def cell( - self, - w: float | None = None, - h: float | None = None, - text: str = "", - border: bool | Literal[0, 1] | str = 0, - ln: int | Literal["DEPRECATED"] = "DEPRECATED", - align: str | Align = ..., - fill: bool = False, - link: str | int = "", - center: bool = False, - markdown: bool = False, - new_x: XPos | str = ..., - new_y: YPos | str = ..., - ) -> bool: ... - def get_fallback_font(self, char: str, style: str = "") -> str | None: ... - def will_page_break(self, height: float) -> bool: ... - def multi_cell( - self, - w: float, - h: float | None = None, - text: str = "", - border: bool | Literal[0, 1] | str = 0, - align: str | Align = ..., - fill: bool = False, - split_only: bool = False, - link: str | int = "", - ln: int | Literal["DEPRECATED"] = "DEPRECATED", - max_line_height: float | None = None, - markdown: bool = False, - print_sh: bool = False, - new_x: XPos | str = ..., - new_y: YPos | str = ..., - wrapmode: WrapMode = ..., - dry_run: bool = False, - output: MethodReturnValue | str | int = ..., - center: bool = False, - padding: int = 0, - ): ... - def write( - self, h: float | None = None, text: str = "", link: str | int = "", print_sh: bool = False, wrapmode: WrapMode = ... - ) -> bool: ... - def text_columns( - self, - text: str | None = None, - img: str | None = None, - img_fill_width: bool = False, - ncols: int = 1, - gutter: float = 10, - balance: bool = False, - text_align: str | _TextAlign | tuple[_TextAlign | str, ...] = "LEFT", - line_height: float = 1, - l_margin: float | None = None, - r_margin: float | None = None, - print_sh: bool = False, - wrapmode: WrapMode = ..., - skip_leading_spaces: bool = False, - ): ... - def image( - self, - name: str | Image.Image | BytesIO | StrPath, - x: float | Align | None = None, - y: float | None = None, - w: float = 0, - h: float = 0, - type: str = "", - link: str | int = "", - title: str | None = None, - alt_text: str | None = None, - dims: tuple[float, float] | None = None, - keep_aspect_ratio: bool = False, - ) -> RasterImageInfo | VectorImageInfo: ... - def x_by_align(self, x: _Align, w: int, h: int, img_info: ImageInfo, keep_aspect_ratio: bool) -> int: ... - @deprecated("Deprecated since 2.7.7; use fpdf.image_parsing.preload_image() instead") - def preload_image( - self, name: str | Image.Image | BytesIO, dims: tuple[float, float] | None = None - ) -> tuple[str, Any, ImageInfo]: ... - def ln(self, h: float | None = None) -> None: ... - def get_x(self) -> float: ... - def set_x(self, x: float) -> None: ... - def get_y(self) -> float: ... - def set_y(self, y: float) -> None: ... - def set_xy(self, x: float, y: float) -> None: ... - def normalize_text(self, text: str) -> str: ... - def sign_pkcs12( - self, - pkcs_filepath: str, - password: bytes | None = None, - hashalgo: str = "sha256", - contact_info: str | None = None, - location: str | None = None, - signing_time: datetime.datetime | None = None, - reason: str | None = None, - flags: tuple[AnnotationFlag, ...] = ..., - ) -> None: ... - def sign( - self, - key, - cert, - extra_certs: Sequence[Incomplete] = (), - hashalgo: str = "sha256", - contact_info: str | None = None, - location: str | None = None, - signing_time: datetime.datetime | None = None, - reason: str | None = None, - flags: tuple[AnnotationFlag, ...] = ..., - ) -> None: ... - def file_id(self) -> str: ... - def interleaved2of5(self, text, x: float, y: float, w: float = 1, h: float = 10) -> None: ... - def code39(self, text, x: float, y: float, w: float = 1.5, h: float = 5) -> None: ... - def rect_clip(self, x: float, y: float, w: float, h: float) -> _GeneratorContextManager[None]: ... - def elliptic_clip(self, x: float, y: float, w: float, h: float) -> _GeneratorContextManager[None]: ... - def round_clip(self, x: float, y: float, r: float) -> _GeneratorContextManager[None]: ... - def unbreakable(self) -> _GeneratorContextManager[FPDFRecorder]: ... - def offset_rendering(self) -> _GeneratorContextManager[FPDFRecorder]: ... - def insert_toc_placeholder( - self, - render_toc_function: Callable[[FPDF, list[OutlineSection]], object], - pages: int = 1, - allow_extra_pages: bool = False, - reset_page_indices: bool = True, - ) -> None: ... - def set_section_title_styles( - self, - level0: TextStyle, - level1: TextStyle | None = None, - level2: TextStyle | None = None, - level3: TextStyle | None = None, - level4: TextStyle | None = None, - level5: TextStyle | None = None, - level6: TextStyle | None = None, - ) -> None: ... - def start_section(self, name: str, level: int = 0, strict: bool = True) -> None: ... - def use_text_style(self, text_style: TextStyle) -> _GeneratorContextManager[None]: ... - def use_font_face(self, font_face: FontFace) -> _GeneratorContextManager[None]: ... - def table( - self, - rows: Iterable[Incomplete] = (), - *, - # Keep in sync with `fpdf.table.Table`: - align: str | _TextAlign = "CENTER", - v_align: str | VAlign = "MIDDLE", - borders_layout: str | TableBordersLayout = ..., - cell_fill_color: int | tuple[Incomplete, ...] | DeviceGray | DeviceRGB | None = None, - cell_fill_mode: str | TableCellFillMode = ..., - col_widths: int | tuple[int, ...] | None = None, - first_row_as_headings: bool = True, - gutter_height: float = 0, - gutter_width: float = 0, - headings_style: FontFace = ..., - line_height: int | None = None, - markdown: bool = False, - text_align: str | _TextAlign | tuple[str | _TextAlign, ...] = "JUSTIFY", - width: int | None = None, - wrapmode: WrapMode = ..., - padding: float | Padding | None = None, - outer_border_width: float | None = None, - num_heading_rows: int = 1, - repeat_headings: TableHeadingsDisplay | int = 1, - ) -> _GeneratorContextManager[Table]: ... - - @overload - def output( # type: ignore[overload-overlap] - self, - name: Literal[""] | None = "", - dest: Unused = "", - linearize: bool = False, - output_producer_class: Callable[[FPDF], OutputProducer] = ..., - ) -> bytearray: ... - @overload - def output( - self, name: str, dest: Unused = "", linearize: bool = False, output_producer_class: Callable[[FPDF], OutputProducer] = ... - ) -> None: ... diff --git a/stubs/fpdf2/fpdf/graphics_state.pyi b/stubs/fpdf2/fpdf/graphics_state.pyi deleted file mode 100644 index 39972466774e..000000000000 --- a/stubs/fpdf2/fpdf/graphics_state.pyi +++ /dev/null @@ -1,155 +0,0 @@ -from typing import Any, ClassVar, Final, Literal, TypedDict, type_check_only - -from .drawing import DeviceGray, DeviceRGB -from .enums import TextMode -from .fonts import FontFace - -@type_check_only -class _TextShaping(TypedDict): - use_shaping_engine: bool - features: dict[str, bool] - direction: Literal["ltr", "rtl"] - script: str | None - language: str | None - fragment_direction: Literal["L", "R"] | None - paragraph_direction: Literal["L", "R"] | None - -class GraphicsStateMixin: - DEFAULT_DRAW_COLOR: ClassVar[DeviceGray] - DEFAULT_FILL_COLOR: ClassVar[DeviceGray] - DEFAULT_TEXT_COLOR: ClassVar[DeviceGray] - def __init__(self, *args, **kwargs) -> None: ... - - @property - def draw_color(self) -> DeviceGray | DeviceRGB: ... - @draw_color.setter - def draw_color(self, v: DeviceGray | DeviceRGB) -> None: ... - - @property - def fill_color(self) -> DeviceGray | DeviceRGB: ... - @fill_color.setter - def fill_color(self, v: DeviceGray | DeviceRGB) -> None: ... - - @property - def text_color(self) -> DeviceGray | DeviceRGB: ... - @text_color.setter - def text_color(self, v: DeviceGray | DeviceRGB) -> None: ... - - @property - def underline(self) -> bool: ... - @underline.setter - def underline(self, v: bool) -> None: ... - - @property - def strikethrough(self) -> bool: ... - @strikethrough.setter - def strikethrough(self, v: bool) -> None: ... - - @property - def font_style(self) -> str: ... - @font_style.setter - def font_style(self, v: str) -> None: ... - - @property - def font_stretching(self) -> float: ... - @font_stretching.setter - def font_stretching(self, v: float) -> None: ... - - @property - def char_spacing(self) -> float: ... - @char_spacing.setter - def char_spacing(self, v: float) -> None: ... - - @property - def font_family(self) -> str: ... - @font_family.setter - def font_family(self, v: str) -> None: ... - - @property - def font_size_pt(self) -> float: ... - @font_size_pt.setter - def font_size_pt(self, v: float) -> None: ... - - @property - def font_size(self) -> float: ... - @font_size.setter - def font_size(self, v: float) -> None: ... - - @property - def current_font(self) -> dict[str, Any]: ... - @current_font.setter - def current_font(self, v: dict[str, Any]) -> None: ... - - @property - def current_font_is_set_on_page(self) -> bool: ... - @current_font_is_set_on_page.setter - def current_font_is_set_on_page(self, v: bool) -> None: ... - - @property - def dash_pattern(self) -> dict[str, float]: ... - @dash_pattern.setter - def dash_pattern(self, v: dict[str, float]) -> None: ... - - @property - def line_width(self) -> float: ... - @line_width.setter - def line_width(self, v: float) -> None: ... - - @property - def text_mode(self) -> TextMode: ... - @text_mode.setter - def text_mode(self, v: int | str) -> None: ... - - @property - def char_vpos(self): ... - @char_vpos.setter - def char_vpos(self, v) -> None: ... - - @property - def sub_scale(self): ... - @sub_scale.setter - def sub_scale(self, v) -> None: ... - - @property - def sup_scale(self): ... - @sup_scale.setter - def sup_scale(self, v) -> None: ... - - @property - def nom_scale(self): ... - @nom_scale.setter - def nom_scale(self, v) -> None: ... - - @property - def denom_scale(self): ... - @denom_scale.setter - def denom_scale(self, v) -> None: ... - - @property - def sub_lift(self): ... - @sub_lift.setter - def sub_lift(self, v) -> None: ... - - @property - def sup_lift(self): ... - @sup_lift.setter - def sup_lift(self, v) -> None: ... - - @property - def nom_lift(self): ... - @nom_lift.setter - def nom_lift(self, v) -> None: ... - - @property - def denom_lift(self): ... - @denom_lift.setter - def denom_lift(self, v) -> None: ... - - @property - def text_shaping(self) -> _TextShaping | None: ... - @text_shaping.setter - def text_shaping(self, v: _TextShaping | None) -> None: ... - - def font_face(self) -> FontFace: ... - -__pdoc__: Final[dict[str, bool]] diff --git a/stubs/fpdf2/fpdf/html.pyi b/stubs/fpdf2/fpdf/html.pyi deleted file mode 100644 index a838697b0d69..000000000000 --- a/stubs/fpdf2/fpdf/html.pyi +++ /dev/null @@ -1,96 +0,0 @@ -from _typeshed import Incomplete, SupportsKeysAndGetItem -from collections.abc import Callable, Iterable, Mapping -from html.parser import HTMLParser -from logging import Logger -from typing import ClassVar, Final, Literal, TypeAlias - -from fpdf import FPDF - -from .enums import Align, TextEmphasis -from .fonts import FontFace -from .table import Row, Table - -__author__: Final[str] -__copyright__: Final[str] - -_OLType: TypeAlias = Literal["1", "a", "A", "I", "i"] - -LOGGER: Logger -MESSAGE_WAITING_WIN1252: Final = "\x95" -BULLET_UNICODE: Final = "•" -DEGREE_SIGN_WIN1252: Final = "\xb0" -RING_OPERATOR_UNICODE: Final = "∘" -HEADING_TAGS: Final[tuple[str, ...]] -DEFAULT_TAG_STYLES: Final[dict[str, FontFace]] -INLINE_TAGS: Final[tuple[str, ...]] -BLOCK_TAGS: Final[tuple[str, ...]] - -COLOR_DICT: Final[dict[str, str]] - -def color_as_decimal(color: str | None = "#000000") -> tuple[int, int, int] | None: ... -def parse_css_style(style_attr: str) -> dict[str, str]: ... - -class HTML2FPDF(HTMLParser): - HTML_UNCLOSED_TAGS: ClassVar[tuple[str, ...]] - TABLE_LINE_HEIGHT: ClassVar[float] - - pdf: FPDF - image_map: Callable[[str], str] - ul_bullet_char: str - li_prefix_color: tuple[int, int, int] - warn_on_tags_not_matching: bool - - font_family: str - font_size_pt: float - font_emphasis: TextEmphasis - font_color: tuple[int, int, int] - - style_stack: list[FontFace] - h: float - follows_trailing_space: bool - follows_heading: bool - href: str - align: float | Align | None - indent: int - line_height_stack: list[Incomplete] - ol_type: dict[int, _OLType] - bullet: list[Incomplete] - heading_level: Incomplete | None - render_title_tag: bool - table_line_separators: bool - table: Table | None - table_row: Row | None - tr: dict[str, str] | None - td_th: dict[str, str] | None - tag_indents: dict[str, int] - tag_styles: dict[str, FontFace] - - def __init__( - self, - pdf: FPDF, - image_map: Callable[[str], str] | None = None, - li_tag_indent: int | None = None, - dd_tag_indent: int | None = None, - table_line_separators: bool = False, - ul_bullet_char: str = "disc", - li_prefix_color: tuple[int, int, int] = (190, 0, 0), - heading_sizes: SupportsKeysAndGetItem[str, int] | Iterable[tuple[str, int]] | None = None, - pre_code_font: str | None = None, - warn_on_tags_not_matching: bool = True, - tag_indents: dict[str, int] | None = None, - tag_styles: Mapping[str, FontFace] | None = None, - font_family: str = "times", - render_title_tag: bool = False, - ) -> None: ... - def handle_data(self, data) -> None: ... - def handle_starttag(self, tag, attrs) -> None: ... - def handle_endtag(self, tag) -> None: ... - def put_link(self, text) -> None: ... - def render_toc(self, pdf, outline) -> None: ... - def error(self, message: str) -> None: ... - -def ul_prefix(ul_type: str, is_ttf_font: bool | None) -> str: ... -def ol_prefix(ol_type: _OLType, index: int) -> str: ... - -class HTMLMixin: - def __init__(self, *args, **kwargs) -> None: ... diff --git a/stubs/fpdf2/fpdf/image_datastructures.pyi b/stubs/fpdf2/fpdf/image_datastructures.pyi deleted file mode 100644 index a45a50ee8e7b..000000000000 --- a/stubs/fpdf2/fpdf/image_datastructures.pyi +++ /dev/null @@ -1,56 +0,0 @@ -from _typeshed import Incomplete -from dataclasses import dataclass -from typing import Any, Literal, TypeAlias - -from fpdf.enums import Align - -from .image_parsing import _ImageFilter - -_AlignLiteral: TypeAlias = Literal[ - "", - "CENTER", - "X_CENTER", - "LEFT", - "RIGHT", - "JUSTIFY", - "center", - "x_center", - "left", - "right", - "justify", - "C", - "X", - "L", - "R", - "J", - "c", - "x", - "l", - "r", - "j", -] -_TextAlign: TypeAlias = Align | _AlignLiteral # noqa: Y047 - -class ImageInfo(dict[str, Any]): - @property - def width(self) -> int: ... - @property - def height(self) -> int: ... - @property - def rendered_width(self) -> int: ... - @property - def rendered_height(self) -> int: ... - def scale_inside_box(self, x: float, y: float, w: float, h: float) -> tuple[float, float, float, float]: ... - -class RasterImageInfo(ImageInfo): - def size_in_document_units(self, w: float, h: float, scale=1) -> tuple[float, float]: ... - -class VectorImageInfo(ImageInfo): ... - -@dataclass -class ImageCache: - images: dict[str, dict[Incomplete, Incomplete]] = ... - icc_profiles: dict[bytes, int] = ... - image_filter: _ImageFilter = "AUTO" - - def reset_usages(self) -> None: ... diff --git a/stubs/fpdf2/fpdf/image_parsing.pyi b/stubs/fpdf2/fpdf/image_parsing.pyi deleted file mode 100644 index 0d131c1338b2..000000000000 --- a/stubs/fpdf2/fpdf/image_parsing.pyi +++ /dev/null @@ -1,58 +0,0 @@ -from collections.abc import Iterable -from dataclasses import dataclass -from io import BytesIO -from logging import Logger -from types import TracebackType -from typing import Any, Final, Literal, TypeAlias - -from PIL import Image - -from .image_datastructures import ImageCache, ImageInfo, VectorImageInfo -from .svg import SVGObject - -_ImageFilter: TypeAlias = Literal["AUTO", "FlateDecode", "DCTDecode", "JPXDecode", "LZWDecode"] - -RESAMPLE: Image.Resampling - -@dataclass -class ImageSettings: - compression_level: int = -1 - -LOGGER: Logger -SUPPORTED_IMAGE_FILTERS: tuple[_ImageFilter, ...] -SETTINGS: ImageSettings - -TIFFBitRevTable: list[int] - -LZW_CLEAR_TABLE_MARKER: Final = 256 -LZW_EOD_MARKER: Final = 257 -LZW_INITIAL_BITS_PER_CODE: Final = 9 -LZW_MAX_BITS_PER_CODE: Final = 12 - -def preload_image( - image_cache: ImageCache, name: str | BytesIO | Image.Image, dims: tuple[float, float] | None = None -) -> tuple[str, BytesIO | Image.Image | None, ImageInfo]: ... -def load_image(filename): ... -def is_iccp_valid(iccp, filename) -> bool: ... -def get_svg_info(filename: str, img: BytesIO, image_cache: ImageCache) -> tuple[str, SVGObject, VectorImageInfo]: ... - -# Returned dict could be typed as a TypedDict. -def get_img_info( - filename, img: BytesIO | Image.Image | None = None, image_filter: _ImageFilter = "AUTO", dims=None -) -> dict[str, Any]: ... - -class temp_attr: - obj: Any - field: str - value: Any - exists: bool # defined after __enter__ is called - def __init__(self, obj: Any, field: str, value: Any) -> None: ... - def __enter__(self) -> None: ... - def __exit__( - self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None - ) -> None: ... - -def ccitt_payload_location_from_pil(img: Image.Image) -> tuple[int, int]: ... -def transcode_monochrome(img: Image.Image): ... -def pack_codes_into_bytes(codes: Iterable[int]) -> bytes: ... -def clear_table() -> tuple[dict[bytes, int], int, int, int]: ... diff --git a/stubs/fpdf2/fpdf/line_break.pyi b/stubs/fpdf2/fpdf/line_break.pyi deleted file mode 100644 index 3ba2ee5a57f9..000000000000 --- a/stubs/fpdf2/fpdf/line_break.pyi +++ /dev/null @@ -1,172 +0,0 @@ -from _typeshed import Incomplete -from collections.abc import Callable, Sequence -from typing import Final, NamedTuple -from uuid import UUID - -from .enums import Align, TextDirection, WrapMode - -SOFT_HYPHEN: Final[str] -HYPHEN: Final[str] -SPACE: Final[str] -BREAKING_SPACE_SYMBOLS: Final[list[str]] -BREAKING_SPACE_SYMBOLS_STR: Final[str] -NBSP: Final[str] -NEWLINE: Final[str] -FORM_FEED: Final[str] - -class Fragment: - characters: list[str] - graphics_state: dict[str, Incomplete] - k: float - url: str | None - def __init__( - self, characters: list[str] | str, graphics_state: dict[str, Incomplete], k: float, link: str | int | None = None - ) -> None: ... - - @property - def font(self): ... - @font.setter - def font(self, v) -> None: ... - - @property - def is_ttf_font(self): ... - @property - def font_style(self): ... - @property - def font_family(self): ... - @property - def font_size_pt(self): ... - @property - def font_size(self): ... - @property - def font_stretching(self): ... - @property - def char_spacing(self): ... - @property - def text_mode(self): ... - @property - def underline(self) -> bool: ... - @property - def strikethrough(self) -> bool: ... - @property - def draw_color(self): ... - @property - def fill_color(self): ... - @property - def text_color(self): ... - @property - def line_width(self): ... - @property - def char_vpos(self): ... - @property - def lift(self): ... - @property - def string(self) -> str: ... - @property - def width(self) -> float: ... - @property - def text_shaping_parameters(self): ... - @property - def paragraph_direction(self) -> TextDirection: ... - @property - def fragment_direction(self) -> TextDirection: ... - def trim(self, index: int) -> None: ... - def __eq__(self, other: Fragment) -> bool: ... # type: ignore[override] - def get_width(self, start: int = 0, end: int | None = None, chars: str | None = None, initial_cs: bool = True) -> float: ... - def has_same_style(self, other: Fragment) -> bool: ... - def get_character_width(self, character: str, print_sh: bool = False, initial_cs: bool = True): ... - def render_pdf_text(self, frag_ws, current_ws, word_spacing, adjust_x, adjust_y, h): ... - def render_pdf_text_ttf(self, frag_ws, word_spacing): ... - def render_with_text_shaping(self, pos_x: float, pos_y: float, h: float, word_spacing: float) -> str: ... - def render_pdf_text_core(self, frag_ws, current_ws): ... - -class TotalPagesSubstitutionFragment(Fragment): - uuid: UUID - def get_placeholder_string(self) -> str: ... - def render_text_substitution(self, replacement_text: str) -> str: ... - -class TextLine(NamedTuple): - fragments: tuple[Fragment, ...] - text_width: float - number_of_spaces: int - align: Align - height: float - max_width: float - trailing_nl: bool = False - trailing_form_feed: bool = False - indent: float = 0 - def get_ordered_fragments(self) -> tuple[Fragment, ...]: ... - -class SpaceHint(NamedTuple): - original_fragment_index: int - original_character_index: int - current_line_fragment_index: int - current_line_character_index: int - line_width: float - number_of_spaces: int - -class HyphenHint(NamedTuple): - original_fragment_index: int - original_character_index: int - current_line_fragment_index: int - current_line_character_index: int - line_width: float - number_of_spaces: int - curchar: str - curchar_width: float - graphics_state: dict[str, Incomplete] - k: float - -class CurrentLine: - max_width: float - print_sh: bool - indent: float - fragments: list[Fragment] - height: int - number_of_spaces: int - space_break_hint: Incomplete - hyphen_break_hint: Incomplete - def __init__(self, max_width: float, print_sh: bool = False, indent: float = 0) -> None: ... - @property - def width(self) -> float: ... - def add_character( - self, - character: str, - character_width: float, - original_fragment: Fragment, - original_fragment_index: int, - original_character_index: int, - height: float, - url: str | None = None, - ) -> None: ... - def trim_trailing_spaces(self) -> None: ... - def manual_break(self, align: Align, trailing_nl: bool = False, trailing_form_feed: bool = False) -> TextLine: ... - def automatic_break_possible(self) -> bool: ... - def automatic_break(self, align: Align) -> tuple[Incomplete, Incomplete, TextLine]: ... - -class MultiLineBreak: - fragments: Sequence[Fragment] - get_width: float - margins: Sequence[float] - align: Align - print_sh: bool - wrapmode: WrapMode - line_height: float - skip_leading_spaces: bool - fragment_index: int - character_index: int - idx_last_forced_break: int | None - first_line_indent: float - def __init__( - self, - fragments: Sequence[Fragment], - max_width: float | Callable[[float], float], - margins: Sequence[float], - align: Align = ..., - print_sh: bool = False, - wrapmode: WrapMode = ..., - line_height: float = 1.0, - skip_leading_spaces: bool = False, - first_line_indent: float = 0, - ) -> None: ... - def get_line(self) -> TextLine: ... diff --git a/stubs/fpdf2/fpdf/linearization.pyi b/stubs/fpdf2/fpdf/linearization.pyi deleted file mode 100644 index 479a6b8d547c..000000000000 --- a/stubs/fpdf2/fpdf/linearization.pyi +++ /dev/null @@ -1,54 +0,0 @@ -from _typeshed import Incomplete -from typing import Final - -from .encryption import StandardSecurityHandler -from .output import ContentWithoutID, OutputProducer -from .syntax import PDFContentStream, PDFObject - -HINT_STREAM_OFFSET_LENGTH_PLACEHOLDER: Final[str] -FIRST_PAGE_END_OFFSET_PLACEHOLDER: Final[str] -MAIN_XREF_1ST_ENTRY_OFFSET_PLACEHOLDER: Final[str] -FILE_LENGTH_PLACEHOLDER: Final[str] - -class PDFLinearization(PDFObject): - linearized: str - n: int - h: str - o: Incomplete | None - e: str - t: str - l: str - def __init__(self, pages_count: int) -> None: ... - -class PDFXrefAndTrailer(ContentWithoutID): - PREV_MAIN_XREF_START_PLACEHOLDER: str - output_builder: Incomplete - count: int - start_obj_id: int - catalog_obj: Incomplete | None - info_obj: Incomplete | None - first_xref: Incomplete | None - main_xref: Incomplete | None - startxref: Incomplete | None - def __init__(self, output_builder) -> None: ... - @property - def is_first_xref(self) -> bool: ... - @property - def is_main_xref(self) -> bool: ... - def serialize(self, _security_handler: StandardSecurityHandler | None = None) -> str: ... - -class PDFHintStream(PDFContentStream): - s: Incomplete | None - t: Incomplete | None - o: Incomplete | None - a: Incomplete | None - e: Incomplete | None - v: Incomplete | None - i: Incomplete | None - c: Incomplete | None - l: Incomplete | None - r: Incomplete | None - b: Incomplete | None - -class LinearizedOutputProducer(OutputProducer): - def bufferize(self) -> bytearray: ... diff --git a/stubs/fpdf2/fpdf/outline.pyi b/stubs/fpdf2/fpdf/outline.pyi deleted file mode 100644 index 4a26d8ee0982..000000000000 --- a/stubs/fpdf2/fpdf/outline.pyi +++ /dev/null @@ -1,61 +0,0 @@ -from _typeshed import Incomplete -from collections.abc import Generator, Iterable -from dataclasses import dataclass - -from .fonts import TextStyle -from .fpdf import FPDF -from .structure_tree import StructElem -from .syntax import Destination, PDFObject, PDFString - -@dataclass -class OutlineSection: - __slots__ = ("name", "level", "page_number", "dest", "struct_elem") - name: str - level: int - page_number: int - dest: Destination - struct_elem: StructElem | None = None - -class OutlineItemDictionary(PDFObject): - __slots__ = ("_id", "title", "parent", "prev", "next", "first", "last", "count", "dest", "struct_elem") - title: PDFString - parent: Incomplete | None - prev: Incomplete | None - next: Incomplete | None - first: Incomplete | None - last: Incomplete | None - count: int - dest: Destination | None - struct_elem: StructElem | None - def __init__(self, title: str, dest: Destination | None = None, struct_elem: StructElem | None = None) -> None: ... - -class OutlineDictionary(PDFObject): - __slots__ = ("_id", "type", "first", "last", "count") - type: str - first: Incomplete | None - last: Incomplete | None - count: int - def __init__(self) -> None: ... - -def build_outline_objs( - sections: Iterable[Incomplete], -) -> Generator[Incomplete, None, list[OutlineDictionary | OutlineItemDictionary]]: ... - -class TableOfContents: - text_style: TextStyle - use_section_title_styles: bool - level_indent: float - line_spacing: float - ignore_pages_before_toc: bool - - def __init__( - self, - text_style: TextStyle | None = None, - use_section_title_styles: bool = False, - level_indent: float = 7.5, - line_spacing: float = 1.5, - ignore_pages_before_toc: bool = True, - ) -> None: ... - def get_text_style(self, pdf: FPDF, item: OutlineSection) -> TextStyle: ... - def render_toc_item(self, pdf: FPDF, item: OutlineSection) -> None: ... - def render_toc(self, pdf: FPDF, outline: Iterable[OutlineSection]) -> None: ... diff --git a/stubs/fpdf2/fpdf/output.pyi b/stubs/fpdf2/fpdf/output.pyi deleted file mode 100644 index 86c1b56c855e..000000000000 --- a/stubs/fpdf2/fpdf/output.pyi +++ /dev/null @@ -1,271 +0,0 @@ -from _typeshed import Incomplete, Unused -from collections import defaultdict -from logging import Logger -from typing import Final - -from .annotations import AnnotationDict -from .encryption import StandardSecurityHandler -from .enums import OutputIntentSubType, PageLabelStyle, PDFResourceType -from .fpdf import FPDF -from .image_datastructures import RasterImageInfo -from .line_break import TotalPagesSubstitutionFragment -from .syntax import Name, PDFArray, PDFContentStream, PDFObject, PDFString - -LOGGER: Logger -ZOOM_CONFIGS: Final[dict[str, tuple[str, ...]]] - -class ContentWithoutID: - def serialize(self, _security_handler: StandardSecurityHandler | None = None) -> str | None: ... - -class PDFHeader(ContentWithoutID): - pdf_version: str - def __init__(self, pdf_version: str) -> None: ... - def serialize(self, _security_handler: StandardSecurityHandler | None = None) -> str: ... - -class PDFFont(PDFObject): - type: Name - subtype: Name - base_font: Name - encoding: Name | None - d_w: Incomplete | None - w: Incomplete | None - descendant_fonts: Incomplete | None - to_unicode: Incomplete | None - c_i_d_system_info: Incomplete | None - font_descriptor: Incomplete | None - c_i_d_to_g_i_d_map: Incomplete | None - def __init__(self, subtype: str, base_font: str, encoding: str | None = None, d_w=None, w=None) -> None: ... - -class CIDSystemInfo(PDFObject): - registry: PDFString - ordering: PDFString - supplement: int - -class PDFInfo(PDFObject): - title: str | None - subject: str | None - author: str | None - keywords: str | None - creator: str | None - producer: str | None - creation_date: Incomplete - def __init__( - self, - title: str | None, - subject: str | None, - author: str | None, - keywords: str | None, - creator: str | None, - producer: str | None, - creation_date, - ) -> None: ... - -class AcroForm: - fields: Incomplete - sig_flags: Incomplete - def __init__(self, fields, sig_flags) -> None: ... - def serialize(self) -> str: ... - -class PDFCatalog(PDFObject): - type: Name - lang: str | None - page_layout: Incomplete | None - page_mode: Incomplete | None - viewer_preferences: Incomplete | None - pages: Incomplete | None - acro_form: Incomplete | None - open_action: Incomplete | None - mark_info: Incomplete | None - metadata: Incomplete | None - names: Incomplete | None - outlines: Incomplete | None - output_intents: Incomplete | None - struct_tree_root: Incomplete | None - def __init__(self, lang: str | None = None, page_layout=None, page_mode=None, viewer_preferences=None) -> None: ... - -class PDFResources(PDFObject): - proc_set: Incomplete - font: Incomplete - x_object: Incomplete - ext_g_state: Incomplete - shading: Incomplete - pattern: Incomplete - def __init__(self, proc_set, font, x_object, ext_g_state, shading, pattern) -> None: ... - -class PDFFontStream(PDFContentStream): - length1: int - def __init__(self, contents: bytes) -> None: ... - -class PDFXmpMetadata(PDFContentStream): - type: Name - subtype: Name - def __init__(self, contents: bytes) -> None: ... - -class PDFXObject(PDFContentStream): - __slots__ = ( - "_id", - "_contents", - "filter", - "length", - "type", - "subtype", - "width", - "height", - "color_space", - "bits_per_component", - "decode", - "decode_parms", - "s_mask", - ) - type: Name - subtype: Name - width: Incomplete - height: Incomplete - color_space: Incomplete - bits_per_component: Incomplete - filter: Name - decode: Incomplete | None - decode_parms: Incomplete | None - s_mask: Incomplete | None - def __init__( - self, - contents, - subtype: str, - width, - height, - color_space, - bits_per_component, - img_filter: str | None = None, - decode=None, - decode_parms=None, - ) -> None: ... - -class PDFICCProfile(PDFContentStream): - __slots__ = ("_id", "_contents", "filter", "length", "n", "alternate") - n: Incomplete - alternate: Name - def __init__(self, contents: bytes, n, alternate: str) -> None: ... - -class PDFPageLabel: - __slots__ = ("_style", "_prefix", "st") - st: int - def __init__(self, label_style: PageLabelStyle, label_prefix: str, label_start: int) -> None: ... - @property - def s(self) -> Name: ... - @property - def p(self) -> PDFString: ... - def serialize(self) -> dict[str, str]: ... - def get_style(self) -> PageLabelStyle: ... - def get_prefix(self) -> str: ... - def get_start(self) -> int: ... - -class PDFPage(PDFObject): - __slots__ = ( - "_id", - "type", - "contents", - "dur", - "trans", - "annots", - "group", - "media_box", - "struct_parents", - "resources", - "parent", - "_index", - "_width_pt", - "_height_pt", - "_page_label", - "_text_substitution_fragments", - ) - type: Name - contents: Incomplete - dur: Incomplete | None - trans: Incomplete - annots: PDFArray[AnnotationDict] - group: Incomplete | None - media_box: Incomplete | None - struct_parents: Incomplete | None - resources: Incomplete | None - parent: Incomplete | None - def __init__(self, duration: Incomplete | None, transition, contents, index) -> None: ... - def index(self) -> int: ... - def set_index(self, i: int) -> None: ... - def dimensions(self) -> tuple[float | None, float | None]: ... - def set_dimensions(self, width_pt: float | None, height_pt: float | None) -> None: ... - def set_page_label(self, previous_page_label: PDFPageLabel, page_label: PDFPageLabel) -> None: ... - def get_page_label(self) -> PDFPageLabel: ... - def get_label(self) -> str: ... - def get_text_substitutions(self) -> list[TotalPagesSubstitutionFragment]: ... - def add_text_substitution(self, fragment: TotalPagesSubstitutionFragment) -> None: ... - -class PDFPagesRoot(PDFObject): - type: Name - count: Incomplete - media_box: Incomplete - kids: Incomplete | None - def __init__(self, count, media_box) -> None: ... - -class PDFExtGState(PDFObject): - def __init__(self, dict_as_str) -> None: ... - def serialize(self, obj_dict: Unused = None, _security_handler: StandardSecurityHandler | None = None) -> str: ... - -class PDFXrefAndTrailer(ContentWithoutID): - output_builder: Incomplete - count: int - catalog_obj: Incomplete | None - info_obj: Incomplete | None - def __init__(self, output_builder) -> None: ... - def serialize(self, _security_handler: StandardSecurityHandler | None = None) -> str: ... - -class OutputIntentDictionary: - __slots__ = ("type", "s", "output_condition_identifier", "output_condition", "registry_name", "dest_output_profile", "info") - type: Name - s: Name - output_condition_identifier: PDFString | None - output_condition: PDFString | None - registry_name: PDFString | None - dest_output_profile: Incomplete | None - info: PDFString | None - - def __init__( - self, - subtype: OutputIntentSubType | str, - output_condition_identifier: str, - output_condition: str | None = None, - registry_name: str | None = None, - dest_output_profile: PDFICCProfile | None = None, - info: str | None = None, - ) -> None: ... - def serialize(self, _security_handler: StandardSecurityHandler | None = None, _obj_id=None): ... - -class ResourceCatalog: - resources: defaultdict[PDFResourceType, dict[Incomplete, Incomplete]] - resources_per_page: defaultdict[tuple[int, PDFResourceType], set[Incomplete]] - - def add(self, resource_type: PDFResourceType, resource, page_number: int) -> Incomplete | None: ... - def get_items(self, resource_type: PDFResourceType): ... - def get_resources_per_page(self, page_number: int, resource_type: PDFResourceType): ... - def get_used_resources(self, resource_type: PDFResourceType) -> set[Incomplete]: ... - -class OutputProducer: - fpdf: FPDF - pdf_objs: list[Incomplete] - obj_id: int - offsets: dict[Incomplete, Incomplete] - trace_labels_per_obj_id: dict[Incomplete, Incomplete] - sections_size_per_trace_label: defaultdict[Incomplete, int] - buffer: bytearray - def __init__(self, fpdf: FPDF) -> None: ... - def bufferize(self) -> bytearray: ... - -def stream_content_for_raster_image( - info: RasterImageInfo, - x: float, - y: float, - w: float, - h: float, - keep_aspect_ratio: bool = False, - scale: float = 1, - pdf_height_to_flip: float | None = None, -) -> str: ... diff --git a/stubs/fpdf2/fpdf/pattern.pyi b/stubs/fpdf2/fpdf/pattern.pyi deleted file mode 100644 index 6d0d043764c6..000000000000 --- a/stubs/fpdf2/fpdf/pattern.pyi +++ /dev/null @@ -1,104 +0,0 @@ -from _typeshed import Incomplete -from abc import ABC -from collections.abc import Iterable -from typing import Final, Literal - -from .drawing import DeviceCMYK, DeviceGray, DeviceRGB -from .fpdf import FPDF -from .syntax import Name, PDFObject - -class Pattern(PDFObject): - type: Name - pattern_type: int - def __init__(self, shading: LinearGradient | RadialGradient) -> None: ... - @property - def shading(self) -> str: ... - -class Type2Function(PDFObject): - function_type: Final = 2 - domain: str - c0: str - c1: str - n: int - def __init__(self, color_1, color_2) -> None: ... - -class Type3Function(PDFObject): - function_type: Final = 3 - domain: str - bounds: str - encode: str - n: int - - def __init__(self, functions: Iterable[Incomplete], bounds: Iterable[Incomplete]) -> None: ... - @property - def functions(self) -> str: ... - -class Shading(PDFObject): - shading_type: Literal[2, 3] - background: str | None - color_space: Name - coords: list[int] - function: str - extend: str - def __init__( - self, - shading_type: Literal[2, 3], - background: DeviceRGB | DeviceGray | DeviceCMYK | None, - color_space: str, - coords: list[int], - function: Type2Function | Type3Function, - extend_before: bool, - extend_after: bool, - ) -> None: ... - -class Gradient(ABC): - color_space: str - colors: list[Incomplete] - background: Incomplete | None - extend_before: Incomplete - extend_after: Incomplete - bounds: Incomplete - functions: Incomplete - pattern: Pattern - coords: Incomplete | None - shading_type: int - - def __init__(self, colors, background, extend_before, extend_after, bounds): ... - def get_shading_object(self) -> Shading: ... - def get_pattern(self) -> Pattern: ... - -class LinearGradient(Gradient): - coords: list[str] - shading_type: int - def __init__( - self, - fpdf: FPDF, - from_x: float, - from_y: float, - to_x: float, - to_y: float, - colors: list[Incomplete], - background=None, - extend_before: bool = False, - extend_after: bool = False, - bounds: list[int] | None = None, - ) -> None: ... - -class RadialGradient(Gradient): - coords: list[str] - shading_type: int - def __init__( - self, - fpdf: FPDF, - start_circle_x: float, - start_circle_y: float, - start_circle_radius: float, - end_circle_x: float, - end_circle_y: float, - end_circle_radius: float, - colors: list[Incomplete], - background=None, - extend_before: bool = False, - extend_after: bool = False, - bounds: list[int] | None = None, - ): ... diff --git a/stubs/fpdf2/fpdf/prefs.pyi b/stubs/fpdf2/fpdf/prefs.pyi deleted file mode 100644 index 9d9882f837b2..000000000000 --- a/stubs/fpdf2/fpdf/prefs.pyi +++ /dev/null @@ -1,86 +0,0 @@ -from typing import Literal - -from .enums import Duplex, PageBoundaries, PageMode, TextDirection - -class ViewerPreferences: - hide_toolbar: bool - hide_menubar: bool - hide_window_u_i: bool - fit_window: bool - center_window: bool - def __init__( - self, - hide_toolbar: bool = False, - hide_menubar: bool = False, - hide_window_u_i: bool = False, - fit_window: bool = False, - center_window: bool = False, - display_doc_title: bool = False, - non_full_screen_page_mode: PageMode | str | None = ..., - num_copies: int | None = None, - print_page_range: list[int] | None = None, - direction: TextDirection | str | None = None, - duplex: Duplex | str | None = None, - view_area: PageBoundaries | None = None, - view_clip: PageBoundaries | None = None, - print_area: PageBoundaries | None = None, - print_clip: PageBoundaries | None = None, - print_scaling=None, - ) -> None: ... - - @property - def non_full_screen_page_mode(self) -> PageMode | None: ... - @non_full_screen_page_mode.setter - def non_full_screen_page_mode(self, page_mode: PageMode | str | None) -> None: ... - - @property - def num_copies(self) -> int | None: ... - @num_copies.setter - def num_copies(self, num_copies: int | None) -> None: ... - - @property - def print_page_range(self) -> list[int] | None: ... - @print_page_range.setter - def print_page_range(self, print_page_range: list[int] | None) -> None: ... - - @property - def direction(self) -> TextDirection | None: ... - @direction.setter - def direction(self, direction: TextDirection | str | None) -> None: ... - - @property - def display_doc_title(self) -> bool: ... - @display_doc_title.setter - def display_doc_title(self, display_doc_title: bool) -> None: ... - - @property - def duplex(self) -> Duplex | None: ... - @duplex.setter - def duplex(self, duplex: Duplex | str | None) -> None: ... - - @property - def view_area(self) -> PageBoundaries | None: ... - @view_area.setter - def view_area(self, view_area: PageBoundaries | str | None) -> None: ... - - @property - def view_clip(self) -> PageBoundaries | None: ... - @view_clip.setter - def view_clip(self, view_area: PageBoundaries | str | None) -> None: ... - - @property - def print_area(self) -> PageBoundaries | None: ... - @print_area.setter - def print_area(self, view_area: PageBoundaries | str | None) -> None: ... - - @property - def print_clip(self) -> PageBoundaries | None: ... - @print_clip.setter - def print_clip(self, view_area: PageBoundaries | str | None) -> None: ... - - @property - def print_scaling(self) -> Literal["None", "AppDefault"] | None: ... - @print_scaling.setter - def print_scaling(self, print_scaling: Literal["None", "AppDefault"] | None) -> None: ... - - def serialize(self) -> str: ... diff --git a/stubs/fpdf2/fpdf/recorder.pyi b/stubs/fpdf2/fpdf/recorder.pyi deleted file mode 100644 index 2588eef8e129..000000000000 --- a/stubs/fpdf2/fpdf/recorder.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Any - -class FPDFRecorder: - pdf: Any - accept_page_break: bool - def __init__(self, pdf, accept_page_break: bool = True) -> None: ... - def __getattr__(self, name: str): ... - def rewind(self) -> None: ... - def replay(self) -> None: ... - -class CallRecorder: - def __init__(self, func, calls) -> None: ... - def __call__(self, *args, **kwargs): ... diff --git a/stubs/fpdf2/fpdf/sign.pyi b/stubs/fpdf2/fpdf/sign.pyi deleted file mode 100644 index 1176b1a099e1..000000000000 --- a/stubs/fpdf2/fpdf/sign.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from _typeshed import Incomplete - -class Signature: - type: str - filter: str - sub_filter: str - contact_info: Incomplete | None - location: Incomplete | None - m: Incomplete | None - reason: Incomplete | None - byte_range: str - contents: str - def __init__(self, contact_info=None, location=None, m=None, reason=None) -> None: ... - def serialize(self) -> str: ... - -def sign_content(signer, buffer, key, cert, extra_certs, hashalgo, sign_time): ... diff --git a/stubs/fpdf2/fpdf/structure_tree.pyi b/stubs/fpdf2/fpdf/structure_tree.pyi deleted file mode 100644 index 6d3f35cd536f..000000000000 --- a/stubs/fpdf2/fpdf/structure_tree.pyi +++ /dev/null @@ -1,51 +0,0 @@ -from _typeshed import Incomplete, Unused -from collections import defaultdict -from collections.abc import Iterable, Iterator - -from .encryption import StandardSecurityHandler -from .syntax import PDFArray, PDFObject, PDFString - -class NumberTree(PDFObject): - __slots__ = ("_id", "nums") - nums: defaultdict[Incomplete, list[Incomplete]] - def __init__(self) -> None: ... - def serialize(self, obj_dict: Unused = None, _security_handler: StandardSecurityHandler | None = None) -> str: ... - -class StructTreeRoot(PDFObject): - __slots__ = ("_id", "type", "parent_tree", "k") - type: str - parent_tree: NumberTree - k: PDFArray[Incomplete] - def __init__(self) -> None: ... - -class StructElem(PDFObject): - __slots__ = ("_id", "type", "s", "p", "k", "t", "alt", "pg", "_page_number") - type: str - s: str - p: PDFObject - k: PDFArray[Incomplete] - t: PDFString | None - alt: PDFString | None - pg: Incomplete | None - def __init__( - self, - struct_type: str, - parent: PDFObject, - kids: Iterable[int] | Iterable[StructElem], - page_number: int | None = None, - title: str | None = None, - alt: str | None = None, - ) -> None: ... - def page_number(self) -> int | None: ... - -class StructureTreeBuilder: - struct_tree_root: Incomplete - doc_struct_elem: Incomplete - struct_elem_per_mc: Incomplete - def __init__(self) -> None: ... - def add_marked_content( - self, page_number: int, struct_type: str, mcid: int | None = None, title: str | None = None, alt_text: str | None = None - ) -> tuple[Incomplete, Incomplete]: ... - def next_mcid_for_page(self, page_number: int) -> int: ... - def empty(self) -> bool: ... - def __iter__(self) -> Iterator[Incomplete]: ... diff --git a/stubs/fpdf2/fpdf/svg.pyi b/stubs/fpdf2/fpdf/svg.pyi deleted file mode 100644 index 9a06c8eb04d9..000000000000 --- a/stubs/fpdf2/fpdf/svg.pyi +++ /dev/null @@ -1,147 +0,0 @@ -from _typeshed import Incomplete, Unused -from collections.abc import Callable -from logging import Logger -from re import Pattern -from typing import Final, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only - -from ._fonttools_shims import BasePen, _TTGlyphSet -from .drawing import ClippingPath, PaintedPath -from .fpdf import FPDF -from .image_datastructures import ImageCache - -LOGGER: Logger -__pdoc__: dict[str, bool] - -@type_check_only -class _HasQualname(Protocol): - __qualname__: str - -_T = TypeVar("_T", bound=_HasQualname) - -def force_nodocument(item: _T) -> _T: ... - -NUMBER_SPLIT: Final[Pattern[str]] -TRANSFORM_GETTER: Final[Pattern[str]] - -class Percent(float): ... - -unit_splitter: Pattern[str] -relative_length_units: set[str] -absolute_length_units: dict[str, int] -angle_units: dict[str, float] - -def resolve_length(length_str, default_unit: str = "pt"): ... -def resolve_angle(angle_str, default_unit: str = "deg"): ... -def xmlns(space, name): ... -def xmlns_lookup(space, *names): ... -def without_ns(qualified_tag: str) -> str: ... - -shape_tags: Incomplete - -def svgcolor(colorstr): ... -def convert_stroke_width(incoming): ... -def convert_miterlimit(incoming): ... -def clamp_float(min_val, max_val): ... -def inheritable(value, converter=...): ... -def optional(value, converter=...): ... - -svg_attr_map: dict[str, Callable[[Incomplete], tuple[str, Incomplete]]] - -def apply_styles(stylable, svg_element) -> None: ... - -class ShapeBuilder: - @overload - @staticmethod - def new_path(tag, clipping_path: Literal[True]) -> ClippingPath: ... - @overload - @staticmethod - def new_path(tag, clipping_path: Literal[False] = False) -> PaintedPath: ... - - @overload - @classmethod - def rect(cls, tag, clipping_path: Literal[True]) -> ClippingPath: ... - @overload - @classmethod - def rect(cls, tag, clipping_path: Literal[False] = False) -> PaintedPath: ... - - @overload - @classmethod - def circle(cls, tag, clipping_path: Literal[True]) -> ClippingPath: ... - @overload - @classmethod - def circle(cls, tag, clipping_path: Literal[False] = False) -> PaintedPath: ... - - @overload - @classmethod - def ellipse(cls, tag, clipping_path: Literal[True]) -> ClippingPath: ... - @overload - @classmethod - def ellipse(cls, tag, clipping_path: Literal[False] = False) -> PaintedPath: ... - - @classmethod - def line(cls, tag) -> PaintedPath: ... - @classmethod - def polyline(cls, tag) -> PaintedPath: ... - - @overload - @classmethod - def polygon(cls, tag, clipping_path: Literal[True]) -> ClippingPath: ... - @overload - @classmethod - def polygon(cls, tag, clipping_path: Literal[False] = False) -> PaintedPath: ... - -def convert_transforms(tfstr): ... - -class PathPen(BasePen): - pdf_path: PaintedPath - last_was_line_to: bool - first_is_move: bool | None - def __init__(self, pdf_path: PaintedPath, glyphSet: _TTGlyphSet | None = ...): ... - def arcTo(self, rx, ry, rotation, arc, sweep, end) -> None: ... - -def svg_path_converter(pdf_path: PaintedPath, svg_path: str) -> None: ... - -class SVGObject: - image_cache: ImageCache | None - - @classmethod - def from_file(cls, filename, *args, encoding: str = "utf-8", **kwargs): ... - cross_references: Incomplete - def __init__(self, svg_text, image_cache: ImageCache | None = None) -> None: ... - preserve_ar: Incomplete - width: Incomplete - height: Incomplete - viewbox: Incomplete - def update_xref(self, key: str | None, referenced) -> None: ... - def extract_shape_info(self, root_tag) -> None: ... - base_group: Incomplete - def convert_graphics(self, root_tag) -> None: ... - def transform_to_page_viewport(self, pdf, align_viewbox: bool = True): ... - def transform_to_rect_viewport( - self, scale, width, height, align_viewbox: bool = True, ignore_svg_top_attrs: bool = False - ): ... - def draw_to_page(self, pdf: FPDF, x=None, y=None, debug_stream=None) -> None: ... - def handle_defs(self, defs) -> None: ... - def build_xref(self, xref): ... - def build_group(self, group, pdf_group=None): ... - def build_path(self, path): ... - def build_shape(self, shape): ... - def build_clipping_path(self, shape, clip_id): ... - def apply_clipping_path(self, stylable, svg_element) -> None: ... - def build_image(self, image) -> SVGImage: ... - -class SVGImage(NamedTuple): - href: str - x: float - y: float - width: float - height: float - svg_obj: SVGObject - - def __deepcopy__(self, _memo: Unused) -> SVGImage: ... - def render( - self, _gsd_registry: Unused, _style: Unused, last_item, initial_point - ) -> tuple[Incomplete, Incomplete, Incomplete]: ... - def render_debug( - self, gsd_registry: Unused, style: Unused, last_item, initial_point, debug_stream, _pfx: Unused - ) -> tuple[Incomplete, Incomplete, Incomplete]: ... diff --git a/stubs/fpdf2/fpdf/syntax.pyi b/stubs/fpdf2/fpdf/syntax.pyi deleted file mode 100644 index ca052a215fbb..000000000000 --- a/stubs/fpdf2/fpdf/syntax.pyi +++ /dev/null @@ -1,82 +0,0 @@ -import datetime -from _typeshed import Incomplete, SupportsItems -from abc import ABC, abstractmethod -from re import Pattern -from typing import ClassVar, Literal, TypeVar -from typing_extensions import Self - -from .encryption import StandardSecurityHandler - -_T = TypeVar("_T") - -def clear_empty_fields(d): ... -def create_dictionary_string( - dict_, - open_dict: str = "<<", - close_dict: str = ">>", - field_join: str = "\n", - key_value_join: str = " ", - has_empty_fields: bool = False, -) -> str: ... -def create_list_string(list_): ... -def iobj_ref(n): ... -def create_stream(stream: str | bytes | bytearray, encryption_handler: StandardSecurityHandler | None = None, obj_id=None): ... -def wrap_in_local_context(draw_commands: list[str]) -> list[str]: ... - -class Raw(str): ... - -class Name(str): - NAME_ESC: ClassVar[Pattern[bytes]] - def serialize(self) -> str: ... - -class PDFObject: - @property - def id(self) -> int: ... - @id.setter - def id(self, n: int) -> None: ... - - @property - def ref(self) -> str: ... - def serialize(self, obj_dict=None, _security_handler: StandardSecurityHandler | None = None) -> str: ... - def content_stream(self) -> bytes: ... - -class PDFContentStream(PDFObject): - filter: Name | None - length: int - def __init__(self, contents: bytes, compress: bool = False) -> None: ... - -def build_obj_dict(key_values: SupportsItems[str, Incomplete]) -> dict[str, str]: ... -def camel_case(snake_case: str) -> str: ... - -class PDFString(str): - USE_HEX_ENCODING: ClassVar[bool] - encrypt: bool - def __new__(cls, content: str, encrypt: bool = False) -> Self: ... - def serialize(self) -> str: ... - -class PDFDate: - date: datetime.datetime - with_tz: bool - encrypt: bool - - def __init__(self, date: datetime.datetime, with_tz: bool = False, encrypt: bool = False) -> None: ... - def serialize(self) -> str: ... - -class PDFArray(list[_T]): - def serialize(self) -> str: ... - -class Destination(ABC): - @abstractmethod - def serialize(self) -> str: ... - -class DestinationXYZ(Destination): - page_number: int - top: float - left: float - zoom: float | Literal["null"] - page_ref: Incomplete | None - def __init__(self, page: int, top: float, left: float = 0, zoom: float | Literal["null"] = "null") -> None: ... - def serialize(self) -> str: ... - def replace( - self, page=None, top: float | None = None, left: float | None = None, zoom: float | Literal["null"] | None = None - ) -> DestinationXYZ: ... diff --git a/stubs/fpdf2/fpdf/table.pyi b/stubs/fpdf2/fpdf/table.pyi deleted file mode 100644 index e07d318d5101..000000000000 --- a/stubs/fpdf2/fpdf/table.pyi +++ /dev/null @@ -1,140 +0,0 @@ -from _typeshed import Incomplete, SupportsItems -from collections.abc import Iterable -from dataclasses import dataclass -from io import BytesIO -from typing import Literal, overload - -from PIL import Image - -from .drawing import DeviceGray, DeviceRGB -from .enums import ( - Align, - CellBordersLayout, - TableBordersLayout, - TableCellFillMode, - TableHeadingsDisplay, - TableSpan, - VAlign, - WrapMode, -) -from .fonts import FontFace -from .fpdf import FPDF -from .image_datastructures import _TextAlign -from .util import Padding - -DEFAULT_HEADINGS_STYLE: FontFace - -class Table: - rows: list[Row] - - def __init__( - self, - fpdf: FPDF, - rows: Iterable[str] = (), - *, - # Keep in sync with `fpdf.fpdf.FPDF.table`: - align: str | _TextAlign = "CENTER", - v_align: str | VAlign = "MIDDLE", - borders_layout: str | TableBordersLayout = ..., - cell_fill_color: int | tuple[Incomplete, ...] | DeviceGray | DeviceRGB | None = None, - cell_fill_mode: str | TableCellFillMode = ..., - col_widths: int | tuple[int, ...] | None = None, - first_row_as_headings: bool = True, - gutter_height: float = 0, - gutter_width: float = 0, - headings_style: FontFace = ..., - line_height: int | None = None, - markdown: bool = False, - text_align: str | _TextAlign | tuple[str | _TextAlign, ...] = "JUSTIFY", - width: int | None = None, - wrapmode: WrapMode = ..., - padding: float | Padding | None = None, - outer_border_width: float | None = None, - num_heading_rows: int = 1, - repeat_headings: TableHeadingsDisplay | int = 1, - min_row_height=None, - ) -> None: ... - def row( - self, cells: Iterable[str] = (), style: FontFace | None = None, v_align: VAlign | str | None = None, min_height=None - ) -> Row: ... - def render(self) -> None: ... - -class Row: - cells: list[Cell] - style: FontFace - v_align: VAlign | None - min_height: Incomplete | None - def __init__( - self, table: Table, style: FontFace | None = None, v_align: VAlign | str | None = None, min_height=None - ) -> None: ... - @property - def cols_count(self) -> int: ... - @property - def max_rowspan(self) -> int: ... - def convert_spans(self, active_rowspans: SupportsItems[int, int]) -> tuple[dict[int, int], list[int]]: ... - - @overload - def cell( - self, - text: str = "", - align: str | Align | None = None, - v_align: str | VAlign | None = None, - style: FontFace | None = None, - img: str | Image.Image | BytesIO | None = None, - img_fill_width: bool = False, - colspan: int = 1, - rowspan: int = 1, - padding: tuple[float, ...] | None = None, - link: str | int | None = None, - border: CellBordersLayout | int = ..., - ) -> str: ... - @overload - def cell( - self, - text: TableSpan, - align: str | Align | None = None, - v_align: str | VAlign | None = None, - style: FontFace | None = None, - img: str | Image.Image | BytesIO | None = None, - img_fill_width: bool = False, - colspan: int = 1, - rowspan: int = 1, - padding: tuple[float, ...] | None = None, - link: str | int | None = None, - border: CellBordersLayout | int = ..., - ) -> TableSpan: ... - -@dataclass -class Cell: - __slots__ = ("text", "align", "v_align", "style", "img", "img_fill_width", "colspan", "rowspan", "padding", "link", "border") - text: str - align: str | Align | None - v_align: str | VAlign | None - style: FontFace | None - img: str | None - img_fill_width: bool - colspan: int - rowspan: int - padding: int | tuple[float, ...] | None - link: str | int | None - border: CellBordersLayout | None - - def write(self, text, align=None): ... - -@dataclass(frozen=True) -class RowLayoutInfo: - height: int - pagebreak_height: float - rendered_heights: dict[Incomplete, Incomplete] - merged_heights: list[Incomplete] - -@dataclass(frozen=True) -class RowSpanLayoutInfo: - column: int - start: int - length: int - contents_height: float - - def row_range(self) -> range: ... - -def draw_box_borders(pdf: FPDF, x1, y1, x2, y2, border: str | Literal[0, 1], fill_color=None) -> None: ... diff --git a/stubs/fpdf2/fpdf/template.pyi b/stubs/fpdf2/fpdf/template.pyi deleted file mode 100644 index 41d5f9d55308..000000000000 --- a/stubs/fpdf2/fpdf/template.pyi +++ /dev/null @@ -1,43 +0,0 @@ -from os import PathLike -from typing import Any - -__author__: str -__copyright__: str -__license__: str - -class FlexTemplate: - pdf: Any - splitting_pdf: Any - handlers: Any - texts: Any - def __init__(self, pdf, elements=None) -> None: ... - elements: Any - keys: Any - def load_elements(self, elements) -> None: ... - def parse_json(self, infile: PathLike[Any], encoding: str = "utf-8") -> None: ... - def parse_csv( - self, infile: PathLike[Any], delimiter: str = ",", decimal_sep: str = ".", encoding: str | None = None - ) -> None: ... - def __setitem__(self, name, value) -> None: ... - set: Any - def __contains__(self, name): ... - def __getitem__(self, name): ... - def split_multicell(self, text: str, element_name: str) -> list[str]: ... - def render(self, offsetx: float = 0.0, offsety: float = 0.0, rotate: float = 0.0, scale: float = 1.0): ... - -class Template(FlexTemplate): - def __init__( - self, - infile=None, - elements=None, - format: str = "A4", - orientation: str = "portrait", - unit: str = "mm", - title: str = "", - author: str = "", - subject: str = "", - creator: str = "", - keywords: str = "", - ) -> None: ... - def add_page(self) -> None: ... - def render(self, outfile=None, dest=None) -> None: ... # type: ignore[override] diff --git a/stubs/fpdf2/fpdf/text_region.pyi b/stubs/fpdf2/fpdf/text_region.pyi deleted file mode 100644 index e5b62cfa839f..000000000000 --- a/stubs/fpdf2/fpdf/text_region.pyi +++ /dev/null @@ -1,174 +0,0 @@ -from _typeshed import Incomplete -from collections.abc import Sequence -from typing import NamedTuple -from typing_extensions import Self - -from .enums import Align, WrapMode -from .image_datastructures import RasterImageInfo, VectorImageInfo, _TextAlign -from .line_break import Fragment, TextLine - -class Extents(NamedTuple): - left: float - right: float - -class TextRegionMixin: - def __init__(self, *args, **kwargs) -> None: ... - def register_text_region(self, region) -> None: ... - def is_current_text_region(self, region) -> bool: ... - def clear_text_region(self) -> None: ... - -class LineWrapper(NamedTuple): - line: Sequence[Incomplete] - paragraph: Paragraph - first_line: bool = False - last_line: bool = False - -class Bullet: - fragments: Sequence[Fragment] - text_line: TextLine - r_margin: float - rendered_flag: bool - def __init__(self, bullet_fragments: Sequence[Fragment], text_line: TextLine, bullet_r_margin: float) -> None: ... - def get_fragments_width(self) -> float: ... - -class Paragraph: - pdf: Incomplete - text_align: Align - line_height: Incomplete - top_margin: Incomplete - bottom_margin: Incomplete - indent: float - skip_leading_spaces: bool - wrapmode: Incomplete - bullet: Bullet | None - first_line_indent: float - - def __init__( - self, - region, - text_align: _TextAlign | None = None, - line_height=None, - top_margin: float = 0, - bottom_margin: float = 0, - indent: float = 0, - bullet_r_margin: float | None = None, - bullet_string: str = "", - skip_leading_spaces: bool = False, - wrapmode: WrapMode | None = None, - first_line_indent: float = 0, - ) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_value, traceback) -> None: ... - def write(self, text: str, link=None): ... - def generate_bullet_frags_and_tl( - self, bullet_string: str, bullet_r_margin: float - ) -> tuple[tuple[Fragment, ...], TextLine] | None: ... - def ln(self, h: float | None = None) -> None: ... - def build_lines(self, print_sh: bool) -> list[LineWrapper]: ... - -class ImageParagraph: - region: Incomplete - name: Incomplete - align: Align | None - width: float | None - height: float | None - fill_width: bool - keep_aspect_ratio: bool - top_margin: float - bottom_margin: float - link: Incomplete | None - title: Incomplete | None - alt_text: Incomplete | None - img: Incomplete | None - info: Incomplete | None - - def __init__( - self, - region, - name, - align: _TextAlign | None = None, - width: float | None = None, - height: float | None = None, - fill_width: bool = False, - keep_aspect_ratio: bool = False, - top_margin: float = 0, - bottom_margin: float = 0, - link=None, - title=None, - alt_text=None, - ) -> None: ... - def build_line(self) -> Self: ... - def render(self, col_left: float, col_width: float, max_height: float) -> VectorImageInfo | RasterImageInfo: ... - -class ParagraphCollectorMixin: - pdf: Incomplete - text_align: Align - line_height: Incomplete - print_sh: Incomplete - wrapmode: Incomplete - skip_leading_spaces: Incomplete - def __init__( - self, - pdf, - *args, - text: str | None = None, - text_align: _TextAlign = "LEFT", - line_height: float = 1.0, - print_sh: bool = False, - skip_leading_spaces: bool = False, - wrapmode: WrapMode | None = None, - img=None, - img_fill_width: bool = False, - **kwargs, - ) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_value, traceback) -> None: ... - def write(self, text: str, link=None): ... - def ln(self, h: float | None = None) -> None: ... - def paragraph( - self, - text_align: _TextAlign | None = None, - line_height=None, - skip_leading_spaces: bool = False, - top_margin: int = 0, - bottom_margin: int = 0, - indent: int = 0, - bullet_string: str = "", - bullet_r_margin: float | None = None, - wrapmode: WrapMode | None = None, - first_line_indent: float = 0, - ) -> Paragraph: ... - def end_paragraph(self) -> None: ... - def image( - self, - name, - align: _TextAlign | None = None, - width: float | None = None, - height: float | None = None, - fill_width: bool = False, - keep_aspect_ratio: bool = False, - top_margin: float = 0, - bottom_margin: float = 0, - link=None, - title=None, - alt_text=None, - ) -> None: ... - -class TextRegion(ParagraphCollectorMixin): - def current_x_extents(self, y, height) -> None: ... - def collect_lines(self): ... - def render(self) -> None: ... - def get_width(self, height): ... - -class TextColumnarMixin: - l_margin: Incomplete - r_margin: Incomplete - def __init__(self, pdf, *args, l_margin=None, r_margin=None, **kwargs) -> None: ... - -class TextColumns(TextRegion, TextColumnarMixin): - balance: Incomplete - def __init__(self, pdf, *args, ncols: int = 1, gutter: float = 10, balance: bool = False, **kwargs) -> None: ... - def __enter__(self) -> Self: ... - def new_column(self) -> None: ... - def render(self) -> None: ... - def current_x_extents(self, y, height): ... diff --git a/stubs/fpdf2/fpdf/transitions.pyi b/stubs/fpdf2/fpdf/transitions.pyi deleted file mode 100644 index 7d7f2e6f9737..000000000000 --- a/stubs/fpdf2/fpdf/transitions.pyi +++ /dev/null @@ -1,59 +0,0 @@ -from abc import ABC, abstractmethod -from typing import Literal - -class Transition(ABC): - @abstractmethod - def serialize(self) -> str: ... - -class SplitTransition(Transition): - dimension: Literal["H", "V"] - direction: Literal["I", "O"] - def __init__(self, dimension: Literal["H", "V"], direction: Literal["I", "O"]) -> None: ... - def serialize(self) -> str: ... - -class BlindsTransition(Transition): - dimension: Literal["H", "V"] - def __init__(self, dimension: Literal["H", "V"]) -> None: ... - def serialize(self) -> str: ... - -class BoxTransition(Transition): - direction: Literal["I", "O"] - def __init__(self, direction: Literal["I", "O"]) -> None: ... - def serialize(self) -> str: ... - -class WipeTransition(Transition): - direction: Literal[0, 90, 180, 270] - def __init__(self, direction: Literal[0, 90, 180, 270]) -> None: ... - def serialize(self) -> str: ... - -class DissolveTransition(Transition): - def serialize(self) -> str: ... - -class GlitterTransition(Transition): - direction: Literal[0, 270, 315] - def __init__(self, direction: Literal[0, 270, 315]) -> None: ... - def serialize(self) -> str: ... - -class FlyTransition(Transition): - dimension: Literal["H", "V"] - direction: Literal[0, 270] | None - def __init__(self, dimension: Literal["H", "V"], direction: Literal[0, 270] | None = None) -> None: ... - def serialize(self) -> str: ... - -class PushTransition(Transition): - direction: Literal[0, 270] - def __init__(self, direction: Literal[0, 270]) -> None: ... - def serialize(self) -> str: ... - -class CoverTransition(Transition): - direction: Literal[0, 270] - def __init__(self, direction: Literal[0, 270]) -> None: ... - def serialize(self) -> str: ... - -class UncoverTransition(Transition): - direction: Literal[0, 270] - def __init__(self, direction: Literal[0, 270]) -> None: ... - def serialize(self) -> str: ... - -class FadeTransition(Transition): - def serialize(self) -> str: ... diff --git a/stubs/fpdf2/fpdf/unicode_script.pyi b/stubs/fpdf2/fpdf/unicode_script.pyi deleted file mode 100644 index 49e56f2d2923..000000000000 --- a/stubs/fpdf2/fpdf/unicode_script.pyi +++ /dev/null @@ -1,172 +0,0 @@ -from enum import IntEnum -from typing import Final - -class UnicodeScript(IntEnum): - COMMON = 0 - LATIN = 1 - GREEK = 2 - CYRILLIC = 3 - ARMENIAN = 4 - HEBREW = 5 - ARABIC = 6 - SYRIAC = 7 - THAANA = 8 - DEVANAGARI = 9 - BENGALI = 10 - GURMUKHI = 11 - GUJARATI = 12 - ORIYA = 13 - TAMIL = 14 - TELUGU = 15 - KANNADA = 16 - MALAYALAM = 17 - SINHALA = 18 - THAI = 19 - LAO = 20 - TIBETAN = 21 - MYANMAR = 22 - GEORGIAN = 23 - HANGUL = 24 - ETHIOPIC = 25 - CHEROKEE = 26 - CANADIAN_ABORIGINAL = 27 - OGHAM = 28 - RUNIC = 29 - KHMER = 30 - MONGOLIAN = 31 - HIRAGANA = 32 - KATAKANA = 33 - BOPOMOFO = 34 - HAN = 35 - YI = 36 - OLD_ITALIC = 37 - GOTHIC = 38 - DESERET = 39 - INHERITED = 40 - TAGALOG = 41 - HANUNOO = 42 - BUHID = 43 - TAGBANWA = 44 - LIMBU = 45 - TAI_LE = 46 - LINEAR_B = 47 - UGARITIC = 48 - SHAVIAN = 49 - OSMANYA = 50 - CYPRIOT = 51 - BRAILLE = 52 - BUGINESE = 53 - COPTIC = 54 - NEW_TAI_LUE = 55 - GLAGOLITIC = 56 - TIFINAGH = 57 - SYLOTI_NAGRI = 58 - OLD_PERSIAN = 59 - KHAROSHTHI = 60 - BALINESE = 61 - CUNEIFORM = 62 - PHOENICIAN = 63 - PHAGS_PA = 64 - NKO = 65 - SUNDANESE = 66 - LEPCHA = 67 - OL_CHIKI = 68 - VAI = 69 - SAURASHTRA = 70 - KAYAH_LI = 71 - REJANG = 72 - LYCIAN = 73 - CARIAN = 74 - LYDIAN = 75 - CHAM = 76 - TAI_THAM = 77 - TAI_VIET = 78 - AVESTAN = 79 - EGYPTIAN_HIEROGLYPHS = 80 - SAMARITAN = 81 - LISU = 82 - BAMUM = 83 - JAVANESE = 84 - MEETEI_MAYEK = 85 - IMPERIAL_ARAMAIC = 86 - OLD_SOUTH_ARABIAN = 87 - INSCRIPTIONAL_PARTHIAN = 88 - INSCRIPTIONAL_PAHLAVI = 89 - OLD_TURKIC = 90 - KAITHI = 91 - BATAK = 92 - BRAHMI = 93 - MANDAIC = 94 - CHAKMA = 95 - MEROITIC_CURSIVE = 96 - MEROITIC_HIEROGLYPHS = 97 - MIAO = 98 - SHARADA = 99 - SORA_SOMPENG = 100 - TAKRI = 101 - CAUCASIAN_ALBANIAN = 102 - BASSA_VAH = 103 - DUPLOYAN = 104 - ELBASAN = 105 - GRANTHA = 106 - PAHAWH_HMONG = 107 - KHOJKI = 108 - LINEAR_A = 109 - MAHAJANI = 110 - MANICHAEAN = 111 - MENDE_KIKAKUI = 112 - MODI = 113 - MRO = 114 - OLD_NORTH_ARABIAN = 115 - NABATAEAN = 116 - PALMYRENE = 117 - PAU_CIN_HAU = 118 - OLD_PERMIC = 119 - PSALTER_PAHLAVI = 120 - SIDDHAM = 121 - KHUDAWADI = 122 - TIRHUTA = 123 - WARANG_CITI = 124 - AHOM = 125 - ANATOLIAN_HIEROGLYPHS = 126 - HATRAN = 127 - MULTANI = 128 - OLD_HUNGARIAN = 129 - SIGNWRITING = 130 - ADLAM = 131 - BHAIKSUKI = 132 - MARCHEN = 133 - NEWA = 134 - OSAGE = 135 - TANGUT = 136 - MASARAM_GONDI = 137 - NUSHU = 138 - SOYOMBO = 139 - ZANABAZAR_SQUARE = 140 - DOGRA = 141 - GUNJALA_GONDI = 142 - MAKASAR = 143 - MEDEFAIDRIN = 144 - HANIFI_ROHINGYA = 145 - SOGDIAN = 146 - OLD_SOGDIAN = 147 - ELYMAIC = 148 - NANDINAGARI = 149 - NYIAKENG_PUACHUE_HMONG = 150 - WANCHO = 151 - CHORASMIAN = 152 - DIVES_AKURU = 153 - KHITAN_SMALL_SCRIPT = 154 - YEZIDI = 155 - CYPRO_MINOAN = 156 - OLD_UYGHUR = 157 - TANGSA = 158 - TOTO = 159 - VITHKUQI = 160 - KAWI = 161 - NAG_MUNDARI = 162 - UNKNOWN = 999 - -UNICODE_RANGE_TO_SCRIPT: Final[tuple[tuple[int, int, int]]] - -def get_unicode_script(char: str) -> UnicodeScript: ... diff --git a/stubs/fpdf2/fpdf/util.pyi b/stubs/fpdf2/fpdf/util.pyi deleted file mode 100644 index 9c98ae361a5f..000000000000 --- a/stubs/fpdf2/fpdf/util.pyi +++ /dev/null @@ -1,38 +0,0 @@ -from collections.abc import Iterable -from typing import Any, AnyStr, Final, Literal, NamedTuple, TypeAlias - -_Unit: TypeAlias = Literal["pt", "mm", "cm", "in"] - -PIL_MEM_BLOCK_SIZE_IN_MIB: Final = 16 - -class Padding(NamedTuple): - top: float = 0 - right: float = 0 - bottom: float = 0 - left: float = 0 - @classmethod - def new(cls, padding: float | tuple[float, ...] | list[float]): ... - -def buffer_subst(buffer: bytearray, placeholder: str, value: str) -> bytearray: ... -def escape_parens(s: AnyStr) -> AnyStr: ... -def get_scale_factor(unit: _Unit | float) -> float: ... -def convert_unit( - # to_convert has a recursive type - to_convert: float | Iterable[float | Iterable[Any]], - old_unit: str | float, - new_unit: str | float, -) -> float | tuple[float, ...]: ... - -ROMAN_NUMERAL_MAP: Final[tuple[tuple[str, int], ...]] - -def int2roman(n: int | None) -> str: ... -def int_to_letters(n: int) -> str: ... -def print_mem_usage(prefix: str) -> None: ... -def get_mem_usage(prefix: str) -> str: ... -def get_process_rss() -> str: ... -def get_process_rss_as_mib() -> float | None: ... -def get_process_heap_and_stack_sizes() -> tuple[str, str]: ... -def get_pymalloc_allocated_over_total_size() -> str: ... -def get_gc_managed_objs_total_size() -> str: ... -def get_tracemalloc_traced_memory() -> str: ... -def get_pillow_allocated_memory() -> str: ...