Skip to content

pep 484: explicit reexport as intended #4586

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 2 commits into from
Sep 30, 2020
Merged

Conversation

hauntsaninja
Copy link
Collaborator

See discussion on typing-sig.
This doesn't take care of some third_party libraries, will follow up on
those.

See discussion on typing-sig.
This doesn't take care of some third_party libraries, will follow up on
those.
Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Thanks! I found a few blank lines that strike me as excessive (we're not following PEP 8 on purpose).

@@ -268,7 +270,9 @@ class stat_result:
st_type: int

if sys.version_info >= (3, 6):
from builtins import _PathLike as PathLike # See comment in builtins
from builtins import _PathLike

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this blank line helps readability.

@@ -3,7 +3,9 @@
import sys

if sys.version_info < (3, 9):
from os import devnull as DEV_NULL
import os

Copy link
Member

Choose a reason for hiding this comment

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

No blank line here.

@@ -5,7 +5,9 @@ import typing
import unittest
from __builtin__ import unichr as unichr
from functools import wraps as wraps
from StringIO import StringIO as BytesIO, StringIO as StringIO
from StringIO import StringIO as StringIO

Copy link
Member

Choose a reason for hiding this comment

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

No blank line.

@hauntsaninja
Copy link
Collaborator Author

Typeshed has surrendered itself to black, which mandates those blank lines

@hauntsaninja hauntsaninja marked this pull request as ready for review September 29, 2020 22:53
@gvanrossum
Copy link
Member

Oooh, that last failing test is a fun one. The code flow through mypy is entirely different when defining a type alias instead of renaming on import.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

I'll tentatively approve this, pending a solution for the mypy failures. I think it's a good idea that the re-export ambiguity is being discussed and fixed.

@JelleZijlstra
Copy link
Member

I haven't checked but I think you need to alias generics with something like PathLike = _PathLike[T], possibly with a more specific typevar.

@hauntsaninja
Copy link
Collaborator Author

hauntsaninja commented Sep 30, 2020

I think this just works and needs builtins._PathLike to not be hardcoded in mypy. Going to attempt the merge dance.

@hauntsaninja hauntsaninja merged commit e3889c7 into python:master Sep 30, 2020
@hauntsaninja hauntsaninja deleted the siximp branch September 30, 2020 17:04
@jakebailey
Copy link
Contributor

Yes; I was just about to say that I think it'd be weird to have to add typevars to emulate behavior that would have previously worked in the "as assignment", especially if we're expecting the PEP clarification to go through and existing stubbers/annotators to fix up their code.

hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this pull request Sep 30, 2020
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this pull request Sep 30, 2020
hauntsaninja added a commit to python/mypy that referenced this pull request Sep 30, 2020
hauntsaninja added a commit to hauntsaninja/mypy that referenced this pull request Oct 4, 2020
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.

5 participants