Add defaults for third-party stubs E-H (#9954)

This commit is contained in:
Alex Waygood
2023-03-27 17:09:01 +01:00
committed by GitHub
parent 0c0a58f36d
commit 1cd3ae8e30
58 changed files with 509 additions and 496 deletions

View File

@@ -5,32 +5,32 @@ from .syntax import PDFObject
class Action(ABC):
next: PDFObject | str | None
def __init__(self, next_action: PDFObject | str | None = ...) -> 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: ...
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: ...
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: ...
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: ...
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: ...
def __init__(self, file: str, next_action: PDFObject | str | None = None) -> None: ...
def serialize(self) -> str: ...

View File

@@ -35,19 +35,19 @@ class AnnotationMixin:
width: int,
height: int,
flags: tuple[AnnotationFlag, ...] = ...,
contents: str | None = ...,
dest: Destination | None = ...,
action: Action | None = ...,
color: tuple[int, int, int] | None = ...,
modification_time: datetime | None = ...,
title: str | None = ...,
quad_points: tuple[float, ...] | None = ..., # multiple of 8 floats
border_width: int = ...,
name: AnnotationName | FileAttachmentAnnotationName | None = ...,
ink_list: tuple[int, ...] = ...,
file_spec: str | None = ...,
field_type: str | None = ...,
value: Incomplete | None = ...,
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: Incomplete | None = None,
) -> None: ...
class PDFAnnotation(AnnotationMixin, PDFObject): ...
@@ -62,11 +62,11 @@ class PDFEmbeddedFile(PDFContentStream):
self,
basename: str,
contents: bytes,
desc: str = ...,
creation_date: datetime | None = ...,
modification_date: datetime | None = ...,
compress: bool = ...,
checksum: bool = ...,
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: ...

View File

