Commit Graph

116 Commits

Author SHA1 Message Date
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
Jelle Zijlstra
0eb7083f0e move dateutil into 2and3 (#1743)
These stubs are identical since #1735.
2017-12-23 06:38:55 -08:00
Sebastian Rittau
398401baee werkzeug: Mark BaseRequest.data as property (#1785) 2017-12-14 20:35:29 -08:00
Guido van Rossum
821c765991 Several packages always auto-import certain submodules on import (#1752)
* Importing yaml implies yaml.resolver

* Importing six implies six.moves

* Importing requests implies requests.packages
2017-11-17 15:15:40 -08:00
Jelle Zijlstra
8e75701eda make Python 2 and 3 dateutil stubs identical (#1735)
So that they can be merged into 2and3. This PR also adds a few missing
elements to parser.pyi and corrects some mistakes in the Python 3 stub.

Refer to https://github.com/dateutil/dateutil/tree/master/dateutil
2017-11-13 07:06:34 -08:00
Jelle Zijlstra
84d0cbf776 move thrift to 2and3 (#1736)
thrift supports Python 3 as of version 0.10.0. These stubs are pure stubgen and
might not be much good, but they belong in 2and3.
2017-11-13 07:05:57 -08:00
Jelle Zijlstra
bcfd3bf554 Fill out croniter stubs and move to 2and3 (#1737)
* fill out croniter stub
* move to 2and3
2017-11-13 07:05:38 -08:00
Jelle Zijlstra
83ca997140 Change more defaults to ... (#1729)
* codemod ': Any = None' ': Any = ...'
* codemod ': (Union|Optional)([^=]+)\s+=\s+-?\d+' ': \1\2 = ...'
* codemod ': (Union|Optional)([^=]+)\s*=\s*-?(None|False|True)' ': \1\2 = ...'
* codemod ': (int|float|bool)\s*=\s*-?\d+' ': \1 = ...'
* codemod ': (bool)\s*=\s*(False|True)' ': \1 = ...'
* codemod ': Any\s*=\s*(False|True|None)' ': Any = ...'
2017-11-13 06:56:24 -08:00
Jelle Zijlstra
324f1761f4 Change more defaults to ... (#1727) 2017-11-09 10:32:17 -08:00
Jelle Zijlstra
54dd6ba27c Change numerous default values to ... (#1722)
This is the convention, and some default values (e.g. strings) apparently
break pytype.
2017-11-09 06:28:40 -08:00
Grzegorz Śliwiński
fcf1d38c57 fix typo in dateutil.tz importing tzutc as tzutz (#1694) 2017-10-27 07:40:16 -07:00
Guido van Rossum
994cfb5369 Make PY2 enum more like PY3 enum, fixing bug in unique() (#1668) 2017-10-25 09:47:45 -07:00
Jelle Zijlstra
c10dc67ad2 Re-export names in dateutil.tz (#1669)
Fixes #1665.
2017-10-12 17:57:12 -07:00
Max Rozentsveyg
6a55ad5b60 Update stubs for pycurl (#1635) 2017-10-07 08:44:24 -07:00
Alex Grönholm
023afbc098 Fixed the signature of six.raise_from() (#1563)
* Made the from_value argument optional in raise_from()

* Fixed six.raise_from() from_value and return type for both py2 and py3
2017-08-26 14:43:43 -07:00
Svyatoslav Ilinskiy
98d768b2c6 Re-export simplejson values (#1517) 2017-08-03 08:33:51 -07:00
Jelle Zijlstra
16aa0651ae Revert "Add __new__ to str and int stubs in both Pythons. (#1352)" (#1466)
This reverts commit fed4e03e53.
2017-07-06 14:21:54 -07:00
Peter Vilim
bc9b2f0d4d Fix signature for slite3.fetchmany (#1444)
Also made pymssql.fetchmany simpler.
2017-06-29 15:05:47 -07:00
Guido van Rossum
9238c737de Make HasField and ClearField use Text instead of str (#1425)
This allows one to write `x.HasField("ok")` even if the file has
`from __future__ import unicode_literals`"
2017-06-21 10:51:49 -07:00