Closed AlexanderPodorov closed 3 months ago
Hi @AlexanderPodorov ,
pdf.table()
just passes all provided arguments to table.Table()
, which does include a num_heading_rows
parameter.
That arrangement works perfectly fine (the relevant code hasn't been changed for about a year).
Can you please copy the exact wording of the "type warnings" you get from using it? That is really the most important information that might enable us to say anything useful about your results, and possibly fix any actual problems.
Hi @gmischler ,
Sorry about not being specific.
It works well in runtime, but does not pass type checking.
As far as I noticed typeshed
includes type stubs for fpdf2
and signature for pdf.table()
is not correct.
See the signature:
https://github.com/python/typeshed/blob/6220c20d9360b12e2287511587825217eec3e5b5/stubs/fpdf2/fpdf/fpdf.pyi#L569-L584
num_heading_rows
is missing here.
Just found another issue: text_align: str | Align = "JUSTIFY",
does not accept tuple[str, ...]
usage, which is used in the docs, e.g.:
with pdf.table(text_align=("CENTER", "CENTER", "RIGHT", "LEFT")) as table:
...
If typeshed produces nonsensical warnings about our code, why do you think this is our responsibility? This "issue" really is a non-issue. Closing now.
Of course, if you find type hints here in this repository that don't match what the code actually accepts, feel free to submit a PR with an improvement.
Sorry about that! I will file an issue for the typeshed
.
Describe the bug
Error details See example from documentation:
However parameter
num_heading_rows
is not presented inpdf.table
signature causing type warnings.Environment Please provide the following information:
fpdf2
version used: 2.7.9