@@ -38,7 +38,7 @@ class _DeviceRGBBase(NamedTuple):
class DeviceRGB(_DeviceRGBBase):
OPERATOR: ClassVar[str]
def __new__(cls, r: Number, g: Number, b: Number, a: Number | None = ...) -> Self: ...
def __new__(cls, r: Number, g: Number, b: Number, a: Number | None = None) -> Self: ...
@property
def colors(self) -> tuple[Number, Number, Number]: ...
def serialize(self) -> str: ...
@@ -49,7 +49,7 @@ class _DeviceGrayBase(NamedTuple):
class DeviceGray(_DeviceGrayBase):
OPERATOR: ClassVar[str]
def __new__(cls, g: Number, a: Number | None = ...) -> Self: ...
def __new__(cls, g: Number, a: Number | None = None) -> Self: ...
@property
def colors(self) -> tuple[Number]: ...
def serialize(self) -> str: ...
@@ -63,14 +63,14 @@ class _DeviceCMYKBase(NamedTuple):
class DeviceCMYK(_DeviceCMYKBase):
OPERATOR: ClassVar[str]
def __new__(cls, c: Number, m: Number, y: Number, k: Number, a: Number | None = ...) -> Self: ...
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, g, b, a: Incomplete | None = ...) -> DeviceRGB: ...
def gray8(g, a: Incomplete | None = ...) -> DeviceGray: ...
def cmyk8(c, m, y, k, a: Incomplete | None = ...) -> DeviceCMYK: ...
def rgb8(r, g, b, a: Incomplete | None = None) -> DeviceRGB: ...
def gray8(g, a: Incomplete | None = None) -> DeviceGray: ...
def cmyk8(c, m, y, k, a: Incomplete | None = None) -> DeviceCMYK: ...
def color_from_hex_string(hexstr) -> DeviceRGB: ...
def color_from_rgb_string(rgbstr) -> DeviceRGB: ...
@@ -102,18 +102,18 @@ class Transform(NamedTuple):
@classmethod
def translation(cls, x, y): ...
@classmethod
def scaling(cls, x, y: Incomplete | None = ...): ...
def scaling(cls, x, y: Incomplete | None = None): ...
@classmethod
def rotation(cls, theta): ...
@classmethod
def rotation_d(cls, theta_d): ...
@classmethod
def shearing(cls, x, y: Incomplete | None = ...): ...
def shearing(cls, x, y: Incomplete | None = None): ...
def translate(self, x, y): ...
def scale(self, x, y: Incomplete | None = ...): ...
def scale(self, x, y: Incomplete | None = None): ...
def rotate(self, theta): ...
def rotate_d(self, theta_d): ...
def shear(self, x, y: Incomplete | None = ...): ...
def shear(self, x, y: Incomplete | None = None): ...
def about(self, x, y): ...
def __mul__(self, other): ...
def __rmul__(self, other): ...
@@ -316,12 +316,12 @@ class Close(NamedTuple):
class DrawingContext:
def __init__(self) -> None: ...
def add_item(self, item, _copy: bool = ...) -> 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: int = ..., y: int = ...) -> None: ...
def __init__(self, x: int = 0, y: int = 0) -> None: ...
def __deepcopy__(self, memo) -> Self: ...
@property
def style(self): ...
@@ -343,9 +343,9 @@ class PaintedPath:
def clipping_path(self, new_clipath) -> None: ...
@contextmanager
def transform_group(self, transform) -> Iterator[Self]: ...
def add_path_element(self, item, _copy: bool = ...) -> None: ...
def add_path_element(self, item, _copy: bool = True) -> None: ...
def remove_last_path_element(self) -> None: ...
def rectangle(self, x, y, w, h, rx: int = ..., ry: int = ...) -> Self: ...
def rectangle(self, x, y, w, h, rx: int = 0, ry: int = 0) -> Self: ...
def circle(self, cx, cy, r) -> Self: ...
def ellipse(self, cx, cy, rx, ry) -> Self: ...
def move_to(self, x, y) -> Self: ...
@@ -364,15 +364,15 @@ class PaintedPath:
def arc_relative(self, rx, ry, rotation, large_arc, positive_sweep, dx, dy) -> Self: ...
def close(self) -> None: ...
def render(
self, gsd_registry, style, last_item, initial_point, debug_stream: Incomplete | None = ..., pfx: Incomplete | None = ...
self, gsd_registry, style, last_item, initial_point, debug_stream: Incomplete | None = None, pfx: Incomplete | None = None
): ...
def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ...
class ClippingPath(PaintedPath):
paint_rule: Incomplete
def __init__(self, x: int = ..., y: int = ...) -> None: ...
def __init__(self, x: int = 0, y: int = 0) -> None: ...
def render(
self, gsd_registry, style, last_item, initial_point, debug_stream: Incomplete | None = ..., pfx: Incomplete | None = ...
self, gsd_registry, style, last_item, initial_point, debug_stream: Incomplete | None = None, pfx: Incomplete | None = None
): ...
def render_debug(self, gsd_registry, style, last_item, initial_point, debug_stream, pfx): ...
@@ -389,7 +389,7 @@ class GraphicsContext:
def clipping_path(self) -> ClippingPath | None: ...
@clipping_path.setter
def clipping_path(self, new_clipath) -> None: ...
def add_item(self, item, _copy: bool = ...) -> 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(
@@ -398,9 +398,9 @@ class GraphicsContext:
style,
last_item,
initial_point,
debug_stream: Incomplete | None = ...,
pfx: Incomplete | None = ...,
_push_stack: bool = ...,
debug_stream: Incomplete | None = None,
pfx: Incomplete | None = None,
_push_stack: bool = True,
): ...
def render(
self,
@@ -408,10 +408,10 @@ class GraphicsContext:
style: DrawingContext,
last_item,
initial_point,
debug_stream: Incomplete | None = ...,
pfx: Incomplete | None = ...,
_push_stack: bool = ...,
debug_stream: Incomplete | None = None,
pfx: Incomplete | None = None,
_push_stack: bool = True,
): ...
def render_debug(
self, gsd_registry, style: DrawingContext, last_item, initial_point, debug_stream, pfx, _push_stack: bool = ...
self, gsd_registry, style: DrawingContext, last_item, initial_point, debug_stream, pfx, _push_stack: bool = True
): ...

View File

@@ -6,7 +6,7 @@ class FPDFPageFormatException(FPDFException):
argument: Any
unknown: Any
one: Any
def __init__(self, argument, unknown: bool = ..., one: bool = ...) -> None: ...
def __init__(self, argument, unknown: bool = False, one: bool = False) -> None: ...
class FPDFUnicodeEncodingException(FPDFException):
def __init__(self, text_index, character, font_name) -> None: ...

View File

@@ -64,7 +64,7 @@ class SubsetMap:
def pick(self, unicode: int) -> int: ...
def dict(self) -> dict[int, int]: ...
def get_page_format(format: _Format | tuple[float, float], k: float | None = ...) -> tuple[float, float]: ...
def get_page_format(format: _Format | tuple[float, float], k: float | None = None) -> tuple[float, float]: ...
# TODO: TypedDicts
_Font: TypeAlias = dict[str, Any]
@@ -143,10 +143,10 @@ class FPDF:
def __init__(
self,
orientation: _Orientation = ...,
unit: _Unit | float = ...,
format: _Format | tuple[float, float] = ...,
font_cache_dir: Literal["DEPRECATED"] = ...,
orientation: _Orientation = "portrait",
unit: _Unit | float = "mm",
format: _Format | tuple[float, float] = "A4",
font_cache_dir: Literal["DEPRECATED"] = "DEPRECATED",
) -> None: ...
# The following definition crashes stubtest 0.991, but seems to be fixed
# in later versions.
@@ -171,7 +171,7 @@ class FPDF:
@property
def pages_count(self) -> int: ...
def set_margin(self, margin: float) -> None: ...
def set_margins(self, left: float, top: float, right: 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
@@ -179,7 +179,7 @@ class FPDF:
auto_page_break: bool
b_margin: float
page_break_trigger: float
def set_auto_page_break(self, auto: bool, margin: float = ...) -> None: ...
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
@@ -187,7 +187,7 @@ class FPDF:
def set_display_mode(
self,
zoom: Literal["fullpage", "fullwidth", "real", "default"] | float,
layout: Literal["single", "continuous", "two", "default"] = ...,
layout: Literal["single", "continuous", "two", "default"] = "continuous",
) -> None: ...
def set_compression(self, compress: bool) -> None: ...
title: str
@@ -208,56 +208,62 @@ class FPDF:
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 = ...) -> None: ...
def alias_nb_pages(self, alias: str = "{nb}") -> None: ...
def add_page(
self,
orientation: _Orientation = ...,
format: _Format | tuple[float, float] = ...,
same: bool = ...,
duration: int = ...,
transition: Incomplete | None = ...,
orientation: _Orientation = "",
format: _Format | tuple[float, float] = "",
same: bool = False,
duration: int = 0,
transition: Incomplete | None = None,
) -> None: ...
def header(self) -> None: ...
def footer(self) -> None: ...
def page_no(self) -> int: ...
def set_draw_color(self, r: int, g: int = ..., b: int = ...) -> None: ...
def set_fill_color(self, r: int, g: int = ..., b: int = ...) -> None: ...
def set_text_color(self, r: int, g: int = ..., b: int = ...) -> None: ...
def get_string_width(self, s: str, normalized: bool = ..., markdown: bool = ...) -> float: ...
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: Incomplete | None = ...) -> _GeneratorContextManager[DrawingContext]: ...
def drawing_context(self, debug_stream: Incomplete | None = None) -> _GeneratorContextManager[DrawingContext]: ...
def new_path(
self, x: float = ..., y: float = ..., paint_rule: PathPaintRule = ..., debug_stream: Incomplete | None = ...
self, x: float = 0, y: float = 0, paint_rule: PathPaintRule = ..., debug_stream: Incomplete | None = None
) -> _GeneratorContextManager[PaintedPath]: ...
def draw_path(self, path: PaintedPath, debug_stream: Incomplete | None = ...) -> None: ...
def set_dash_pattern(self, dash: float = ..., gap: float = ..., phase: float = ...) -> None: ...
def draw_path(self, path: PaintedPath, debug_stream: Incomplete | None = 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 = ..., polygon: bool = ..., style: RenderStyle | str | None = ...
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 = ..., style: RenderStyle | str | None = ...) -> None: ...
def dashed_line(self, x1, y1, x2, y2, dash_length: int = ..., space_length: int = ...) -> 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 = ...,
round_corners: tuple[str, ...] | tuple[Corner, ...] | bool = ...,
corner_radius: 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: ...
def circle(self, x: float, y: float, r, style: RenderStyle | str | None = ...) -> 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, r, style: RenderStyle | str | None = None) -> None: ...
def regular_polygon(
self,
x: float,
y: float,
numSides: int,
polyWidth: float,
rotateDegrees: float = ...,
style: RenderStyle | str | None = ...,
rotateDegrees: float = 0,
style: RenderStyle | str | None = None,
): ...
def star(
self,
@@ -266,8 +272,8 @@ class FPDF:
r_in: float,
r_out: float,
corners: int,
rotate_degrees: float = ...,
style: RenderStyle | str | None = ...,
rotate_degrees: float = 0,
style: RenderStyle | str | None = None,
): ...
def arc(
self,
@@ -276,12 +282,12 @@ class FPDF:
a: float,
start_angle: float,
end_angle: float,
b: float | None = ...,
inclination: float = ...,
clockwise: bool = ...,
start_from_center: bool = ...,
end_at_center: bool = ...,
style: RenderStyle | str | None = ...,
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,
@@ -290,10 +296,10 @@ class FPDF:
a: float,
start_angle: float,
end_angle: float,
b: float | None = ...,
inclination: float = ...,
clockwise: bool = ...,
style: RenderStyle | str | None = ...,
b: float | None = None,
inclination: float = 0,
clockwise: bool = False,
style: RenderStyle | str | None = None,
) -> None: ...
def add_font(
self,
@@ -302,21 +308,21 @@ class FPDF:
fname: str | PurePath | None = None,
uni: bool | Literal["DEPRECATED"] = "DEPRECATED",
) -> None: ...
def set_font(self, family: str | None = ..., style: _FontStyles = ..., size: int = ...) -> None: ...
def set_font(self, family: str | None = None, style: _FontStyles = "", 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 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 = ..., border_width: int = ...
self, x: float, y: float, w: float, h: float, link: str | int, alt_text: str | None = None, border_width: int = 0
) -> AnnotationDict: ...
def embed_file(
self,
file_path: StrPath | None = ...,
bytes: bytes | None = ...,
basename: str | None = ...,
modification_date: datetime.datetime | None = ...,
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 = ...,
@@ -328,9 +334,9 @@ class FPDF:
file_path: StrPath,
x: float,
y: float,
w: float = ...,
h: float = ...,
name: FileAttachmentAnnotationName | str | None = ...,
w: float = 1,
h: float = 1,
name: FileAttachmentAnnotationName | str | None = None,
flags: Iterable[AnnotationFlag | str] = ...,
*,
bytes: bytes | None = ...,
@@ -346,19 +352,19 @@ class FPDF:
x: float,
y: float,
text: str,
w: float = ...,
h: float = ...,
name: AnnotationName | str | None = ...,
w: float = 1,
h: float = 1,
name: AnnotationName | str | None = None,
flags: tuple[AnnotationFlag, ...] | tuple[str, ...] = ...,
) -> None: ...
def add_action(self, action, x: float, y: float, w: float, h: float) -> None: ...
def highlight(
self,
text: str,
title: str = ...,
type: TextMarkupType | str = ...,
color: tuple[float, float, float] = ...,
modification_time: datetime.datetime | None = ...,
title: str = "",
type: TextMarkupType | str = "Highlight",
color: tuple[float, float, float] = (1, 1, 0),
modification_time: datetime.datetime | None = None,
) -> _GeneratorContextManager[None]: ...
add_highlight = highlight
def add_text_markup_annotation(
@@ -366,51 +372,51 @@ class FPDF:
type: str,
text: str,
quad_points: Sequence[int],
title: str = ...,
color: tuple[float, float, float] = ...,
modification_time: datetime.datetime | None = ...,
page: int | None = ...,
title: str = "",
color: tuple[float, float, float] = (1, 1, 0),
modification_time: datetime.datetime | None = None,
page: int | None = None,
) -> AnnotationDict: ...
def ink_annotation(
self,
coords: Iterable[Incomplete],
contents: str = ...,
title: str = ...,
color: Sequence[float] = ...,
border_width: int = ...,
contents: str = "",
title: str = "",
color: Sequence[float] = (1, 1, 0),
border_width: int = 1,
) -> AnnotationDict: ...
def text(self, x: float, y: float, txt: str = ...) -> None: ...
def rotate(self, angle: float, x: float | None = ..., y: float | None = ...) -> None: ...
def rotation(self, angle: float, x: float | None = ..., y: float | None = ...) -> _GeneratorContextManager[None]: ...
def text(self, x: float, y: float, txt: 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 local_context(
self,
font_family: Incomplete | None = ...,
font_style: Incomplete | None = ...,
font_size: Incomplete | None = ...,
line_width: Incomplete | None = ...,
draw_color: Incomplete | None = ...,
fill_color: Incomplete | None = ...,
text_color: Incomplete | None = ...,
dash_pattern: Incomplete | None = ...,
font_family: Incomplete | None = None,
font_style: Incomplete | None = None,
font_size: Incomplete | None = None,
line_width: Incomplete | None = None,
draw_color: Incomplete | None = None,
fill_color: Incomplete | None = None,
text_color: Incomplete | None = None,
dash_pattern: Incomplete | None = None,
**kwargs,
) -> _GeneratorContextManager[None]: ...
@property
def accept_page_break(self) -> bool: ...
def cell(
self,
w: float | None = ...,
h: float | None = ...,
txt: str = ...,
border: bool | Literal[0, 1] | str = ...,
ln: int | Literal["DEPRECATED"] = ...,
w: float | None = None,
h: float | None = None,
txt: str = "",
border: bool | Literal[0, 1] | str = 0,
ln: int | Literal["DEPRECATED"] = "DEPRECATED",
align: str | Align = ...,
fill: bool = ...,
link: str = ...,
center: bool | Literal["DEPRECATED"] = ...,
markdown: bool = ...,
fill: bool = False,
link: str = "",
center: bool | Literal["DEPRECATED"] = "DEPRECATED",
markdown: bool = False,
new_x: XPos | str = ...,
new_y: YPos | str = ...,
) -> bool: ...
@@ -418,21 +424,21 @@ class FPDF:
def multi_cell(
self,
w: float,
h: float | None = ...,
txt: str = ...,
border: bool | Literal[0, 1] | str = ...,
h: float | None = None,
txt: str = "",
border: bool | Literal[0, 1] | str = 0,
align: str | Align = ...,
fill: bool = ...,
split_only: bool = ...,
link: str | int = ...,
ln: int | Literal["DEPRECATED"] = ...,
max_line_height: float | None = ...,
markdown: bool = ...,
print_sh: bool = ...,
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 = ...,
): ...
def write(self, h: float | None = ..., txt: str = ..., link: str = ..., print_sh: bool = ...) -> None: ...
def write(self, h: float | None = None, txt: str = "", link: str = "", print_sh: bool = False) -> None: ...
def image(
self,
name: str | Image.Image | BytesIO | StrPath,
@@ -446,57 +452,57 @@ class FPDF:
alt_text: str | None = None,
dims: tuple[float, float] | None = None,
) -> _Image: ...
def ln(self, h: float | None = ...) -> None: ...
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: ...
@overload
def output(self, name: Literal[""] = ...) -> bytearray: ... # type: ignore[misc]
def output(self, name: Literal[""] = "") -> bytearray: ... # type: ignore[misc]
@overload
def output(self, name: str) -> None: ...
def normalize_text(self, txt: str) -> str: ...
def sign_pkcs12(
self,
pkcs_filepath: str,
password: bytes | None = ...,
hashalgo: str = ...,
contact_info: str | None = ...,
location: str | None = ...,
signing_time: datetime.datetime | None = ...,
reason: str | None = ...,
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 = ...,
contact_info: str | None = ...,
location: str | None = ...,
signing_time: datetime.datetime | None = ...,
reason: str | None = ...,
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, txt, x: float, y: float, w: float = ..., h: float = ...) -> None: ...
def code39(self, txt, x: float, y: float, w: float = ..., h: float = ...) -> None: ...
def interleaved2of5(self, txt, x: float, y: float, w: float = 1, h: float = 10) -> None: ...
def code39(self, txt, 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, pages: int = ...) -> None: ...
def insert_toc_placeholder(self, render_toc_function, pages: int = 1) -> None: ...
def set_section_title_styles(
self,
level0: TitleStyle,
level1: TitleStyle | None = ...,
level2: TitleStyle | None = ...,
level3: TitleStyle | None = ...,
level4: TitleStyle | None = ...,
level5: TitleStyle | None = ...,
level6: TitleStyle | None = ...,
level1: TitleStyle | None = None,
level2: TitleStyle | None = None,
level3: TitleStyle | None = None,
level4: TitleStyle | None = None,
level5: TitleStyle | None = None,
level6: TitleStyle | None = None,
) -> None: ...
def start_section(self, name: str, level: int = 0, strict: bool = True) -> None: ...

View File

@@ -22,7 +22,7 @@ TRAILING_SPACE: Pattern[str]
COLOR_DICT: Final[dict[str, str]]
def px2mm(px: float) -> float: ...
def color_as_decimal(color: str | None = ...) -> tuple[int, int, int] | None: ...
def color_as_decimal(color: str | None = "#000000") -> tuple[int, int, int] | None: ...
class HTML2FPDF(HTMLParser):
HTML_UNCLOSED_TAGS: ClassVar[tuple[str, ...]]
@@ -65,7 +65,7 @@ class HTML2FPDF(HTMLParser):
li_tag_indent: int = 5,
dd_tag_indent: int = 10,
table_line_separators: bool = False,
ul_bullet_char: str = ...,
ul_bullet_char: str = "\x95",
heading_sizes: Incomplete | None = None,
warn_on_tags_not_matching: bool = True,
**_: Unused,
@@ -83,9 +83,9 @@ class HTML2FPDF(HTMLParser):
tbody: Incomplete
def handle_endtag(self, tag) -> None: ...
h: Incomplete
def set_font(self, face: Incomplete | None = ..., size: Incomplete | None = ...) -> None: ...
def set_style(self, tag: Incomplete | None = ..., enable: bool = ...) -> None: ...
def set_text_color(self, r: Incomplete | None = ..., g: int = ..., b: int = ...) -> None: ...
def set_font(self, face: Incomplete | None = None, size: Incomplete | None = None) -> None: ...
def set_style(self, tag: Incomplete | None = None, enable: bool = False) -> None: ...
def set_text_color(self, r: Incomplete | None = None, g: int = 0, b: int = 0) -> None: ...
def put_link(self, txt) -> None: ...
def render_toc(self, pdf, outline) -> None: ...
def error(self, message: str) -> None: ...

View File

@@ -12,4 +12,4 @@ SUPPORTED_IMAGE_FILTERS: tuple[_ImageFilter, ...]
def load_image(filename): ...
# Returned dict could be typed as a TypedDict.
def get_img_info(img, image_filter: _ImageFilter = ..., dims: Incomplete | None = ...) -> dict[str, Any]: ...
def get_img_info(img, image_filter: _ImageFilter = "AUTO", dims: Incomplete | None = None) -> dict[str, Any]: ...

View File

@@ -53,8 +53,8 @@ class Fragment:
def string(self): ...
def trim(self, index: int): ...
def __eq__(self, other: Fragment) -> bool: ... # type: ignore[override]
def get_width(self, start: int = ..., end: int | None = ..., chars: str | None = ..., initial_cs: bool = ...): ...
def get_character_width(self, character: str, print_sh: bool = ..., initial_cs: bool = ...): ...
def get_width(self, start: int = 0, end: int | None = None, chars: str | None = None, initial_cs: bool = True): ...
def get_character_width(self, character: str, print_sh: bool = False, initial_cs: bool = True): ...
class TextLine(NamedTuple):
fragments: tuple[Incomplete, ...]
@@ -90,7 +90,7 @@ class CurrentLine:
number_of_spaces: int
space_break_hint: Incomplete
hyphen_break_hint: Incomplete
def __init__(self, print_sh: bool = ...) -> None: ...
def __init__(self, print_sh: bool = False) -> None: ...
def add_character(
self,
character: str,
@@ -101,7 +101,7 @@ class CurrentLine:
original_character_index: int,
url: str | None = None,
): ...
def manual_break(self, justify: bool = ..., trailing_nl: bool = ...): ...
def manual_break(self, justify: bool = False, trailing_nl: bool = False): ...
def automatic_break_possible(self): ...
def automatic_break(self, justify: bool): ...
@@ -112,5 +112,5 @@ class MultiLineBreak:
fragment_index: int
character_index: int
idx_last_forced_break: Incomplete
def __init__(self, styled_text_fragments: Sequence[Fragment], justify: bool = ..., print_sh: bool = ...) -> None: ...
def get_line_of_given_width(self, maximum_width: float, wordsplit: bool = ...): ...
def __init__(self, styled_text_fragments: Sequence[Fragment], justify: bool = False, print_sh: bool = False) -> None: ...
def get_line_of_given_width(self, maximum_width: float, wordsplit: bool = True): ...

View File

@@ -22,7 +22,7 @@ class OutlineItemDictionary(PDFObject):
count: int
dest: Destination | None
struct_elem: StructElem | None
def __init__(self, title: str, dest: Destination | None = ..., struct_elem: StructElem | None = ...) -> None: ...
def __init__(self, title: str, dest: Destination | None = None, struct_elem: StructElem | None = None) -> None: ...
class OutlineDictionary(PDFObject):
type: str

View File

@@ -31,7 +31,12 @@ class PDFFont(PDFObject):
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 = ..., d_w: Incomplete | None = ..., w: Incomplete | None = ...
self,
subtype: str,
base_font: str,
encoding: str | None = None,
d_w: Incomplete | None = None,
w: Incomplete | None = None,
) -> None: ...
class PDFFontDescriptor(PDFObject):
@@ -94,10 +99,10 @@ class PDFCatalog(PDFObject):
struct_tree_root: Incomplete | None
def __init__(
self,
lang: str | None = ...,
page_layout: Incomplete | None = ...,
page_mode: Incomplete | None = ...,
viewer_preferences: Incomplete | None = ...,
lang: str | None = None,
page_layout: Incomplete | None = None,
page_mode: Incomplete | None = None,
viewer_preferences: Incomplete | None = None,
) -> None: ...
class PDFResources(PDFObject):
@@ -135,9 +140,9 @@ class PDFXObject(PDFContentStream):
height,
color_space,
bits_per_component,
img_filter: str | None = ...,
decode: Incomplete | None = ...,
decode_parms: Incomplete | None = ...,
img_filter: str | None = None,
decode: Incomplete | None = None,
decode_parms: Incomplete | None = None,
) -> None: ...
class PDFPage(PDFObject):

View File

@@ -9,12 +9,12 @@ class ViewerPreferences:
display_doc_title: bool
def __init__(
self,
hide_toolbar: bool = ...,
hide_menubar: bool = ...,
hide_window_u_i: bool = ...,
fit_window: bool = ...,
center_window: bool = ...,
display_doc_title: bool = ...,
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: ...
@property

View File

@@ -3,7 +3,7 @@ from typing import Any
class FPDFRecorder:
pdf: Any
accept_page_break: bool
def __init__(self, pdf, accept_page_break: bool = ...) -> None: ...
def __init__(self, pdf, accept_page_break: bool = True) -> None: ...
def __getattr__(self, name: str): ...
def rewind(self) -> None: ...
def replay(self) -> None: ...

View File

@@ -12,10 +12,10 @@ class Signature:
contents: str
def __init__(
self,
contact_info: Incomplete | None = ...,
location: Incomplete | None = ...,
m: Incomplete | None = ...,
reason: Incomplete | None = ...,
contact_info: Incomplete | None = None,
location: Incomplete | None = None,
m: Incomplete | None = None,
reason: Incomplete | None = None,
) -> None: ...
def serialize(self): ...

View File

@@ -29,9 +29,9 @@ class StructElem(PDFObject):
struct_type: str,
parent: PDFObject,
kids: Iterable[int] | Iterable[StructElem],
page_number: int | None = ...,
title: str | None = ...,
alt: str | None = ...,
page_number: int | None = None,
title: str | None = None,
alt: str | None = None,
) -> None: ...
def page_number(self) -> int | None: ...
@@ -41,7 +41,7 @@ class StructureTreeBuilder:
struct_elem_per_mc: Incomplete
def __init__(self) -> None: ...
def add_marked_content(
self, page_number: int, struct_type: str, mcid: int | None = ..., title: str | None = ..., alt_text: str | None = ...
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: ...

View File

@@ -20,8 +20,8 @@ relative_length_units: set[str]
absolute_length_units: dict[str, int]
angle_units: dict[str, float]
def resolve_length(length_str, default_unit: str = ...): ...
def resolve_angle(angle_str, default_unit: str = ...): ...
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): ...
@@ -68,7 +68,7 @@ def svg_path_converter(pdf_path: PaintedPath, svg_path: str) -> None: ...
class SVGObject:
@classmethod
def from_file(cls, filename, *args, encoding: str = ..., **kwargs): ...
def from_file(cls, filename, *args, encoding: str = "utf-8", **kwargs): ...
cross_references: Incomplete
def __init__(self, svg_text) -> None: ...
preserve_ar: Incomplete
@@ -78,12 +78,14 @@ class SVGObject:
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 = ...): ...
def transform_to_rect_viewport(self, scale, width, height, align_viewbox: bool = ..., ignore_svg_top_attrs: bool = ...): ...
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, x: Incomplete | None = ..., y: Incomplete | None = ..., debug_stream: Incomplete | None = ...
self, pdf, x: Incomplete | None = None, y: Incomplete | None = None, debug_stream: Incomplete | None = None
) -> None: ...
def handle_defs(self, defs) -> None: ...
def build_xref(self, xref): ...
def build_group(self, group, pdf_group: Incomplete | None = ...): ...
def build_group(self, group, pdf_group: Incomplete | None = None): ...
def build_path(self, path): ...

View File

@@ -11,11 +11,11 @@ _T = TypeVar("_T")
def clear_empty_fields(d): ...
def create_dictionary_string(
dict_,
open_dict: str = ...,
close_dict: str = ...,
field_join: str = ...,
key_value_join: str = ...,
has_empty_fields: bool = ...,
open_dict: str = "<<",
close_dict: str = ">>",
field_join: str = "\n",
key_value_join: str = " ",
has_empty_fields: bool = False,
): ...
def create_list_string(list_): ...
def iobj_ref(n): ...
@@ -37,13 +37,13 @@ class PDFObject:
def id(self, n: int) -> None: ...
@property
def ref(self) -> str: ...
def serialize(self, obj_dict: Incomplete | None = ..., _security_handler: StandardSecurityHandler | None = None) -> str: ...
def serialize(self, obj_dict: Incomplete | None = 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 = ...) -> None: ...
def __init__(self, contents: bytes, compress: bool = False) -> None: ...
def encrypt(self, security_handler: StandardSecurityHandler) -> None: ...
def build_obj_dict(key_values: SupportsItems[str, Incomplete]) -> dict[str, str]: ...
@@ -66,5 +66,5 @@ class DestinationXYZ(Destination):
left: float
zoom: float | Literal["null"]
page_ref: Incomplete | None
def __init__(self, page: int, top: float, left: float = ..., zoom: float | Literal["null"] = ...) -> None: ...
def __init__(self, page: int, top: float, left: float = 0, zoom: float | Literal["null"] = "null") -> None: ...
def serialize(self) -> str: ...

