-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
stubs: false positiveType checkers report false errorsType checkers report false errorstopic: ioI/O related issuesI/O related issues
Description
Compare the types of the filename
parameters between
def __init__(self, filename: str | IO[bytes], **kw) -> None: ... |
and
def build(self, flowables: list[Flowable], filename: str | None = None, canvasmaker: _CanvasMaker = ...) -> None: ... |
If we trace the use of the filename
parameter through BaseDocTemplate
, we go through:
- In
build()
: used in the call to_startBuild()
- In
_startBuild()
: is used in the call to_makeCanvas
- In
_makeCanvas()
: Is used as one alternative in a parameter passed into (by default)canvas.Canvas
, and the other alternative isself.filename
, which is populated inBaseDocTemplate.__init__()
. - It is not used elsewhere in the call tree.
Therefore, the type of the filename
parameter of BaseDocTemplate.build()
should be str | IO[Bytes] | None
. It also matches the type of the parameter of Canvas.__init__()
.
I've put a minimal test for this issue in a gist: https://gist.github.com/egerlach/f47c9722794b5d03f832aada27da2293
Metadata
Metadata
Assignees
Labels
stubs: false positiveType checkers report false errorsType checkers report false errorstopic: ioI/O related issuesI/O related issues