Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stubs/fpdf2/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ 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"
fpdf.fonts.Glyph._DT
Comment on lines +14 to +16
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a mypy issue relating to https://github.com/python/mypy/blob/5c87e972d3c2c3c1f6229e1a655c4b903207dd32/mypy/plugins/dataclasses.py#L86 (at a guess, it's probably synthesizing a TypeVar and attaching it to the class body, then not ignoring the synthesized symbol when running stubtest?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably report it upstream to mypy as a stubtest bug

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10 changes: 2 additions & 8 deletions stubs/fpdf2/fpdf/fonts.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,13 @@ class PDFFontDescriptor(PDFObject):
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:
glyph_id: int
unicode: tuple[Incomplete, ...]
glyph_name: str
glyph_width: int
def __hash__(self): ...
def __init__(self, glyph_id, unicode, glyph_name, glyph_width) -> None: ...
def __lt__(self, other): ...
def __gt__(self, other): ...
def __le__(self, other): ...
def __ge__(self, other): ...

__match_args__ = ("glyph_id", "unicode", "glyph_name", "glyph_width")
def __hash__(self) -> int: ...

class SubsetMap:
font: TTFFont
Expand Down