Commit Graph

3676 Commits

Author SHA1 Message Date
Eric Traut
030e5ad1dd Added missing type annotations for itsdangerous. (#4416)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-08 20:48:22 +02:00
Akuli
954ce8c703 create _tkinter stub (#4372) 2020-08-08 14:14:52 +02:00
Eric Traut
adcd691d93 Added missing type annotations in gflags.pyi; removed some functions and methods that no longer exist in the library. (#4417)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-08 11:34:46 +02:00
Eric Traut
2fa7a8d8c3 Added missing type annotations for mock.pyi. (#4415)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-08 11:33:01 +02:00
Eric Traut
e4b48edbba Fix a couple of type name collisions (#4419)
PEP 484 indicates that all type annotations within a stub file are supposed to be considered forward references even if they are not quoted. This means a type checker needs to use scope-based symbol resolution without regard for code flow order. Lookups will find same-named symbols within the same scope even if they are declared after the type annotation. This change fixes a couple of cases where this occurs and confuses pyright.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-08 11:29:23 +02:00
github-actions[bot]
17db12866b Remove unused stubtest whitelist entries (#4420)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-08-07 22:54:07 -07:00
Jukka Lehtosalo
199b262f63 Add back six.moves.urllib.parse.unquote (Python 2) (#4414)
This was accidentally removed in #4287.
2020-08-07 17:56:54 +01:00
Jukka Lehtosalo
57a1a3937a Add back six.StringIO (Python 2) (#4413)
This was accidentally removed in #4287.
2020-08-07 17:41:48 +01:00
Jukka Lehtosalo
7c444365f2 Add back six.moves.range (Python 2) (#4411)
This was accidentally removed in #4287.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2020-08-07 17:20:34 +01:00
Jukka Lehtosalo
29c71ff52a Add back tornado stubs for Python 2 only (#4412)
Tornado ships with inline annotations, but it no longer is Python 2
compatible. I think that it makes sense to keep the legacy stubs for
Python 2 compatibility, at least for a while longer.

This restores stubs removed in #4321, but moves them to
`third_party/2`.
2020-08-07 08:54:57 -07:00
Sebastian Rittau
4233008b4a TypeVar(bound) accepts strings for forward references (#4410) 2020-08-07 08:31:31 -07:00
Eric Traut
439ea4bd8b Added missing import for case.pyi (#4403)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-06 19:51:52 -07:00
Anders Kaseorg
bb685daad1 Update orjson.pyi from upstream (#4405)
https://github.com/ijl/orjson/blob/master/orjson.pyi

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2020-08-06 19:40:26 -07:00
Eric Traut
baaffed1ac Added missing type annotations in various stdlib stubs. (#4402)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-06 18:27:21 -07:00
Andreas Poehlmann
10a5b070ab Fix contextlib.ContextDecorator.__call__ types (#4399)
The decorated function returned by ContextDecorator.__call__ has
the same call signature as the original function.

Closes #4382.
2020-08-06 17:26:54 -07:00
Eric Traut
de4ea8681d Removed imported symbols that are not accessed or re-exported (third_party part 4 of 4) (#4391)
* Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 4). These were all identified as unused symbols by the pyright type checker and language server.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-06 22:11:22 +02:00
Sam Bull
cea32bdc70 Add UserAgent attributes. (#4398) 2020-08-06 19:08:37 +02:00
Eric Traut
0b3494f712 Replaced parameter name "self" with "cls" for a few class methods (#4393)
* Replaced parameter name "self" with "cls" for a few class methods. Pyright emits a warning if a class method doesn't follow the PEP 8 standard where the first parameter is named "cls" for a class method. This change eliminates these warnings.

* Missed a file.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-06 09:09:21 +02:00
Eric Traut
f60074f3d2 Fixed symbol redefinition in cgi.pyi stub (#4394)
* PEP 484 says that type checkers should assume that all types used in a stub should use forward declarations even though they are not quoted. This stub is using the symbol "type" within the context of a class scope. The "type" symbol is declared within this scope, so pyright assumes that the forward declaration should be used. The solution is to define a symbol with a different name in the outer scope to avoid the name conflict.

* Fixed import sort order.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-06 09:05:45 +02:00
Eric Traut
65450d81ff Fix multi-part module import errors (#4395)
* Pyright detects and reports cases where a multi-part module name is accessed but is not explicitly imported. These are dangerous because they rely on import resolution ordering within a program, which can easily change. This change eliminates errors detected by pyright.

* Fixed regression caught by CI test.

* Fixed black formatting issues.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-06 09:03:54 +02:00
Eric Traut
04c74640f0 Removed imported symbols that are not accessed or re-exported (#4387)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-05 22:49:17 -07:00
Eric Traut
e17c6a752e Fixed base classes to avoid "Cannot create consistent method ordering" error. Like the Python interpreter, the pyright type checker reports an error when a class is defined in a way that a deterministic MRO cannot be established. This set of changes eliminates these errors. (#4392)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-05 19:42:48 -07:00
Eric Traut
fe970d1134 Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 3) (#4390)
These were all identified as unused symbols by the pyright type checker and language server. 

Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-05 18:51:20 -07:00
Eric Traut
b3929cbcc9 Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 2). (#4389)
These were all identified as unused symbols by the pyright type checker and language server.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-05 18:50:31 -07:00
Eric Traut
94a7a62c65 Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 1). These were all identified as unused symbols by the pyright type checker and language server. (#4388)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-05 18:49:35 -07:00
Adam Hitchcock
3b6925b955 mark deque.rotate arg as having a default (#4386) 2020-08-05 17:35:22 -07:00
Sebastian Rittau
dc0bfc5889 Make FeedParser generic over Message (#4375) 2020-08-04 09:32:38 -07:00
Áron Ricardo Perez-Lopez
a770110497 Mark __next__, __iter__, and close in Generator as concrete (#4385)
Closes #4384
2020-08-04 12:16:35 +02:00
Ran Benita
cd132ff161 stdlib/3/inspect: fix _ParameterKind being an empty enum (#4383)
This makes mypy think that conditions like

    parameter.kind is Parameter.POSITIONAL_OR_KEYWORD

are always false, which triggers `unreachable` warnings, among other
problems.
2020-08-04 11:02:36 +02:00
Igor Nehoroshev
8ae5549b61 Add stub for typing_extensions.get_args (#4373) 2020-08-03 12:49:18 -07:00
frehoy
7894269bb5 Proposed fix for tarfile.add() accepting Path name and arcname (#4369)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2020-07-31 16:55:45 +02:00
Akuli
8bf7efe94e add types for tkinter geometry manager (aka pack,grid,place) methods (#4379) 2020-07-31 14:34:47 +02:00
Akuli
09c91a00ac add type hints for tkinter.Variable and its subclasses (#4378) 2020-07-31 10:53:57 +02:00
Jaromir Latal
c96b1ae1bf [stdlib][unittest] Fix mock.call(...) types (#4374)
Co-authored-by: Jaromir Latal <jaro@fb.com>
2020-07-30 22:02:08 +02:00
Omar Sandoval
7b29927c4b Add missing warn_on_full_buffer argument to signal.set_wakeup_fd() (#4377)
According to
https://docs.python.org/3/library/signal.html#signal.set_wakeup_fd, this
was added in Python 3.7.
2020-07-30 20:52:17 +02:00
Sebastian Rittau
7ed8c5f1da Add select.epoll.register to stubtest whitelist (#4376)
Python 3.8.5 changed the docstring slightly, possibly
a problem in stubtest.
2020-07-30 19:29:34 +02:00
Sebastian Rittau
36356b3368 Remove argument from deque.pop() (#4367)
Closes: #4364
2020-07-27 06:49:56 -07:00
Sebastian Rittau
06f87e5c92 Simplify pathlib (#4357)
* Enable some branches for Python2 pathlib2
* Define an alias _PathLike, instead of using multiple branches
* Drop a Python 3.4 branch (the Python 2 branch is identical to
  the 3.5+ branch)
* Move Path.__new__ to the top
2020-07-27 06:08:09 -07:00
karl ding
8f50cd9d0e Add missing syslog facility codes (#4366)
Add support for the following syslog facilities:

  - LOG_NTP
  - LOG_SECURITY
  - LOG_CONSOLE
  - LOG_SOLCRON

In addition, reorder the entries to match the CPython implementation to
make it easier to read.
2020-07-27 12:34:12 +02:00
Ian Good
a472c9b543 Fix Policy.header_source_parse return type (#4365) 2020-07-27 08:38:40 +02:00
Sebastian Rittau
cfd06e2d3c Enable aliases in pytest_mock (#4359)
* Require newer pytype
2020-07-25 12:13:00 -07:00
Akuli
2c37551fd1 make tkinter.Event generic and add missing type hints to bind methods (#4347) 2020-07-25 14:23:26 +02:00
Vegard Stikbakke
51fd8b2a06 Fix Filter.filter return type - bool, not int (#4358) 2020-07-24 20:25:06 +02:00
Shannon Zhu
b45e6cfbf6 Make TypeAlias stub a valid annotation (#4354) 2020-07-22 17:31:21 -07:00
Akuli
9efc9d8818 add tkinter.font stub (#4350) 2020-07-22 11:46:04 -07:00
Jaromir Latal
09718c6a03 [requests] Add _content to Response (#4353)
Co-authored-by: Jaromir Latal <jaro@fb.com>
2020-07-22 17:46:51 +02:00
Peter Law
29dec525e7 Add pydoc_data (#4351)
This appears to be used by jedi at least, so it would be great to
have stubs for it.
2020-07-21 18:14:03 -07:00
Shantanu
bc6da51495 asyncio: export submodules (#4346)
Resolves #4345

Co-authored-by: hauntsaninja <>
2020-07-21 09:34:00 +02:00
Rebecca Chen
537b730558 Update to pytype 2020.07.20 and remove nmap from the exclude list. (#4348) 2020-07-20 23:01:21 -07:00
Sabby6
42d20c4a07 pkg_resources: Add missing methods of pkg_resources.DistributionNotFound (#4344) 2020-07-20 19:31:50 +02:00