Commit Graph

2748 Commits

Author SHA1 Message Date
Rebecca Chen
c3b70d4224 Require the newest pytype version, with a pyi parser fix. (#3160)
For https://github.com/python/typeshed/pull/3149.
2019-07-30 13:50:51 -07:00
Anthony Sottile
29dde6c883 Fix type annotations for get_wch / unget_wch (#3157) 2019-07-30 17:57:11 +02:00
Ville Skyttä
c6cbe4da66 inspect: use more specific arg type for some source retrieve functions (#3155) 2019-07-30 17:53:56 +02:00
Brad
bd2d0fcc85 Add hints for 3 globals from logging/__init__.py (#3159) 2019-07-30 17:28:13 +02:00
Anthony Sottile
32a89809f0 curses: getch returns an integer (#3156) 2019-07-30 09:25:01 +02:00
Michael R. Shannon
568f1ea555 Add attributes to xml.etree.ElementTree.ParseError. (#3158) 2019-07-30 08:48:28 +02:00
Allison Kaptur
15aa18d0a2 dateutil.rrule can take dates (#3154) 2019-07-27 11:39:23 +02:00
Sebastian Rittau
9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00
Kamil Bar
4697adcb1a [stdlib][3] Add missing typing.OrderedDict generic stub for Python 3.7.2 (#3153) 2019-07-26 20:46:15 +02:00
Ran Benita
c8e7d98c1f Allow function.__code__ in Python 2 (#3152)
The following code works:

    >>> print(sys.version)
    2.7.16 (default, Mar 11 2019, 18:59:25)
    >>> def f(): pass
    >>> print(f.__code__)
    <code object f at 0x7f8534ecc8a0, file "<stdin>", line 1>
    >>> isinstance(f.__code__, types.CodeType)
    True

but it didn't type-check with `mypy --python-version 2.7`.
2019-07-26 07:40:22 -07:00
Rebecca Chen
c356316c6f Use pytype.config.Options.create() for prettier code. (#3151)
This is a small cosmetic change. I want to encourage use of the
nicer-lookng pytype.config.Options.create() rather than
direct construction of the command-line args, so I'm changing
over all occurrences of the latter that I can find.
2019-07-25 19:43:33 -07:00
Connor Brinton
df8ecf5a67 Fix incorrectly named parameters in logging module (#3148) 2019-07-25 21:29:55 +02:00
Vasily Zakharov
e9d1f86591 gettext stubs fixed (#3130) 2019-07-25 16:57:14 +02:00
Sebastian Rittau
b20e5b6c14 Travis: run mypy with Python 3.8 as well (#3146)
This runs mypy both with Python 3.7 and 3.8. In Python 3.8,
mypy switched from using typed-ast to using Python's built-in ast.
This patch ensures that both are tested.
2019-07-25 07:43:52 -07:00
Maarten ter Huurne
32ee49c79c Add zipfile.ZipFile.filename (#3104) 2019-07-25 11:26:39 +02:00
Ran Benita
c9f9530224 xml.etree.ElementTree: use literal type for a more precise return value for tostring() (#3120) 2019-07-25 09:31:12 +02:00
Michael J. Sullivan
b3f7be523a Fix __call__ type for GeneratorContextManager (#3143) 2019-07-24 22:20:15 +02:00
Ville Skyttä
bf50612d76 inspect: get{doc,comments,module,sourcefile} can return None (#3137) 2019-07-24 22:05:01 +02:00
Ran Benita
9a7b286c66 warnings: ignore the type of category when message is a Warning (#3121) 2019-07-24 21:46:23 +02:00
Sebastian Rittau
0177dedc42 Add werkzeug.middleware (#3103)
HTTPConnection.timeout can be a float
2019-07-24 08:51:55 -07:00
Zsolt Dollenstein
8794e40d41 Fix ast.Constant availability (#3142) 2019-07-24 14:10:51 +02:00
Ville Skyttä
322be1b9e7 Upgrade flake8* and isort versions (#3141) 2019-07-23 23:02:19 +02:00
Ville Skyttä
8e0d288ea4 json: require a JSONDecoder/JSONEncoder in cls (#3138) 2019-07-23 22:59:57 +02:00
Nipunn Koorapati
67d091db15 Update google RepeatedCompositeFieldContainer (#3136) 2019-07-22 09:00:22 +02:00
Daniel Hahler
9dcdc7d481 faulthandler.dump_traceback_later: timeout can be float (#3134) 2019-07-21 01:04:25 +02:00
Naman
9379cedfa7 remove itertools.accumulate from Python 2 stubs (#3135) 2019-07-19 22:31:32 -07:00
Michael J. Sullivan
4072ad82fb Fix python 2 subprocess.Popen to produce Popen[bytes] (#3133)
Otherwise this causes a lot of spurious errors.
2019-07-19 14:17:32 -07:00
Michael J. Sullivan
90c2c22961 Make python 2 subprocess consistent with python 3 (#3132) 2019-07-19 10:56:59 -07:00
Sebastian Rittau
dad16f2d43 Update socket exceptions (#3127)
* error is an alias for OSError in Python 3
* herror and gaierror can be constructed without arguments (tested
  in Python 2.7 and 3.7)
* timeout uses the same arguments as herror and gaierror
2019-07-18 16:50:28 -07:00
Yannack
40215d1fa3 Fix the definition of nsmallest() in stdlib/2 and 2and3/heapq.pyi (#3114)
Missing support of the optional "key" kwarg in nsmallest.
Also fixed nlargest syntax for 2and3 which was also missing.
Use a protocol for heapq.py
2019-07-18 21:38:28 +02:00
Sebastian Rittau
09d1055cd3 Remove mypy new analyzer tests (#3128)
Now that the new analyzer is the default, this does exactly the same
as the normal mypy self test.
2019-07-18 17:02:12 +02:00
Ivan Levkivskyi
508f992730 Add __eq__ to protobuf containers (#3126)
See https://github.com/protocolbuffers/protobuf/blob/master/python/google/protobuf/internal/containers.py.

Without these `mypy --strict-equality` causes false positives with protobufs.
2019-07-17 23:25:22 +01:00
William Ayd
8e89faa90f Added Optional (#3125)
Fixes #3124
2019-07-17 10:08:46 +02:00
Michael J. Sullivan
3ad3ed82c7 Overload the constructor of subprocess.Popen (#3113)
This takes advantage of a recent mypy change to respect the return
type of `__new__`. Using that it does the same tedious overloads
as `run` and `check_output`.
2019-07-16 15:41:33 -07:00
秋葉
e2ec5d0525 Make SyntaxError.text be optional (#3119)
Closes #3118
2019-07-15 09:11:45 +02:00
Anthony Sottile
f76b7b273b Re-export _curses._CursesWindow from curses (#3117) 2019-07-13 08:01:10 -07:00
Anthony Sottile
2a57ce2cec Add curses.COLORS and curses.COLOR_PAIRS (#3115) 2019-07-13 07:50:13 -07:00
Rebecca Chen
40124b5f4c Update required pytype version to one that supports async def. (#3112) 2019-07-11 12:47:46 -07:00
Brandt Bucher
34b47101dd Slice attributes can be of any type. (#3024) 2019-07-11 12:13:32 -07:00
Ran Benita
4ae4714e00 sys: refine the return type of sys.exc_info() (#3111) 2019-07-11 10:43:37 +02:00
Michael J. Sullivan
b43e1d674f Use Literal overloads to give better types to subprocess (#3110)
This gives better types to `subprocess.check_output` and `subprocess.run`
by laboriously overloading using literals.

To support `run`, I turned `CompletedProcess` into `_CompletedProcess[T]`
with `CompletedProcess = _CompletedProcess[Any]`. I could pretty easily
be convinced that it would be better to just make `CompletedProcess`
generic, though.

I'd like to do the same for Popen but need to make mypy support
believing the type of `__new__` in order for that to work.
2019-07-10 14:44:27 -07:00
Cole Maclean
f5c107cacd BytesGenerator requires BinaryIO (#3106) 2019-07-07 22:03:07 -07:00
Sebastian Rittau
1436cfdef9 Add types to FileStorage (#3067) 2019-07-04 12:58:51 -07:00
Savo Kovačević
84e6492d7e Improving Flask stubs (#3003)
* Fix flask render_template and render_template_string stubs

* Add types for flask view function

* Import TracebackType from the right location

* Switch to bound typevar in route decorator stub

* Change render_template and render_template_string parameters to Text
2019-07-04 12:57:06 -07:00
Sam Zhou
4af283e1ac Fix HTTPConnection.putrequest parameter names (#3101) 2019-07-03 08:52:59 +02:00
ikelos
3e700224ba Add in multiprocessing.managers.ValueProxy types (#3100)
Fixes #1778
2019-07-03 08:49:16 +02:00
Francis Colas
75d9228b02 PurePath methods accept os.PathLike[str] from 3.6 (#3099)
Closes #3095
2019-07-02 13:08:32 +02:00
Rafi Blecher
668d050476 Fix contextlib GeneratorContextManager name for py>=3.2 (#3083) 2019-07-02 10:56:40 +01:00
Martijn Pieters
e1e5c83795 QueueHandler / QueueListener accept SimpleQueue too (#3098)
The implementation of `logging.adapters.QueueHandler` and `logging.adapters.QueueListener` works great with `queue.SimpleQueue` too, so update the stub to reflect this.

The new queue.SimpleQueue class (introduced in 3.7) is faster but is not a Queue subclass as it doesn't implement task handling (`handle_task()` / `join()`) or queue bounds (raising `queue.Full` / `full()`). The logging handler / listener implementations do not make use of those features however.

Related Python bug, asking for an explicit documentation mention: https://bugs.python.org/issue37469
2019-07-01 07:47:30 -07:00
Ran Benita
c66699800e xml.etree.ElementTree: fix missing None in get(), findtext() return type (#3093) 2019-07-01 14:28:40 +02:00