As promised in #2014.
There are virtually no real changes between Python 2 and 3 in this module, but the stub had accumulated some meaningless differences. I also fixed a few incorrect types.
They have getaddrinfo(3) as their backend, and accept port='http' etc. You can even omit (pass None to) either of host or port for start_server() to effectively select 'localhost' and an arbitrary ephemeral port, respectively.
Looked at https://github.com/requests/requests/blob/master/requests/structures.py.
The "data" argument to the CaseInsensitiveDict constructor is passed as is to .update(),
so I accept the same argument types as MutableMapping.update.
LookupDict is strangely named and implemented but the point seems to be that you
setattr its keys, and then can access them with both attribute access and subscripting.
See its usage in d1fb1a29ab/requests/status_codes.py (L102).
* Make {C,WIN,PY}FUNCTYPE's restype argument optional (for void returns)
* Make WinError return WindowsError
* Don't have Array explicitly inherit from Sized
(since inheriting from classes with different metaclasses causes problems,
and it is a protocol anyways)
* Have Array.__iter__ properly return an Iterator instead of an Iterable
* Support additional argument types for c_void_p parameters
* Don't allow passing bytes where a writable c_void_p is expected
* Fix type of ctypes._CDataMeta.__[r]mul__
* Rename ctypes._cparam to _CArgObject to match the real type name
* Fix value type of ctypes.HRESULT
* Add stub for ctypes.wintypes
* Fix trailing whitespace in ctypes.wintypes
* Add a workaround to ctypes.Array to fix incorrect typing in some cases
* Expand multiple assignments so mypy recognizes them as type aliases
* Rename ctypes._Pointer to pointer so it can be used externally
This is in our style guide. This is the last piece of offending code; I just submitted ambv/flake8-pyi#10 to enforce the rule in the linter in the future.
This was introduced in a recent version (so it doesn't affect us right now but will if we upgrade the flake8 version used in tests). It gives errors like:
```
/home/travis/build/ambv/flake8-pyi/.tox/typeshed/tmp/typeshed/stdlib/3/re.pyi:21:9: E741 ambiguous variable name 'I'
/home/travis/build/ambv/flake8-pyi/.tox/typeshed/tmp/typeshed/stdlib/3/re.pyi:39:5: E741 ambiguous variable name 'I'
/home/travis/build/ambv/flake8-pyi/.tox/typeshed/tmp/typeshed/stdlib/3/re.pyi:58:5: E741 ambiguous variable name 'I'
/home/travis/build/ambv/flake8-pyi/.tox/typeshed/tmp/typeshed/third_party/2/OpenSSL/crypto.pyi:43:5: E741 ambiguous variable name 'O'
```
These aren't useful for typeshed, because regardless of whether it's good style, these libraries really do contain variables named `I` and `O`.
* ArgumentParser's add_argument returns the Action that was created.
* Make add_argument's dest parameter Optional. _ArgumentGroup's add_argument should also return the Action.
- Made deque.maxlen read-only
- We don't support 3.2, so we don't care about signature changes in it
- There don't seem to be any missing set operations (I compared the dir() of this class to that of builtins.set)
In python3 `RotatingFileHandler` is a subclass of `BaseRotatingHandler` which is a subclass of `FileHandler` which is a subclass of `StreamHandler` which as a `terminator` property but I'm getting a `"RotatingFileHandler" has no attribute "terminator"` error on my code.
A call like this:
```
from attr import attrib
from attr.validators import optional, instance_of
c = attrib(default=None, validator=optional(instance_of(bytes)))
```
Was returning no return value, because the first overload was T -> T.
The solution was to change the ordering so that the first overload is
None -> T and infer the type from the other arguments.
The generic type of the futures provided to the wait method cannot
currently be preserved through this definition. For now deleting the
unused NamedTuple is the best approach.