Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper type hits deduced by liters #80

Open
SebastianMorawiec opened this issue Apr 16, 2024 · 0 comments
Open

Improper type hits deduced by liters #80

SebastianMorawiec opened this issue Apr 16, 2024 · 0 comments

Comments

@SebastianMorawiec
Copy link

SebastianMorawiec commented Apr 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant