Skip to content

Improper type hits deduced by liters #80

@SebastianMorawiec

Description

@SebastianMorawiec

As part of our project we are using wurlitzer to redirect some of the outputs into the files.
The problem I am facing is that library lacks type deduction, thus linters are trying to deduce types themselves leading to errors.

Even trying out the doc example (saved as test.py):

from io import StringIO
from wurlitzer import pipes, STDOUT

out = StringIO()
with pipes(stdout=out, stderr=STDOUT):
    print("test")

stdout = out.getvalue()

When running
pyright test.py

I got the following error

  //:5:19 - error: Argument of type "StringIO" cannot be assigned to parameter "stdout" of type "int"
    "StringIO" is incompatible with "int" (reportGeneralTypeIssues)

This is basically a feature request - I can workaround it by silencing linters and type checkers for individual lines in my code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions