Depending on if a "stream" or the "encoding" is given, the functions
either return None, str/unicode or bytes.
Use @overload fix distinguish those cases.
Also fix the functions using **kwds as they delegate their work to the
more generic functions: copy their signatures.
* yaml.dump(): Drop distinguishing encoding
As far as I know it's currently impossible to use "overloads with return
types depending on optional arguments" (Issue #5621). As "encoding" is
in the middle of 11 optional arguments, it would require ~ 2^6 overloads
for each of those 6 functions.
For now just return Any and wait for Issue #5621 to get fixed.
During the PyCon sprints, I'm planning to bash the pytype pyi
parser into shape so we can handle all of third_party. As a first
step, create an explicit blacklist of everything pytype chokes on.
According to Ivan, PEP 544 intentionally did not specify whether method conformance check in protocol inference should look at parameter names. For example, it's up to the type checker to decide whether a class with method defined as `def foo(self, x: int)` would implement a protocol with method `def foo(self, y: int)`.
Mypy decided to ignore parameter names altogether, but we Pyre team decided to be more strict and refuse to match different parameter names (as it is unsound to do so when those methods are invoked with named parameters). Since we rely on the typeshed stubs, we want to make sure at least the important stubs on typeshed conform to our standard.
This PR changes `Container.__contains__` to use dunder (i.e. positional-only) parameter name specified in PEP484. This change should not affect mypy since it ignores parameter names, but will make Pyre happy as it eliminate the naming requirement for all classes that want to conform to the `Container` protocol.
In python 3, add an overload for there being no digits argument
and make it return int.
In python 2, __round__ doesn't exist and SupportsRound doesn't exist
in the typing module. Use SupportsFloat for python 2 round().
Remove decimal's __round__ overload that takes None, since it doesn't exist
As a followup to the work done in #2767 and #2830, and to address a
piece of #66, most of the email_mime submodules aren't typed in six
under python2, only python3. Now they are.
With today's release, pytype is able to fully load
stdlib/3/collections/__init__.pyi, so the test no longer needs the
ability to partially parse stubs using the pytd tool. Removing this
functionality allows the test code to be simplified considerably.