Commit Graph

83 Commits

Author SHA1 Message Date
Jelle Zijlstra
b9e896d97c make type aliases in lxml.etree private (#1216)
Naming the alias "AnyStr" isn't a great idea since AnyStr normally means
the typevar.

Also removed some whitespace in accordance with typeshed style.
2017-04-30 09:36:37 -07:00
David Euresti
759da86478 Cleanup six.moves module (#1180)
* Cleanup six.moves

Regenerate files so all imports are present, comment out imports that fail.
Remove useless files.

* Fix flake8
2017-04-21 16:03:19 -07:00
Guido van Rossum
3594b0e607 Fix JSONWebSignatureSerializer.load_dangerous() signature to satisfy mypy. (#1135)
The latest mypy complained that the signature didn't match that in the
superclass: Serializer.load_payload() has a serializer argument.  I
don't know this project but I think it's best to just add that
argument (rather than adding `# type: ignore`).
2017-04-04 09:51:56 -07:00
Jelle Zijlstra
37a854630c merge 2 and 3 stubs for requests (#1017)
* merge 2 and 3 stubs for requests

* fix version comparison
2017-03-18 16:39:40 -07:00
Semyon Proshev
4cd137189a Remove object as the only ancestor for classes in Python 3 stubs. 2017-03-18 14:57:57 -07:00
Jelle Zijlstra
97e1ffff40 Modify the Python 3 stubs for requests to be Python 2-compatible
This works towards fixing #924. To make the changes easier to review, I'm planning to
fix the issue in two steps:
- This commit makes the 3 stubs compatible with py2
- The next PR will move the 3 stubs to 2and3 and remove the 2 stubs

I wrote this code by diffing the files in third_party/{2,3}/requests and making
appropriate changes to the Python 3 stubs (mostly str/Text stuff). I verified
that the 3 stubs now pass mypy when parsed as 2.7, but I don't have an annotated
requests-using codebase to test on.
2017-03-17 10:27:47 -07:00
Jelle Zijlstra
349ff59f33 change empty bodies from "pass" to "..."
CONTRIBUTING.md says to prefer ... Not the most impactful change but fixing
these will allow us to lint for it in the future and get a consistent style.
2017-03-16 09:13:08 -07:00
Jelle Zijlstra
f35f6860f3 add missing types to some arguments in third_party/3 (#994) 2017-03-14 08:12:14 -07:00
Jelle Zijlstra
eb07fd3c1a make sure typevars defined in stubs are private (#989)
And also a few type aliases I noticed in the process.

Found using 59f9cac095
2017-03-13 07:32:40 -07:00
Hong Minhee
a6e3e70d14 Add incorrect/missing types to Werkzeug wrappers (#969) 2017-03-10 15:54:20 -08:00
David Fisher
6e34fc9127 Remove semicolon in type (#976) 2017-03-07 14:33:55 -08:00
David Euresti
8d42a2899a Add configparser and builtins to six (#937)
* Add configparser and builtins to six

* Use 'as' import
2017-02-20 11:38:49 -08:00
Ivan Levkivskyi
22c0353498 Add missing imports from typing (#933) 2017-02-14 10:59:00 -08:00
David Fisher
52dd4903d1 Update typed_ast for version 1.0 (#931) 2017-02-13 07:26:45 -08:00
Adam Marszałek
ca36070d51 Improved pytz support for timezone function (#911) 2017-02-03 10:54:59 -08:00
Adam Marszałek
6178ed3201 Expansion of unions inside params definition (#848)
Due to `Dict` / `Mapping` invariance it's necessary to include other variants of `Union[str, bytes], Union[str, bytes]`.
2017-01-20 09:09:22 -08:00
Alexey
741dd37422 Update annotations in requests.api for Python 3 (#849)
* Update annotations for requests.api.get

Argument params of requests.api.get accepts not only dictionaries of str, str pairs, but dictionaries and tuples of various types.
2017-01-19 14:09:58 -08:00
Roy Williams
aa6a1c53c9 Add stubs for dateutil.tz (#839) 2017-01-17 15:54:15 -08:00
David Fisher
2cb8e184cc Add NoReturn (#811)
* Add NoReturn
2017-01-04 13:38:05 -08:00
Roy Williams
844b32cc64 Fixup types 2017-01-03 10:17:20 -08:00
Roy Williams
7fd08cf073 Add more type information to requests.PreparedRequest 2017-01-03 10:17:20 -08:00
Alex Jurkiewicz
f8717ccfc4 Add support for request.get's 'params' param (#770)
* Add support for request.get's 'params' param

Requests defines the following API:
`get(url, params=None, **kwargs)`

* Improve typing for requests.get(params)

Add support for string form, and tighten restrictions for the dict form
to allow only string keys/vals. Technically, anything is allowed since
the code (I guess) runs `str(key)` and `str(value)`, but it seems better
to keep the stub somewhat strict so it can help pick up potential
errors.
2016-12-28 11:24:03 -08:00
Mateusz Kurek
43f18bc830 Use specific types in dateutil.relativedelta stubs
Improve operator methods for dateutil.relativedelta stubs:
* `__add__` operator method could return other types than `relativedelta` (`datetime.date` or `datetime.datetime`)
* use specific types of operators args instead of Any
* mypy currently does not handle `Union` in op methods (see python/mypy#2129, python/mypy#1442, python/mypy#1264 for details), so I've overloaded it directly
2016-12-28 11:18:03 -08:00
David Euresti
8a8680371a Fix type for six.reraise to make it match sys.exc_info()
The docs for six say the simple case is `reraise(*sys.exc_info())`
2016-12-28 11:15:27 -08:00
Lukasz Langa
cfe1cbb426 Add missing import in werkzeug stubs.
This is needed by #786.
2016-12-21 17:20:01 -08:00
Lukasz Langa
5f416fae64 Add missing List imports. 2016-12-21 01:06:52 -08:00
Lukasz Langa
82b2d8e3bc Fixing flake8 F403, F405 errors 2016-12-20 02:28:12 -08:00
Lukasz Langa
99a57e5cbe Fixing flake8 E251 errors 2016-12-20 01:54:34 -08:00
Lukasz Langa
ad9038dcd7 Fixing flake8 E303 errors 2016-12-20 01:08:00 -08:00
Lukasz Langa
6eb97964fd Fixing flake8 E401, E402 errors 2016-12-20 00:47:51 -08:00
Lukasz Langa
147772950f Fixing flake8 E265 errors 2016-12-20 00:16:44 -08:00
Lukasz Langa
6b5c6626d6 Fixing flake8 E121, E122, E123, E124, E125, E126 errors 2016-12-19 23:53:19 -08:00
Lukasz Langa
fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Lukasz Langa
b84f20a011 Fixing flake8 W errors 2016-12-19 21:52:56 -08:00
Naomi Seyfer
64124376aa Make a few types in werkzeug more compatible with base types (#730)
* Make a few types in werkzeug more compatible with base types

* Keyword arguments to __delitem__ were private to implementation so can be left out
2016-12-06 16:14:46 -08:00
Bertrand Bonnefoy-Claudet
f447cbdc89 Fix resource_string type: from str to bytes (#734)
Fixes #733
2016-12-05 11:20:16 -08:00
Naomi Seyfer
38d356503d Increase compatibility of itsdangerous URLSafeSerializerMixin & Serializer (#712)
I'm preparing a PR to mypy that further formalizes and improves the rules for
which functions are "compatible" with each other, both for subtyping and for
assignment.  This is the one place in the stubs that violates the new rules but
not the old: the supertype `Serializer` can take an optional positional argument
called `serializer` to `load_payload`, but until this diff the mixin used to
implement it could not, but rather could only take `serializer` as a named
argument, through its **kwargs.
2016-12-01 11:48:56 +00:00
Roy Williams
021b162bc9 Add stubs for werkzeug (#530) 2016-11-28 10:50:57 -08:00
Roy Williams
8305d51e75 Add more specific types for requests.session.Session.mount and BaseAdapter (#674) 2016-11-10 11:14:30 -08:00
Jakub Stasiak
5a2a46d3bd lxml: Document _Element.tag and __iter__ (#650) 2016-11-02 07:44:22 -07:00
Elazar Gershuni
58d60343ba fix self for thirdparty (#646) 2016-10-30 15:02:23 -07:00
TrueBrain
15ec66cdd6 Consider __doc__ always Optional. (#641)
python/mypy#2380 showed a discrepancy between object and FunctionType in stdlib2. The first defined __doc__ to be str, the second Optional[str]. As FunctionType depends on object, this is no longer valid.

As suggested by @gvanrossum in python/mypy#2380, all __doc__ should be considered Optional.

(Final verdict was just to remove most __doc__ attributes since it's inherited from object.)
2016-10-30 11:48:23 -07:00
Roy Williams
bfbe4f8540 Update lxml stubs to add Element.append and Element.text (#629) 2016-10-25 12:04:42 -07:00
David Fisher
ca318e444f Fix strings that were really bytes in typed_ast (#624) 2016-10-19 16:34:41 -07:00
Ivan Levkivskyi
70cfe793d9 Implement PEP 526 in typed_ast (#548)
See dropbox/typed_ast#16.
2016-09-28 10:31:28 -07:00
Roy Williams
b5e372bc7f Add stubs for itsdangerous. (#537)
This is needed for https://github.com/python/typeshed/issues/28
2016-09-18 14:40:18 -07:00
Roy Williams
5c52691954 Add more specific types for requests.sessions.Session (#524)
* Add more specific types for requests.sessions.Session

Once this is accepted I'd like to propegate these signatures to all of the
convience methods people actually use like get, post, put, etc...

* s/Optional[Union,/Union[None,/g
2016-09-09 12:23:32 -07:00
Michael Lee
a257166149 Add missing type_comments attr to ast27.arguments (#522) 2016-09-07 11:55:27 -07:00
Drew Haven
d56a5e80fb Fix six.reraise stub to take an optional traceback (#514) 2016-08-31 11:31:49 -07:00
Jakub Stasiak
9715995b2d Remove undesired type variable from lxml.objectify (#441)
typing.AnyStr usage here was a mistake that I noticed too late,
from a GitHub comment[1]:

    AnyStr is a type variable so in your version of
    objectify.fromstring() the types if text and base_url have to
    correspond -- but with unions they can each be either str or bytes,
    and that's how the rest of the API is defined.

[1] https://github.com/python/typeshed/pull/436#issuecomment-237708512
2016-08-05 05:51:20 -07:00