Skip to content

Conversation

@CraftSpider
Copy link
Contributor

Closes #3096
Adds the _TemporaryFileWrapper type to tempfile. Needed to be added to stubtest's ignores, as its methods are dynamic

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.

LGTM, just one question below. Also, shouldn't NamedTemporaryFile be changed to return this new type?

) -> Optional[bool]: ...
def __getattr__(self, name: str) -> Any: ...
def close(self) -> None: ...
def unlink(self, path: str) -> None: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where does this come from? As far as I can see, it's not defined in _TemporaryFileWrapper, so shouldn't it be below the next comment?

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

ignite (https://github.com/pytorch/ignite)
+ ignite/handlers/checkpoint.py:8: error: unused 'type: ignore' comment
+ ignite/handlers/checkpoint.py:627: error: Incompatible types in assignment (expression has type "None", variable has type "_TemporaryFileWrapper")  [assignment]
+ ignite/handlers/checkpoint.py:629: error: Incompatible types in assignment (expression has type "IO[bytes]", variable has type "_TemporaryFileWrapper")  [assignment]


streamlit (https://github.com/streamlit/streamlit.git)
+ lib/streamlit/hashing.py:491: error: unused 'type: ignore' comment

@srittau srittau merged commit 6870caf into python:master Jan 23, 2021
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.

missing annotation for tempfile._TemporaryFileWrapper in Python 3

2 participants