Commit Graph
301 Commits
Author SHA1 Message Date
Alex VandiverandJelle Zijlstra 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
Jelle ZijlstraandGuido van Rossum 463b4144dc explicitly import boto.regioninfo (#2121)
This may be causing intermittent test failures (see discussion on gitter).
2018-05-15 10:09:44 -04:00
Katelyn GiganteandJelle Zijlstra 51446f35fc Add stub for dateutil.rrule (#1808) 2018-05-15 09:04:57 -04:00
Daniel LiandJelle Zijlstra 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 WeinbergandJelle Zijlstra 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 GaulandJelle Zijlstra 29bf24b8b9 Reparent simplejson from 2 to 2and3 (#2088) 2018-05-04 15:59:26 -07:00
David EurestiandJelle Zijlstra 863b9b0886 Add new factory arg to attrib and fields_dict (#2096) 2018-05-04 07:53:52 -07:00
David EurestiandJelle Zijlstra 664d30c44b Fix attr.Factory signature (#2077)
The first overload was catching all calls including take_self=True.
Fix it by modifying the overloads.

Fixes https://github.com/python-attrs/attrs/issues/366
2018-04-23 12:27:14 -07:00
Guido van RossumandJelle Zijlstra 2dc7d39af5 Add 'file=...' to FieldDescriptor constructor. (#2073) 2018-04-20 14:51:19 -07:00
Charles-Axel DeinandJelle Zijlstra 5818893a7f Add default_exceptions to werkzeug.exceptions (#2071) 2018-04-19 09:03:24 -07:00
Aaron MillerandJelle Zijlstra 8e62a79970 Fix type of click.Path path_type arg (#2066)
path_type takes a *type*, rather than instance of the type
2018-04-17 23:32:02 -07:00
Jelle ZijlstraandGitHub 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
Andrew GaulandJelle Zijlstra aa7d705ae8 Add hints to PyYAML dump methods (#2023) 2018-04-09 12:59:10 -07:00
Jelle ZijlstraandGuido van Rossum 6862434eae fix return type for itsdangerous.Signer.unsign (#2029)
Fixes #2011

Also fixed the argument type (it doesn't accept str).
2018-04-09 12:00:41 -07:00
Matt GilsonandJelle Zijlstra a994c47198 Fixup the boto stubs to allow mypy --strict. (#2032) 2018-04-08 12:41:04 -07:00
Jelle ZijlstraandGuido van Rossum 8482b1030b fill out stubs for requests.structures (#1897)
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 https://github.com/requests/requests/blob/d1fb1a29ab949223d8d64797e0fcc9a7d2690483/requests/status_codes.py#L102.
2018-04-06 11:36:43 -07:00
Jelle ZijlstraandGuido van Rossum d24799fd31 uncomment a few parts of six.moves (#2019) 2018-04-06 11:20:14 -07:00
Danny WeinbergandJelle Zijlstra 12d60a2760 Allow passing None for gflags default string value (#2016) 2018-04-04 16:50:28 -07:00
Alan DuandJelle Zijlstra 603be5e1da Fix typehint of click progressbar (#2003)
* Fix typehint of click progressbar

* Oops -- stubs are *.pyi files
2018-04-03 07:16:17 -07:00
Jelle ZijlstraandŁukasz Langa 371b805c23 improve selenium stubs (#1732) 2018-03-28 19:39:43 -07:00
Jelle ZijlstraandŁukasz Langa 0c15e5bdcc Improve werkzeug stubs (#1730) 2018-03-28 19:38:35 -07:00
Michael J. SullivanandJelle Zijlstra eb571e9cbb Make protobuf's BaseContainer a MutableSequence (#1981) 2018-03-22 18:22:59 -07:00
David EurestiandMatthias Kramm 097e9f5e71 Fix issue with attrib ordering. (#1980)
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.
2018-03-22 10:50:07 -07:00
Luka SterbicandMatthias Kramm 89cbd47344 Stubs for termcolor (#1935) 2018-03-20 15:32:50 -07:00
Leonardo FedaltoandJelle Zijlstra a9cce0c94b Add requests.utils.set_environ (#1973) 2018-03-20 11:15:52 -07:00
Nipunn KoorapatiandJelle Zijlstra cac7264d3a Add google.protobuf.internal.containers.pyi to typeshed (#1718) 2018-03-17 22:05:43 -07:00
Sebastian RittauandJelle Zijlstra 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
Dan SullyandJelle Zijlstra ef87943397 Update click.option to allow for user defined kwargs. (#1950)
Click's option decorator can take a cls= argument, which allows that class to parse arbitrary arguments from the decorator.
2018-03-07 10:32:55 -08:00
David EurestiandJelle Zijlstra df65f6ea15 Better type for click 'type' argument (#1903)
The call accepts tuples of types and callback methods
2018-03-06 21:41:21 -08:00
yed podtrzitkoandJelle Zijlstra 1fe9fd83fa validator.instance_of can contain sequence of types (#1920) 2018-03-06 10:18:33 -08:00
David EurestiandJelle Zijlstra 50c7188300 Work around mypy issue #4554 in attr.Factory (#1933)
This makes the following not give a type error:

   y: DefaultDict[str, List[int]] = Factory(lambda: defaultdict(list))
2018-03-05 19:21:14 -08:00
Matthias KrammandJelle Zijlstra 6c30806d07 add deprecation comment to mypy_extensions (#1943) 2018-03-05 18:51:14 -08:00
rchen152andMatthias Kramm 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
Han SongandJelle Zijlstra a5c9093edc Allow requests.post to accept str for data. (#1922)
```python
import json

url = 'https://api.github.com/some/endpoint'
payload = {'some': 'data'}
r = requests.post(url, data=json.dumps(payload))
```
2018-02-25 22:19:35 -08:00
David EurestiandJelle Zijlstra 61e63293f1 Work around mypy issue #4554 in attrs. (#1914) 2018-02-24 13:00:15 -08:00
Roy WilliamsandJelle Zijlstra 8891b02d51 Make update parameters all optional (#1913)
As of https://github.com/pynamodb/PynamoDB/pull/352 all of these params are optional.
2018-02-23 13:18:55 -08:00
Daniel BowmanandJelle Zijlstra 1707d8f466 Improve pymysql types (#1804)
Add all cursor types and missing show_warnings method in connections

Added show_warnings to connections. No return type specified as this
requires tracing back through missing return types in previous
author's work. This is out of scope for this pull request.

Added SSDictCursor, SSCursor and DictCursorMixin to complete the
Cursors definition.
2018-02-16 17:23:17 -08:00
Asim GoheerandJelle Zijlstra e7b567c1f4 Issue 1858: pynamodb 3.2.1 added new methods in Attributes which are not in typeshed (#1859) 2018-02-16 16:54:45 -08:00
Roy WilliamsandJelle Zijlstra 0f36f7ea09 Treat all pynamodb Numbers as floats (#1895)
Previously we specified this as a Union type, which caused more problems than it helped with, namely when reading data off a Pynamo property
We still had to cast to the appropriate type.  Pynamo simply reads the type out of Dynamo, which more closely models a float as it can be an int or a float -

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html
2018-02-16 16:42:32 -08:00
David EurestiandJelle Zijlstra fe5e12795f Fix signature of CaseInsensitiveDict (#1873)
The values can be more than just strings.
2018-02-11 08:19:39 -08:00
Can Berk GüderandGuido van Rossum c1c9fac63f Add tornado.process (#1870) 2018-02-09 15:43:22 -08:00
Guido van RossumandGitHub 40d6faeccd Ignore thrift imports (#1869)
Fixes #1868
2018-02-09 09:11:59 -08:00
Chad DombrovaandJelle Zijlstra b111a4537f Add attrs library (#1838) 2018-02-02 21:26:35 -08:00
Erwin JanssenandJelle Zijlstra b5baedffb7 Add 'message' to click.decorators.version_option (#1845)
Click's version_option decorator allows the caller to specify the
version message. This optional string option is missing in typeshed.
2018-01-31 16:56:49 -08:00
Carl MeyerandJelle Zijlstra 1c3ec74d13 Remove incomplete thrift stubs that cause false positives. (#1827) 2018-01-26 15:26:14 -08:00
GarrettandJelle Zijlstra 372b541a07 Fix requests session hooks type (#1794) 2018-01-26 14:39:01 -08:00
Sebastian RittauandJelle Zijlstra 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 LevkivskyiandGitHub 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
Roy WilliamsandJelle Zijlstra 8175130688 Reexport DoesNotExist from pynamodb.models (#1809) 2018-01-10 05:00:39 +08:00
Jelle ZijlstraandMatthias Kramm fb2c7b34e2 Improve itsdangerous stubs (#1733) 2018-01-02 12:50:22 -08:00