* Change Uses of List[] to Sequence[] in argument positions.
One of these (parse_args()) broke in real-world code, because the
expected type was List[Union[str, bytes]] but the actual type was
List[str] (because List is invariant). That is ridiculous, so I
changed the accepted type to Sequence[_Text] which is covariant. Then
I found a few other methods/functions that probably should also be
changed to Sequence, but I'm less certain of those. I'm not at all
sure about the instance/class attributes, so I left those alone
(though I suspect those might also have to switch).
* Fixes suggested by code review
- Changed Sequence[Option] to Iterable[Option] everywhere
- Changed _process_args to plain List
CPython _warnings module implementation accepts Warning subclasses and None, but not any subclass of BaseException
specified in the stub. The stub for warnings is correct.
* Partial lib2to3 stubs
* Use typing.Text instead of str
* Add a _Path shortcut for managing PathLike
* Respond to review, pgen2/driver
* Respond to review, pgen2/grammar
* Respond to review, pgen2/parse
* Respond to review, pgen2/pgen
* Respond to review, pgen2/token
* Respond to review, pgen2/tokenize
* Respond to review, pytree
* Move to 2and3
* Make pytype happy
* Respond to review nits
* Move _RawNode, _Convert to pytree and make the latter return None
* Make concrete Symbols subclasses for python and pattern
* Add missing Callable import
* Fix a few return types in stdlib/2/inspect.pyi.
* Rename _FrameRecord to _FrameInfo
* Correct some return types in itertools.pyi from Iterable to Iterator.
* Change types.pyi syntax that pytype can't parse.
Add typehints for the following `asyncio.subprocess.Process` attributes:
- `stdin`: `Optional[asyncio.streams.StreamWriter]`
- `stdout`: `Optional[asyncio.streams.StreamReader]`
- `stderr`: `Optional[asyncio.streams.StreamReader]`
- `pid`: `int`
Include stdin, stdout, and stderr also in SSP.
mypy could not recognize the case when we use contextmanager as a
decorator, which has been supported since Python 3.2.
In the following code snippet,
from contextlib import contextmanager
@contextmanager
def foo(arg1):
try:
print(arg1)
print('1')
yield
finally:
print('2')
@foo('0')
def foo2():
print('3')
foo2()
we get mypy error as follows,
error: ContextManager[Any] not callable
The suggested changes can fix this error and properly reflect the
updated contextmanager usage pattern.
* Fix patch.object to return a _patch context manager.
This should fix https://github.com/python/typeshed/issues/914
* Prefer None over ... to be consistent with the rest of the file.
* Add socket enum classes from py3.4+
Adds four IntEnum classes in the socket module that mirror the
AF_, AI_, MSG_, and SOCK_ sets of constants.
* Update socket AddressInfo/MsgFlag to use IntFlag type
* IntFlag, AddressInfo, and MsgFlag are py 3.6+