typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Add `wurlitzer` stubs

Open hoel-bagard opened this issue 1 year ago • 13 comments

This PR adds stubs for the wurlitzer package.

hoel-bagard avatar Feb 21 '24 12:02 hoel-bagard

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 12:02 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 12:02 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 12:02 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 13:02 github-actions[bot]

Thanks for the (very fast :open_mouth: ) review, I'll look into using protocols.

Edit: looks like some overloads will be required to get precise return types, I'm passing this PR back into draft mode for now.

hoel-bagard avatar Feb 21 '24 13:02 hoel-bagard

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 13:02 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 13:02 github-actions[bot]

@AlexWaygood Do you know what in the overloads is causing the CI to fail ?

hoel-bagard avatar Feb 21 '24 14:02 hoel-bagard

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 14:02 github-actions[bot]

The error looks like a bug in stubtest, but you can probably work around it by not using overloaded context managers. Instead of @contextmanager together with -> Iterator[Foo], you could try -> AbstractContextManager[Foo] or -> _GeneratorContextManager[Foo]. You need to import from contextlib.

Akuli avatar Feb 21 '24 14:02 Akuli

The error looks like a bug in stubtest, but you can probably work around it by not using overloaded context managers. Instead of @contextmanager together with -> Iterator[Foo], you could try -> AbstractContextManager[Foo] or -> _GeneratorContextManager[Foo]. You need to import from contextlib.

Yeah, @Akuli is right. Stubtest in general isn't great at dealing with several decorators on a single function -- see https://github.com/python/mypy/issues/14950 (which is now fixed, but was only fixed by special-casing @final).

AlexWaygood avatar Feb 21 '24 14:02 AlexWaygood

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 23:02 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Feb 21 '24 23:02 github-actions[bot]

@AlexWaygood If you have time to review the changes.

hoel-bagard avatar Mar 08 '24 02:03 hoel-bagard

@Akuli Thanks for the improvements/fixes!

hoel-bagard avatar Mar 09 '24 11:03 hoel-bagard

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Mar 09 '24 11:03 github-actions[bot]