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

pylance flags an error for : Object of type "BufferedWriter" cannot be used with "with" because it does not implement __enter__ #718

Open
Josverl opened this issue May 6, 2023 · 1 comment
Labels
pyright report a typecheck issue reported by pyright or pylance Quality QA of published stubs

Comments

@Josverl
Copy link
Owner

Josverl commented May 6, 2023

            with open(_toml, "wb") as output:
                tomli_w.dump(pyproject, output)

raises the errors
Object of type "BufferedWriter" cannot be used with "with" because it does not implement enter

class BufferedWriter:
    def flush(self, *args, **kwargs) -> Any: ...
    def write(self, *args, **kwargs) -> Any: ...
    def __init__(self, *argv, **kwargs) -> None: ...
@Josverl
Copy link
Owner Author

Josverl commented May 6, 2023

Set BinaryIO as the baseclass for BufferedWriter will need to be done using a codemod as the class is not documented in the docstubs

already tried lookup:
"BufferedWriter": "IOBase", # DOCME: not in documentation

@Josverl Josverl added the Quality QA of published stubs label Dec 15, 2023
@Josverl Josverl added the pyright report a typecheck issue reported by pyright or pylance label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pyright report a typecheck issue reported by pyright or pylance Quality QA of published stubs
Projects
None yet
Development

No branches or pull requests

1 participant