mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-02 06:00:24 +08:00
Add __slots__ to third-party packages using stubdefaulter (#14619)
This commit is contained in:
@@ -55,6 +55,26 @@ class AnnotationMixin:
|
||||
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):
|
||||
|
||||
@@ -15,6 +15,7 @@ class _BracketInfo(TypedDict):
|
||||
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
|
||||
@@ -28,11 +29,13 @@ class BidiCharacter:
|
||||
|
||||
@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
|
||||
@@ -46,6 +49,7 @@ def auto_detect_base_direction(string: str, stop_at_pdi: bool = False, debug: bo
|
||||
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
|
||||
|
||||
@@ -20,6 +20,7 @@ class HarfBuzzFont(Incomplete): # derives from uharfbuzz.Font
|
||||
|
||||
@dataclass
|
||||
class FontFace:
|
||||
__slots__ = ("family", "emphasis", "size_pt", "color", "fill_color")
|
||||
family: str | None
|
||||
emphasis: TextEmphasis | None
|
||||
size_pt: int | None
|
||||
@@ -79,6 +80,7 @@ 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
|
||||
@@ -94,6 +96,27 @@ class CoreFont:
|
||||
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
|
||||
@@ -137,6 +160,7 @@ class PDFFontDescriptor(PDFObject):
|
||||
|
||||
@dataclass(order=True)
|
||||
class Glyph:
|
||||
__slots__ = ("glyph_id", "unicode", "glyph_name", "glyph_width")
|
||||
glyph_id: int
|
||||
unicode: tuple[Incomplete, ...]
|
||||
glyph_name: str
|
||||
|
||||
@@ -9,6 +9,7 @@ from .syntax import Destination, PDFObject, PDFString
|
||||
|
||||
@dataclass
|
||||
class OutlineSection:
|
||||
__slots__ = ("name", "level", "page_number", "dest", "struct_elem")
|
||||
name: str
|
||||
level: int
|
||||
page_number: int
|
||||
@@ -16,6 +17,7 @@ class OutlineSection:
|
||||
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
|
||||
@@ -28,6 +30,7 @@ class OutlineItemDictionary(PDFObject):
|
||||
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
|
||||
|
||||
@@ -102,6 +102,21 @@ class PDFXmpMetadata(PDFContentStream):
|
||||
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
|
||||
@@ -126,11 +141,13 @@ class PDFXObject(PDFContentStream):
|
||||
) -> 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
|
||||
@@ -143,6 +160,24 @@ class PDFPageLabel:
|
||||
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
|
||||
@@ -184,6 +219,7 @@ class PDFXrefAndTrailer(ContentWithoutID):
|
||||
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
|
||||
|
||||
@@ -6,17 +6,20 @@ 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
|
||||
|
||||
@@ -105,6 +105,7 @@ class Row:
|
||||
|
||||
@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
|
||||
|
||||
Reference in New Issue
Block a user