Skip to content

fix integration of io with mypy #196

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

Merged
merged 1 commit into from
May 12, 2016
Merged

fix integration of io with mypy #196

merged 1 commit into from
May 12, 2016

Conversation

tharvik
Copy link
Contributor

@tharvik tharvik commented May 12, 2016

See #194 for reference.

So, that should fix mypy tests. Why coping classes around? Because it is the (sadly only) way to do it, BaseIO can not inherit both BinaryIO because then TextIOWrapper would need to redefine some method (by having TextIO) but failing because not being compliant with BinaryIO. Copying seems like the best solution.

There is also some issues with mypy itself (should redefine writelines in both TextIO and BinaryIO opened here, using write_through in python 3.2 but it appears only in python 3.3).

@gvanrossum
Copy link
Member

I will have to put off reviewing this until next week (this week I'm over-committed).

@tharvik
Copy link
Contributor Author

tharvik commented May 12, 2016

I'll ping you next week then, thanks.

@gvanrossum gvanrossum merged commit e9efb31 into python:master May 12, 2016
@gvanrossum
Copy link
Member

What the heck I'll just merge it now. Long term this worries me -- the relationship between the class tree here, the one in the real stdlib, and the classes defined in typing.py seem all to be somewhat problematic. Ideally mypy should be able to represent such hierarchies faithfully -- I'm not sure if we're looking at changes needed to mypy, to io.pyi, or to typing.py[i].

@tharvik
Copy link
Contributor Author

tharvik commented May 13, 2016

the relationship between the class tree here, the one in the real stdlib, and the classes defined in typing.py seem all to be somewhat problematic. Ideally mypy should be able to represent such hierarchies faithfully -- I'm not sure if we're looking at changes needed to mypy, to io.pyi, or to typing.py[i].

IMO, it would better to put it in typing.py, as IO[AnyStr] implement IOBase by definition, so that would mean moving most of IO[AnyStr] to IOBase, and having it only making the methods abstract.

@tharvik tharvik deleted the fix_io branch May 14, 2016 10:25
momandine pushed a commit to momandine/typeshed that referenced this pull request Jul 5, 2016
momandine pushed a commit to momandine/typeshed that referenced this pull request Jul 5, 2016
hswong3i pushed a commit to alvistack/python-typeshed that referenced this pull request May 25, 2025
* Re-export all names from typing

Fixes python#50.

I decided to exclude top-level names that have a definite removal
timeline (io, re, ByteString); there's no point in re-exporting them
now.

Many other names are deprecated without a definite removal plan
(PEP 585). If they do get removed eventually, typing-extensions can
simply re-export the builtin/collections.abc names.

In the documentation, I add a separate section listing all the names
that are pure aliases for typing. This makes it easier to distinguish
the cases where there is something more interesting going on in
typing-extensions.

Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Shantanu <[email protected]>
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.

2 participants