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

Improve contextlib #406

Merged
merged 5 commits into from
Jul 29, 2016
Merged

Improve contextlib #406

merged 5 commits into from
Jul 29, 2016

Conversation

tharvik
Copy link
Contributor

@tharvik tharvik commented Jul 26, 2016

Merge both contextlib.

ContextManager do not existing in typing for now.

Currently failing because of mypy#1941

@tharvik
Copy link
Contributor Author

tharvik commented Jul 26, 2016

Bypassed mypy#1941 using a TypeVar.

class ContextDecorator:
def __call__(self, func: Callable[..., None]) -> Callable[..., ContextManager[None]]: ...

class ExitStack(ContextManager[ExitStack]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExitStack does not exist in Python 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups, I actually forgot to add the py2 version; fixed.

@matthiaskramm matthiaskramm merged commit 1bd78d4 into python:master Jul 29, 2016
@tharvik tharvik deleted the improve_contextlib branch August 8, 2016 06:47
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

Successfully merging this pull request may close these issues.

3 participants