Skip to content

docker: Wrong type in Container.attach() #15143

@martinber

Description

@martinber

I use container.attach(stdout=True, stderr=True, stream=True, logs=True) and I get a <class 'docker.types.daemon.CancellableStream'>, and when iterating over it I get each line as a bytes object which I .decode("utf-8"). My code works correctly

In mypy 1.19.1 I get

code.py:492: error: Item "str" of "str | tuple[str | None, str | None] | None" has no attribute "decode"  [union-attr]
code.py:492: error: Item "None" of "str | tuple[str | None, str | None] | None" has no attribute "decode"  [union-attr]
code.py:492: error: Item "tuple[str | None, ...]" of "str | tuple[str | None, str | None] | None" has no attribute "decode"  [union-attr]

I think the stubs are wrong on this line

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions