Commit Graph

134 Commits

Author SHA1 Message Date
Benjamin Peterson
6850b9d699 gflags: Add DEFINE_multi_enum. (#2783)
4f06c3d0d6/gflags/__init__.py (L800)
2019-02-08 15:14:52 -08:00
Frazer McLean
9e5816a539 Fix six.raise_from value type (#2746)
Fixes #2742
2019-01-17 20:16:38 +01:00
Guido van Rossum
a2c0f4b827 Add stubs for six.ensure_{binary,str,text} functions (#2704) 2018-12-19 16:07:16 -08:00
jhance
5663dba895 [gflags] add known_only arg to __call__ (#2646) 2018-11-28 18:45:51 +00:00
Sebastian Rittau
82c59a7fc2 Merge Python 2 and 3 versions of itsdangerous (#2564) 2018-11-20 17:55:16 +01:00
Sebastian Rittau
cd75801aa5 Replace non-ellipsis default arguments (#2550) 2018-11-20 07:35:06 -08:00
Sebastian Rittau
e3a79d0ce6 Remove third_party/3/enum.py (#2563)
All Python 3 versions supported by typeshed (3.4+) have enum as part
of the standard library.

Make the third-party Python 2 version consistent with the Python 3 version.
2018-10-27 08:54:56 -07:00
Sebastian Rittau
006a79220f Flake8 fixes (#2549)
* Fix over-indented continuation lines

* Fix under-indented continuation lines

* Fix whitespace around default operator problems

* Limit line lengths

* Fix inconsistent files
2018-10-24 07:20:53 -07:00
Michael Lee
53d12c0a6c Makes enums accept objects in the argument type (#2539)
Fixes problems with using enums with the --disallow-any-expr flag.
2018-10-23 09:52:15 +02:00
Daniel Li
254af0ff2a Add stub for pathlib2.Path.__div__ (#2507) 2018-10-16 07:31:58 +02:00
Benjamin Peterson
b2a9f2e383 Add new gflags names. (#2489)
As a described in https://github.com/google/python-gflags/blob/master/absl_migration/migration_guidelines.md, gflags did a mass rename to PEP 8-style names.
2018-10-01 20:18:51 -07:00
Benjamin Peterson
a8cfde79c4 Use structural inference for enum34 EnumMeta. (#2490)
Fixes python/mypy#5577.
2018-09-27 09:27:41 -07:00
Rebecca Chen
77e4d5d5a8 Add six.moves.urllib_request and six.moves.urllib_response. (#2455) 2018-09-13 22:01:56 +02:00
Jelle Zijlstra
2e1c81684e fix duplicate definitions in tornado (#2424)
Fixes #2423.

I followed https://github.com/tornadoweb/tornado/blob/master/tornado/httpclient.py and kept the `@property` where it exists in the implementation and the attribute where it doesn't.
2018-09-03 16:39:51 -07:00
Brandon Lin
700efc43dd add missing stubs in cryptography rsa/serialization (#2376) 2018-08-15 20:50:56 -07:00
Ville Skyttä
5b2c8dc883 concurrent.futures: Sync with Python 3.7 (#2343) 2018-08-08 08:26:01 -07:00
Brandon Lin
7c263e3935 add set_time to OpenSSL.crypto.X509Store (#2367) 2018-08-07 22:22:26 -07:00
Daniel Li
631d2768d6 Add stub for pathlib2 on Python 2.7 (#2351)
pathlib2 is the Python 2.7 backport of the pathlib module from Python 3.
Hence we use the same stub file for both.

The maintainer of pathlib2 granted permission for stubs to be added in
mcmtroffaes/pathlib2#44.
2018-08-07 10:27:18 -07:00
Yusuke Miyazaki
6192cce9d9 Avoid using string literals in type annotations (#2294) 2018-07-02 20:23:29 -07:00
Yusuke Miyazaki
581705d9ee Prefer to use ellipsis over pass (#2292) 2018-06-28 10:29:45 -07:00
Guido van Rossum
5b32e79f4a [gflags] Give DEFINE* default values Optional types (#2279)
I found some code that called DEFINE_integer() and DEFINE_float() with default set to None. Perusing the code that seems to be a totally valid usage. I am not super familiar with gflags but I believe this PR consistently changes all those default values to Optional[].
2018-06-26 13:53:39 -07:00
Daniel Li
1a8455b444 Add thread_name_prefix to ThreadPoolExecutor stub (#2249)
The thread_name_prefix argument of ThreadPoolExecutor.__init__ was added
to the Python 2 backport in agronholm/pythonfutures#64.
2018-06-17 18:33:37 -07:00
Jelle Zijlstra
0393de4bd7 fix some abstract classes in Python 2 (#2240)
Part of #1476.
2018-06-17 00:56:00 +01:00
Daniel Li
5054465746 Make concurrent.futures stubs identical (#2237)
Make the Python 2 and 3 concurrent.futures stubs identical so fixes get
applied to both.

For example, #1305 and #2233 fixed the same problem at different times,
as did #1078 and #1911.

By making the stubs identical, we apply the fix from #1711 to Python 2.

Fixes #2234.
2018-06-15 10:03:19 -07:00
Daniel Li
a9366df7e8 Improve signatures in concurrent.futures backport (#2233)
Use parameterized types in Future.add_done_callback(), wait(), and
as_completed().

Mark the traceback argument to Future.set_exception_info() as optional.
2018-06-15 08:21:01 -07:00
Sebastian Rittau
fcc1b7def4 Merge Python 2 and 3 versions of werkzeug (#2185)
The Python 2 version was slightly outdated compared to the Python 3
version.

The Python 2 version of Headers.__delitem__() had an optional argument
_index_operation that also exists in the implementation. But considering
this is internal use only, it was missing from the Python 3 version, and
it created problems with derived classes, I decided not to add it to
the merged stub. See also pallets/werkzeug#1051.
2018-06-05 08:16:23 -07:00
Nipunn Koorapati
b7ee95aa56 Move google.protobuf from 2 to 2and3 (#2174)
* Move google protobuf from 2 to 2and3

This should generally be ok. I ran the internal consistency
tests and they seemed to pass.

* Convert str to bytes

* repr to use str in google.protobuf.internal.containers
2018-05-31 21:47:11 -07:00
Sebastian Rittau
c3897b4a14 A few werkzeug type fixes (#2181)
* BaseRequest.stream
* ResponseStreamMixin.stream
* get_content_length()
* get_input_stream()
2018-05-31 21:38:51 -07:00
Guido van Rossum
a392989a30 Add support for well_known_types to google/protobuf (#2157)
Fixes #2154
2018-05-22 21:57:07 -07:00
Ethan Smith
f4d19d9f61 Remove selenium stubs (#2137)
These stubs have not been used by anything for a while
(`remote` doesn't have a __init__.pyi). The quality of the stubs is also
lacking.
2018-05-16 11:50:01 -04:00
Ethan Smith
66545f147a Fix protobuf stubs (#2135) 2018-05-15 20:21:23 -04:00
Alex Vandiver
5505cb83bb Add generated stubs for google.protobuf, from its protobufs (#2095)
This fleshes out the auto-generated pieces of `google.protobuf`, by
using the go version of https://github.com/dropbox/mypy-protobuf to
generate mypy stubs from the .proto files in
https://github.com/google/protobuf/tree/master/src/google/protobuf

Generated from current `master` of google/protobuf, 25625b956a.

Ref google/protobuf#3803, python/typeshed#1705
2018-05-15 10:11:01 -04:00
Daniel Li
56a31be7a7 Add stubs for submodules of six.moves (#2108)
To support "from six.moves.cPickle import loads", we must add a stub for
six.moves.cPickle as if it were a real submodule, even though it isn't
implemented as such. This fixes python/mypy#1550.

We don't apply this approach to six.moves.builtins on Python 2, because
it seems to confuse mypy.

We also add stubs for aliases in six.moves whose underlying modules have
been added to typeshed.

For Python 2:
    - six.moves.SimpleHTTPServer (alias for SimpleHTTPServer)

For Python 3:
    - six.moves.tkinter_dialog (alias for tkinter.dialog)
    - six.moves.tkinter_filedialog (alias for tkinter.filedialog)
    - six.moves.tkinter_commondialog (alias for tkinter.commondialog)
    - six.moves.tkinter_tkfiledialog (alias for tkinter.filedialog)
2018-05-12 12:02:44 -04:00
Danny Weinberg
9b479fd07e Have Python 2 IntEnum values be ints (#2104)
Currently the Python 2 stub for `IntEnum` just inherits from `Enum` without changing anything, meaning that its `value` has type `Any`. This changes it such that, if you know you have an `IntEnum` you get the more specific `int` type for the `value`. Note that this has already been done for Python 3 `IntEnum` (both in `third_party/3/enum.pyi` and `stdlib/3.4/enum.pyi`).
2018-05-08 19:39:45 -07:00
Andrew Gaul
29bf24b8b9 Reparent simplejson from 2 to 2and3 (#2088) 2018-05-04 15:59:26 -07:00
Guido van Rossum
2dc7d39af5 Add 'file=...' to FieldDescriptor constructor. (#2073) 2018-04-20 14:51:19 -07:00
Jelle Zijlstra
bdea1bb292 fix third_party/2/enum.pyi (#2039)
This fixes an error in Travis that seems to have been caused by python/mypy#4319.

The fix was taken from the stdlib/3.4/enum.pyi stub. Mypy no longer assumes
that classes whose metaclass is EnumMeta are subclasses of Enum, so we can't
bound the typevar on Enum.
2018-04-10 21:34:59 -07:00
Jelle Zijlstra
d24799fd31 uncomment a few parts of six.moves (#2019) 2018-04-06 11:20:14 -07:00
Danny Weinberg
12d60a2760 Allow passing None for gflags default string value (#2016) 2018-04-04 16:50:28 -07:00
Jelle Zijlstra
371b805c23 improve selenium stubs (#1732) 2018-03-28 19:39:43 -07:00
Jelle Zijlstra
0c15e5bdcc Improve werkzeug stubs (#1730) 2018-03-28 19:38:35 -07:00
Michael J. Sullivan
eb571e9cbb Make protobuf's BaseContainer a MutableSequence (#1981) 2018-03-22 18:22:59 -07:00
Nipunn Koorapati
cac7264d3a Add google.protobuf.internal.containers.pyi to typeshed (#1718) 2018-03-17 22:05:43 -07:00
Sebastian Rittau
6cf97b8db2 Proper types for Common{Request,Response}DescriptorsMixin (#1948)
* werkzeug: Add proper types for CommonRequestDescriptorsMixin

* werkzeug: Add proper types for CommonResponseDescriptorsMixin
2018-03-16 20:13:03 -07:00
rchen152
38dc8f5a6a Switch usages of mypy_extensions.NoReturn over to typing.NoReturn. (#1942)
* Change mypy_extensions.NoReturn to typing.NoReturn everywhere.
2018-03-05 12:42:29 -08:00
Can Berk Güder
c1c9fac63f Add tornado.process (#1870) 2018-02-09 15:43:22 -08:00
Guido van Rossum
40d6faeccd Ignore thrift imports (#1869)
Fixes #1868
2018-02-09 09:11:59 -08:00
Sebastian Rittau
a08d57833f Fix werkzeug environ type (#1831)
* Fix werkzeug environ type

PEP 3333 explicitly calls for environ to be a built-in dict. Using a
Mapping will not only prevent the dict from being modified (which is
explicitly allowed by PEP 3333), it will also cause interaction
problems when the environment is passed to other WSGI handlers.

Also change the value type from object to Any for convenience. By
definition, the values can be anything and can't be type checked.
Using object instead of Any forces us to explicitly cast the value
whenever we access it.

* Use Union[str, unicode] for Werkzeug environment keys

This matches the type in wsgiref.types.

* Use WSGIEnvironment from wsgiref.types

* Add '= ...' to environ attribute
2018-01-26 14:30:23 -08:00
Ivan Levkivskyi
c2fa0a153a Minor improvements to simplejson stubs (#1832)
This fixes signatures of `load` and `loads` and cleans-up
`JSONDecodeError`.
2018-01-19 22:42:31 +00:00
Jelle Zijlstra
fb2c7b34e2 Improve itsdangerous stubs (#1733) 2018-01-02 12:50:22 -08:00