View File

@@ -10,31 +10,31 @@ class FlexTemplate:
splitting_pdf: Any
handlers: Any
texts: Any
def __init__(self, pdf, elements: Incomplete | None = ...) -> None: ...
def __init__(self, pdf, elements: Incomplete | None = None) -> None: ...
elements: Any
keys: Any
def load_elements(self, elements) -> None: ...
def parse_csv(self, infile, delimiter: str = ..., decimal_sep: str = ..., encoding: Incomplete | None = ...): ...
def parse_csv(self, infile, delimiter: str = ",", decimal_sep: str = ".", encoding: Incomplete | None = None): ...
def __setitem__(self, name, value) -> None: ...
set: Any
def __contains__(self, name): ...
def __getitem__(self, name): ...
def split_multicell(self, text, element_name): ...
def render(self, offsetx: float = ..., offsety: float = ..., rotate: float = ..., scale: float = ...): ...
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: Incomplete | None = ...,
elements: Incomplete | None = ...,
format: str = ...,
orientation: str = ...,
unit: str = ...,
title: str = ...,
author: str = ...,
subject: str = ...,
creator: str = ...,
keywords: str = ...,
infile: Incomplete | None = None,
elements: Incomplete | None = 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: Incomplete | None = ..., dest: Incomplete | None = ...) -> None: ... # type: ignore[override]
def render(self, outfile: Incomplete | None = None, dest: Incomplete | None = None) -> None: ... # type: ignore[override]

View File

@@ -37,7 +37,7 @@ class GlitterTransition(Transition):
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: ...
def __init__(self, dimension: Literal["H", "V"], direction: Literal[0, 270] | None = None) -> None: ...
def serialize(self) -> str: ...
class PushTransition(Transition):

View File

@@ -6,7 +6,7 @@ from typing_extensions import Literal, TypeAlias
_Unit: TypeAlias = Literal["pt", "mm", "cm", "in"]
def buffer_subst(buffer: bytearray, placeholder: str, value: str) -> bytearray: ...
def format_date(date: datetime.datetime, with_tz: bool = ...) -> str: ...
def format_date(date: datetime.datetime, with_tz: bool = False) -> str: ...
def enclose_in_parens(s: str) -> str: ...
def escape_parens(s): ...
def b(s): ...