Skip to content

pep 484: explicit reexport as intended#4586

Merged
hauntsaninja merged 2 commits into
python:masterfrom
hauntsaninja:siximp
Sep 30, 2020
Merged

pep 484: explicit reexport as intended#4586
hauntsaninja merged 2 commits into
python:masterfrom
hauntsaninja:siximp

Conversation

@hauntsaninja
Copy link
Copy Markdown
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
Copy Markdown
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).

Comment thread stdlib/3/os/__init__.pyi
if sys.version_info >= (3, 6):
from builtins import _PathLike as PathLike # See comment in builtins
from builtins import _PathLike

Copy link
Copy Markdown
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.

Comment thread stdlib/3/platform.pyi
if sys.version_info < (3, 9):
from os import devnull as DEV_NULL
import os

Copy link
Copy Markdown
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.

Comment thread third_party/2/six/__init__.pyi Outdated
from functools import wraps as wraps
from StringIO import StringIO as BytesIO, StringIO as StringIO
from StringIO import StringIO as StringIO

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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