Added a # type: ignore comment to the `timeout` property setter in filelock to suppress errors about type mismatch between setter and getter.
Co-authored-by: Eric Traut <erictr@microsoft.com>
This is enough to get stubtest working (note that it's a little annoying
to install mypy currently since typed-ast seems to have broken again on
Python 3.10)
Co-authored-by: hauntsaninja <>
The TypeVar `_T` was being used as a type argument for `PathLike`, but `PathLike` requires that its type argument be constrained to `str` or `bytes`, and `_T` didn't provide any such constraint. The easy workaround is to use the TypeVar `AnyStr` instead.
Co-authored-by: Eric Traut <erictr@microsoft.com>
Fixed a problem with the openssl-python stubs. It was using `unicode`, which is not defined in Python 3. I conditionalized its use based on Python version check.
Co-authored-by: Eric Traut <erictr@microsoft.com>
0 is the default value for the timeout argument for both blpop and brpop. When the timeout is `0`, the return type is non-nullable. Otherwise the return type is optional.
I tested my change with the following code
```python
from typing import Optional, Tuple
import redis
def test_blpop_timeout(r: redis.Redis) -> None:
a: Tuple[bytes, bytes] = r.blpop('')
b: Tuple[bytes, bytes] = r.blpop('',timeout=0)
c: Optional[Tuple[bytes, bytes]] = r.blpop('', timeout=1)
d: Optional[Tuple[bytes, bytes]] = r.blpop('', timeout=1.0)
def test_brpop_timeout(r: redis.Redis) -> None:
a: Tuple[bytes, bytes] = r.brpop('')
b: Tuple[bytes, bytes] = r.brpop('',timeout=0)
c: Optional[Tuple[bytes, bytes]] = r.brpop('', timeout=1)
d: Optional[Tuple[bytes, bytes]] = r.brpop('', timeout=1.0)
```
The documentation says, "The parse() function can take either a filename
or an open file object."
(https://docs.python.org/3.8/library/xml.dom.minidom.html). The function
was annotated as only accepting a str, so I added IO[Any].
According to the docs in paramiko the return type will always be bytes
```
.. note::
``'b'`` mode flag is ignored (``self.FLAG_BINARY`` in
``self._flags``), because SSH treats all files as binary, since we
have no idea what encoding the file is in, or even if the file is
text data.
:param int size: maximum number of bytes to read
:returns:
data read from the file (as bytes), or an empty string if EOF was
encountered immediately
```
For now, the test requires changes that have been merged into the pytype master branch but not yet released. I'll update requirements-tests-py3.txt again once I've cut a new release (hopefully later this week).
* Fix pytype_test.
* Re-enable pytype_test.
* Remove continue-on-error from pytype_test.
* Temporarily install pytype from its master branch, as the code to
support the new directory structure hasn't been released yet.
* Set TYPESHED_HOME before using pytype.pytd.Typeshed().