Skip to content

pull via github#1

Merged
RafiB merged 201 commits intoRafiB:masterfrom
python:master
Oct 7, 2019
Merged

pull via github#1
RafiB merged 201 commits intoRafiB:masterfrom
python:master

Conversation

@RafiB
Copy link
Owner

@RafiB RafiB commented Oct 7, 2019

No description provided.

rchen152 and others added 30 commits June 8, 2019 07:06
* Add `copy()` method to requests.Session.headers

* Use one type annotation
* StrictRedis is an alias for Redis in current redis

* Add a few types

* Add missing import

* Add missing argument and types
The marshal.dumps and marshal.loads functions should return and accept
bytes, respectively, rather than a string.
This includes two things to sync up with recent runtime updates:
* Move `Final`, `@final`, `Literal`, and `TypedDict` to `typing` (`typing_extensions` still defines or re-exports them)
* Rename `@typing.runtime` to `@typing.runtime_checkable`, while keeping `@runtime` as a backwards-compatible alias in `typing_extensions`.
The Pull Request #1121 added the `AddressFamily` type to `socket.pyi`
for Python 3.4+, so constants such as `AF_INET` are correctly
represented as being an enum member rather than an int. The same is
true of the `SocketKind` enums in the `SOCK_*` family.

Various functions in the socket module can accept either an int
or an `AF_*` enum member as arguments, which is allowed by the
int argument type. However the `getaddrinfo` function returns an
`AddressFamily` member rather than an int in the first position
of its list members, so code that access enum specific members
such as the `name` attribute causes a typing error to be found.

This change corrects the return type of `getaddrinfo` but leaves
the family parameters as int, given that `AddressFamily` members
are `IntEnum` and only ever treated as `int`s internally.
Morsel does cast any value to string and therfor any is the correct
typehint. For some keys other types then strings are more
appropiate anyway, max-age can take an integer (unix time) and http-only
a boolean.

Closes #3059
* Add types and functions in types.py that are new in 3.7

* Update `resolve_bases` to accept any iterable of objects, and the same
for `new_class` if the version is at least 3.7

* Add comparison overrides implemented by MethodWrapperType

* Fix mypy error due to over-constrained `__eq__`
…3085)

Both are None if there were no groups matched. Also 'lastgroup'
will be None if the matched group was nameless.

The Python 2 versions of these annotations already used Optional.
)

On Python 2, a str is returned, however on Python 3 the return type
is bytes.
srittau and others added 29 commits September 30, 2019 11:46
This removes the indirection of setting environment variables to
install and run tests. Also, use an explicit version for running
mypy with typed-ast.
Modified __add__ method in tuple class to allow it to accept tuples with different generic parameter types. This allows, for example:
a = (1, )
b = a + (2.4, )
Part of #3267. Together with #3276 this should fix all such problems.
…3294)

This was discussed in #3181 and the correct explanation was given that
object ought to be preferred here. In practice this caused an obscure
issue with mypy when using this operations on the results of
six.viewkeys(), since it decided that it wanted a mapping *from* object
as a result of inference contexts. Grumble.
PR #3269 added some version checks for the argument type to setLevel
and the existence of NullHandler. While these features weren't present
in early versions of Python 3, they *are* present in Python 2.7, which
leads to false positives.
This is important because mypy doesn't generally think functions are compatible with `FunctionType`, so `inspect.getsource` on arbitrary functions is rejected by the current annotations.
…vate_key. (#3296)

The only extant implementation of generate_private_key returns this more specialized interface.
The cryptography stubs are very rudimentary at the moment, but there
is nothing that limits them to just Python 2.

Closes: #3303
* In Python 2, the optional `msg` argument was missing.
* In Python 3, the method was missing altogether.

Reference:
https://github.com/python/cpython/blob/2.7/Lib/_pyio.py#L423
https://github.com/python/cpython/blob/3.6/Lib/_pyio.py#L443
The decode method of IncrementalNewlineDecoder accepts a string when its decoder is None.
@RafiB RafiB merged commit 451a9d6 into RafiB:master Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.