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+
* Simplify and add missing types for copy module.
Error and error were missing. I also removed the internal arg memo.
* Move copy module into 2and3
* Bring back internal kwargs
* md5.md5(string)
* switch md5 from str to AnyStr, add missing constants
* add missing import
* digest() and hexdigest() never return unicode
* make md5.md5 an alias of, and fix, hashlib_hash
* remove unnecessary import
* fix duplicate block_size
* md5.md5 and md5.new are aliases for hashlib.md5
* Add buffer types to struct module.
I noticed these were missing and I made the version look alike for an easy rename into 2and3.
* Add array to WriteBuffer, add iter_unpack
* Code review comments
None is the default value for these two arguments to logging.Logger._log (which
most other stuff in logging delegates to).
I was getting errors in my codebase because mypy now distinguishes between Any
and Optional[Any].
* Add missing kwargs for create_server and create_datagram_endpoint
Looks like `create_server` and `create_datagram_endpoint` have supported `reuse_port`, `reuse_address`, and `sock` since 3.4.
https://docs.python.org/3.4/library/asyncio-eventloop.htmlee51327a23/Lib/asyncio/events.py
* Fixes to create_server, create_datagram_endpoing
- Add allow sequence for `hosts` in `create_server`
- Add `allow_broadcast` to `create_datagram_endpoint`
- Reorder `sock` in `create_datagram_endpoint`
* Import Sequence
* Sockets are Optionals
* Improve types for CalledProcessError
This adds union types in the constructor to account for parameters that
might be either byte strings or unicode strings. At the same time, this
*removes* specific types from the user-accessible fields, to avoid the
need for users to at every use site specify which types their particular
instance was instantiated with.
* remove 'moral' comments; add List import; change 'str' to 'Text'
* import Text
* List -> Sequence; reinsert 'moral' comments
* Regularize string types everywhere
This defines _TXT and _CMD aliases, and uses them everywhere applicable.
Also brings the _FILE alias to python3.
* fix typo; possibly fix indentation
* remove trailing comma, which caused problems in python 2 tests
* fix py2 outputs to be bytes; tweak descriptive comments; remove one AnyStr