Skip to content

Commit

Permalink
Refactor away uses of _promote in lib-python
Browse files Browse the repository at this point in the history
  • Loading branch information
JukkaL committed Mar 9, 2015
1 parent 845ac5e commit f09f6e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions lib-python/3.2/tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
from typing import (
Any as _Any, Callable as _Callable, Iterator as _Iterator,
Undefined as _Undefined, List as _List, Tuple as _Tuple, Dict as _Dict,
Iterable as _Iterable, IO as _IO, _promote as __promote,
Traceback as _Traceback
Iterable as _Iterable, IO as _IO, Traceback as _Traceback, cast as _cast,
)

try:
Expand Down Expand Up @@ -353,7 +352,6 @@ def mktemp(suffix: str = "", prefix: str = template, dir: str = None) -> str:
raise IOError(_errno.EEXIST, "No usable temporary filename found")


@__promote(_IO[_Any])
class _TemporaryFileWrapper:
"""Temporary file wrapper
Expand Down Expand Up @@ -457,7 +455,7 @@ def NamedTemporaryFile(mode: str = 'w+b', buffering: int = -1,
file = _io.open(fd, mode, buffering=buffering,
newline=newline, encoding=encoding)

return _TemporaryFileWrapper(file, name, delete)
return _cast(_IO[_Any], _TemporaryFileWrapper(file, name, delete))

if _os.name != 'posix' or _sys.platform == 'cygwin':
# On non-POSIX and Cygwin systems, assume that we cannot unlink a file
Expand Down
3 changes: 1 addition & 2 deletions lib-python/3.2/test/test_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from test.support import check_warnings, captured_stdout

from typing import (
Any, Callable, Tuple, List, Sequence, BinaryIO, Traceback, IO, Union, _promote, cast
Any, Callable, Tuple, List, Sequence, BinaryIO, Traceback, IO, Union, cast
)

import bz2
Expand Down Expand Up @@ -851,7 +851,6 @@ class TestCopyFile(unittest.TestCase):

_delete = False

@_promote(IO[str])
class Faux(object):
_entered = False
_exited_with = None # type: tuple
Expand Down

0 comments on commit f09f6e6

Please sign in to comment.