From be5cd1d3dc9cb39ab309f2721478f7420da9ea10 Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 09:29:49 -0700 Subject: [PATCH 01/10] Add project.toml to configure both black and isort --- pyproject.toml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000000..27d7c72dc443 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,9 @@ +[tool.black] +line_length = 130 + +[tool.isort] +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +line_length = 130 From b8e1441f308bcade51581cb99239645e5f1b9c13 Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 09:43:37 -0700 Subject: [PATCH 02/10] Install Black and isort --- requirements-tests-py3.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements-tests-py3.txt b/requirements-tests-py3.txt index 5c23efe5e6b3..00054fa1974a 100644 --- a/requirements-tests-py3.txt +++ b/requirements-tests-py3.txt @@ -1,6 +1,8 @@ git+https://github.com/python/mypy.git@master typed-ast>=1.0.4 +black==19.3b0 flake8==3.6.0 flake8-bugbear==18.8.0 flake8-pyi==18.3.1 +isort==4.3.20 pytype>=2019.5.15 From fee25a3af71181741496786454d6a293a8ca3099 Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 09:52:22 -0700 Subject: [PATCH 03/10] Update documentation --- CONTRIBUTING.md | 21 +++++++++++---------- README.md | 19 +++++++++++++------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 045d07f654d0..c79b0e95e422 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ are important to the project's success. but [contact us](#discussion) before starting significant work. * IMPORTANT: For new libraries, [get permission from the library owner first](#adding-a-new-library). * Create your stubs [conforming to the coding style](#stub-file-coding-style). - * Make sure your tests pass cleanly on `mypy`, `pytype`, and `flake8`. + * Make sure you first run the autoformmaters `isort` and `black`, then that the tests pass cleanly on `mypy`, `pytype`, and `flake8`. 4. [Submit your changes](#submitting-changes): * Open a pull request * For new libraries, [include a reference to where you got permission](#adding-a-new-library) @@ -223,23 +223,24 @@ as regular Python files. However, there are a few important differences you should know about. Style conventions for stub files are different from PEP 8. The general -rule is that they should be as concise as possible. Specifically: +rule is that they should be as concise as possible. + +We use the code formatter [Black](https://github.com/python/black) to automatically use the below conventions: * lines can be up to 130 characters long; * functions and methods that don't fit in one line should be split up with one argument per line; -* all function bodies should be empty; -* prefer ``...`` over ``pass``; * prefer ``...`` on the same line as the class/function signature; * avoid vertical whitespace between consecutive module-level functions, names, or methods and fields within a single class; -* use a single blank line between top-level class definitions, or none - if the classes are very small; +* use a single blank line between top-level class definitions; +* for arguments with a type and a default, use spaces around the `=`. + +Stub files should also use these style conventions, which Black cannot automatically fix: +* all function bodies should be empty; +* prefer ``...`` over ``pass``; * do not use docstrings; * use variable annotations instead of type comments, even for stubs that target older versions of Python; -* for arguments with a type and a default, use spaces around the `=`. -The code formatter [black](https://github.com/python/black) will format -stubs according to this standard. Stub files should only contain information necessary for the type checker, and leave out unnecessary detail: @@ -258,7 +259,7 @@ Some further tips for good type hints: * use platform checks like `if sys.platform == 'win32'` to denote platform-dependent APIs. -Imports in stubs are considered private (not part of the exported API) +Imports in stubs are considered private (not part of the exported API), unless: * they use the form ``from library import name as name`` (sic, using explicit ``as`` even if the name stays the same); or diff --git a/README.md b/README.md index 14f32ea72859..53584d4aa255 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ https://github.com/python/typeshed/blob/master/CONTRIBUTING.md#stub-versioning). Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting pull requests. If you have questions related to contributing, drop by the [typing Gitter](https://gitter.im/python/typing). -## Running the tests +## Running the tests and autoformatters The tests are automatically run by Travis CI on every PR and push to the repo. There are several sets of tests: `tests/mypy_test.py` @@ -114,19 +114,26 @@ $ python3.6 -m venv .venv3 $ source .venv3/bin/activate (.venv3)$ pip3 install -r requirements-tests-py3.txt ``` -This will install mypy (you need the latest master branch from GitHub), -typed-ast, flake8, and pytype. You can then run mypy, flake8, and pytype tests -by invoking: +This will install mypy (we use the latest master branch from GitHub), +typed-ast, flake8, pytype, isort, and black. You can then run the tests + and autoformatters by invoking: ``` -(.venv3)$ python3 tests/mypy_test.py +(.venv3)$ isort --recursive . ... -(.venv3)$ python3 tests/mypy_selftest.py +(.venv3)$ black stdlib tests third_party ... (.venv3)$ flake8 ... +(.venv3)$ python3 tests/mypy_test.py +... +(.venv3)$ python3 tests/mypy_selftest.py +... (.venv3)$ python3 tests/pytype_test.py ... ``` + +If `black` or `isort` made any changes, be sure to commit them before making a pull request. + Note that flake8 only works with Python 3.6 or higher, and that to run the pytype tests, you will need Python 2.7 and Python 3.6 interpreters. Pytype will find these automatically if they're in `PATH`, but otherwise you must point to From 8736df8fea182eca61ae4e1e2b74e5c3e4a6f6d2 Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 10:04:14 -0700 Subject: [PATCH 04/10] Add autoformatters shard to Travis We run both isort and black on the same shard because there is a nontrivial startup cost to adding an additional shard. It reduces the available worker pool and each shard takes some time to clone the repository and get set up properly. --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 011b5212123c..dab87339e57e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,11 @@ python: 3.7 matrix: include: + - name: "autoformatters" + python: 3.6 + env: + - TEST_CMD="isort --check-only --recursive . && black --check stdlib tests third_party" + - INSTALL="test" - name: "pytype" python: 3.6 env: From 53e70531989ed45360144a476923ad58c8085fae Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 10:58:26 -0700 Subject: [PATCH 05/10] `.venv3/bin/isort -rc .` --- stdlib/2/BaseHTTPServer.pyi | 4 +- stdlib/2/ConfigParser.pyi | 2 +- stdlib/2/HTMLParser.pyi | 3 +- stdlib/2/Queue.pyi | 2 +- stdlib/2/SimpleHTTPServer.pyi | 2 +- stdlib/2/SocketServer.pyi | 4 +- stdlib/2/StringIO.pyi | 2 +- stdlib/2/UserDict.pyi | 18 +- stdlib/2/UserString.pyi | 2 +- stdlib/2/__builtin__.pyi | 50 +++++- stdlib/2/_collections.pyi | 2 +- stdlib/2/_functools.pyi | 2 +- stdlib/2/_hotshot.pyi | 2 +- stdlib/2/_io.pyi | 2 +- stdlib/2/_json.pyi | 2 +- stdlib/2/_socket.pyi | 2 +- stdlib/2/_sre.pyi | 2 +- stdlib/2/_symtable.pyi | 2 +- stdlib/2/abc.pyi | 2 +- stdlib/2/atexit.pyi | 2 +- stdlib/2/cPickle.pyi | 2 +- stdlib/2/cStringIO.pyi | 2 +- stdlib/2/collections.pyi | 41 ++--- stdlib/2/commands.pyi | 2 +- stdlib/2/email/mime/application.pyi | 2 +- stdlib/2/email/mime/audio.pyi | 1 - stdlib/2/email/mime/image.pyi | 1 - stdlib/2/email/mime/message.pyi | 1 - stdlib/2/email/utils.pyi | 2 +- stdlib/2/encodings/__init__.pyi | 1 - stdlib/2/exceptions.pyi | 8 +- stdlib/2/fcntl.pyi | 2 +- stdlib/2/functools.pyi | 2 +- stdlib/2/future_builtins.pyi | 4 +- stdlib/2/gc.pyi | 1 - stdlib/2/getpass.pyi | 2 +- stdlib/2/gettext.pyi | 2 +- stdlib/2/glob.pyi | 2 +- stdlib/2/gzip.pyi | 2 +- stdlib/2/heapq.pyi | 2 +- stdlib/2/httplib.pyi | 2 +- stdlib/2/imp.pyi | 2 +- stdlib/2/inspect.pyi | 4 +- stdlib/2/io.pyi | 8 +- stdlib/2/itertools.pyi | 3 +- stdlib/2/json.pyi | 2 +- stdlib/2/md5.pyi | 2 +- stdlib/2/mimetools.pyi | 2 +- stdlib/2/multiprocessing/__init__.pyi | 10 +- stdlib/2/multiprocessing/dummy/__init__.pyi | 14 +- stdlib/2/multiprocessing/pool.pyi | 5 +- stdlib/2/multiprocessing/util.pyi | 2 +- stdlib/2/os/__init__.pyi | 25 ++- stdlib/2/os/path.pyi | 5 +- stdlib/2/os2emxpath.pyi | 5 +- stdlib/2/pipes.pyi | 2 +- stdlib/2/popen2.pyi | 2 +- stdlib/2/posix.pyi | 2 +- stdlib/2/random.pyi | 5 +- stdlib/2/re.pyi | 16 +- stdlib/2/resource.pyi | 2 +- stdlib/2/shelve.pyi | 3 +- stdlib/2/shlex.pyi | 2 +- stdlib/2/signal.pyi | 2 +- stdlib/2/sre_parse.pyi | 4 +- stdlib/2/string.pyi | 2 +- stdlib/2/subprocess.pyi | 2 +- stdlib/2/sys.pyi | 7 +- stdlib/2/tempfile.pyi | 4 +- stdlib/2/textwrap.pyi | 2 +- stdlib/2/thread.pyi | 2 +- stdlib/2/toaiff.pyi | 1 - stdlib/2/tokenize.pyi | 2 +- stdlib/2/types.pyi | 5 +- stdlib/2/typing.pyi | 4 +- stdlib/2/unittest.pyi | 26 ++- stdlib/2/urllib.pyi | 2 +- stdlib/2/urllib2.pyi | 4 +- stdlib/2/urlparse.pyi | 2 +- stdlib/2/xmlrpclib.pyi | 8 +- stdlib/2and3/_codecs.pyi | 5 +- stdlib/2and3/_csv.pyi | 1 - stdlib/2and3/_curses.pyi | 2 +- stdlib/2and3/_heapq.pyi | 2 +- stdlib/2and3/_weakrefset.pyi | 2 +- stdlib/2and3/argparse.pyi | 21 ++- stdlib/2and3/array.pyi | 3 +- stdlib/2and3/asynchat.pyi | 3 +- stdlib/2and3/asyncore.pyi | 24 ++- stdlib/2and3/base64.pyi | 2 +- stdlib/2and3/binascii.pyi | 3 +- stdlib/2and3/binhex.pyi | 8 +- stdlib/2and3/builtins.pyi | 50 +++++- stdlib/2and3/bz2.pyi | 2 +- stdlib/2and3/calendar.pyi | 1 - stdlib/2and3/cgi.pyi | 2 +- stdlib/2and3/cmd.pyi | 2 +- stdlib/2and3/code.pyi | 2 +- stdlib/2and3/codecs.pyi | 22 ++- stdlib/2and3/contextlib.pyi | 8 +- stdlib/2and3/copy.pyi | 2 +- stdlib/2and3/crypt.pyi | 1 - stdlib/2and3/csv.pyi | 31 ++-- stdlib/2and3/ctypes/__init__.pyi | 20 ++- stdlib/2and3/ctypes/util.pyi | 2 +- stdlib/2and3/ctypes/wintypes.pyi | 21 ++- stdlib/2and3/curses/__init__.pyi | 2 +- stdlib/2and3/curses/ascii.pyi | 2 +- stdlib/2and3/datetime.pyi | 5 +- stdlib/2and3/decimal.pyi | 4 +- stdlib/2and3/difflib.pyi | 15 +- stdlib/2and3/dis.pyi | 20 ++- stdlib/2and3/distutils/archive_util.pyi | 1 - stdlib/2and3/distutils/bcppcompiler.pyi | 1 - stdlib/2and3/distutils/ccompiler.pyi | 1 - stdlib/2and3/distutils/cmd.pyi | 2 +- stdlib/2and3/distutils/command/build_py.pyi | 2 +- stdlib/2and3/distutils/command/install.pyi | 1 - stdlib/2and3/distutils/core.pyi | 2 +- stdlib/2and3/distutils/cygwinccompiler.pyi | 1 - stdlib/2and3/distutils/dir_util.pyi | 1 - stdlib/2and3/distutils/dist.pyi | 4 +- stdlib/2and3/distutils/extension.pyi | 2 +- stdlib/2and3/distutils/fancy_getopt.pyi | 5 +- stdlib/2and3/distutils/file_util.pyi | 1 - stdlib/2and3/distutils/msvccompiler.pyi | 1 - stdlib/2and3/distutils/sysconfig.pyi | 2 +- stdlib/2and3/distutils/unixccompiler.pyi | 1 - stdlib/2and3/distutils/util.pyi | 1 - stdlib/2and3/distutils/version.pyi | 2 +- stdlib/2and3/doctest.pyi | 3 +- stdlib/2and3/errno.pyi | 2 +- stdlib/2and3/filecmp.pyi | 2 +- stdlib/2and3/fileinput.pyi | 3 +- stdlib/2and3/formatter.pyi | 2 +- stdlib/2and3/fractions.pyi | 6 +- stdlib/2and3/ftplib.pyi | 20 ++- stdlib/2and3/genericpath.pyi | 2 +- stdlib/2and3/hmac.pyi | 4 +- stdlib/2and3/imaplib.pyi | 2 +- stdlib/2and3/imghdr.pyi | 5 +- stdlib/2and3/lib2to3/pgen2/driver.pyi | 8 +- stdlib/2and3/lib2to3/pgen2/grammar.pyi | 1 - stdlib/2and3/lib2to3/pgen2/parse.pyi | 5 +- stdlib/2and3/lib2to3/pgen2/pgen.pyi | 5 +- stdlib/2and3/lib2to3/pgen2/tokenize.pyi | 3 +- stdlib/2and3/lib2to3/pygram.pyi | 2 +- stdlib/2and3/lib2to3/pytree.pyi | 3 +- stdlib/2and3/locale.pyi | 2 +- stdlib/2and3/logging/__init__.pyi | 11 +- stdlib/2and3/logging/config.pyi | 5 +- stdlib/2and3/logging/handlers.pyi | 5 +- stdlib/2and3/macpath.pyi | 5 +- stdlib/2and3/marshal.pyi | 2 +- stdlib/2and3/math.pyi | 3 +- stdlib/2and3/mimetypes.pyi | 2 +- stdlib/2and3/mmap.pyi | 3 +- stdlib/2and3/netrc.pyi | 1 - stdlib/2and3/ntpath.pyi | 5 +- stdlib/2and3/numbers.pyi | 4 +- stdlib/2and3/opcode.pyi | 3 +- stdlib/2and3/operator.pyi | 16 +- stdlib/2and3/optparse.pyi | 2 +- stdlib/2and3/pdb.pyi | 4 +- stdlib/2and3/pickle.pyi | 2 +- stdlib/2and3/pickletools.pyi | 2 +- stdlib/2and3/pkgutil.pyi | 2 +- stdlib/2and3/plistlib.pyi | 9 +- stdlib/2and3/poplib.pyi | 5 +- stdlib/2and3/posixpath.pyi | 5 +- stdlib/2and3/pprint.pyi | 2 +- stdlib/2and3/pstats.pyi | 6 +- stdlib/2and3/py_compile.pyi | 3 +- stdlib/2and3/pyclbr.pyi | 3 +- stdlib/2and3/pydoc.pyi | 19 ++- stdlib/2and3/pyexpat/__init__.pyi | 3 +- stdlib/2and3/readline.pyi | 2 +- stdlib/2and3/rlcompleter.pyi | 2 +- stdlib/2and3/shutil.pyi | 23 ++- stdlib/2and3/site.pyi | 2 +- stdlib/2and3/smtpd.pyi | 7 +- stdlib/2and3/socket.pyi | 2 +- stdlib/2and3/sqlite3/dbapi2.pyi | 2 +- stdlib/2and3/ssl.pyi | 4 +- stdlib/2and3/struct.pyi | 2 +- stdlib/2and3/sunau.pyi | 2 +- stdlib/2and3/symtable.pyi | 2 +- stdlib/2and3/sysconfig.pyi | 2 +- stdlib/2and3/tarfile.pyi | 5 +- stdlib/2and3/threading.pyi | 7 +- stdlib/2and3/time.pyi | 3 +- stdlib/2and3/timeit.pyi | 2 +- stdlib/2and3/traceback.pyi | 4 +- stdlib/2and3/turtle.pyi | 3 +- stdlib/2and3/uu.pyi | 2 +- stdlib/2and3/uuid.pyi | 2 +- stdlib/2and3/warnings.pyi | 2 +- stdlib/2and3/wave.pyi | 4 +- stdlib/2and3/weakref.pyi | 34 ++-- stdlib/2and3/webbrowser.pyi | 2 +- stdlib/2and3/wsgiref/handlers.pyi | 4 +- stdlib/2and3/wsgiref/headers.pyi | 2 +- stdlib/2and3/wsgiref/simple_server.pyi | 4 +- stdlib/2and3/wsgiref/types.pyi | 2 +- stdlib/2and3/wsgiref/validate.pyi | 5 +- stdlib/2and3/xml/etree/ElementInclude.pyi | 2 +- stdlib/2and3/xml/etree/ElementPath.pyi | 2 +- stdlib/2and3/xml/etree/ElementTree.pyi | 21 ++- stdlib/2and3/xml/sax/__init__.pyi | 5 +- stdlib/2and3/xml/sax/saxutils.pyi | 4 +- stdlib/2and3/zipfile.pyi | 5 +- stdlib/2and3/zipimport.pyi | 2 +- stdlib/3.5/zipapp.pyi | 2 +- stdlib/3.6/secrets.pyi | 2 +- stdlib/3.7/dataclasses.pyi | 3 +- stdlib/3/_ast.pyi | 2 +- stdlib/3/_compression.pyi | 2 +- stdlib/3/_importlib_modulespec.pyi | 2 +- stdlib/3/_operator.pyi | 108 ++++++------ stdlib/3/_posixsubprocess.pyi | 2 +- stdlib/3/_subprocess.pyi | 2 +- stdlib/3/_winapi.pyi | 2 +- stdlib/3/abc.pyi | 1 + stdlib/3/ast.pyi | 6 +- stdlib/3/asyncio/__init__.pyi | 145 +++++++--------- stdlib/3/asyncio/base_events.pyi | 6 +- stdlib/3/asyncio/events.pyi | 6 +- stdlib/3/asyncio/futures.pyi | 13 +- stdlib/3/asyncio/locks.pyi | 4 +- stdlib/3/asyncio/queues.pyi | 3 +- stdlib/3/asyncio/runners.pyi | 1 - stdlib/3/asyncio/streams.pyi | 5 +- stdlib/3/asyncio/subprocess.pyi | 7 +- stdlib/3/asyncio/tasks.pyi | 24 ++- stdlib/3/asyncio/transports.pyi | 2 +- stdlib/3/collections/__init__.pyi | 52 +++--- stdlib/3/collections/abc.pyi | 34 ++-- stdlib/3/compileall.pyi | 2 +- stdlib/3/concurrent/futures/__init__.pyi | 2 +- stdlib/3/concurrent/futures/_base.pyi | 4 +- stdlib/3/concurrent/futures/process.pyi | 5 +- stdlib/3/concurrent/futures/thread.pyi | 3 +- stdlib/3/configparser.pyi | 24 ++- stdlib/3/email/__init__.pyi | 2 +- stdlib/3/email/charset.pyi | 2 +- stdlib/3/email/contentmanager.pyi | 2 +- stdlib/3/email/feedparser.pyi | 2 +- stdlib/3/email/generator.pyi | 2 +- stdlib/3/email/header.pyi | 2 +- stdlib/3/email/headerregistry.pyi | 2 +- stdlib/3/email/iterators.pyi | 2 +- stdlib/3/email/message.pyi | 6 +- stdlib/3/email/mime/application.pyi | 2 +- stdlib/3/email/mime/audio.pyi | 2 +- stdlib/3/email/mime/base.pyi | 2 +- stdlib/3/email/mime/image.pyi | 2 +- stdlib/3/email/mime/multipart.pyi | 2 +- stdlib/3/email/mime/text.pyi | 2 +- stdlib/3/email/policy.pyi | 8 +- stdlib/3/email/utils.pyi | 4 +- stdlib/3/encodings/__init__.pyi | 1 - stdlib/3/enum.pyi | 2 +- stdlib/3/faulthandler.pyi | 3 +- stdlib/3/fcntl.pyi | 2 +- stdlib/3/fnmatch.pyi | 2 +- stdlib/3/functools.pyi | 17 +- stdlib/3/gc.pyi | 1 - stdlib/3/getpass.pyi | 1 - stdlib/3/gettext.pyi | 2 +- stdlib/3/glob.pyi | 2 +- stdlib/3/gzip.pyi | 4 +- stdlib/3/heapq.pyi | 2 +- stdlib/3/html/parser.pyi | 4 +- stdlib/3/http/__init__.pyi | 1 - stdlib/3/http/client.pyi | 28 +++- stdlib/3/http/cookiejar.pyi | 2 +- stdlib/3/http/cookies.pyi | 2 +- stdlib/3/http/server.pyi | 4 +- stdlib/3/imp.pyi | 15 +- stdlib/3/importlib/__init__.pyi | 2 +- stdlib/3/importlib/abc.pyi | 5 +- stdlib/3/importlib/resources.pyi | 1 + stdlib/3/inspect.pyi | 6 +- stdlib/3/io.pyi | 7 +- stdlib/3/ipaddress.pyi | 3 +- stdlib/3/itertools.pyi | 3 +- stdlib/3/json/__init__.pyi | 3 +- stdlib/3/lzma.pyi | 2 +- stdlib/3/msvcrt.pyi | 2 +- stdlib/3/multiprocessing/__init__.pyi | 21 ++- stdlib/3/multiprocessing/connection.pyi | 2 +- stdlib/3/multiprocessing/context.pyi | 10 +- stdlib/3/multiprocessing/dummy/__init__.pyi | 8 +- stdlib/3/multiprocessing/dummy/connection.pyi | 3 +- stdlib/3/multiprocessing/managers.pyi | 5 +- stdlib/3/multiprocessing/pool.pyi | 5 +- stdlib/3/multiprocessing/process.pyi | 2 +- stdlib/3/multiprocessing/queues.pyi | 3 +- stdlib/3/multiprocessing/spawn.pyi | 2 +- stdlib/3/multiprocessing/synchronize.pyi | 7 +- stdlib/3/nntplib.pyi | 2 +- stdlib/3/os/__init__.pyi | 30 +++- stdlib/3/os/path.pyi | 5 +- stdlib/3/pathlib.pyi | 4 +- stdlib/3/platform.pyi | 2 +- stdlib/3/posix.pyi | 3 +- stdlib/3/queue.pyi | 4 +- stdlib/3/random.pyi | 4 +- stdlib/3/re.pyi | 16 +- stdlib/3/resource.pyi | 2 +- stdlib/3/runpy.pyi | 2 +- stdlib/3/shelve.pyi | 3 +- stdlib/3/shlex.pyi | 2 +- stdlib/3/signal.pyi | 2 +- stdlib/3/smtplib.pyi | 6 +- stdlib/3/socketserver.pyi | 4 +- stdlib/3/sre_parse.pyi | 10 +- stdlib/3/statistics.pyi | 2 +- stdlib/3/string.pyi | 2 +- stdlib/3/subprocess.pyi | 2 +- stdlib/3/sys.pyi | 8 +- stdlib/3/tempfile.pyi | 2 +- stdlib/3/textwrap.pyi | 2 +- stdlib/3/tkinter/__init__.pyi | 4 +- stdlib/3/tkinter/dialog.pyi | 2 +- stdlib/3/tkinter/filedialog.pyi | 2 +- stdlib/3/tkinter/ttk.pyi | 2 +- stdlib/3/tokenize.pyi | 4 +- stdlib/3/types.pyi | 5 +- stdlib/3/typing.pyi | 4 +- stdlib/3/unittest/__init__.pyi | 4 +- stdlib/3/unittest/case.pyi | 28 +++- stdlib/3/unittest/loader.pyi | 3 +- stdlib/3/unittest/result.pyi | 5 +- stdlib/3/unittest/runner.pyi | 3 +- stdlib/3/unittest/signals.pyi | 3 +- stdlib/3/unittest/suite.pyi | 3 +- stdlib/3/urllib/parse.pyi | 2 +- stdlib/3/urllib/request.pyi | 15 +- stdlib/3/urllib/response.pyi | 2 +- stdlib/3/urllib/robotparser.pyi | 2 +- tests/check_consistent.py | 2 +- tests/mypy_selftest.py | 3 +- tests/mypy_test.py | 2 +- tests/pytype_test.py | 4 +- third_party/2/OpenSSL/crypto.pyi | 2 +- third_party/2/concurrent/futures/__init__.pyi | 2 +- third_party/2/concurrent/futures/_base.pyi | 4 +- third_party/2/concurrent/futures/process.pyi | 5 +- third_party/2/concurrent/futures/thread.pyi | 3 +- .../hazmat/primitives/asymmetric/rsa.pyi | 3 +- .../hazmat/primitives/serialization.pyi | 2 +- third_party/2/enum.pyi | 2 +- third_party/2/fb303/FacebookService.pyi | 1 + third_party/2/gflags.pyi | 2 +- third_party/2/pathlib2.pyi | 4 +- third_party/2/pymssql.pyi | 5 +- third_party/2/routes/__init__.pyi | 3 +- third_party/2/scribe/scribe.pyi | 3 +- third_party/2/six/__init__.pyi | 29 +++- third_party/2/six/moves/__init__.pyi | 75 +++++---- third_party/2/six/moves/urllib/error.pyi | 4 +- third_party/2/six/moves/urllib/parse.pyi | 16 +- third_party/2/six/moves/urllib/request.pyi | 50 +++--- third_party/2/tornado/gen.pyi | 2 +- third_party/2/tornado/httpclient.pyi | 1 + third_party/2/tornado/httpserver.pyi | 1 + third_party/2/tornado/httputil.pyi | 3 +- third_party/2/tornado/ioloop.pyi | 1 + third_party/2/tornado/netutil.pyi | 1 + third_party/2/tornado/testing.pyi | 4 +- third_party/2/tornado/web.pyi | 1 + third_party/2and3/Crypto/Cipher/AES.pyi | 3 +- third_party/2and3/Crypto/Cipher/ARC2.pyi | 3 +- third_party/2and3/Crypto/Cipher/ARC4.pyi | 2 +- third_party/2and3/Crypto/Cipher/Blowfish.pyi | 3 +- third_party/2and3/Crypto/Cipher/CAST.pyi | 3 +- third_party/2and3/Crypto/Cipher/DES.pyi | 3 +- third_party/2and3/Crypto/Cipher/DES3.pyi | 2 +- .../2and3/Crypto/Cipher/PKCS1_OAEP.pyi | 2 +- .../2and3/Crypto/Cipher/PKCS1_v1_5.pyi | 2 +- third_party/2and3/Crypto/Cipher/XOR.pyi | 2 +- third_party/2and3/Crypto/Cipher/blockalgo.pyi | 2 +- third_party/2and3/Crypto/Hash/MD2.pyi | 1 + third_party/2and3/Crypto/Hash/MD4.pyi | 1 + third_party/2and3/Crypto/Hash/MD5.pyi | 1 + third_party/2and3/Crypto/Hash/RIPEMD.pyi | 1 + third_party/2and3/Crypto/Hash/SHA.pyi | 1 + third_party/2and3/Crypto/Hash/SHA224.pyi | 1 + third_party/2and3/Crypto/Hash/SHA256.pyi | 1 + third_party/2and3/Crypto/Hash/SHA384.pyi | 1 + third_party/2and3/Crypto/Hash/SHA512.pyi | 1 + third_party/2and3/Crypto/Protocol/KDF.pyi | 1 + third_party/2and3/Crypto/PublicKey/DSA.pyi | 1 + .../2and3/Crypto/PublicKey/ElGamal.pyi | 2 +- third_party/2and3/Crypto/PublicKey/RSA.pyi | 3 +- .../2and3/Crypto/Random/OSRNG/posix.pyi | 1 + third_party/2and3/atomicwrites/__init__.pyi | 2 +- third_party/2and3/attr/__init__.pyi | 18 +- third_party/2and3/attr/converters.pyi | 3 +- third_party/2and3/attr/filters.pyi | 3 +- third_party/2and3/attr/validators.pyi | 3 +- third_party/2and3/bleach/__init__.pyi | 15 +- third_party/2and3/bleach/callbacks.pyi | 2 +- third_party/2and3/bleach/utils.pyi | 2 +- third_party/2and3/boto/__init__.pyi | 2 +- third_party/2and3/boto/auth.pyi | 1 + third_party/2and3/boto/auth_handler.pyi | 1 + third_party/2and3/boto/compat.pyi | 3 +- third_party/2and3/boto/connection.pyi | 1 + third_party/2and3/boto/elb/__init__.pyi | 1 + third_party/2and3/boto/exception.pyi | 1 + third_party/2and3/boto/kms/__init__.pyi | 1 + third_party/2and3/boto/kms/layer1.pyi | 1 + third_party/2and3/boto/s3/__init__.pyi | 6 +- third_party/2and3/boto/s3/acl.pyi | 3 +- third_party/2and3/boto/s3/bucket.pyi | 4 +- .../2and3/boto/s3/bucketlistresultset.pyi | 4 +- third_party/2and3/boto/s3/connection.pyi | 5 +- third_party/2and3/boto/utils.pyi | 6 +- third_party/2and3/characteristic/__init__.pyi | 2 +- third_party/2and3/click/__init__.pyi | 155 ++++++++---------- third_party/2and3/click/_termui_impl.pyi | 2 +- third_party/2and3/click/decorators.pyi | 4 +- third_party/2and3/click/exceptions.pyi | 3 +- third_party/2and3/click/formatting.pyi | 1 - third_party/2and3/click/globals.pyi | 2 +- third_party/2and3/click/parser.pyi | 1 - third_party/2and3/click/termui.pyi | 18 +- third_party/2and3/click/testing.pyi | 3 +- third_party/2and3/click/types.pyi | 7 +- third_party/2and3/click/utils.pyi | 2 +- third_party/2and3/dateutil/parser.pyi | 2 +- third_party/2and3/dateutil/relativedelta.pyi | 3 +- third_party/2and3/dateutil/rrule.pyi | 5 +- third_party/2and3/dateutil/tz/__init__.pyi | 24 ++- third_party/2and3/dateutil/tz/_common.pyi | 2 +- third_party/2and3/dateutil/tz/tz.pyi | 9 +- third_party/2and3/dateutil/utils.pyi | 3 +- third_party/2and3/emoji.pyi | 2 +- third_party/2and3/first.pyi | 2 +- third_party/2and3/flask/__init__.pyi | 10 +- third_party/2and3/flask/app.pyi | 18 +- third_party/2and3/flask/blueprints.pyi | 3 +- third_party/2and3/flask/cli.pyi | 4 +- third_party/2and3/flask/config.pyi | 2 +- third_party/2and3/flask/ctx.pyi | 3 +- third_party/2and3/flask/debughelpers.pyi | 3 +- third_party/2and3/flask/globals.pyi | 6 +- third_party/2and3/flask/helpers.pyi | 3 +- third_party/2and3/flask/json/__init__.pyi | 1 + third_party/2and3/flask/logging.pyi | 3 +- third_party/2and3/flask/sessions.pyi | 1 + third_party/2and3/flask/templating.pyi | 7 +- third_party/2and3/flask/testing.pyi | 4 +- third_party/2and3/flask/views.pyi | 3 +- third_party/2and3/flask/wrappers.pyi | 4 +- third_party/2and3/google/protobuf/any_pb2.pyi | 12 +- .../2and3/google/protobuf/any_test_pb2.pyi | 17 +- third_party/2and3/google/protobuf/api_pb2.pyi | 23 +-- .../google/protobuf/compiler/plugin_pb2.pyi | 19 +-- .../2and3/google/protobuf/descriptor.pyi | 2 +- .../2and3/google/protobuf/descriptor_pb2.pyi | 18 +- .../2and3/google/protobuf/duration_pb2.pyi | 11 +- .../2and3/google/protobuf/empty_pb2.pyi | 5 +- .../2and3/google/protobuf/field_mask_pb2.pyi | 17 +- .../google/protobuf/internal/containers.pyi | 6 +- .../protobuf/internal/well_known_types.pyi | 2 +- .../2and3/google/protobuf/json_format.pyi | 1 + .../protobuf/map_proto2_unittest_pb2.pyi | 18 +- .../google/protobuf/map_unittest_pb2.pyi | 25 +-- third_party/2and3/google/protobuf/message.pyi | 7 +- .../2and3/google/protobuf/message_factory.pyi | 2 +- .../google/protobuf/source_context_pb2.pyi | 9 +- .../2and3/google/protobuf/struct_pb2.pyi | 22 +-- .../protobuf/test_messages_proto2_pb2.pyi | 20 +-- .../protobuf/test_messages_proto3_pb2.pyi | 43 +---- .../2and3/google/protobuf/timestamp_pb2.pyi | 11 +- .../2and3/google/protobuf/type_pb2.pyi | 26 +-- .../google/protobuf/unittest_arena_pb2.pyi | 17 +- .../protobuf/unittest_custom_options_pb2.pyi | 22 +-- .../google/protobuf/unittest_import_pb2.pyi | 11 +- .../protobuf/unittest_import_public_pb2.pyi | 8 +- .../google/protobuf/unittest_mset_pb2.pyi | 18 +- .../unittest_mset_wire_format_pb2.pyi | 8 +- .../protobuf/unittest_no_arena_import_pb2.pyi | 8 +- .../google/protobuf/unittest_no_arena_pb2.pyi | 31 +--- .../unittest_no_generic_services_pb2.pyi | 11 +- .../2and3/google/protobuf/unittest_pb2.pyi | 29 +--- .../protobuf/unittest_proto3_arena_pb2.pyi | 26 +-- .../protobuf/util/json_format_proto3_pb2.pyi | 48 ++---- .../2and3/google/protobuf/wrappers_pb2.pyi | 9 +- third_party/2and3/itsdangerous.pyi | 2 +- third_party/2and3/jinja2/__init__.pyi | 41 ++++- third_party/2and3/jinja2/_compat.pyi | 2 +- third_party/2and3/jinja2/compiler.pyi | 3 +- third_party/2and3/jinja2/defaults.pyi | 1 + third_party/2and3/jinja2/loaders.pyi | 2 +- third_party/2and3/jinja2/meta.pyi | 1 + third_party/2and3/jinja2/optimizer.pyi | 1 + third_party/2and3/jinja2/runtime.pyi | 8 +- third_party/2and3/jinja2/sandbox.pyi | 1 + third_party/2and3/jinja2/utils.pyi | 4 +- third_party/2and3/markupsafe/__init__.pyi | 10 +- third_party/2and3/markupsafe/_compat.pyi | 1 - third_party/2and3/markupsafe/_native.pyi | 5 +- third_party/2and3/markupsafe/_speedups.pyi | 5 +- third_party/2and3/mypy_extensions.pyi | 4 +- third_party/2and3/pymysql/__init__.pyi | 44 +++-- third_party/2and3/pymysql/connections.pyi | 32 +++- third_party/2and3/pymysql/converters.pyi | 4 +- third_party/2and3/pymysql/cursors.pyi | 3 +- third_party/2and3/pymysql/err.pyi | 1 + third_party/2and3/pynamodb/attributes.pyi | 3 +- third_party/2and3/pynamodb/models.pyi | 3 +- third_party/2and3/pytz/__init__.pyi | 2 +- third_party/2and3/redis/__init__.pyi | 5 +- third_party/2and3/redis/client.pyi | 2 +- third_party/2and3/requests/__init__.pyi | 10 +- third_party/2and3/requests/adapters.pyi | 16 +- third_party/2and3/requests/api.pyi | 2 +- third_party/2and3/requests/auth.pyi | 7 +- third_party/2and3/requests/compat.pyi | 2 +- third_party/2and3/requests/cookies.pyi | 3 +- third_party/2and3/requests/exceptions.pyi | 1 + third_party/2and3/requests/models.pyi | 17 +- .../requests/packages/urllib3/__init__.pyi | 12 +- .../packages/urllib3/_collections.pyi | 2 +- .../requests/packages/urllib3/connection.pyi | 7 +- .../packages/urllib3/connectionpool.pyi | 19 +-- .../requests/packages/urllib3/fields.pyi | 1 + .../requests/packages/urllib3/filepost.pyi | 4 +- .../requests/packages/urllib3/poolmanager.pyi | 1 + .../requests/packages/urllib3/response.pyi | 9 +- .../packages/urllib3/util/__init__.pyi | 9 +- .../packages/urllib3/util/request.pyi | 1 + .../requests/packages/urllib3/util/retry.pyi | 4 +- .../requests/packages/urllib3/util/ssl_.pyi | 3 +- .../packages/urllib3/util/timeout.pyi | 1 + .../requests/packages/urllib3/util/url.pyi | 1 + third_party/2and3/requests/sessions.pyi | 12 +- third_party/2and3/requests/status_codes.pyi | 1 + third_party/2and3/requests/structures.pyi | 2 +- third_party/2and3/requests/utils.pyi | 6 +- third_party/2and3/simplejson/__init__.pyi | 7 +- third_party/2and3/simplejson/encoder.pyi | 2 +- third_party/2and3/singledispatch.pyi | 1 - third_party/2and3/tabulate.pyi | 1 - third_party/2and3/termcolor.pyi | 1 - third_party/2and3/toml.pyi | 2 +- third_party/2and3/typing_extensions.pyi | 9 +- third_party/2and3/ujson.pyi | 2 +- third_party/2and3/werkzeug/__init__.pyi | 34 ++-- third_party/2and3/werkzeug/contrib/fixers.pyi | 4 +- .../2and3/werkzeug/contrib/securecookie.pyi | 5 +- .../2and3/werkzeug/contrib/sessions.pyi | 1 + .../2and3/werkzeug/contrib/testtools.pyi | 1 + third_party/2and3/werkzeug/datastructures.pyi | 2 +- third_party/2and3/werkzeug/debug/__init__.pyi | 4 +- third_party/2and3/werkzeug/debug/console.pyi | 2 +- third_party/2and3/werkzeug/exceptions.pyi | 4 +- third_party/2and3/werkzeug/http.pyi | 30 +++- third_party/2and3/werkzeug/posixemulation.pyi | 1 + third_party/2and3/werkzeug/routing.pyi | 1 + third_party/2and3/werkzeug/testapp.pyi | 4 +- third_party/2and3/werkzeug/urls.pyi | 1 - third_party/2and3/werkzeug/utils.pyi | 3 +- third_party/2and3/werkzeug/wrappers.pyi | 32 +++- third_party/2and3/werkzeug/wsgi.pyi | 4 +- third_party/2and3/yaml/__init__.pyi | 13 +- third_party/2and3/yaml/composer.pyi | 5 +- third_party/2and3/yaml/constructor.pyi | 6 +- third_party/2and3/yaml/cyaml.pyi | 5 +- third_party/2and3/yaml/dumper.pyi | 2 +- third_party/2and3/yaml/emitter.pyi | 1 + third_party/2and3/yaml/loader.pyi | 8 +- third_party/2and3/yaml/parser.pyi | 1 + third_party/2and3/yaml/reader.pyi | 1 + third_party/2and3/yaml/representer.pyi | 1 + third_party/2and3/yaml/resolver.pyi | 1 + third_party/2and3/yaml/scanner.pyi | 1 + third_party/2and3/yaml/serializer.pyi | 1 + third_party/3/dataclasses.pyi | 3 +- third_party/3/docutils/parsers/rst/roles.pyi | 4 +- third_party/3/jwt/__init__.pyi | 2 +- third_party/3/jwt/algorithms.pyi | 2 +- .../3/jwt/contrib/algorithms/py_ecdsa.pyi | 1 + .../3/jwt/contrib/algorithms/pycrypto.pyi | 1 + third_party/3/pkg_resources/__init__.pyi | 4 +- third_party/3/pkg_resources/py31compat.pyi | 2 +- third_party/3/six/__init__.pyi | 15 +- third_party/3/six/moves/__init__.pyi | 104 ++++++------ third_party/3/six/moves/urllib/error.pyi | 4 +- third_party/3/six/moves/urllib/parse.pyi | 16 +- third_party/3/six/moves/urllib/request.pyi | 52 +++--- third_party/3/typed_ast/ast27.pyi | 2 +- third_party/3/typed_ast/ast3.pyi | 2 +- third_party/3/typed_ast/conversions.pyi | 3 +- 598 files changed, 2036 insertions(+), 2028 deletions(-) diff --git a/stdlib/2/BaseHTTPServer.pyi b/stdlib/2/BaseHTTPServer.pyi index 1f9d2ce8b3f3..3231b2f53b98 100644 --- a/stdlib/2/BaseHTTPServer.pyi +++ b/stdlib/2/BaseHTTPServer.pyi @@ -1,8 +1,8 @@ # Stubs for BaseHTTPServer (Python 2.7) -from typing import Any, BinaryIO, Mapping, Optional, Tuple, Union -import SocketServer import mimetools +import SocketServer +from typing import Any, BinaryIO, Mapping, Optional, Tuple, Union class HTTPServer(SocketServer.TCPServer): server_name: str diff --git a/stdlib/2/ConfigParser.pyi b/stdlib/2/ConfigParser.pyi index 5d86811726a8..448e2d190a45 100644 --- a/stdlib/2/ConfigParser.pyi +++ b/stdlib/2/ConfigParser.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO, Sequence, Tuple, Union, List, Dict, Protocol, Optional +from typing import IO, Any, Dict, List, Optional, Protocol, Sequence, Tuple, Union DEFAULTSECT: str MAX_INTERPOLATION_DEPTH: int diff --git a/stdlib/2/HTMLParser.pyi b/stdlib/2/HTMLParser.pyi index 0f6c7e399a9c..4ee4e1498de4 100644 --- a/stdlib/2/HTMLParser.pyi +++ b/stdlib/2/HTMLParser.pyi @@ -1,4 +1,5 @@ -from typing import List, Tuple, AnyStr +from typing import AnyStr, List, Tuple + from markupbase import ParserBase class HTMLParser(ParserBase): diff --git a/stdlib/2/Queue.pyi b/stdlib/2/Queue.pyi index 11b01ed1c23e..7763e5ded840 100644 --- a/stdlib/2/Queue.pyi +++ b/stdlib/2/Queue.pyi @@ -1,7 +1,7 @@ # Stubs for Queue (Python 2) from collections import deque -from typing import Any, TypeVar, Generic, Optional +from typing import Any, Generic, Optional, TypeVar _T = TypeVar('_T') diff --git a/stdlib/2/SimpleHTTPServer.pyi b/stdlib/2/SimpleHTTPServer.pyi index be22b88381d7..b6bdc06265d3 100644 --- a/stdlib/2/SimpleHTTPServer.pyi +++ b/stdlib/2/SimpleHTTPServer.pyi @@ -1,8 +1,8 @@ # Stubs for SimpleHTTPServer (Python 2) -from typing import Any, AnyStr, IO, Mapping, Optional, Union import BaseHTTPServer from StringIO import StringIO +from typing import IO, Any, AnyStr, Mapping, Optional, Union class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): server_version: str diff --git a/stdlib/2/SocketServer.pyi b/stdlib/2/SocketServer.pyi index d485b8bf1034..b24f96c4df6e 100644 --- a/stdlib/2/SocketServer.pyi +++ b/stdlib/2/SocketServer.pyi @@ -1,10 +1,10 @@ # NB: SocketServer.pyi and socketserver.pyi must remain consistent! # Stubs for socketserver -from typing import Any, BinaryIO, Optional, Tuple, Type -from socket import SocketType import sys import types +from socket import SocketType +from typing import Any, BinaryIO, Optional, Tuple, Type class BaseServer: address_family: int diff --git a/stdlib/2/StringIO.pyi b/stdlib/2/StringIO.pyi index de17f6abadfa..d055e571f90c 100644 --- a/stdlib/2/StringIO.pyi +++ b/stdlib/2/StringIO.pyi @@ -1,6 +1,6 @@ # Stubs for StringIO (Python 2) -from typing import Any, IO, AnyStr, Iterator, Iterable, Generic, List, Optional +from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List, Optional class StringIO(IO[AnyStr], Generic[AnyStr]): closed: bool diff --git a/stdlib/2/UserDict.pyi b/stdlib/2/UserDict.pyi index 965e88e03b29..96d464c82bc1 100644 --- a/stdlib/2/UserDict.pyi +++ b/stdlib/2/UserDict.pyi @@ -1,5 +1,19 @@ -from typing import (Any, Container, Dict, Generic, Iterable, Iterator, List, - Mapping, Optional, Sized, Tuple, TypeVar, Union, overload) +from typing import ( + Any, + Container, + Dict, + Generic, + Iterable, + Iterator, + List, + Mapping, + Optional, + Sized, + Tuple, + TypeVar, + Union, + overload, +) _KT = TypeVar('_KT') _VT = TypeVar('_VT') diff --git a/stdlib/2/UserString.pyi b/stdlib/2/UserString.pyi index 8cbbfc1242e7..375d68b0a161 100644 --- a/stdlib/2/UserString.pyi +++ b/stdlib/2/UserString.pyi @@ -1,5 +1,5 @@ import collections -from typing import Any, Iterable, List, MutableSequence, Sequence, Optional, overload, Text, TypeVar, Tuple, Union +from typing import Any, Iterable, List, MutableSequence, Optional, Sequence, Text, Tuple, TypeVar, Union, overload _UST = TypeVar("_UST", bound=UserString) _MST = TypeVar("_MST", bound=MutableString) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 13a6ef968ecc..5d47593011b5 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -1,18 +1,50 @@ # True and False are deliberately omitted because they are keywords in # Python 3, and stub files conform to Python 3 syntax. +import sys +from abc import ABCMeta, abstractmethod +from ast import AST, mod +from types import CodeType, TracebackType from typing import ( - TypeVar, Iterator, Iterable, NoReturn, overload, Container, - Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic, - Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, - SupportsComplex, IO, BinaryIO, Union, - ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text, + IO, + AbstractSet, + Any, + AnyStr, + BinaryIO, + ByteString, + Callable, + Container, + Dict, + FrozenSet, + Generic, + ItemsView, + Iterable, + Iterator, + KeysView, + List, + Mapping, + MutableMapping, + MutableSequence, + MutableSet, + NoReturn, + Optional, Protocol, + Reversible, + Sequence, + Set, + Sized, + SupportsAbs, + SupportsComplex, + SupportsFloat, + SupportsInt, + Text, + Tuple, + Type, + TypeVar, + Union, + ValuesView, + overload, ) -from abc import abstractmethod, ABCMeta -from ast import mod, AST -from types import TracebackType, CodeType -import sys if sys.version_info >= (3,): from typing import SupportsBytes, SupportsRound diff --git a/stdlib/2/_collections.pyi b/stdlib/2/_collections.pyi index e24d4053b233..c0b7e743e787 100644 --- a/stdlib/2/_collections.pyi +++ b/stdlib/2/_collections.pyi @@ -1,6 +1,6 @@ """Stub file for the '_collections' module.""" -from typing import Any, Generic, Iterator, TypeVar, Optional, Union +from typing import Any, Generic, Iterator, Optional, TypeVar, Union class defaultdict(dict): default_factory: None diff --git a/stdlib/2/_functools.pyi b/stdlib/2/_functools.pyi index 064188505d95..3972b671ddbe 100644 --- a/stdlib/2/_functools.pyi +++ b/stdlib/2/_functools.pyi @@ -1,6 +1,6 @@ """Stub file for the '_functools' module.""" -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Tuple, overload +from typing import Any, Callable, Dict, Iterable, Optional, Tuple, TypeVar, overload _T = TypeVar("_T") _T2 = TypeVar("_T2") diff --git a/stdlib/2/_hotshot.pyi b/stdlib/2/_hotshot.pyi index 8a9c8d72bdfd..6501126a6ba0 100644 --- a/stdlib/2/_hotshot.pyi +++ b/stdlib/2/_hotshot.pyi @@ -3,7 +3,7 @@ # for a more precise manual annotation of this module. # Feel free to edit the source below, but remove this header when you do. -from typing import Any, List, Tuple, Dict, Generic +from typing import Any, Dict, Generic, List, Tuple def coverage(a: str) -> Any: ... diff --git a/stdlib/2/_io.pyi b/stdlib/2/_io.pyi index e4e15cbfd90f..109245dd9d20 100644 --- a/stdlib/2/_io.pyi +++ b/stdlib/2/_io.pyi @@ -1,6 +1,6 @@ -from typing import Any, AnyStr, BinaryIO, IO, Text, TextIO, Iterable, Iterator, List, Optional, Type, Tuple, TypeVar, Union from mmap import mmap from types import TracebackType +from typing import IO, Any, AnyStr, BinaryIO, Iterable, Iterator, List, Optional, Text, TextIO, Tuple, Type, TypeVar, Union _bytearray_like = Union[bytearray, mmap] diff --git a/stdlib/2/_json.pyi b/stdlib/2/_json.pyi index 028b7b229a89..5bdd5c079469 100644 --- a/stdlib/2/_json.pyi +++ b/stdlib/2/_json.pyi @@ -3,7 +3,7 @@ # for a more precise manual annotation of this module. # Feel free to edit the source below, but remove this header when you do. -from typing import Any, List, Tuple, Dict, Generic +from typing import Any, Dict, Generic, List, Tuple def encode_basestring_ascii(*args, **kwargs) -> str: raise TypeError() diff --git a/stdlib/2/_socket.pyi b/stdlib/2/_socket.pyi index 8d02bdee3f16..fc592bacb64c 100644 --- a/stdlib/2/_socket.pyi +++ b/stdlib/2/_socket.pyi @@ -1,4 +1,4 @@ -from typing import Tuple, Union, IO, Any, Optional, overload +from typing import IO, Any, Optional, Tuple, Union, overload AF_APPLETALK: int AF_ASH: int diff --git a/stdlib/2/_sre.pyi b/stdlib/2/_sre.pyi index 0692b4c17085..9af908b75166 100644 --- a/stdlib/2/_sre.pyi +++ b/stdlib/2/_sre.pyi @@ -1,6 +1,6 @@ """Stub file for the '_sre' module.""" -from typing import Any, Union, Iterable, Optional, Mapping, Sequence, Dict, List, Tuple, overload +from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union, overload CODESIZE: int MAGIC: int diff --git a/stdlib/2/_symtable.pyi b/stdlib/2/_symtable.pyi index fbf5424405ca..be332958e556 100644 --- a/stdlib/2/_symtable.pyi +++ b/stdlib/2/_symtable.pyi @@ -1,4 +1,4 @@ -from typing import List, Dict +from typing import Dict, List CELL: int DEF_BOUND: int diff --git a/stdlib/2/abc.pyi b/stdlib/2/abc.pyi index 746f5306fcd6..dfb46fa2c761 100644 --- a/stdlib/2/abc.pyi +++ b/stdlib/2/abc.pyi @@ -1,5 +1,5 @@ -from typing import Any, Dict, Set, Tuple, Type import _weakrefset +from typing import Any, Dict, Set, Tuple, Type # NOTE: mypy has special processing for ABCMeta and abstractmethod. diff --git a/stdlib/2/atexit.pyi b/stdlib/2/atexit.pyi index 13d2602b0dc4..30a777912337 100644 --- a/stdlib/2/atexit.pyi +++ b/stdlib/2/atexit.pyi @@ -1,4 +1,4 @@ -from typing import TypeVar, Any +from typing import Any, TypeVar _FT = TypeVar('_FT') diff --git a/stdlib/2/cPickle.pyi b/stdlib/2/cPickle.pyi index 0421c50efe17..2bb9e83c09df 100644 --- a/stdlib/2/cPickle.pyi +++ b/stdlib/2/cPickle.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO, List +from typing import IO, Any, List HIGHEST_PROTOCOL: int compatible_formats: List[str] diff --git a/stdlib/2/cStringIO.pyi b/stdlib/2/cStringIO.pyi index 380e3a4be269..fbf9d2a55dea 100644 --- a/stdlib/2/cStringIO.pyi +++ b/stdlib/2/cStringIO.pyi @@ -2,8 +2,8 @@ # See https://docs.python.org/2/library/stringio.html from abc import ABCMeta -from typing import overload, IO, List, Iterable, Iterator, Optional, Union from types import TracebackType +from typing import IO, Iterable, Iterator, List, Optional, Union, overload # TODO the typing.IO[] generics should be split into input and output. diff --git a/stdlib/2/collections.pyi b/stdlib/2/collections.pyi index 0daa118e53a7..a85162b4a005 100644 --- a/stdlib/2/collections.pyi +++ b/stdlib/2/collections.pyi @@ -1,25 +1,26 @@ # These are not exported. -from typing import Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible - # These are exported. -from typing import ( - Callable as Callable, - Container as Container, - Hashable as Hashable, - ItemsView as ItemsView, - Iterable as Iterable, - Iterator as Iterator, - KeysView as KeysView, - Mapping as Mapping, - MappingView as MappingView, - MutableMapping as MutableMapping, - MutableSequence as MutableSequence, - MutableSet as MutableSet, - Sequence as Sequence, - AbstractSet as Set, - Sized as Sized, - ValuesView as ValuesView, -) +from typing import AbstractSet as Set +from typing import Callable as Callable +from typing import Container as Container +from typing import Dict, Generic +from typing import Hashable as Hashable +from typing import ItemsView as ItemsView +from typing import Iterable as Iterable +from typing import Iterator as Iterator +from typing import KeysView as KeysView +from typing import List +from typing import Mapping as Mapping +from typing import MappingView as MappingView +from typing import MutableMapping as MutableMapping +from typing import MutableSequence as MutableSequence +from typing import MutableSet as MutableSet +from typing import Optional, Reversible +from typing import Sequence as Sequence +from typing import Sized as Sized +from typing import Tuple, Type, TypeVar, Union +from typing import ValuesView as ValuesView +from typing import overload _S = TypeVar('_S') _T = TypeVar('_T') diff --git a/stdlib/2/commands.pyi b/stdlib/2/commands.pyi index e321f0844349..969bf258aea2 100644 --- a/stdlib/2/commands.pyi +++ b/stdlib/2/commands.pyi @@ -1,4 +1,4 @@ -from typing import overload, AnyStr, Text, Tuple +from typing import AnyStr, Text, Tuple, overload def getstatus(file: Text) -> str: ... def getoutput(cmd: Text) -> str: ... diff --git a/stdlib/2/email/mime/application.pyi b/stdlib/2/email/mime/application.pyi index 99da67287bd5..49d84a52f234 100644 --- a/stdlib/2/email/mime/application.pyi +++ b/stdlib/2/email/mime/application.pyi @@ -1,7 +1,7 @@ # Stubs for email.mime.application -from typing import Callable, Optional, Tuple, Union from email.mime.nonmultipart import MIMENonMultipart +from typing import Callable, Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] diff --git a/stdlib/2/email/mime/audio.pyi b/stdlib/2/email/mime/audio.pyi index 406ade11b362..5f11f8d79008 100644 --- a/stdlib/2/email/mime/audio.pyi +++ b/stdlib/2/email/mime/audio.pyi @@ -1,5 +1,4 @@ from email.mime.nonmultipart import MIMENonMultipart - class MIMEAudio(MIMENonMultipart): def __init__(self, _audiodata, _subtype=..., _encoder=..., **_params) -> None: ... diff --git a/stdlib/2/email/mime/image.pyi b/stdlib/2/email/mime/image.pyi index 2dfb098b8567..3fe8249d6ac8 100644 --- a/stdlib/2/email/mime/image.pyi +++ b/stdlib/2/email/mime/image.pyi @@ -1,5 +1,4 @@ from email.mime.nonmultipart import MIMENonMultipart - class MIMEImage(MIMENonMultipart): def __init__(self, _imagedata, _subtype=..., _encoder=..., **_params) -> None: ... diff --git a/stdlib/2/email/mime/message.pyi b/stdlib/2/email/mime/message.pyi index 33552faf2ca6..9d6fafa2a19b 100644 --- a/stdlib/2/email/mime/message.pyi +++ b/stdlib/2/email/mime/message.pyi @@ -1,5 +1,4 @@ from email.mime.nonmultipart import MIMENonMultipart - class MIMEMessage(MIMENonMultipart): def __init__(self, _msg, _subtype=...) -> None: ... diff --git a/stdlib/2/email/utils.pyi b/stdlib/2/email/utils.pyi index 7b868efce86c..24bc60bda046 100644 --- a/stdlib/2/email/utils.pyi +++ b/stdlib/2/email/utils.pyi @@ -3,7 +3,7 @@ from email._parseaddr import mktime_tz as mktime_tz from email._parseaddr import parsedate as _parsedate from email._parseaddr import parsedate_tz as _parsedate_tz from quopri import decodestring as _qdecode -from typing import Optional, Any +from typing import Any, Optional def formataddr(pair): ... def getaddresses(fieldvalues): ... diff --git a/stdlib/2/encodings/__init__.pyi b/stdlib/2/encodings/__init__.pyi index 2ae6c0a9351d..2c8884112d2f 100644 --- a/stdlib/2/encodings/__init__.pyi +++ b/stdlib/2/encodings/__init__.pyi @@ -1,5 +1,4 @@ import codecs - import typing def search_function(encoding: str) -> codecs.CodecInfo: diff --git a/stdlib/2/exceptions.pyi b/stdlib/2/exceptions.pyi index 6e4bafc9a00f..6642858e8d60 100644 --- a/stdlib/2/exceptions.pyi +++ b/stdlib/2/exceptions.pyi @@ -5,19 +5,19 @@ from __builtin__ import BaseException as BaseException from __builtin__ import BufferError as BufferError from __builtin__ import BytesWarning as BytesWarning from __builtin__ import DeprecationWarning as DeprecationWarning -from __builtin__ import EOFError as EOFError from __builtin__ import EnvironmentError as EnvironmentError +from __builtin__ import EOFError as EOFError from __builtin__ import Exception as Exception from __builtin__ import FloatingPointError as FloatingPointError from __builtin__ import FutureWarning as FutureWarning from __builtin__ import GeneratorExit as GeneratorExit -from __builtin__ import IOError as IOError from __builtin__ import ImportError as ImportError from __builtin__ import ImportWarning as ImportWarning from __builtin__ import IndentationError as IndentationError from __builtin__ import IndexError as IndexError -from __builtin__ import KeyError as KeyError +from __builtin__ import IOError as IOError from __builtin__ import KeyboardInterrupt as KeyboardInterrupt +from __builtin__ import KeyError as KeyError from __builtin__ import LookupError as LookupError from __builtin__ import MemoryError as MemoryError from __builtin__ import NameError as NameError @@ -37,9 +37,9 @@ from __builtin__ import SystemExit as SystemExit from __builtin__ import TabError as TabError from __builtin__ import TypeError as TypeError from __builtin__ import UnboundLocalError as UnboundLocalError -from __builtin__ import UnicodeError as UnicodeError from __builtin__ import UnicodeDecodeError as UnicodeDecodeError from __builtin__ import UnicodeEncodeError as UnicodeEncodeError +from __builtin__ import UnicodeError as UnicodeError from __builtin__ import UnicodeTranslateError as UnicodeTranslateError from __builtin__ import UnicodeWarning as UnicodeWarning from __builtin__ import UserWarning as UserWarning diff --git a/stdlib/2/fcntl.pyi b/stdlib/2/fcntl.pyi index 5ba64ae8c659..97d31fae992e 100644 --- a/stdlib/2/fcntl.pyi +++ b/stdlib/2/fcntl.pyi @@ -1,5 +1,5 @@ -from typing import Any, Union, IO import io +from typing import IO, Any, Union FASYNC: int FD_CLOEXEC: int diff --git a/stdlib/2/functools.pyi b/stdlib/2/functools.pyi index c12af8fe7ed3..ca7dfc712241 100644 --- a/stdlib/2/functools.pyi +++ b/stdlib/2/functools.pyi @@ -3,8 +3,8 @@ # NOTE: These are incomplete! from abc import ABCMeta, abstractmethod -from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, TypeVar, overload from collections import namedtuple +from typing import Any, Callable, Dict, Generic, Iterable, Optional, Sequence, Tuple, TypeVar, overload _AnyCallable = Callable[..., Any] diff --git a/stdlib/2/future_builtins.pyi b/stdlib/2/future_builtins.pyi index a9b25b2fec6e..9a45f9273223 100644 --- a/stdlib/2/future_builtins.pyi +++ b/stdlib/2/future_builtins.pyi @@ -1,9 +1,7 @@ -from typing import Any - from itertools import ifilter as filter from itertools import imap as map from itertools import izip as zip - +from typing import Any def ascii(obj: Any) -> str: ... diff --git a/stdlib/2/gc.pyi b/stdlib/2/gc.pyi index cdfae7491dfb..5f552075baba 100644 --- a/stdlib/2/gc.pyi +++ b/stdlib/2/gc.pyi @@ -2,7 +2,6 @@ from typing import Any, List, Tuple - def enable() -> None: ... def disable() -> None: ... def isenabled() -> bool: ... diff --git a/stdlib/2/getpass.pyi b/stdlib/2/getpass.pyi index 011fc8e7924c..782fa42bf49a 100644 --- a/stdlib/2/getpass.pyi +++ b/stdlib/2/getpass.pyi @@ -1,6 +1,6 @@ # Stubs for getpass (Python 2) -from typing import Any, IO +from typing import IO, Any class GetPassWarning(UserWarning): ... diff --git a/stdlib/2/gettext.pyi b/stdlib/2/gettext.pyi index c7bfceb7b82c..59e16ac4f635 100644 --- a/stdlib/2/gettext.pyi +++ b/stdlib/2/gettext.pyi @@ -1,4 +1,4 @@ -from typing import Any, Container, Dict, IO, List, Optional, Sequence, Type, Union +from typing import IO, Any, Container, Dict, List, Optional, Sequence, Type, Union def bindtextdomain(domain: str, localedir: str = ...) -> str: ... def bind_textdomain_codeset(domain: str, codeset: str = ...) -> str: ... diff --git a/stdlib/2/glob.pyi b/stdlib/2/glob.pyi index 5caa166f8e26..2804d74a6a3f 100644 --- a/stdlib/2/glob.pyi +++ b/stdlib/2/glob.pyi @@ -1,4 +1,4 @@ -from typing import List, Iterator, Union, AnyStr +from typing import AnyStr, Iterator, List, Union def glob(pathname: AnyStr) -> List[AnyStr]: ... def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ... diff --git a/stdlib/2/gzip.pyi b/stdlib/2/gzip.pyi index 50c38e426208..6817daf7df04 100644 --- a/stdlib/2/gzip.pyi +++ b/stdlib/2/gzip.pyi @@ -1,5 +1,5 @@ -from typing import Any, IO, Text import io +from typing import IO, Any, Text class GzipFile(io.BufferedIOBase): myfileobj: Any diff --git a/stdlib/2/heapq.pyi b/stdlib/2/heapq.pyi index 00abb31a6c59..cdd6f63e72df 100644 --- a/stdlib/2/heapq.pyi +++ b/stdlib/2/heapq.pyi @@ -1,4 +1,4 @@ -from typing import TypeVar, List, Iterable, Any, Callable, Optional +from typing import Any, Callable, Iterable, List, Optional, TypeVar _T = TypeVar('_T') diff --git a/stdlib/2/httplib.pyi b/stdlib/2/httplib.pyi index 4e3843c1414d..0cb837d9a030 100644 --- a/stdlib/2/httplib.pyi +++ b/stdlib/2/httplib.pyi @@ -3,9 +3,9 @@ # Generated by stubgen and manually massaged a bit. # Needs lots more work! -from typing import Any, Dict, Optional, Protocol import mimetools import ssl +from typing import Any, Dict, Optional, Protocol class HTTPMessage(mimetools.Message): def addcontinue(self, key: str, more: str) -> None: ... diff --git a/stdlib/2/imp.pyi b/stdlib/2/imp.pyi index 409fecb5bd93..d96c5e21ba82 100644 --- a/stdlib/2/imp.pyi +++ b/stdlib/2/imp.pyi @@ -1,7 +1,7 @@ """Stubs for the 'imp' module.""" -from typing import List, Optional, Tuple, Iterable, IO, Any import types +from typing import IO, Any, Iterable, List, Optional, Tuple C_BUILTIN: int C_EXTENSION: int diff --git a/stdlib/2/inspect.pyi b/stdlib/2/inspect.pyi index 8bc2eacb114f..e4c11fe52b07 100644 --- a/stdlib/2/inspect.pyi +++ b/stdlib/2/inspect.pyi @@ -1,5 +1,5 @@ -from types import CodeType, TracebackType, FrameType, ModuleType -from typing import Any, Dict, Callable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union +from types import CodeType, FrameType, ModuleType, TracebackType +from typing import Any, Callable, Dict, List, NamedTuple, Optional, Sequence, Tuple, Type, Union # Types and members class EndOfBlock(Exception): ... diff --git a/stdlib/2/io.pyi b/stdlib/2/io.pyi index 1ab6b9069505..16afa1b804ae 100644 --- a/stdlib/2/io.pyi +++ b/stdlib/2/io.pyi @@ -4,16 +4,16 @@ # Only a subset of functionality is included. -from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union, Optional -import _io +from typing import IO, Any, BinaryIO, Iterable, Iterator, List, Optional, TextIO, Union, overload +import _io +from _io import DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE from _io import BlockingIOError as BlockingIOError -from _io import BufferedRWPair as BufferedRWPair from _io import BufferedRandom as BufferedRandom from _io import BufferedReader as BufferedReader +from _io import BufferedRWPair as BufferedRWPair from _io import BufferedWriter as BufferedWriter from _io import BytesIO as BytesIO -from _io import DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE from _io import FileIO as FileIO from _io import IncrementalNewlineDecoder as IncrementalNewlineDecoder from _io import StringIO as StringIO diff --git a/stdlib/2/itertools.pyi b/stdlib/2/itertools.pyi index 1c8522c87663..8272d95c416b 100644 --- a/stdlib/2/itertools.pyi +++ b/stdlib/2/itertools.pyi @@ -2,8 +2,7 @@ # Based on https://docs.python.org/2/library/itertools.html -from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple, - Union, Sequence, Generic, Optional) +from typing import Any, Callable, Generic, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload _T = TypeVar('_T') _S = TypeVar('_S') diff --git a/stdlib/2/json.pyi b/stdlib/2/json.pyi index 9cc151b27f34..ce080bf66e38 100644 --- a/stdlib/2/json.pyi +++ b/stdlib/2/json.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol +from typing import IO, Any, Callable, Dict, List, Optional, Protocol, Text, Tuple, Union class JSONDecodeError(ValueError): def dumps(self, obj: Any) -> str: ... diff --git a/stdlib/2/md5.pyi b/stdlib/2/md5.pyi index fe6ad719d110..bfaa37bbf263 100644 --- a/stdlib/2/md5.pyi +++ b/stdlib/2/md5.pyi @@ -1,6 +1,6 @@ # Stubs for Python 2.7 md5 stdlib module -from hashlib import md5 as md5, md5 as new +from hashlib import md5 as new blocksize = 0 digest_size = 0 diff --git a/stdlib/2/mimetools.pyi b/stdlib/2/mimetools.pyi index f565202f4f80..3c6cbfcbacae 100644 --- a/stdlib/2/mimetools.pyi +++ b/stdlib/2/mimetools.pyi @@ -1,5 +1,5 @@ -from typing import Any import rfc822 +from typing import Any class Message(rfc822.Message): encodingheader: Any diff --git a/stdlib/2/multiprocessing/__init__.pyi b/stdlib/2/multiprocessing/__init__.pyi index fb00b245c2e5..9cdcdcc21897 100644 --- a/stdlib/2/multiprocessing/__init__.pyi +++ b/stdlib/2/multiprocessing/__init__.pyi @@ -1,9 +1,11 @@ -from typing import Any, Callable, Optional, TypeVar, Iterable - from multiprocessing import pool -from multiprocessing.process import Process as Process, current_process as current_process, active_children as active_children -from multiprocessing.util import SUBDEBUG as SUBDEBUG, SUBWARNING as SUBWARNING +from multiprocessing.process import Process as Process +from multiprocessing.process import active_children as active_children +from multiprocessing.process import current_process as current_process +from multiprocessing.util import SUBDEBUG as SUBDEBUG +from multiprocessing.util import SUBWARNING as SUBWARNING from Queue import Queue as _BaseQueue +from typing import Any, Callable, Iterable, Optional, TypeVar class ProcessError(Exception): ... class BufferTooShort(ProcessError): ... diff --git a/stdlib/2/multiprocessing/dummy/__init__.pyi b/stdlib/2/multiprocessing/dummy/__init__.pyi index e8e02eb16eee..7132f69b081b 100644 --- a/stdlib/2/multiprocessing/dummy/__init__.pyi +++ b/stdlib/2/multiprocessing/dummy/__init__.pyi @@ -1,17 +1,13 @@ -from typing import Any, Optional, List, Type - -import threading -import sys -import weakref import array import itertools - +import sys +import threading +import weakref from multiprocessing import TimeoutError, cpu_count from multiprocessing.dummy.connection import Pipe -from threading import Lock, RLock, Semaphore, BoundedSemaphore -from threading import Event from Queue import Queue - +from threading import BoundedSemaphore, Event, Lock, RLock, Semaphore +from typing import Any, List, Optional, Type class DummyProcess(threading.Thread): _children: weakref.WeakKeyDictionary diff --git a/stdlib/2/multiprocessing/pool.pyi b/stdlib/2/multiprocessing/pool.pyi index 4001a5a2be77..546480fce480 100644 --- a/stdlib/2/multiprocessing/pool.pyi +++ b/stdlib/2/multiprocessing/pool.pyi @@ -1,7 +1,4 @@ -from typing import ( - Any, Callable, ContextManager, Iterable, Optional, Dict, List, - TypeVar, Iterator, -) +from typing import Any, Callable, ContextManager, Dict, Iterable, Iterator, List, Optional, TypeVar _T = TypeVar('_T', bound=Pool) diff --git a/stdlib/2/multiprocessing/util.pyi b/stdlib/2/multiprocessing/util.pyi index 14d44f6e3929..9520022e2962 100644 --- a/stdlib/2/multiprocessing/util.pyi +++ b/stdlib/2/multiprocessing/util.pyi @@ -1,5 +1,5 @@ -from typing import Any, Optional import threading +from typing import Any, Optional SUBDEBUG: Any SUBWARNING: Any diff --git a/stdlib/2/os/__init__.pyi b/stdlib/2/os/__init__.pyi index 2c66dc79d471..867e19b5ea40 100644 --- a/stdlib/2/os/__init__.pyi +++ b/stdlib/2/os/__init__.pyi @@ -1,14 +1,33 @@ # Stubs for os # Ron Murawski +import sys from builtins import OSError as error from io import TextIOWrapper as _TextIOWrapper from posix import stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078 -import sys from typing import ( - Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr, - Optional, Generic, Set, Callable, Text, Sequence, IO, NamedTuple, NoReturn, TypeVar + IO, + Any, + AnyStr, + Callable, + Dict, + Generic, + Iterator, + List, + Mapping, + MutableMapping, + NamedTuple, + NoReturn, + Optional, + Sequence, + Set, + Text, + Tuple, + TypeVar, + Union, + overload, ) + from . import path as path _T = TypeVar('_T') diff --git a/stdlib/2/os/path.pyi b/stdlib/2/os/path.pyi index c0bf57658ed7..dfd074fe7c7c 100644 --- a/stdlib/2/os/path.pyi +++ b/stdlib/2/os/path.pyi @@ -4,10 +4,7 @@ import os import sys -from typing import ( - overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO, - TypeVar, Union, Text, Callable, Optional -) +from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/2/os2emxpath.pyi b/stdlib/2/os2emxpath.pyi index c0bf57658ed7..dfd074fe7c7c 100644 --- a/stdlib/2/os2emxpath.pyi +++ b/stdlib/2/os2emxpath.pyi @@ -4,10 +4,7 @@ import os import sys -from typing import ( - overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO, - TypeVar, Union, Text, Callable, Optional -) +from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/2/pipes.pyi b/stdlib/2/pipes.pyi index d5f5291e3442..fd7208fb5476 100644 --- a/stdlib/2/pipes.pyi +++ b/stdlib/2/pipes.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO +from typing import IO, Any class Template: def __init__(self) -> None: ... diff --git a/stdlib/2/popen2.pyi b/stdlib/2/popen2.pyi index 23435b3a2a9f..113cbbc5bd14 100644 --- a/stdlib/2/popen2.pyi +++ b/stdlib/2/popen2.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterable, List, Optional, Union, TextIO, Tuple, TypeVar +from typing import Any, Iterable, List, Optional, TextIO, Tuple, TypeVar, Union _T = TypeVar('_T') diff --git a/stdlib/2/posix.pyi b/stdlib/2/posix.pyi index fcd4a66f9d2b..dce87df67e22 100644 --- a/stdlib/2/posix.pyi +++ b/stdlib/2/posix.pyi @@ -1,4 +1,4 @@ -from typing import Dict, List, Mapping, Tuple, Union, Sequence, IO, Optional, TypeVar +from typing import IO, Dict, List, Mapping, Optional, Sequence, Tuple, TypeVar, Union error = OSError diff --git a/stdlib/2/random.pyi b/stdlib/2/random.pyi index 3292db864cb5..4bdcc51e2124 100644 --- a/stdlib/2/random.pyi +++ b/stdlib/2/random.pyi @@ -7,10 +7,7 @@ # ----- random classes ----- import _random -from typing import ( - Any, TypeVar, Sequence, List, Callable, AbstractSet, Union, - overload -) +from typing import AbstractSet, Any, Callable, List, Sequence, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/2/re.pyi b/stdlib/2/re.pyi index 2a2c2cb03e07..db265399e474 100644 --- a/stdlib/2/re.pyi +++ b/stdlib/2/re.pyi @@ -5,8 +5,20 @@ # based on: http: //docs.python.org/2.7/library/re.html from typing import ( - List, Iterator, overload, Callable, Tuple, Sequence, Dict, - Generic, AnyStr, Match, Pattern, Any, Optional, Union + Any, + AnyStr, + Callable, + Dict, + Generic, + Iterator, + List, + Match, + Optional, + Pattern, + Sequence, + Tuple, + Union, + overload, ) # ----- re variables and constants ----- diff --git a/stdlib/2/resource.pyi b/stdlib/2/resource.pyi index 2a6c6947a81b..df51f8f88f25 100644 --- a/stdlib/2/resource.pyi +++ b/stdlib/2/resource.pyi @@ -1,4 +1,4 @@ -from typing import Tuple, NamedTuple +from typing import NamedTuple, Tuple class error(Exception): ... diff --git a/stdlib/2/shelve.pyi b/stdlib/2/shelve.pyi index d7d9b8c60188..61271b363431 100644 --- a/stdlib/2/shelve.pyi +++ b/stdlib/2/shelve.pyi @@ -1,6 +1,5 @@ -from typing import Any, Dict, Iterator, List, Optional, Tuple import collections - +from typing import Any, Dict, Iterator, List, Optional, Tuple class Shelf(collections.MutableMapping): def __init__(self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ... diff --git a/stdlib/2/shlex.pyi b/stdlib/2/shlex.pyi index 5bf6fccdba11..b78994da3cb1 100644 --- a/stdlib/2/shlex.pyi +++ b/stdlib/2/shlex.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO, List, Optional, TypeVar +from typing import IO, Any, List, Optional, TypeVar def split(s: Optional[str], comments: bool = ..., posix: bool = ...) -> List[str]: ... diff --git a/stdlib/2/signal.pyi b/stdlib/2/signal.pyi index cda4c65ecc8e..387c9237b4b5 100644 --- a/stdlib/2/signal.pyi +++ b/stdlib/2/signal.pyi @@ -1,5 +1,5 @@ -from typing import Callable, Any, Tuple, Union from types import FrameType +from typing import Any, Callable, Tuple, Union SIG_DFL: int = ... SIG_IGN: int = ... diff --git a/stdlib/2/sre_parse.pyi b/stdlib/2/sre_parse.pyi index beabb40946b6..baebf65f709e 100644 --- a/stdlib/2/sre_parse.pyi +++ b/stdlib/2/sre_parse.pyi @@ -1,6 +1,8 @@ # Source: https://hg.python.org/cpython/file/2.7/Lib/sre_parse.py -from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Pattern, Set, Tuple, Union +from typing import Any, Dict, Iterable, List, Match, Optional +from typing import Pattern as _Pattern +from typing import Set, Tuple, Union SPECIAL_CHARS: str REPEAT_CHARS: str diff --git a/stdlib/2/string.pyi b/stdlib/2/string.pyi index 624f092b3365..9a68445c14ad 100644 --- a/stdlib/2/string.pyi +++ b/stdlib/2/string.pyi @@ -2,7 +2,7 @@ # Based on http://docs.python.org/3.2/library/string.html -from typing import Any, AnyStr, Iterable, List, Mapping, Optional, overload, Sequence, Text, Tuple, Union +from typing import Any, AnyStr, Iterable, List, Mapping, Optional, Sequence, Text, Tuple, Union, overload ascii_letters: str ascii_lowercase: str diff --git a/stdlib/2/subprocess.pyi b/stdlib/2/subprocess.pyi index b60e89e677ac..39e86b13cda9 100644 --- a/stdlib/2/subprocess.pyi +++ b/stdlib/2/subprocess.pyi @@ -2,7 +2,7 @@ # Based on http://docs.python.org/2/library/subprocess.html and Python 3 stub -from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional, List, Text +from typing import IO, Any, Callable, List, Mapping, Optional, Sequence, Text, Tuple, Union _FILE = Union[None, int, IO[Any]] _TXT = Union[bytes, Text] diff --git a/stdlib/2/sys.pyi b/stdlib/2/sys.pyi index e67b26325af1..f9dfea6a3be7 100644 --- a/stdlib/2/sys.pyi +++ b/stdlib/2/sys.pyi @@ -1,10 +1,7 @@ """Stubs for the 'sys' module.""" -from typing import ( - IO, NoReturn, Union, List, Sequence, Any, Dict, Tuple, BinaryIO, Optional, - Callable, overload, Text, Type, -) -from types import FrameType, ModuleType, TracebackType, ClassType +from types import ClassType, FrameType, ModuleType, TracebackType +from typing import IO, Any, BinaryIO, Callable, Dict, List, NoReturn, Optional, Sequence, Text, Tuple, Type, Union, overload # The following type alias are stub-only and do not exist during runtime _ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] diff --git a/stdlib/2/tempfile.pyi b/stdlib/2/tempfile.pyi index 2dcc1a924beb..a92c0717c507 100644 --- a/stdlib/2/tempfile.pyi +++ b/stdlib/2/tempfile.pyi @@ -1,6 +1,6 @@ -from typing import Any, AnyStr, IO, Iterable, Iterator, List, Optional, overload, Text, Tuple, Union -from thread import LockType from random import Random +from thread import LockType +from typing import IO, Any, AnyStr, Iterable, Iterator, List, Optional, Text, Tuple, Union, overload TMP_MAX: int tempdir: str diff --git a/stdlib/2/textwrap.pyi b/stdlib/2/textwrap.pyi index 60498a65acd0..83c36aa88510 100644 --- a/stdlib/2/textwrap.pyi +++ b/stdlib/2/textwrap.pyi @@ -1,4 +1,4 @@ -from typing import AnyStr, List, Dict, Pattern +from typing import AnyStr, Dict, List, Pattern class TextWrapper(object): width: int = ... diff --git a/stdlib/2/thread.pyi b/stdlib/2/thread.pyi index eb4e6d6d3e9e..d36635286290 100644 --- a/stdlib/2/thread.pyi +++ b/stdlib/2/thread.pyi @@ -1,5 +1,5 @@ """Stubs for the "thread" module.""" -from typing import Callable, Any +from typing import Any, Callable def _count() -> int: ... diff --git a/stdlib/2/toaiff.pyi b/stdlib/2/toaiff.pyi index 77334c7f525e..715bd14706f1 100644 --- a/stdlib/2/toaiff.pyi +++ b/stdlib/2/toaiff.pyi @@ -4,7 +4,6 @@ from pipes import Template from typing import Dict, List - __all__: List[str] table: Dict[str, Template] t: Template diff --git a/stdlib/2/tokenize.pyi b/stdlib/2/tokenize.pyi index 43457b6a95de..21570647760f 100644 --- a/stdlib/2/tokenize.pyi +++ b/stdlib/2/tokenize.pyi @@ -1,6 +1,6 @@ # Automatically generated by pytype, manually fixed up. May still contain errors. -from typing import Any, Callable, Dict, Generator, Iterator, List, Tuple, Union, Iterable +from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Tuple, Union __author__: str __credits__: str diff --git a/stdlib/2/types.pyi b/stdlib/2/types.pyi index 93360e7dec35..0843e4abbc24 100644 --- a/stdlib/2/types.pyi +++ b/stdlib/2/types.pyi @@ -1,10 +1,7 @@ # Stubs for types # Note, all classes "defined" here require special handling. -from typing import ( - Any, Callable, Dict, Iterable, Iterator, List, Optional, - Tuple, Type, TypeVar, Union, overload, -) +from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Type, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/2/typing.pyi b/stdlib/2/typing.pyi index 6c159b963207..c87ea030c207 100644 --- a/stdlib/2/typing.pyi +++ b/stdlib/2/typing.pyi @@ -1,8 +1,8 @@ # Stubs for typing (Python 2.7) -from abc import abstractmethod, ABCMeta -from types import CodeType, FrameType, TracebackType import collections # Needed by aliases like DefaultDict, see mypy issue 2986 +from abc import ABCMeta, abstractmethod +from types import CodeType, FrameType, TracebackType # Definitions of special type checking related constructs. Their definitions # are not used, so their value does not matter. diff --git a/stdlib/2/unittest.pyi b/stdlib/2/unittest.pyi index d8d499af9565..51515aa23117 100644 --- a/stdlib/2/unittest.pyi +++ b/stdlib/2/unittest.pyi @@ -2,11 +2,29 @@ # Based on http://docs.python.org/2.7/library/unittest.html -from typing import (Any, Callable, Dict, FrozenSet, Iterable, Iterator, - List, NoReturn, Optional, overload, Pattern, Sequence, Set, - Text, TextIO, Tuple, Type, TypeVar, Union) -from abc import abstractmethod, ABCMeta import types +from abc import ABCMeta, abstractmethod +from typing import ( + Any, + Callable, + Dict, + FrozenSet, + Iterable, + Iterator, + List, + NoReturn, + Optional, + Pattern, + Sequence, + Set, + Text, + TextIO, + Tuple, + Type, + TypeVar, + Union, + overload, +) _T = TypeVar('_T') _FT = TypeVar('_FT') diff --git a/stdlib/2/urllib.pyi b/stdlib/2/urllib.pyi index 8b44a066ec7b..6f2bc29842da 100644 --- a/stdlib/2/urllib.pyi +++ b/stdlib/2/urllib.pyi @@ -1,4 +1,4 @@ -from typing import Any, AnyStr, IO, List, Mapping, Sequence, Text, Tuple, TypeVar, Union +from typing import IO, Any, AnyStr, List, Mapping, Sequence, Text, Tuple, TypeVar, Union def url2pathname(pathname: AnyStr) -> AnyStr: ... def pathname2url(pathname: AnyStr) -> AnyStr: ... diff --git a/stdlib/2/urllib2.pyi b/stdlib/2/urllib2.pyi index 6611ad240a96..23ebc0c34722 100644 --- a/stdlib/2/urllib2.pyi +++ b/stdlib/2/urllib2.pyi @@ -1,8 +1,8 @@ import ssl -from typing import Any, AnyStr, Dict, List, Union, Optional, Mapping, Callable, Sequence, Text, Tuple, Type -from urllib import addinfourl from httplib import HTTPConnectionProtocol, HTTPResponse +from typing import Any, AnyStr, Callable, Dict, List, Mapping, Optional, Sequence, Text, Tuple, Type, Union +from urllib import addinfourl _string = Union[str, unicode] diff --git a/stdlib/2/urlparse.pyi b/stdlib/2/urlparse.pyi index fb5909503290..368e7664417f 100644 --- a/stdlib/2/urlparse.pyi +++ b/stdlib/2/urlparse.pyi @@ -1,6 +1,6 @@ # Stubs for urlparse (Python 2) -from typing import AnyStr, Dict, List, NamedTuple, Tuple, Sequence, Union, overload +from typing import AnyStr, Dict, List, NamedTuple, Sequence, Tuple, Union, overload _String = Union[str, unicode] diff --git a/stdlib/2/xmlrpclib.pyi b/stdlib/2/xmlrpclib.pyi index abf40987e61d..3ab276ed467c 100644 --- a/stdlib/2/xmlrpclib.pyi +++ b/stdlib/2/xmlrpclib.pyi @@ -1,13 +1,13 @@ # Stubs for xmlrpclib (Python 2) -from typing import Any, AnyStr, Callable, IO, Iterable, List, Mapping, MutableMapping, Optional, Tuple, Type, TypeVar, Union -from types import InstanceType from datetime import datetime -from time import struct_time +from gzip import GzipFile from httplib import HTTPConnection, HTTPResponse, HTTPSConnection from ssl import SSLContext from StringIO import StringIO -from gzip import GzipFile +from time import struct_time +from types import InstanceType +from typing import IO, Any, AnyStr, Callable, Iterable, List, Mapping, MutableMapping, Optional, Tuple, Type, TypeVar, Union _Unmarshaller = Any _timeTuple = Tuple[int, int, int, int, int, int, int, int, int] diff --git a/stdlib/2and3/_codecs.pyi b/stdlib/2and3/_codecs.pyi index 32163eb913d0..31bd06e91526 100644 --- a/stdlib/2and3/_codecs.pyi +++ b/stdlib/2and3/_codecs.pyi @@ -1,9 +1,8 @@ """Stub file for the '_codecs' module.""" -import sys -from typing import Any, Callable, Tuple, Optional, Dict, Text, Union - import codecs +import sys +from typing import Any, Callable, Dict, Optional, Text, Tuple, Union # For convenience: _Handler = Callable[[Exception], Tuple[Text, int]] diff --git a/stdlib/2and3/_csv.pyi b/stdlib/2and3/_csv.pyi index 1c4c26ef2073..66be513c8482 100644 --- a/stdlib/2and3/_csv.pyi +++ b/stdlib/2and3/_csv.pyi @@ -1,5 +1,4 @@ import sys - from typing import Any, Iterable, Iterator, List, Optional, Sequence, Text QUOTE_ALL: int diff --git a/stdlib/2and3/_curses.pyi b/stdlib/2and3/_curses.pyi index 836089f5b32d..3ab9fac1b867 100644 --- a/stdlib/2and3/_curses.pyi +++ b/stdlib/2and3/_curses.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, BinaryIO, IO, Optional, Tuple, Union, overload +from typing import IO, Any, BinaryIO, Optional, Tuple, Union, overload _chtype = Union[str, bytes, int] diff --git a/stdlib/2and3/_heapq.pyi b/stdlib/2and3/_heapq.pyi index 8b7f6eac0d30..493566ac92f8 100644 --- a/stdlib/2and3/_heapq.pyi +++ b/stdlib/2and3/_heapq.pyi @@ -1,6 +1,6 @@ """Stub file for the '_heapq' module.""" -from typing import TypeVar, List +from typing import List, TypeVar _T = TypeVar("_T") diff --git a/stdlib/2and3/_weakrefset.pyi b/stdlib/2and3/_weakrefset.pyi index 950d3fe64265..1263f9070564 100644 --- a/stdlib/2and3/_weakrefset.pyi +++ b/stdlib/2and3/_weakrefset.pyi @@ -1,4 +1,4 @@ -from typing import Iterator, Any, Iterable, MutableSet, Optional, TypeVar, Generic, Union +from typing import Any, Generic, Iterable, Iterator, MutableSet, Optional, TypeVar, Union _S = TypeVar('_S') _T = TypeVar('_T') diff --git a/stdlib/2and3/argparse.pyi b/stdlib/2and3/argparse.pyi index 03b9620d3225..fc60e0bc48bf 100644 --- a/stdlib/2and3/argparse.pyi +++ b/stdlib/2and3/argparse.pyi @@ -1,8 +1,23 @@ +import sys from typing import ( - Any, Callable, Dict, Generator, Iterable, List, IO, NoReturn, Optional, - Pattern, Sequence, Text, Tuple, Type, Union, TypeVar, overload + IO, + Any, + Callable, + Dict, + Generator, + Iterable, + List, + NoReturn, + Optional, + Pattern, + Sequence, + Text, + Tuple, + Type, + TypeVar, + Union, + overload, ) -import sys _T = TypeVar('_T') _ActionT = TypeVar('_ActionT', bound='Action') diff --git a/stdlib/2and3/array.pyi b/stdlib/2and3/array.pyi index 01c6f9943713..c7eb6e4ac673 100644 --- a/stdlib/2and3/array.pyi +++ b/stdlib/2and3/array.pyi @@ -3,8 +3,7 @@ # Based on http://docs.python.org/3.6/library/array.html import sys -from typing import (Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence, - overload, Text, Tuple, TypeVar, Union) +from typing import Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence, Text, Tuple, TypeVar, Union, overload _T = TypeVar('_T', int, float, Text) diff --git a/stdlib/2and3/asynchat.pyi b/stdlib/2and3/asynchat.pyi index a359ae7de147..601a6ae15458 100644 --- a/stdlib/2and3/asynchat.pyi +++ b/stdlib/2and3/asynchat.pyi @@ -1,10 +1,9 @@ -from abc import abstractmethod import asyncore import socket import sys +from abc import abstractmethod from typing import Optional, Sequence, Tuple, Union - class simple_producer: def __init__(self, data: bytes, buffer_size: int = ...) -> None: ... def more(self) -> bytes: ... diff --git a/stdlib/2and3/asyncore.pyi b/stdlib/2and3/asyncore.pyi index 8dc8f477543f..93cbd0b91c0d 100644 --- a/stdlib/2and3/asyncore.pyi +++ b/stdlib/2and3/asyncore.pyi @@ -1,16 +1,26 @@ -from typing import Tuple, Union, Optional, Any, Dict, overload - import os import select import sys import time import warnings +from errno import ( + EAGAIN, + EALREADY, + EBADF, + ECONNABORTED, + ECONNRESET, + EINPROGRESS, + EINTR, + EINVAL, + EISCONN, + ENOTCONN, + EPIPE, + ESHUTDOWN, + EWOULDBLOCK, + errorcode, +) from socket import SocketType -from typing import Optional - -from errno import (EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, - ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, - EPIPE, EAGAIN, errorcode) +from typing import Any, Dict, Optional, Tuple, Union, overload # cyclic dependence with asynchat _maptype = Dict[str, Any] diff --git a/stdlib/2and3/base64.pyi b/stdlib/2and3/base64.pyi index 7c648c8b5e30..635301013caa 100644 --- a/stdlib/2and3/base64.pyi +++ b/stdlib/2and3/base64.pyi @@ -1,7 +1,7 @@ # Stubs for base64 -from typing import IO, Union, Text import sys +from typing import IO, Text, Union if sys.version_info < (3,): _encodable = Union[bytes, unicode] diff --git a/stdlib/2and3/binascii.pyi b/stdlib/2and3/binascii.pyi index 9689b712b919..d3c07507cb7d 100644 --- a/stdlib/2and3/binascii.pyi +++ b/stdlib/2and3/binascii.pyi @@ -3,8 +3,7 @@ # Based on http://docs.python.org/3.2/library/binascii.html import sys -from typing import Union, Text - +from typing import Text, Union if sys.version_info < (3,): # Python 2 accepts unicode ascii pretty much everywhere. diff --git a/stdlib/2and3/binhex.pyi b/stdlib/2and3/binhex.pyi index c759ba0b6f19..02d094faf923 100644 --- a/stdlib/2and3/binhex.pyi +++ b/stdlib/2and3/binhex.pyi @@ -1,10 +1,4 @@ -from typing import ( - Any, - IO, - Tuple, - Union, -) - +from typing import IO, Any, Tuple, Union class Error(Exception): ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 13a6ef968ecc..5d47593011b5 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -1,18 +1,50 @@ # True and False are deliberately omitted because they are keywords in # Python 3, and stub files conform to Python 3 syntax. +import sys +from abc import ABCMeta, abstractmethod +from ast import AST, mod +from types import CodeType, TracebackType from typing import ( - TypeVar, Iterator, Iterable, NoReturn, overload, Container, - Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic, - Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, - SupportsComplex, IO, BinaryIO, Union, - ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text, + IO, + AbstractSet, + Any, + AnyStr, + BinaryIO, + ByteString, + Callable, + Container, + Dict, + FrozenSet, + Generic, + ItemsView, + Iterable, + Iterator, + KeysView, + List, + Mapping, + MutableMapping, + MutableSequence, + MutableSet, + NoReturn, + Optional, Protocol, + Reversible, + Sequence, + Set, + Sized, + SupportsAbs, + SupportsComplex, + SupportsFloat, + SupportsInt, + Text, + Tuple, + Type, + TypeVar, + Union, + ValuesView, + overload, ) -from abc import abstractmethod, ABCMeta -from ast import mod, AST -from types import TracebackType, CodeType -import sys if sys.version_info >= (3,): from typing import SupportsBytes, SupportsRound diff --git a/stdlib/2and3/bz2.pyi b/stdlib/2and3/bz2.pyi index 2cb329ce93c8..2a1082e3b243 100644 --- a/stdlib/2and3/bz2.pyi +++ b/stdlib/2and3/bz2.pyi @@ -1,6 +1,6 @@ import io import sys -from typing import Any, IO, Optional, Union +from typing import IO, Any, Optional, Union if sys.version_info >= (3, 6): from os import PathLike diff --git a/stdlib/2and3/calendar.pyi b/stdlib/2and3/calendar.pyi index 4b452cc334b9..2472908d1646 100644 --- a/stdlib/2and3/calendar.pyi +++ b/stdlib/2and3/calendar.pyi @@ -3,7 +3,6 @@ import sys from time import struct_time from typing import Any, Iterable, List, Optional, Sequence, Tuple, Union - _LocaleType = Tuple[Optional[str], Optional[str]] class IllegalMonthError(ValueError): diff --git a/stdlib/2and3/cgi.pyi b/stdlib/2and3/cgi.pyi index 02979c090f20..b4272c3298db 100644 --- a/stdlib/2and3/cgi.pyi +++ b/stdlib/2and3/cgi.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, AnyStr, Dict, IO, Iterable, List, Mapping, Optional, Tuple, TypeVar, Union +from typing import IO, Any, AnyStr, Dict, Iterable, List, Mapping, Optional, Tuple, TypeVar, Union _T = TypeVar('_T', bound=FieldStorage) diff --git a/stdlib/2and3/cmd.pyi b/stdlib/2and3/cmd.pyi index c2aeb75b5ad3..80b41effa381 100644 --- a/stdlib/2and3/cmd.pyi +++ b/stdlib/2and3/cmd.pyi @@ -1,6 +1,6 @@ # Stubs for cmd (Python 2/3) -from typing import Any, Optional, Text, IO, List, Callable, Tuple +from typing import IO, Any, Callable, List, Optional, Text, Tuple class Cmd: prompt: str diff --git a/stdlib/2and3/code.pyi b/stdlib/2and3/code.pyi index 293ab9b98b61..81b3e47ccfaa 100644 --- a/stdlib/2and3/code.pyi +++ b/stdlib/2and3/code.pyi @@ -1,8 +1,8 @@ # Stubs for code import sys -from typing import Any, Callable, Mapping, Optional from types import CodeType +from typing import Any, Callable, Mapping, Optional class InteractiveInterpreter: def __init__(self, locals: Optional[Mapping[str, Any]] = ...) -> None: ... diff --git a/stdlib/2and3/codecs.pyi b/stdlib/2and3/codecs.pyi index b99ce9134a6f..2e12261a364a 100644 --- a/stdlib/2and3/codecs.pyi +++ b/stdlib/2and3/codecs.pyi @@ -1,8 +1,24 @@ import sys -from typing import Any, BinaryIO, Callable, Generator, IO, Iterable, Iterator, List, Optional, Protocol, Text, TextIO, Tuple, Type, TypeVar, Union - -from abc import abstractmethod import types +from abc import abstractmethod +from typing import ( + IO, + Any, + BinaryIO, + Callable, + Generator, + Iterable, + Iterator, + List, + Optional, + Protocol, + Text, + TextIO, + Tuple, + Type, + TypeVar, + Union, +) # TODO: this only satisfies the most common interface, where # bytes (py2 str) is the raw form and str (py2 unicode) is the cooked form. diff --git a/stdlib/2and3/contextlib.pyi b/stdlib/2and3/contextlib.pyi index dec1b411d515..1d994a81cdf1 100644 --- a/stdlib/2and3/contextlib.pyi +++ b/stdlib/2and3/contextlib.pyi @@ -1,13 +1,11 @@ # Stubs for contextlib -from typing import ( - Any, Callable, Generator, IO, Iterable, Iterator, Optional, Type, - Generic, TypeVar, overload -) -from types import TracebackType import sys +from types import TracebackType # Aliased here for backwards compatibility; TODO eventually remove this +from typing import IO, Any, Callable from typing import ContextManager as ContextManager +from typing import Generator, Generic, Iterable, Iterator, Optional, Type, TypeVar, overload if sys.version_info >= (3, 5): from typing import AsyncContextManager, AsyncIterator diff --git a/stdlib/2and3/copy.pyi b/stdlib/2and3/copy.pyi index 523802a84ee7..9d48432409df 100644 --- a/stdlib/2and3/copy.pyi +++ b/stdlib/2and3/copy.pyi @@ -1,6 +1,6 @@ # Stubs for copy -from typing import TypeVar, Optional, Dict, Any +from typing import Any, Dict, Optional, TypeVar _T = TypeVar('_T') diff --git a/stdlib/2and3/crypt.pyi b/stdlib/2and3/crypt.pyi index d55fc263e90d..522d95e1d7c0 100644 --- a/stdlib/2and3/crypt.pyi +++ b/stdlib/2and3/crypt.pyi @@ -1,7 +1,6 @@ import sys from typing import List, NamedTuple, Optional, Union - if sys.version_info >= (3, 3): class _Method: ... diff --git a/stdlib/2and3/csv.pyi b/stdlib/2and3/csv.pyi index da5c709df42a..bd511cb742a0 100644 --- a/stdlib/2and3/csv.pyi +++ b/stdlib/2and3/csv.pyi @@ -1,23 +1,20 @@ -from collections import OrderedDict import sys +from _csv import QUOTE_ALL as QUOTE_ALL +from _csv import QUOTE_MINIMAL as QUOTE_MINIMAL +from _csv import QUOTE_NONE as QUOTE_NONE +from _csv import QUOTE_NONNUMERIC as QUOTE_NONNUMERIC +from _csv import Error as Error +from _csv import _reader, _writer +from _csv import field_size_limit as field_size_limit +from _csv import get_dialect as get_dialect +from _csv import list_dialects as list_dialects +from _csv import reader as reader +from _csv import register_dialect as register_dialect +from _csv import unregister_dialect as unregister_dialect +from _csv import writer as writer +from collections import OrderedDict from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Type, Union -from _csv import (_reader, - _writer, - reader as reader, - writer as writer, - register_dialect as register_dialect, - unregister_dialect as unregister_dialect, - get_dialect as get_dialect, - list_dialects as list_dialects, - field_size_limit as field_size_limit, - QUOTE_ALL as QUOTE_ALL, - QUOTE_MINIMAL as QUOTE_MINIMAL, - QUOTE_NONE as QUOTE_NONE, - QUOTE_NONNUMERIC as QUOTE_NONNUMERIC, - Error as Error, - ) - _Dialect = Union[str, Dialect, Type[Dialect]] _DictRow = Mapping[str, Any] diff --git a/stdlib/2and3/ctypes/__init__.pyi b/stdlib/2and3/ctypes/__init__.pyi index e4cd6b48fc18..1b9d3e65fe72 100644 --- a/stdlib/2and3/ctypes/__init__.pyi +++ b/stdlib/2and3/ctypes/__init__.pyi @@ -1,12 +1,26 @@ # Stubs for ctypes +import sys from array import array from typing import ( - Any, Callable, ClassVar, Iterator, Iterable, List, Mapping, Optional, Sequence, Sized, Text, - Tuple, Type, Generic, TypeVar, overload, + Any, + Callable, + ClassVar, + Generic, + Iterable, + Iterator, + List, + Mapping, + Optional, + Sequence, + Sized, + Text, + Tuple, + Type, + TypeVar, ) from typing import Union as _UnionT -import sys +from typing import overload _T = TypeVar('_T') _DLLT = TypeVar('_DLLT', bound=CDLL) diff --git a/stdlib/2and3/ctypes/util.pyi b/stdlib/2and3/ctypes/util.pyi index 7077d9d2f1e9..45ddc3b599f6 100644 --- a/stdlib/2and3/ctypes/util.pyi +++ b/stdlib/2and3/ctypes/util.pyi @@ -1,7 +1,7 @@ # Stubs for ctypes.util -from typing import Optional import sys +from typing import Optional def find_library(name: str) -> Optional[str]: ... if sys.platform == 'win32': diff --git a/stdlib/2and3/ctypes/wintypes.pyi b/stdlib/2and3/ctypes/wintypes.pyi index c5a6226b25c0..633096539aa8 100644 --- a/stdlib/2and3/ctypes/wintypes.pyi +++ b/stdlib/2and3/ctypes/wintypes.pyi @@ -1,6 +1,23 @@ from ctypes import ( - _SimpleCData, Array, Structure, c_byte, c_char, c_char_p, c_double, c_float, c_int, c_long, - c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, c_void_p, c_wchar, c_wchar_p, + Array, + Structure, + _SimpleCData, + c_byte, + c_char, + c_char_p, + c_double, + c_float, + c_int, + c_long, + c_longlong, + c_short, + c_uint, + c_ulong, + c_ulonglong, + c_ushort, + c_void_p, + c_wchar, + c_wchar_p, pointer, ) diff --git a/stdlib/2and3/curses/__init__.pyi b/stdlib/2and3/curses/__init__.pyi index c327c7803931..315bac1c7ebe 100644 --- a/stdlib/2and3/curses/__init__.pyi +++ b/stdlib/2and3/curses/__init__.pyi @@ -1,5 +1,5 @@ from _curses import * # noqa: F403 -from typing import TypeVar, Callable, Any +from typing import Any, Callable, TypeVar _T = TypeVar('_T') diff --git a/stdlib/2and3/curses/ascii.pyi b/stdlib/2and3/curses/ascii.pyi index 4033769252c8..95abff1f51a0 100644 --- a/stdlib/2and3/curses/ascii.pyi +++ b/stdlib/2and3/curses/ascii.pyi @@ -1,4 +1,4 @@ -from typing import List, Union, overload, TypeVar +from typing import List, TypeVar, Union, overload _Ch = TypeVar('_Ch', str, int) diff --git a/stdlib/2and3/datetime.pyi b/stdlib/2and3/datetime.pyi index ccc92ba35078..5c83728a48e3 100644 --- a/stdlib/2and3/datetime.pyi +++ b/stdlib/2and3/datetime.pyi @@ -1,9 +1,6 @@ import sys from time import struct_time -from typing import ( - AnyStr, Optional, SupportsAbs, Tuple, Union, overload, - ClassVar, -) +from typing import AnyStr, ClassVar, Optional, SupportsAbs, Tuple, Union, overload if sys.version_info >= (3,): _Text = str diff --git a/stdlib/2and3/decimal.pyi b/stdlib/2and3/decimal.pyi index 2018ed8446c6..555f55c8af8f 100644 --- a/stdlib/2and3/decimal.pyi +++ b/stdlib/2and3/decimal.pyi @@ -1,9 +1,7 @@ import numbers import sys from types import TracebackType -from typing import ( - Any, Container, Dict, List, NamedTuple, Optional, overload, Sequence, Text, Tuple, Type, TypeVar, Union, -) +from typing import Any, Container, Dict, List, NamedTuple, Optional, Sequence, Text, Tuple, Type, TypeVar, Union, overload _Decimal = Union[Decimal, int] _DecimalNew = Union[Decimal, float, Text, Tuple[int, Sequence[int], int]] diff --git a/stdlib/2and3/difflib.pyi b/stdlib/2and3/difflib.pyi index ddcec11dd02b..6b7b85f6a229 100644 --- a/stdlib/2and3/difflib.pyi +++ b/stdlib/2and3/difflib.pyi @@ -2,8 +2,19 @@ import sys from typing import ( - TypeVar, Callable, Iterable, Iterator, List, NamedTuple, Sequence, Tuple, - Generic, Optional, Text, Union, AnyStr + AnyStr, + Callable, + Generic, + Iterable, + Iterator, + List, + NamedTuple, + Optional, + Sequence, + Text, + Tuple, + TypeVar, + Union, ) _T = TypeVar('_T') diff --git a/stdlib/2and3/dis.pyi b/stdlib/2and3/dis.pyi index 0ef27f4af49f..63aa89e9c917 100644 --- a/stdlib/2and3/dis.pyi +++ b/stdlib/2and3/dis.pyi @@ -1,12 +1,18 @@ -from typing import Callable, List, Union, Iterator, Tuple, Optional, Any, IO, NamedTuple, Dict - import sys import types - -from opcode import (hasconst as hasconst, hasname as hasname, hasjrel as hasjrel, - hasjabs as hasjabs, haslocal as haslocal, hascompare as hascompare, - hasfree as hasfree, cmp_op as cmp_op, opname as opname, opmap as opmap, - HAVE_ARGUMENT as HAVE_ARGUMENT, EXTENDED_ARG as EXTENDED_ARG) +from opcode import EXTENDED_ARG as EXTENDED_ARG +from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT +from opcode import cmp_op as cmp_op +from opcode import hascompare as hascompare +from opcode import hasconst as hasconst +from opcode import hasfree as hasfree +from opcode import hasjabs as hasjabs +from opcode import hasjrel as hasjrel +from opcode import haslocal as haslocal +from opcode import hasname as hasname +from opcode import opmap as opmap +from opcode import opname as opname +from typing import IO, Any, Callable, Dict, Iterator, List, NamedTuple, Optional, Tuple, Union if sys.version_info >= (3, 4): from opcode import stack_effect as stack_effect diff --git a/stdlib/2and3/distutils/archive_util.pyi b/stdlib/2and3/distutils/archive_util.pyi index 12172f3f2b01..002982a93910 100644 --- a/stdlib/2and3/distutils/archive_util.pyi +++ b/stdlib/2and3/distutils/archive_util.pyi @@ -2,7 +2,6 @@ from typing import Optional - def make_archive(base_name: str, format: str, root_dir: Optional[str] = ..., base_dir: Optional[str] = ..., verbose: int = ..., dry_run: int = ...) -> str: ... diff --git a/stdlib/2and3/distutils/bcppcompiler.pyi b/stdlib/2and3/distutils/bcppcompiler.pyi index 9f27a0ae0965..dec317f81e64 100644 --- a/stdlib/2and3/distutils/bcppcompiler.pyi +++ b/stdlib/2and3/distutils/bcppcompiler.pyi @@ -2,5 +2,4 @@ from distutils.ccompiler import CCompiler - class BCPPCompiler(CCompiler): ... diff --git a/stdlib/2and3/distutils/ccompiler.pyi b/stdlib/2and3/distutils/ccompiler.pyi index 94fad8bacd00..da6361fa5342 100644 --- a/stdlib/2and3/distutils/ccompiler.pyi +++ b/stdlib/2and3/distutils/ccompiler.pyi @@ -2,7 +2,6 @@ from typing import Any, Callable, List, Optional, Tuple, Union - _Macro = Union[Tuple[str], Tuple[str, str]] diff --git a/stdlib/2and3/distutils/cmd.pyi b/stdlib/2and3/distutils/cmd.pyi index 2ec5a5089420..3e155e5c25bf 100644 --- a/stdlib/2and3/distutils/cmd.pyi +++ b/stdlib/2and3/distutils/cmd.pyi @@ -1,8 +1,8 @@ # Stubs for distutils.cmd -from typing import Callable, List, Tuple, Union, Optional, Iterable, Any, Text from abc import abstractmethod from distutils.dist import Distribution +from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union class Command: sub_commands: List[Tuple[str, Union[Callable[[], bool], str, None]]] diff --git a/stdlib/2and3/distutils/command/build_py.pyi b/stdlib/2and3/distutils/command/build_py.pyi index 34753e4a75b6..c1e118e5d232 100644 --- a/stdlib/2and3/distutils/command/build_py.pyi +++ b/stdlib/2and3/distutils/command/build_py.pyi @@ -1,5 +1,5 @@ -from distutils.cmd import Command import sys +from distutils.cmd import Command if sys.version_info >= (3,): class build_py(Command): diff --git a/stdlib/2and3/distutils/command/install.pyi b/stdlib/2and3/distutils/command/install.pyi index 94a900824686..205f6d4471f6 100644 --- a/stdlib/2and3/distutils/command/install.pyi +++ b/stdlib/2and3/distutils/command/install.pyi @@ -1,7 +1,6 @@ from distutils.cmd import Command from typing import Optional, Text - class install(Command): user: bool prefix: Optional[Text] diff --git a/stdlib/2and3/distutils/core.pyi b/stdlib/2and3/distutils/core.pyi index 125b79992219..6ec326b4e971 100644 --- a/stdlib/2and3/distutils/core.pyi +++ b/stdlib/2and3/distutils/core.pyi @@ -1,9 +1,9 @@ # Stubs for distutils.core -from typing import Any, List, Mapping, Optional, Tuple, Type, Union from distutils.cmd import Command as Command from distutils.dist import Distribution as Distribution from distutils.extension import Extension as Extension +from typing import Any, List, Mapping, Optional, Tuple, Type, Union def setup(name: str = ..., version: str = ..., diff --git a/stdlib/2and3/distutils/cygwinccompiler.pyi b/stdlib/2and3/distutils/cygwinccompiler.pyi index 1bfab90ead47..bf36fc70c8dd 100644 --- a/stdlib/2and3/distutils/cygwinccompiler.pyi +++ b/stdlib/2and3/distutils/cygwinccompiler.pyi @@ -2,6 +2,5 @@ from distutils.unixccompiler import UnixCCompiler - class CygwinCCompiler(UnixCCompiler): ... class Mingw32CCompiler(CygwinCCompiler): ... diff --git a/stdlib/2and3/distutils/dir_util.pyi b/stdlib/2and3/distutils/dir_util.pyi index 667ac2fe710a..3ee56281898f 100644 --- a/stdlib/2and3/distutils/dir_util.pyi +++ b/stdlib/2and3/distutils/dir_util.pyi @@ -2,7 +2,6 @@ from typing import List - def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ... def create_tree(base_dir: str, files: List[str], mode: int = ..., diff --git a/stdlib/2and3/distutils/dist.pyi b/stdlib/2and3/distutils/dist.pyi index 65e766d1802b..9bf88bb02d11 100644 --- a/stdlib/2and3/distutils/dist.pyi +++ b/stdlib/2and3/distutils/dist.pyi @@ -1,8 +1,6 @@ # Stubs for distutils.dist from distutils.cmd import Command - -from typing import Any, Mapping, Optional, Dict, Tuple, Iterable, Text - +from typing import Any, Dict, Iterable, Mapping, Optional, Text, Tuple class Distribution: def __init__(self, attrs: Optional[Mapping[str, Any]] = ...) -> None: ... diff --git a/stdlib/2and3/distutils/extension.pyi b/stdlib/2and3/distutils/extension.pyi index 5aa070e43061..6487043692fc 100644 --- a/stdlib/2and3/distutils/extension.pyi +++ b/stdlib/2and3/distutils/extension.pyi @@ -1,7 +1,7 @@ # Stubs for distutils.extension -from typing import List, Optional, Tuple import sys +from typing import List, Optional, Tuple class Extension: if sys.version_info >= (3,): diff --git a/stdlib/2and3/distutils/fancy_getopt.pyi b/stdlib/2and3/distutils/fancy_getopt.pyi index aa7e964b2fe5..357fb64e4f34 100644 --- a/stdlib/2and3/distutils/fancy_getopt.pyi +++ b/stdlib/2and3/distutils/fancy_getopt.pyi @@ -1,9 +1,6 @@ # Stubs for distutils.fancy_getopt -from typing import ( - Any, List, Mapping, Optional, Tuple, Union, - TypeVar, overload, -) +from typing import Any, List, Mapping, Optional, Tuple, TypeVar, Union, overload _Option = Tuple[str, str, str] _GR = Tuple[List[str], OptionDummy] diff --git a/stdlib/2and3/distutils/file_util.pyi b/stdlib/2and3/distutils/file_util.pyi index 6324d63d4b5d..74a360f8d94b 100644 --- a/stdlib/2and3/distutils/file_util.pyi +++ b/stdlib/2and3/distutils/file_util.pyi @@ -2,7 +2,6 @@ from typing import Optional, Sequence, Tuple - def copy_file(src: str, dst: str, preserve_mode: bool = ..., preserve_times: bool = ..., update: bool = ..., link: Optional[str] = ..., verbose: bool = ..., diff --git a/stdlib/2and3/distutils/msvccompiler.pyi b/stdlib/2and3/distutils/msvccompiler.pyi index ffc9e4490ce3..9c588ebfcb75 100644 --- a/stdlib/2and3/distutils/msvccompiler.pyi +++ b/stdlib/2and3/distutils/msvccompiler.pyi @@ -2,5 +2,4 @@ from distutils.ccompiler import CCompiler - class MSVCCompiler(CCompiler): ... diff --git a/stdlib/2and3/distutils/sysconfig.pyi b/stdlib/2and3/distutils/sysconfig.pyi index 62fa9af81757..f937c0660f9f 100644 --- a/stdlib/2and3/distutils/sysconfig.pyi +++ b/stdlib/2and3/distutils/sysconfig.pyi @@ -1,7 +1,7 @@ # Stubs for distutils.sysconfig -from typing import Mapping, Optional, Union from distutils.ccompiler import CCompiler +from typing import Mapping, Optional, Union PREFIX: str EXEC_PREFIX: str diff --git a/stdlib/2and3/distutils/unixccompiler.pyi b/stdlib/2and3/distutils/unixccompiler.pyi index 7ab7298bf4c6..b7a36ad51699 100644 --- a/stdlib/2and3/distutils/unixccompiler.pyi +++ b/stdlib/2and3/distutils/unixccompiler.pyi @@ -2,5 +2,4 @@ from distutils.ccompiler import CCompiler - class UnixCCompiler(CCompiler): ... diff --git a/stdlib/2and3/distutils/util.pyi b/stdlib/2and3/distutils/util.pyi index 942886d77f55..6db47ecbbf2a 100644 --- a/stdlib/2and3/distutils/util.pyi +++ b/stdlib/2and3/distutils/util.pyi @@ -2,7 +2,6 @@ from typing import Any, Callable, List, Mapping, Optional, Tuple - def get_platform() -> str: ... def convert_path(pathname: str) -> str: ... def change_root(new_root: str, pathname: str) -> str: ... diff --git a/stdlib/2and3/distutils/version.pyi b/stdlib/2and3/distutils/version.pyi index cb636b4d95fb..67331fd19fe7 100644 --- a/stdlib/2and3/distutils/version.pyi +++ b/stdlib/2and3/distutils/version.pyi @@ -1,6 +1,6 @@ import sys from abc import abstractmethod -from typing import Any, Optional, TypeVar, Union, Pattern, Text, Tuple +from typing import Any, Optional, Pattern, Text, Tuple, TypeVar, Union _T = TypeVar('_T', bound='Version') diff --git a/stdlib/2and3/doctest.pyi b/stdlib/2and3/doctest.pyi index 8151fb572799..07b097afe5da 100644 --- a/stdlib/2and3/doctest.pyi +++ b/stdlib/2and3/doctest.pyi @@ -1,8 +1,7 @@ -from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type, Union - import sys import types import unittest +from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type, Union TestResults = NamedTuple('TestResults', [ ('failed', int), diff --git a/stdlib/2and3/errno.pyi b/stdlib/2and3/errno.pyi index 14987bbe80df..f6871dfb8c27 100644 --- a/stdlib/2and3/errno.pyi +++ b/stdlib/2and3/errno.pyi @@ -1,7 +1,7 @@ # Stubs for errno -from typing import Mapping import sys +from typing import Mapping errorcode: Mapping[int, str] diff --git a/stdlib/2and3/filecmp.pyi b/stdlib/2and3/filecmp.pyi index 57a884660a92..e702f84984a4 100644 --- a/stdlib/2and3/filecmp.pyi +++ b/stdlib/2and3/filecmp.pyi @@ -1,6 +1,6 @@ # Stubs for filecmp (Python 2/3) import sys -from typing import AnyStr, Callable, Dict, Generic, Iterable, List, Optional, Sequence, Tuple, Union, Text +from typing import AnyStr, Callable, Dict, Generic, Iterable, List, Optional, Sequence, Text, Tuple, Union DEFAULT_IGNORES: List[str] diff --git a/stdlib/2and3/fileinput.pyi b/stdlib/2and3/fileinput.pyi index 0eb8ca9d8840..e86b66d9c433 100644 --- a/stdlib/2and3/fileinput.pyi +++ b/stdlib/2and3/fileinput.pyi @@ -1,7 +1,6 @@ -from typing import Iterable, Callable, IO, AnyStr, Generic, Any, Text, Union, Iterator, Optional - import os import sys +from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Optional, Text, Union if sys.version_info >= (3, 6): _Path = Union[Text, bytes, os.PathLike[Any]] diff --git a/stdlib/2and3/formatter.pyi b/stdlib/2and3/formatter.pyi index 77a4956260ed..8fbfb6d79555 100644 --- a/stdlib/2and3/formatter.pyi +++ b/stdlib/2and3/formatter.pyi @@ -1,6 +1,6 @@ # Source: https://hg.python.org/cpython/file/2.7/Lib/formatter.py # and https://github.com/python/cpython/blob/master/Lib/formatter.py -from typing import Any, IO, List, Optional, Tuple +from typing import IO, Any, List, Optional, Tuple AS_IS = None _FontType = Tuple[str, bool, bool, bool] diff --git a/stdlib/2and3/fractions.pyi b/stdlib/2and3/fractions.pyi index 8bebe5fc89e8..be5fe103d2ed 100644 --- a/stdlib/2and3/fractions.pyi +++ b/stdlib/2and3/fractions.pyi @@ -4,10 +4,10 @@ # Note: these stubs are incomplete. The more complex type # signatures are currently omitted. Also see numbers.pyi. -from typing import Optional, TypeVar, Union, overload, Any -from numbers import Real, Integral, Rational -from decimal import Decimal import sys +from decimal import Decimal +from numbers import Integral, Rational, Real +from typing import Any, Optional, TypeVar, Union, overload _ComparableNum = Union[int, float, Decimal, Real] diff --git a/stdlib/2and3/ftplib.pyi b/stdlib/2and3/ftplib.pyi index dff8c4788bc2..999602de9e82 100644 --- a/stdlib/2and3/ftplib.pyi +++ b/stdlib/2and3/ftplib.pyi @@ -1,9 +1,25 @@ # Stubs for ftplib (Python 2.7/3) import sys -from typing import Optional, BinaryIO, Tuple, TextIO, Iterable, Callable, List, Union, Iterator, Dict, Text, Type, TypeVar, Generic, Any -from types import TracebackType from socket import socket from ssl import SSLContext +from types import TracebackType +from typing import ( + Any, + BinaryIO, + Callable, + Dict, + Generic, + Iterable, + Iterator, + List, + Optional, + Text, + TextIO, + Tuple, + Type, + TypeVar, + Union, +) _T = TypeVar('_T') _IntOrStr = Union[int, Text] diff --git a/stdlib/2and3/genericpath.pyi b/stdlib/2and3/genericpath.pyi index e0b1c6de208c..eb1c3bf15301 100644 --- a/stdlib/2and3/genericpath.pyi +++ b/stdlib/2and3/genericpath.pyi @@ -1,5 +1,5 @@ -from typing import Sequence, AnyStr, Text import sys +from typing import AnyStr, Sequence, Text if sys.version_info >= (3, 0): def commonprefix(m: Sequence[str]) -> str: ... diff --git a/stdlib/2and3/hmac.pyi b/stdlib/2and3/hmac.pyi index 47bbc7ec0ec7..5df6ad790472 100644 --- a/stdlib/2and3/hmac.pyi +++ b/stdlib/2and3/hmac.pyi @@ -1,8 +1,8 @@ # Stubs for hmac -from typing import Any, Callable, Optional, Union, overload, AnyStr -from types import ModuleType import sys +from types import ModuleType +from typing import Any, AnyStr, Callable, Optional, Union, overload _B = Union[bytes, bytearray] diff --git a/stdlib/2and3/imaplib.pyi b/stdlib/2and3/imaplib.pyi index ab32e7bac31f..60975d715680 100644 --- a/stdlib/2and3/imaplib.pyi +++ b/stdlib/2and3/imaplib.pyi @@ -6,7 +6,7 @@ import sys import time from socket import socket as _socket from ssl import SSLSocket -from typing import Any, Callable, Dict, IO, List, Optional, Pattern, Text, Tuple, Type, Union +from typing import IO, Any, Callable, Dict, List, Optional, Pattern, Text, Tuple, Type, Union CommandResults = Tuple[str, List[Any]] diff --git a/stdlib/2and3/imghdr.pyi b/stdlib/2and3/imghdr.pyi index b9d8d17e33ae..dce5d3cb0762 100644 --- a/stdlib/2and3/imghdr.pyi +++ b/stdlib/2and3/imghdr.pyi @@ -1,7 +1,6 @@ -from typing import overload, Union, Text, BinaryIO, Optional, Any, List, Callable -import sys import os - +import sys +from typing import Any, BinaryIO, Callable, List, Optional, Text, Union, overload if sys.version_info >= (3, 6): _File = Union[Text, os.PathLike[Text], BinaryIO] diff --git a/stdlib/2and3/lib2to3/pgen2/driver.pyi b/stdlib/2and3/lib2to3/pgen2/driver.pyi index 56785f087313..57d287e09f21 100644 --- a/stdlib/2and3/lib2to3/pgen2/driver.pyi +++ b/stdlib/2and3/lib2to3/pgen2/driver.pyi @@ -2,13 +2,11 @@ import os import sys -from typing import Any, Callable, IO, Iterable, List, Optional, Text, Tuple, Union - -from logging import Logger -from lib2to3.pytree import _Convert, _NL from lib2to3.pgen2 import _Path from lib2to3.pgen2.grammar import Grammar - +from lib2to3.pytree import _NL, _Convert +from logging import Logger +from typing import IO, Any, Callable, Iterable, List, Optional, Text, Tuple, Union class Driver: grammar: Grammar diff --git a/stdlib/2and3/lib2to3/pgen2/grammar.pyi b/stdlib/2and3/lib2to3/pgen2/grammar.pyi index 122d771dba00..485de0c89f9b 100644 --- a/stdlib/2and3/lib2to3/pgen2/grammar.pyi +++ b/stdlib/2and3/lib2to3/pgen2/grammar.pyi @@ -1,7 +1,6 @@ # Stubs for lib2to3.pgen2.grammar (Python 3.6) from lib2to3.pgen2 import _Path - from typing import Any, Dict, List, Optional, Text, Tuple, TypeVar _P = TypeVar('_P') diff --git a/stdlib/2and3/lib2to3/pgen2/parse.pyi b/stdlib/2and3/lib2to3/pgen2/parse.pyi index 101d4760a60c..4b141fd5ca2f 100644 --- a/stdlib/2and3/lib2to3/pgen2/parse.pyi +++ b/stdlib/2and3/lib2to3/pgen2/parse.pyi @@ -1,9 +1,8 @@ # Stubs for lib2to3.pgen2.parse (Python 3.6) -from typing import Any, Dict, List, Optional, Sequence, Set, Text, Tuple - -from lib2to3.pgen2.grammar import Grammar, _DFAS +from lib2to3.pgen2.grammar import _DFAS, Grammar from lib2to3.pytree import _NL, _Convert, _RawNode +from typing import Any, Dict, List, Optional, Sequence, Set, Text, Tuple _Context = Sequence[Any] diff --git a/stdlib/2and3/lib2to3/pgen2/pgen.pyi b/stdlib/2and3/lib2to3/pgen2/pgen.pyi index 42d503b4d3ea..eae44222acc6 100644 --- a/stdlib/2and3/lib2to3/pgen2/pgen.pyi +++ b/stdlib/2and3/lib2to3/pgen2/pgen.pyi @@ -1,11 +1,8 @@ # Stubs for lib2to3.pgen2.pgen (Python 3.6) -from typing import ( - Any, Dict, IO, Iterable, Iterator, List, NoReturn, Optional, Text, Tuple -) - from lib2to3.pgen2 import _Path, grammar from lib2to3.pgen2.tokenize import _TokenInfo +from typing import IO, Any, Dict, Iterable, Iterator, List, NoReturn, Optional, Text, Tuple class PgenGrammar(grammar.Grammar): ... diff --git a/stdlib/2and3/lib2to3/pgen2/tokenize.pyi b/stdlib/2and3/lib2to3/pgen2/tokenize.pyi index c10305ffdda0..f5acccb2febb 100644 --- a/stdlib/2and3/lib2to3/pgen2/tokenize.pyi +++ b/stdlib/2and3/lib2to3/pgen2/tokenize.pyi @@ -1,9 +1,8 @@ # Stubs for lib2to3.pgen2.tokenize (Python 3.6) # NOTE: Only elements from __all__ are present. -from typing import Callable, Iterable, Iterator, List, Text, Tuple from lib2to3.pgen2.token import * # noqa - +from typing import Callable, Iterable, Iterator, List, Text, Tuple _Coord = Tuple[int, int] _TokenEater = Callable[[int, Text, _Coord, _Coord, Text], None] diff --git a/stdlib/2and3/lib2to3/pygram.pyi b/stdlib/2and3/lib2to3/pygram.pyi index aeb7b93bf870..6bdbfe18250c 100644 --- a/stdlib/2and3/lib2to3/pygram.pyi +++ b/stdlib/2and3/lib2to3/pygram.pyi @@ -1,7 +1,7 @@ # Stubs for lib2to3.pygram (Python 3.6) -from typing import Any from lib2to3.pgen2.grammar import Grammar +from typing import Any class Symbols: def __init__(self, grammar: Grammar) -> None: ... diff --git a/stdlib/2and3/lib2to3/pytree.pyi b/stdlib/2and3/lib2to3/pytree.pyi index 06a7c1229c40..afcfe822831e 100644 --- a/stdlib/2and3/lib2to3/pytree.pyi +++ b/stdlib/2and3/lib2to3/pytree.pyi @@ -1,9 +1,8 @@ # Stubs for lib2to3.pytree (Python 3.6) import sys -from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union - from lib2to3.pgen2.grammar import Grammar +from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union _P = TypeVar('_P') _NL = Union[Node, Leaf] diff --git a/stdlib/2and3/locale.pyi b/stdlib/2and3/locale.pyi index a0d7383adb5c..bb61f66098d7 100644 --- a/stdlib/2and3/locale.pyi +++ b/stdlib/2and3/locale.pyi @@ -1,8 +1,8 @@ # Stubs for locale +import sys from decimal import Decimal from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union -import sys # workaround for mypy#2010 if sys.version_info < (3,): diff --git a/stdlib/2and3/logging/__init__.pyi b/stdlib/2and3/logging/__init__.pyi index d736b0838230..2fafbbd4a483 100644 --- a/stdlib/2and3/logging/__init__.pyi +++ b/stdlib/2and3/logging/__init__.pyi @@ -1,14 +1,11 @@ # Stubs for logging (Python 3.4) -from typing import ( - Any, Callable, Dict, Iterable, List, Mapping, MutableMapping, Optional, IO, - Tuple, Text, Union, overload, -) -from string import Template -from time import struct_time -from types import TracebackType, FrameType import sys import threading +from string import Template +from time import struct_time +from types import FrameType, TracebackType +from typing import IO, Any, Callable, Dict, Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, Union, overload _SysExcInfoType = Union[Tuple[type, BaseException, Optional[TracebackType]], Tuple[None, None, None]] diff --git a/stdlib/2and3/logging/config.pyi b/stdlib/2and3/logging/config.pyi index c8dbfdffc093..3884cfbb02ca 100644 --- a/stdlib/2and3/logging/config.pyi +++ b/stdlib/2and3/logging/config.pyi @@ -1,8 +1,9 @@ # Stubs for logging.config (Python 3.4) -from typing import Any, Callable, Dict, Optional, IO, Union -from threading import Thread import sys +from threading import Thread +from typing import IO, Any, Callable, Dict, Optional, Union + if sys.version_info >= (3,): from configparser import RawConfigParser else: diff --git a/stdlib/2and3/logging/handlers.pyi b/stdlib/2and3/logging/handlers.pyi index c18ddccf568f..8acdb8ace605 100644 --- a/stdlib/2and3/logging/handlers.pyi +++ b/stdlib/2and3/logging/handlers.pyi @@ -1,11 +1,12 @@ # Stubs for logging.handlers (Python 2.4) import datetime -from logging import Handler, FileHandler, LogRecord -from socket import SocketType import ssl import sys +from logging import FileHandler, Handler, LogRecord +from socket import SocketType from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload + if sys.version_info >= (3,): from queue import Queue else: diff --git a/stdlib/2and3/macpath.pyi b/stdlib/2and3/macpath.pyi index c0bf57658ed7..dfd074fe7c7c 100644 --- a/stdlib/2and3/macpath.pyi +++ b/stdlib/2and3/macpath.pyi @@ -4,10 +4,7 @@ import os import sys -from typing import ( - overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO, - TypeVar, Union, Text, Callable, Optional -) +from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/2and3/marshal.pyi b/stdlib/2and3/marshal.pyi index 6eb3f175d145..0a271ea7ebcc 100644 --- a/stdlib/2and3/marshal.pyi +++ b/stdlib/2and3/marshal.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO +from typing import IO, Any version: int diff --git a/stdlib/2and3/math.pyi b/stdlib/2and3/math.pyi index 25eb1c4ba127..f80a4a5e7b1d 100644 --- a/stdlib/2and3/math.pyi +++ b/stdlib/2and3/math.pyi @@ -1,9 +1,8 @@ # Stubs for math # See: http://docs.python.org/2/library/math.html -from typing import Tuple, Iterable, SupportsFloat, SupportsInt - import sys +from typing import Iterable, SupportsFloat, SupportsInt, Tuple e: float pi: float diff --git a/stdlib/2and3/mimetypes.pyi b/stdlib/2and3/mimetypes.pyi index eb8302796372..43248c50013e 100644 --- a/stdlib/2and3/mimetypes.pyi +++ b/stdlib/2and3/mimetypes.pyi @@ -1,7 +1,7 @@ # Stubs for mimetypes -from typing import Dict, IO, List, Optional, Sequence, Text, Tuple import sys +from typing import IO, Dict, List, Optional, Sequence, Text, Tuple def guess_type(url: Text, strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... diff --git a/stdlib/2and3/mmap.pyi b/stdlib/2and3/mmap.pyi index 709d5d93f291..ede5739725ac 100644 --- a/stdlib/2and3/mmap.pyi +++ b/stdlib/2and3/mmap.pyi @@ -1,6 +1,5 @@ import sys -from typing import (Optional, Sequence, Union, Generic, overload, - Iterable, Iterator, Sized, ContextManager, AnyStr) +from typing import AnyStr, ContextManager, Generic, Iterable, Iterator, Optional, Sequence, Sized, Union, overload ACCESS_DEFAULT: int ACCESS_READ: int diff --git a/stdlib/2and3/netrc.pyi b/stdlib/2and3/netrc.pyi index 3ceae889963b..d08f73a59da0 100644 --- a/stdlib/2and3/netrc.pyi +++ b/stdlib/2and3/netrc.pyi @@ -1,6 +1,5 @@ from typing import AnyStr, Dict, List, Optional, Tuple, overload - class NetrcParseError(Exception): filename: Optional[str] lineno: Optional[int] diff --git a/stdlib/2and3/ntpath.pyi b/stdlib/2and3/ntpath.pyi index c0bf57658ed7..dfd074fe7c7c 100644 --- a/stdlib/2and3/ntpath.pyi +++ b/stdlib/2and3/ntpath.pyi @@ -4,10 +4,7 @@ import os import sys -from typing import ( - overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO, - TypeVar, Union, Text, Callable, Optional -) +from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/2and3/numbers.pyi b/stdlib/2and3/numbers.pyi index 50b561c24a32..f9954b1d9ff0 100644 --- a/stdlib/2and3/numbers.pyi +++ b/stdlib/2and3/numbers.pyi @@ -5,9 +5,9 @@ # Note: these stubs are incomplete. The more complex type # signatures are currently omitted. -from typing import Any, Optional, SupportsFloat -from abc import ABCMeta, abstractmethod import sys +from abc import ABCMeta, abstractmethod +from typing import Any, Optional, SupportsFloat class Number(metaclass=ABCMeta): @abstractmethod diff --git a/stdlib/2and3/opcode.pyi b/stdlib/2and3/opcode.pyi index 34350e749cc1..70a566272dd9 100644 --- a/stdlib/2and3/opcode.pyi +++ b/stdlib/2and3/opcode.pyi @@ -1,6 +1,5 @@ -from typing import List, Dict, Optional, Sequence - import sys +from typing import Dict, List, Optional, Sequence cmp_op: Sequence[str] hasconst: List[int] diff --git a/stdlib/2and3/operator.pyi b/stdlib/2and3/operator.pyi index eafc37cb36b9..655e3d58809b 100644 --- a/stdlib/2and3/operator.pyi +++ b/stdlib/2and3/operator.pyi @@ -1,11 +1,19 @@ # Stubs for operator +import sys from typing import ( - Any, Callable, Container, Mapping, MutableMapping, MutableSequence, Sequence, SupportsAbs, Tuple, - TypeVar, overload, + Any, + Callable, + Container, + Mapping, + MutableMapping, + MutableSequence, + Sequence, + SupportsAbs, + Tuple, + TypeVar, + overload, ) -import sys - _T = TypeVar('_T') _K = TypeVar('_K') diff --git a/stdlib/2and3/optparse.pyi b/stdlib/2and3/optparse.pyi index 9b8b8eac568c..cdb9b94058b7 100644 --- a/stdlib/2and3/optparse.pyi +++ b/stdlib/2and3/optparse.pyi @@ -1,6 +1,6 @@ # Generated by pytype, with only minor tweaks. Might be incomplete. import sys -from typing import Any, AnyStr, Callable, Dict, IO, Iterable, List, Mapping, Optional, Sequence, Tuple, Union +from typing import IO, Any, AnyStr, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union # See https://groups.google.com/forum/#!topic/python-ideas/gA1gdj3RZ5g if sys.version_info >= (3,): diff --git a/stdlib/2and3/pdb.pyi b/stdlib/2and3/pdb.pyi index e403c36cad8a..425cfe060b92 100644 --- a/stdlib/2and3/pdb.pyi +++ b/stdlib/2and3/pdb.pyi @@ -1,9 +1,9 @@ # NOTE: This stub is incomplete - only contains some global functions -from cmd import Cmd import sys +from cmd import Cmd from types import FrameType -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar +from typing import IO, Any, Callable, Dict, Iterable, Optional, TypeVar _T = TypeVar('_T') diff --git a/stdlib/2and3/pickle.pyi b/stdlib/2and3/pickle.pyi index 7bfad8f3bf1b..795405c103d8 100644 --- a/stdlib/2and3/pickle.pyi +++ b/stdlib/2and3/pickle.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, IO, Mapping, Union, Tuple, Callable, Optional, Iterator +from typing import IO, Any, Callable, Iterator, Mapping, Optional, Tuple, Union HIGHEST_PROTOCOL: int if sys.version_info >= (3, 0): diff --git a/stdlib/2and3/pickletools.pyi b/stdlib/2and3/pickletools.pyi index c03664697bab..856866655723 100644 --- a/stdlib/2and3/pickletools.pyi +++ b/stdlib/2and3/pickletools.pyi @@ -1,6 +1,6 @@ # Stubs for pickletools (Python 2 and 3) import sys -from typing import Any, Callable, IO, Iterator, List, MutableMapping, Optional, Text, Tuple, Type, Union +from typing import IO, Any, Callable, Iterator, List, MutableMapping, Optional, Text, Tuple, Type, Union _Reader = Callable[[IO[bytes]], Any] diff --git a/stdlib/2and3/pkgutil.pyi b/stdlib/2and3/pkgutil.pyi index c7bad4221839..d582736df7e6 100644 --- a/stdlib/2and3/pkgutil.pyi +++ b/stdlib/2and3/pkgutil.pyi @@ -1,7 +1,7 @@ # Stubs for pkgutil -from typing import Any, Callable, Generator, IO, Iterable, Optional, Tuple, NamedTuple import sys +from typing import IO, Any, Callable, Generator, Iterable, NamedTuple, Optional, Tuple if sys.version_info >= (3,): from importlib.abc import Loader diff --git a/stdlib/2and3/plistlib.pyi b/stdlib/2and3/plistlib.pyi index 64201dd5b6dd..f1f272dc6e88 100644 --- a/stdlib/2and3/plistlib.pyi +++ b/stdlib/2and3/plistlib.pyi @@ -1,11 +1,10 @@ # Stubs for plistlib -from typing import ( - Any, IO, Mapping, MutableMapping, Optional, Union, - Type, TypeVar, -) -from typing import Dict as DictT import sys +from typing import IO, Any +from typing import Dict as DictT +from typing import Mapping, MutableMapping, Optional, Type, TypeVar, Union + if sys.version_info >= (3,): from enum import Enum diff --git a/stdlib/2and3/poplib.pyi b/stdlib/2and3/poplib.pyi index d2b7dab6cf5c..5a74d49f92c2 100644 --- a/stdlib/2and3/poplib.pyi +++ b/stdlib/2and3/poplib.pyi @@ -3,10 +3,7 @@ import socket import ssl import sys -from typing import ( - Any, BinaryIO, Dict, List, NoReturn, Optional, overload, Pattern, Text, - Tuple, -) +from typing import Any, BinaryIO, Dict, List, NoReturn, Optional, Pattern, Text, Tuple, overload _LongResp = Tuple[bytes, List[bytes], int] diff --git a/stdlib/2and3/posixpath.pyi b/stdlib/2and3/posixpath.pyi index c0bf57658ed7..dfd074fe7c7c 100644 --- a/stdlib/2and3/posixpath.pyi +++ b/stdlib/2and3/posixpath.pyi @@ -4,10 +4,7 @@ import os import sys -from typing import ( - overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO, - TypeVar, Union, Text, Callable, Optional -) +from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/2and3/pprint.pyi b/stdlib/2and3/pprint.pyi index 90a87ab0f09c..2bbd1718c374 100644 --- a/stdlib/2and3/pprint.pyi +++ b/stdlib/2and3/pprint.pyi @@ -4,7 +4,7 @@ # Based on http://docs.python.org/3/library/pprint.html import sys -from typing import Any, Dict, Tuple, IO +from typing import IO, Any, Dict, Tuple if sys.version_info >= (3, 4): def pformat(o: object, indent: int = ..., width: int = ..., diff --git a/stdlib/2and3/pstats.pyi b/stdlib/2and3/pstats.pyi index 8bf1b0dae900..104061577ac5 100644 --- a/stdlib/2and3/pstats.pyi +++ b/stdlib/2and3/pstats.pyi @@ -1,8 +1,8 @@ -from profile import Profile -from cProfile import Profile as _cProfile import os import sys -from typing import Any, Dict, IO, Iterable, List, Text, Tuple, TypeVar, Union, overload +from cProfile import Profile as _cProfile +from profile import Profile +from typing import IO, Any, Dict, Iterable, List, Text, Tuple, TypeVar, Union, overload _Selector = Union[str, float, int] _T = TypeVar('_T', bound='Stats') diff --git a/stdlib/2and3/py_compile.pyi b/stdlib/2and3/py_compile.pyi index a8be1136a52d..089712ec989b 100644 --- a/stdlib/2and3/py_compile.pyi +++ b/stdlib/2and3/py_compile.pyi @@ -1,7 +1,6 @@ # Stubs for py_compile (Python 2 and 3) import sys - -from typing import Optional, List, Text, AnyStr, Union +from typing import AnyStr, List, Optional, Text, Union _EitherStr = Union[bytes, Text] diff --git a/stdlib/2and3/pyclbr.pyi b/stdlib/2and3/pyclbr.pyi index efecf3292bed..24355f65e614 100644 --- a/stdlib/2and3/pyclbr.pyi +++ b/stdlib/2and3/pyclbr.pyi @@ -1,5 +1,4 @@ -from typing import List, Union, Sequence, Optional, Dict - +from typing import Dict, List, Optional, Sequence, Union class Class: module: str diff --git a/stdlib/2and3/pydoc.pyi b/stdlib/2and3/pydoc.pyi index 1150741bd205..69d3b32c61a2 100644 --- a/stdlib/2and3/pydoc.pyi +++ b/stdlib/2and3/pydoc.pyi @@ -1,6 +1,23 @@ import sys -from typing import Any, AnyStr, Callable, Container, Dict, IO, List, Mapping, MutableMapping, NoReturn, Optional, Text, Tuple, Type, Union from types import FunctionType, MethodType, ModuleType, TracebackType +from typing import ( + IO, + Any, + AnyStr, + Callable, + Container, + Dict, + List, + Mapping, + MutableMapping, + NoReturn, + Optional, + Text, + Tuple, + Type, + Union, +) + if sys.version_info >= (3,): from reprlib import Repr else: diff --git a/stdlib/2and3/pyexpat/__init__.pyi b/stdlib/2and3/pyexpat/__init__.pyi index 670e561068c8..0c0f6b848138 100644 --- a/stdlib/2and3/pyexpat/__init__.pyi +++ b/stdlib/2and3/pyexpat/__init__.pyi @@ -1,7 +1,6 @@ -from typing import List, Tuple, Optional, Callable, Any, Protocol, Union, Dict, Text - import pyexpat.errors as errors import pyexpat.model as model +from typing import Any, Callable, Dict, List, Optional, Protocol, Text, Tuple, Union EXPAT_VERSION: str # undocumented version_info: Tuple[int, int, int] # undocumented diff --git a/stdlib/2and3/readline.pyi b/stdlib/2and3/readline.pyi index aff2debf266a..1724af3e96d3 100644 --- a/stdlib/2and3/readline.pyi +++ b/stdlib/2and3/readline.pyi @@ -1,7 +1,7 @@ # Stubs for readline -from typing import Callable, Optional, Sequence import sys +from typing import Callable, Optional, Sequence _CompleterT = Optional[Callable[[str, int], Optional[str]]] _CompDispT = Optional[Callable[[str, Sequence[str], int], None]] diff --git a/stdlib/2and3/rlcompleter.pyi b/stdlib/2and3/rlcompleter.pyi index 3db9d0c40799..e0d6f7991a84 100644 --- a/stdlib/2and3/rlcompleter.pyi +++ b/stdlib/2and3/rlcompleter.pyi @@ -1,7 +1,7 @@ # Stubs for rlcompleter -from typing import Any, Dict, Optional, Union import sys +from typing import Any, Dict, Optional, Union if sys.version_info >= (3,): _Text = str diff --git a/stdlib/2and3/shutil.pyi b/stdlib/2and3/shutil.pyi index de1f8fcc8330..8545b0d10fff 100644 --- a/stdlib/2and3/shutil.pyi +++ b/stdlib/2and3/shutil.pyi @@ -1,14 +1,29 @@ import os import sys +from typing import ( + IO, + Any, + AnyStr, + Callable, + Iterable, + List, + NamedTuple, + Optional, + Protocol, + Sequence, + Set, + Text, + Tuple, + Type, + TypeVar, + Union, + overload, +) # 'bytes' paths are not properly supported: they don't work with all functions, # sometimes they only work partially (broken exception messages), and the test # cases don't use them. -from typing import ( - List, Iterable, Callable, Any, Tuple, Sequence, NamedTuple, IO, - AnyStr, Optional, Union, Set, TypeVar, overload, Type, Protocol, Text -) if sys.version_info >= (3, 6): _Path = Union[str, os.PathLike[str]] diff --git a/stdlib/2and3/site.pyi b/stdlib/2and3/site.pyi index 4fdbad8ee3cf..e3c4221a3800 100644 --- a/stdlib/2and3/site.pyi +++ b/stdlib/2and3/site.pyi @@ -1,7 +1,7 @@ # Stubs for site -from typing import List, Iterable, Optional import sys +from typing import Iterable, List, Optional PREFIXES: List[str] ENABLE_USER_SITE: Optional[bool] diff --git a/stdlib/2and3/smtpd.pyi b/stdlib/2and3/smtpd.pyi index 923b8bc65df4..8f712057f412 100644 --- a/stdlib/2and3/smtpd.pyi +++ b/stdlib/2and3/smtpd.pyi @@ -1,9 +1,8 @@ # Stubs for smtpd (Python 2 and 3) -import sys -import socket -import asyncore import asynchat - +import asyncore +import socket +import sys from typing import Any, DefaultDict, List, Optional, Text, Tuple, Type _Address = Tuple[str, int] # (host, port) diff --git a/stdlib/2and3/socket.pyi b/stdlib/2and3/socket.pyi index 22b2f91357a3..7cebf8a702df 100644 --- a/stdlib/2and3/socket.pyi +++ b/stdlib/2and3/socket.pyi @@ -6,7 +6,7 @@ # see: http://nullege.com/codes/search/socket # adapted for Python 2.7 by Michal Pokorny import sys -from typing import Any, Iterable, Tuple, List, Optional, Union, overload, TypeVar, Text +from typing import Any, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload _WriteBuffer = Union[bytearray, memoryview] diff --git a/stdlib/2and3/sqlite3/dbapi2.pyi b/stdlib/2and3/sqlite3/dbapi2.pyi index 5b3d2a03ed1a..ce61a367249e 100644 --- a/stdlib/2and3/sqlite3/dbapi2.pyi +++ b/stdlib/2and3/sqlite3/dbapi2.pyi @@ -3,8 +3,8 @@ import os import sys +from datetime import date, datetime, time from typing import Any, Callable, Iterable, Iterator, List, Optional, Text, Tuple, Type, TypeVar, Union -from datetime import date, time, datetime _T = TypeVar('_T') diff --git a/stdlib/2and3/ssl.pyi b/stdlib/2and3/ssl.pyi index 4b51e409f0f4..5469f7b3978a 100644 --- a/stdlib/2and3/ssl.pyi +++ b/stdlib/2and3/ssl.pyi @@ -1,10 +1,8 @@ # Stubs for ssl -from typing import ( - Any, Dict, Callable, List, NamedTuple, Optional, Set, Tuple, Union, -) import socket import sys +from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple, Union _PCTRTT = Tuple[Tuple[str, str], ...] _PCTRTTT = Tuple[_PCTRTT, ...] diff --git a/stdlib/2and3/struct.pyi b/stdlib/2and3/struct.pyi index 552ee227de33..5ebc07584c72 100644 --- a/stdlib/2and3/struct.pyi +++ b/stdlib/2and3/struct.pyi @@ -4,9 +4,9 @@ # Based on http://docs.python.org/2/library/struct.html import sys -from typing import Any, Tuple, Text, Union, Iterator from array import array from mmap import mmap +from typing import Any, Iterator, Text, Tuple, Union class error(Exception): ... diff --git a/stdlib/2and3/sunau.pyi b/stdlib/2and3/sunau.pyi index 6577c316c46e..45ecef2f207c 100644 --- a/stdlib/2and3/sunau.pyi +++ b/stdlib/2and3/sunau.pyi @@ -1,7 +1,7 @@ # Stubs for sunau (Python 2 and 3) import sys -from typing import Any, NamedTuple, NoReturn, Optional, Text, IO, Union, Tuple +from typing import IO, Any, NamedTuple, NoReturn, Optional, Text, Tuple, Union _File = Union[Text, IO[bytes]] diff --git a/stdlib/2and3/symtable.pyi b/stdlib/2and3/symtable.pyi index fd8b9ad79bb8..9fe53402d4ec 100644 --- a/stdlib/2and3/symtable.pyi +++ b/stdlib/2and3/symtable.pyi @@ -1,5 +1,5 @@ import sys -from typing import List, Sequence, Tuple, Text +from typing import List, Sequence, Text, Tuple def symtable(code: Text, filename: Text, compile_type: Text) -> SymbolTable: ... diff --git a/stdlib/2and3/sysconfig.pyi b/stdlib/2and3/sysconfig.pyi index 5d6c9cb19c8a..ae8b844fc317 100644 --- a/stdlib/2and3/sysconfig.pyi +++ b/stdlib/2and3/sysconfig.pyi @@ -1,6 +1,6 @@ # Stubs for sysconfig -from typing import overload, Any, Dict, IO, List, Optional, Tuple, Union +from typing import IO, Any, Dict, List, Optional, Tuple, Union, overload @overload def get_config_vars() -> Dict[str, Any]: ... diff --git a/stdlib/2and3/tarfile.pyi b/stdlib/2and3/tarfile.pyi index f5984949d1db..57121128ec03 100644 --- a/stdlib/2and3/tarfile.pyi +++ b/stdlib/2and3/tarfile.pyi @@ -1,12 +1,9 @@ # Stubs for tarfile -from typing import ( - Callable, IO, Iterable, Iterator, List, Mapping, Optional, Type, - Union, -) import os import sys from types import TracebackType +from typing import IO, Callable, Iterable, Iterator, List, Mapping, Optional, Type, Union if sys.version_info >= (3, 6): _Path = Union[bytes, str, os.PathLike] diff --git a/stdlib/2and3/threading.pyi b/stdlib/2and3/threading.pyi index 190f93407001..eab8454116df 100644 --- a/stdlib/2and3/threading.pyi +++ b/stdlib/2and3/threading.pyi @@ -1,11 +1,8 @@ # Stubs for threading -from typing import ( - Any, Callable, Iterable, List, Mapping, Optional, Tuple, Type, Union, - TypeVar, -) -from types import FrameType, TracebackType import sys +from types import FrameType, TracebackType +from typing import Any, Callable, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union # TODO recursive type _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] diff --git a/stdlib/2and3/time.pyi b/stdlib/2and3/time.pyi index b04e6164b652..1f97703df1ce 100644 --- a/stdlib/2and3/time.pyi +++ b/stdlib/2and3/time.pyi @@ -2,7 +2,8 @@ # See https://docs.python.org/3/library/time.html import sys -from typing import Any, NamedTuple, Tuple, Union, Optional +from typing import Any, NamedTuple, Optional, Tuple, Union + if sys.version_info >= (3, 3): from types import SimpleNamespace diff --git a/stdlib/2and3/timeit.pyi b/stdlib/2and3/timeit.pyi index bc4cbba87d36..1079ef88f115 100644 --- a/stdlib/2and3/timeit.pyi +++ b/stdlib/2and3/timeit.pyi @@ -1,7 +1,7 @@ # Stubs for timeit (Python 2 and 3) import sys -from typing import Any, Callable, Dict, IO, List, Optional, Sequence, Text, Tuple, Union +from typing import IO, Any, Callable, Dict, List, Optional, Sequence, Text, Tuple, Union _str = Union[str, Text] _Timer = Callable[[], float] diff --git a/stdlib/2and3/traceback.pyi b/stdlib/2and3/traceback.pyi index cbefb62f020c..4c81e5c8fa76 100644 --- a/stdlib/2and3/traceback.pyi +++ b/stdlib/2and3/traceback.pyi @@ -1,8 +1,8 @@ # Stubs for traceback -from typing import Any, Dict, Generator, IO, Iterator, List, Mapping, Optional, Protocol, Tuple, Type, Iterable -from types import FrameType, TracebackType import sys +from types import FrameType, TracebackType +from typing import IO, Any, Dict, Generator, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple, Type _PT = Tuple[str, int, str, Optional[str]] diff --git a/stdlib/2and3/turtle.pyi b/stdlib/2and3/turtle.pyi index c9d9d90f0ba0..8a317ee8eca7 100644 --- a/stdlib/2and3/turtle.pyi +++ b/stdlib/2and3/turtle.pyi @@ -1,5 +1,6 @@ -from typing import Tuple, overload, Optional, Union, Dict, Any, Sequence, TypeVar, List, Callable, Text import sys +from typing import Any, Callable, Dict, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload + if sys.version_info >= (3,): from tkinter import Canvas, PhotoImage else: diff --git a/stdlib/2and3/uu.pyi b/stdlib/2and3/uu.pyi index c926dbba2a37..238fcf3bbdec 100644 --- a/stdlib/2and3/uu.pyi +++ b/stdlib/2and3/uu.pyi @@ -1,6 +1,6 @@ # Stubs for uu (Python 2 and 3) import sys -from typing import BinaryIO, Union, Optional, Text +from typing import BinaryIO, Optional, Text, Union _File = Union[Text, BinaryIO] diff --git a/stdlib/2and3/uuid.pyi b/stdlib/2and3/uuid.pyi index 9c009d92163d..6a290780370a 100644 --- a/stdlib/2and3/uuid.pyi +++ b/stdlib/2and3/uuid.pyi @@ -1,7 +1,7 @@ # Stubs for uuid import sys -from typing import Tuple, Optional, Any, Text +from typing import Any, Optional, Text, Tuple # Because UUID has properties called int and bytes we need to rename these temporarily. _Int = int diff --git a/stdlib/2and3/warnings.pyi b/stdlib/2and3/warnings.pyi index a44e43e0162d..f2b84e2c5fb9 100644 --- a/stdlib/2and3/warnings.pyi +++ b/stdlib/2and3/warnings.pyi @@ -1,7 +1,7 @@ # Stubs for warnings -from typing import Any, Dict, List, NamedTuple, Optional, TextIO, Tuple, Type, Union from types import ModuleType, TracebackType +from typing import Any, Dict, List, NamedTuple, Optional, TextIO, Tuple, Type, Union def warn(message: Union[str, Warning], category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ... diff --git a/stdlib/2and3/wave.pyi b/stdlib/2and3/wave.pyi index 951142aa34bd..1ebc8ccb8cf3 100644 --- a/stdlib/2and3/wave.pyi +++ b/stdlib/2and3/wave.pyi @@ -1,9 +1,7 @@ # Stubs for wave (Python 2 and 3) import sys -from typing import ( - Any, NamedTuple, NoReturn, Optional, Text, BinaryIO, Union, Tuple -) +from typing import Any, BinaryIO, NamedTuple, NoReturn, Optional, Text, Tuple, Union _File = Union[Text, BinaryIO] diff --git a/stdlib/2and3/weakref.pyi b/stdlib/2and3/weakref.pyi index e3ddbf27845e..e488e9854918 100644 --- a/stdlib/2and3/weakref.pyi +++ b/stdlib/2and3/weakref.pyi @@ -1,19 +1,31 @@ import sys import types +from _weakrefset import WeakSet as WeakSet from typing import ( - TypeVar, Generic, Any, Callable, overload, Mapping, Iterator, Tuple, - Iterable, Optional, Type, MutableMapping, Union, List, Dict + Any, + Callable, + Dict, + Generic, + Iterable, + Iterator, + List, + Mapping, + MutableMapping, + Optional, + Tuple, + Type, + TypeVar, + Union, + overload, ) -from _weakref import ( - getweakrefcount as getweakrefcount, - getweakrefs as getweakrefs, - ref as ref, - proxy as proxy, - CallableProxyType as CallableProxyType, - ProxyType as ProxyType, - ReferenceType as ReferenceType) -from _weakrefset import WeakSet as WeakSet +from _weakref import CallableProxyType as CallableProxyType +from _weakref import ProxyType as ProxyType +from _weakref import ReferenceType as ReferenceType +from _weakref import getweakrefcount as getweakrefcount +from _weakref import getweakrefs as getweakrefs +from _weakref import proxy as proxy +from _weakref import ref as ref if sys.version_info < (3, 0): from exceptions import ReferenceError as ReferenceError diff --git a/stdlib/2and3/webbrowser.pyi b/stdlib/2and3/webbrowser.pyi index 7d1b4cb68336..fb14c8f3005b 100644 --- a/stdlib/2and3/webbrowser.pyi +++ b/stdlib/2and3/webbrowser.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Optional, Callable, List, Text, Union, Sequence +from typing import Any, Callable, List, Optional, Sequence, Text, Union class Error(Exception): ... diff --git a/stdlib/2and3/wsgiref/handlers.pyi b/stdlib/2and3/wsgiref/handlers.pyi index 3271c881a289..ba148891945e 100644 --- a/stdlib/2and3/wsgiref/handlers.pyi +++ b/stdlib/2and3/wsgiref/handlers.pyi @@ -1,10 +1,10 @@ import sys from abc import abstractmethod from types import TracebackType -from typing import Optional, Dict, MutableMapping, Type, Text, Callable, List, Tuple, IO +from typing import IO, Callable, Dict, List, MutableMapping, Optional, Text, Tuple, Type from .headers import Headers -from .types import WSGIApplication, WSGIEnvironment, StartResponse, InputStream, ErrorStream +from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment from .util import FileWrapper, guess_scheme _exc_info = Tuple[Optional[Type[BaseException]], diff --git a/stdlib/2and3/wsgiref/headers.pyi b/stdlib/2and3/wsgiref/headers.pyi index 853922527b5b..c3e943200e40 100644 --- a/stdlib/2and3/wsgiref/headers.pyi +++ b/stdlib/2and3/wsgiref/headers.pyi @@ -1,5 +1,5 @@ import sys -from typing import overload, Pattern, Optional, List, Tuple +from typing import List, Optional, Pattern, Tuple, overload _HeaderList = List[Tuple[str, str]] diff --git a/stdlib/2and3/wsgiref/simple_server.pyi b/stdlib/2and3/wsgiref/simple_server.pyi index 50b8377e549e..1cd1943800a4 100644 --- a/stdlib/2and3/wsgiref/simple_server.pyi +++ b/stdlib/2and3/wsgiref/simple_server.pyi @@ -1,8 +1,8 @@ import sys -from typing import Optional, List, Type, TypeVar, overload +from typing import List, Optional, Type, TypeVar, overload from .handlers import SimpleHandler -from .types import WSGIApplication, WSGIEnvironment, StartResponse, ErrorStream +from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment if sys.version_info < (3,): from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer diff --git a/stdlib/2and3/wsgiref/types.pyi b/stdlib/2and3/wsgiref/types.pyi index 39a913eeada1..c05f51c26c2e 100644 --- a/stdlib/2and3/wsgiref/types.pyi +++ b/stdlib/2and3/wsgiref/types.pyi @@ -16,7 +16,7 @@ # hinting your code. Otherwise Python will raise NameErrors. from sys import _OptExcInfo -from typing import Callable, Dict, Iterable, List, Any, Text, Protocol, Tuple, Optional +from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol, Text, Tuple class StartResponse(Protocol): def __call__(self, status: str, headers: List[Tuple[str, str]], exc_info: Optional[_OptExcInfo] = ...) -> Callable[[bytes], Any]: ... diff --git a/stdlib/2and3/wsgiref/validate.pyi b/stdlib/2and3/wsgiref/validate.pyi index c7fa699fc1ee..233ae4a5c91a 100644 --- a/stdlib/2and3/wsgiref/validate.pyi +++ b/stdlib/2and3/wsgiref/validate.pyi @@ -1,7 +1,6 @@ import sys -from typing import Any, Iterable, Iterator, Optional, NoReturn, Callable - -from wsgiref.types import WSGIApplication, InputStream, ErrorStream +from typing import Any, Callable, Iterable, Iterator, NoReturn, Optional +from wsgiref.types import ErrorStream, InputStream, WSGIApplication class WSGIWarning(Warning): ... diff --git a/stdlib/2and3/xml/etree/ElementInclude.pyi b/stdlib/2and3/xml/etree/ElementInclude.pyi index e8c3cd5609fc..8ab3eb656af9 100644 --- a/stdlib/2and3/xml/etree/ElementInclude.pyi +++ b/stdlib/2and3/xml/etree/ElementInclude.pyi @@ -1,6 +1,6 @@ # Stubs for xml.etree.ElementInclude (Python 3.4) -from typing import Union, Optional, Callable +from typing import Callable, Optional, Union from xml.etree.ElementTree import Element XINCLUDE: str diff --git a/stdlib/2and3/xml/etree/ElementPath.pyi b/stdlib/2and3/xml/etree/ElementPath.pyi index 1477b329caf6..f397cb7fc0ed 100644 --- a/stdlib/2and3/xml/etree/ElementPath.pyi +++ b/stdlib/2and3/xml/etree/ElementPath.pyi @@ -1,6 +1,6 @@ # Stubs for xml.etree.ElementPath (Python 3.4) -from typing import Pattern, Dict, Generator, Tuple, List, Union, TypeVar, Callable, Optional +from typing import Callable, Dict, Generator, List, Optional, Pattern, Tuple, TypeVar, Union from xml.etree.ElementTree import Element xpath_tokenizer_re: Pattern diff --git a/stdlib/2and3/xml/etree/ElementTree.pyi b/stdlib/2and3/xml/etree/ElementTree.pyi index d5f64b67a96e..e4608f2477bb 100644 --- a/stdlib/2and3/xml/etree/ElementTree.pyi +++ b/stdlib/2and3/xml/etree/ElementTree.pyi @@ -1,8 +1,27 @@ # Stubs for xml.etree.ElementTree -from typing import Any, Callable, Dict, Generator, IO, ItemsView, Iterable, Iterator, KeysView, List, MutableSequence, Optional, overload, Sequence, Text, Tuple, TypeVar, Union import io import sys +from typing import ( + IO, + Any, + Callable, + Dict, + Generator, + ItemsView, + Iterable, + Iterator, + KeysView, + List, + MutableSequence, + Optional, + Sequence, + Text, + Tuple, + TypeVar, + Union, + overload, +) VERSION: str diff --git a/stdlib/2and3/xml/sax/__init__.pyi b/stdlib/2and3/xml/sax/__init__.pyi index 6edf12da86b4..e50c9a8fa726 100644 --- a/stdlib/2and3/xml/sax/__init__.pyi +++ b/stdlib/2and3/xml/sax/__init__.pyi @@ -1,8 +1,7 @@ -from typing import Any, List, NoReturn, Optional, Text, Union, IO - import xml.sax -from xml.sax.xmlreader import InputSource, Locator +from typing import IO, Any, List, NoReturn, Optional, Text, Union from xml.sax.handler import ContentHandler, ErrorHandler +from xml.sax.xmlreader import InputSource, Locator class SAXException(Exception): def __init__(self, msg: str, exception: Optional[Exception] = ...) -> None: ... diff --git a/stdlib/2and3/xml/sax/saxutils.pyi b/stdlib/2and3/xml/sax/saxutils.pyi index 342d6ed84815..120a26b0922f 100644 --- a/stdlib/2and3/xml/sax/saxutils.pyi +++ b/stdlib/2and3/xml/sax/saxutils.pyi @@ -1,8 +1,6 @@ import sys from typing import Mapping, Text - -from xml.sax import handler -from xml.sax import xmlreader +from xml.sax import handler, xmlreader def escape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... def unescape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ... diff --git a/stdlib/2and3/zipfile.pyi b/stdlib/2and3/zipfile.pyi index a06d3fd98928..bcd54faa6512 100644 --- a/stdlib/2and3/zipfile.pyi +++ b/stdlib/2and3/zipfile.pyi @@ -1,10 +1,9 @@ # Stubs for zipfile -from typing import Callable, Dict, IO, Iterable, List, Optional, Text, Tuple, Type, Union -from types import TracebackType import os import sys - +from types import TracebackType +from typing import IO, Callable, Dict, Iterable, List, Optional, Text, Tuple, Type, Union if sys.version_info >= (3, 6): _Path = Union[os.PathLike[Text], Text] diff --git a/stdlib/2and3/zipimport.pyi b/stdlib/2and3/zipimport.pyi index c22531a985bc..45c837954daf 100644 --- a/stdlib/2and3/zipimport.pyi +++ b/stdlib/2and3/zipimport.pyi @@ -1,7 +1,7 @@ """Stub file for the 'zipimport' module.""" -from typing import Optional from types import CodeType, ModuleType +from typing import Optional class ZipImportError(ImportError): ... diff --git a/stdlib/3.5/zipapp.pyi b/stdlib/3.5/zipapp.pyi index b90b7559ce1d..94971f8ace17 100644 --- a/stdlib/3.5/zipapp.pyi +++ b/stdlib/3.5/zipapp.pyi @@ -1,7 +1,7 @@ # Stubs for zipapp (Python 3.5+) -from pathlib import Path import sys +from pathlib import Path from typing import BinaryIO, Callable, Optional, Union _Path = Union[str, Path, BinaryIO] diff --git a/stdlib/3.6/secrets.pyi b/stdlib/3.6/secrets.pyi index 5069dba25c67..290d72246e65 100644 --- a/stdlib/3.6/secrets.pyi +++ b/stdlib/3.6/secrets.pyi @@ -1,8 +1,8 @@ # Stubs for secrets (Python 3.6) -from typing import Optional, Sequence, TypeVar from hmac import compare_digest as compare_digest from random import SystemRandom as SystemRandom +from typing import Optional, Sequence, TypeVar _T = TypeVar('_T') diff --git a/stdlib/3.7/dataclasses.pyi b/stdlib/3.7/dataclasses.pyi index f8bcd52634df..ec10fc4d65c2 100644 --- a/stdlib/3.7/dataclasses.pyi +++ b/stdlib/3.7/dataclasses.pyi @@ -1,5 +1,4 @@ -from typing import overload, Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union - +from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/3/_ast.pyi b/stdlib/3/_ast.pyi index 9f4284e64fa7..341547bf4056 100644 --- a/stdlib/3/_ast.pyi +++ b/stdlib/3/_ast.pyi @@ -1,6 +1,6 @@ import sys import typing -from typing import Any, Optional, ClassVar +from typing import Any, ClassVar, Optional PyCF_ONLY_AST: int diff --git a/stdlib/3/_compression.pyi b/stdlib/3/_compression.pyi index bf474e6b9270..10fca36e8735 100644 --- a/stdlib/3/_compression.pyi +++ b/stdlib/3/_compression.pyi @@ -1,5 +1,5 @@ -from typing import Any import io +from typing import Any BUFFER_SIZE: Any diff --git a/stdlib/3/_importlib_modulespec.pyi b/stdlib/3/_importlib_modulespec.pyi index 51cb48983dd3..d765e887cc92 100644 --- a/stdlib/3/_importlib_modulespec.pyi +++ b/stdlib/3/_importlib_modulespec.pyi @@ -7,8 +7,8 @@ # # _Loader is the PEP-451-defined interface for a loader type/object. -from abc import ABCMeta import sys +from abc import ABCMeta from typing import Any, Dict, List, Optional, Protocol class _Loader(Protocol): diff --git a/stdlib/3/_operator.pyi b/stdlib/3/_operator.pyi index 6d08cd7efaf9..9ecdd91ab96d 100644 --- a/stdlib/3/_operator.pyi +++ b/stdlib/3/_operator.pyi @@ -1,63 +1,61 @@ # Stubs for _operator (Python 3.5) import sys +# In reality the import is the other way around, but this way we can keep the operator stub in 2and3 +from operator import abs as abs +from operator import add as add +from operator import and_ as and_ +from operator import attrgetter as attrgetter +from operator import concat as concat +from operator import contains as contains +from operator import countOf as countOf +from operator import delitem as delitem +from operator import eq as eq +from operator import floordiv as floordiv +from operator import ge as ge +from operator import getitem as getitem +from operator import gt as gt +from operator import iadd as iadd +from operator import iand as iand +from operator import iconcat as iconcat +from operator import ifloordiv as ifloordiv +from operator import ilshift as ilshift +from operator import imod as imod +from operator import imul as imul +from operator import index as index +from operator import indexOf as indexOf +from operator import inv as inv +from operator import invert as invert +from operator import ior as ior +from operator import ipow as ipow +from operator import irshift as irshift +from operator import is_ as is_ +from operator import is_not as is_not +from operator import isub as isub +from operator import itemgetter as itemgetter +from operator import itruediv as itruediv +from operator import ixor as ixor +from operator import le as le +from operator import length_hint as length_hint +from operator import lshift as lshift +from operator import lt as lt +from operator import methodcaller as methodcaller +from operator import mod as mod +from operator import mul as mul +from operator import ne as ne +from operator import neg as neg +from operator import not_ as not_ +from operator import or_ as or_ +from operator import pos as pos +from operator import pow as pow +from operator import rshift as rshift +from operator import setitem as setitem +from operator import sub as sub +from operator import truediv as truediv +from operator import truth as truth +from operator import xor as xor from typing import AnyStr -# In reality the import is the other way around, but this way we can keep the operator stub in 2and3 -from operator import ( - truth as truth, - contains as contains, - indexOf as indexOf, - countOf as countOf, - is_ as is_, - is_not as is_not, - index as index, - add as add, - sub as sub, - mul as mul, - floordiv as floordiv, - truediv as truediv, - mod as mod, - neg as neg, - pos as pos, - abs as abs, - inv as inv, - invert as invert, - length_hint as length_hint, - lshift as lshift, - rshift as rshift, - not_ as not_, - and_ as and_, - xor as xor, - or_ as or_, - iadd as iadd, - isub as isub, - imul as imul, - ifloordiv as ifloordiv, - itruediv as itruediv, - imod as imod, - ilshift as ilshift, - irshift as irshift, - iand as iand, - ixor as ixor, - ior as ior, - concat as concat, - iconcat as iconcat, - getitem as getitem, - setitem as setitem, - delitem as delitem, - pow as pow, - ipow as ipow, - eq as eq, - ne as ne, - lt as lt, - le as le, - gt as gt, - ge as ge, - itemgetter as itemgetter, - attrgetter as attrgetter, - methodcaller as methodcaller, -) if sys.version_info >= (3, 5): from operator import matmul as matmul, imatmul as imatmul diff --git a/stdlib/3/_posixsubprocess.pyi b/stdlib/3/_posixsubprocess.pyi index 67b7d7cc5634..49fcbb7f5685 100644 --- a/stdlib/3/_posixsubprocess.pyi +++ b/stdlib/3/_posixsubprocess.pyi @@ -2,7 +2,7 @@ # NOTE: These are incomplete! -from typing import Tuple, Sequence, Callable +from typing import Callable, Sequence, Tuple def cloexec_pipe() -> Tuple[int, int]: ... def fork_exec(args: Sequence[str], diff --git a/stdlib/3/_subprocess.pyi b/stdlib/3/_subprocess.pyi index 76967b94bcbb..a58b16f92fff 100644 --- a/stdlib/3/_subprocess.pyi +++ b/stdlib/3/_subprocess.pyi @@ -2,7 +2,7 @@ # NOTE: These are incomplete! -from typing import Mapping, Any, Tuple +from typing import Any, Mapping, Tuple CREATE_NEW_CONSOLE = 0 CREATE_NEW_PROCESS_GROUP = 0 diff --git a/stdlib/3/_winapi.pyi b/stdlib/3/_winapi.pyi index af6c9231b05c..3a6d5436ad2a 100644 --- a/stdlib/3/_winapi.pyi +++ b/stdlib/3/_winapi.pyi @@ -1,4 +1,4 @@ -from typing import Any, Union, Tuple, Optional, overload, Dict, NoReturn, Sequence +from typing import Any, Dict, NoReturn, Optional, Sequence, Tuple, Union, overload CREATE_NEW_CONSOLE: int CREATE_NEW_PROCESS_GROUP: int diff --git a/stdlib/3/abc.pyi b/stdlib/3/abc.pyi index e9c530d20f83..49a1c8a04590 100644 --- a/stdlib/3/abc.pyi +++ b/stdlib/3/abc.pyi @@ -1,4 +1,5 @@ from typing import Any, Callable, Type, TypeVar + # Stubs for abc. _T = TypeVar('_T') diff --git a/stdlib/3/ast.pyi b/stdlib/3/ast.pyi index 090d5f8aec84..b13e82306b46 100644 --- a/stdlib/3/ast.pyi +++ b/stdlib/3/ast.pyi @@ -5,12 +5,8 @@ import sys # from _ast below when loaded in an unorthodox way by the Dropbox # internal Bazel integration. import typing as _typing -from typing import Any, Iterator, Optional, Union, TypeVar +from typing import Any, Iterator, Optional, TypeVar, Union -# The same unorthodox Bazel integration causes issues with sys, which -# is imported in both modules. unfortunately we can't just rename sys, -# since mypy only supports version checks with a sys that is named -# sys. from _ast import * # type: ignore class NodeVisitor(): diff --git a/stdlib/3/asyncio/__init__.pyi b/stdlib/3/asyncio/__init__.pyi index b98c2d1c8bd6..f919622b1ab0 100644 --- a/stdlib/3/asyncio/__init__.pyi +++ b/stdlib/3/asyncio/__init__.pyi @@ -1,88 +1,67 @@ import sys -from typing import List, Type - -from asyncio.coroutines import ( - coroutine as coroutine, - iscoroutinefunction as iscoroutinefunction, - iscoroutine as iscoroutine, -) -from asyncio.protocols import ( - BaseProtocol as BaseProtocol, - Protocol as Protocol, - DatagramProtocol as DatagramProtocol, - SubprocessProtocol as SubprocessProtocol, -) -from asyncio.streams import ( - StreamReader as StreamReader, - StreamWriter as StreamWriter, - StreamReaderProtocol as StreamReaderProtocol, - open_connection as open_connection, - start_server as start_server, - IncompleteReadError as IncompleteReadError, - LimitOverrunError as LimitOverrunError, -) -from asyncio.subprocess import ( - create_subprocess_exec as create_subprocess_exec, - create_subprocess_shell as create_subprocess_shell, -) -from asyncio.transports import ( - BaseTransport as BaseTransport, - ReadTransport as ReadTransport, - WriteTransport as WriteTransport, - Transport as Transport, - DatagramTransport as DatagramTransport, - SubprocessTransport as SubprocessTransport, -) -from asyncio.futures import ( - Future as Future, - CancelledError as CancelledError, - TimeoutError as TimeoutError, - InvalidStateError as InvalidStateError, - wrap_future as wrap_future, -) -from asyncio.tasks import ( - FIRST_COMPLETED as FIRST_COMPLETED, - FIRST_EXCEPTION as FIRST_EXCEPTION, - ALL_COMPLETED as ALL_COMPLETED, - as_completed as as_completed, - ensure_future as ensure_future, - gather as gather, - run_coroutine_threadsafe as run_coroutine_threadsafe, - shield as shield, - sleep as sleep, - wait as wait, - wait_for as wait_for, - Task as Task, -) from asyncio.base_events import BaseEventLoop as BaseEventLoop -from asyncio.events import ( - AbstractEventLoopPolicy as AbstractEventLoopPolicy, - AbstractEventLoop as AbstractEventLoop, - AbstractServer as AbstractServer, - Handle as Handle, - TimerHandle as TimerHandle, - get_event_loop_policy as get_event_loop_policy, - set_event_loop_policy as set_event_loop_policy, - get_event_loop as get_event_loop, - set_event_loop as set_event_loop, - new_event_loop as new_event_loop, - get_child_watcher as get_child_watcher, - set_child_watcher as set_child_watcher, -) -from asyncio.queues import ( - Queue as Queue, - PriorityQueue as PriorityQueue, - LifoQueue as LifoQueue, - QueueFull as QueueFull, - QueueEmpty as QueueEmpty, -) -from asyncio.locks import ( - Lock as Lock, - Event as Event, - Condition as Condition, - Semaphore as Semaphore, - BoundedSemaphore as BoundedSemaphore, -) +from asyncio.coroutines import coroutine as coroutine +from asyncio.coroutines import iscoroutine as iscoroutine +from asyncio.coroutines import iscoroutinefunction as iscoroutinefunction +from asyncio.events import AbstractEventLoop as AbstractEventLoop +from asyncio.events import AbstractEventLoopPolicy as AbstractEventLoopPolicy +from asyncio.events import AbstractServer as AbstractServer +from asyncio.events import Handle as Handle +from asyncio.events import TimerHandle as TimerHandle +from asyncio.events import get_child_watcher as get_child_watcher +from asyncio.events import get_event_loop as get_event_loop +from asyncio.events import get_event_loop_policy as get_event_loop_policy +from asyncio.events import new_event_loop as new_event_loop +from asyncio.events import set_child_watcher as set_child_watcher +from asyncio.events import set_event_loop as set_event_loop +from asyncio.events import set_event_loop_policy as set_event_loop_policy +from asyncio.futures import CancelledError as CancelledError +from asyncio.futures import Future as Future +from asyncio.futures import InvalidStateError as InvalidStateError +from asyncio.futures import TimeoutError as TimeoutError +from asyncio.futures import wrap_future as wrap_future +from asyncio.locks import BoundedSemaphore as BoundedSemaphore +from asyncio.locks import Condition as Condition +from asyncio.locks import Event as Event +from asyncio.locks import Lock as Lock +from asyncio.locks import Semaphore as Semaphore +from asyncio.protocols import BaseProtocol as BaseProtocol +from asyncio.protocols import DatagramProtocol as DatagramProtocol +from asyncio.protocols import Protocol as Protocol +from asyncio.protocols import SubprocessProtocol as SubprocessProtocol +from asyncio.queues import LifoQueue as LifoQueue +from asyncio.queues import PriorityQueue as PriorityQueue +from asyncio.queues import Queue as Queue +from asyncio.queues import QueueEmpty as QueueEmpty +from asyncio.queues import QueueFull as QueueFull +from asyncio.streams import IncompleteReadError as IncompleteReadError +from asyncio.streams import LimitOverrunError as LimitOverrunError +from asyncio.streams import StreamReader as StreamReader +from asyncio.streams import StreamReaderProtocol as StreamReaderProtocol +from asyncio.streams import StreamWriter as StreamWriter +from asyncio.streams import open_connection as open_connection +from asyncio.streams import start_server as start_server +from asyncio.subprocess import create_subprocess_exec as create_subprocess_exec +from asyncio.subprocess import create_subprocess_shell as create_subprocess_shell +from asyncio.tasks import ALL_COMPLETED as ALL_COMPLETED +from asyncio.tasks import FIRST_COMPLETED as FIRST_COMPLETED +from asyncio.tasks import FIRST_EXCEPTION as FIRST_EXCEPTION +from asyncio.tasks import Task as Task +from asyncio.tasks import as_completed as as_completed +from asyncio.tasks import ensure_future as ensure_future +from asyncio.tasks import gather as gather +from asyncio.tasks import run_coroutine_threadsafe as run_coroutine_threadsafe +from asyncio.tasks import shield as shield +from asyncio.tasks import sleep as sleep +from asyncio.tasks import wait as wait +from asyncio.tasks import wait_for as wait_for +from asyncio.transports import BaseTransport as BaseTransport +from asyncio.transports import DatagramTransport as DatagramTransport +from asyncio.transports import ReadTransport as ReadTransport +from asyncio.transports import SubprocessTransport as SubprocessTransport +from asyncio.transports import Transport as Transport +from asyncio.transports import WriteTransport as WriteTransport +from typing import List, Type if sys.version_info < (3, 5): from asyncio.queues import JoinableQueue as JoinableQueue diff --git a/stdlib/3/asyncio/base_events.pyi b/stdlib/3/asyncio/base_events.pyi index 2262a67f8b3c..658396443d79 100644 --- a/stdlib/3/asyncio/base_events.pyi +++ b/stdlib/3/asyncio/base_events.pyi @@ -1,14 +1,14 @@ import selectors -from socket import socket import ssl import sys -from typing import Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload -from asyncio.futures import Future from asyncio.coroutines import coroutine from asyncio.events import AbstractEventLoop, AbstractServer, Handle, TimerHandle +from asyncio.futures import Future from asyncio.protocols import BaseProtocol from asyncio.tasks import Task from asyncio.transports import BaseTransport +from socket import socket +from typing import Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload _T = TypeVar('_T') _Context = Dict[str, Any] diff --git a/stdlib/3/asyncio/events.pyi b/stdlib/3/asyncio/events.pyi index c81d027efc32..e8490d137bb6 100644 --- a/stdlib/3/asyncio/events.pyi +++ b/stdlib/3/asyncio/events.pyi @@ -1,14 +1,14 @@ import selectors -from socket import socket import ssl import sys -from typing import Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload from abc import ABCMeta, abstractmethod -from asyncio.futures import Future from asyncio.coroutines import coroutine +from asyncio.futures import Future from asyncio.protocols import BaseProtocol from asyncio.tasks import Task from asyncio.transports import BaseTransport +from socket import socket +from typing import Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload __all__: List[str] diff --git a/stdlib/3/asyncio/futures.pyi b/stdlib/3/asyncio/futures.pyi index ed2e4a0c951c..49d708fde890 100644 --- a/stdlib/3/asyncio/futures.pyi +++ b/stdlib/3/asyncio/futures.pyi @@ -1,12 +1,11 @@ import sys -from typing import Any, Union, Callable, TypeVar, Type, List, Generic, Iterable, Generator, Awaitable, Optional, Tuple +from concurrent.futures import CancelledError as CancelledError +from concurrent.futures import Error +from concurrent.futures import Future as _ConcurrentFuture +from concurrent.futures import TimeoutError as TimeoutError +from typing import Any, Awaitable, Callable, Generator, Generic, Iterable, List, Optional, Tuple, Type, TypeVar, Union + from .events import AbstractEventLoop -from concurrent.futures import ( - CancelledError as CancelledError, - TimeoutError as TimeoutError, - Future as _ConcurrentFuture, - Error, -) if sys.version_info >= (3, 7): from contextvars import Context diff --git a/stdlib/3/asyncio/locks.pyi b/stdlib/3/asyncio/locks.pyi index 56b8a672718a..189c4241b00d 100644 --- a/stdlib/3/asyncio/locks.pyi +++ b/stdlib/3/asyncio/locks.pyi @@ -1,9 +1,9 @@ -from typing import Any, Callable, Generator, Iterable, Iterator, List, Type, TypeVar, Union, Optional, Awaitable +from types import TracebackType +from typing import Any, Awaitable, Callable, Generator, Iterable, Iterator, List, Optional, Type, TypeVar, Union from .coroutines import coroutine from .events import AbstractEventLoop from .futures import Future -from types import TracebackType _T = TypeVar('_T') diff --git a/stdlib/3/asyncio/queues.pyi b/stdlib/3/asyncio/queues.pyi index dc4e9efa1f83..ddc93c5f9bea 100644 --- a/stdlib/3/asyncio/queues.pyi +++ b/stdlib/3/asyncio/queues.pyi @@ -1,8 +1,9 @@ import sys from asyncio.events import AbstractEventLoop +from typing import Any, Generator, Generic, List, Optional, TypeVar + from .coroutines import coroutine from .futures import Future -from typing import Any, Generator, Generic, List, TypeVar, Optional __all__: List[str] diff --git a/stdlib/3/asyncio/runners.pyi b/stdlib/3/asyncio/runners.pyi index 7d8c28c0d7d4..581c9fb3c74a 100644 --- a/stdlib/3/asyncio/runners.pyi +++ b/stdlib/3/asyncio/runners.pyi @@ -1,6 +1,5 @@ import sys - if sys.version_info >= (3, 7): from typing import Awaitable, TypeVar diff --git a/stdlib/3/asyncio/streams.pyi b/stdlib/3/asyncio/streams.pyi index 68271c0fe2a1..d9bd60814edf 100644 --- a/stdlib/3/asyncio/streams.pyi +++ b/stdlib/3/asyncio/streams.pyi @@ -1,10 +1,7 @@ import sys from typing import Any, Awaitable, Callable, Generator, Iterable, List, Optional, Tuple, Union -from . import coroutines -from . import events -from . import protocols -from . import transports +from . import coroutines, events, protocols, transports _ClientConnectedCallback = Callable[[StreamReader, StreamWriter], Optional[Awaitable[None]]] diff --git a/stdlib/3/asyncio/subprocess.pyi b/stdlib/3/asyncio/subprocess.pyi index 46ed30212ab3..b014f3d845a3 100644 --- a/stdlib/3/asyncio/subprocess.pyi +++ b/stdlib/3/asyncio/subprocess.pyi @@ -1,9 +1,6 @@ -from asyncio import events -from asyncio import protocols -from asyncio import streams -from asyncio import transports +from asyncio import events, protocols, streams, transports from asyncio.coroutines import coroutine -from typing import Any, Generator, List, Optional, Text, Tuple, Union, IO +from typing import IO, Any, Generator, List, Optional, Text, Tuple, Union __all__: List[str] diff --git a/stdlib/3/asyncio/tasks.pyi b/stdlib/3/asyncio/tasks.pyi index ef657aab1248..518466ae1e3f 100644 --- a/stdlib/3/asyncio/tasks.pyi +++ b/stdlib/3/asyncio/tasks.pyi @@ -1,9 +1,27 @@ import concurrent.futures import sys -from typing import (Any, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable, - Coroutine, Generator, Iterable, Awaitable, overload, Sequence, Iterator, - Optional) from types import FrameType +from typing import ( + Any, + Awaitable, + Callable, + Coroutine, + Dict, + Generator, + Generic, + Iterable, + Iterator, + List, + Optional, + Sequence, + Set, + TextIO, + Tuple, + TypeVar, + Union, + overload, +) + from .events import AbstractEventLoop from .futures import Future diff --git a/stdlib/3/asyncio/transports.pyi b/stdlib/3/asyncio/transports.pyi index 9ea6688d7593..441fa5047d2e 100644 --- a/stdlib/3/asyncio/transports.pyi +++ b/stdlib/3/asyncio/transports.pyi @@ -1,4 +1,4 @@ -from typing import Dict, Any, TypeVar, Mapping, List, Optional, Tuple +from typing import Any, Dict, List, Mapping, Optional, Tuple, TypeVar __all__: List[str] diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 524ff6f8f4e3..6eb5c4efa52d 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -1,34 +1,36 @@ # These are not exported. import sys import typing -from typing import ( - TypeVar, Generic, Dict, overload, List, Tuple, - Any, Type, Optional, Union -) +from typing import AbstractSet as Set +from typing import Any +from typing import ByteString as ByteString +from typing import Callable as Callable +from typing import Container as Container +from typing import Dict +from typing import Generator as Generator +from typing import Generic +from typing import Hashable as Hashable +from typing import ItemsView as ItemsView +from typing import Iterable as Iterable +from typing import Iterator as Iterator +from typing import KeysView as KeysView +from typing import List +from typing import Mapping as Mapping +from typing import MappingView as MappingView +from typing import MutableMapping as MutableMapping +from typing import MutableSequence as MutableSequence +from typing import MutableSet as MutableSet +from typing import Optional +from typing import Reversible as Reversible +from typing import Sequence as Sequence +from typing import Sized as Sized +from typing import Tuple, Type, TypeVar, Union +from typing import ValuesView as ValuesView +from typing import overload + # These are exported. from . import abc -from typing import ( - Callable as Callable, - Container as Container, - Hashable as Hashable, - Iterable as Iterable, - Iterator as Iterator, - Sized as Sized, - Generator as Generator, - ByteString as ByteString, - Reversible as Reversible, - Mapping as Mapping, - MappingView as MappingView, - ItemsView as ItemsView, - KeysView as KeysView, - ValuesView as ValuesView, - MutableMapping as MutableMapping, - Sequence as Sequence, - MutableSequence as MutableSequence, - MutableSet as MutableSet, - AbstractSet as Set, -) if sys.version_info >= (3, 6): from typing import ( Collection as Collection, diff --git a/stdlib/3/collections/abc.pyi b/stdlib/3/collections/abc.pyi index a9577285ce81..8c45a0c02120 100644 --- a/stdlib/3/collections/abc.pyi +++ b/stdlib/3/collections/abc.pyi @@ -3,24 +3,22 @@ # https://docs.python.org/3.3/whatsnew/3.3.html#collections import sys -from . import ( - Container as Container, - Hashable as Hashable, - Iterable as Iterable, - Iterator as Iterator, - Sized as Sized, - Callable as Callable, - Mapping as Mapping, - MutableMapping as MutableMapping, - Sequence as Sequence, - MutableSequence as MutableSequence, - Set as Set, - MutableSet as MutableSet, - MappingView as MappingView, - ItemsView as ItemsView, - KeysView as KeysView, - ValuesView as ValuesView, -) +from . import Callable as Callable +from . import Container as Container +from . import Hashable as Hashable +from . import ItemsView as ItemsView +from . import Iterable as Iterable +from . import Iterator as Iterator +from . import KeysView as KeysView +from . import Mapping as Mapping +from . import MappingView as MappingView +from . import MutableMapping as MutableMapping +from . import MutableSequence as MutableSequence +from . import MutableSet as MutableSet +from . import Sequence as Sequence +from . import Set as Set +from . import Sized as Sized +from . import ValuesView as ValuesView if sys.version_info >= (3, 5): from . import ( diff --git a/stdlib/3/compileall.pyi b/stdlib/3/compileall.pyi index 8d2731c05ed9..b3761f1805a4 100644 --- a/stdlib/3/compileall.pyi +++ b/stdlib/3/compileall.pyi @@ -2,7 +2,7 @@ import os import sys -from typing import Optional, Union, Pattern +from typing import Optional, Pattern, Union if sys.version_info < (3, 6): _Path = Union[str, bytes] diff --git a/stdlib/3/concurrent/futures/__init__.pyi b/stdlib/3/concurrent/futures/__init__.pyi index 4439dcadb523..cde4120b2a78 100644 --- a/stdlib/3/concurrent/futures/__init__.pyi +++ b/stdlib/3/concurrent/futures/__init__.pyi @@ -1,3 +1,3 @@ from ._base import * # noqa: F403 -from .thread import * # noqa: F403 from .process import * # noqa: F403 +from .thread import * # noqa: F403 diff --git a/stdlib/3/concurrent/futures/_base.pyi b/stdlib/3/concurrent/futures/_base.pyi index 95189a741199..1c1695784387 100644 --- a/stdlib/3/concurrent/futures/_base.pyi +++ b/stdlib/3/concurrent/futures/_base.pyi @@ -1,6 +1,6 @@ -from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple, Optional, Set, NamedTuple -from types import TracebackType import sys +from types import TracebackType +from typing import Any, Callable, Generic, Iterable, Iterator, NamedTuple, Optional, Set, Tuple, TypeVar FIRST_COMPLETED: str FIRST_EXCEPTION: str diff --git a/stdlib/3/concurrent/futures/process.pyi b/stdlib/3/concurrent/futures/process.pyi index ba0cd61a6170..f5d3e0f4b479 100644 --- a/stdlib/3/concurrent/futures/process.pyi +++ b/stdlib/3/concurrent/futures/process.pyi @@ -1,6 +1,7 @@ -from typing import Any, Callable, Optional, Tuple -from ._base import Future, Executor import sys +from typing import Any, Callable, Optional, Tuple + +from ._base import Executor, Future EXTRA_QUEUED_CALLS: Any diff --git a/stdlib/3/concurrent/futures/thread.pyi b/stdlib/3/concurrent/futures/thread.pyi index 983594dc728f..44dac203675b 100644 --- a/stdlib/3/concurrent/futures/thread.pyi +++ b/stdlib/3/concurrent/futures/thread.pyi @@ -1,6 +1,7 @@ +import sys from typing import Any, Callable, Optional, Tuple + from ._base import Executor, Future -import sys class ThreadPoolExecutor(Executor): if sys.version_info >= (3, 7): diff --git a/stdlib/3/configparser.pyi b/stdlib/3/configparser.pyi index 17501c1e9e6c..f7cb01b4910c 100644 --- a/stdlib/3/configparser.pyi +++ b/stdlib/3/configparser.pyi @@ -2,11 +2,27 @@ # reading configparser.py. import sys -from typing import (AbstractSet, MutableMapping, Mapping, Dict, Sequence, List, - Union, Iterable, Iterator, Callable, Any, IO, overload, - Optional, Pattern, Type, TypeVar) # Types only used in type comments only -from typing import Optional, Tuple # noqa +from typing import ( # noqa + IO, + AbstractSet, + Any, + Callable, + Dict, + Iterable, + Iterator, + List, + Mapping, + MutableMapping, + Optional, + Pattern, + Sequence, + Tuple, + Type, + TypeVar, + Union, + overload, +) if sys.version_info >= (3, 6): from os import PathLike diff --git a/stdlib/3/email/__init__.pyi b/stdlib/3/email/__init__.pyi index ec7c25bd4b69..4660a47ca6a4 100644 --- a/stdlib/3/email/__init__.pyi +++ b/stdlib/3/email/__init__.pyi @@ -1,9 +1,9 @@ # Stubs for email (Python 3.4) -from typing import Callable, Optional, IO import sys from email.message import Message from email.policy import Policy +from typing import IO, Callable, Optional def message_from_string(s: str, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... def message_from_bytes(s: bytes, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ... diff --git a/stdlib/3/email/charset.pyi b/stdlib/3/email/charset.pyi index 3a6c19d1b91b..6c912d432243 100644 --- a/stdlib/3/email/charset.pyi +++ b/stdlib/3/email/charset.pyi @@ -1,6 +1,6 @@ # Stubs for email.charset (Python 3.4) -from typing import List, Optional, Iterator, Any +from typing import Any, Iterator, List, Optional QP: int # undocumented BASE64: int # undocumented diff --git a/stdlib/3/email/contentmanager.pyi b/stdlib/3/email/contentmanager.pyi index ed55ef67dccd..460c36419a6b 100644 --- a/stdlib/3/email/contentmanager.pyi +++ b/stdlib/3/email/contentmanager.pyi @@ -1,7 +1,7 @@ # Stubs for email.contentmanager (Python 3.4) -from typing import Any, Callable from email.message import Message +from typing import Any, Callable class ContentManager: def __init__(self) -> None: ... diff --git a/stdlib/3/email/feedparser.pyi b/stdlib/3/email/feedparser.pyi index 48d940b3987d..313060dd7323 100644 --- a/stdlib/3/email/feedparser.pyi +++ b/stdlib/3/email/feedparser.pyi @@ -1,9 +1,9 @@ # Stubs for email.feedparser (Python 3.4) -from typing import Callable import sys from email.message import Message from email.policy import Policy +from typing import Callable class FeedParser: def __init__(self, _factory: Callable[[], Message] = ..., *, diff --git a/stdlib/3/email/generator.pyi b/stdlib/3/email/generator.pyi index 81e733b7a960..97eaff96f735 100644 --- a/stdlib/3/email/generator.pyi +++ b/stdlib/3/email/generator.pyi @@ -1,8 +1,8 @@ # Stubs for email.generator (Python 3.4) -from typing import TextIO, Optional from email.message import Message from email.policy import Policy +from typing import Optional, TextIO class Generator: def clone(self, fp: TextIO) -> Generator: ... diff --git a/stdlib/3/email/header.pyi b/stdlib/3/email/header.pyi index 21b999530154..8dc3f608acbb 100644 --- a/stdlib/3/email/header.pyi +++ b/stdlib/3/email/header.pyi @@ -1,7 +1,7 @@ # Stubs for email.header (Python 3.4) -from typing import Union, Optional, Any, List, Tuple from email.charset import Charset +from typing import Any, List, Optional, Tuple, Union class Header: def __init__(self, s: Union[bytes, str, None] = ..., diff --git a/stdlib/3/email/headerregistry.pyi b/stdlib/3/email/headerregistry.pyi index 6af1abfb517f..40822fab95b7 100644 --- a/stdlib/3/email/headerregistry.pyi +++ b/stdlib/3/email/headerregistry.pyi @@ -1,9 +1,9 @@ # Stubs for email.headerregistry (Python 3.4) from datetime import datetime as _datetime -from typing import Dict, Tuple, Optional, Any, Union, Mapping from email.errors import MessageDefect from email.policy import Policy +from typing import Any, Dict, Mapping, Optional, Tuple, Union class BaseHeader(str): @property diff --git a/stdlib/3/email/iterators.pyi b/stdlib/3/email/iterators.pyi index 6a69f39c9518..c07b69c16c76 100644 --- a/stdlib/3/email/iterators.pyi +++ b/stdlib/3/email/iterators.pyi @@ -1,7 +1,7 @@ # Stubs for email.iterators (Python 3.4) -from typing import Iterator, Optional from email.message import Message +from typing import Iterator, Optional def body_line_iterator(msg: Message, decode: bool = ...) -> Iterator[str]: ... def typed_subpart_iterator(msg: Message, maintype: str = ..., diff --git a/stdlib/3/email/message.pyi b/stdlib/3/email/message.pyi index 09fbdda7a38b..61f2bd08f9c2 100644 --- a/stdlib/3/email/message.pyi +++ b/stdlib/3/email/message.pyi @@ -1,14 +1,12 @@ # Stubs for email.message (Python 3.4) -from typing import ( - List, Optional, Union, Tuple, TypeVar, Generator, Sequence, Iterator, Any -) import sys from email.charset import Charset +from email.contentmanager import ContentManager from email.errors import MessageDefect from email.header import Header from email.policy import Policy -from email.contentmanager import ContentManager +from typing import Any, Generator, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union _T = TypeVar('_T') diff --git a/stdlib/3/email/mime/application.pyi b/stdlib/3/email/mime/application.pyi index 1a40e281f447..2817b786d907 100644 --- a/stdlib/3/email/mime/application.pyi +++ b/stdlib/3/email/mime/application.pyi @@ -1,7 +1,7 @@ # Stubs for email.mime.application (Python 3.4) -from typing import Callable, Optional, Tuple, Union from email.mime.nonmultipart import MIMENonMultipart +from typing import Callable, Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] diff --git a/stdlib/3/email/mime/audio.pyi b/stdlib/3/email/mime/audio.pyi index 5bb57d3a5d7a..4fb01f5ed40b 100644 --- a/stdlib/3/email/mime/audio.pyi +++ b/stdlib/3/email/mime/audio.pyi @@ -1,7 +1,7 @@ # Stubs for email.mime.audio (Python 3.4) -from typing import Callable, Optional, Tuple, Union from email.mime.nonmultipart import MIMENonMultipart +from typing import Callable, Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] diff --git a/stdlib/3/email/mime/base.pyi b/stdlib/3/email/mime/base.pyi index 448d34be1481..8a0470bdbb4e 100644 --- a/stdlib/3/email/mime/base.pyi +++ b/stdlib/3/email/mime/base.pyi @@ -1,7 +1,7 @@ # Stubs for email.mime.base (Python 3.4) -from typing import Optional, Tuple, Union import email.message +from typing import Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] diff --git a/stdlib/3/email/mime/image.pyi b/stdlib/3/email/mime/image.pyi index d32d9ee650fc..c3ae502d3d2a 100644 --- a/stdlib/3/email/mime/image.pyi +++ b/stdlib/3/email/mime/image.pyi @@ -1,7 +1,7 @@ # Stubs for email.mime.image (Python 3.4) -from typing import Callable, Optional, Tuple, Union from email.mime.nonmultipart import MIMENonMultipart +from typing import Callable, Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] diff --git a/stdlib/3/email/mime/multipart.pyi b/stdlib/3/email/mime/multipart.pyi index ea5eba15eb33..f1434b24d241 100644 --- a/stdlib/3/email/mime/multipart.pyi +++ b/stdlib/3/email/mime/multipart.pyi @@ -1,8 +1,8 @@ # Stubs for email.mime.multipart (Python 3.4) -from typing import Optional, Sequence, Tuple, Union from email.message import Message from email.mime.base import MIMEBase +from typing import Optional, Sequence, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] diff --git a/stdlib/3/email/mime/text.pyi b/stdlib/3/email/mime/text.pyi index 73adaf5f6aa8..c5519ccd230b 100644 --- a/stdlib/3/email/mime/text.pyi +++ b/stdlib/3/email/mime/text.pyi @@ -1,7 +1,7 @@ # Stubs for email.mime.text (Python 3.4) -from typing import Optional from email.mime.nonmultipart import MIMENonMultipart +from typing import Optional class MIMEText(MIMENonMultipart): def __init__(self, _text: str, _subtype: str = ..., diff --git a/stdlib/3/email/policy.pyi b/stdlib/3/email/policy.pyi index e47e643f90af..a56d9d8eaaef 100644 --- a/stdlib/3/email/policy.pyi +++ b/stdlib/3/email/policy.pyi @@ -1,12 +1,12 @@ # Stubs for email.policy (Python 3.4) -from abc import abstractmethod -from typing import Any, List, Optional, Tuple, Union, Callable import sys -from email.message import Message +from abc import abstractmethod +from email.contentmanager import ContentManager from email.errors import MessageDefect from email.header import Header -from email.contentmanager import ContentManager +from email.message import Message +from typing import Any, Callable, List, Optional, Tuple, Union class Policy: max_line_length: Optional[int] diff --git a/stdlib/3/email/utils.pyi b/stdlib/3/email/utils.pyi index 6c0a18319759..61c90b33ae6e 100644 --- a/stdlib/3/email/utils.pyi +++ b/stdlib/3/email/utils.pyi @@ -1,8 +1,8 @@ # Stubs for email.utils (Python 3.4) -from typing import List, Optional, Tuple, Union -from email.charset import Charset import datetime +from email.charset import Charset +from typing import List, Optional, Tuple, Union _ParamType = Union[str, Tuple[Optional[str], Optional[str], str]] _PDTZ = Tuple[int, int, int, int, int, int, int, int, int, Optional[int]] diff --git a/stdlib/3/encodings/__init__.pyi b/stdlib/3/encodings/__init__.pyi index 2ae6c0a9351d..2c8884112d2f 100644 --- a/stdlib/3/encodings/__init__.pyi +++ b/stdlib/3/encodings/__init__.pyi @@ -1,5 +1,4 @@ import codecs - import typing def search_function(encoding: str) -> codecs.CodecInfo: diff --git a/stdlib/3/enum.pyi b/stdlib/3/enum.pyi index 703c7cfa8be3..b472bfa3ce39 100644 --- a/stdlib/3/enum.pyi +++ b/stdlib/3/enum.pyi @@ -1,7 +1,7 @@ # NB: third_party/2/enum.pyi and stdlib/3.4/enum.pyi must remain consistent! import sys -from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union from abc import ABCMeta +from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union _T = TypeVar('_T') _S = TypeVar('_S', bound=Type[Enum]) diff --git a/stdlib/3/faulthandler.pyi b/stdlib/3/faulthandler.pyi index 1a87c9cf9e8c..b60f57896d67 100644 --- a/stdlib/3/faulthandler.pyi +++ b/stdlib/3/faulthandler.pyi @@ -1,6 +1,5 @@ import sys -from typing import Union, Protocol - +from typing import Protocol, Union class _HasFileno(Protocol): def fileno(self) -> int: ... diff --git a/stdlib/3/fcntl.pyi b/stdlib/3/fcntl.pyi index fdcb4fcf84c1..a2593f119ac4 100644 --- a/stdlib/3/fcntl.pyi +++ b/stdlib/3/fcntl.pyi @@ -1,6 +1,6 @@ # Stubs for fcntl from io import IOBase -from typing import Any, IO, Union +from typing import IO, Any, Union FASYNC: int FD_CLOEXEC: int diff --git a/stdlib/3/fnmatch.pyi b/stdlib/3/fnmatch.pyi index 4f99b4aafd6d..8f534753e774 100644 --- a/stdlib/3/fnmatch.pyi +++ b/stdlib/3/fnmatch.pyi @@ -3,7 +3,7 @@ # Based on http://docs.python.org/3.2/library/fnmatch.html and # python-lib/fnmatch.py -from typing import Iterable, List, AnyStr +from typing import AnyStr, Iterable, List def fnmatch(name: AnyStr, pat: AnyStr) -> bool: ... def fnmatchcase(name: AnyStr, pat: AnyStr) -> bool: ... diff --git a/stdlib/3/functools.pyi b/stdlib/3/functools.pyi index 409e84b3c466..5cf9640a4334 100644 --- a/stdlib/3/functools.pyi +++ b/stdlib/3/functools.pyi @@ -1,5 +1,20 @@ import sys -from typing import Any, Callable, Generic, Dict, Iterable, Mapping, Optional, Sequence, Tuple, Type, TypeVar, NamedTuple, Union, overload +from typing import ( + Any, + Callable, + Dict, + Generic, + Iterable, + Mapping, + NamedTuple, + Optional, + Sequence, + Tuple, + Type, + TypeVar, + Union, + overload, +) _AnyCallable = Callable[..., Any] diff --git a/stdlib/3/gc.pyi b/stdlib/3/gc.pyi index d4bb109840dd..a188e8ff215e 100644 --- a/stdlib/3/gc.pyi +++ b/stdlib/3/gc.pyi @@ -2,7 +2,6 @@ from typing import Any, Dict, List, Tuple - DEBUG_COLLECTABLE: int DEBUG_LEAK: int DEBUG_SAVEALL: int diff --git a/stdlib/3/getpass.pyi b/stdlib/3/getpass.pyi index 55a8433fca43..f8f5ff4b72df 100644 --- a/stdlib/3/getpass.pyi +++ b/stdlib/3/getpass.pyi @@ -2,7 +2,6 @@ from typing import Optional, TextIO - def getpass(prompt: str = ..., stream: Optional[TextIO] = ...) -> str: ... diff --git a/stdlib/3/gettext.pyi b/stdlib/3/gettext.pyi index eeb9b09768f9..355ecbdd9a62 100644 --- a/stdlib/3/gettext.pyi +++ b/stdlib/3/gettext.pyi @@ -1,6 +1,6 @@ # Stubs for gettext (Python 3.4) -from typing import Any, IO, List, Optional, Union, Callable +from typing import IO, Any, Callable, List, Optional, Union class NullTranslations: def __init__(self, fp: IO[str] = ...) -> None: ... diff --git a/stdlib/3/glob.pyi b/stdlib/3/glob.pyi index 22ee20569339..02293be035e5 100644 --- a/stdlib/3/glob.pyi +++ b/stdlib/3/glob.pyi @@ -1,8 +1,8 @@ # Stubs for glob # Based on http://docs.python.org/3/library/glob.html -from typing import List, Iterator, AnyStr, Union import sys +from typing import AnyStr, Iterator, List, Union if sys.version_info >= (3, 6): def glob0(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ... diff --git a/stdlib/3/gzip.pyi b/stdlib/3/gzip.pyi index 6f1bf7adc329..74524d91aba3 100644 --- a/stdlib/3/gzip.pyi +++ b/stdlib/3/gzip.pyi @@ -1,7 +1,7 @@ -from typing import Any, IO, Optional -from os.path import _PathType import _compression import zlib +from os.path import _PathType +from typing import IO, Any, Optional def open(filename, mode: str = ..., compresslevel: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., newline: Optional[str] = ...) -> IO[Any]: ... diff --git a/stdlib/3/heapq.pyi b/stdlib/3/heapq.pyi index 5c49dfac1e98..bd03bba22cde 100644 --- a/stdlib/3/heapq.pyi +++ b/stdlib/3/heapq.pyi @@ -3,7 +3,7 @@ # Based on http://docs.python.org/3.2/library/heapq.html import sys -from typing import TypeVar, List, Iterable, Any, Callable, Optional +from typing import Any, Callable, Iterable, List, Optional, TypeVar _T = TypeVar('_T') diff --git a/stdlib/3/html/parser.pyi b/stdlib/3/html/parser.pyi index 4b10331be99f..2c86cd2b83fc 100644 --- a/stdlib/3/html/parser.pyi +++ b/stdlib/3/html/parser.pyi @@ -1,6 +1,6 @@ -from typing import List, Optional, Tuple -from _markupbase import ParserBase import sys +from _markupbase import ParserBase +from typing import List, Optional, Tuple class HTMLParser(ParserBase): if sys.version_info >= (3, 5): diff --git a/stdlib/3/http/__init__.pyi b/stdlib/3/http/__init__.pyi index 580250b3c7e2..adc0ba9ccb44 100644 --- a/stdlib/3/http/__init__.pyi +++ b/stdlib/3/http/__init__.pyi @@ -1,5 +1,4 @@ import sys - from enum import IntEnum if sys.version_info >= (3, 5): diff --git a/stdlib/3/http/client.pyi b/stdlib/3/http/client.pyi index 5528b0150865..8beb77eb57d4 100644 --- a/stdlib/3/http/client.pyi +++ b/stdlib/3/http/client.pyi @@ -1,16 +1,26 @@ -from typing import ( - Any, Dict, IO, Iterable, List, Iterator, Mapping, Optional, - Protocol, Tuple, Type, TypeVar, - Union, - overload, - BinaryIO, -) import email.message import io -from socket import socket -import sys import ssl +import sys import types +from socket import socket +from typing import ( + IO, + Any, + BinaryIO, + Dict, + Iterable, + Iterator, + List, + Mapping, + Optional, + Protocol, + Tuple, + Type, + TypeVar, + Union, + overload, +) _DataType = Union[bytes, IO[Any], Iterable[bytes], str] _T = TypeVar('_T') diff --git a/stdlib/3/http/cookiejar.pyi b/stdlib/3/http/cookiejar.pyi index 9e31fb994cd4..16d51b0cee5c 100644 --- a/stdlib/3/http/cookiejar.pyi +++ b/stdlib/3/http/cookiejar.pyi @@ -1,5 +1,5 @@ -from typing import Dict, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload from http.client import HTTPResponse +from typing import Dict, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload from urllib.request import Request _T = TypeVar('_T') diff --git a/stdlib/3/http/cookies.pyi b/stdlib/3/http/cookies.pyi index 5e5d58a00583..9a1fdeb7fc18 100644 --- a/stdlib/3/http/cookies.pyi +++ b/stdlib/3/http/cookies.pyi @@ -1,6 +1,6 @@ # Stubs for http.cookies (Python 3.5) -from typing import Generic, Dict, List, Mapping, MutableMapping, Optional, TypeVar, Union +from typing import Dict, Generic, List, Mapping, MutableMapping, Optional, TypeVar, Union _DataType = Union[str, Mapping[str, Union[str, Morsel]]] _T = TypeVar('_T') diff --git a/stdlib/3/http/server.pyi b/stdlib/3/http/server.pyi index 7a7729f87275..2c8218d87e65 100644 --- a/stdlib/3/http/server.pyi +++ b/stdlib/3/http/server.pyi @@ -1,9 +1,9 @@ # Stubs for http.server (Python 3.4) +import email.message +import socketserver import sys from typing import Any, BinaryIO, Dict, List, Mapping, Optional, Tuple, Union -import socketserver -import email.message if sys.version_info >= (3, 7): from builtins import _PathLike diff --git a/stdlib/3/imp.pyi b/stdlib/3/imp.pyi index 33440910a1c0..b491db2bd095 100644 --- a/stdlib/3/imp.pyi +++ b/stdlib/3/imp.pyi @@ -3,11 +3,16 @@ import os import sys import types -from typing import Any, IO, List, Optional, Tuple, TypeVar, Union - -from _imp import (lock_held as lock_held, acquire_lock as acquire_lock, release_lock as release_lock, - get_frozen_object as get_frozen_object, is_frozen_package as is_frozen_package, - init_frozen as init_frozen, is_builtin as is_builtin, is_frozen as is_frozen) +from typing import IO, Any, List, Optional, Tuple, TypeVar, Union + +from _imp import acquire_lock as acquire_lock +from _imp import get_frozen_object as get_frozen_object +from _imp import init_frozen as init_frozen +from _imp import is_builtin as is_builtin +from _imp import is_frozen as is_frozen +from _imp import is_frozen_package as is_frozen_package +from _imp import lock_held as lock_held +from _imp import release_lock as release_lock if sys.version_info >= (3, 5): from _imp import create_dynamic as create_dynamic diff --git a/stdlib/3/importlib/__init__.pyi b/stdlib/3/importlib/__init__.pyi index d46f7e19d555..70788d734e43 100644 --- a/stdlib/3/importlib/__init__.pyi +++ b/stdlib/3/importlib/__init__.pyi @@ -1,6 +1,6 @@ -from importlib.abc import Loader import sys import types +from importlib.abc import Loader from typing import Any, Mapping, Optional, Sequence def __import__(name: str, globals: Optional[Mapping[str, Any]] = ..., diff --git a/stdlib/3/importlib/abc.pyi b/stdlib/3/importlib/abc.pyi index a86e194dda56..babcda1c5d44 100644 --- a/stdlib/3/importlib/abc.pyi +++ b/stdlib/3/importlib/abc.pyi @@ -1,13 +1,12 @@ -from abc import ABCMeta, abstractmethod import os import sys import types -from typing import Any, IO, Iterator, Mapping, Optional, Sequence, Tuple, Union +from abc import ABCMeta, abstractmethod +from typing import IO, Any, Iterator, Mapping, Optional, Sequence, Tuple, Union # Loader is exported from this module, but for circular import reasons # exists in its own stub file (with ModuleSpec and ModuleType). from _importlib_modulespec import Loader as Loader # Exported - from _importlib_modulespec import ModuleSpec _Path = Union[bytes, str] diff --git a/stdlib/3/importlib/resources.pyi b/stdlib/3/importlib/resources.pyi index 007477d51b26..b8942e76258c 100644 --- a/stdlib/3/importlib/resources.pyi +++ b/stdlib/3/importlib/resources.pyi @@ -1,4 +1,5 @@ import sys + # This is a >=3.7 module, so we conditionally include its source. if sys.version_info >= (3, 7): import os diff --git a/stdlib/3/inspect.pyi b/stdlib/3/inspect.pyi index 61737158e0e4..72d59c6eb0c7 100644 --- a/stdlib/3/inspect.pyi +++ b/stdlib/3/inspect.pyi @@ -1,9 +1,7 @@ import sys -from typing import (AbstractSet, Any, Callable, Dict, Generator, List, Mapping, - NamedTuple, Optional, Sequence, Tuple, Union, - ) -from types import CodeType, FrameType, ModuleType, TracebackType from collections import OrderedDict +from types import CodeType, FrameType, ModuleType, TracebackType +from typing import AbstractSet, Any, Callable, Dict, Generator, List, Mapping, NamedTuple, Optional, Sequence, Tuple, Union # # Types and members diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index 903fab2f6f93..2a739a624a42 100644 --- a/stdlib/3/io.pyi +++ b/stdlib/3/io.pyi @@ -1,12 +1,9 @@ -from typing import ( - List, BinaryIO, TextIO, Iterator, Union, Optional, Callable, Tuple, Type, Any, IO, Iterable -) import builtins import codecs -from mmap import mmap import sys +from mmap import mmap from types import TracebackType -from typing import TypeVar +from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, List, Optional, TextIO, Tuple, Type, TypeVar, Union _bytearray_like = Union[bytearray, mmap] diff --git a/stdlib/3/ipaddress.pyi b/stdlib/3/ipaddress.pyi index f706330b6426..21c01febf2ef 100644 --- a/stdlib/3/ipaddress.pyi +++ b/stdlib/3/ipaddress.pyi @@ -1,6 +1,5 @@ import sys -from typing import (Any, Container, Generic, Iterable, Iterator, Optional, - overload, SupportsInt, Tuple, TypeVar) +from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Tuple, TypeVar, overload # Undocumented length constants IPV4LENGTH: int diff --git a/stdlib/3/itertools.pyi b/stdlib/3/itertools.pyi index f34dd5b61644..db7076a93f39 100644 --- a/stdlib/3/itertools.pyi +++ b/stdlib/3/itertools.pyi @@ -2,8 +2,7 @@ # Based on http://docs.python.org/3.2/library/itertools.html -from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple, - Generic, Optional) +from typing import Any, Callable, Generic, Iterable, Iterator, Optional, Tuple, TypeVar, overload _T = TypeVar('_T') _S = TypeVar('_S') diff --git a/stdlib/3/json/__init__.pyi b/stdlib/3/json/__init__.pyi index 620b239b46c8..bbd285ca3747 100644 --- a/stdlib/3/json/__init__.pyi +++ b/stdlib/3/json/__init__.pyi @@ -1,8 +1,9 @@ import sys -from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Protocol +from typing import IO, Any, Callable, Dict, List, Optional, Protocol, Tuple, Union from .decoder import JSONDecoder as JSONDecoder from .encoder import JSONEncoder as JSONEncoder + if sys.version_info >= (3, 5): from .decoder import JSONDecodeError as JSONDecodeError diff --git a/stdlib/3/lzma.pyi b/stdlib/3/lzma.pyi index cd0a088b442b..3f1dd90bd42d 100644 --- a/stdlib/3/lzma.pyi +++ b/stdlib/3/lzma.pyi @@ -1,6 +1,6 @@ import io import sys -from typing import Any, IO, Mapping, Optional, Sequence, Union +from typing import IO, Any, Mapping, Optional, Sequence, Union if sys.version_info >= (3, 6): from os import PathLike diff --git a/stdlib/3/msvcrt.pyi b/stdlib/3/msvcrt.pyi index bcab64cd9a0a..fb36471dfa54 100644 --- a/stdlib/3/msvcrt.pyi +++ b/stdlib/3/msvcrt.pyi @@ -2,7 +2,7 @@ # NOTE: These are incomplete! -from typing import overload, BinaryIO, TextIO +from typing import BinaryIO, TextIO, overload def get_osfhandle(file: int) -> int: ... def open_osfhandle(handle: int, flags: int) -> int: ... diff --git a/stdlib/3/multiprocessing/__init__.pyi b/stdlib/3/multiprocessing/__init__.pyi index e5fad0a5afc9..7734af759b2a 100644 --- a/stdlib/3/multiprocessing/__init__.pyi +++ b/stdlib/3/multiprocessing/__init__.pyi @@ -1,22 +1,21 @@ # Stubs for multiprocessing -from typing import ( - Any, Callable, ContextManager, Iterable, Mapping, Optional, Dict, List, - Union, Sequence, Tuple -) - +import sys from logging import Logger from multiprocessing import connection, pool, spawn, synchronize -from multiprocessing.context import ( - BaseContext, - ProcessError as ProcessError, BufferTooShort as BufferTooShort, TimeoutError as TimeoutError, AuthenticationError as AuthenticationError) +from multiprocessing.context import AuthenticationError as AuthenticationError +from multiprocessing.context import BaseContext +from multiprocessing.context import BufferTooShort as BufferTooShort +from multiprocessing.context import ProcessError as ProcessError +from multiprocessing.context import TimeoutError as TimeoutError from multiprocessing.managers import SyncManager from multiprocessing.process import current_process as current_process -from multiprocessing.queues import Queue as Queue, SimpleQueue as SimpleQueue, JoinableQueue as JoinableQueue +from multiprocessing.queues import JoinableQueue as JoinableQueue +from multiprocessing.queues import Queue as Queue +from multiprocessing.queues import SimpleQueue as SimpleQueue from multiprocessing.spawn import freeze_support as freeze_support from multiprocessing.spawn import set_executable as set_executable - -import sys +from typing import Any, Callable, ContextManager, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union # N.B. The functions below are generated at runtime by partially applying # multiprocessing.context.BaseContext's methods, so the two signatures should diff --git a/stdlib/3/multiprocessing/connection.pyi b/stdlib/3/multiprocessing/connection.pyi index 76bdca01ce8e..9bbb830db1e2 100644 --- a/stdlib/3/multiprocessing/connection.pyi +++ b/stdlib/3/multiprocessing/connection.pyi @@ -1,7 +1,7 @@ -from typing import Any, Iterable, List, Optional, Tuple, Type, Union import socket import sys import types +from typing import Any, Iterable, List, Optional, Tuple, Type, Union # https://docs.python.org/3/library/multiprocessing.html#address-formats _Address = Union[str, Tuple[str, int]] diff --git a/stdlib/3/multiprocessing/context.pyi b/stdlib/3/multiprocessing/context.pyi index dada9b3ea93a..d1c1b864961d 100644 --- a/stdlib/3/multiprocessing/context.pyi +++ b/stdlib/3/multiprocessing/context.pyi @@ -1,14 +1,10 @@ # Stubs for multiprocessing.context -from logging import Logger import multiprocessing -from multiprocessing import synchronize -from multiprocessing import queues import sys -from typing import ( - Any, Callable, Iterable, Optional, List, Mapping, Sequence, Tuple, Type, - Union, -) +from logging import Logger +from multiprocessing import queues, synchronize +from typing import Any, Callable, Iterable, List, Mapping, Optional, Sequence, Tuple, Type, Union _LockLike = Union[synchronize.Lock, synchronize.RLock] diff --git a/stdlib/3/multiprocessing/dummy/__init__.pyi b/stdlib/3/multiprocessing/dummy/__init__.pyi index c169d2d0e853..1bef76d4f6bc 100644 --- a/stdlib/3/multiprocessing/dummy/__init__.pyi +++ b/stdlib/3/multiprocessing/dummy/__init__.pyi @@ -1,14 +1,12 @@ -from typing import Any, Optional, List, Type - import array import sys import threading import weakref +from queue import Queue +from threading import Barrier, BoundedSemaphore, Condition, Event, Lock, RLock, Semaphore +from typing import Any, List, Optional, Type from .connection import Pipe -from threading import Lock, RLock, Semaphore, BoundedSemaphore -from threading import Event, Condition, Barrier -from queue import Queue JoinableQueue = Queue diff --git a/stdlib/3/multiprocessing/dummy/connection.pyi b/stdlib/3/multiprocessing/dummy/connection.pyi index 3baaf286f24a..3b33826ff734 100644 --- a/stdlib/3/multiprocessing/dummy/connection.pyi +++ b/stdlib/3/multiprocessing/dummy/connection.pyi @@ -1,6 +1,5 @@ -from typing import Any, List, Optional, Tuple, Type, TypeVar - from queue import Queue +from typing import Any, List, Optional, Tuple, Type, TypeVar families: List[None] diff --git a/stdlib/3/multiprocessing/managers.pyi b/stdlib/3/multiprocessing/managers.pyi index a5ec399d74cc..8c9b150be600 100644 --- a/stdlib/3/multiprocessing/managers.pyi +++ b/stdlib/3/multiprocessing/managers.pyi @@ -4,10 +4,7 @@ import queue import threading -from typing import ( - Any, Callable, ContextManager, Dict, Iterable, List, Mapping, Optional, - Sequence, Tuple, TypeVar, Union, -) +from typing import Any, Callable, ContextManager, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, TypeVar, Union _T = TypeVar('_T') _KT = TypeVar('_KT') diff --git a/stdlib/3/multiprocessing/pool.pyi b/stdlib/3/multiprocessing/pool.pyi index 469d83ad301a..07da7eadce1d 100644 --- a/stdlib/3/multiprocessing/pool.pyi +++ b/stdlib/3/multiprocessing/pool.pyi @@ -1,8 +1,5 @@ -from typing import ( - Any, Callable, ContextManager, Iterable, Mapping, Optional, List, - Type, TypeVar, Generic, Iterator -) from types import TracebackType +from typing import Any, Callable, ContextManager, Generic, Iterable, Iterator, List, Mapping, Optional, Type, TypeVar _PT = TypeVar('_PT', bound='Pool') _S = TypeVar('_S') diff --git a/stdlib/3/multiprocessing/process.pyi b/stdlib/3/multiprocessing/process.pyi index df8ea9300a37..8c09bd714ceb 100644 --- a/stdlib/3/multiprocessing/process.pyi +++ b/stdlib/3/multiprocessing/process.pyi @@ -1,5 +1,5 @@ -from typing import List from multiprocessing import Process +from typing import List def current_process() -> Process: ... def active_children() -> List[Process]: ... diff --git a/stdlib/3/multiprocessing/queues.pyi b/stdlib/3/multiprocessing/queues.pyi index c6dd0f20d631..319de3772cf1 100644 --- a/stdlib/3/multiprocessing/queues.pyi +++ b/stdlib/3/multiprocessing/queues.pyi @@ -1,6 +1,5 @@ -from typing import Any, Generic, Optional, TypeVar - import queue +from typing import Any, Generic, Optional, TypeVar _T = TypeVar('_T') diff --git a/stdlib/3/multiprocessing/spawn.pyi b/stdlib/3/multiprocessing/spawn.pyi index 659253c48436..e40bf4435982 100644 --- a/stdlib/3/multiprocessing/spawn.pyi +++ b/stdlib/3/multiprocessing/spawn.pyi @@ -1,5 +1,5 @@ -from typing import Any, Dict, List, Mapping, Optional, Sequence from types import ModuleType +from typing import Any, Dict, List, Mapping, Optional, Sequence WINEXE: bool WINSERVICE: bool diff --git a/stdlib/3/multiprocessing/synchronize.pyi b/stdlib/3/multiprocessing/synchronize.pyi index 9b226810e628..5085a2dda4bf 100644 --- a/stdlib/3/multiprocessing/synchronize.pyi +++ b/stdlib/3/multiprocessing/synchronize.pyi @@ -1,8 +1,7 @@ -from typing import Callable, ContextManager, Optional, Union - -from multiprocessing.context import BaseContext -import threading import sys +import threading +from multiprocessing.context import BaseContext +from typing import Callable, ContextManager, Optional, Union _LockLike = Union[Lock, RLock] diff --git a/stdlib/3/nntplib.pyi b/stdlib/3/nntplib.pyi index 00abdd994ba5..3ae25d223b3b 100644 --- a/stdlib/3/nntplib.pyi +++ b/stdlib/3/nntplib.pyi @@ -3,7 +3,7 @@ import datetime import socket import ssl -from typing import Any, Dict, IO, Iterable, List, NamedTuple, Optional, Tuple, TypeVar, Union +from typing import IO, Any, Dict, Iterable, List, NamedTuple, Optional, Tuple, TypeVar, Union _SelfT = TypeVar('_SelfT', bound=_NNTPBase) _File = Union[IO[bytes], bytes, str, None] diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index b71792687e56..f2927f4bfd19 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -1,15 +1,35 @@ # Stubs for os # Ron Murawski -from io import TextIOWrapper as _TextIOWrapper import sys +# Re-exported names from other modules. +from builtins import OSError as error +from io import TextIOWrapper as _TextIOWrapper from typing import ( - Mapping, MutableMapping, Dict, List, Any, Tuple, IO, Iterable, Iterator, NoReturn, overload, Union, AnyStr, - Optional, Generic, Set, Callable, Text, Sequence, NamedTuple, TypeVar, ContextManager + IO, + Any, + AnyStr, + Callable, + ContextManager, + Dict, + Generic, + Iterable, + Iterator, + List, + Mapping, + MutableMapping, + NamedTuple, + NoReturn, + Optional, + Sequence, + Set, + Text, + Tuple, + TypeVar, + Union, + overload, ) -# Re-exported names from other modules. -from builtins import OSError as error from . import path as path _T = TypeVar('_T') diff --git a/stdlib/3/os/path.pyi b/stdlib/3/os/path.pyi index c0bf57658ed7..dfd074fe7c7c 100644 --- a/stdlib/3/os/path.pyi +++ b/stdlib/3/os/path.pyi @@ -4,10 +4,7 @@ import os import sys -from typing import ( - overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO, - TypeVar, Union, Text, Callable, Optional -) +from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/3/pathlib.pyi b/stdlib/3/pathlib.pyi index 42968fa98ec7..d16e31126adb 100644 --- a/stdlib/3/pathlib.pyi +++ b/stdlib/3/pathlib.pyi @@ -1,7 +1,7 @@ -from typing import Any, Generator, IO, Optional, Sequence, Tuple, Type, TypeVar, Union, List -from types import TracebackType import os import sys +from types import TracebackType +from typing import IO, Any, Generator, List, Optional, Sequence, Tuple, Type, TypeVar, Union _P = TypeVar('_P', bound='PurePath') diff --git a/stdlib/3/platform.pyi b/stdlib/3/platform.pyi index 728e259fe92c..915ae30b4eb5 100644 --- a/stdlib/3/platform.pyi +++ b/stdlib/3/platform.pyi @@ -2,7 +2,7 @@ from os import devnull as DEV_NULL from os import popen -from typing import Tuple, NamedTuple +from typing import NamedTuple, Tuple def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> Tuple[str, str]: ... def linux_distribution(distname: str = ..., version: str = ..., id: str = ..., supported_dists: Tuple[str, ...] = ..., full_distribution_name: bool = ...) -> Tuple[str, str, str]: ... diff --git a/stdlib/3/posix.pyi b/stdlib/3/posix.pyi index 6902e5f23240..91d621dbe4c9 100644 --- a/stdlib/3/posix.pyi +++ b/stdlib/3/posix.pyi @@ -3,9 +3,8 @@ # NOTE: These are incomplete! import sys -from typing import NamedTuple, Tuple - from os import stat_result as stat_result +from typing import NamedTuple, Tuple uname_result = NamedTuple('uname_result', [ ('sysname', str), diff --git a/stdlib/3/queue.pyi b/stdlib/3/queue.pyi index 88605a358325..80dbc030c0b7 100644 --- a/stdlib/3/queue.pyi +++ b/stdlib/3/queue.pyi @@ -2,9 +2,9 @@ # NOTE: These are incomplete! -from collections import deque -from typing import Any, TypeVar, Generic, Optional import sys +from collections import deque +from typing import Any, Generic, Optional, TypeVar _T = TypeVar('_T') diff --git a/stdlib/3/random.pyi b/stdlib/3/random.pyi index 35ee63488bf7..3ebd1104d56b 100644 --- a/stdlib/3/random.pyi +++ b/stdlib/3/random.pyi @@ -8,9 +8,7 @@ import _random import sys -from typing import ( - Any, TypeVar, Sequence, List, Callable, AbstractSet, Union, Optional -) +from typing import AbstractSet, Any, Callable, List, Optional, Sequence, TypeVar, Union _T = TypeVar('_T') diff --git a/stdlib/3/re.pyi b/stdlib/3/re.pyi index a75bfe67e619..66ffbf4fa185 100644 --- a/stdlib/3/re.pyi +++ b/stdlib/3/re.pyi @@ -7,8 +7,20 @@ import sys from typing import ( - List, Iterator, overload, Callable, Tuple, Sequence, Dict, - Generic, AnyStr, Match, Pattern, Any, Optional, Union + Any, + AnyStr, + Callable, + Dict, + Generic, + Iterator, + List, + Match, + Optional, + Pattern, + Sequence, + Tuple, + Union, + overload, ) # ----- re variables and constants ----- diff --git a/stdlib/3/resource.pyi b/stdlib/3/resource.pyi index 0d2e30bb367c..c40211b11506 100644 --- a/stdlib/3/resource.pyi +++ b/stdlib/3/resource.pyi @@ -2,7 +2,7 @@ # NOTE: These are incomplete! -from typing import Tuple, Optional, NamedTuple +from typing import NamedTuple, Optional, Tuple RLIMIT_AS: int RLIMIT_CORE: int diff --git a/stdlib/3/runpy.pyi b/stdlib/3/runpy.pyi index 654c53c8ebb3..022af115722f 100644 --- a/stdlib/3/runpy.pyi +++ b/stdlib/3/runpy.pyi @@ -1,5 +1,5 @@ from types import ModuleType -from typing import Dict, Optional, Any +from typing import Any, Dict, Optional class _TempModule: mod_name: str = ... diff --git a/stdlib/3/shelve.pyi b/stdlib/3/shelve.pyi index 4a339692ce00..51f21a8a4fdd 100644 --- a/stdlib/3/shelve.pyi +++ b/stdlib/3/shelve.pyi @@ -1,6 +1,5 @@ -from typing import Any, Dict, Iterator, Optional, Tuple import collections - +from typing import Any, Dict, Iterator, Optional, Tuple class Shelf(collections.MutableMapping): def __init__(self, dict: Dict[bytes, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ... diff --git a/stdlib/3/shlex.pyi b/stdlib/3/shlex.pyi index fb398ea0628d..a54b8aadee17 100644 --- a/stdlib/3/shlex.pyi +++ b/stdlib/3/shlex.pyi @@ -2,8 +2,8 @@ # Based on http://docs.python.org/3.2/library/shlex.html -from typing import List, Tuple, Any, TextIO, Union, Optional, Iterable, TypeVar import sys +from typing import Any, Iterable, List, Optional, TextIO, Tuple, TypeVar, Union def split(s: str, comments: bool = ..., posix: bool = ...) -> List[str]: ... diff --git a/stdlib/3/signal.pyi b/stdlib/3/signal.pyi index 34a8cdd07f29..3b73018e8506 100644 --- a/stdlib/3/signal.pyi +++ b/stdlib/3/signal.pyi @@ -2,8 +2,8 @@ import sys from enum import IntEnum -from typing import Any, Callable, List, Tuple, Dict, Generic, Union, Optional, Iterable, Set from types import FrameType +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, Set, Tuple, Union class ItimerError(IOError): ... diff --git a/stdlib/3/smtplib.pyi b/stdlib/3/smtplib.pyi index ec8e27f09dfb..ef578feb4978 100644 --- a/stdlib/3/smtplib.pyi +++ b/stdlib/3/smtplib.pyi @@ -1,11 +1,9 @@ +import sys from email.message import Message as _Message from socket import socket from ssl import SSLContext from types import TracebackType -from typing import ( - Any, AnyStr, Dict, Generic, List, Optional, Sequence, Tuple, Union, - Pattern, Type, Callable, Protocol, overload) -import sys +from typing import Any, AnyStr, Callable, Dict, Generic, List, Optional, Pattern, Protocol, Sequence, Tuple, Type, Union, overload _Reply = Tuple[int, bytes] _SendErrs = Dict[str, _Reply] diff --git a/stdlib/3/socketserver.pyi b/stdlib/3/socketserver.pyi index d485b8bf1034..b24f96c4df6e 100644 --- a/stdlib/3/socketserver.pyi +++ b/stdlib/3/socketserver.pyi @@ -1,10 +1,10 @@ # NB: SocketServer.pyi and socketserver.pyi must remain consistent! # Stubs for socketserver -from typing import Any, BinaryIO, Optional, Tuple, Type -from socket import SocketType import sys import types +from socket import SocketType +from typing import Any, BinaryIO, Optional, Tuple, Type class BaseServer: address_family: int diff --git a/stdlib/3/sre_parse.pyi b/stdlib/3/sre_parse.pyi index 93b3c1dd7dab..5100f286621b 100644 --- a/stdlib/3/sre_parse.pyi +++ b/stdlib/3/sre_parse.pyi @@ -1,10 +1,10 @@ # Source: https://github.com/python/cpython/blob/master/Lib/sre_parse.py -from typing import ( - Any, Dict, FrozenSet, Iterable, List, Match, - Optional, Pattern as _Pattern, Tuple, Union -) -from sre_constants import _NamedIntConstant as NIC, error as _Error +from sre_constants import _NamedIntConstant as NIC +from sre_constants import error as _Error +from typing import Any, Dict, FrozenSet, Iterable, List, Match, Optional +from typing import Pattern as _Pattern +from typing import Tuple, Union SPECIAL_CHARS: str REPEAT_CHARS: str diff --git a/stdlib/3/statistics.pyi b/stdlib/3/statistics.pyi index d9116e58730b..bc78a4a3a51e 100644 --- a/stdlib/3/statistics.pyi +++ b/stdlib/3/statistics.pyi @@ -1,8 +1,8 @@ # Stubs for statistics +import sys from decimal import Decimal from fractions import Fraction -import sys from typing import Iterable, Optional, TypeVar # Most functions in this module accept homogeneous collections of one of these types diff --git a/stdlib/3/string.pyi b/stdlib/3/string.pyi index 92fc03611db6..d1bde9e9841c 100644 --- a/stdlib/3/string.pyi +++ b/stdlib/3/string.pyi @@ -2,7 +2,7 @@ # Based on http://docs.python.org/3.2/library/string.html -from typing import Mapping, Sequence, Any, Optional, Union, List, Tuple, Iterable +from typing import Any, Iterable, List, Mapping, Optional, Sequence, Tuple, Union ascii_letters: str ascii_lowercase: str diff --git a/stdlib/3/subprocess.pyi b/stdlib/3/subprocess.pyi index b2424494d25e..ebfda9fef2d3 100644 --- a/stdlib/3/subprocess.pyi +++ b/stdlib/3/subprocess.pyi @@ -2,8 +2,8 @@ # Based on http://docs.python.org/3.6/library/subprocess.html import sys -from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, List, Type, Text from types import TracebackType +from typing import IO, Any, Callable, List, Mapping, Optional, Sequence, Text, Tuple, Type, Union # We prefer to annotate inputs to methods (eg subprocess.check_call) with these # union types. However, outputs (eg check_call return) and class attributes diff --git a/stdlib/3/sys.pyi b/stdlib/3/sys.pyi index 3f856bbc9c76..44c974c1f195 100644 --- a/stdlib/3/sys.pyi +++ b/stdlib/3/sys.pyi @@ -3,14 +3,10 @@ # based on http://docs.python.org/3.2/library/sys.html -from typing import ( - List, NoReturn, Sequence, Any, Dict, Tuple, TextIO, overload, Optional, - Union, TypeVar, Callable, Type -) import sys -from types import FrameType, ModuleType, TracebackType - from importlib.abc import MetaPathFinder +from types import FrameType, ModuleType, TracebackType +from typing import Any, Callable, Dict, List, NoReturn, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/stdlib/3/tempfile.pyi b/stdlib/3/tempfile.pyi index e041b44e7bc7..d81704527eb7 100644 --- a/stdlib/3/tempfile.pyi +++ b/stdlib/3/tempfile.pyi @@ -5,7 +5,7 @@ import sys from types import TracebackType -from typing import Any, AnyStr, Generic, IO, Iterable, Iterator, List, Optional, overload, Tuple, Type +from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List, Optional, Tuple, Type, overload # global variables TMP_MAX: int diff --git a/stdlib/3/textwrap.pyi b/stdlib/3/textwrap.pyi index f61f975bbf2b..c9c6a0d1bc6f 100644 --- a/stdlib/3/textwrap.pyi +++ b/stdlib/3/textwrap.pyi @@ -1,4 +1,4 @@ -from typing import Callable, List, Optional, Dict, Pattern +from typing import Callable, Dict, List, Optional, Pattern class TextWrapper: width: int = ... diff --git a/stdlib/3/tkinter/__init__.pyi b/stdlib/3/tkinter/__init__.pyi index c63839470c55..b4818d391c8c 100644 --- a/stdlib/3/tkinter/__init__.pyi +++ b/stdlib/3/tkinter/__init__.pyi @@ -1,6 +1,6 @@ -from types import TracebackType -from typing import Any, Optional, Dict, Callable, Type from tkinter.constants import * # noqa: F403 +from types import TracebackType +from typing import Any, Callable, Dict, Optional, Type TclError: Any wantobjects: Any diff --git a/stdlib/3/tkinter/dialog.pyi b/stdlib/3/tkinter/dialog.pyi index 3136f21e663d..d02036a64f10 100644 --- a/stdlib/3/tkinter/dialog.pyi +++ b/stdlib/3/tkinter/dialog.pyi @@ -1,5 +1,5 @@ -from typing import Any, Mapping, Optional from tkinter import Widget +from typing import Any, Mapping, Optional DIALOG_ICON: str diff --git a/stdlib/3/tkinter/filedialog.pyi b/stdlib/3/tkinter/filedialog.pyi index 6d5f165134b0..4fa850ec5942 100644 --- a/stdlib/3/tkinter/filedialog.pyi +++ b/stdlib/3/tkinter/filedialog.pyi @@ -1,5 +1,5 @@ +from tkinter import Button, Entry, Frame, Listbox, Scrollbar, Toplevel, commondialog from typing import Any, Dict, Optional, Tuple -from tkinter import Button, commondialog, Entry, Frame, Listbox, Scrollbar, Toplevel dialogstates: Dict[Any, Tuple[Any, Any]] diff --git a/stdlib/3/tkinter/ttk.pyi b/stdlib/3/tkinter/ttk.pyi index 0362f17cb74c..b3e517c3afb4 100644 --- a/stdlib/3/tkinter/ttk.pyi +++ b/stdlib/3/tkinter/ttk.pyi @@ -1,6 +1,6 @@ import sys -from typing import Any, Optional import tkinter +from typing import Any, Optional def tclobjs_to_py(adict): ... def setup_master(master: Optional[Any] = ...): ... diff --git a/stdlib/3/tokenize.pyi b/stdlib/3/tokenize.pyi index 33c8a2d5d258..3ee9f8b67ad0 100644 --- a/stdlib/3/tokenize.pyi +++ b/stdlib/3/tokenize.pyi @@ -1,7 +1,7 @@ -from typing import Any, Callable, Generator, Iterable, List, NamedTuple, Optional, Union, Sequence, TextIO, Tuple -from builtins import open as _builtin_open import sys +from builtins import open as _builtin_open from token import * # noqa: F403 +from typing import Any, Callable, Generator, Iterable, List, NamedTuple, Optional, Sequence, TextIO, Tuple, Union COMMENT: int NL: int diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 73b88899c53f..0c040a6b4f5e 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -4,10 +4,7 @@ # TODO parts of this should be conditional on version import sys -from typing import ( - Any, Awaitable, Callable, Dict, Generic, Iterator, Mapping, Optional, Tuple, TypeVar, - Union, overload, Type -) +from typing import Any, Awaitable, Callable, Dict, Generic, Iterator, Mapping, Optional, Tuple, Type, TypeVar, Union, overload # ModuleType is exported from this module, but for circular import # reasons exists in its own stub file (with ModuleSpec and Loader). diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index e83640a73d1e..deebf1471c8e 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -1,9 +1,9 @@ # Stubs for typing +import collections # Needed by aliases like DefaultDict, see mypy issue 2986 import sys -from abc import abstractmethod, ABCMeta +from abc import ABCMeta, abstractmethod from types import CodeType, FrameType, TracebackType -import collections # Needed by aliases like DefaultDict, see mypy issue 2986 # Definitions of special type checking related constructs. Their definition # are not used, so their value does not matter. diff --git a/stdlib/3/unittest/__init__.pyi b/stdlib/3/unittest/__init__.pyi index 3ed602c8b6f5..6c1737f8279b 100644 --- a/stdlib/3/unittest/__init__.pyi +++ b/stdlib/3/unittest/__init__.pyi @@ -1,8 +1,7 @@ # Stubs for unittest -from typing import Iterable, List, Optional, Type, Union from types import ModuleType - +from typing import Iterable, List, Optional, Type, Union from unittest.case import * from unittest.loader import * from unittest.result import * @@ -10,7 +9,6 @@ from unittest.runner import * from unittest.signals import * from unittest.suite import * - # not really documented class TestProgram: result: TestResult diff --git a/stdlib/3/unittest/case.pyi b/stdlib/3/unittest/case.pyi index f71e5e4e8b7f..6ded9cdd08f9 100644 --- a/stdlib/3/unittest/case.pyi +++ b/stdlib/3/unittest/case.pyi @@ -1,12 +1,28 @@ -from typing import ( - Any, AnyStr, Callable, Container, ContextManager, Dict, FrozenSet, Generic, - Iterable, List, NoReturn, Optional, overload, Pattern, Sequence, Set, - Tuple, Type, TypeVar, Union, -) import logging import unittest.result from types import TracebackType - +from typing import ( + Any, + AnyStr, + Callable, + Container, + ContextManager, + Dict, + FrozenSet, + Generic, + Iterable, + List, + NoReturn, + Optional, + Pattern, + Sequence, + Set, + Tuple, + Type, + TypeVar, + Union, + overload, +) _E = TypeVar('_E', bound=BaseException) _FT = TypeVar('_FT', bound=Callable[..., Any]) diff --git a/stdlib/3/unittest/loader.pyi b/stdlib/3/unittest/loader.pyi index 53b81ad72db2..10de922e17b5 100644 --- a/stdlib/3/unittest/loader.pyi +++ b/stdlib/3/unittest/loader.pyi @@ -1,11 +1,10 @@ import sys import unittest.case -import unittest.suite import unittest.result +import unittest.suite from types import ModuleType from typing import Any, Callable, List, Optional, Sequence, Type - class TestLoader: if sys.version_info >= (3, 5): errors: List[Type[BaseException]] diff --git a/stdlib/3/unittest/result.pyi b/stdlib/3/unittest/result.pyi index cb85399a5548..bc51158172c8 100644 --- a/stdlib/3/unittest/result.pyi +++ b/stdlib/3/unittest/result.pyi @@ -1,7 +1,6 @@ -from typing import Any, List, Optional, Tuple, Type -from types import TracebackType import unittest.case - +from types import TracebackType +from typing import Any, List, Optional, Tuple, Type _SysExcInfoType = Tuple[Optional[Type[BaseException]], Optional[BaseException], diff --git a/stdlib/3/unittest/runner.pyi b/stdlib/3/unittest/runner.pyi index 786bc191e0cf..ef3693fa7943 100644 --- a/stdlib/3/unittest/runner.pyi +++ b/stdlib/3/unittest/runner.pyi @@ -1,9 +1,8 @@ -from typing import Callable, Optional, TextIO, Tuple, Type, Union import sys import unittest.case import unittest.result import unittest.suite - +from typing import Callable, Optional, TextIO, Tuple, Type, Union _ResultClassType = Callable[[TextIO, bool, int], unittest.result.TestResult] diff --git a/stdlib/3/unittest/signals.pyi b/stdlib/3/unittest/signals.pyi index a4616b779382..c5d12b335adc 100644 --- a/stdlib/3/unittest/signals.pyi +++ b/stdlib/3/unittest/signals.pyi @@ -1,6 +1,5 @@ -from typing import Any, Callable, overload, TypeVar import unittest.result - +from typing import Any, Callable, TypeVar, overload _F = TypeVar('_F', bound=Callable[..., Any]) diff --git a/stdlib/3/unittest/suite.pyi b/stdlib/3/unittest/suite.pyi index 54e9e69e9761..1d2d1482f570 100644 --- a/stdlib/3/unittest/suite.pyi +++ b/stdlib/3/unittest/suite.pyi @@ -1,7 +1,6 @@ -from typing import Iterable, Iterator, List, Union import unittest.case import unittest.result - +from typing import Iterable, Iterator, List, Union _TestType = Union[unittest.case.TestCase, TestSuite] diff --git a/stdlib/3/urllib/parse.pyi b/stdlib/3/urllib/parse.pyi index 8d7cc4a0db5c..f533cfeeb823 100644 --- a/stdlib/3/urllib/parse.pyi +++ b/stdlib/3/urllib/parse.pyi @@ -1,6 +1,6 @@ # Stubs for urllib.parse -from typing import Any, List, Dict, Tuple, AnyStr, Generic, overload, Sequence, Mapping, Union, NamedTuple, Callable, Optional import sys +from typing import Any, AnyStr, Callable, Dict, Generic, List, Mapping, NamedTuple, Optional, Sequence, Tuple, Union, overload _Str = Union[bytes, str] diff --git a/stdlib/3/urllib/request.pyi b/stdlib/3/urllib/request.pyi index e096ef4ef7f8..6d2d48e29fd7 100644 --- a/stdlib/3/urllib/request.pyi +++ b/stdlib/3/urllib/request.pyi @@ -1,16 +1,13 @@ # Stubs for urllib.request (Python 3.4) -from typing import ( - Any, Callable, ClassVar, Dict, List, IO, Mapping, Optional, Sequence, Tuple, - TypeVar, Union, overload, NoReturn, -) -from http.client import HTTPResponse, HTTPMessage, HTTPConnectionProtocol -from http.cookiejar import CookieJar -from email.message import Message -from urllib.response import addinfourl +import os import ssl import sys -import os +from email.message import Message +from http.client import HTTPConnectionProtocol, HTTPMessage, HTTPResponse +from http.cookiejar import CookieJar +from typing import IO, Any, Callable, ClassVar, Dict, List, Mapping, NoReturn, Optional, Sequence, Tuple, TypeVar, Union, overload +from urllib.response import addinfourl _T = TypeVar('_T') _UrlopenRet = Any diff --git a/stdlib/3/urllib/response.pyi b/stdlib/3/urllib/response.pyi index ef3507d7ddc7..c48d0b71fce2 100644 --- a/stdlib/3/urllib/response.pyi +++ b/stdlib/3/urllib/response.pyi @@ -1,7 +1,7 @@ # private module, we only expose what's needed -from typing import BinaryIO, Iterable, List, Mapping, Optional, Type, TypeVar from types import TracebackType +from typing import BinaryIO, Iterable, List, Mapping, Optional, Type, TypeVar _AIUT = TypeVar("_AIUT", bound=addbase) diff --git a/stdlib/3/urllib/robotparser.pyi b/stdlib/3/urllib/robotparser.pyi index 36150ab01d5c..34fc44b59d7e 100644 --- a/stdlib/3/urllib/robotparser.pyi +++ b/stdlib/3/urllib/robotparser.pyi @@ -1,7 +1,7 @@ # Stubs for urllib.robotparser (Python 3.4) -from typing import Iterable, NamedTuple, Optional import sys +from typing import Iterable, NamedTuple, Optional _RequestRate = NamedTuple('_RequestRate', [('requests', int), ('seconds', int)]) diff --git a/tests/check_consistent.py b/tests/check_consistent.py index 0566b4967b93..bccdf2b994cb 100755 --- a/tests/check_consistent.py +++ b/tests/check_consistent.py @@ -3,8 +3,8 @@ # Symlinks are bad on Windows, so we cannot use them in typeshed. # This checks that certain files are duplicated exactly. -import os import filecmp +import os consistent_files = [ {'stdlib/2and3/builtins.pyi', 'stdlib/2/__builtin__.pyi'}, diff --git a/tests/mypy_selftest.py b/tests/mypy_selftest.py index fd7f23b105bb..c2d879ca4b76 100755 --- a/tests/mypy_selftest.py +++ b/tests/mypy_selftest.py @@ -1,12 +1,11 @@ #!/usr/bin/env python3 """Script to run mypy's test suite against this version of typeshed.""" -from pathlib import Path import shutil import subprocess import sys import tempfile - +from pathlib import Path if __name__ == '__main__': with tempfile.TemporaryDirectory() as tempdir: diff --git a/tests/mypy_test.py b/tests/mypy_test.py index 7ac6f077b08f..a800a91d620a 100755 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -12,10 +12,10 @@ 5. Repeat steps 2-4 for other mypy runs (e.g. --py2) """ +import argparse import os import re import sys -import argparse parser = argparse.ArgumentParser(description="Test runner for typeshed. " "Patterns are unanchored regexps on the full path.") diff --git a/tests/pytype_test.py b/tests/pytype_test.py index bb4793a20078..1b7a8c7b2194 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -14,13 +14,13 @@ import collections import itertools import os -from pytype import config -from pytype import io import re import subprocess import sys import traceback +from pytype import config, io + parser = argparse.ArgumentParser(description='Pytype/typeshed tests.') parser.add_argument('-n', '--dry-run', action='store_true', default=False, help='Don\'t actually run tests') diff --git a/third_party/2/OpenSSL/crypto.pyi b/third_party/2/OpenSSL/crypto.pyi index 395e6309b94f..daf6ae7b251f 100644 --- a/third_party/2/OpenSSL/crypto.pyi +++ b/third_party/2/OpenSSL/crypto.pyi @@ -1,9 +1,9 @@ # Stubs for OpenSSL.crypto (Python 2) +from datetime import datetime from typing import Any, Callable, Iterable, List, Optional, Set, Text, Tuple, Union from cryptography.hazmat.primitives.asymmetric import dsa, rsa -from datetime import datetime FILETYPE_PEM: int FILETYPE_ASN1: int diff --git a/third_party/2/concurrent/futures/__init__.pyi b/third_party/2/concurrent/futures/__init__.pyi index 4439dcadb523..cde4120b2a78 100644 --- a/third_party/2/concurrent/futures/__init__.pyi +++ b/third_party/2/concurrent/futures/__init__.pyi @@ -1,3 +1,3 @@ from ._base import * # noqa: F403 -from .thread import * # noqa: F403 from .process import * # noqa: F403 +from .thread import * # noqa: F403 diff --git a/third_party/2/concurrent/futures/_base.pyi b/third_party/2/concurrent/futures/_base.pyi index 95189a741199..1c1695784387 100644 --- a/third_party/2/concurrent/futures/_base.pyi +++ b/third_party/2/concurrent/futures/_base.pyi @@ -1,6 +1,6 @@ -from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple, Optional, Set, NamedTuple -from types import TracebackType import sys +from types import TracebackType +from typing import Any, Callable, Generic, Iterable, Iterator, NamedTuple, Optional, Set, Tuple, TypeVar FIRST_COMPLETED: str FIRST_EXCEPTION: str diff --git a/third_party/2/concurrent/futures/process.pyi b/third_party/2/concurrent/futures/process.pyi index ba0cd61a6170..f5d3e0f4b479 100644 --- a/third_party/2/concurrent/futures/process.pyi +++ b/third_party/2/concurrent/futures/process.pyi @@ -1,6 +1,7 @@ -from typing import Any, Callable, Optional, Tuple -from ._base import Future, Executor import sys +from typing import Any, Callable, Optional, Tuple + +from ._base import Executor, Future EXTRA_QUEUED_CALLS: Any diff --git a/third_party/2/concurrent/futures/thread.pyi b/third_party/2/concurrent/futures/thread.pyi index 983594dc728f..44dac203675b 100644 --- a/third_party/2/concurrent/futures/thread.pyi +++ b/third_party/2/concurrent/futures/thread.pyi @@ -1,6 +1,7 @@ +import sys from typing import Any, Callable, Optional, Tuple + from ._base import Executor, Future -import sys class ThreadPoolExecutor(Executor): if sys.version_info >= (3, 7): diff --git a/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi b/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi index 006e8221e6c5..d6ef3d504b12 100644 --- a/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi +++ b/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi @@ -1,6 +1,7 @@ -from cryptography.hazmat.primitives.serialization import Encoding, KeySerializationEncryption, PrivateFormat, PublicFormat from typing import Tuple +from cryptography.hazmat.primitives.serialization import Encoding, KeySerializationEncryption, PrivateFormat, PublicFormat + class RSAPrivateKey: def signer(self, padding, algorithm): ... def decrypt(self, ciphertext: bytes, padding) -> bytes: ... diff --git a/third_party/2/cryptography/hazmat/primitives/serialization.pyi b/third_party/2/cryptography/hazmat/primitives/serialization.pyi index bec4e89a4398..9ad73168db4e 100644 --- a/third_party/2/cryptography/hazmat/primitives/serialization.pyi +++ b/third_party/2/cryptography/hazmat/primitives/serialization.pyi @@ -1,5 +1,5 @@ -from typing import Any, Optional from enum import Enum +from typing import Any, Optional def load_pem_private_key(data: bytes, password: Optional[bytes], backend): ... def load_pem_public_key(data: bytes, backend): ... diff --git a/third_party/2/enum.pyi b/third_party/2/enum.pyi index 703c7cfa8be3..b472bfa3ce39 100644 --- a/third_party/2/enum.pyi +++ b/third_party/2/enum.pyi @@ -1,7 +1,7 @@ # NB: third_party/2/enum.pyi and stdlib/3.4/enum.pyi must remain consistent! import sys -from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union from abc import ABCMeta +from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union _T = TypeVar('_T') _S = TypeVar('_S', bound=Type[Enum]) diff --git a/third_party/2/fb303/FacebookService.pyi b/third_party/2/fb303/FacebookService.pyi index ead5d24fe7a3..c578c0db629d 100644 --- a/third_party/2/fb303/FacebookService.pyi +++ b/third_party/2/fb303/FacebookService.pyi @@ -1,4 +1,5 @@ from typing import Any + from thrift.Thrift import TProcessor # type: ignore fastbinary: Any diff --git a/third_party/2/gflags.pyi b/third_party/2/gflags.pyi index 87edd4e4a0bb..082b56a1f7b5 100644 --- a/third_party/2/gflags.pyi +++ b/third_party/2/gflags.pyi @@ -1,5 +1,5 @@ -from typing import Any, Callable, Dict, Iterable, IO, List, Optional, Sequence, Union from types import ModuleType +from typing import IO, Any, Callable, Dict, Iterable, List, Optional, Sequence, Union class Error(Exception): ... FlagsError = Error diff --git a/third_party/2/pathlib2.pyi b/third_party/2/pathlib2.pyi index 42968fa98ec7..d16e31126adb 100644 --- a/third_party/2/pathlib2.pyi +++ b/third_party/2/pathlib2.pyi @@ -1,7 +1,7 @@ -from typing import Any, Generator, IO, Optional, Sequence, Tuple, Type, TypeVar, Union, List -from types import TracebackType import os import sys +from types import TracebackType +from typing import IO, Any, Generator, List, Optional, Sequence, Tuple, Type, TypeVar, Union _P = TypeVar('_P', bound='PurePath') diff --git a/third_party/2/pymssql.pyi b/third_party/2/pymssql.pyi index 8e08ee352a8d..7fa18ddf4618 100644 --- a/third_party/2/pymssql.pyi +++ b/third_party/2/pymssql.pyi @@ -1,6 +1,5 @@ -from datetime import datetime, date, time - -from typing import Any, Dict, Tuple, Iterable, List, Optional, Union, Sequence +from datetime import date, datetime, time +from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union Scalar = Union[int, float, str, datetime, date, time] Result = Union[Tuple[Scalar, ...], Dict[str, Scalar]] diff --git a/third_party/2/routes/__init__.pyi b/third_party/2/routes/__init__.pyi index 8a1261f5599c..c80116a2c6d2 100644 --- a/third_party/2/routes/__init__.pyi +++ b/third_party/2/routes/__init__.pyi @@ -1,5 +1,4 @@ -from . import mapper -from . import util +from . import mapper, util class _RequestConfig: def __getattr__(self, name): ... diff --git a/third_party/2/scribe/scribe.pyi b/third_party/2/scribe/scribe.pyi index 3530bf80a809..08da03618014 100644 --- a/third_party/2/scribe/scribe.pyi +++ b/third_party/2/scribe/scribe.pyi @@ -1,9 +1,10 @@ from typing import Any import fb303.FacebookService -from .ttypes import * # noqa: F403 from thrift.Thrift import TProcessor # type: ignore # We don't have thrift stubs in typeshed +from .ttypes import * # noqa: F403 + class Iface(fb303.FacebookService.Iface): def Log(self, messages): ... diff --git a/third_party/2/six/__init__.pyi b/third_party/2/six/__init__.pyi index 3bed0500ca39..eaacba4d3f5d 100644 --- a/third_party/2/six/__init__.pyi +++ b/third_party/2/six/__init__.pyi @@ -3,19 +3,34 @@ from __future__ import print_function import types -from typing import ( - Any, AnyStr, Callable, Dict, Iterable, Mapping, NoReturn, Optional, - Pattern, Text, Tuple, Type, TypeVar, Union, overload, ValuesView, KeysView, ItemsView, -) import typing import unittest - # Exports from __builtin__ import unichr as unichr -from StringIO import StringIO as StringIO, StringIO as BytesIO from functools import wraps as wraps -from . import moves +from StringIO import StringIO as BytesIO +from typing import ( + Any, + AnyStr, + Callable, + Dict, + ItemsView, + Iterable, + KeysView, + Mapping, + NoReturn, + Optional, + Pattern, + Text, + Tuple, + Type, + TypeVar, + Union, + ValuesView, + overload, +) +from . import moves _T = TypeVar('_T') _K = TypeVar('_K') diff --git a/third_party/2/six/moves/__init__.pyi b/third_party/2/six/moves/__init__.pyi index ade03042ca7c..6bad8fff9913 100644 --- a/third_party/2/six/moves/__init__.pyi +++ b/third_party/2/six/moves/__init__.pyi @@ -2,47 +2,26 @@ # # Note: Commented out items means they weren't implemented at the time. # Uncomment them when the modules have been added to the typeshed. +import __builtin__ as builtins +from __builtin__ import intern as intern +from __builtin__ import raw_input as input +from __builtin__ import reduce as reduce +from __builtin__ import reload as reload_module +from __builtin__ import xrange as xrange from cStringIO import StringIO as cStringIO from itertools import ifilter as filter from itertools import ifilterfalse as filterfalse -from __builtin__ import raw_input as input -from __builtin__ import intern as intern from itertools import imap as map -from os import getcwdu as getcwd +from itertools import izip as zip +from itertools import izip_longest as zip_longest from os import getcwd as getcwdb -from __builtin__ import xrange as range -from __builtin__ import reload as reload_module -from __builtin__ import reduce as reduce +from os import getcwdu as getcwd from pipes import quote as shlex_quote from StringIO import StringIO as StringIO from UserDict import UserDict as UserDict from UserList import UserList as UserList from UserString import UserString as UserString -from __builtin__ import xrange as xrange -from itertools import izip as zip -from itertools import izip_longest as zip_longest -import __builtin__ as builtins -from . import configparser -# import copy_reg as copyreg -# import gdbm as dbm_gnu -from . import _dummy_thread -from . import http_cookiejar -from . import http_cookies -from . import html_entities -from . import html_parser -from . import http_client -# import email.MIMEMultipart as email_mime_multipart -# import email.MIMENonMultipart as email_mime_nonmultipart -from . import email_mime_text -# import email.MIMEBase as email_mime_base -from . import BaseHTTPServer -# import CGIHTTPServer as CGIHTTPServer -from . import SimpleHTTPServer -from . import cPickle -from . import queue -from . import reprlib -from . import socketserver -from . import _thread + # import Tkinter as tkinter # import Dialog as tkinter_dialog # import FileDialog as tkinter_filedialog @@ -58,9 +37,33 @@ from . import _thread # import tkFont as tkinter_font # import tkMessageBox as tkinter_messagebox # import tkSimpleDialog as tkinter_tksimpledialog -from . import urllib_parse -from . import urllib_error -from . import urllib -from . import urllib_robotparser -from . import xmlrpc_client +# import CGIHTTPServer as CGIHTTPServer +# import email.MIMEBase as email_mime_base +# import email.MIMEMultipart as email_mime_multipart +# import email.MIMENonMultipart as email_mime_nonmultipart +# import copy_reg as copyreg +# import gdbm as dbm_gnu +from . import ( + BaseHTTPServer, + SimpleHTTPServer, + _dummy_thread, + _thread, + configparser, + cPickle, + email_mime_text, + html_entities, + html_parser, + http_client, + http_cookiejar, + http_cookies, + queue, + reprlib, + socketserver, + urllib, + urllib_error, + urllib_parse, + urllib_robotparser, + xmlrpc_client, +) + # import SimpleXMLRPCServer as xmlrpc_server diff --git a/third_party/2/six/moves/urllib/error.pyi b/third_party/2/six/moves/urllib/error.pyi index 044327ee4fb4..ef51329c7594 100644 --- a/third_party/2/six/moves/urllib/error.pyi +++ b/third_party/2/six/moves/urllib/error.pyi @@ -1,3 +1,3 @@ -from urllib2 import URLError as URLError -from urllib2 import HTTPError as HTTPError from urllib import ContentTooShortError as ContentTooShortError +from urllib2 import HTTPError as HTTPError +from urllib2 import URLError as URLError diff --git a/third_party/2/six/moves/urllib/parse.pyi b/third_party/2/six/moves/urllib/parse.pyi index 4096c27fae9b..6733b99b0d69 100644 --- a/third_party/2/six/moves/urllib/parse.pyi +++ b/third_party/2/six/moves/urllib/parse.pyi @@ -1,4 +1,12 @@ # Stubs for six.moves.urllib.parse +from urllib import quote as quote +from urllib import quote_plus as quote_plus +from urllib import splitquery as splitquery +from urllib import splittag as splittag +from urllib import splituser as splituser +from urllib import unquote as unquote +from urllib import unquote_plus as unquote_plus +from urllib import urlencode as urlencode from urlparse import ParseResult as ParseResult from urlparse import SplitResult as SplitResult from urlparse import parse_qs as parse_qs @@ -9,14 +17,6 @@ from urlparse import urlparse as urlparse from urlparse import urlsplit as urlsplit from urlparse import urlunparse as urlunparse from urlparse import urlunsplit as urlunsplit -from urllib import quote as quote -from urllib import quote_plus as quote_plus -from urllib import unquote as unquote -from urllib import unquote_plus as unquote_plus -from urllib import urlencode as urlencode -from urllib import splitquery as splitquery -from urllib import splittag as splittag -from urllib import splituser as splituser from urlparse import uses_fragment as uses_fragment from urlparse import uses_netloc as uses_netloc from urlparse import uses_params as uses_params diff --git a/third_party/2/six/moves/urllib/request.pyi b/third_party/2/six/moves/urllib/request.pyi index 6aadde161b0e..479e629097ef 100644 --- a/third_party/2/six/moves/urllib/request.pyi +++ b/third_party/2/six/moves/urllib/request.pyi @@ -1,36 +1,36 @@ # Stubs for six.moves.urllib.request -from urllib2 import urlopen as urlopen -from urllib2 import install_opener as install_opener -from urllib2 import build_opener as build_opener +from urllib import FancyURLopener as FancyURLopener +from urllib import URLopener as URLopener +from urllib import getproxies as getproxies from urllib import pathname2url as pathname2url +from urllib import proxy_bypass as proxy_bypass from urllib import url2pathname as url2pathname -from urllib import getproxies as getproxies -from urllib2 import Request as Request -from urllib2 import OpenerDirector as OpenerDirector -from urllib2 import HTTPDefaultErrorHandler as HTTPDefaultErrorHandler -from urllib2 import HTTPRedirectHandler as HTTPRedirectHandler -from urllib2 import HTTPCookieProcessor as HTTPCookieProcessor -from urllib2 import ProxyHandler as ProxyHandler -from urllib2 import BaseHandler as BaseHandler -from urllib2 import HTTPPasswordMgr as HTTPPasswordMgr -from urllib2 import HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm +from urllib import urlcleanup as urlcleanup +from urllib import urlretrieve as urlretrieve from urllib2 import AbstractBasicAuthHandler as AbstractBasicAuthHandler -from urllib2 import HTTPBasicAuthHandler as HTTPBasicAuthHandler -from urllib2 import ProxyBasicAuthHandler as ProxyBasicAuthHandler from urllib2 import AbstractDigestAuthHandler as AbstractDigestAuthHandler +from urllib2 import BaseHandler as BaseHandler +from urllib2 import CacheFTPHandler as CacheFTPHandler +from urllib2 import FileHandler as FileHandler +from urllib2 import FTPHandler as FTPHandler +from urllib2 import HTTPBasicAuthHandler as HTTPBasicAuthHandler +from urllib2 import HTTPCookieProcessor as HTTPCookieProcessor +from urllib2 import HTTPDefaultErrorHandler as HTTPDefaultErrorHandler from urllib2 import HTTPDigestAuthHandler as HTTPDigestAuthHandler -from urllib2 import ProxyDigestAuthHandler as ProxyDigestAuthHandler +from urllib2 import HTTPErrorProcessor as HTTPErrorProcessor from urllib2 import HTTPHandler as HTTPHandler +from urllib2 import HTTPPasswordMgr as HTTPPasswordMgr +from urllib2 import HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm +from urllib2 import HTTPRedirectHandler as HTTPRedirectHandler from urllib2 import HTTPSHandler as HTTPSHandler -from urllib2 import FileHandler as FileHandler -from urllib2 import FTPHandler as FTPHandler -from urllib2 import CacheFTPHandler as CacheFTPHandler +from urllib2 import OpenerDirector as OpenerDirector +from urllib2 import ProxyBasicAuthHandler as ProxyBasicAuthHandler +from urllib2 import ProxyDigestAuthHandler as ProxyDigestAuthHandler +from urllib2 import ProxyHandler as ProxyHandler +from urllib2 import Request as Request from urllib2 import UnknownHandler as UnknownHandler -from urllib2 import HTTPErrorProcessor as HTTPErrorProcessor -from urllib import urlretrieve as urlretrieve -from urllib import urlcleanup as urlcleanup -from urllib import URLopener as URLopener -from urllib import FancyURLopener as FancyURLopener -from urllib import proxy_bypass as proxy_bypass +from urllib2 import build_opener as build_opener +from urllib2 import install_opener as install_opener from urllib2 import parse_http_list as parse_http_list from urllib2 import parse_keqv_list as parse_keqv_list +from urllib2 import urlopen as urlopen diff --git a/third_party/2/tornado/gen.pyi b/third_party/2/tornado/gen.pyi index ee3954b09863..809e7eaf09a3 100644 --- a/third_party/2/tornado/gen.pyi +++ b/third_party/2/tornado/gen.pyi @@ -1,5 +1,5 @@ -from typing import Any from collections import namedtuple +from typing import Any singledispatch: Any diff --git a/third_party/2/tornado/httpclient.pyi b/third_party/2/tornado/httpclient.pyi index f10709333b1d..abc6e81c1715 100644 --- a/third_party/2/tornado/httpclient.pyi +++ b/third_party/2/tornado/httpclient.pyi @@ -1,4 +1,5 @@ from typing import Any + from tornado.util import Configurable class HTTPClient: diff --git a/third_party/2/tornado/httpserver.pyi b/third_party/2/tornado/httpserver.pyi index 9bcf99a884f5..ad3c40952ddf 100644 --- a/third_party/2/tornado/httpserver.pyi +++ b/third_party/2/tornado/httpserver.pyi @@ -1,4 +1,5 @@ from typing import Any + from tornado import httputil from tornado.tcpserver import TCPServer from tornado.util import Configurable diff --git a/third_party/2/tornado/httputil.pyi b/third_party/2/tornado/httputil.pyi index bfc81fa786a7..a916eb4e52cd 100644 --- a/third_party/2/tornado/httputil.pyi +++ b/third_party/2/tornado/httputil.pyi @@ -1,6 +1,7 @@ +from collections import namedtuple from typing import Any + from tornado.util import ObjectDict -from collections import namedtuple class SSLError(Exception): ... diff --git a/third_party/2/tornado/ioloop.pyi b/third_party/2/tornado/ioloop.pyi index 92c3548e3a2a..541c58684123 100644 --- a/third_party/2/tornado/ioloop.pyi +++ b/third_party/2/tornado/ioloop.pyi @@ -1,4 +1,5 @@ from typing import Any + from tornado.util import Configurable signal: Any diff --git a/third_party/2/tornado/netutil.pyi b/third_party/2/tornado/netutil.pyi index 53c8fc70d376..ca8af80a2ed7 100644 --- a/third_party/2/tornado/netutil.pyi +++ b/third_party/2/tornado/netutil.pyi @@ -1,4 +1,5 @@ from typing import Any + from tornado.util import Configurable ssl: Any diff --git a/third_party/2/tornado/testing.pyi b/third_party/2/tornado/testing.pyi index 25fd0e59e583..0c130c0b66cb 100644 --- a/third_party/2/tornado/testing.pyi +++ b/third_party/2/tornado/testing.pyi @@ -1,6 +1,6 @@ -from typing import Any, Optional -import unittest import logging +import unittest +from typing import Any, Optional AsyncHTTPClient: Any gen: Any diff --git a/third_party/2/tornado/web.pyi b/third_party/2/tornado/web.pyi index c63f414d11ab..254b7805e938 100644 --- a/third_party/2/tornado/web.pyi +++ b/third_party/2/tornado/web.pyi @@ -1,4 +1,5 @@ from typing import Any + from tornado import httputil MIN_SUPPORTED_SIGNED_VALUE_VERSION: Any diff --git a/third_party/2and3/Crypto/Cipher/AES.pyi b/third_party/2and3/Crypto/Cipher/AES.pyi index 144ccfa08f7d..001acaefdabf 100644 --- a/third_party/2and3/Crypto/Cipher/AES.pyi +++ b/third_party/2and3/Crypto/Cipher/AES.pyi @@ -1,4 +1,5 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union + from .blockalgo import BlockAlgo __revision__: str diff --git a/third_party/2and3/Crypto/Cipher/ARC2.pyi b/third_party/2and3/Crypto/Cipher/ARC2.pyi index 24a12ea12063..c492277cd460 100644 --- a/third_party/2and3/Crypto/Cipher/ARC2.pyi +++ b/third_party/2and3/Crypto/Cipher/ARC2.pyi @@ -1,4 +1,5 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union + from .blockalgo import BlockAlgo __revision__: str diff --git a/third_party/2and3/Crypto/Cipher/ARC4.pyi b/third_party/2and3/Crypto/Cipher/ARC4.pyi index 109e2bfde7bb..82d266da03a2 100644 --- a/third_party/2and3/Crypto/Cipher/ARC4.pyi +++ b/third_party/2and3/Crypto/Cipher/ARC4.pyi @@ -1,4 +1,4 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union __revision__: str diff --git a/third_party/2and3/Crypto/Cipher/Blowfish.pyi b/third_party/2and3/Crypto/Cipher/Blowfish.pyi index e29ca6b1203f..a42aa3e689df 100644 --- a/third_party/2and3/Crypto/Cipher/Blowfish.pyi +++ b/third_party/2and3/Crypto/Cipher/Blowfish.pyi @@ -1,4 +1,5 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union + from .blockalgo import BlockAlgo __revision__: str diff --git a/third_party/2and3/Crypto/Cipher/CAST.pyi b/third_party/2and3/Crypto/Cipher/CAST.pyi index b291919337b4..c84e9b9c77ce 100644 --- a/third_party/2and3/Crypto/Cipher/CAST.pyi +++ b/third_party/2and3/Crypto/Cipher/CAST.pyi @@ -1,4 +1,5 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union + from .blockalgo import BlockAlgo __revision__: str diff --git a/third_party/2and3/Crypto/Cipher/DES.pyi b/third_party/2and3/Crypto/Cipher/DES.pyi index 30a40dd42af6..b4f93533d44e 100644 --- a/third_party/2and3/Crypto/Cipher/DES.pyi +++ b/third_party/2and3/Crypto/Cipher/DES.pyi @@ -1,4 +1,5 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union + from .blockalgo import BlockAlgo __revision__: str diff --git a/third_party/2and3/Crypto/Cipher/DES3.pyi b/third_party/2and3/Crypto/Cipher/DES3.pyi index 59ccd8f22c26..42c930295354 100644 --- a/third_party/2and3/Crypto/Cipher/DES3.pyi +++ b/third_party/2and3/Crypto/Cipher/DES3.pyi @@ -1,4 +1,4 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union from .blockalgo import BlockAlgo diff --git a/third_party/2and3/Crypto/Cipher/PKCS1_OAEP.pyi b/third_party/2and3/Crypto/Cipher/PKCS1_OAEP.pyi index 50980a46b931..239d237694b3 100644 --- a/third_party/2and3/Crypto/Cipher/PKCS1_OAEP.pyi +++ b/third_party/2and3/Crypto/Cipher/PKCS1_OAEP.pyi @@ -1,4 +1,4 @@ -from typing import Any, Optional, Union, Text +from typing import Any, Optional, Text, Union from Crypto.PublicKey.RSA import _RSAobj diff --git a/third_party/2and3/Crypto/Cipher/PKCS1_v1_5.pyi b/third_party/2and3/Crypto/Cipher/PKCS1_v1_5.pyi index c2b9ea1a904b..6a993a82777d 100644 --- a/third_party/2and3/Crypto/Cipher/PKCS1_v1_5.pyi +++ b/third_party/2and3/Crypto/Cipher/PKCS1_v1_5.pyi @@ -1,4 +1,4 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union from Crypto.PublicKey.RSA import _RSAobj diff --git a/third_party/2and3/Crypto/Cipher/XOR.pyi b/third_party/2and3/Crypto/Cipher/XOR.pyi index 4c952c22235a..e2f0dc449856 100644 --- a/third_party/2and3/Crypto/Cipher/XOR.pyi +++ b/third_party/2and3/Crypto/Cipher/XOR.pyi @@ -1,4 +1,4 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union __revision__: str diff --git a/third_party/2and3/Crypto/Cipher/blockalgo.pyi b/third_party/2and3/Crypto/Cipher/blockalgo.pyi index 8286b7a31f0c..a7ae666a2665 100644 --- a/third_party/2and3/Crypto/Cipher/blockalgo.pyi +++ b/third_party/2and3/Crypto/Cipher/blockalgo.pyi @@ -1,4 +1,4 @@ -from typing import Any, Union, Text +from typing import Any, Text, Union MODE_ECB: int MODE_CBC: int diff --git a/third_party/2and3/Crypto/Hash/MD2.pyi b/third_party/2and3/Crypto/Hash/MD2.pyi index 1575b1146f4a..ef6d3180ac79 100644 --- a/third_party/2and3/Crypto/Hash/MD2.pyi +++ b/third_party/2and3/Crypto/Hash/MD2.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class MD2Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Hash/MD4.pyi b/third_party/2and3/Crypto/Hash/MD4.pyi index 644b3bdb3607..1d5c504be170 100644 --- a/third_party/2and3/Crypto/Hash/MD4.pyi +++ b/third_party/2and3/Crypto/Hash/MD4.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class MD4Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Hash/MD5.pyi b/third_party/2and3/Crypto/Hash/MD5.pyi index 52261ab305d7..888af0eb0635 100644 --- a/third_party/2and3/Crypto/Hash/MD5.pyi +++ b/third_party/2and3/Crypto/Hash/MD5.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class MD5Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Hash/RIPEMD.pyi b/third_party/2and3/Crypto/Hash/RIPEMD.pyi index 3fe4ac53c5fc..a4241113291e 100644 --- a/third_party/2and3/Crypto/Hash/RIPEMD.pyi +++ b/third_party/2and3/Crypto/Hash/RIPEMD.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class RIPEMD160Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Hash/SHA.pyi b/third_party/2and3/Crypto/Hash/SHA.pyi index 145abd899e1f..e595c5841f5e 100644 --- a/third_party/2and3/Crypto/Hash/SHA.pyi +++ b/third_party/2and3/Crypto/Hash/SHA.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class SHA1Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Hash/SHA224.pyi b/third_party/2and3/Crypto/Hash/SHA224.pyi index fcd170fc00bf..39895ba93e1b 100644 --- a/third_party/2and3/Crypto/Hash/SHA224.pyi +++ b/third_party/2and3/Crypto/Hash/SHA224.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class SHA224Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Hash/SHA256.pyi b/third_party/2and3/Crypto/Hash/SHA256.pyi index 2ee94720584d..40b04379f609 100644 --- a/third_party/2and3/Crypto/Hash/SHA256.pyi +++ b/third_party/2and3/Crypto/Hash/SHA256.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class SHA256Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Hash/SHA384.pyi b/third_party/2and3/Crypto/Hash/SHA384.pyi index ce63a32e1884..a810dd25a5bf 100644 --- a/third_party/2and3/Crypto/Hash/SHA384.pyi +++ b/third_party/2and3/Crypto/Hash/SHA384.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class SHA384Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Hash/SHA512.pyi b/third_party/2and3/Crypto/Hash/SHA512.pyi index c59eb765cab7..1781017e3e14 100644 --- a/third_party/2and3/Crypto/Hash/SHA512.pyi +++ b/third_party/2and3/Crypto/Hash/SHA512.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash.hashalgo import HashAlgo class SHA512Hash(HashAlgo): diff --git a/third_party/2and3/Crypto/Protocol/KDF.pyi b/third_party/2and3/Crypto/Protocol/KDF.pyi index a10d8399028d..b4fcdb4e083a 100644 --- a/third_party/2and3/Crypto/Protocol/KDF.pyi +++ b/third_party/2and3/Crypto/Protocol/KDF.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from Crypto.Hash import SHA as SHA1 __revision__: str diff --git a/third_party/2and3/Crypto/PublicKey/DSA.pyi b/third_party/2and3/Crypto/PublicKey/DSA.pyi index bc48d230f88c..e0b4b8956b27 100644 --- a/third_party/2and3/Crypto/PublicKey/DSA.pyi +++ b/third_party/2and3/Crypto/PublicKey/DSA.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from .pubkey import pubkey class _DSAobj(pubkey): diff --git a/third_party/2and3/Crypto/PublicKey/ElGamal.pyi b/third_party/2and3/Crypto/PublicKey/ElGamal.pyi index 1a256a344ec6..507c72523cee 100644 --- a/third_party/2and3/Crypto/PublicKey/ElGamal.pyi +++ b/third_party/2and3/Crypto/PublicKey/ElGamal.pyi @@ -1,7 +1,7 @@ from typing import Any, Optional -from Crypto.PublicKey.pubkey import pubkey from Crypto.PublicKey.pubkey import * # noqa: F403 +from Crypto.PublicKey.pubkey import pubkey class error(Exception): ... diff --git a/third_party/2and3/Crypto/PublicKey/RSA.pyi b/third_party/2and3/Crypto/PublicKey/RSA.pyi index 5ce7b910adc2..d5977f6bb766 100644 --- a/third_party/2and3/Crypto/PublicKey/RSA.pyi +++ b/third_party/2and3/Crypto/PublicKey/RSA.pyi @@ -1,4 +1,5 @@ -from typing import Any, Optional, Union, Text +from typing import Any, Optional, Text, Union + from .pubkey import pubkey class _RSAobj(pubkey): diff --git a/third_party/2and3/Crypto/Random/OSRNG/posix.pyi b/third_party/2and3/Crypto/Random/OSRNG/posix.pyi index bbaf74047b02..2c6586b06dc6 100644 --- a/third_party/2and3/Crypto/Random/OSRNG/posix.pyi +++ b/third_party/2and3/Crypto/Random/OSRNG/posix.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from .rng_base import BaseRNG class DevURandomRNG(BaseRNG): diff --git a/third_party/2and3/atomicwrites/__init__.pyi b/third_party/2and3/atomicwrites/__init__.pyi index 07edff6979d8..45a01544808d 100644 --- a/third_party/2and3/atomicwrites/__init__.pyi +++ b/third_party/2and3/atomicwrites/__init__.pyi @@ -1,4 +1,4 @@ -from typing import AnyStr, Callable, ContextManager, IO, Optional, Text, Type +from typing import IO, AnyStr, Callable, ContextManager, Optional, Text, Type def replace_atomic(src: AnyStr, dst: AnyStr) -> None: ... def move_atomic(src: AnyStr, dst: AnyStr) -> None: ... diff --git a/third_party/2and3/attr/__init__.pyi b/third_party/2and3/attr/__init__.pyi index fcb93b18e36f..4cc73c5a848f 100644 --- a/third_party/2and3/attr/__init__.pyi +++ b/third_party/2and3/attr/__init__.pyi @@ -1,23 +1,9 @@ -from typing import ( - Any, - Callable, - Dict, - Generic, - List, - Optional, - Sequence, - Mapping, - Tuple, - Type, - TypeVar, - Union, - overload, -) +from typing import Any, Callable, Dict, Generic, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, overload # `import X as X` is required to make these public +from . import converters as converters from . import exceptions as exceptions from . import filters as filters -from . import converters as converters from . import validators as validators _T = TypeVar("_T") diff --git a/third_party/2and3/attr/converters.pyi b/third_party/2and3/attr/converters.pyi index 63b2a3866e31..011a3a469bfb 100644 --- a/third_party/2and3/attr/converters.pyi +++ b/third_party/2and3/attr/converters.pyi @@ -1,4 +1,5 @@ -from typing import TypeVar, Optional, Callable, overload +from typing import Callable, Optional, TypeVar, overload + from . import _ConverterType _T = TypeVar("_T") diff --git a/third_party/2and3/attr/filters.pyi b/third_party/2and3/attr/filters.pyi index 68368fe2b92d..993866865eab 100644 --- a/third_party/2and3/attr/filters.pyi +++ b/third_party/2and3/attr/filters.pyi @@ -1,4 +1,5 @@ -from typing import Union, Any +from typing import Any, Union + from . import Attribute, _FilterType def include(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ... diff --git a/third_party/2and3/attr/validators.pyi b/third_party/2and3/attr/validators.pyi index 01af06845ec3..b7bd25c14985 100644 --- a/third_party/2and3/attr/validators.pyi +++ b/third_party/2and3/attr/validators.pyi @@ -1,4 +1,5 @@ -from typing import Container, List, Union, TypeVar, Type, Any, Optional, Tuple +from typing import Any, Container, List, Optional, Tuple, Type, TypeVar, Union + from . import _ValidatorType _T = TypeVar("_T") diff --git a/third_party/2and3/bleach/__init__.pyi b/third_party/2and3/bleach/__init__.pyi index 3a1ad2c4e0cb..a78854593e77 100644 --- a/third_party/2and3/bleach/__init__.pyi +++ b/third_party/2and3/bleach/__init__.pyi @@ -1,13 +1,12 @@ from typing import Any, Container, Iterable, Optional, Text -from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker -from bleach.sanitizer import ( - ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES, - ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS, - ALLOWED_STYLES as ALLOWED_STYLES, - ALLOWED_TAGS as ALLOWED_TAGS, - Cleaner as Cleaner, -) +from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS +from bleach.linkifier import Linker as Linker +from bleach.sanitizer import ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES +from bleach.sanitizer import ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS +from bleach.sanitizer import ALLOWED_STYLES as ALLOWED_STYLES +from bleach.sanitizer import ALLOWED_TAGS as ALLOWED_TAGS +from bleach.sanitizer import Cleaner as Cleaner from .linkifier import _Callback diff --git a/third_party/2and3/bleach/callbacks.pyi b/third_party/2and3/bleach/callbacks.pyi index 25c5c01e3eb5..d89fe1eaa37c 100644 --- a/third_party/2and3/bleach/callbacks.pyi +++ b/third_party/2and3/bleach/callbacks.pyi @@ -1,4 +1,4 @@ -from typing import MutableMapping, Any, Text +from typing import Any, MutableMapping, Text _Attrs = MutableMapping[Any, Text] diff --git a/third_party/2and3/bleach/utils.pyi b/third_party/2and3/bleach/utils.pyi index 984c554bd0cc..e4edcfbd8abe 100644 --- a/third_party/2and3/bleach/utils.pyi +++ b/third_party/2and3/bleach/utils.pyi @@ -1,5 +1,5 @@ from collections import OrderedDict -from typing import overload, Mapping, Any, Text +from typing import Any, Mapping, Text, overload @overload def alphabetize_attributes(attrs: None) -> None: ... diff --git a/third_party/2and3/boto/__init__.pyi b/third_party/2and3/boto/__init__.pyi index 8426785ab5b0..3f4c9fbcf0e1 100644 --- a/third_party/2and3/boto/__init__.pyi +++ b/third_party/2and3/boto/__init__.pyi @@ -1,5 +1,5 @@ -from typing import Any, Optional, Text import logging +from typing import Any, Optional, Text from .s3.connection import S3Connection diff --git a/third_party/2and3/boto/auth.pyi b/third_party/2and3/boto/auth.pyi index 033d1d79d9e0..f59955010872 100644 --- a/third_party/2and3/boto/auth.pyi +++ b/third_party/2and3/boto/auth.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from boto.auth_handler import AuthHandler SIGV4_DETECT: Any diff --git a/third_party/2and3/boto/auth_handler.pyi b/third_party/2and3/boto/auth_handler.pyi index 018e6d1d6703..7cc874bc8d79 100644 --- a/third_party/2and3/boto/auth_handler.pyi +++ b/third_party/2and3/boto/auth_handler.pyi @@ -1,4 +1,5 @@ from typing import Any + from boto.plugin import Plugin class NotReadyToAuthenticate(Exception): ... diff --git a/third_party/2and3/boto/compat.pyi b/third_party/2and3/boto/compat.pyi index ce997030aba9..03cd256d5470 100644 --- a/third_party/2and3/boto/compat.pyi +++ b/third_party/2and3/boto/compat.pyi @@ -1,7 +1,6 @@ import sys - -from typing import Any from base64 import encodestring as encodebytes +from typing import Any from six.moves import http_client diff --git a/third_party/2and3/boto/connection.pyi b/third_party/2and3/boto/connection.pyi index 820d6e3a16a0..a588eabeb7bf 100644 --- a/third_party/2and3/boto/connection.pyi +++ b/third_party/2and3/boto/connection.pyi @@ -1,4 +1,5 @@ from typing import Any, Dict, Optional, Text + from six.moves import http_client HAVE_HTTPS_CONNECTION: bool diff --git a/third_party/2and3/boto/elb/__init__.pyi b/third_party/2and3/boto/elb/__init__.pyi index 16cf5b48fb3e..2d51f10e93e2 100644 --- a/third_party/2and3/boto/elb/__init__.pyi +++ b/third_party/2and3/boto/elb/__init__.pyi @@ -1,4 +1,5 @@ from typing import Any + from boto.connection import AWSQueryConnection RegionData: Any diff --git a/third_party/2and3/boto/exception.pyi b/third_party/2and3/boto/exception.pyi index e83a07402e92..a8db84c13131 100644 --- a/third_party/2and3/boto/exception.pyi +++ b/third_party/2and3/boto/exception.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional + from boto.compat import StandardError class BotoClientError(StandardError): diff --git a/third_party/2and3/boto/kms/__init__.pyi b/third_party/2and3/boto/kms/__init__.pyi index 41fff607ec8c..ec5dfacb7f5b 100644 --- a/third_party/2and3/boto/kms/__init__.pyi +++ b/third_party/2and3/boto/kms/__init__.pyi @@ -1,4 +1,5 @@ from typing import List + import boto.regioninfo def regions() -> List[boto.regioninfo.RegionInfo]: ... diff --git a/third_party/2and3/boto/kms/layer1.pyi b/third_party/2and3/boto/kms/layer1.pyi index f48ce665c5bf..76cca6b46a97 100644 --- a/third_party/2and3/boto/kms/layer1.pyi +++ b/third_party/2and3/boto/kms/layer1.pyi @@ -1,4 +1,5 @@ from typing import Any, Dict, List, Mapping, Optional, Type + from boto.connection import AWSQueryConnection class KMSConnection(AWSQueryConnection): diff --git a/third_party/2and3/boto/s3/__init__.pyi b/third_party/2and3/boto/s3/__init__.pyi index d88955e0df9f..9f002bbf80c0 100644 --- a/third_party/2and3/boto/s3/__init__.pyi +++ b/third_party/2and3/boto/s3/__init__.pyi @@ -1,11 +1,9 @@ -from typing import Optional - -from .connection import S3Connection +from typing import List, Optional, Text, Type from boto.connection import AWSAuthConnection from boto.regioninfo import RegionInfo -from typing import List, Type, Text +from .connection import S3Connection class S3RegionInfo(RegionInfo): def connect(self, name: Optional[Text] = ..., endpoint: Optional[str] = ..., connection_cls: Optional[Type[AWSAuthConnection]] = ..., **kw_params) -> S3Connection: ... diff --git a/third_party/2and3/boto/s3/acl.pyi b/third_party/2and3/boto/s3/acl.pyi index 168f914a1c8e..a8fe6119baa0 100644 --- a/third_party/2and3/boto/s3/acl.pyi +++ b/third_party/2and3/boto/s3/acl.pyi @@ -1,6 +1,7 @@ +from typing import Any, Dict, List, Optional, Text, Union + from .connection import S3Connection from .user import User -from typing import Any, Dict, Optional, List, Text, Union CannedACLStrings: List[str] diff --git a/third_party/2and3/boto/s3/bucket.pyi b/third_party/2and3/boto/s3/bucket.pyi index daed50212241..a59a6c5f341a 100644 --- a/third_party/2and3/boto/s3/bucket.pyi +++ b/third_party/2and3/boto/s3/bucket.pyi @@ -1,9 +1,9 @@ +from typing import Any, Dict, List, Optional, Text, Type + from .bucketlistresultset import BucketListResultSet from .connection import S3Connection from .key import Key -from typing import Any, Dict, Optional, Text, Type, List - class S3WebsiteEndpointTranslate: trans_region: Dict[str, str] @classmethod diff --git a/third_party/2and3/boto/s3/bucketlistresultset.pyi b/third_party/2and3/boto/s3/bucketlistresultset.pyi index b33d84d96ea5..8cef08317b2d 100644 --- a/third_party/2and3/boto/s3/bucketlistresultset.pyi +++ b/third_party/2and3/boto/s3/bucketlistresultset.pyi @@ -1,8 +1,8 @@ +from typing import Any, Iterable, Iterator, Optional + from .bucket import Bucket from .key import Key -from typing import Any, Iterable, Iterator, Optional - def bucket_lister(bucket, prefix: str = ..., delimiter: str = ..., marker: str = ..., headers: Optional[Any] = ..., encoding_type: Optional[Any] = ...): ... class BucketListResultSet(Iterable[Key]): diff --git a/third_party/2and3/boto/s3/connection.pyi b/third_party/2and3/boto/s3/connection.pyi index 9148e6832f92..f3de639020c6 100644 --- a/third_party/2and3/boto/s3/connection.pyi +++ b/third_party/2and3/boto/s3/connection.pyi @@ -1,9 +1,10 @@ -from .bucket import Bucket - from typing import Any, Dict, Optional, Text, Type + from boto.connection import AWSAuthConnection from boto.exception import BotoClientError +from .bucket import Bucket + def check_lowercase_bucketname(n): ... def assert_case_insensitive(f): ... diff --git a/third_party/2and3/boto/utils.pyi b/third_party/2and3/boto/utils.pyi index 6552b0af1610..84caa60dfc4d 100644 --- a/third_party/2and3/boto/utils.pyi +++ b/third_party/2and3/boto/utils.pyi @@ -3,14 +3,12 @@ import logging.handlers import subprocess import sys import time - -import boto.connection from typing import ( + IO, Any, Callable, ContextManager, Dict, - IO, Iterable, List, Mapping, @@ -22,6 +20,8 @@ from typing import ( Union, ) +import boto.connection + _KT = TypeVar('_KT') _VT = TypeVar('_VT') diff --git a/third_party/2and3/characteristic/__init__.pyi b/third_party/2and3/characteristic/__init__.pyi index 20bd6e58a94e..4a7bd639c78e 100644 --- a/third_party/2and3/characteristic/__init__.pyi +++ b/third_party/2and3/characteristic/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Sequence, Callable, Union, Any, Optional, AnyStr, TypeVar, Type +from typing import Any, AnyStr, Callable, Optional, Sequence, Type, TypeVar, Union def with_repr(attrs: Sequence[Union[AnyStr, Attribute]]) -> Callable[..., Any]: ... def with_cmp(attrs: Sequence[Union[AnyStr, Attribute]]) -> Callable[..., Any]: ... diff --git a/third_party/2and3/click/__init__.pyi b/third_party/2and3/click/__init__.pyi index 4733c6d0c006..62124a59da77 100644 --- a/third_party/2and3/click/__init__.pyi +++ b/third_party/2and3/click/__init__.pyi @@ -15,98 +15,79 @@ """ # Core classes -from .core import ( - Context as Context, - BaseCommand as BaseCommand, - Command as Command, - MultiCommand as MultiCommand, - Group as Group, - CommandCollection as CommandCollection, - Parameter as Parameter, - Option as Option, - Argument as Argument, -) - -# Globals -from .globals import get_current_context as get_current_context - +from .core import Argument as Argument +from .core import BaseCommand as BaseCommand +from .core import Command as Command +from .core import CommandCollection as CommandCollection +from .core import Context as Context +from .core import Group as Group +from .core import MultiCommand as MultiCommand +from .core import Option as Option +from .core import Parameter as Parameter # Decorators -from .decorators import ( - pass_context as pass_context, - pass_obj as pass_obj, - make_pass_decorator as make_pass_decorator, - command as command, - group as group, - argument as argument, - option as option, - confirmation_option as confirmation_option, - password_option as password_option, - version_option as version_option, - help_option as help_option, -) - -# Types -from .types import ( - ParamType as ParamType, - File as File, - Path as Path, - Choice as Choice, - IntRange as IntRange, - Tuple as Tuple, - STRING as STRING, - INT as INT, - FLOAT as FLOAT, - BOOL as BOOL, - UUID as UUID, - UNPROCESSED as UNPROCESSED, -) - -# Utilities -from .utils import ( - echo as echo, - get_binary_stream as get_binary_stream, - get_text_stream as get_text_stream, - open_file as open_file, - format_filename as format_filename, - get_app_dir as get_app_dir, - get_os_args as get_os_args, -) - -# Terminal functions -from .termui import ( - prompt as prompt, - confirm as confirm, - get_terminal_size as get_terminal_size, - echo_via_pager as echo_via_pager, - progressbar as progressbar, - clear as clear, - style as style, - unstyle as unstyle, - secho as secho, - edit as edit, - launch as launch, - getchar as getchar, - pause as pause, -) - +from .decorators import argument as argument +from .decorators import command as command +from .decorators import confirmation_option as confirmation_option +from .decorators import group as group +from .decorators import help_option as help_option +from .decorators import make_pass_decorator as make_pass_decorator +from .decorators import option as option +from .decorators import pass_context as pass_context +from .decorators import pass_obj as pass_obj +from .decorators import password_option as password_option +from .decorators import version_option as version_option # Exceptions -from .exceptions import ( - ClickException as ClickException, - UsageError as UsageError, - BadParameter as BadParameter, - FileError as FileError, - Abort as Abort, - NoSuchOption as NoSuchOption, - BadOptionUsage as BadOptionUsage, - BadArgumentUsage as BadArgumentUsage, - MissingParameter as MissingParameter, -) - +from .exceptions import Abort as Abort +from .exceptions import BadArgumentUsage as BadArgumentUsage +from .exceptions import BadOptionUsage as BadOptionUsage +from .exceptions import BadParameter as BadParameter +from .exceptions import ClickException as ClickException +from .exceptions import FileError as FileError +from .exceptions import MissingParameter as MissingParameter +from .exceptions import NoSuchOption as NoSuchOption +from .exceptions import UsageError as UsageError # Formatting -from .formatting import HelpFormatter as HelpFormatter, wrap_text as wrap_text - +from .formatting import HelpFormatter as HelpFormatter +from .formatting import wrap_text as wrap_text +# Globals +from .globals import get_current_context as get_current_context # Parsing from .parser import OptionParser as OptionParser +# Terminal functions +from .termui import clear as clear +from .termui import confirm as confirm +from .termui import echo_via_pager as echo_via_pager +from .termui import edit as edit +from .termui import get_terminal_size as get_terminal_size +from .termui import getchar as getchar +from .termui import launch as launch +from .termui import pause as pause +from .termui import progressbar as progressbar +from .termui import prompt as prompt +from .termui import secho as secho +from .termui import style as style +from .termui import unstyle as unstyle +# Types +from .types import BOOL as BOOL +from .types import FLOAT as FLOAT +from .types import INT as INT +from .types import STRING as STRING +from .types import UNPROCESSED as UNPROCESSED +from .types import UUID as UUID +from .types import Choice as Choice +from .types import File as File +from .types import IntRange as IntRange +from .types import ParamType as ParamType +from .types import Path as Path +from .types import Tuple as Tuple +# Utilities +from .utils import echo as echo +from .utils import format_filename as format_filename +from .utils import get_app_dir as get_app_dir +from .utils import get_binary_stream as get_binary_stream +from .utils import get_os_args as get_os_args +from .utils import get_text_stream as get_text_stream +from .utils import open_file as open_file # Controls if click should emit the warning about the use of unicode # literals. diff --git a/third_party/2and3/click/_termui_impl.pyi b/third_party/2and3/click/_termui_impl.pyi index f938c1c9dab6..4b19a0be315b 100644 --- a/third_party/2and3/click/_termui_impl.pyi +++ b/third_party/2and3/click/_termui_impl.pyi @@ -1,4 +1,4 @@ -from typing import ContextManager, Iterator, Generic, TypeVar, Optional +from typing import ContextManager, Generic, Iterator, Optional, TypeVar _T = TypeVar("_T") diff --git a/third_party/2and3/click/decorators.pyi b/third_party/2and3/click/decorators.pyi index 44f4ad7883b0..22475da92745 100644 --- a/third_party/2and3/click/decorators.pyi +++ b/third_party/2and3/click/decorators.pyi @@ -1,7 +1,7 @@ from distutils.version import Version -from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union, Text, overload +from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Type, TypeVar, Union, overload -from click.core import Command, Group, Argument, Option, Parameter, Context, _ConvertibleType +from click.core import Argument, Command, Context, Group, Option, Parameter, _ConvertibleType _T = TypeVar('_T') _F = TypeVar('_F', bound=Callable[..., Any]) diff --git a/third_party/2and3/click/exceptions.pyi b/third_party/2and3/click/exceptions.pyi index ab2932eb4a5e..7884a08ff3af 100644 --- a/third_party/2and3/click/exceptions.pyi +++ b/third_party/2and3/click/exceptions.pyi @@ -1,8 +1,7 @@ -from typing import IO, List, Optional, Any +from typing import IO, Any, List, Optional from click.core import Context, Parameter - class ClickException(Exception): exit_code: int message: str diff --git a/third_party/2and3/click/formatting.pyi b/third_party/2and3/click/formatting.pyi index bcd3048e9ae8..80225ab60154 100644 --- a/third_party/2and3/click/formatting.pyi +++ b/third_party/2and3/click/formatting.pyi @@ -1,6 +1,5 @@ from typing import ContextManager, Generator, Iterable, List, Optional, Tuple - FORCED_WIDTH: Optional[int] diff --git a/third_party/2and3/click/globals.pyi b/third_party/2and3/click/globals.pyi index 11adce3fa419..04addb581bc5 100644 --- a/third_party/2and3/click/globals.pyi +++ b/third_party/2and3/click/globals.pyi @@ -1,6 +1,6 @@ -from click.core import Context from typing import Optional +from click.core import Context def get_current_context(silent: bool = ...) -> Context: ... diff --git a/third_party/2and3/click/parser.pyi b/third_party/2and3/click/parser.pyi index d790bacbc7c1..da3fe83089fa 100644 --- a/third_party/2and3/click/parser.pyi +++ b/third_party/2and3/click/parser.pyi @@ -2,7 +2,6 @@ from typing import Any, Dict, Iterable, List, Optional, Set, Tuple from click.core import Context - def _unpack_args( args: Iterable[str], nargs_spec: Iterable[int] ) -> Tuple[Tuple[Optional[Tuple[str, ...]], ...], List[str]]: diff --git a/third_party/2and3/click/termui.pyi b/third_party/2and3/click/termui.pyi index 4262e32306bb..3a52973ba9bc 100644 --- a/third_party/2and3/click/termui.pyi +++ b/third_party/2and3/click/termui.pyi @@ -1,21 +1,7 @@ -from typing import ( - Any, - Callable, - Generator, - Iterable, - IO, - List, - Optional, - Text, - overload, - Tuple, - TypeVar, - Union, -) +from typing import IO, Any, Callable, Generator, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload -from click.core import _ConvertibleType from click._termui_impl import ProgressBar as _ProgressBar - +from click.core import _ConvertibleType def hidden_prompt_func(prompt: str) -> str: ... diff --git a/third_party/2and3/click/testing.pyi b/third_party/2and3/click/testing.pyi index 6b16df9b2d39..1f3315970017 100644 --- a/third_party/2and3/click/testing.pyi +++ b/third_party/2and3/click/testing.pyi @@ -1,5 +1,4 @@ -from typing import (IO, Any, BinaryIO, ContextManager, Dict, Iterable, List, - Mapping, Optional, Text, Tuple, Union) +from typing import IO, Any, BinaryIO, ContextManager, Dict, Iterable, List, Mapping, Optional, Text, Tuple, Union from .core import BaseCommand diff --git a/third_party/2and3/click/types.pyi b/third_party/2and3/click/types.pyi index 7f1e0ba8f324..50febcdb86ad 100644 --- a/third_party/2and3/click/types.pyi +++ b/third_party/2and3/click/types.pyi @@ -1,8 +1,11 @@ -from typing import Any, Callable, IO, Iterable, List, Optional, TypeVar, Union, Tuple as _PyTuple, Type import datetime import uuid +from typing import IO, Any, Callable, Iterable, List, Optional +from typing import Tuple as _PyTuple +from typing import Type, TypeVar, Union -from click.core import Context, Parameter, _ParamType as ParamType, _ConvertibleType +from click.core import Context, Parameter, _ConvertibleType +from click.core import _ParamType as ParamType class BoolParamType(ParamType): def __call__( diff --git a/third_party/2and3/click/utils.pyi b/third_party/2and3/click/utils.pyi index 547c5e80d85c..d47738f2795c 100644 --- a/third_party/2and3/click/utils.pyi +++ b/third_party/2and3/click/utils.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Iterator, IO, List, Optional, TypeVar, Union, Text +from typing import IO, Any, Callable, Iterator, List, Optional, Text, TypeVar, Union _T = TypeVar('_T') diff --git a/third_party/2and3/dateutil/parser.pyi b/third_party/2and3/dateutil/parser.pyi index 045a7934d66d..551bf50a290e 100644 --- a/third_party/2and3/dateutil/parser.pyi +++ b/third_party/2and3/dateutil/parser.pyi @@ -1,5 +1,5 @@ -from typing import List, Tuple, Optional, Callable, Union, IO, Any, Dict, Mapping, Text from datetime import datetime, tzinfo +from typing import IO, Any, Callable, Dict, List, Mapping, Optional, Text, Tuple, Union _FileOrStr = Union[bytes, Text, IO[str], IO[Any]] diff --git a/third_party/2and3/dateutil/relativedelta.pyi b/third_party/2and3/dateutil/relativedelta.pyi index 40ee586ff1d8..03f096c179ef 100644 --- a/third_party/2and3/dateutil/relativedelta.pyi +++ b/third_party/2and3/dateutil/relativedelta.pyi @@ -1,9 +1,8 @@ -from typing import overload, Any, List, Optional, SupportsFloat, TypeVar, Union from datetime import date, datetime, timedelta +from typing import Any, List, Optional, SupportsFloat, TypeVar, Union, overload from ._common import weekday - _SelfT = TypeVar('_SelfT', bound=relativedelta) _DateT = TypeVar('_DateT', date, datetime) # Work around attribute and type having the same name. diff --git a/third_party/2and3/dateutil/rrule.pyi b/third_party/2and3/dateutil/rrule.pyi index 84e4eb5441bc..22a0d4ca5620 100644 --- a/third_party/2and3/dateutil/rrule.pyi +++ b/third_party/2and3/dateutil/rrule.pyi @@ -1,6 +1,7 @@ -from ._common import weekday as weekdaybase -from typing import Any, Iterable, Optional, Union import datetime +from typing import Any, Iterable, Optional, Union + +from ._common import weekday as weekdaybase YEARLY: int MONTHLY: int diff --git a/third_party/2and3/dateutil/tz/__init__.pyi b/third_party/2and3/dateutil/tz/__init__.pyi index 5a5e45feb03f..21c155e923f4 100644 --- a/third_party/2and3/dateutil/tz/__init__.pyi +++ b/third_party/2and3/dateutil/tz/__init__.pyi @@ -1,15 +1,13 @@ -from .tz import ( - tzutc as tzutc, - tzoffset as tzoffset, - tzlocal as tzlocal, - tzfile as tzfile, - tzrange as tzrange, - tzstr as tzstr, - tzical as tzical, - gettz as gettz, - datetime_exists as datetime_exists, - datetime_ambiguous as datetime_ambiguous, - resolve_imaginary as resolve_imaginary, -) +from .tz import datetime_ambiguous as datetime_ambiguous +from .tz import datetime_exists as datetime_exists +from .tz import gettz as gettz +from .tz import resolve_imaginary as resolve_imaginary +from .tz import tzfile as tzfile +from .tz import tzical as tzical +from .tz import tzlocal as tzlocal +from .tz import tzoffset as tzoffset +from .tz import tzrange as tzrange +from .tz import tzstr as tzstr +from .tz import tzutc as tzutc UTC: tzutc diff --git a/third_party/2and3/dateutil/tz/_common.pyi b/third_party/2and3/dateutil/tz/_common.pyi index 32b06ed290bf..b185f0dcafec 100644 --- a/third_party/2and3/dateutil/tz/_common.pyi +++ b/third_party/2and3/dateutil/tz/_common.pyi @@ -1,5 +1,5 @@ +from datetime import datetime, timedelta, tzinfo from typing import Any, Optional -from datetime import datetime, tzinfo, timedelta def tzname_in_python2(namefunc): ... def enfold(dt: datetime, fold: int = ...): ... diff --git a/third_party/2and3/dateutil/tz/tz.pyi b/third_party/2and3/dateutil/tz/tz.pyi index 71395070f10c..97c3cac7ad60 100644 --- a/third_party/2and3/dateutil/tz/tz.pyi +++ b/third_party/2and3/dateutil/tz/tz.pyi @@ -1,8 +1,11 @@ -from typing import Any, Optional, Union, IO, Text, Tuple, List import datetime -from ._common import tzname_in_python2 as tzname_in_python2, _tzinfo as _tzinfo -from ._common import tzrangebase as tzrangebase, enfold as enfold +from typing import IO, Any, List, Optional, Text, Tuple, Union + from ..relativedelta import relativedelta +from ._common import _tzinfo as _tzinfo +from ._common import enfold as enfold +from ._common import tzname_in_python2 as tzname_in_python2 +from ._common import tzrangebase as tzrangebase _FileObj = Union[str, Text, IO[str], IO[Text]] diff --git a/third_party/2and3/dateutil/utils.pyi b/third_party/2and3/dateutil/utils.pyi index b722053e445d..1eaa66683440 100644 --- a/third_party/2and3/dateutil/utils.pyi +++ b/third_party/2and3/dateutil/utils.pyi @@ -1,6 +1,5 @@ +from datetime import datetime, timedelta, tzinfo from typing import Optional -from datetime import datetime, tzinfo, timedelta - def default_tzinfo(dt: datetime, tzinfo: tzinfo) -> datetime: ... def today(tzinfo: Optional[tzinfo] = ...) -> datetime: ... diff --git a/third_party/2and3/emoji.pyi b/third_party/2and3/emoji.pyi index fe193b124574..81a1f05ce033 100644 --- a/third_party/2and3/emoji.pyi +++ b/third_party/2and3/emoji.pyi @@ -1,4 +1,4 @@ -from typing import Tuple, Pattern, List, Dict, Union +from typing import Dict, List, Pattern, Tuple, Union _DEFAULT_DELIMITER: str diff --git a/third_party/2and3/first.pyi b/third_party/2and3/first.pyi index f03f3a35bc59..a6eb5be0afe9 100644 --- a/third_party/2and3/first.pyi +++ b/third_party/2and3/first.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, Iterable, Optional, overload, TypeVar, Union +from typing import Any, Callable, Iterable, Optional, TypeVar, Union, overload _T = TypeVar('_T') _S = TypeVar('_S') diff --git a/third_party/2and3/flask/__init__.pyi b/third_party/2and3/flask/__init__.pyi index caeac5e2236a..7aed80e8112c 100644 --- a/third_party/2and3/flask/__init__.pyi +++ b/third_party/2and3/flask/__init__.pyi @@ -2,6 +2,11 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from jinja2 import Markup as Markup +from jinja2 import escape as escape +from werkzeug.exceptions import abort as abort +from werkzeug.utils import redirect as redirect + from .app import Flask as Flask from .blueprints import Blueprint as Blueprint from .config import Config as Config @@ -38,8 +43,3 @@ from .templating import render_template as render_template from .templating import render_template_string as render_template_string from .wrappers import Request as Request from .wrappers import Response as Response - -from werkzeug.exceptions import abort as abort -from werkzeug.utils import redirect as redirect -from jinja2 import Markup as Markup -from jinja2 import escape as escape diff --git a/third_party/2and3/flask/app.pyi b/third_party/2and3/flask/app.pyi index 5be3d6d5931b..eb34e60cbb8b 100644 --- a/third_party/2and3/flask/app.pyi +++ b/third_party/2and3/flask/app.pyi @@ -2,19 +2,29 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from datetime import timedelta +from typing import Any, Callable, ContextManager, Dict, List, Optional, Text, Type, TypeVar, Union + from .blueprints import Blueprint from .config import Config, ConfigAttribute from .ctx import AppContext, RequestContext, _AppCtxGlobals from .globals import _request_ctx_stack, g, request, session -from .helpers import _PackageBoundObject, find_package, get_debug_flag, get_env, get_flashed_messages, get_load_dotenv, locked_cached_property, url_for +from .helpers import ( + _PackageBoundObject, + find_package, + get_debug_flag, + get_env, + get_flashed_messages, + get_load_dotenv, + locked_cached_property, + url_for, +) from .logging import create_logger from .sessions import SecureCookieSessionInterface from .signals import appcontext_tearing_down, got_request_exception, request_finished, request_started, request_tearing_down from .templating import DispatchingJinjaLoader, Environment -from .wrappers import Request, Response from .testing import FlaskClient -from typing import Any, Callable, ContextManager, Dict, List, Optional, Type, TypeVar, Union, Text -from datetime import timedelta +from .wrappers import Request, Response def setupmethod(f: Any): ... diff --git a/third_party/2and3/flask/blueprints.pyi b/third_party/2and3/flask/blueprints.pyi index d43f8e4ff612..3c0d6b151252 100644 --- a/third_party/2and3/flask/blueprints.pyi +++ b/third_party/2and3/flask/blueprints.pyi @@ -2,9 +2,10 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from .helpers import _PackageBoundObject from typing import Any, Callable, Optional, Type, TypeVar, Union +from .helpers import _PackageBoundObject + _T = TypeVar('_T') class BlueprintSetupState: diff --git a/third_party/2and3/flask/cli.pyi b/third_party/2and3/flask/cli.pyi index 15d3243f88f3..405a15186dab 100644 --- a/third_party/2and3/flask/cli.pyi +++ b/third_party/2and3/flask/cli.pyi @@ -2,10 +2,12 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any, Optional + import click + from .globals import current_app from .helpers import get_debug_flag, get_env, get_load_dotenv -from typing import Any, Optional class NoAppException(click.UsageError): ... diff --git a/third_party/2and3/flask/config.pyi b/third_party/2and3/flask/config.pyi index 6b925e7248dd..c8897fb38b5f 100644 --- a/third_party/2and3/flask/config.pyi +++ b/third_party/2and3/flask/config.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any, Optional, Dict +from typing import Any, Dict, Optional class ConfigAttribute: __name__: Any = ... diff --git a/third_party/2and3/flask/ctx.pyi b/third_party/2and3/flask/ctx.pyi index 09fdea3a9939..ee9bf6aa6591 100644 --- a/third_party/2and3/flask/ctx.pyi +++ b/third_party/2and3/flask/ctx.pyi @@ -2,9 +2,10 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any, Optional + from .globals import _app_ctx_stack, _request_ctx_stack from .signals import appcontext_popped, appcontext_pushed -from typing import Any, Optional class _AppCtxGlobals: def get(self, name: Any, default: Optional[Any] = ...): ... diff --git a/third_party/2and3/flask/debughelpers.pyi b/third_party/2and3/flask/debughelpers.pyi index 5a4cbea07fa4..2dc87325b8e4 100644 --- a/third_party/2and3/flask/debughelpers.pyi +++ b/third_party/2and3/flask/debughelpers.pyi @@ -2,10 +2,11 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any + from .app import Flask from .blueprints import Blueprint from .globals import _request_ctx_stack -from typing import Any class UnexpectedUnicodeError(AssertionError, UnicodeError): ... diff --git a/third_party/2and3/flask/globals.pyi b/third_party/2and3/flask/globals.pyi index 8ce1caf1653a..d20dbfa27a45 100644 --- a/third_party/2and3/flask/globals.pyi +++ b/third_party/2and3/flask/globals.pyi @@ -2,11 +2,13 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from .app import Flask -from .wrappers import Request from typing import Any + from werkzeug.local import LocalStack +from .app import Flask +from .wrappers import Request + class _FlaskLocalProxy(Flask): def _get_current_object(self) -> Flask: ... diff --git a/third_party/2and3/flask/helpers.pyi b/third_party/2and3/flask/helpers.pyi index 726f8a03c083..0f828e6bdf9d 100644 --- a/third_party/2and3/flask/helpers.pyi +++ b/third_party/2and3/flask/helpers.pyi @@ -2,9 +2,10 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any, Optional + from .globals import _app_ctx_stack, _request_ctx_stack, current_app, request, session from .signals import message_flashed -from typing import Any, Optional def get_env(): ... def get_debug_flag(): ... diff --git a/third_party/2and3/flask/json/__init__.pyi b/third_party/2and3/flask/json/__init__.pyi index f2dea4d13e86..691d41d623ae 100644 --- a/third_party/2and3/flask/json/__init__.pyi +++ b/third_party/2and3/flask/json/__init__.pyi @@ -1,6 +1,7 @@ # Stubs for flask.json (Python 3.6) import json as _json from typing import Any + from jinja2 import Markup class JSONEncoder(_json.JSONEncoder): diff --git a/third_party/2and3/flask/logging.pyi b/third_party/2and3/flask/logging.pyi index e43d51d882d1..0d032e478a54 100644 --- a/third_party/2and3/flask/logging.pyi +++ b/third_party/2and3/flask/logging.pyi @@ -2,9 +2,10 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from .globals import request from typing import Any +from .globals import request + def wsgi_errors_stream(): ... def has_level_handler(logger: Any): ... diff --git a/third_party/2and3/flask/sessions.pyi b/third_party/2and3/flask/sessions.pyi index b0d238d90127..9053da5d9966 100644 --- a/third_party/2and3/flask/sessions.pyi +++ b/third_party/2and3/flask/sessions.pyi @@ -4,6 +4,7 @@ from abc import ABCMeta from typing import Any, MutableMapping, Optional + from werkzeug.datastructures import CallbackDict class SessionMixin(MutableMapping, metaclass=ABCMeta): diff --git a/third_party/2and3/flask/templating.pyi b/third_party/2and3/flask/templating.pyi index 1da102d2bcd4..2284496b21e6 100644 --- a/third_party/2and3/flask/templating.pyi +++ b/third_party/2and3/flask/templating.pyi @@ -2,10 +2,13 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any + +from jinja2 import BaseLoader +from jinja2 import Environment as BaseEnvironment + from .globals import _app_ctx_stack, _request_ctx_stack from .signals import before_render_template, template_rendered -from jinja2 import BaseLoader, Environment as BaseEnvironment -from typing import Any class Environment(BaseEnvironment): app: Any = ... diff --git a/third_party/2and3/flask/testing.pyi b/third_party/2and3/flask/testing.pyi index 813eeca4d27e..7b9c273ba046 100644 --- a/third_party/2and3/flask/testing.pyi +++ b/third_party/2and3/flask/testing.pyi @@ -2,9 +2,11 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import IO, Any, Iterable, Mapping, Optional, Union + from click import BaseCommand from click.testing import CliRunner, Result -from typing import Any, IO, Iterable, Mapping, Optional, Union + from werkzeug.test import Client def make_test_environ_builder(app: Any, path: str = ..., base_url: Optional[Any] = ..., subdomain: Optional[Any] = ..., url_scheme: Optional[Any] = ..., *args: Any, **kwargs: Any): ... diff --git a/third_party/2and3/flask/views.pyi b/third_party/2and3/flask/views.pyi index a2637b3b03ec..1d4df7405e41 100644 --- a/third_party/2and3/flask/views.pyi +++ b/third_party/2and3/flask/views.pyi @@ -2,9 +2,10 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from .globals import request from typing import Any +from .globals import request + http_method_funcs: Any class View: diff --git a/third_party/2and3/flask/wrappers.pyi b/third_party/2and3/flask/wrappers.pyi index df8869e0ae82..263dc3b66eb0 100644 --- a/third_party/2and3/flask/wrappers.pyi +++ b/third_party/2and3/flask/wrappers.pyi @@ -3,9 +3,11 @@ # NOTE: This dynamically typed stub was automatically generated by stubgen. from typing import Any, Dict, Optional + from werkzeug.exceptions import HTTPException from werkzeug.routing import Rule -from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase +from werkzeug.wrappers import Request as RequestBase +from werkzeug.wrappers import Response as ResponseBase class JSONMixin: @property diff --git a/third_party/2and3/google/protobuf/any_pb2.pyi b/third_party/2and3/google/protobuf/any_pb2.pyi index c2a7295a9725..234d7452123c 100644 --- a/third_party/2and3/google/protobuf/any_pb2.pyi +++ b/third_party/2and3/google/protobuf/any_pb2.pyi @@ -1,13 +1,7 @@ -from google.protobuf.message import ( - Message, -) -from google.protobuf.internal import well_known_types - -from typing import ( - Optional, - Text, -) +from typing import Optional, Text +from google.protobuf.internal import well_known_types +from google.protobuf.message import Message class Any(Message, well_known_types.Any_): type_url: Text diff --git a/third_party/2and3/google/protobuf/any_test_pb2.pyi b/third_party/2and3/google/protobuf/any_test_pb2.pyi index d352badb3418..bfd73816b56a 100644 --- a/third_party/2and3/google/protobuf/any_test_pb2.pyi +++ b/third_party/2and3/google/protobuf/any_test_pb2.pyi @@ -1,17 +1,8 @@ -from google.protobuf.any_pb2 import ( - Any, -) -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from typing import ( - Iterable, - Optional, -) +from typing import Iterable, Optional +from google.protobuf.any_pb2 import Any +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer +from google.protobuf.message import Message class TestAny(Message): int32_value: int diff --git a/third_party/2and3/google/protobuf/api_pb2.pyi b/third_party/2and3/google/protobuf/api_pb2.pyi index 36468780e0e5..6c0ddb63870d 100644 --- a/third_party/2and3/google/protobuf/api_pb2.pyi +++ b/third_party/2and3/google/protobuf/api_pb2.pyi @@ -1,22 +1,9 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.source_context_pb2 import ( - SourceContext, -) -from google.protobuf.type_pb2 import ( - Option, - Syntax, -) -from typing import ( - Iterable, - Optional, - Text, -) +from typing import Iterable, Optional, Text +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer +from google.protobuf.message import Message +from google.protobuf.source_context_pb2 import SourceContext +from google.protobuf.type_pb2 import Option, Syntax class Api(Message): name: Text diff --git a/third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi b/third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi index d1037fa3a483..98190a30249a 100644 --- a/third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi +++ b/third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi @@ -1,19 +1,8 @@ -from google.protobuf.descriptor_pb2 import ( - FileDescriptorProto, -) -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from typing import ( - Iterable, - Optional, - Text, -) +from typing import Iterable, Optional, Text +from google.protobuf.descriptor_pb2 import FileDescriptorProto +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message class Version(Message): major: int diff --git a/third_party/2and3/google/protobuf/descriptor.pyi b/third_party/2and3/google/protobuf/descriptor.pyi index 44352c6a7cce..69922c407f2e 100644 --- a/third_party/2and3/google/protobuf/descriptor.pyi +++ b/third_party/2and3/google/protobuf/descriptor.pyi @@ -1,6 +1,5 @@ from typing import Any -from .message import Message from .descriptor_pb2 import ( EnumOptions, EnumValueOptions, @@ -11,6 +10,7 @@ from .descriptor_pb2 import ( OneofOptions, ServiceOptions, ) +from .message import Message class Error(Exception): ... class TypeTransformationError(Error): ... diff --git a/third_party/2and3/google/protobuf/descriptor_pb2.pyi b/third_party/2and3/google/protobuf/descriptor_pb2.pyi index d0fbcdc2f865..e4f238df5956 100644 --- a/third_party/2and3/google/protobuf/descriptor_pb2.pyi +++ b/third_party/2and3/google/protobuf/descriptor_pb2.pyi @@ -1,19 +1,7 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from typing import ( - Iterable, - List, - Optional, - Text, - Tuple, - cast, -) +from typing import Iterable, List, Optional, Text, Tuple, cast +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message class FileDescriptorSet(Message): diff --git a/third_party/2and3/google/protobuf/duration_pb2.pyi b/third_party/2and3/google/protobuf/duration_pb2.pyi index 378c2e57ce01..e08b124b3bdf 100644 --- a/third_party/2and3/google/protobuf/duration_pb2.pyi +++ b/third_party/2and3/google/protobuf/duration_pb2.pyi @@ -1,12 +1,7 @@ -from google.protobuf.message import ( - Message, -) -from google.protobuf.internal import well_known_types - -from typing import ( - Optional, -) +from typing import Optional +from google.protobuf.internal import well_known_types +from google.protobuf.message import Message class Duration(Message, well_known_types.Duration): seconds: int diff --git a/third_party/2and3/google/protobuf/empty_pb2.pyi b/third_party/2and3/google/protobuf/empty_pb2.pyi index 295ebfa938be..5f220c4b2a8d 100644 --- a/third_party/2and3/google/protobuf/empty_pb2.pyi +++ b/third_party/2and3/google/protobuf/empty_pb2.pyi @@ -1,7 +1,4 @@ -from google.protobuf.message import ( - Message, -) - +from google.protobuf.message import Message class Empty(Message): diff --git a/third_party/2and3/google/protobuf/field_mask_pb2.pyi b/third_party/2and3/google/protobuf/field_mask_pb2.pyi index 1c96a02bbe1e..26c3a08c29a6 100644 --- a/third_party/2and3/google/protobuf/field_mask_pb2.pyi +++ b/third_party/2and3/google/protobuf/field_mask_pb2.pyi @@ -1,17 +1,8 @@ -from google.protobuf.internal.containers import ( - RepeatedScalarFieldContainer, -) -from google.protobuf.internal import well_known_types - -from google.protobuf.message import ( - Message, -) -from typing import ( - Iterable, - Optional, - Text, -) +from typing import Iterable, Optional, Text +from google.protobuf.internal import well_known_types +from google.protobuf.internal.containers import RepeatedScalarFieldContainer +from google.protobuf.message import Message class FieldMask(Message, well_known_types.FieldMask): paths: RepeatedScalarFieldContainer[Text] diff --git a/third_party/2and3/google/protobuf/internal/containers.pyi b/third_party/2and3/google/protobuf/internal/containers.pyi index 33e603c93e58..576809c4b6c4 100644 --- a/third_party/2and3/google/protobuf/internal/containers.pyi +++ b/third_party/2and3/google/protobuf/internal/containers.pyi @@ -1,10 +1,8 @@ +from typing import Any, Callable, Generic, Iterable, Iterator, List, Optional, Sequence, TypeVar, Union, overload + from google.protobuf.descriptor import Descriptor from google.protobuf.internal.message_listener import MessageListener from google.protobuf.message import Message -from typing import ( - Sequence, TypeVar, Generic, Any, Iterator, Iterable, - Union, Optional, Callable, overload, List -) _T = TypeVar('_T') class BaseContainer(Sequence[_T]): diff --git a/third_party/2and3/google/protobuf/internal/well_known_types.pyi b/third_party/2and3/google/protobuf/internal/well_known_types.pyi index 91a42a33ce25..26a2e110ec26 100644 --- a/third_party/2and3/google/protobuf/internal/well_known_types.pyi +++ b/third_party/2and3/google/protobuf/internal/well_known_types.pyi @@ -1,5 +1,5 @@ -from typing import Any, Optional from datetime import datetime +from typing import Any, Optional class Error(Exception): ... class ParseError(Error): ... diff --git a/third_party/2and3/google/protobuf/json_format.pyi b/third_party/2and3/google/protobuf/json_format.pyi index e61ccb869fbf..c1a8b454a5e6 100644 --- a/third_party/2and3/google/protobuf/json_format.pyi +++ b/third_party/2and3/google/protobuf/json_format.pyi @@ -1,5 +1,6 @@ import sys from typing import Any, Dict, Text, TypeVar, Union + from google.protobuf.message import Message _MessageVar = TypeVar('_MessageVar', bound=Message) diff --git a/third_party/2and3/google/protobuf/map_proto2_unittest_pb2.pyi b/third_party/2and3/google/protobuf/map_proto2_unittest_pb2.pyi index fd12d108a998..d5e16bd151ae 100644 --- a/third_party/2and3/google/protobuf/map_proto2_unittest_pb2.pyi +++ b/third_party/2and3/google/protobuf/map_proto2_unittest_pb2.pyi @@ -1,19 +1,7 @@ -from google.protobuf.message import ( - Message, -) -from google.protobuf.unittest_import_pb2 import ( - ImportEnumForMap, -) -from typing import ( - List, - Mapping, - MutableMapping, - Optional, - Text, - Tuple, - cast, -) +from typing import List, Mapping, MutableMapping, Optional, Text, Tuple, cast +from google.protobuf.message import Message +from google.protobuf.unittest_import_pb2 import ImportEnumForMap class Proto2MapEnum(int): diff --git a/third_party/2and3/google/protobuf/map_unittest_pb2.pyi b/third_party/2and3/google/protobuf/map_unittest_pb2.pyi index 25058bbde6d4..5962922b38f7 100644 --- a/third_party/2and3/google/protobuf/map_unittest_pb2.pyi +++ b/third_party/2and3/google/protobuf/map_unittest_pb2.pyi @@ -1,24 +1,9 @@ -from google.protobuf.message import ( - Message, -) -from google.protobuf.unittest_no_arena_pb2 import ( - ForeignMessage, -) -from google.protobuf.unittest_pb2 import ( - ForeignMessage as ForeignMessage1, - TestAllTypes, - TestRequired, -) -from typing import ( - List, - Mapping, - MutableMapping, - Optional, - Text, - Tuple, - cast, -) +from typing import List, Mapping, MutableMapping, Optional, Text, Tuple, cast +from google.protobuf.message import Message +from google.protobuf.unittest_no_arena_pb2 import ForeignMessage +from google.protobuf.unittest_pb2 import ForeignMessage as ForeignMessage1 +from google.protobuf.unittest_pb2 import TestAllTypes, TestRequired class MapEnum(int): diff --git a/third_party/2and3/google/protobuf/message.pyi b/third_party/2and3/google/protobuf/message.pyi index 4bf8cabfb282..92ea7cee425f 100644 --- a/third_party/2and3/google/protobuf/message.pyi +++ b/third_party/2and3/google/protobuf/message.pyi @@ -1,9 +1,6 @@ -from typing import Any, Sequence, Optional, Tuple +from typing import Any, Optional, Sequence, Tuple -from .descriptor import ( - DescriptorBase, - FieldDescriptor, -) +from .descriptor import DescriptorBase, FieldDescriptor class Error(Exception): ... class DecodeError(Error): ... diff --git a/third_party/2and3/google/protobuf/message_factory.pyi b/third_party/2and3/google/protobuf/message_factory.pyi index ad31e22fcb92..e2a549339f78 100644 --- a/third_party/2and3/google/protobuf/message_factory.pyi +++ b/third_party/2and3/google/protobuf/message_factory.pyi @@ -1,8 +1,8 @@ from typing import Any, Dict, Iterable, Optional, Type -from .message import Message from .descriptor import Descriptor from .descriptor_pool import DescriptorPool +from .message import Message class MessageFactory: pool: Any diff --git a/third_party/2and3/google/protobuf/source_context_pb2.pyi b/third_party/2and3/google/protobuf/source_context_pb2.pyi index 527ac1a4f8c0..7ccf6c889957 100644 --- a/third_party/2and3/google/protobuf/source_context_pb2.pyi +++ b/third_party/2and3/google/protobuf/source_context_pb2.pyi @@ -1,11 +1,6 @@ -from google.protobuf.message import ( - Message, -) -from typing import ( - Optional, - Text, -) +from typing import Optional, Text +from google.protobuf.message import Message class SourceContext(Message): file_name: Text diff --git a/third_party/2and3/google/protobuf/struct_pb2.pyi b/third_party/2and3/google/protobuf/struct_pb2.pyi index 21afcc71b393..76ffc0fe7bf2 100644 --- a/third_party/2and3/google/protobuf/struct_pb2.pyi +++ b/third_party/2and3/google/protobuf/struct_pb2.pyi @@ -1,22 +1,8 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, -) -from google.protobuf.internal import well_known_types - -from google.protobuf.message import ( - Message, -) -from typing import ( - Iterable, - List, - Mapping, - MutableMapping, - Optional, - Text, - Tuple, - cast, -) +from typing import Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, cast +from google.protobuf.internal import well_known_types +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer +from google.protobuf.message import Message class NullValue(int): @classmethod diff --git a/third_party/2and3/google/protobuf/test_messages_proto2_pb2.pyi b/third_party/2and3/google/protobuf/test_messages_proto2_pb2.pyi index 03e34be76ad7..82e78f5900e2 100644 --- a/third_party/2and3/google/protobuf/test_messages_proto2_pb2.pyi +++ b/third_party/2and3/google/protobuf/test_messages_proto2_pb2.pyi @@ -1,22 +1,8 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) import builtins -from typing import ( - Iterable, - List, - Mapping, - MutableMapping, - Optional, - Text, - Tuple, - cast, -) +from typing import Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, cast +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message class ForeignEnumProto2(int): diff --git a/third_party/2and3/google/protobuf/test_messages_proto3_pb2.pyi b/third_party/2and3/google/protobuf/test_messages_proto3_pb2.pyi index 5a9cce340cd0..2124591824ca 100644 --- a/third_party/2and3/google/protobuf/test_messages_proto3_pb2.pyi +++ b/third_party/2and3/google/protobuf/test_messages_proto3_pb2.pyi @@ -1,26 +1,12 @@ -from google.protobuf.any_pb2 import ( - Any, -) -from google.protobuf.duration_pb2 import ( - Duration, -) -from google.protobuf.field_mask_pb2 import ( - FieldMask, -) -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.struct_pb2 import ( - Struct, - Value, -) -from google.protobuf.timestamp_pb2 import ( - Timestamp, -) +from typing import Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, cast + +from google.protobuf.any_pb2 import Any +from google.protobuf.duration_pb2 import Duration +from google.protobuf.field_mask_pb2 import FieldMask +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message +from google.protobuf.struct_pb2 import Struct, Value +from google.protobuf.timestamp_pb2 import Timestamp from google.protobuf.wrappers_pb2 import ( BoolValue, BytesValue, @@ -32,17 +18,6 @@ from google.protobuf.wrappers_pb2 import ( UInt32Value, UInt64Value, ) -from typing import ( - Iterable, - List, - Mapping, - MutableMapping, - Optional, - Text, - Tuple, - cast, -) - class ForeignEnum(int): diff --git a/third_party/2and3/google/protobuf/timestamp_pb2.pyi b/third_party/2and3/google/protobuf/timestamp_pb2.pyi index 77ae3055c095..83a9d6af36e1 100644 --- a/third_party/2and3/google/protobuf/timestamp_pb2.pyi +++ b/third_party/2and3/google/protobuf/timestamp_pb2.pyi @@ -1,12 +1,7 @@ -from google.protobuf.message import ( - Message, -) -from google.protobuf.internal import well_known_types - -from typing import ( - Optional, -) +from typing import Optional +from google.protobuf.internal import well_known_types +from google.protobuf.message import Message class Timestamp(Message, well_known_types.Timestamp): seconds: int diff --git a/third_party/2and3/google/protobuf/type_pb2.pyi b/third_party/2and3/google/protobuf/type_pb2.pyi index e3ff9b101d19..07536c268984 100644 --- a/third_party/2and3/google/protobuf/type_pb2.pyi +++ b/third_party/2and3/google/protobuf/type_pb2.pyi @@ -1,25 +1,9 @@ -from google.protobuf.any_pb2 import ( - Any, -) -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.source_context_pb2 import ( - SourceContext, -) -from typing import ( - Iterable, - List, - Optional, - Text, - Tuple, - cast, -) +from typing import Iterable, List, Optional, Text, Tuple, cast +from google.protobuf.any_pb2 import Any +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message +from google.protobuf.source_context_pb2 import SourceContext class Syntax(int): diff --git a/third_party/2and3/google/protobuf/unittest_arena_pb2.pyi b/third_party/2and3/google/protobuf/unittest_arena_pb2.pyi index 89d6042be384..c9d3bed55a48 100644 --- a/third_party/2and3/google/protobuf/unittest_arena_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_arena_pb2.pyi @@ -1,17 +1,8 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.unittest_no_arena_import_pb2 import ( - ImportNoArenaNestedMessage, -) -from typing import ( - Iterable, - Optional, -) +from typing import Iterable, Optional +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer +from google.protobuf.message import Message +from google.protobuf.unittest_no_arena_import_pb2 import ImportNoArenaNestedMessage class NestedMessage(Message): d: int diff --git a/third_party/2and3/google/protobuf/unittest_custom_options_pb2.pyi b/third_party/2and3/google/protobuf/unittest_custom_options_pb2.pyi index 5028e079eaee..97f649a5744a 100644 --- a/third_party/2and3/google/protobuf/unittest_custom_options_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_custom_options_pb2.pyi @@ -1,22 +1,8 @@ -from google.protobuf.descriptor_pb2 import ( - FileOptions, -) -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from typing import ( - Iterable, - List, - Optional, - Text, - Tuple, - cast, -) +from typing import Iterable, List, Optional, Text, Tuple, cast +from google.protobuf.descriptor_pb2 import FileOptions +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message class MethodOpt1(int): diff --git a/third_party/2and3/google/protobuf/unittest_import_pb2.pyi b/third_party/2and3/google/protobuf/unittest_import_pb2.pyi index 92f191473ea5..0569200eb72e 100644 --- a/third_party/2and3/google/protobuf/unittest_import_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_import_pb2.pyi @@ -1,13 +1,6 @@ -from google.protobuf.message import ( - Message, -) -from typing import ( - List, - Optional, - Tuple, - cast, -) +from typing import List, Optional, Tuple, cast +from google.protobuf.message import Message class ImportEnum(int): diff --git a/third_party/2and3/google/protobuf/unittest_import_public_pb2.pyi b/third_party/2and3/google/protobuf/unittest_import_public_pb2.pyi index c8e13ff01e89..6f0daeb8fbd9 100644 --- a/third_party/2and3/google/protobuf/unittest_import_public_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_import_public_pb2.pyi @@ -1,10 +1,6 @@ -from google.protobuf.message import ( - Message, -) -from typing import ( - Optional, -) +from typing import Optional +from google.protobuf.message import Message class PublicImportMessage(Message): e: int diff --git a/third_party/2and3/google/protobuf/unittest_mset_pb2.pyi b/third_party/2and3/google/protobuf/unittest_mset_pb2.pyi index 63663207bda0..00fcd5c09451 100644 --- a/third_party/2and3/google/protobuf/unittest_mset_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_mset_pb2.pyi @@ -1,19 +1,9 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.unittest_mset_wire_format_pb2 import ( - TestMessageSet, -) import builtins -from typing import ( - Iterable, - Optional, - Text, -) +from typing import Iterable, Optional, Text +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer +from google.protobuf.message import Message +from google.protobuf.unittest_mset_wire_format_pb2 import TestMessageSet class TestMessageSetContainer(Message): diff --git a/third_party/2and3/google/protobuf/unittest_mset_wire_format_pb2.pyi b/third_party/2and3/google/protobuf/unittest_mset_wire_format_pb2.pyi index acb24a46f693..5e190057bf2d 100644 --- a/third_party/2and3/google/protobuf/unittest_mset_wire_format_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_mset_wire_format_pb2.pyi @@ -1,10 +1,6 @@ -from google.protobuf.message import ( - Message, -) -from typing import ( - Optional, -) +from typing import Optional +from google.protobuf.message import Message class TestMessageSet(Message): diff --git a/third_party/2and3/google/protobuf/unittest_no_arena_import_pb2.pyi b/third_party/2and3/google/protobuf/unittest_no_arena_import_pb2.pyi index c02e4d3c74e7..a8f8a207717c 100644 --- a/third_party/2and3/google/protobuf/unittest_no_arena_import_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_no_arena_import_pb2.pyi @@ -1,10 +1,6 @@ -from google.protobuf.message import ( - Message, -) -from typing import ( - Optional, -) +from typing import Optional +from google.protobuf.message import Message class ImportNoArenaNestedMessage(Message): d: int diff --git a/third_party/2and3/google/protobuf/unittest_no_arena_pb2.pyi b/third_party/2and3/google/protobuf/unittest_no_arena_pb2.pyi index 8a256222b082..a90a4cf513c7 100644 --- a/third_party/2and3/google/protobuf/unittest_no_arena_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_no_arena_pb2.pyi @@ -1,29 +1,10 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.unittest_arena_pb2 import ( - ArenaMessage, -) -from google.protobuf.unittest_import_pb2 import ( - ImportEnum, - ImportMessage, -) -from google.protobuf.unittest_import_public_pb2 import ( - PublicImportMessage, -) -from typing import ( - Iterable, - List, - Optional, - Text, - Tuple, - cast, -) +from typing import Iterable, List, Optional, Text, Tuple, cast +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message +from google.protobuf.unittest_arena_pb2 import ArenaMessage +from google.protobuf.unittest_import_pb2 import ImportEnum, ImportMessage +from google.protobuf.unittest_import_public_pb2 import PublicImportMessage class ForeignEnum(int): diff --git a/third_party/2and3/google/protobuf/unittest_no_generic_services_pb2.pyi b/third_party/2and3/google/protobuf/unittest_no_generic_services_pb2.pyi index b65863b1fe16..e4217590ea79 100644 --- a/third_party/2and3/google/protobuf/unittest_no_generic_services_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_no_generic_services_pb2.pyi @@ -1,13 +1,6 @@ -from google.protobuf.message import ( - Message, -) -from typing import ( - List, - Optional, - Tuple, - cast, -) +from typing import List, Optional, Tuple, cast +from google.protobuf.message import Message class TestEnum(int): @classmethod diff --git a/third_party/2and3/google/protobuf/unittest_pb2.pyi b/third_party/2and3/google/protobuf/unittest_pb2.pyi index 7f052577d350..cc636c2d1eab 100644 --- a/third_party/2and3/google/protobuf/unittest_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_pb2.pyi @@ -1,28 +1,9 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.unittest_import_pb2 import ( - ImportEnum, - ImportMessage, -) -from google.protobuf.unittest_import_public_pb2 import ( - PublicImportMessage, -) -from typing import ( - Iterable, - List, - Mapping, - MutableMapping, - Optional, - Text, - Tuple, - cast, -) +from typing import Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, cast +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message +from google.protobuf.unittest_import_pb2 import ImportEnum, ImportMessage +from google.protobuf.unittest_import_public_pb2 import PublicImportMessage class ForeignEnum(int): @classmethod diff --git a/third_party/2and3/google/protobuf/unittest_proto3_arena_pb2.pyi b/third_party/2and3/google/protobuf/unittest_proto3_arena_pb2.pyi index 9464062ccafb..3c6057eaf38a 100644 --- a/third_party/2and3/google/protobuf/unittest_proto3_arena_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_proto3_arena_pb2.pyi @@ -1,25 +1,9 @@ -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.unittest_import_pb2 import ( - ImportMessage, -) -from google.protobuf.unittest_import_public_pb2 import ( - PublicImportMessage, -) -from typing import ( - Iterable, - List, - Optional, - Text, - Tuple, - cast, -) +from typing import Iterable, List, Optional, Text, Tuple, cast +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message +from google.protobuf.unittest_import_pb2 import ImportMessage +from google.protobuf.unittest_import_public_pb2 import PublicImportMessage class ForeignEnum(int): diff --git a/third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi b/third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi index 04623137f35b..11de45422468 100644 --- a/third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi +++ b/third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi @@ -1,30 +1,13 @@ -from google.protobuf.any_pb2 import ( - Any, -) -from google.protobuf.duration_pb2 import ( - Duration, -) -from google.protobuf.field_mask_pb2 import ( - FieldMask, -) -from google.protobuf.internal.containers import ( - RepeatedCompositeFieldContainer, - RepeatedScalarFieldContainer, -) -from google.protobuf.message import ( - Message, -) -from google.protobuf.struct_pb2 import ( - ListValue, - Struct, - Value, -) -from google.protobuf.timestamp_pb2 import ( - Timestamp, -) -from google.protobuf.unittest_pb2 import ( - TestAllExtensions, -) +from typing import Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, cast + +from google.protobuf.any_pb2 import Any +from google.protobuf.duration_pb2 import Duration +from google.protobuf.field_mask_pb2 import FieldMask +from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer +from google.protobuf.message import Message +from google.protobuf.struct_pb2 import ListValue, Struct, Value +from google.protobuf.timestamp_pb2 import Timestamp +from google.protobuf.unittest_pb2 import TestAllExtensions from google.protobuf.wrappers_pb2 import ( BoolValue, BytesValue, @@ -36,17 +19,6 @@ from google.protobuf.wrappers_pb2 import ( UInt32Value, UInt64Value, ) -from typing import ( - Iterable, - List, - Mapping, - MutableMapping, - Optional, - Text, - Tuple, - cast, -) - class EnumType(int): diff --git a/third_party/2and3/google/protobuf/wrappers_pb2.pyi b/third_party/2and3/google/protobuf/wrappers_pb2.pyi index 6ff865d34c06..eabc28adcf57 100644 --- a/third_party/2and3/google/protobuf/wrappers_pb2.pyi +++ b/third_party/2and3/google/protobuf/wrappers_pb2.pyi @@ -1,11 +1,6 @@ -from google.protobuf.message import ( - Message, -) -from typing import ( - Optional, - Text, -) +from typing import Optional, Text +from google.protobuf.message import Message class DoubleValue(Message): value: float diff --git a/third_party/2and3/itsdangerous.pyi b/third_party/2and3/itsdangerous.pyi index 32bbf2bb12be..f65c156d3a03 100644 --- a/third_party/2and3/itsdangerous.pyi +++ b/third_party/2and3/itsdangerous.pyi @@ -1,5 +1,5 @@ from datetime import datetime -from typing import Any, Callable, IO, Mapping, MutableMapping, Optional, Tuple, Union, Text, Generator +from typing import IO, Any, Callable, Generator, Mapping, MutableMapping, Optional, Text, Tuple, Union _serializer = Any # must be an object that has "dumps" and "loads" attributes (e.g. the json module) diff --git a/third_party/2and3/jinja2/__init__.pyi b/third_party/2and3/jinja2/__init__.pyi index 063f73d8d540..cf26a1d29226 100644 --- a/third_party/2and3/jinja2/__init__.pyi +++ b/third_party/2and3/jinja2/__init__.pyi @@ -1,7 +1,34 @@ -from jinja2.environment import Environment as Environment, Template as Template -from jinja2.loaders import BaseLoader as BaseLoader, FileSystemLoader as FileSystemLoader, PackageLoader as PackageLoader, DictLoader as DictLoader, FunctionLoader as FunctionLoader, PrefixLoader as PrefixLoader, ChoiceLoader as ChoiceLoader, ModuleLoader as ModuleLoader -from jinja2.bccache import BytecodeCache as BytecodeCache, FileSystemBytecodeCache as FileSystemBytecodeCache, MemcachedBytecodeCache as MemcachedBytecodeCache -from jinja2.runtime import Undefined as Undefined, DebugUndefined as DebugUndefined, StrictUndefined as StrictUndefined, make_logging_undefined as make_logging_undefined -from jinja2.exceptions import TemplateError as TemplateError, UndefinedError as UndefinedError, TemplateNotFound as TemplateNotFound, TemplatesNotFound as TemplatesNotFound, TemplateSyntaxError as TemplateSyntaxError, TemplateAssertionError as TemplateAssertionError -from jinja2.filters import environmentfilter as environmentfilter, contextfilter as contextfilter, evalcontextfilter as evalcontextfilter -from jinja2.utils import Markup as Markup, escape as escape, clear_caches as clear_caches, environmentfunction as environmentfunction, evalcontextfunction as evalcontextfunction, contextfunction as contextfunction, is_undefined as is_undefined, select_autoescape as select_autoescape +from jinja2.bccache import BytecodeCache as BytecodeCache +from jinja2.bccache import FileSystemBytecodeCache as FileSystemBytecodeCache +from jinja2.bccache import MemcachedBytecodeCache as MemcachedBytecodeCache +from jinja2.environment import Environment as Environment +from jinja2.environment import Template as Template +from jinja2.exceptions import TemplateAssertionError as TemplateAssertionError +from jinja2.exceptions import TemplateError as TemplateError +from jinja2.exceptions import TemplateNotFound as TemplateNotFound +from jinja2.exceptions import TemplatesNotFound as TemplatesNotFound +from jinja2.exceptions import TemplateSyntaxError as TemplateSyntaxError +from jinja2.exceptions import UndefinedError as UndefinedError +from jinja2.filters import contextfilter as contextfilter +from jinja2.filters import environmentfilter as environmentfilter +from jinja2.filters import evalcontextfilter as evalcontextfilter +from jinja2.loaders import BaseLoader as BaseLoader +from jinja2.loaders import ChoiceLoader as ChoiceLoader +from jinja2.loaders import DictLoader as DictLoader +from jinja2.loaders import FileSystemLoader as FileSystemLoader +from jinja2.loaders import FunctionLoader as FunctionLoader +from jinja2.loaders import ModuleLoader as ModuleLoader +from jinja2.loaders import PackageLoader as PackageLoader +from jinja2.loaders import PrefixLoader as PrefixLoader +from jinja2.runtime import DebugUndefined as DebugUndefined +from jinja2.runtime import StrictUndefined as StrictUndefined +from jinja2.runtime import Undefined as Undefined +from jinja2.runtime import make_logging_undefined as make_logging_undefined +from jinja2.utils import Markup as Markup +from jinja2.utils import clear_caches as clear_caches +from jinja2.utils import contextfunction as contextfunction +from jinja2.utils import environmentfunction as environmentfunction +from jinja2.utils import escape as escape +from jinja2.utils import evalcontextfunction as evalcontextfunction +from jinja2.utils import is_undefined as is_undefined +from jinja2.utils import select_autoescape as select_autoescape diff --git a/third_party/2and3/jinja2/_compat.pyi b/third_party/2and3/jinja2/_compat.pyi index 1e37a7abf912..8851e608b1a9 100644 --- a/third_party/2and3/jinja2/_compat.pyi +++ b/third_party/2and3/jinja2/_compat.pyi @@ -1,5 +1,5 @@ -from typing import Any, Optional import sys +from typing import Any, Optional if sys.version_info[0] >= 3: from io import BytesIO diff --git a/third_party/2and3/jinja2/compiler.pyi b/third_party/2and3/jinja2/compiler.pyi index 7b1a537793a5..ce29f720928b 100644 --- a/third_party/2and3/jinja2/compiler.pyi +++ b/third_party/2and3/jinja2/compiler.pyi @@ -1,5 +1,6 @@ -from typing import Any, Optional from keyword import iskeyword as is_python_keyword +from typing import Any, Optional + from jinja2.visitor import NodeVisitor operators: Any diff --git a/third_party/2and3/jinja2/defaults.pyi b/third_party/2and3/jinja2/defaults.pyi index e89d3ce3e4d0..fb16e8c95dd8 100644 --- a/third_party/2and3/jinja2/defaults.pyi +++ b/third_party/2and3/jinja2/defaults.pyi @@ -1,4 +1,5 @@ from typing import Any + from jinja2.filters import FILTERS as DEFAULT_FILTERS from jinja2.tests import TESTS as DEFAULT_TESTS diff --git a/third_party/2and3/jinja2/loaders.pyi b/third_party/2and3/jinja2/loaders.pyi index 330de41c4ce5..dae9fb476394 100644 --- a/third_party/2and3/jinja2/loaders.pyi +++ b/third_party/2and3/jinja2/loaders.pyi @@ -1,5 +1,5 @@ -from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union from types import ModuleType +from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union from .environment import Environment diff --git a/third_party/2and3/jinja2/meta.pyi b/third_party/2and3/jinja2/meta.pyi index 46ca83b678c9..8f0b50bec203 100644 --- a/third_party/2and3/jinja2/meta.pyi +++ b/third_party/2and3/jinja2/meta.pyi @@ -1,4 +1,5 @@ from typing import Any + from jinja2.compiler import CodeGenerator class TrackingCodeGenerator(CodeGenerator): diff --git a/third_party/2and3/jinja2/optimizer.pyi b/third_party/2and3/jinja2/optimizer.pyi index b55b08aa9f0a..d0056acf908e 100644 --- a/third_party/2and3/jinja2/optimizer.pyi +++ b/third_party/2and3/jinja2/optimizer.pyi @@ -1,4 +1,5 @@ from typing import Any + from jinja2.visitor import NodeTransformer def optimize(node, environment): ... diff --git a/third_party/2and3/jinja2/runtime.pyi b/third_party/2and3/jinja2/runtime.pyi index 271c0eff9414..f442bfa856b0 100644 --- a/third_party/2and3/jinja2/runtime.pyi +++ b/third_party/2and3/jinja2/runtime.pyi @@ -1,8 +1,12 @@ from typing import Any, Dict, Optional, Text, Union -from jinja2.utils import Markup as Markup, escape as escape, missing as missing, concat as concat -from jinja2.exceptions import TemplateRuntimeError as TemplateRuntimeError, TemplateNotFound as TemplateNotFound from jinja2.environment import Environment +from jinja2.exceptions import TemplateNotFound as TemplateNotFound +from jinja2.exceptions import TemplateRuntimeError as TemplateRuntimeError +from jinja2.utils import Markup as Markup +from jinja2.utils import concat as concat +from jinja2.utils import escape as escape +from jinja2.utils import missing as missing to_string: Any identity: Any diff --git a/third_party/2and3/jinja2/sandbox.pyi b/third_party/2and3/jinja2/sandbox.pyi index 518deca50dd9..1fc319cfd76c 100644 --- a/third_party/2and3/jinja2/sandbox.pyi +++ b/third_party/2and3/jinja2/sandbox.pyi @@ -1,4 +1,5 @@ from typing import Any + from jinja2.environment import Environment MAX_RANGE: int diff --git a/third_party/2and3/jinja2/utils.pyi b/third_party/2and3/jinja2/utils.pyi index bf5ff8356bb2..3b8029d06d76 100644 --- a/third_party/2and3/jinja2/utils.pyi +++ b/third_party/2and3/jinja2/utils.pyi @@ -1,6 +1,8 @@ from typing import Any, Callable, Iterable, Optional -from markupsafe import Markup as Markup, escape as escape, soft_unicode as soft_unicode +from markupsafe import Markup as Markup +from markupsafe import escape as escape +from markupsafe import soft_unicode as soft_unicode missing: Any internal_code: Any diff --git a/third_party/2and3/markupsafe/__init__.pyi b/third_party/2and3/markupsafe/__init__.pyi index 44d15da3a54c..3b6def3b9def 100644 --- a/third_party/2and3/markupsafe/__init__.pyi +++ b/third_party/2and3/markupsafe/__init__.pyi @@ -1,10 +1,12 @@ +import string import sys - -from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Text, Tuple, Union from collections import Mapping +from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Text, Tuple, Union + from markupsafe._compat import text_type -import string -from markupsafe._native import escape as escape, escape_silent as escape_silent, soft_unicode as soft_unicode +from markupsafe._native import escape as escape +from markupsafe._native import escape_silent as escape_silent +from markupsafe._native import soft_unicode as soft_unicode class Markup(text_type): def __new__(cls, base: Text = ..., encoding: Optional[Text] = ..., errors: Text = ...) -> Markup: ... diff --git a/third_party/2and3/markupsafe/_compat.pyi b/third_party/2and3/markupsafe/_compat.pyi index 7257425cf6bc..b8da6849b118 100644 --- a/third_party/2and3/markupsafe/_compat.pyi +++ b/third_party/2and3/markupsafe/_compat.pyi @@ -1,5 +1,4 @@ import sys - from typing import Any, Iterator, Mapping, Text, Tuple, TypeVar _K = TypeVar('_K') diff --git a/third_party/2and3/markupsafe/_native.pyi b/third_party/2and3/markupsafe/_native.pyi index ecf20c607ef0..0af37e0799da 100644 --- a/third_party/2and3/markupsafe/_native.pyi +++ b/third_party/2and3/markupsafe/_native.pyi @@ -1,6 +1,7 @@ +from typing import Text, Union + from . import Markup -from ._compat import text_type, string_types -from typing import Union, Text +from ._compat import string_types, text_type def escape(s: Union[Markup, Text]) -> Markup: ... def escape_silent(s: Union[None, Markup, Text]) -> Markup: ... diff --git a/third_party/2and3/markupsafe/_speedups.pyi b/third_party/2and3/markupsafe/_speedups.pyi index ecf20c607ef0..0af37e0799da 100644 --- a/third_party/2and3/markupsafe/_speedups.pyi +++ b/third_party/2and3/markupsafe/_speedups.pyi @@ -1,6 +1,7 @@ +from typing import Text, Union + from . import Markup -from ._compat import text_type, string_types -from typing import Union, Text +from ._compat import string_types, text_type def escape(s: Union[Markup, Text]) -> Markup: ... def escape_silent(s: Union[None, Markup, Text]) -> Markup: ... diff --git a/third_party/2and3/mypy_extensions.pyi b/third_party/2and3/mypy_extensions.pyi index f9c9ff6da6c0..06c5df5d2ba6 100644 --- a/third_party/2and3/mypy_extensions.pyi +++ b/third_party/2and3/mypy_extensions.pyi @@ -1,8 +1,6 @@ import abc import sys -from typing import ( - Dict, Type, TypeVar, Optional, Union, Any, Generic, Mapping, ItemsView, KeysView, ValuesView -) +from typing import Any, Dict, Generic, ItemsView, KeysView, Mapping, Optional, Type, TypeVar, Union, ValuesView _T = TypeVar('_T') _U = TypeVar('_U') diff --git a/third_party/2and3/pymysql/__init__.pyi b/third_party/2and3/pymysql/__init__.pyi index 523c6014b691..a5c5d90bdb66 100644 --- a/third_party/2and3/pymysql/__init__.pyi +++ b/third_party/2and3/pymysql/__init__.pyi @@ -1,30 +1,28 @@ import sys -from typing import Union, Tuple, Callable, FrozenSet +from typing import Callable, FrozenSet, Tuple, Union from .connections import Connection as _Connection from .constants import FIELD_TYPE as FIELD_TYPE -from .converters import escape_dict as escape_dict, escape_sequence as escape_sequence, escape_string as escape_string -from .err import ( - Warning as Warning, - Error as Error, - InterfaceError as InterfaceError, - DataError as DataError, - DatabaseError as DatabaseError, - OperationalError as OperationalError, - IntegrityError as IntegrityError, - InternalError as InternalError, - NotSupportedError as NotSupportedError, - ProgrammingError as ProgrammingError, - MySQLError as MySQLError, -) -from .times import ( - Date as Date, - Time as Time, - Timestamp as Timestamp, - DateFromTicks as DateFromTicks, - TimeFromTicks as TimeFromTicks, - TimestampFromTicks as TimestampFromTicks, -) +from .converters import escape_dict as escape_dict +from .converters import escape_sequence as escape_sequence +from .converters import escape_string as escape_string +from .err import DatabaseError as DatabaseError +from .err import DataError as DataError +from .err import Error as Error +from .err import IntegrityError as IntegrityError +from .err import InterfaceError as InterfaceError +from .err import InternalError as InternalError +from .err import MySQLError as MySQLError +from .err import NotSupportedError as NotSupportedError +from .err import OperationalError as OperationalError +from .err import ProgrammingError as ProgrammingError +from .err import Warning as Warning +from .times import Date as Date +from .times import DateFromTicks as DateFromTicks +from .times import Time as Time +from .times import TimeFromTicks as TimeFromTicks +from .times import Timestamp as Timestamp +from .times import TimestampFromTicks as TimestampFromTicks threadsafety: int apilevel: str diff --git a/third_party/2and3/pymysql/connections.pyi b/third_party/2and3/pymysql/connections.pyi index 4f1cd0486ec2..1d7f04ee51db 100644 --- a/third_party/2and3/pymysql/connections.pyi +++ b/third_party/2and3/pymysql/connections.pyi @@ -1,13 +1,31 @@ from typing import Any, Optional, Type -from .charset import MBLENGTH as MBLENGTH, charset_by_name as charset_by_name, charset_by_id as charset_by_id -from .cursors import Cursor as Cursor -from .constants import FIELD_TYPE as FIELD_TYPE, FLAG as FLAG -from .constants import SERVER_STATUS as SERVER_STATUS + +from .charset import MBLENGTH as MBLENGTH +from .charset import charset_by_id as charset_by_id +from .charset import charset_by_name as charset_by_name from .constants import CLIENT as CLIENT from .constants import COMMAND as COMMAND -from .util import join_bytes as join_bytes, byte2int as byte2int, int2byte as int2byte -from .converters import escape_item as escape_item, encoders as encoders, decoders as decoders -from .err import raise_mysql_exception as raise_mysql_exception, Warning as Warning, Error as Error, InterfaceError as InterfaceError, DataError as DataError, DatabaseError as DatabaseError, OperationalError as OperationalError, IntegrityError as IntegrityError, InternalError as InternalError, NotSupportedError as NotSupportedError, ProgrammingError as ProgrammingError +from .constants import FIELD_TYPE as FIELD_TYPE +from .constants import FLAG as FLAG +from .constants import SERVER_STATUS as SERVER_STATUS +from .converters import decoders as decoders +from .converters import encoders as encoders +from .converters import escape_item as escape_item +from .cursors import Cursor as Cursor +from .err import DatabaseError as DatabaseError +from .err import DataError as DataError +from .err import Error as Error +from .err import IntegrityError as IntegrityError +from .err import InterfaceError as InterfaceError +from .err import InternalError as InternalError +from .err import NotSupportedError as NotSupportedError +from .err import OperationalError as OperationalError +from .err import ProgrammingError as ProgrammingError +from .err import Warning as Warning +from .err import raise_mysql_exception as raise_mysql_exception +from .util import byte2int as byte2int +from .util import int2byte as int2byte +from .util import join_bytes as join_bytes sha_new: Any SSL_ENABLED: Any diff --git a/third_party/2and3/pymysql/converters.pyi b/third_party/2and3/pymysql/converters.pyi index fdd760225d62..ec53254543af 100644 --- a/third_party/2and3/pymysql/converters.pyi +++ b/third_party/2and3/pymysql/converters.pyi @@ -1,6 +1,8 @@ from typing import Any -from .constants import FIELD_TYPE as FIELD_TYPE, FLAG as FLAG + from .charset import charset_by_id as charset_by_id +from .constants import FIELD_TYPE as FIELD_TYPE +from .constants import FLAG as FLAG PYTHON3: Any ESCAPE_REGEX: Any diff --git a/third_party/2and3/pymysql/cursors.pyi b/third_party/2and3/pymysql/cursors.pyi index e08008541503..2e2456d3be52 100644 --- a/third_party/2and3/pymysql/cursors.pyi +++ b/third_party/2and3/pymysql/cursors.pyi @@ -1,4 +1,5 @@ -from typing import Union, Tuple, Any, Dict, Optional, Text, Iterator, List +from typing import Any, Dict, Iterator, List, Optional, Text, Tuple, Union + from .connections import Connection Gen = Union[Tuple[Any, ...], Dict[str, Any]] diff --git a/third_party/2and3/pymysql/err.pyi b/third_party/2and3/pymysql/err.pyi index 29d4f55cd94b..10a663dc3e0b 100644 --- a/third_party/2and3/pymysql/err.pyi +++ b/third_party/2and3/pymysql/err.pyi @@ -1,4 +1,5 @@ from typing import Dict + from .constants import ER as ER class MySQLError(Exception): ... diff --git a/third_party/2and3/pynamodb/attributes.pyi b/third_party/2and3/pynamodb/attributes.pyi index 3c8247435cd7..03639b7b95f2 100644 --- a/third_party/2and3/pynamodb/attributes.pyi +++ b/third_party/2and3/pynamodb/attributes.pyi @@ -1,6 +1,5 @@ -from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Text, Type, TypeVar, Union, Set - from datetime import datetime +from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Set, Text, Type, TypeVar, Union _T = TypeVar('_T') _KT = TypeVar('_KT') diff --git a/third_party/2and3/pynamodb/models.pyi b/third_party/2and3/pynamodb/models.pyi index 5943a58d6f31..d115c2521108 100644 --- a/third_party/2and3/pynamodb/models.pyi +++ b/third_party/2and3/pynamodb/models.pyi @@ -1,6 +1,7 @@ +from typing import Any, Dict, Generic, Iterable, Iterator, List, Optional, Sequence, Text, Tuple, Type, TypeVar, Union + from .attributes import Attribute from .exceptions import DoesNotExist as DoesNotExist -from typing import Any, Dict, Generic, Iterable, Iterator, List, Optional, Sequence, Tuple, Type, TypeVar, Text, Union log: Any diff --git a/third_party/2and3/pytz/__init__.pyi b/third_party/2and3/pytz/__init__.pyi index 16d57dbb16d8..0f35c9a838cf 100644 --- a/third_party/2and3/pytz/__init__.pyi +++ b/third_party/2and3/pytz/__init__.pyi @@ -1,5 +1,5 @@ -from typing import Optional, List, Set, Mapping, Union import datetime +from typing import List, Mapping, Optional, Set, Union class BaseTzInfo(datetime.tzinfo): zone: str = ... diff --git a/third_party/2and3/redis/__init__.pyi b/third_party/2and3/redis/__init__.pyi index 333de49b0805..07191af84ef9 100644 --- a/third_party/2and3/redis/__init__.pyi +++ b/third_party/2and3/redis/__init__.pyi @@ -1,7 +1,4 @@ -from . import client -from . import connection -from . import utils -from . import exceptions +from . import client, connection, exceptions, utils Redis = client.Redis StrictRedis = client.StrictRedis diff --git a/third_party/2and3/redis/client.pyi b/third_party/2and3/redis/client.pyi index 7049ff4e69c7..e9a07e690bf8 100644 --- a/third_party/2and3/redis/client.pyi +++ b/third_party/2and3/redis/client.pyi @@ -1,5 +1,5 @@ from datetime import timedelta -from typing import Any, Text, Optional, Mapping, Union +from typing import Any, Mapping, Optional, Text, Union from .connection import ConnectionPool diff --git a/third_party/2and3/requests/__init__.pyi b/third_party/2and3/requests/__init__.pyi index 7705d78b484b..5f67a6079b57 100644 --- a/third_party/2and3/requests/__init__.pyi +++ b/third_party/2and3/requests/__init__.pyi @@ -1,13 +1,9 @@ # Stubs for requests (based on version 2.6.0, Python 3) -from typing import Any -from . import models -from . import api -from . import sessions -from . import status_codes -from . import exceptions -from . import packages import logging +from typing import Any + +from . import api, exceptions, models, packages, sessions, status_codes __title__: Any __build__: Any diff --git a/third_party/2and3/requests/adapters.pyi b/third_party/2and3/requests/adapters.pyi index 190056755fbc..cf4a01736fb2 100644 --- a/third_party/2and3/requests/adapters.pyi +++ b/third_party/2and3/requests/adapters.pyi @@ -1,17 +1,11 @@ # Stubs for requests.adapters (Python 3) -from typing import Any, Container, Union, Text, Tuple, Optional, Mapping -from . import models -from .packages.urllib3 import poolmanager -from .packages.urllib3 import response -from .packages.urllib3.util import retry -from . import compat -from . import utils -from . import structures +from typing import Any, Container, Mapping, Optional, Text, Tuple, Union + +from . import auth, compat, cookies, exceptions, models, structures, utils from .packages.urllib3 import exceptions as urllib3_exceptions -from . import cookies -from . import exceptions -from . import auth +from .packages.urllib3 import poolmanager, response +from .packages.urllib3.util import retry PreparedRequest = models.PreparedRequest Response = models.Response diff --git a/third_party/2and3/requests/api.pyi b/third_party/2and3/requests/api.pyi index df3003cfafc4..62fae3d94232 100644 --- a/third_party/2and3/requests/api.pyi +++ b/third_party/2and3/requests/api.pyi @@ -1,7 +1,7 @@ # Stubs for requests.api (Python 3) import sys -from typing import Optional, Union, Any, Iterable, Mapping, MutableMapping, Tuple, IO, Text +from typing import IO, Any, Iterable, Mapping, MutableMapping, Optional, Text, Tuple, Union from .models import Response diff --git a/third_party/2and3/requests/auth.pyi b/third_party/2and3/requests/auth.pyi index 48d4b08cee37..d0b9d82754e6 100644 --- a/third_party/2and3/requests/auth.pyi +++ b/third_party/2and3/requests/auth.pyi @@ -1,11 +1,8 @@ # Stubs for requests.auth (Python 3) from typing import Any, Text, Union -from . import compat -from . import cookies -from . import models -from . import utils -from . import status_codes + +from . import compat, cookies, models, status_codes, utils extract_cookies_to_jar = cookies.extract_cookies_to_jar parse_dict_header = utils.parse_dict_header diff --git a/third_party/2and3/requests/compat.pyi b/third_party/2and3/requests/compat.pyi index 63b92f6fef32..355b517ec81a 100644 --- a/third_party/2and3/requests/compat.pyi +++ b/third_party/2and3/requests/compat.pyi @@ -1,6 +1,6 @@ # Stubs for requests.compat (Python 3.4) -from typing import Any import collections +from typing import Any OrderedDict = collections.OrderedDict diff --git a/third_party/2and3/requests/cookies.pyi b/third_party/2and3/requests/cookies.pyi index 1208dce503cd..70ed15c0c726 100644 --- a/third_party/2and3/requests/cookies.pyi +++ b/third_party/2and3/requests/cookies.pyi @@ -1,8 +1,9 @@ # Stubs for requests.cookies (Python 3) +import collections import sys from typing import Any, MutableMapping -import collections + from . import compat if sys.version_info < (3, 0): diff --git a/third_party/2and3/requests/exceptions.pyi b/third_party/2and3/requests/exceptions.pyi index 36696928288e..95bc03280810 100644 --- a/third_party/2and3/requests/exceptions.pyi +++ b/third_party/2and3/requests/exceptions.pyi @@ -1,6 +1,7 @@ # Stubs for requests.exceptions (Python 3) from typing import Any + from .packages.urllib3.exceptions import HTTPError as BaseHTTPError class RequestException(IOError): diff --git a/third_party/2and3/requests/models.pyi b/third_party/2and3/requests/models.pyi index 2bcea9459bc4..275fbdaea7c0 100644 --- a/third_party/2and3/requests/models.pyi +++ b/third_party/2and3/requests/models.pyi @@ -1,24 +1,13 @@ # Stubs for requests.models (Python 3) -from typing import (Any, Dict, Iterator, List, MutableMapping, Optional, Text, - Union) import datetime import types +from typing import Any, Dict, Iterator, List, MutableMapping, Optional, Text, Union -from . import hooks -from . import structures -from . import auth -from . import cookies +from . import auth, compat, cookies, exceptions, hooks, status_codes, structures, utils from .cookies import RequestsCookieJar -from .packages.urllib3 import fields -from .packages.urllib3 import filepost -from .packages.urllib3 import util from .packages.urllib3 import exceptions as urllib3_exceptions -from . import exceptions -from . import utils -from . import compat -from . import status_codes - +from .packages.urllib3 import fields, filepost, util default_hooks = hooks.default_hooks CaseInsensitiveDict = structures.CaseInsensitiveDict diff --git a/third_party/2and3/requests/packages/urllib3/__init__.pyi b/third_party/2and3/requests/packages/urllib3/__init__.pyi index f575800c242a..943043eb147b 100644 --- a/third_party/2and3/requests/packages/urllib3/__init__.pyi +++ b/third_party/2and3/requests/packages/urllib3/__init__.pyi @@ -1,13 +1,9 @@ +import logging from typing import Any -from . import connectionpool -from . import filepost -from . import poolmanager -from . import response + +from . import connectionpool, filepost, poolmanager, response from .util import request as _request -from .util import url -from .util import timeout -from .util import retry -import logging +from .util import retry, timeout, url __license__: Any diff --git a/third_party/2and3/requests/packages/urllib3/_collections.pyi b/third_party/2and3/requests/packages/urllib3/_collections.pyi index 64e3d22dc5b6..4f032f2518eb 100644 --- a/third_party/2and3/requests/packages/urllib3/_collections.pyi +++ b/third_party/2and3/requests/packages/urllib3/_collections.pyi @@ -1,5 +1,5 @@ -from typing import Any from collections import MutableMapping +from typing import Any class RLock: def __enter__(self): ... diff --git a/third_party/2and3/requests/packages/urllib3/connection.pyi b/third_party/2and3/requests/packages/urllib3/connection.pyi index 99af02784394..d7d23c952a27 100644 --- a/third_party/2and3/requests/packages/urllib3/connection.pyi +++ b/third_party/2and3/requests/packages/urllib3/connection.pyi @@ -1,13 +1,12 @@ # Stubs for requests.packages.urllib3.connection (Python 3.4) +import ssl import sys from typing import Any -from . import packages -import ssl -from . import exceptions + +from . import exceptions, packages, util from .packages import ssl_match_hostname from .util import ssl_ -from . import util if sys.version_info < (3, 0): from httplib import HTTPConnection as _HTTPConnection diff --git a/third_party/2and3/requests/packages/urllib3/connectionpool.pyi b/third_party/2and3/requests/packages/urllib3/connectionpool.pyi index a4e8ac1fe1fc..955378035718 100644 --- a/third_party/2and3/requests/packages/urllib3/connectionpool.pyi +++ b/third_party/2and3/requests/packages/urllib3/connectionpool.pyi @@ -1,19 +1,12 @@ from typing import Any -from . import exceptions + +from . import connection, exceptions, packages, request, response +from .connection import BaseSSLError as BaseSSLError +from .connection import ConnectionError as ConnectionError +from .connection import HTTPException as HTTPException from .packages import ssl_match_hostname -from . import packages -from .connection import ( - HTTPException as HTTPException, - BaseSSLError as BaseSSLError, - ConnectionError as ConnectionError, -) -from . import request -from . import response -from . import connection from .util import connection as _connection -from .util import retry -from .util import timeout -from .util import url +from .util import retry, timeout, url ClosedPoolError = exceptions.ClosedPoolError ProtocolError = exceptions.ProtocolError diff --git a/third_party/2and3/requests/packages/urllib3/fields.pyi b/third_party/2and3/requests/packages/urllib3/fields.pyi index 9d691dcf6ed4..ce45435492fb 100644 --- a/third_party/2and3/requests/packages/urllib3/fields.pyi +++ b/third_party/2and3/requests/packages/urllib3/fields.pyi @@ -1,6 +1,7 @@ # Stubs for requests.packages.urllib3.fields (Python 3.4) from typing import Any + from . import packages def guess_content_type(filename, default=...): ... diff --git a/third_party/2and3/requests/packages/urllib3/filepost.pyi b/third_party/2and3/requests/packages/urllib3/filepost.pyi index afcc837b89fe..44ec71bfed20 100644 --- a/third_party/2and3/requests/packages/urllib3/filepost.pyi +++ b/third_party/2and3/requests/packages/urllib3/filepost.pyi @@ -1,7 +1,7 @@ from typing import Any -from . import packages + # from .packages import six -from . import fields +from . import fields, packages # six = packages.six # b = six.b diff --git a/third_party/2and3/requests/packages/urllib3/poolmanager.pyi b/third_party/2and3/requests/packages/urllib3/poolmanager.pyi index 9568488f7ffe..68ad69622b66 100644 --- a/third_party/2and3/requests/packages/urllib3/poolmanager.pyi +++ b/third_party/2and3/requests/packages/urllib3/poolmanager.pyi @@ -1,4 +1,5 @@ from typing import Any + from .request import RequestMethods class PoolManager(RequestMethods): diff --git a/third_party/2and3/requests/packages/urllib3/response.pyi b/third_party/2and3/requests/packages/urllib3/response.pyi index de0aa330e351..56c63f2f9432 100644 --- a/third_party/2and3/requests/packages/urllib3/response.pyi +++ b/third_party/2and3/requests/packages/urllib3/response.pyi @@ -1,8 +1,9 @@ -from typing import Any import io -from . import _collections -from . import exceptions -from .connection import HTTPException as HTTPException, BaseSSLError as BaseSSLError +from typing import Any + +from . import _collections, exceptions +from .connection import BaseSSLError as BaseSSLError +from .connection import HTTPException as HTTPException from .util import response HTTPHeaderDict = _collections.HTTPHeaderDict diff --git a/third_party/2and3/requests/packages/urllib3/util/__init__.pyi b/third_party/2and3/requests/packages/urllib3/util/__init__.pyi index 53bdac9b9275..2d0d66dcb603 100644 --- a/third_party/2and3/requests/packages/urllib3/util/__init__.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/__init__.pyi @@ -1,12 +1,7 @@ -from . import connection -from . import request -from . import response -from . import ssl_ -from . import timeout -from . import retry -from . import url import ssl +from . import connection, request, response, retry, ssl_, timeout, url + is_connection_dropped = connection.is_connection_dropped make_headers = request.make_headers is_fp_closed = response.is_fp_closed diff --git a/third_party/2and3/requests/packages/urllib3/util/request.pyi b/third_party/2and3/requests/packages/urllib3/util/request.pyi index a7e112f17ed3..9cafcaa181f5 100644 --- a/third_party/2and3/requests/packages/urllib3/util/request.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/request.pyi @@ -1,4 +1,5 @@ from typing import Any + # from ..packages import six # b = six.b diff --git a/third_party/2and3/requests/packages/urllib3/util/retry.pyi b/third_party/2and3/requests/packages/urllib3/util/retry.pyi index c7c21786361e..1aac0913033c 100644 --- a/third_party/2and3/requests/packages/urllib3/util/retry.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/retry.pyi @@ -1,6 +1,6 @@ from typing import Any -from .. import exceptions -from .. import packages + +from .. import exceptions, packages ConnectTimeoutError = exceptions.ConnectTimeoutError MaxRetryError = exceptions.MaxRetryError diff --git a/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi b/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi index fe1a3a0d56cb..b259338984bd 100644 --- a/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi @@ -1,6 +1,7 @@ +import ssl from typing import Any + from .. import exceptions -import ssl SSLError = exceptions.SSLError InsecurePlatformWarning = exceptions.InsecurePlatformWarning diff --git a/third_party/2and3/requests/packages/urllib3/util/timeout.pyi b/third_party/2and3/requests/packages/urllib3/util/timeout.pyi index 0f3c97cae66d..25879d685ea9 100644 --- a/third_party/2and3/requests/packages/urllib3/util/timeout.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/timeout.pyi @@ -1,4 +1,5 @@ from typing import Any + from .. import exceptions TimeoutStateError = exceptions.TimeoutStateError diff --git a/third_party/2and3/requests/packages/urllib3/util/url.pyi b/third_party/2and3/requests/packages/urllib3/util/url.pyi index 0e40ba5a0bc7..2d43e2d2626d 100644 --- a/third_party/2and3/requests/packages/urllib3/util/url.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/url.pyi @@ -1,4 +1,5 @@ from typing import Any + from .. import exceptions LocationParseError = exceptions.LocationParseError diff --git a/third_party/2and3/requests/sessions.pyi b/third_party/2and3/requests/sessions.pyi index db275ae4e6b3..9110ab5f7750 100644 --- a/third_party/2and3/requests/sessions.pyi +++ b/third_party/2and3/requests/sessions.pyi @@ -1,18 +1,12 @@ # Stubs for requests.sessions (Python 3) -from typing import Any, Union, List, MutableMapping, Text, Optional, IO, Tuple, Callable, Iterable +from typing import IO, Any, Callable, Iterable, List, MutableMapping, Optional, Text, Tuple, Union + from . import adapters from . import auth as _auth -from . import compat -from . import cookies -from . import models +from . import compat, cookies, exceptions, hooks, models, status_codes, structures, utils from .models import Response -from . import hooks -from . import utils -from . import exceptions from .packages.urllib3 import _collections -from . import structures -from . import status_codes BaseAdapter = adapters.BaseAdapter OrderedDict = compat.OrderedDict diff --git a/third_party/2and3/requests/status_codes.pyi b/third_party/2and3/requests/status_codes.pyi index f9bf820aed9f..523dde8e18f3 100644 --- a/third_party/2and3/requests/status_codes.pyi +++ b/third_party/2and3/requests/status_codes.pyi @@ -1,4 +1,5 @@ from typing import Any + from .structures import LookupDict codes: Any diff --git a/third_party/2and3/requests/structures.pyi b/third_party/2and3/requests/structures.pyi index 807f39a1c6b0..50a17217c2f2 100644 --- a/third_party/2and3/requests/structures.pyi +++ b/third_party/2and3/requests/structures.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterable, Iterator, Mapping, MutableMapping, Optional, Tuple, TypeVar, Union, Generic +from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, MutableMapping, Optional, Tuple, TypeVar, Union _VT = TypeVar('_VT') diff --git a/third_party/2and3/requests/utils.pyi b/third_party/2and3/requests/utils.pyi index 396a37409190..c4631381a1f8 100644 --- a/third_party/2and3/requests/utils.pyi +++ b/third_party/2and3/requests/utils.pyi @@ -1,10 +1,8 @@ # Stubs for requests.utils (Python 3) from typing import Any -from . import compat -from . import cookies -from . import structures -from . import exceptions + +from . import compat, cookies, exceptions, structures OrderedDict = compat.OrderedDict RequestsCookieJar = cookies.RequestsCookieJar diff --git a/third_party/2and3/simplejson/__init__.pyi b/third_party/2and3/simplejson/__init__.pyi index 6221b4efa72e..4073b387f904 100644 --- a/third_party/2and3/simplejson/__init__.pyi +++ b/third_party/2and3/simplejson/__init__.pyi @@ -1,8 +1,9 @@ -from typing import Any, IO, Text, Union +from typing import IO, Any, Text, Union -from simplejson.scanner import JSONDecodeError as JSONDecodeError from simplejson.decoder import JSONDecoder as JSONDecoder -from simplejson.encoder import JSONEncoder as JSONEncoder, JSONEncoderForHTML as JSONEncoderForHTML +from simplejson.encoder import JSONEncoder as JSONEncoder +from simplejson.encoder import JSONEncoderForHTML as JSONEncoderForHTML +from simplejson.scanner import JSONDecodeError as JSONDecodeError _LoadsString = Union[Text, bytes, bytearray] diff --git a/third_party/2and3/simplejson/encoder.pyi b/third_party/2and3/simplejson/encoder.pyi index 0e318066156b..6fa1ff7f72d5 100644 --- a/third_party/2and3/simplejson/encoder.pyi +++ b/third_party/2and3/simplejson/encoder.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO +from typing import IO, Any class JSONEncoder(object): def __init__(self, *args, **kwargs): ... diff --git a/third_party/2and3/singledispatch.pyi b/third_party/2and3/singledispatch.pyi index e89ac121e26b..daf3b85df899 100644 --- a/third_party/2and3/singledispatch.pyi +++ b/third_party/2and3/singledispatch.pyi @@ -1,6 +1,5 @@ from typing import Any, Callable, Generic, Mapping, Optional, TypeVar, overload - _T = TypeVar("_T") diff --git a/third_party/2and3/tabulate.pyi b/third_party/2and3/tabulate.pyi index a360515759f8..05db37713ac7 100644 --- a/third_party/2and3/tabulate.pyi +++ b/third_party/2and3/tabulate.pyi @@ -1,7 +1,6 @@ # Stub for tabulate: https://bitbucket.org/astanin/python-tabulate from typing import Any, Dict, Iterable, Sequence, Union - def __getattr__(name: str) -> Any: ... def tabulate( diff --git a/third_party/2and3/termcolor.pyi b/third_party/2and3/termcolor.pyi index e1ad18b8a58c..f0dfa022bc5a 100644 --- a/third_party/2and3/termcolor.pyi +++ b/third_party/2and3/termcolor.pyi @@ -1,7 +1,6 @@ # Stub for termcolor: https://pypi.python.org/pypi/termcolor from typing import Any, Iterable, Optional, Text - def colored( text: Text, color: Optional[Text] = ..., diff --git a/third_party/2and3/toml.pyi b/third_party/2and3/toml.pyi index 2639178e03dd..307cfc755006 100644 --- a/third_party/2and3/toml.pyi +++ b/third_party/2and3/toml.pyi @@ -1,6 +1,6 @@ -from typing import Any, IO, List, Mapping, MutableMapping, Optional, Protocol, Text, Type, Union import datetime import sys +from typing import IO, Any, List, Mapping, MutableMapping, Optional, Protocol, Text, Type, Union if sys.version_info >= (3, 4): import pathlib diff --git a/third_party/2and3/typing_extensions.pyi b/third_party/2and3/typing_extensions.pyi index c9a2ec435022..19211e559c2b 100644 --- a/third_party/2and3/typing_extensions.pyi +++ b/third_party/2and3/typing_extensions.pyi @@ -1,18 +1,19 @@ import abc import sys -from typing import Callable +from typing import TYPE_CHECKING as TYPE_CHECKING +from typing import Any, Callable from typing import ClassVar as ClassVar from typing import ContextManager as ContextManager from typing import Counter as Counter from typing import DefaultDict as DefaultDict from typing import Deque as Deque +from typing import Dict, ItemsView, KeysView, Mapping from typing import NewType as NewType from typing import NoReturn as NoReturn -from typing import overload as overload from typing import Text as Text from typing import Type as Type -from typing import TYPE_CHECKING as TYPE_CHECKING -from typing import TypeVar, Any, Mapping, ItemsView, KeysView, ValuesView, Dict, Type +from typing import TypeVar, ValuesView +from typing import overload as overload _T = TypeVar('_T') _F = TypeVar('_F', bound=Callable[..., Any]) diff --git a/third_party/2and3/ujson.pyi b/third_party/2and3/ujson.pyi index 7e006592e03c..c364cea06475 100644 --- a/third_party/2and3/ujson.pyi +++ b/third_party/2and3/ujson.pyi @@ -1,6 +1,6 @@ # Stubs for ujson # See: https://pypi.python.org/pypi/ujson -from typing import Any, AnyStr, IO, Optional +from typing import IO, Any, AnyStr, Optional __version__: str diff --git a/third_party/2and3/werkzeug/__init__.pyi b/third_party/2and3/werkzeug/__init__.pyi index 2de398a8fcba..6632ff4984ad 100644 --- a/third_party/2and3/werkzeug/__init__.pyi +++ b/third_party/2and3/werkzeug/__init__.pyi @@ -1,22 +1,24 @@ from types import ModuleType from typing import Any -from werkzeug import _internal -from werkzeug import datastructures -from werkzeug import debug -from werkzeug import exceptions -from werkzeug import formparser -from werkzeug import http -from werkzeug import local -from werkzeug import security -from werkzeug import serving -from werkzeug import test -from werkzeug import testapp -from werkzeug import urls -from werkzeug import useragents -from werkzeug import utils -from werkzeug import wrappers -from werkzeug import wsgi +from werkzeug import ( + _internal, + datastructures, + debug, + exceptions, + formparser, + http, + local, + security, + serving, + test, + testapp, + urls, + useragents, + utils, + wrappers, + wsgi, +) class module(ModuleType): def __getattr__(self, name): ... diff --git a/third_party/2and3/werkzeug/contrib/fixers.pyi b/third_party/2and3/werkzeug/contrib/fixers.pyi index 97c6e564a7ea..ba672acf25a2 100644 --- a/third_party/2and3/werkzeug/contrib/fixers.pyi +++ b/third_party/2and3/werkzeug/contrib/fixers.pyi @@ -1,5 +1,5 @@ -from typing import Any, Sequence, Optional, Iterable -from wsgiref.types import WSGIApplication, WSGIEnvironment, StartResponse +from typing import Any, Iterable, Optional, Sequence +from wsgiref.types import StartResponse, WSGIApplication, WSGIEnvironment class CGIRootFix: app: Any diff --git a/third_party/2and3/werkzeug/contrib/securecookie.pyi b/third_party/2and3/werkzeug/contrib/securecookie.pyi index 009ad2d6b9eb..bd768a7aee53 100644 --- a/third_party/2and3/werkzeug/contrib/securecookie.pyi +++ b/third_party/2and3/werkzeug/contrib/securecookie.pyi @@ -1,6 +1,7 @@ -from typing import Any, Optional -from hmac import new as hmac from hashlib import sha1 as _default_hash +from hmac import new as hmac +from typing import Any, Optional + from werkzeug.contrib.sessions import ModificationTrackingDict class UnquoteError(Exception): ... diff --git a/third_party/2and3/werkzeug/contrib/sessions.pyi b/third_party/2and3/werkzeug/contrib/sessions.pyi index b4b4ec25d03d..9abfed3ba6f7 100644 --- a/third_party/2and3/werkzeug/contrib/sessions.pyi +++ b/third_party/2and3/werkzeug/contrib/sessions.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional, Text + from werkzeug.datastructures import CallbackDict def generate_key(salt: Optional[Any] = ...): ... diff --git a/third_party/2and3/werkzeug/contrib/testtools.pyi b/third_party/2and3/werkzeug/contrib/testtools.pyi index 860ebb7afb0f..10102fb73030 100644 --- a/third_party/2and3/werkzeug/contrib/testtools.pyi +++ b/third_party/2and3/werkzeug/contrib/testtools.pyi @@ -1,4 +1,5 @@ from typing import Any + from werkzeug.wrappers import Response class ContentAccessors: diff --git a/third_party/2and3/werkzeug/datastructures.pyi b/third_party/2and3/werkzeug/datastructures.pyi index f10665f98cdc..a9b3acd5252a 100644 --- a/third_party/2and3/werkzeug/datastructures.pyi +++ b/third_party/2and3/werkzeug/datastructures.pyi @@ -1,6 +1,6 @@ import collections -from typing import Any, Optional, Mapping, Dict, TypeVar, Callable, Union, overload, Text from collections import Container, Iterable, MutableSet +from typing import Any, Callable, Dict, Mapping, Optional, Text, TypeVar, Union, overload _K = TypeVar("_K") _V = TypeVar("_V") diff --git a/third_party/2and3/werkzeug/debug/__init__.pyi b/third_party/2and3/werkzeug/debug/__init__.pyi index d920ed0d932c..ae346a94b4ae 100644 --- a/third_party/2and3/werkzeug/debug/__init__.pyi +++ b/third_party/2and3/werkzeug/debug/__init__.pyi @@ -1,5 +1,7 @@ from typing import Any, Optional -from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response + +from werkzeug.wrappers import BaseRequest as Request +from werkzeug.wrappers import BaseResponse as Response PIN_TIME: Any diff --git a/third_party/2and3/werkzeug/debug/console.pyi b/third_party/2and3/werkzeug/debug/console.pyi index 0323377b88af..d2fc1d36fd5c 100644 --- a/third_party/2and3/werkzeug/debug/console.pyi +++ b/third_party/2and3/werkzeug/debug/console.pyi @@ -1,5 +1,5 @@ -from typing import Any, Optional import code +from typing import Any, Optional class HTMLStringO: def __init__(self): ... diff --git a/third_party/2and3/werkzeug/exceptions.pyi b/third_party/2and3/werkzeug/exceptions.pyi index 368604641266..a98555faf234 100644 --- a/third_party/2and3/werkzeug/exceptions.pyi +++ b/third_party/2and3/werkzeug/exceptions.pyi @@ -1,6 +1,6 @@ -from typing import Any, Dict, Tuple, List, Text, NoReturn, Optional, Protocol, Type, Union, Iterable +from typing import Any, Dict, Iterable, List, NoReturn, Optional, Protocol, Text, Tuple, Type, Union +from wsgiref.types import StartResponse, WSGIEnvironment -from wsgiref.types import WSGIEnvironment, StartResponse from werkzeug.wrappers import Response class _EnvironContainer(Protocol): diff --git a/third_party/2and3/werkzeug/http.pyi b/third_party/2and3/werkzeug/http.pyi index 2e078ff843b5..a6ff85ddc0af 100644 --- a/third_party/2and3/werkzeug/http.pyi +++ b/third_party/2and3/werkzeug/http.pyi @@ -1,14 +1,36 @@ import sys from datetime import datetime, timedelta from typing import ( - Dict, Text, Union, Tuple, Any, Optional, Mapping, Iterable, Callable, List, Type, - TypeVar, Protocol, overload, SupportsInt, + Any, + Callable, + Dict, + Iterable, + List, + Mapping, + Optional, + Protocol, + SupportsInt, + Text, + Tuple, + Type, + TypeVar, + Union, + overload, ) from wsgiref.types import WSGIEnvironment from .datastructures import ( - Headers, Accept, RequestCacheControl, HeaderSet, Authorization, WWWAuthenticate, - IfRange, Range, ContentRange, ETags, TypeConversionDict, + Accept, + Authorization, + ContentRange, + ETags, + Headers, + HeaderSet, + IfRange, + Range, + RequestCacheControl, + TypeConversionDict, + WWWAuthenticate, ) if sys.version_info < (3,): diff --git a/third_party/2and3/werkzeug/posixemulation.pyi b/third_party/2and3/werkzeug/posixemulation.pyi index f66692947fdf..334cb3d0afa7 100644 --- a/third_party/2and3/werkzeug/posixemulation.pyi +++ b/third_party/2and3/werkzeug/posixemulation.pyi @@ -1,4 +1,5 @@ from typing import Any + from ._compat import to_unicode as to_unicode from .filesystem import get_filesystem_encoding as get_filesystem_encoding diff --git a/third_party/2and3/werkzeug/routing.pyi b/third_party/2and3/werkzeug/routing.pyi index 347af55b4294..f1b48b7d8467 100644 --- a/third_party/2and3/werkzeug/routing.pyi +++ b/third_party/2and3/werkzeug/routing.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional, Text + from werkzeug.exceptions import HTTPException def parse_converter_args(argstr): ... diff --git a/third_party/2and3/werkzeug/testapp.pyi b/third_party/2and3/werkzeug/testapp.pyi index e45ea4a301f2..63cf3310d688 100644 --- a/third_party/2and3/werkzeug/testapp.pyi +++ b/third_party/2and3/werkzeug/testapp.pyi @@ -1,5 +1,7 @@ from typing import Any -from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response + +from werkzeug.wrappers import BaseRequest as Request +from werkzeug.wrappers import BaseResponse as Response logo: Any TEMPLATE: Any diff --git a/third_party/2and3/werkzeug/urls.pyi b/third_party/2and3/werkzeug/urls.pyi index e0b13069a76c..ff9f54ee245e 100644 --- a/third_party/2and3/werkzeug/urls.pyi +++ b/third_party/2and3/werkzeug/urls.pyi @@ -1,7 +1,6 @@ from collections import namedtuple from typing import Any, Optional, Text - _URLTuple = namedtuple( '_URLTuple', ['scheme', 'netloc', 'path', 'query', 'fragment'] diff --git a/third_party/2and3/werkzeug/utils.pyi b/third_party/2and3/werkzeug/utils.pyi index 92465efdf0b9..fa638315a725 100644 --- a/third_party/2and3/werkzeug/utils.pyi +++ b/third_party/2and3/werkzeug/utils.pyi @@ -1,4 +1,5 @@ -from typing import Any, Optional, overload, Type, TypeVar +from typing import Any, Optional, Type, TypeVar, overload + from werkzeug._internal import _DictAccessorProperty from werkzeug.wrappers import Response diff --git a/third_party/2and3/werkzeug/wrappers.pyi b/third_party/2and3/werkzeug/wrappers.pyi index 74cb6ffa870b..fea4fd8389dc 100644 --- a/third_party/2and3/werkzeug/wrappers.pyi +++ b/third_party/2and3/werkzeug/wrappers.pyi @@ -1,14 +1,34 @@ from datetime import datetime from typing import ( - Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Optional, Sequence, Text, Tuple, Type, TypeVar, Union, + Any, + Callable, + Iterable, + Iterator, + Mapping, + MutableMapping, + Optional, + Sequence, + Text, + Tuple, + Type, + TypeVar, + Union, ) - -from wsgiref.types import WSGIEnvironment, InputStream +from wsgiref.types import InputStream, WSGIEnvironment from .datastructures import ( - Authorization, CombinedMultiDict, EnvironHeaders, Headers, ImmutableMultiDict, - MultiDict, ImmutableTypeConversionDict, HeaderSet, - Accept, MIMEAccept, CharsetAccept, LanguageAccept, + Accept, + Authorization, + CharsetAccept, + CombinedMultiDict, + EnvironHeaders, + Headers, + HeaderSet, + ImmutableMultiDict, + ImmutableTypeConversionDict, + LanguageAccept, + MIMEAccept, + MultiDict, ) from .useragents import UserAgent diff --git a/third_party/2and3/werkzeug/wsgi.pyi b/third_party/2and3/werkzeug/wsgi.pyi index 87deff409dda..db4b866383de 100644 --- a/third_party/2and3/werkzeug/wsgi.pyi +++ b/third_party/2and3/werkzeug/wsgi.pyi @@ -1,5 +1,5 @@ -from typing import Any, Optional, Protocol, Iterable, Text -from wsgiref.types import WSGIEnvironment, InputStream +from typing import Any, Iterable, Optional, Protocol, Text +from wsgiref.types import InputStream, WSGIEnvironment def responder(f): ... def get_current_url(environ, root_only: bool = ..., strip_querystring: bool = ..., host_only: bool = ..., diff --git a/third_party/2and3/yaml/__init__.pyi b/third_party/2and3/yaml/__init__.pyi index c0fc6a98270c..5c5c1c86f77b 100644 --- a/third_party/2and3/yaml/__init__.pyi +++ b/third_party/2and3/yaml/__init__.pyi @@ -1,14 +1,17 @@ -from typing import Any, IO, Iterator, Optional, overload, Sequence, Text, Union import sys +from typing import IO, Any, Iterator, Optional, Sequence, Text, Union, overload + +from yaml.dumper import * # noqa: F403 from yaml.error import * # noqa: F403 -from yaml.tokens import * # noqa: F403 from yaml.events import * # noqa: F403 -from yaml.nodes import * # noqa: F403 from yaml.loader import * # noqa: F403 -from yaml.dumper import * # noqa: F403 -from . import resolver # Help mypy a bit; this is implied by loader and dumper +from yaml.nodes import * # noqa: F403 +from yaml.tokens import * # noqa: F403 + from .cyaml import * +from . import resolver # Help mypy a bit; this is implied by loader and dumper + if sys.version_info < (3,): _Str = Union[Text, str] else: diff --git a/third_party/2and3/yaml/composer.pyi b/third_party/2and3/yaml/composer.pyi index f1e2c03ab5e9..a59932180515 100644 --- a/third_party/2and3/yaml/composer.pyi +++ b/third_party/2and3/yaml/composer.pyi @@ -1,6 +1,7 @@ from typing import Any -from yaml.error import Mark, YAMLError, MarkedYAMLError -from yaml.nodes import Node, ScalarNode, CollectionNode, SequenceNode, MappingNode + +from yaml.error import Mark, MarkedYAMLError, YAMLError +from yaml.nodes import CollectionNode, MappingNode, Node, ScalarNode, SequenceNode class ComposerError(MarkedYAMLError): ... diff --git a/third_party/2and3/yaml/constructor.pyi b/third_party/2and3/yaml/constructor.pyi index 1c3d998611c9..e8c8e93091ca 100644 --- a/third_party/2and3/yaml/constructor.pyi +++ b/third_party/2and3/yaml/constructor.pyi @@ -1,8 +1,8 @@ -from yaml.error import Mark, YAMLError, MarkedYAMLError -from yaml.nodes import Node, ScalarNode, CollectionNode, SequenceNode, MappingNode - from typing import Any +from yaml.error import Mark, MarkedYAMLError, YAMLError +from yaml.nodes import CollectionNode, MappingNode, Node, ScalarNode, SequenceNode + class ConstructorError(MarkedYAMLError): ... class BaseConstructor: diff --git a/third_party/2and3/yaml/cyaml.pyi b/third_party/2and3/yaml/cyaml.pyi index 0eef81592813..dfaa3671be30 100644 --- a/third_party/2and3/yaml/cyaml.pyi +++ b/third_party/2and3/yaml/cyaml.pyi @@ -1,11 +1,12 @@ -from typing import Any, IO, Mapping, Optional, Sequence, Text, Union -from typing_extensions import Protocol +from typing import IO, Any, Mapping, Optional, Sequence, Text, Union from yaml.constructor import BaseConstructor, Constructor, SafeConstructor from yaml.representer import BaseRepresenter, Representer, SafeRepresenter from yaml.resolver import BaseResolver, Resolver from yaml.serializer import Serializer +from typing_extensions import Protocol + class _Readable(Protocol): def read(self, size: int) -> Union[Text, bytes]: ... diff --git a/third_party/2and3/yaml/dumper.pyi b/third_party/2and3/yaml/dumper.pyi index 0586f1313ef1..db5e398467f7 100644 --- a/third_party/2and3/yaml/dumper.pyi +++ b/third_party/2and3/yaml/dumper.pyi @@ -1,7 +1,7 @@ from yaml.emitter import Emitter -from yaml.serializer import Serializer from yaml.representer import BaseRepresenter, Representer, SafeRepresenter from yaml.resolver import BaseResolver, Resolver +from yaml.serializer import Serializer class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): def __init__(self, stream, default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... diff --git a/third_party/2and3/yaml/emitter.pyi b/third_party/2and3/yaml/emitter.pyi index 5ca9cbb6ace2..650b86bce911 100644 --- a/third_party/2and3/yaml/emitter.pyi +++ b/third_party/2and3/yaml/emitter.pyi @@ -1,4 +1,5 @@ from typing import Any + from yaml.error import YAMLError class EmitterError(YAMLError): ... diff --git a/third_party/2and3/yaml/loader.pyi b/third_party/2and3/yaml/loader.pyi index 15c3a50daa47..67bf6798b737 100644 --- a/third_party/2and3/yaml/loader.pyi +++ b/third_party/2and3/yaml/loader.pyi @@ -1,9 +1,9 @@ -from yaml.reader import Reader -from yaml.scanner import Scanner -from yaml.parser import Parser from yaml.composer import Composer -from yaml.constructor import BaseConstructor, FullConstructor, SafeConstructor, Constructor +from yaml.constructor import BaseConstructor, Constructor, FullConstructor, SafeConstructor +from yaml.parser import Parser +from yaml.reader import Reader from yaml.resolver import BaseResolver, Resolver +from yaml.scanner import Scanner class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): def __init__(self, stream) -> None: ... diff --git a/third_party/2and3/yaml/parser.pyi b/third_party/2and3/yaml/parser.pyi index 4253e1172b98..9dc41d2ae364 100644 --- a/third_party/2and3/yaml/parser.pyi +++ b/third_party/2and3/yaml/parser.pyi @@ -1,4 +1,5 @@ from typing import Any + from yaml.error import MarkedYAMLError class ParserError(MarkedYAMLError): ... diff --git a/third_party/2and3/yaml/reader.pyi b/third_party/2and3/yaml/reader.pyi index 05adf0cd7d3c..18c3c7a9ab5b 100644 --- a/third_party/2and3/yaml/reader.pyi +++ b/third_party/2and3/yaml/reader.pyi @@ -1,4 +1,5 @@ from typing import Any + from yaml.error import YAMLError class ReaderError(YAMLError): diff --git a/third_party/2and3/yaml/representer.pyi b/third_party/2and3/yaml/representer.pyi index 7d4bbcc06bfe..fa72795fcdd6 100644 --- a/third_party/2and3/yaml/representer.pyi +++ b/third_party/2and3/yaml/representer.pyi @@ -1,4 +1,5 @@ from typing import Any + from yaml.error import YAMLError class RepresenterError(YAMLError): ... diff --git a/third_party/2and3/yaml/resolver.pyi b/third_party/2and3/yaml/resolver.pyi index 72975609491e..f5f534dee4f5 100644 --- a/third_party/2and3/yaml/resolver.pyi +++ b/third_party/2and3/yaml/resolver.pyi @@ -1,4 +1,5 @@ from typing import Any + from yaml.error import YAMLError class ResolverError(YAMLError): ... diff --git a/third_party/2and3/yaml/scanner.pyi b/third_party/2and3/yaml/scanner.pyi index 33f45dac15f0..64890a19a5f6 100644 --- a/third_party/2and3/yaml/scanner.pyi +++ b/third_party/2and3/yaml/scanner.pyi @@ -1,4 +1,5 @@ from typing import Any + from yaml.error import MarkedYAMLError class ScannerError(MarkedYAMLError): ... diff --git a/third_party/2and3/yaml/serializer.pyi b/third_party/2and3/yaml/serializer.pyi index 0c169e8658f9..8b85e3e45eba 100644 --- a/third_party/2and3/yaml/serializer.pyi +++ b/third_party/2and3/yaml/serializer.pyi @@ -1,4 +1,5 @@ from typing import Any + from yaml.error import YAMLError class SerializerError(YAMLError): ... diff --git a/third_party/3/dataclasses.pyi b/third_party/3/dataclasses.pyi index f8bcd52634df..ec10fc4d65c2 100644 --- a/third_party/3/dataclasses.pyi +++ b/third_party/3/dataclasses.pyi @@ -1,5 +1,4 @@ -from typing import overload, Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union - +from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union, overload _T = TypeVar('_T') diff --git a/third_party/3/docutils/parsers/rst/roles.pyi b/third_party/3/docutils/parsers/rst/roles.pyi index 58b9cd73c350..a5f7aa880386 100644 --- a/third_party/3/docutils/parsers/rst/roles.pyi +++ b/third_party/3/docutils/parsers/rst/roles.pyi @@ -1,8 +1,8 @@ +from typing import Any, Callable, Dict, List, Tuple + import docutils.nodes import docutils.parsers.rst.states -from typing import Callable, Any, List, Dict, Tuple - def register_local_role(name: str, role_fn: Callable[[str, str, str, int, docutils.parsers.rst.states.Inliner, Dict, List], Tuple[List[docutils.nodes.reference], List[docutils.nodes.reference]]] diff --git a/third_party/3/jwt/__init__.pyi b/third_party/3/jwt/__init__.pyi index da8eb4095b2b..4a77022a768c 100644 --- a/third_party/3/jwt/__init__.pyi +++ b/third_party/3/jwt/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Mapping, Any, Optional, Union, Dict +from typing import Any, Dict, Mapping, Optional, Union from . import algorithms diff --git a/third_party/3/jwt/algorithms.pyi b/third_party/3/jwt/algorithms.pyi index 7177dc7d1252..1ee746142c37 100644 --- a/third_party/3/jwt/algorithms.pyi +++ b/third_party/3/jwt/algorithms.pyi @@ -1,6 +1,6 @@ import sys from hashlib import _Hash -from typing import Any, Set, Dict, Optional, ClassVar, Union, Generic, TypeVar +from typing import Any, ClassVar, Dict, Generic, Optional, Set, TypeVar, Union requires_cryptography = Set[str] diff --git a/third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi b/third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi index e1342cced745..e1efc46815f6 100644 --- a/third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi +++ b/third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi @@ -1,4 +1,5 @@ from typing import Any + from jwt.algorithms import Algorithm from . import _HashAlg diff --git a/third_party/3/jwt/contrib/algorithms/pycrypto.pyi b/third_party/3/jwt/contrib/algorithms/pycrypto.pyi index 763b46a32428..1e376064a158 100644 --- a/third_party/3/jwt/contrib/algorithms/pycrypto.pyi +++ b/third_party/3/jwt/contrib/algorithms/pycrypto.pyi @@ -1,4 +1,5 @@ from typing import Any + from jwt.algorithms import Algorithm from . import _HashAlg diff --git a/third_party/3/pkg_resources/__init__.pyi b/third_party/3/pkg_resources/__init__.pyi index 55914e12bae0..d10d3975c253 100644 --- a/third_party/3/pkg_resources/__init__.pyi +++ b/third_party/3/pkg_resources/__init__.pyi @@ -1,10 +1,10 @@ # Stubs for pkg_resources (Python 3.4) -from typing import Any, Callable, Dict, IO, Iterable, Generator, Optional, Sequence, Tuple, List, Union, TypeVar, overload -from abc import ABCMeta import importlib.abc import types import zipimport +from abc import ABCMeta +from typing import IO, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, TypeVar, Union, overload _T = TypeVar("_T") _NestedStr = Union[str, Iterable[Union[str, Iterable[Any]]]] diff --git a/third_party/3/pkg_resources/py31compat.pyi b/third_party/3/pkg_resources/py31compat.pyi index e7b17a3c4ec6..cb61617379e4 100644 --- a/third_party/3/pkg_resources/py31compat.pyi +++ b/third_party/3/pkg_resources/py31compat.pyi @@ -1,6 +1,6 @@ -from typing import Text import os import sys +from typing import Text needs_makedirs: bool diff --git a/third_party/3/six/__init__.pyi b/third_party/3/six/__init__.pyi index b785eaca7684..6ede7db0019f 100644 --- a/third_party/3/six/__init__.pyi +++ b/third_party/3/six/__init__.pyi @@ -2,6 +2,14 @@ from __future__ import print_function +import types +import typing +import unittest +from builtins import next as next +from functools import wraps as wraps +# Exports +from io import BytesIO as BytesIO +from io import StringIO as StringIO from typing import ( Any, AnyStr, @@ -22,14 +30,7 @@ from typing import ( ValuesView, overload, ) -import types -import typing -import unittest -# Exports -from io import StringIO as StringIO, BytesIO as BytesIO -from builtins import next as next -from functools import wraps as wraps from . import moves _T = TypeVar('_T') diff --git a/third_party/3/six/moves/__init__.pyi b/third_party/3/six/moves/__init__.pyi index 3d6efced38a9..34e586211ab6 100644 --- a/third_party/3/six/moves/__init__.pyi +++ b/third_party/3/six/moves/__init__.pyi @@ -3,67 +3,67 @@ # Note: Commented out items means they weren't implemented at the time. # Uncomment them when the modules have been added to the typeshed. import sys - -from io import StringIO as cStringIO from builtins import filter as filter -from itertools import filterfalse as filterfalse from builtins import input as input -from sys import intern as intern from builtins import map as map -from os import getcwd as getcwd -from os import getcwdb as getcwdb -from builtins import range as range -from functools import reduce as reduce -from shlex import quote as shlex_quote -from io import StringIO as StringIO +from builtins import range as xrange +from builtins import zip as zip from collections import UserDict as UserDict from collections import UserList as UserList from collections import UserString as UserString -from builtins import range as xrange -from builtins import zip as zip +from functools import reduce as reduce +from importlib import reload as reload_module +from io import StringIO as StringIO +from itertools import filterfalse as filterfalse from itertools import zip_longest as zip_longest -from . import builtins -from . import configparser -# import copyreg as copyreg -# import dbm.gnu as dbm_gnu -from . import _dummy_thread -from . import http_cookiejar -from . import http_cookies -from . import html_entities -from . import html_parser -from . import http_client -from . import email_mime_multipart -from . import email_mime_nonmultipart -from . import email_mime_text -from . import email_mime_base -from . import BaseHTTPServer -from . import CGIHTTPServer -from . import SimpleHTTPServer -from . import cPickle -from . import queue -from . import reprlib -from . import socketserver -from . import _thread -from . import tkinter -from . import tkinter_dialog -from . import tkinter_filedialog -# import tkinter.scrolledtext as tkinter_scrolledtext -# import tkinter.simpledialog as tkinter_simpledialog -# import tkinter.tix as tkinter_tix -from . import tkinter_ttk -from . import tkinter_constants -# import tkinter.dnd as tkinter_dnd -# import tkinter.colorchooser as tkinter_colorchooser -from . import tkinter_commondialog -from . import tkinter_tkfiledialog +from os import getcwd as getcwd +from os import getcwdb as getcwdb +from shlex import quote as shlex_quote +from sys import intern as intern + # import tkinter.font as tkinter_font # import tkinter.messagebox as tkinter_messagebox # import tkinter.simpledialog as tkinter_tksimpledialog -from . import urllib_parse -from . import urllib_error -from . import urllib -from . import urllib_robotparser +# import tkinter.dnd as tkinter_dnd +# import tkinter.colorchooser as tkinter_colorchooser +# import tkinter.scrolledtext as tkinter_scrolledtext +# import tkinter.simpledialog as tkinter_simpledialog +# import tkinter.tix as tkinter_tix +# import copyreg as copyreg +# import dbm.gnu as dbm_gnu +from . import ( + BaseHTTPServer, + CGIHTTPServer, + SimpleHTTPServer, + _dummy_thread, + _thread, + builtins, + configparser, + cPickle, + email_mime_base, + email_mime_multipart, + email_mime_nonmultipart, + email_mime_text, + html_entities, + html_parser, + http_client, + http_cookiejar, + http_cookies, + queue, + reprlib, + socketserver, + tkinter, + tkinter_commondialog, + tkinter_constants, + tkinter_dialog, + tkinter_filedialog, + tkinter_tkfiledialog, + tkinter_ttk, + urllib, + urllib_error, + urllib_parse, + urllib_robotparser, +) + # import xmlrpc.client as xmlrpc_client # import xmlrpc.server as xmlrpc_server - -from importlib import reload as reload_module diff --git a/third_party/3/six/moves/urllib/error.pyi b/third_party/3/six/moves/urllib/error.pyi index 83f0d22d4b9f..8e1bd9cb67ae 100644 --- a/third_party/3/six/moves/urllib/error.pyi +++ b/third_party/3/six/moves/urllib/error.pyi @@ -1,3 +1,3 @@ -from urllib.error import URLError as URLError -from urllib.error import HTTPError as HTTPError from urllib.error import ContentTooShortError as ContentTooShortError +from urllib.error import HTTPError as HTTPError +from urllib.error import URLError as URLError diff --git a/third_party/3/six/moves/urllib/parse.pyi b/third_party/3/six/moves/urllib/parse.pyi index 8b4310a4e7c6..2deffbbafb6b 100644 --- a/third_party/3/six/moves/urllib/parse.pyi +++ b/third_party/3/six/moves/urllib/parse.pyi @@ -2,24 +2,24 @@ # # Note: Commented out items means they weren't implemented at the time. # Uncomment them when the modules have been added to the typeshed. +# from urllib.parse import splitquery as splitquery +# from urllib.parse import splittag as splittag +# from urllib.parse import splituser as splituser from urllib.parse import ParseResult as ParseResult from urllib.parse import SplitResult as SplitResult from urllib.parse import parse_qs as parse_qs from urllib.parse import parse_qsl as parse_qsl +from urllib.parse import quote as quote +from urllib.parse import quote_plus as quote_plus +from urllib.parse import unquote as unquote +from urllib.parse import unquote_plus as unquote_plus from urllib.parse import urldefrag as urldefrag +from urllib.parse import urlencode as urlencode from urllib.parse import urljoin as urljoin from urllib.parse import urlparse as urlparse from urllib.parse import urlsplit as urlsplit from urllib.parse import urlunparse as urlunparse from urllib.parse import urlunsplit as urlunsplit -from urllib.parse import quote as quote -from urllib.parse import quote_plus as quote_plus -from urllib.parse import unquote as unquote -from urllib.parse import unquote_plus as unquote_plus -from urllib.parse import urlencode as urlencode -# from urllib.parse import splitquery as splitquery -# from urllib.parse import splittag as splittag -# from urllib.parse import splituser as splituser from urllib.parse import uses_fragment as uses_fragment from urllib.parse import uses_netloc as uses_netloc from urllib.parse import uses_params as uses_params diff --git a/third_party/3/six/moves/urllib/request.pyi b/third_party/3/six/moves/urllib/request.pyi index b01dea7440d0..7f3f6cdeef87 100644 --- a/third_party/3/six/moves/urllib/request.pyi +++ b/third_party/3/six/moves/urllib/request.pyi @@ -2,38 +2,38 @@ # # Note: Commented out items means they weren't implemented at the time. # Uncomment them when the modules have been added to the typeshed. -from urllib.request import urlopen as urlopen -from urllib.request import install_opener as install_opener -from urllib.request import build_opener as build_opener -from urllib.request import pathname2url as pathname2url -from urllib.request import url2pathname as url2pathname -from urllib.request import getproxies as getproxies -from urllib.request import Request as Request -from urllib.request import OpenerDirector as OpenerDirector -from urllib.request import HTTPDefaultErrorHandler as HTTPDefaultErrorHandler -from urllib.request import HTTPRedirectHandler as HTTPRedirectHandler -from urllib.request import HTTPCookieProcessor as HTTPCookieProcessor -from urllib.request import ProxyHandler as ProxyHandler -from urllib.request import BaseHandler as BaseHandler -from urllib.request import HTTPPasswordMgr as HTTPPasswordMgr -from urllib.request import HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm +# from urllib.request import proxy_bypass as proxy_bypass from urllib.request import AbstractBasicAuthHandler as AbstractBasicAuthHandler -from urllib.request import HTTPBasicAuthHandler as HTTPBasicAuthHandler -from urllib.request import ProxyBasicAuthHandler as ProxyBasicAuthHandler from urllib.request import AbstractDigestAuthHandler as AbstractDigestAuthHandler +from urllib.request import BaseHandler as BaseHandler +from urllib.request import CacheFTPHandler as CacheFTPHandler +from urllib.request import FancyURLopener as FancyURLopener +from urllib.request import FileHandler as FileHandler +from urllib.request import FTPHandler as FTPHandler +from urllib.request import HTTPBasicAuthHandler as HTTPBasicAuthHandler +from urllib.request import HTTPCookieProcessor as HTTPCookieProcessor +from urllib.request import HTTPDefaultErrorHandler as HTTPDefaultErrorHandler from urllib.request import HTTPDigestAuthHandler as HTTPDigestAuthHandler -from urllib.request import ProxyDigestAuthHandler as ProxyDigestAuthHandler +from urllib.request import HTTPErrorProcessor as HTTPErrorProcessor from urllib.request import HTTPHandler as HTTPHandler +from urllib.request import HTTPPasswordMgr as HTTPPasswordMgr +from urllib.request import HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm +from urllib.request import HTTPRedirectHandler as HTTPRedirectHandler from urllib.request import HTTPSHandler as HTTPSHandler -from urllib.request import FileHandler as FileHandler -from urllib.request import FTPHandler as FTPHandler -from urllib.request import CacheFTPHandler as CacheFTPHandler +from urllib.request import OpenerDirector as OpenerDirector +from urllib.request import ProxyBasicAuthHandler as ProxyBasicAuthHandler +from urllib.request import ProxyDigestAuthHandler as ProxyDigestAuthHandler +from urllib.request import ProxyHandler as ProxyHandler +from urllib.request import Request as Request from urllib.request import UnknownHandler as UnknownHandler -from urllib.request import HTTPErrorProcessor as HTTPErrorProcessor -from urllib.request import urlretrieve as urlretrieve -from urllib.request import urlcleanup as urlcleanup from urllib.request import URLopener as URLopener -from urllib.request import FancyURLopener as FancyURLopener -# from urllib.request import proxy_bypass as proxy_bypass +from urllib.request import build_opener as build_opener +from urllib.request import getproxies as getproxies +from urllib.request import install_opener as install_opener from urllib.request import parse_http_list as parse_http_list from urllib.request import parse_keqv_list as parse_keqv_list +from urllib.request import pathname2url as pathname2url +from urllib.request import url2pathname as url2pathname +from urllib.request import urlcleanup as urlcleanup +from urllib.request import urlopen as urlopen +from urllib.request import urlretrieve as urlretrieve diff --git a/third_party/3/typed_ast/ast27.pyi b/third_party/3/typed_ast/ast27.pyi index c56434229f4a..e4e6c2fac4a0 100644 --- a/third_party/3/typed_ast/ast27.pyi +++ b/third_party/3/typed_ast/ast27.pyi @@ -1,5 +1,5 @@ import typing -from typing import Any, Optional, Union, Generic, Iterator +from typing import Any, Generic, Iterator, Optional, Union class NodeVisitor(): def visit(self, node: AST) -> Any: ... diff --git a/third_party/3/typed_ast/ast3.pyi b/third_party/3/typed_ast/ast3.pyi index 1962b46308fc..15af912c7630 100644 --- a/third_party/3/typed_ast/ast3.pyi +++ b/third_party/3/typed_ast/ast3.pyi @@ -1,5 +1,5 @@ import typing -from typing import Any, Optional, Union, Generic, Iterator +from typing import Any, Generic, Iterator, Optional, Union class NodeVisitor(): def visit(self, node: AST) -> Any: ... diff --git a/third_party/3/typed_ast/conversions.pyi b/third_party/3/typed_ast/conversions.pyi index d5f18299f02b..c7088ecc2f72 100644 --- a/third_party/3/typed_ast/conversions.pyi +++ b/third_party/3/typed_ast/conversions.pyi @@ -1,4 +1,3 @@ -from . import ast27 -from . import ast3 +from . import ast3, ast27 def py2to3(ast: ast27.AST) -> ast3.AST: ... From af9efd12f79d47aa7a4b77349d7e33b203aaf3aa Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 11:00:45 -0700 Subject: [PATCH 06/10] `.venv3/bin/black stdlib tests third_party` --- stdlib/2/BaseHTTPServer.pyi | 12 +- stdlib/2/HTMLParser.pyi | 4 - stdlib/2/Queue.pyi | 2 +- stdlib/2/SocketServer.pyi | 45 +- stdlib/2/UserDict.pyi | 13 +- stdlib/2/__builtin__.pyi | 531 ++++--- stdlib/2/_ast.pyi | 43 +- stdlib/2/_collections.pyi | 4 +- stdlib/2/_functools.pyi | 73 +- stdlib/2/_hotshot.pyi | 2 - stdlib/2/_io.pyi | 49 +- stdlib/2/_json.pyi | 2 - stdlib/2/_socket.pyi | 4 +- stdlib/2/_sre.pyi | 13 +- stdlib/2/_struct.pyi | 1 - stdlib/2/_symtable.pyi | 4 +- stdlib/2/_warnings.pyi | 13 +- stdlib/2/ast.pyi | 2 +- stdlib/2/atexit.pyi | 2 +- stdlib/2/cPickle.pyi | 6 - stdlib/2/cStringIO.pyi | 1 - stdlib/2/collections.pyi | 40 +- stdlib/2/commands.pyi | 2 - stdlib/2/compileall.pyi | 13 +- stdlib/2/cookielib.pyi | 42 +- stdlib/2/email/base64mime.pyi | 3 + stdlib/2/email/feedparser.pyi | 1 - stdlib/2/email/generator.pyi | 1 - stdlib/2/email/header.pyi | 3 +- stdlib/2/email/mime/application.pyi | 6 +- stdlib/2/encodings/__init__.pyi | 3 +- stdlib/2/fcntl.pyi | 7 +- stdlib/2/functools.pyi | 81 +- stdlib/2/future_builtins.pyi | 4 - stdlib/2/gc.pyi | 3 +- stdlib/2/gettext.pyi | 21 +- stdlib/2/gzip.pyi | 5 +- stdlib/2/hashlib.pyi | 1 - stdlib/2/heapq.pyi | 7 +- stdlib/2/httplib.pyi | 34 +- stdlib/2/inspect.pyi | 78 +- stdlib/2/io.pyi | 16 +- stdlib/2/itertools.pyi | 248 +-- stdlib/2/json.pyi | 140 +- stdlib/2/markupbase.pyi | 1 - stdlib/2/multiprocessing/__init__.pyi | 13 +- stdlib/2/multiprocessing/dummy/__init__.pyi | 1 - stdlib/2/multiprocessing/dummy/connection.pyi | 1 - stdlib/2/multiprocessing/pool.pyi | 67 +- stdlib/2/multiprocessing/process.pyi | 5 +- stdlib/2/mutex.pyi | 2 +- stdlib/2/os/__init__.pyi | 115 +- stdlib/2/os/path.pyi | 19 +- stdlib/2/os2emxpath.pyi | 19 +- stdlib/2/popen2.pyi | 3 +- stdlib/2/posix.pyi | 9 + stdlib/2/random.pyi | 8 +- stdlib/2/re.pyi | 70 +- stdlib/2/repr.pyi | 1 + stdlib/2/resource.pyi | 29 +- stdlib/2/sets.pyi | 4 +- stdlib/2/sha.pyi | 1 + stdlib/2/shelve.pyi | 8 +- stdlib/2/shlex.pyi | 3 +- stdlib/2/signal.pyi | 2 + stdlib/2/spwd.pyi | 23 +- stdlib/2/sre_constants.pyi | 3 +- stdlib/2/sre_parse.pyi | 3 +- stdlib/2/stat.pyi | 1 - stdlib/2/string.pyi | 14 +- stdlib/2/stringold.pyi | 1 - stdlib/2/strop.pyi | 1 - stdlib/2/subprocess.pyi | 129 +- stdlib/2/sys.pyi | 3 +- stdlib/2/tempfile.pyi | 29 +- stdlib/2/textwrap.pyi | 70 +- stdlib/2/thread.pyi | 2 + stdlib/2/tokenize.pyi | 1 - stdlib/2/types.pyi | 18 +- stdlib/2/typing.pyi | 100 +- stdlib/2/unittest.pyi | 173 +-- stdlib/2/urllib.pyi | 1 - stdlib/2/urllib2.pyi | 40 +- stdlib/2/urlparse.pyi | 31 +- stdlib/2/user.pyi | 1 + stdlib/2/xmlrpclib.pyi | 49 +- stdlib/2and3/_bisect.pyi | 3 +- stdlib/2and3/_codecs.pyi | 4 +- stdlib/2and3/_csv.pyi | 1 - stdlib/2and3/_curses.pyi | 37 +- stdlib/2and3/_heapq.pyi | 2 + stdlib/2and3/_weakref.pyi | 5 +- stdlib/2and3/_weakrefset.pyi | 8 +- stdlib/2and3/argparse.pyi | 327 ++-- stdlib/2and3/array.pyi | 9 +- stdlib/2and3/asynchat.pyi | 1 - stdlib/2and3/asyncore.pyi | 24 +- stdlib/2and3/base64.pyi | 13 +- stdlib/2and3/binascii.pyi | 6 + stdlib/2and3/bisect.pyi | 3 +- stdlib/2and3/builtins.pyi | 531 ++++--- stdlib/2and3/bz2.pyi | 23 +- stdlib/2and3/cProfile.pyi | 12 +- stdlib/2and3/calendar.pyi | 2 + stdlib/2and3/cgi.pyi | 51 +- stdlib/2and3/cmath.pyi | 2 + stdlib/2and3/code.pyi | 30 +- stdlib/2and3/codecs.pyi | 3 + stdlib/2and3/contextlib.pyi | 33 +- stdlib/2and3/copy.pyi | 4 +- stdlib/2and3/crypt.pyi | 2 +- stdlib/2and3/csv.pyi | 28 +- stdlib/2and3/ctypes/__init__.pyi | 108 +- stdlib/2and3/ctypes/util.pyi | 3 +- stdlib/2and3/ctypes/wintypes.pyi | 8 + stdlib/2and3/curses/__init__.pyi | 2 +- stdlib/2and3/curses/ascii.pyi | 2 +- stdlib/2and3/datetime.pyi | 134 +- stdlib/2and3/decimal.pyi | 62 +- stdlib/2and3/difflib.pyi | 93 +- stdlib/2and3/dis.pyi | 31 +- stdlib/2and3/distutils/archive_util.pyi | 17 +- stdlib/2and3/distutils/ccompiler.pyi | 196 +-- stdlib/2and3/distutils/cmd.pyi | 45 +- stdlib/2and3/distutils/command/build_py.pyi | 1 - stdlib/2and3/distutils/command/install.pyi | 1 - stdlib/2and3/distutils/core.pyi | 85 +- stdlib/2and3/distutils/dep_util.pyi | 3 +- stdlib/2and3/distutils/dir_util.pyi | 23 +- stdlib/2and3/distutils/extension.pyi | 66 +- stdlib/2and3/distutils/fancy_getopt.pyi | 7 +- stdlib/2and3/distutils/file_util.pyi | 17 +- stdlib/2and3/distutils/spawn.pyi | 6 +- stdlib/2and3/distutils/sysconfig.pyi | 7 +- stdlib/2and3/distutils/text_file.pyi | 21 +- stdlib/2and3/distutils/util.pyi | 20 +- stdlib/2and3/distutils/version.pyi | 6 +- stdlib/2and3/doctest.pyi | 130 +- stdlib/2and3/filecmp.pyi | 14 +- stdlib/2and3/fileinput.pyi | 11 +- stdlib/2and3/fractions.pyi | 17 +- stdlib/2and3/ftplib.pyi | 66 +- stdlib/2and3/genericpath.pyi | 2 +- stdlib/2and3/grp.pyi | 7 +- stdlib/2and3/hmac.pyi | 7 +- stdlib/2and3/imaplib.pyi | 2 - stdlib/2and3/imghdr.pyi | 2 +- stdlib/2and3/keyword.pyi | 1 + stdlib/2and3/lib2to3/pgen2/driver.pyi | 4 +- stdlib/2and3/lib2to3/pgen2/grammar.pyi | 2 +- stdlib/2and3/lib2to3/pgen2/tokenize.pyi | 5 +- stdlib/2and3/lib2to3/pytree.pyi | 20 +- stdlib/2and3/linecache.pyi | 1 + stdlib/2and3/locale.pyi | 20 +- stdlib/2and3/logging/__init__.pyi | 559 ++++--- stdlib/2and3/logging/config.pyi | 21 +- stdlib/2and3/logging/handlers.pyi | 162 +- stdlib/2and3/macpath.pyi | 19 +- stdlib/2and3/math.pyi | 16 + stdlib/2and3/mimetypes.pyi | 18 +- stdlib/2and3/mmap.pyi | 21 +- stdlib/2and3/netrc.pyi | 3 - stdlib/2and3/nis.pyi | 3 +- stdlib/2and3/ntpath.pyi | 19 +- stdlib/2and3/operator.pyi | 63 +- stdlib/2and3/optparse.pyi | 47 +- stdlib/2and3/pdb.pyi | 17 +- stdlib/2and3/pickle.pyi | 38 +- stdlib/2and3/pickletools.pyi | 45 +- stdlib/2and3/pkgutil.pyi | 14 +- stdlib/2and3/plistlib.pyi | 30 +- stdlib/2and3/poplib.pyi | 23 +- stdlib/2and3/posixpath.pyi | 19 +- stdlib/2and3/pprint.pyi | 28 +- stdlib/2and3/profile.pyi | 8 +- stdlib/2and3/pstats.pyi | 11 +- stdlib/2and3/pty.pyi | 2 + stdlib/2and3/py_compile.pyi | 9 +- stdlib/2and3/pyclbr.pyi | 27 +- stdlib/2and3/pydoc.pyi | 95 +- stdlib/2and3/pyexpat/__init__.pyi | 11 +- stdlib/2and3/readline.pyi | 8 +- stdlib/2and3/rlcompleter.pyi | 1 - stdlib/2and3/sched.pyi | 36 +- stdlib/2and3/select.pyi | 11 +- stdlib/2and3/shutil.pyi | 102 +- stdlib/2and3/site.pyi | 4 +- stdlib/2and3/smtpd.pyi | 44 +- stdlib/2and3/sndhdr.pyi | 11 +- stdlib/2and3/socket.pyi | 82 +- stdlib/2and3/sqlite3/dbapi2.pyi | 78 +- stdlib/2and3/ssl.pyi | 129 +- stdlib/2and3/struct.pyi | 3 +- stdlib/2and3/sunau.pyi | 13 +- stdlib/2and3/sysconfig.pyi | 1 - stdlib/2and3/syslog.pyi | 1 - stdlib/2and3/tarfile.pyi | 162 +- stdlib/2and3/telnetlib.pyi | 7 +- stdlib/2and3/threading.pyi | 97 +- stdlib/2and3/time.pyi | 50 +- stdlib/2and3/timeit.pyi | 30 +- stdlib/2and3/trace.pyi | 28 +- stdlib/2and3/traceback.pyi | 133 +- stdlib/2and3/turtle.pyi | 82 +- stdlib/2and3/unicodedata.pyi | 2 +- stdlib/2and3/uu.pyi | 6 +- stdlib/2and3/uuid.pyi | 17 +- stdlib/2and3/warnings.pyi | 61 +- stdlib/2and3/wave.pyi | 13 +- stdlib/2and3/weakref.pyi | 14 +- stdlib/2and3/webbrowser.pyi | 10 +- stdlib/2and3/wsgiref/handlers.pyi | 22 +- stdlib/2and3/wsgiref/simple_server.pyi | 5 +- stdlib/2and3/wsgiref/types.pyi | 5 +- stdlib/2and3/xdrlib.pyi | 2 +- stdlib/2and3/xml/etree/ElementPath.pyi | 6 +- stdlib/2and3/xml/etree/ElementTree.pyi | 95 +- stdlib/2and3/xml/sax/__init__.pyi | 15 +- stdlib/2and3/zipfile.pyi | 51 +- stdlib/2and3/zlib.pyi | 19 +- stdlib/3.5/zipapp.pyi | 16 +- stdlib/3.6/secrets.pyi | 2 +- stdlib/3.7/contextvars.pyi | 2 +- stdlib/3.7/dataclasses.pyi | 74 +- stdlib/3/_ast.pyi | 46 +- stdlib/3/_importlib_modulespec.pyi | 12 +- stdlib/3/_json.pyi | 5 +- stdlib/3/_markupbase.pyi | 1 - stdlib/3/_operator.pyi | 1 + stdlib/3/_posixsubprocess.pyi | 26 +- stdlib/3/_stat.pyi | 2 - stdlib/3/_subprocess.pyi | 20 +- stdlib/3/_thread.pyi | 5 +- stdlib/3/_tracemalloc.pyi | 6 - stdlib/3/_warnings.pyi | 13 +- stdlib/3/_winapi.pyi | 49 +- stdlib/3/abc.pyi | 6 +- stdlib/3/ast.pyi | 15 +- stdlib/3/asyncio/__init__.pyi | 29 +- stdlib/3/asyncio/base_events.pyi | 178 ++- stdlib/3/asyncio/coroutines.pyi | 2 +- stdlib/3/asyncio/events.pyi | 174 ++- stdlib/3/asyncio/futures.pyi | 4 +- stdlib/3/asyncio/locks.pyi | 6 +- stdlib/3/asyncio/protocols.pyi | 1 - stdlib/3/asyncio/queues.pyi | 6 +- stdlib/3/asyncio/runners.pyi | 3 +- stdlib/3/asyncio/streams.pyi | 49 +- stdlib/3/asyncio/subprocess.pyi | 13 +- stdlib/3/asyncio/tasks.pyi | 96 +- stdlib/3/asyncio/transports.pyi | 4 +- stdlib/3/collections/__init__.pyi | 91 +- stdlib/3/collections/abc.pyi | 6 +- stdlib/3/compileall.pyi | 39 +- stdlib/3/concurrent/futures/_base.pyi | 17 +- stdlib/3/concurrent/futures/process.pyi | 10 +- stdlib/3/concurrent/futures/thread.pyi | 14 +- stdlib/3/configparser.pyi | 162 +- stdlib/3/email/charset.pyi | 9 +- stdlib/3/email/contentmanager.pyi | 6 +- stdlib/3/email/errors.pyi | 1 - stdlib/3/email/feedparser.pyi | 6 +- stdlib/3/email/generator.pyi | 17 +- stdlib/3/email/header.pyi | 31 +- stdlib/3/email/headerregistry.pyi | 17 +- stdlib/3/email/iterators.pyi | 3 +- stdlib/3/email/message.pyi | 59 +- stdlib/3/email/mime/application.pyi | 10 +- stdlib/3/email/mime/audio.pyi | 10 +- stdlib/3/email/mime/base.pyi | 3 +- stdlib/3/email/mime/image.pyi | 10 +- stdlib/3/email/mime/multipart.pyi | 10 +- stdlib/3/email/mime/text.pyi | 3 +- stdlib/3/email/parser.pyi | 12 +- stdlib/3/email/policy.pyi | 18 +- stdlib/3/email/utils.pyi | 19 +- stdlib/3/encodings/__init__.pyi | 3 +- stdlib/3/enum.pyi | 6 +- stdlib/3/faulthandler.pyi | 3 +- stdlib/3/fcntl.pyi | 16 +- stdlib/3/functools.pyi | 93 +- stdlib/3/gc.pyi | 3 +- stdlib/3/getpass.pyi | 3 - stdlib/3/gettext.pyi | 20 +- stdlib/3/glob.pyi | 3 +- stdlib/3/gzip.pyi | 18 +- stdlib/3/hashlib.pyi | 26 +- stdlib/3/heapq.pyi | 14 +- stdlib/3/html/parser.pyi | 10 +- stdlib/3/http/__init__.pyi | 2 - stdlib/3/http/client.pyi | 98 +- stdlib/3/http/cookiejar.pyi | 83 +- stdlib/3/http/cookies.pyi | 8 +- stdlib/3/http/server.pyi | 30 +- stdlib/3/imp.pyi | 9 +- stdlib/3/importlib/__init__.pyi | 15 +- stdlib/3/importlib/abc.pyi | 36 +- stdlib/3/importlib/machinery.pyi | 59 +- stdlib/3/importlib/resources.pyi | 11 +- stdlib/3/importlib/util.pyi | 45 +- stdlib/3/inspect.pyi | 199 +-- stdlib/3/io.pyi | 36 +- stdlib/3/itertools.pyi | 106 +- stdlib/3/json/__init__.pyi | 90 +- stdlib/3/json/decoder.pyi | 16 +- stdlib/3/json/encoder.pyi | 17 +- stdlib/3/lzma.pyi | 60 +- stdlib/3/multiprocessing/__init__.pyi | 39 +- stdlib/3/multiprocessing/connection.pyi | 17 +- stdlib/3/multiprocessing/context.pyi | 46 +- stdlib/3/multiprocessing/dummy/__init__.pyi | 2 - stdlib/3/multiprocessing/dummy/connection.pyi | 5 +- stdlib/3/multiprocessing/managers.pyi | 23 +- stdlib/3/multiprocessing/pool.pyi | 101 +- stdlib/3/multiprocessing/queues.pyi | 2 +- stdlib/3/multiprocessing/spawn.pyi | 3 + stdlib/3/multiprocessing/synchronize.pyi | 31 +- stdlib/3/nntplib.pyi | 61 +- stdlib/3/os/__init__.pyi | 300 ++-- stdlib/3/os/path.pyi | 19 +- stdlib/3/pathlib.pyi | 44 +- stdlib/3/platform.pyi | 26 +- stdlib/3/posix.pyi | 35 +- stdlib/3/queue.pyi | 2 +- stdlib/3/random.pyi | 27 +- stdlib/3/re.pyi | 57 +- stdlib/3/reprlib.pyi | 1 + stdlib/3/resource.pyi | 27 +- stdlib/3/runpy.pyi | 11 +- stdlib/3/selectors.pyi | 20 +- stdlib/3/shelve.pyi | 8 +- stdlib/3/shlex.pyi | 20 +- stdlib/3/signal.pyi | 9 - stdlib/3/smtplib.pyi | 78 +- stdlib/3/socketserver.pyi | 45 +- stdlib/3/spwd.pyi | 23 +- stdlib/3/sre_constants.pyi | 1 - stdlib/3/sre_parse.pyi | 5 +- stdlib/3/stat.pyi | 6 +- stdlib/3/statistics.pyi | 4 +- stdlib/3/string.pyi | 16 +- stdlib/3/subprocess.pyi | 482 +++--- stdlib/3/sys.pyi | 49 +- stdlib/3/tempfile.pyi | 133 +- stdlib/3/textwrap.pyi | 137 +- stdlib/3/tkinter/__init__.pyi | 50 +- stdlib/3/tkinter/filedialog.pyi | 4 +- stdlib/3/tokenize.pyi | 9 +- stdlib/3/tracemalloc.pyi | 9 +- stdlib/3/types.pyi | 34 +- stdlib/3/typing.pyi | 136 +- stdlib/3/unittest/__init__.pyi | 27 +- stdlib/3/unittest/case.pyi | 247 ++- stdlib/3/unittest/loader.pyi | 21 +- stdlib/3/unittest/mock.pyi | 86 +- stdlib/3/unittest/result.pyi | 13 +- stdlib/3/unittest/runner.pyi | 40 +- stdlib/3/unittest/signals.pyi | 3 +- stdlib/3/unittest/suite.pyi | 2 - stdlib/3/urllib/error.pyi | 2 + stdlib/3/urllib/parse.pyi | 83 +- stdlib/3/urllib/request.pyi | 152 +- stdlib/3/urllib/response.pyi | 4 +- stdlib/3/urllib/robotparser.pyi | 2 +- tests/check_consistent.py | 49 +- tests/mypy_selftest.py | 22 +- tests/mypy_test.py | 89 +- tests/pytype_test.py | 94 +- third_party/2/OpenSSL/crypto.pyi | 10 +- third_party/2/concurrent/futures/_base.pyi | 17 +- third_party/2/concurrent/futures/process.pyi | 10 +- third_party/2/concurrent/futures/thread.pyi | 14 +- .../hazmat/primitives/asymmetric/rsa.pyi | 5 +- third_party/2/enum.pyi | 6 +- third_party/2/gflags.pyi | 129 +- third_party/2/kazoo/client.pyi | 20 +- third_party/2/pathlib2.pyi | 44 +- third_party/2/pymssql.pyi | 41 +- third_party/2/routes/mapper.pyi | 14 +- third_party/2/six/__init__.pyi | 26 +- third_party/2/tornado/gen.pyi | 2 +- third_party/2/tornado/httpclient.pyi | 46 +- third_party/2/tornado/httpserver.pyi | 19 +- third_party/2/tornado/httputil.pyi | 9 +- .../2and3/Crypto/Cipher/PKCS1_OAEP.pyi | 1 - third_party/2and3/Crypto/Cipher/XOR.pyi | 1 - third_party/2and3/Crypto/Util/Counter.pyi | 11 +- third_party/2and3/Crypto/Util/randpool.pyi | 4 +- third_party/2and3/atomicwrites/__init__.pyi | 2 + third_party/2and3/attr/__init__.pyi | 5 +- third_party/2and3/attr/converters.pyi | 4 +- third_party/2and3/attr/validators.pyi | 15 +- third_party/2and3/bleach/__init__.pyi | 5 +- third_party/2and3/bleach/utils.pyi | 1 - third_party/2and3/boto/__init__.pyi | 42 +- third_party/2and3/boto/connection.pyi | 70 +- third_party/2and3/boto/elb/__init__.pyi | 23 +- third_party/2and3/boto/kms/layer1.pyi | 60 +- third_party/2and3/boto/regioninfo.pyi | 8 +- third_party/2and3/boto/s3/__init__.pyi | 8 +- third_party/2and3/boto/s3/acl.pyi | 10 +- third_party/2and3/boto/s3/bucket.pyi | 129 +- .../2and3/boto/s3/bucketlistresultset.pyi | 53 +- third_party/2and3/boto/s3/connection.pyi | 85 +- third_party/2and3/boto/s3/cors.pyi | 20 +- third_party/2and3/boto/s3/key.pyi | 3 +- third_party/2and3/boto/s3/lifecycle.pyi | 18 +- third_party/2and3/boto/s3/multidelete.pyi | 12 +- third_party/2and3/boto/s3/multipart.pyi | 27 +- third_party/2and3/boto/s3/website.pyi | 26 +- third_party/2and3/boto/utils.pyi | 106 +- third_party/2and3/characteristic/__init__.pyi | 9 +- third_party/2and3/click/__init__.pyi | 9 +- third_party/2and3/click/core.pyi | 378 +---- third_party/2and3/click/decorators.pyi | 85 +- third_party/2and3/click/exceptions.pyi | 67 +- third_party/2and3/click/formatting.pyi | 92 +- third_party/2and3/click/globals.pyi | 18 +- third_party/2and3/click/parser.pyi | 70 +- third_party/2and3/click/termui.pyi | 94 +- third_party/2and3/click/testing.pyi | 12 +- third_party/2and3/click/types.pyi | 235 +-- third_party/2and3/click/utils.pyi | 125 +- third_party/2and3/croniter.pyi | 6 +- third_party/2and3/dateutil/_common.pyi | 5 - third_party/2and3/dateutil/parser.pyi | 16 +- third_party/2and3/dateutil/relativedelta.pyi | 45 +- third_party/2and3/dateutil/rrule.pyi | 41 +- third_party/2and3/dateutil/tz/tz.pyi | 13 +- third_party/2and3/emoji.pyi | 14 +- third_party/2and3/first.pyi | 5 +- third_party/2and3/flask/app.pyi | 39 +- third_party/2and3/flask/blueprints.pyi | 27 +- third_party/2and3/flask/cli.pyi | 13 +- third_party/2and3/flask/helpers.pyi | 11 +- third_party/2and3/flask/testing.pyi | 13 +- third_party/2and3/google/protobuf/any_pb2.pyi | 7 +- .../2and3/google/protobuf/any_test_pb2.pyi | 12 +- third_party/2and3/google/protobuf/api_pb2.pyi | 56 +- .../google/protobuf/compiler/plugin_pb2.pyi | 49 +- .../2and3/google/protobuf/descriptor.pyi | 124 +- .../2and3/google/protobuf/descriptor_pb2.pyi | 572 +++---- .../2and3/google/protobuf/duration_pb2.pyi | 7 +- .../2and3/google/protobuf/empty_pb2.pyi | 5 +- .../2and3/google/protobuf/field_mask_pb2.pyi | 6 +- .../google/protobuf/internal/containers.pyi | 3 +- .../protobuf/internal/enum_type_wrapper.pyi | 1 - .../protobuf/internal/well_known_types.pyi | 4 +- .../2and3/google/protobuf/json_format.pyi | 11 +- .../protobuf/map_proto2_unittest_pb2.pyi | 265 +--- .../google/protobuf/map_unittest_pb2.pyi | 602 ++------ third_party/2and3/google/protobuf/message.pyi | 2 - .../google/protobuf/source_context_pb2.pyi | 6 +- .../2and3/google/protobuf/struct_pb2.pyi | 52 +- .../protobuf/test_messages_proto2_pb2.pyi | 505 ++---- .../protobuf/test_messages_proto3_pb2.pyi | 483 ++---- .../2and3/google/protobuf/timestamp_pb2.pyi | 7 +- .../2and3/google/protobuf/type_pb2.pyi | 112 +- .../google/protobuf/unittest_arena_pb2.pyi | 26 +- .../protobuf/unittest_custom_options_pb2.pyi | 275 +--- .../google/protobuf/unittest_import_pb2.pyi | 20 +- .../protobuf/unittest_import_public_pb2.pyi | 6 +- .../google/protobuf/unittest_mset_pb2.pyi | 37 +- .../unittest_mset_wire_format_pb2.pyi | 13 +- .../protobuf/unittest_no_arena_import_pb2.pyi | 6 +- .../google/protobuf/unittest_no_arena_pb2.pyi | 236 ++- .../unittest_no_generic_services_pb2.pyi | 12 +- .../2and3/google/protobuf/unittest_pb2.pyi | 1376 ++++++----------- .../protobuf/unittest_proto3_arena_pb2.pyi | 259 ++-- .../protobuf/util/json_format_proto3_pb2.pyi | 449 ++---- .../2and3/google/protobuf/wrappers_pb2.pyi | 62 +- third_party/2and3/itsdangerous.pyi | 103 +- third_party/2and3/jinja2/environment.pyi | 129 +- third_party/2and3/jinja2/ext.pyi | 10 +- third_party/2and3/jinja2/parser.pyi | 12 +- third_party/2and3/jinja2/runtime.pyi | 4 +- third_party/2and3/jinja2/utils.pyi | 7 +- third_party/2and3/markupsafe/__init__.pyi | 4 +- third_party/2and3/markupsafe/_compat.pyi | 11 +- third_party/2and3/mock.pyi | 86 +- third_party/2and3/mypy_extensions.pyi | 5 +- third_party/2and3/pycurl.pyi | 4 +- third_party/2and3/pymysql/__init__.pyi | 2 + third_party/2and3/pymysql/connections.pyi | 28 +- third_party/2and3/pynamodb/attributes.pyi | 37 +- .../2and3/pynamodb/connection/base.pyi | 148 +- .../2and3/pynamodb/connection/table.pyi | 112 +- third_party/2and3/pynamodb/indexes.pyi | 11 +- third_party/2and3/pynamodb/models.pyi | 69 +- third_party/2and3/pytz/__init__.pyi | 1 + third_party/2and3/redis/client.pyi | 12 +- third_party/2and3/redis/connection.pyi | 35 +- third_party/2and3/requests/adapters.pyi | 35 +- third_party/2and3/requests/api.pyi | 33 +- third_party/2and3/requests/models.pyi | 20 +- .../requests/packages/urllib3/connection.pyi | 3 +- .../packages/urllib3/connectionpool.pyi | 52 +- .../requests/packages/urllib3/request.pyi | 4 +- .../requests/packages/urllib3/response.pyi | 15 +- .../packages/urllib3/util/request.pyi | 4 +- .../requests/packages/urllib3/util/retry.pyi | 13 +- .../requests/packages/urllib3/util/ssl_.pyi | 13 +- third_party/2and3/requests/sessions.pyi | 42 +- third_party/2and3/requests/structures.pyi | 2 +- third_party/2and3/simplejson/__init__.pyi | 1 - third_party/2and3/singledispatch.pyi | 1 - third_party/2and3/tabulate.pyi | 6 +- third_party/2and3/termcolor.pyi | 19 +- third_party/2and3/toml.pyi | 3 +- third_party/2and3/typing_extensions.pyi | 12 +- third_party/2and3/ujson.pyi | 20 +- third_party/2and3/werkzeug/__init__.pyi | 1 - third_party/2and3/werkzeug/_internal.pyi | 11 +- third_party/2and3/werkzeug/contrib/cache.pyi | 12 +- .../2and3/werkzeug/contrib/profiler.pyi | 12 +- .../2and3/werkzeug/contrib/securecookie.pyi | 16 +- .../2and3/werkzeug/contrib/sessions.pyi | 26 +- third_party/2and3/werkzeug/datastructures.pyi | 16 +- third_party/2and3/werkzeug/debug/__init__.pyi | 15 +- third_party/2and3/werkzeug/formparser.pyi | 37 +- third_party/2and3/werkzeug/http.pyi | 66 +- third_party/2and3/werkzeug/routing.pyi | 74 +- third_party/2and3/werkzeug/script.pyi | 16 +- third_party/2and3/werkzeug/serving.pyi | 60 +- third_party/2and3/werkzeug/test.pyi | 50 +- third_party/2and3/werkzeug/urls.pyi | 47 +- third_party/2and3/werkzeug/utils.pyi | 1 - third_party/2and3/werkzeug/wrappers.pyi | 38 +- third_party/2and3/werkzeug/wsgi.pyi | 15 +- third_party/2and3/yaml/__init__.pyi | 211 ++- third_party/2and3/yaml/cyaml.pyi | 43 +- third_party/2and3/yaml/dumper.pyi | 51 +- third_party/2and3/yaml/emitter.pyi | 4 +- third_party/3.5/contextvars.pyi | 2 +- third_party/3/dataclasses.pyi | 74 +- third_party/3/docutils/nodes.pyi | 6 +- third_party/3/docutils/parsers/rst/roles.pyi | 13 +- third_party/3/docutils/parsers/rst/states.pyi | 3 +- third_party/3/jwt/__init__.pyi | 28 +- third_party/3/jwt/algorithms.pyi | 1 - third_party/3/orjson.pyi | 4 +- third_party/3/six/__init__.pyi | 27 +- third_party/3/typed_ast/ast27.pyi | 42 +- third_party/3/typed_ast/ast3.pyi | 47 +- 544 files changed, 11835 insertions(+), 12195 deletions(-) diff --git a/stdlib/2/BaseHTTPServer.pyi b/stdlib/2/BaseHTTPServer.pyi index 3231b2f53b98..3958d072047d 100644 --- a/stdlib/2/BaseHTTPServer.pyi +++ b/stdlib/2/BaseHTTPServer.pyi @@ -7,8 +7,7 @@ from typing import Any, BinaryIO, Mapping, Optional, Tuple, Union class HTTPServer(SocketServer.TCPServer): server_name: str server_port: int - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type) -> None: ... class BaseHTTPRequestHandler: client_address: Tuple[str, int] @@ -27,18 +26,15 @@ class BaseHTTPRequestHandler: protocol_version: str MessageClass: type responses: Mapping[int, Tuple[str, str]] - def __init__(self, request: bytes, client_address: Tuple[str, int], - server: SocketServer.BaseServer) -> None: ... + def __init__(self, request: bytes, client_address: Tuple[str, int], server: SocketServer.BaseServer) -> None: ... def handle(self) -> None: ... def handle_one_request(self) -> None: ... def send_error(self, code: int, message: Optional[str] = ...) -> None: ... - def send_response(self, code: int, - message: Optional[str] = ...) -> None: ... + def send_response(self, code: int, message: Optional[str] = ...) -> None: ... def send_header(self, keyword: str, value: str) -> None: ... def end_headers(self) -> None: ... def flush_headers(self) -> None: ... - def log_request(self, code: Union[int, str] = ..., - size: Union[int, str] = ...) -> None: ... + def log_request(self, code: Union[int, str] = ..., size: Union[int, str] = ...) -> None: ... def log_error(self, format: str, *args: Any) -> None: ... def log_message(self, format: str, *args: Any) -> None: ... def version_string(self) -> str: ... diff --git a/stdlib/2/HTMLParser.pyi b/stdlib/2/HTMLParser.pyi index 4ee4e1498de4..ebc2735e9c48 100644 --- a/stdlib/2/HTMLParser.pyi +++ b/stdlib/2/HTMLParser.pyi @@ -7,11 +7,9 @@ class HTMLParser(ParserBase): def feed(self, feed: AnyStr) -> None: ... def close(self) -> None: ... def reset(self) -> None: ... - def get_starttag_text(self) -> AnyStr: ... def set_cdata_mode(self, AnyStr) -> None: ... def clear_cdata_mode(self) -> None: ... - def handle_startendtag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ... def handle_starttag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ... def handle_endtag(self, tag: AnyStr): ... @@ -21,9 +19,7 @@ class HTMLParser(ParserBase): def handle_comment(self, data: AnyStr): ... def handle_decl(self, decl: AnyStr): ... def handle_pi(self, data: AnyStr): ... - def unknown_decl(self, data: AnyStr): ... - def unescape(self, s: AnyStr) -> AnyStr: ... class HTMLParseError(Exception): diff --git a/stdlib/2/Queue.pyi b/stdlib/2/Queue.pyi index 7763e5ded840..30637d841ae1 100644 --- a/stdlib/2/Queue.pyi +++ b/stdlib/2/Queue.pyi @@ -3,7 +3,7 @@ from collections import deque from typing import Any, Generic, Optional, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") class Empty(Exception): ... class Full(Exception): ... diff --git a/stdlib/2/SocketServer.pyi b/stdlib/2/SocketServer.pyi index b24f96c4df6e..0476758a9404 100644 --- a/stdlib/2/SocketServer.pyi +++ b/stdlib/2/SocketServer.pyi @@ -15,66 +15,51 @@ class BaseServer: request_queue_size: int socket_type: int timeout: Optional[float] - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type) -> None: ... def fileno(self) -> int: ... def handle_request(self) -> None: ... def serve_forever(self, poll_interval: float = ...) -> None: ... def shutdown(self) -> None: ... def server_close(self) -> None: ... - def finish_request(self, request: bytes, - client_address: Tuple[str, int]) -> None: ... + def finish_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... def get_request(self) -> None: ... - def handle_error(self, request: bytes, - client_address: Tuple[str, int]) -> None: ... + def handle_error(self, request: bytes, client_address: Tuple[str, int]) -> None: ... def handle_timeout(self) -> None: ... - def process_request(self, request: bytes, - client_address: Tuple[str, int]) -> None: ... + def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... def server_activate(self) -> None: ... def server_bind(self) -> None: ... - def verify_request(self, request: bytes, - client_address: Tuple[str, int]) -> bool: ... + def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ... if sys.version_info >= (3, 6): def __enter__(self) -> BaseServer: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[types.TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType] + ) -> bool: ... if sys.version_info >= (3, 3): def service_actions(self) -> None: ... class TCPServer(BaseServer): - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type, - bind_and_activate: bool = ...) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type, bind_and_activate: bool = ...) -> None: ... class UDPServer(BaseServer): - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type, - bind_and_activate: bool = ...) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type, bind_and_activate: bool = ...) -> None: ... -if sys.platform != 'win32': +if sys.platform != "win32": class UnixStreamServer(BaseServer): - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type, - bind_and_activate: bool = ...) -> None: ... - + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type, bind_and_activate: bool = ...) -> None: ... class UnixDatagramServer(BaseServer): - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type, - bind_and_activate: bool = ...) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type, bind_and_activate: bool = ...) -> None: ... class ForkingMixIn: ... class ThreadingMixIn: ... - class ForkingTCPServer(ForkingMixIn, TCPServer): ... class ForkingUDPServer(ForkingMixIn, UDPServer): ... class ThreadingTCPServer(ThreadingMixIn, TCPServer): ... class ThreadingUDPServer(ThreadingMixIn, UDPServer): ... -if sys.platform != 'win32': + +if sys.platform != "win32": class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): ... class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): ... - class BaseRequestHandler: # Those are technically of types, respectively: # * Union[SocketType, Tuple[bytes, SocketType]] diff --git a/stdlib/2/UserDict.pyi b/stdlib/2/UserDict.pyi index 96d464c82bc1..0e681a63e813 100644 --- a/stdlib/2/UserDict.pyi +++ b/stdlib/2/UserDict.pyi @@ -15,25 +15,21 @@ from typing import ( overload, ) -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') -_T = TypeVar('_T') +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") +_T = TypeVar("_T") class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]): data: Mapping[_KT, _VT] - def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ... - # TODO: __iter__ is not available for UserDict -class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]): - ... +class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]): ... class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]): def has_key(self, key: _KT) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_KT]: ... - # From typing.Mapping[_KT, _VT] # (can't inherit because of keys()) @overload @@ -46,7 +42,6 @@ class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]): def itervalues(self) -> Iterator[_VT]: ... def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... def __contains__(self, o: Any) -> bool: ... - # From typing.MutableMapping[_KT, _VT] def clear(self) -> None: ... def pop(self, k: _KT, default: _VT = ...) -> _VT: ... diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 5d47593011b5..ee457a579cac 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -49,17 +49,17 @@ from typing import ( if sys.version_info >= (3,): from typing import SupportsBytes, SupportsRound -_T = TypeVar('_T') -_T_co = TypeVar('_T_co', covariant=True) -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') -_S = TypeVar('_S') -_T1 = TypeVar('_T1') -_T2 = TypeVar('_T2') -_T3 = TypeVar('_T3') -_T4 = TypeVar('_T4') -_T5 = TypeVar('_T5') -_TT = TypeVar('_TT', bound='type') +_T = TypeVar("_T") +_T_co = TypeVar("_T_co", covariant=True) +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") +_S = TypeVar("_S") +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") +_T4 = TypeVar("_T4") +_T5 = TypeVar("_T5") +_TT = TypeVar("_TT", bound="type") class object: __doc__: Optional[str] @@ -68,7 +68,6 @@ class object: __module__: str if sys.version_info >= (3, 6): __annotations__: Dict[str, Any] - @property def __class__(self: _T) -> Type[_T]: ... @__class__.setter @@ -96,7 +95,6 @@ class staticmethod(object): # Special, only valid as a decorator. __func__: Callable if sys.version_info >= (3,): __isabstractmethod__: bool - def __init__(self, f: Callable) -> None: ... def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ... @@ -105,7 +103,6 @@ class classmethod(object): # Special, only valid as a decorator. __func__: Callable if sys.version_info >= (3,): __isabstractmethod__: bool - def __init__(self, f: Callable) -> None: ... def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ... @@ -125,7 +122,6 @@ class type(object): __qualname__: str __text_signature__: Optional[str] __weakrefoffset__: int - @overload def __init__(self, o: object) -> None: ... @overload @@ -164,7 +160,6 @@ class int: def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ... @overload def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ... - @property def real(self) -> int: ... @property @@ -174,14 +169,13 @@ class int: @property def denominator(self) -> int: ... def conjugate(self) -> int: ... - def bit_length(self) -> int: ... if sys.version_info >= (3,): def to_bytes(self, length: int, byteorder: str, *, signed: bool = ...) -> bytes: ... @classmethod - def from_bytes(cls, bytes: Sequence[int], byteorder: str, *, - signed: bool = ...) -> int: ... # TODO buffer object argument - + def from_bytes( + cls, bytes: Sequence[int], byteorder: str, *, signed: bool = ... + ) -> int: ... # TODO buffer object argument def __add__(self, x: int) -> int: ... def __sub__(self, x: int) -> int: ... def __mul__(self, x: int) -> int: ... @@ -218,14 +212,12 @@ class int: if sys.version_info >= (3,): def __round__(self, ndigits: Optional[int] = ...) -> int: ... def __getnewargs__(self) -> Tuple[int]: ... - def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... def __lt__(self, x: int) -> bool: ... def __le__(self, x: int) -> bool: ... def __gt__(self, x: int) -> bool: ... def __ge__(self, x: int) -> bool: ... - def __str__(self) -> str: ... def __float__(self) -> float: ... def __int__(self) -> int: ... @@ -244,13 +236,11 @@ class float: def is_integer(self) -> bool: ... @classmethod def fromhex(cls, s: str) -> float: ... - @property def real(self) -> float: ... @property def imag(self) -> float: ... def conjugate(self) -> float: ... - def __add__(self, x: float) -> float: ... def __sub__(self, x: float) -> float: ... def __mul__(self, x: float) -> float: ... @@ -279,7 +269,6 @@ class float: def __round__(self, ndigits: None) -> int: ... @overload def __round__(self, ndigits: int) -> float: ... - def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... def __lt__(self, x: float) -> bool: ... @@ -288,7 +277,6 @@ class float: def __ge__(self, x: float) -> bool: ... def __neg__(self) -> float: ... def __pos__(self) -> float: ... - def __str__(self) -> str: ... def __int__(self) -> int: ... def __float__(self) -> float: ... @@ -306,14 +294,11 @@ class complex: def __init__(self, s: str) -> None: ... @overload def __init__(self, s: SupportsComplex) -> None: ... - @property def real(self) -> float: ... @property def imag(self) -> float: ... - def conjugate(self) -> complex: ... - def __add__(self, x: complex) -> complex: ... def __sub__(self, x: complex) -> complex: ... def __mul__(self, x: complex) -> complex: ... @@ -328,12 +313,10 @@ class complex: if sys.version_info < (3,): def __rdiv__(self, x: complex) -> complex: ... def __rtruediv__(self, x: complex) -> complex: ... - def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... def __neg__(self) -> complex: ... def __pos__(self) -> complex: ... - def __str__(self) -> str: ... def __complex__(self) -> complex: ... def __abs__(self) -> float: ... @@ -347,7 +330,6 @@ if sys.version_info >= (3,): _str_base = object else: class basestring(metaclass=ABCMeta): ... - class unicode(basestring, Sequence[unicode]): @overload def __init__(self) -> None: ... @@ -360,8 +342,7 @@ else: def count(self, x: unicode) -> int: ... def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... - def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = ..., - end: int = ...) -> bool: ... + def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = ..., end: int = ...) -> bool: ... def expandtabs(self, tabsize: int = ...) -> unicode: ... def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def format(self, *args: Any, **kwargs: Any) -> unicode: ... @@ -391,15 +372,13 @@ else: def rstrip(self, chars: unicode = ...) -> unicode: ... def split(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ... def splitlines(self, keepends: bool = ...) -> List[unicode]: ... - def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = ..., - end: int = ...) -> bool: ... + def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = ..., end: int = ...) -> bool: ... def strip(self, chars: unicode = ...) -> unicode: ... def swapcase(self) -> unicode: ... def title(self) -> unicode: ... def translate(self, table: Union[Dict[int, Any], unicode]) -> unicode: ... def upper(self) -> unicode: ... def zfill(self, width: int) -> unicode: ... - @overload def __getitem__(self, i: int) -> unicode: ... @overload @@ -415,7 +394,6 @@ else: def __le__(self, x: unicode) -> bool: ... def __gt__(self, x: unicode) -> bool: ... def __ge__(self, x: unicode) -> bool: ... - def __len__(self) -> int: ... # The argument type is incompatible with Sequence def __contains__(self, s: Union[unicode, bytes]) -> bool: ... # type: ignore @@ -426,7 +404,6 @@ else: def __float__(self) -> float: ... def __hash__(self) -> int: ... def __getnewargs__(self) -> Tuple[unicode]: ... - _str_base = basestring class str(Sequence[str], _str_base): @@ -437,7 +414,6 @@ class str(Sequence[str], _str_base): def __init__(self, o: bytes, encoding: str = ..., errors: str = ...) -> None: ... else: def __init__(self, o: object = ...) -> None: ... - def capitalize(self) -> str: ... if sys.version_info >= (3, 3): def casefold(self) -> str: ... @@ -447,8 +423,9 @@ class str(Sequence[str], _str_base): def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ... def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ... if sys.version_info >= (3,): - def endswith(self, suffix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., - end: Optional[int] = ...) -> bool: ... + def endswith( + self, suffix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ... + ) -> bool: ... else: def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ... def expandtabs(self, tabsize: int = ...) -> str: ... @@ -524,8 +501,9 @@ class str(Sequence[str], _str_base): def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... def splitlines(self, keepends: bool = ...) -> List[str]: ... if sys.version_info >= (3,): - def startswith(self, prefix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., - end: Optional[int] = ...) -> bool: ... + def startswith( + self, prefix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ... + ) -> bool: ... def strip(self, chars: Optional[str] = ...) -> str: ... else: def startswith(self, prefix: Union[Text, Tuple[Text, ...]]) -> bool: ... @@ -548,7 +526,6 @@ class str(Sequence[str], _str_base): @staticmethod @overload def maketrans(x: str, y: str, z: str = ...) -> Dict[int, Union[int, None]]: ... - if sys.version_info >= (3,): def __add__(self, s: str) -> str: ... else: @@ -571,7 +548,6 @@ class str(Sequence[str], _str_base): def __rmul__(self, n: int) -> str: ... def __str__(self) -> str: ... def __getnewargs__(self) -> Tuple[str]: ... - if sys.version_info < (3,): def __getslice__(self, start: int, stop: int) -> str: ... def __float__(self) -> float: ... @@ -582,8 +558,7 @@ if sys.version_info >= (3,): @overload def __init__(self, ints: Iterable[int]) -> None: ... @overload - def __init__(self, string: str, encoding: str, - errors: str = ...) -> None: ... + def __init__(self, string: str, encoding: str, errors: str = ...) -> None: ... @overload def __init__(self, length: int) -> None: ... @overload @@ -624,10 +599,7 @@ if sys.version_info >= (3,): def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ... def splitlines(self, keepends: bool = ...) -> List[bytes]: ... def startswith( - self, - prefix: Union[bytes, Tuple[bytes, ...]], - start: Optional[int] = ..., - end: Optional[int] = ..., + self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ... ) -> bool: ... def strip(self, chars: Optional[bytes] = ...) -> bytes: ... def swapcase(self) -> bytes: ... @@ -639,7 +611,6 @@ if sys.version_info >= (3,): def fromhex(cls, s: str) -> bytes: ... @classmethod def maketrans(cls, frm: bytes, to: bytes) -> bytes: ... - def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ... def __str__(self) -> str: ... @@ -665,6 +636,7 @@ if sys.version_info >= (3,): def __gt__(self, x: bytes) -> bool: ... def __ge__(self, x: bytes) -> bool: ... def __getnewargs__(self) -> Tuple[bytes]: ... + else: bytes = str @@ -740,10 +712,7 @@ class bytearray(MutableSequence[int], ByteString): def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ... def splitlines(self, keepends: bool = ...) -> List[bytearray]: ... def startswith( - self, - prefix: Union[bytes, Tuple[bytes, ...]], - start: Optional[int] = ..., - end: Optional[int] = ..., + self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ... ) -> bool: ... def strip(self, chars: Optional[bytes] = ...) -> bytearray: ... def swapcase(self) -> bytearray: ... @@ -759,7 +728,6 @@ class bytearray(MutableSequence[int], ByteString): if sys.version_info >= (3,): @classmethod def maketrans(cls, frm: bytes, to: bytes) -> bytes: ... - def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ... def __str__(self) -> str: ... @@ -818,29 +786,26 @@ class memoryview(Sized, Container[_mv_container_type]): contiguous: bool def __init__(self, obj: Union[bytes, bytearray, memoryview]) -> None: ... def __enter__(self) -> memoryview: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... else: def __init__(self, obj: Union[bytes, bytearray, buffer, memoryview]) -> None: ... - @overload def __getitem__(self, i: int) -> _mv_container_type: ... @overload def __getitem__(self, s: slice) -> memoryview: ... - def __contains__(self, x: object) -> bool: ... def __iter__(self) -> Iterator[_mv_container_type]: ... def __len__(self) -> int: ... - @overload def __setitem__(self, i: int, o: bytes) -> None: ... @overload def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ... @overload def __setitem__(self, s: slice, o: memoryview) -> None: ... - def tobytes(self) -> bytes: ... def tolist(self) -> List[int]: ... - if sys.version_info >= (3, 5): def hex(self) -> str: ... @@ -933,7 +898,6 @@ class list(MutableSequence[_T], Generic[_T]): def sort(self, *, key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...) -> None: ... else: def sort(self, cmp: Callable[[_T, _T], Any] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ...) -> None: ... - def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... def __str__(self) -> str: ... @@ -973,9 +937,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __init__(self, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... - if sys.version_info < (3,): def has_key(self, k: _KT) -> bool: ... def clear(self) -> None: ... @@ -1099,6 +1061,7 @@ if sys.version_info >= (3,): def __getitem__(self, s: slice) -> range: ... def __repr__(self) -> str: ... def __reversed__(self) -> Iterator[int]: ... + else: class xrange(Sized, Iterable[int], Reversible[int]): @overload @@ -1111,10 +1074,13 @@ else: def __reversed__(self) -> Iterator[int]: ... class property(object): - def __init__(self, fget: Optional[Callable[[Any], Any]] = ..., - fset: Optional[Callable[[Any, Any], None]] = ..., - fdel: Optional[Callable[[Any], None]] = ..., - doc: Optional[str] = ...) -> None: ... + def __init__( + self, + fget: Optional[Callable[[Any], Any]] = ..., + fset: Optional[Callable[[Any, Any], None]] = ..., + fdel: Optional[Callable[[Any], None]] = ..., + doc: Optional[str] = ..., + ) -> None: ... def getter(self, fget: Callable[[Any], Any]) -> property: ... def setter(self, fset: Callable[[Any, Any], None]) -> property: ... def deleter(self, fdel: Callable[[Any], None]) -> property: ... @@ -1133,82 +1099,133 @@ NotImplemented: Any def abs(__n: SupportsAbs[_T]) -> _T: ... def all(__i: Iterable[object]) -> bool: ... def any(__i: Iterable[object]) -> bool: ... + if sys.version_info < (3,): - def apply(__func: Callable[..., _T], __args: Optional[Sequence[Any]] = ..., __kwds: Optional[Mapping[str, Any]] = ...) -> _T: ... + def apply( + __func: Callable[..., _T], __args: Optional[Sequence[Any]] = ..., __kwds: Optional[Mapping[str, Any]] = ... + ) -> _T: ... + if sys.version_info >= (3,): def ascii(__o: object) -> str: ... class _SupportsIndex(Protocol): def __index__(self) -> int: ... + def bin(__number: Union[int, _SupportsIndex]) -> str: ... if sys.version_info >= (3, 7): def breakpoint(*args: Any, **kws: Any) -> None: ... + def callable(__o: object) -> bool: ... def chr(__code: int) -> str: ... + if sys.version_info < (3,): def cmp(__x: Any, __y: Any) -> int: ... - _N1 = TypeVar('_N1', bool, int, float, complex) + _N1 = TypeVar("_N1", bool, int, float, complex) def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ... + if sys.version_info >= (3, 6): # This class is to be exported as PathLike from os, # but we define it here as _PathLike to avoid import cycle issues. # See https://github.com/python/typeshed/pull/991#issuecomment-288160993 class _PathLike(Generic[AnyStr]): def __fspath__(self) -> AnyStr: ... - def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ... + def compile( + source: Union[str, bytes, mod, AST], + filename: Union[str, bytes, _PathLike], + mode: str, + flags: int = ..., + dont_inherit: int = ..., + optimize: int = ..., + ) -> Any: ... + elif sys.version_info >= (3,): - def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ... + def compile( + source: Union[str, bytes, mod, AST], + filename: Union[str, bytes], + mode: str, + flags: int = ..., + dont_inherit: int = ..., + optimize: int = ..., + ) -> Any: ... + else: def compile(source: Union[Text, mod], filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ... + if sys.version_info >= (3,): def copyright() -> None: ... def credits() -> None: ... + def delattr(__o: Any, __name: Text) -> None: ... def dir(__o: object = ...) -> List[str]: ... -_N2 = TypeVar('_N2', int, float) + +_N2 = TypeVar("_N2", int, float) + def divmod(__a: _N2, __b: _N2) -> Tuple[_N2, _N2]: ... -def eval(__source: Union[Text, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...) -> Any: ... +def eval( + __source: Union[Text, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ... +) -> Any: ... + if sys.version_info >= (3,): - def exec(__object: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...) -> Any: ... + def exec( + __object: Union[str, bytes, CodeType], + __globals: Optional[Dict[str, Any]] = ..., + __locals: Optional[Mapping[str, Any]] = ..., + ) -> Any: ... + else: - def execfile(__filename: str, __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Dict[str, Any]] = ...) -> None: ... + def execfile( + __filename: str, __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Dict[str, Any]] = ... + ) -> None: ... + def exit(code: object = ...) -> NoReturn: ... + if sys.version_info >= (3,): @overload def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ... @overload def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ... + else: @overload - def filter(__function: Callable[[AnyStr], Any], # type: ignore - __iterable: AnyStr) -> AnyStr: ... + def filter( + __function: Callable[[AnyStr], Any], # type: ignore + __iterable: AnyStr, + ) -> AnyStr: ... @overload - def filter(__function: None, # type: ignore - __iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ... + def filter( + __function: None, # type: ignore + __iterable: Tuple[Optional[_T], ...], + ) -> Tuple[_T, ...]: ... @overload - def filter(__function: Callable[[_T], Any], # type: ignore - __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... + def filter( + __function: Callable[[_T], Any], # type: ignore + __iterable: Tuple[_T, ...], + ) -> Tuple[_T, ...]: ... @overload - def filter(__function: None, - __iterable: Iterable[Optional[_T]]) -> List[_T]: ... + def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> List[_T]: ... @overload - def filter(__function: Callable[[_T], Any], - __iterable: Iterable[_T]) -> List[_T]: ... + def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ... + def format(__o: object, __format_spec: str = ...) -> str: ... # TODO unicode def getattr(__o: Any, name: Text, __default: Any = ...) -> Any: ... def globals() -> Dict[str, Any]: ... def hasattr(__o: Any, __name: Text) -> bool: ... def hash(__o: object) -> int: ... + if sys.version_info >= (3,): def help(*args: Any, **kwds: Any) -> None: ... + def hex(__i: Union[int, _SupportsIndex]) -> str: ... def id(__o: object) -> int: ... + if sys.version_info >= (3,): def input(__prompt: Any = ...) -> str: ... + else: def input(__prompt: Any = ...) -> Any: ... def intern(__string: str) -> str: ... + @overload def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... @overload @@ -1216,109 +1233,120 @@ def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ... def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ... def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ... def len(__o: Sized) -> int: ... + if sys.version_info >= (3,): def license() -> None: ... + def locals() -> Dict[str, Any]: ... + if sys.version_info >= (3,): @overload def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> Iterator[_S]: ... @overload - def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], - __iter2: Iterable[_T2]) -> Iterator[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> Iterator[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3, _T4], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> Iterator[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5]) -> Iterator[_S]: ... - @overload - def map(__func: Callable[..., _S], - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> Iterator[_S]: ... + def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] + ) -> Iterator[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3, _T4], _S], + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + ) -> Iterator[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + __iter5: Iterable[_T5], + ) -> Iterator[_S]: ... + @overload + def map( + __func: Callable[..., _S], + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> Iterator[_S]: ... + else: @overload def map(__func: None, __iter1: Iterable[_T1]) -> List[_T1]: ... @overload - def map(__func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... - @overload - def map(__func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... - @overload - def map(__func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... - @overload - def map(__func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... - @overload - def map(__func: None, - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ... + def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... + @overload + def map( + __func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] + ) -> List[Tuple[_T1, _T2, _T3]]: ... + @overload + def map( + __func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] + ) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... + @overload + def map( + __func: None, + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + __iter5: Iterable[_T5], + ) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + @overload + def map( + __func: None, + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> List[Tuple[Any, ...]]: ... @overload def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> List[_S]: ... @overload - def map(__func: Callable[[_T1, _T2], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2]) -> List[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> List[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3, _T4], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> List[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5]) -> List[_S]: ... - @overload - def map(__func: Callable[..., _S], - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> List[_S]: ... + def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] + ) -> List[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3, _T4], _S], + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + ) -> List[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + __iter5: Iterable[_T5], + ) -> List[_S]: ... + @overload + def map( + __func: Callable[..., _S], + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> List[_S]: ... + if sys.version_info >= (3,): @overload def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @@ -1326,11 +1354,13 @@ if sys.version_info >= (3,): def max(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... @overload def max(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ..., default: _VT) -> Union[_T, _VT]: ... + else: @overload def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @overload def max(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... + if sys.version_info >= (3,): @overload def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @@ -1338,11 +1368,13 @@ if sys.version_info >= (3,): def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... @overload def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ..., default: _VT) -> Union[_T, _VT]: ... + else: @overload def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @overload def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... + @overload def next(__i: Iterator[_T]) -> _T: ... @overload @@ -1350,26 +1382,45 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ... def oct(__i: Union[int, _SupportsIndex]) -> str: ... if sys.version_info >= (3, 6): - def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., - opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... + def open( + file: Union[str, bytes, int, _PathLike], + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ..., + closefd: bool = ..., + opener: Optional[Callable[[str, int], int]] = ..., + ) -> IO[Any]: ... + elif sys.version_info >= (3,): - def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., - opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... + def open( + file: Union[str, bytes, int], + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ..., + closefd: bool = ..., + opener: Optional[Callable[[str, int], int]] = ..., + ) -> IO[Any]: ... + else: def open(name: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ... def ord(__c: Union[Text, bytes]) -> int: ... + if sys.version_info >= (3,): class _Writer(Protocol): def write(self, __s: str) -> Any: ... def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ..., flush: bool = ...) -> None: ... + else: class _Writer(Protocol): def write(self, __s: Any) -> Any: ... # This is only available after from __future__ import print_function. def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ...) -> None: ... + @overload def pow(__x: int, __y: int) -> Any: ... # The return type can be int or float, depending on y @overload @@ -1379,6 +1430,7 @@ def pow(__x: float, __y: float) -> float: ... @overload def pow(__x: float, __y: float, __z: float) -> float: ... def quit(code: object = ...) -> NoReturn: ... + if sys.version_info < (3,): def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... def raw_input(__prompt: Any = ...) -> str: ... @@ -1387,11 +1439,13 @@ if sys.version_info < (3,): @overload def reduce(__function: Callable[[_T, _T], _T], __iterable: Iterable[_T]) -> _T: ... def reload(__module: Any) -> Any: ... + @overload def reversed(__object: Sequence[_T]) -> Iterator[_T]: ... @overload def reversed(__object: Reversible[_T]) -> Iterator[_T]: ... def repr(__o: object) -> str: ... + if sys.version_info >= (3,): @overload def round(number: float) -> int: ... @@ -1405,6 +1459,7 @@ if sys.version_info >= (3,): def round(number: SupportsRound[_T], ndigits: None) -> int: ... # type: ignore @overload def round(number: SupportsRound[_T], ndigits: int) -> _T: ... + else: @overload def round(number: float) -> float: ... @@ -1414,72 +1469,92 @@ else: def round(number: SupportsFloat) -> float: ... @overload def round(number: SupportsFloat, ndigits: int) -> float: ... + def setattr(__object: Any, __name: Text, __value: Any) -> None: ... + if sys.version_info >= (3,): - def sorted(__iterable: Iterable[_T], *, - key: Optional[Callable[[_T], Any]] = ..., - reverse: bool = ...) -> List[_T]: ... + def sorted(__iterable: Iterable[_T], *, key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...) -> List[_T]: ... + else: - def sorted(__iterable: Iterable[_T], *, - cmp: Callable[[_T, _T], int] = ..., - key: Callable[[_T], Any] = ..., - reverse: bool = ...) -> List[_T]: ... + def sorted( + __iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ... + ) -> List[_T]: ... + @overload def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ... @overload def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ... + if sys.version_info < (3,): def unichr(__i: int) -> unicode: ... + def vars(__object: Any = ...) -> Dict[str, Any]: ... + if sys.version_info >= (3,): @overload def zip(__iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... @overload def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... + def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... + def zip( + __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] + ) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], - __iter4: Iterable[_T4], __iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + def zip( + __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] + ) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload - def zip(__iter1: Iterable[Any], __iter2: Iterable[Any], __iter3: Iterable[Any], - __iter4: Iterable[Any], __iter5: Iterable[Any], __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ... + def zip( + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> Iterator[Tuple[Any, ...]]: ... + else: @overload def zip(__iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ... @overload - def zip(__iter1: Iterable[_T1], - __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... + def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... + def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... + def zip( + __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] + ) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], - __iter4: Iterable[_T4], __iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + def zip( + __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] + ) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload - def zip(__iter1: Iterable[Any], __iter2: Iterable[Any], __iter3: Iterable[Any], - __iter4: Iterable[Any], __iter5: Iterable[Any], __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ... -def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ..., - fromlist: List[str] = ..., level: int = ...) -> Any: ... + def zip( + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> List[Tuple[Any, ...]]: ... + +def __import__( + name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ..., fromlist: List[str] = ..., level: int = ... +) -> Any: ... # Actually the type of Ellipsis is , but since it's # not exposed anywhere under that name, we make it private here. class ellipsis: ... + Ellipsis: ellipsis if sys.version_info < (3,): # TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check. - _AnyBuffer = TypeVar('_AnyBuffer', str, unicode, bytearray, buffer) - + _AnyBuffer = TypeVar("_AnyBuffer", str, unicode, bytearray, buffer) class buffer(Sized): def __init__(self, object: _AnyBuffer, offset: int = ..., size: int = ...) -> None: ... def __add__(self, other: _AnyBuffer) -> str: ... @@ -1507,12 +1582,16 @@ class BaseException(object): class GeneratorExit(BaseException): ... class KeyboardInterrupt(BaseException): ... + class SystemExit(BaseException): code: int + class Exception(BaseException): ... + class StopIteration(Exception): if sys.version_info >= (3,): value: Any + if sys.version_info >= (3,): _StandardError = Exception class OSError(Exception): @@ -1539,28 +1618,32 @@ class AssertionError(_StandardError): ... class AttributeError(_StandardError): ... class BufferError(_StandardError): ... class EOFError(_StandardError): ... + class ImportError(_StandardError): if sys.version_info >= (3,): name: str path: str + class LookupError(_StandardError): ... class MemoryError(_StandardError): ... class NameError(_StandardError): ... class ReferenceError(_StandardError): ... class RuntimeError(_StandardError): ... + if sys.version_info >= (3, 5): class StopAsyncIteration(Exception): value: Any + class SyntaxError(_StandardError): msg: str lineno: int offset: Optional[int] text: str filename: str + class SystemError(_StandardError): ... class TypeError(_StandardError): ... class ValueError(_StandardError): ... - class FloatingPointError(ArithmeticError): ... class OverflowError(ArithmeticError): ... class ZeroDivisionError(ArithmeticError): ... @@ -1570,11 +1653,11 @@ if sys.version_info >= (3, 6): class IndexError(LookupError): ... class KeyError(LookupError): ... - class UnboundLocalError(NameError): ... class WindowsError(OSError): winerror: int + if sys.version_info >= (3,): class BlockingIOError(OSError): characters_written: int @@ -1594,31 +1677,31 @@ if sys.version_info >= (3,): class TimeoutError(OSError): ... class NotImplementedError(RuntimeError): ... + if sys.version_info >= (3, 5): class RecursionError(RuntimeError): ... class IndentationError(SyntaxError): ... class TabError(IndentationError): ... - class UnicodeError(ValueError): ... + class UnicodeDecodeError(UnicodeError): encoding: str object: bytes start: int end: int reason: str - def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, - __reason: str) -> None: ... + def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, __reason: str) -> None: ... + class UnicodeEncodeError(UnicodeError): encoding: str object: Text start: int end: int reason: str - def __init__(self, __encoding: str, __object: Text, __start: int, __end: int, - __reason: str) -> None: ... -class UnicodeTranslateError(UnicodeError): ... + def __init__(self, __encoding: str, __object: Text, __start: int, __end: int, __reason: str) -> None: ... +class UnicodeTranslateError(UnicodeError): ... class Warning(Exception): ... class UserWarning(Warning): ... class DeprecationWarning(Warning): ... @@ -1629,6 +1712,7 @@ class PendingDeprecationWarning(Warning): ... class ImportWarning(Warning): ... class UnicodeWarning(Warning): ... class BytesWarning(Warning): ... + if sys.version_info >= (3, 2): class ResourceWarning(Warning): ... @@ -1649,7 +1733,6 @@ if sys.version_info < (3,): def fileno(self) -> int: ... def isatty(self) -> bool: ... def close(self) -> None: ... - def readable(self) -> bool: ... def writable(self) -> bool: ... def seekable(self) -> bool: ... diff --git a/stdlib/2/_ast.pyi b/stdlib/2/_ast.pyi index c461bb412805..4ca7def60b04 100644 --- a/stdlib/2/_ast.pyi +++ b/stdlib/2/_ast.pyi @@ -10,8 +10,7 @@ class AST: _fields: typing.Tuple[str, ...] def __init__(self, *args, **kwargs) -> None: ... -class mod(AST): - ... +class mod(AST): ... class Module(mod): body: typing.List[stmt] @@ -25,7 +24,6 @@ class Expression(mod): class Suite(mod): body: typing.List[stmt] - class stmt(AST): lineno: int col_offset: int @@ -123,10 +121,7 @@ class Expr(stmt): class Pass(stmt): ... class Break(stmt): ... class Continue(stmt): ... - - -class slice(AST): - ... +class slice(AST): ... _slice = slice # this lets us type the variable named 'slice' below @@ -143,7 +138,6 @@ class Index(slice): class Ellipsis(slice): ... - class expr(AST): lineno: int col_offset: int @@ -240,27 +234,17 @@ class Tuple(expr): elts: typing.List[expr] ctx: expr_context - -class expr_context(AST): - ... - +class expr_context(AST): ... class AugLoad(expr_context): ... class AugStore(expr_context): ... class Del(expr_context): ... class Load(expr_context): ... class Param(expr_context): ... class Store(expr_context): ... - - -class boolop(AST): - ... - +class boolop(AST): ... class And(boolop): ... class Or(boolop): ... - -class operator(AST): - ... - +class operator(AST): ... class Add(operator): ... class BitAnd(operator): ... class BitOr(operator): ... @@ -273,18 +257,12 @@ class Mult(operator): ... class Pow(operator): ... class RShift(operator): ... class Sub(operator): ... - -class unaryop(AST): - ... - +class unaryop(AST): ... class Invert(unaryop): ... class Not(unaryop): ... class UAdd(unaryop): ... class USub(unaryop): ... - -class cmpop(AST): - ... - +class cmpop(AST): ... class Eq(cmpop): ... class Gt(cmpop): ... class GtE(cmpop): ... @@ -296,16 +274,12 @@ class LtE(cmpop): ... class NotEq(cmpop): ... class NotIn(cmpop): ... - class comprehension(AST): target: expr iter: expr ifs: typing.List[expr] - -class excepthandler(AST): - ... - +class excepthandler(AST): ... class ExceptHandler(excepthandler): type: Optional[expr] @@ -314,7 +288,6 @@ class ExceptHandler(excepthandler): lineno: int col_offset: int - class arguments(AST): args: typing.List[expr] vararg: Optional[_identifier] diff --git a/stdlib/2/_collections.pyi b/stdlib/2/_collections.pyi index c0b7e743e787..332585c518d9 100644 --- a/stdlib/2/_collections.pyi +++ b/stdlib/2/_collections.pyi @@ -10,8 +10,8 @@ class defaultdict(dict): def __copy__(self) -> defaultdict: ... def copy(self) -> defaultdict: ... -_T = TypeVar('_T') -_T2 = TypeVar('_T2') +_T = TypeVar("_T") +_T2 = TypeVar("_T2") class deque(Generic[_T]): maxlen: Optional[int] diff --git a/stdlib/2/_functools.pyi b/stdlib/2/_functools.pyi index 3972b671ddbe..4d430fa36fa1 100644 --- a/stdlib/2/_functools.pyi +++ b/stdlib/2/_functools.pyi @@ -8,14 +8,10 @@ _T3 = TypeVar("_T3") _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") _S = TypeVar("_S") - @overload -def reduce(function: Callable[[_T, _T], _T], - sequence: Iterable[_T]) -> _T: ... +def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ... @overload -def reduce(function: Callable[[_T, _S], _T], - sequence: Iterable[_S], initial: _T) -> _T: ... - +def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ... @overload def partial(__func: Callable[[_T], _S], __arg: _T) -> Callable[[], _S]: ... @overload @@ -26,62 +22,29 @@ def partial(__func: Callable[[_T, _T2, _T3], _S], __arg: _T) -> Callable[[_T2, _ def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg: _T) -> Callable[[_T2, _T3, _T4], _S]: ... @overload def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg: _T) -> Callable[[_T2, _T3, _T4, _T5], _S]: ... - @overload -def partial(__func: Callable[[_T, _T2], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[], _S]: ... +def partial(__func: Callable[[_T, _T2], _S], __arg1: _T, __arg2: _T2) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3, _T4], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3, _T4], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[_T4], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[_T4], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[_T4, _T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[_T4, _T5], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4) -> Callable[[], _S]: ... -@overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4) -> Callable[[_T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4, - __arg5: _T5) -> Callable[[], _S]: ... - +def partial( + __func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4 +) -> Callable[[_T5], _S]: ... +@overload +def partial( + __func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4, __arg5: _T5 +) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[..., _S], - *args: Any, - **kwargs: Any) -> Callable[..., _S]: ... +def partial(__func: Callable[..., _S], *args: Any, **kwargs: Any) -> Callable[..., _S]: ... diff --git a/stdlib/2/_hotshot.pyi b/stdlib/2/_hotshot.pyi index 6501126a6ba0..f2a25c6bcc91 100644 --- a/stdlib/2/_hotshot.pyi +++ b/stdlib/2/_hotshot.pyi @@ -6,7 +6,6 @@ from typing import Any, Dict, Generic, List, Tuple def coverage(a: str) -> Any: ... - def logreader(a: str) -> LogReaderType: raise IOError() raise RuntimeError() @@ -16,7 +15,6 @@ def profiler(a: str, *args, **kwargs) -> Any: def resolution() -> tuple: ... - class LogReaderType(object): def close(self) -> None: ... def fileno(self) -> int: diff --git a/stdlib/2/_io.pyi b/stdlib/2/_io.pyi index 109245dd9d20..eaaad5b93019 100644 --- a/stdlib/2/_io.pyi +++ b/stdlib/2/_io.pyi @@ -53,8 +53,7 @@ class _BufferedIOBase(_IOBase): def detach(self) -> _IOBase: ... class BufferedRWPair(_BufferedIOBase): - def __init__(self, reader: _RawIOBase, writer: _RawIOBase, - buffer_size: int = ..., max_buffer_size: int = ...) -> None: ... + def __init__(self, reader: _RawIOBase, writer: _RawIOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ... def peek(self, n: int = ...) -> bytes: ... def __enter__(self) -> BufferedRWPair: ... @@ -62,9 +61,7 @@ class BufferedRandom(_BufferedIOBase): mode: str name: str raw: _IOBase - def __init__(self, raw: _IOBase, - buffer_size: int = ..., - max_buffer_size: int = ...) -> None: ... + def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ... def peek(self, n: int = ...) -> bytes: ... class BufferedReader(_BufferedIOBase): @@ -78,9 +75,7 @@ class BufferedWriter(_BufferedIOBase): name: str raw: _IOBase mode: str - def __init__(self, raw: _IOBase, - buffer_size: int = ..., - max_buffer_size: int = ...) -> None: ... + def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ... class BytesIO(_BufferedIOBase): def __init__(self, initial_bytes: bytes = ...) -> None: ... @@ -115,7 +110,6 @@ class IncrementalNewlineDecoder(object): def setstate(self, state: Tuple[Any, int]) -> None: ... def reset(self) -> None: ... - # Note: In the actual _io.py, _TextIOBase inherits from _IOBase. class _TextIOBase(TextIO): errors: Optional[str] @@ -151,9 +145,7 @@ class _TextIOBase(TextIO): class StringIO(_TextIOBase): line_buffering: bool - def __init__(self, - initial_value: Optional[unicode] = ..., - newline: Optional[unicode] = ...) -> None: ... + def __init__(self, initial_value: Optional[unicode] = ..., newline: Optional[unicode] = ...) -> None: ... def __setstate__(self, state: tuple) -> None: ... def __getstate__(self) -> tuple: ... # StringIO does not contain a "name" field. This workaround is necessary @@ -167,17 +159,22 @@ class TextIOWrapper(_TextIOBase): line_buffering: bool buffer: BinaryIO _CHUNK_SIZE: int - def __init__(self, buffer: IO, - encoding: Optional[Text] = ..., - errors: Optional[Text] = ..., - newline: Optional[Text] = ..., - line_buffering: bool = ..., - write_through: bool = ...) -> None: ... - -def open(file: Union[str, unicode, int], - mode: Text = ..., - buffering: int = ..., - encoding: Optional[Text] = ..., - errors: Optional[Text] = ..., - newline: Optional[Text] = ..., - closefd: bool = ...) -> IO[Any]: ... + def __init__( + self, + buffer: IO, + encoding: Optional[Text] = ..., + errors: Optional[Text] = ..., + newline: Optional[Text] = ..., + line_buffering: bool = ..., + write_through: bool = ..., + ) -> None: ... + +def open( + file: Union[str, unicode, int], + mode: Text = ..., + buffering: int = ..., + encoding: Optional[Text] = ..., + errors: Optional[Text] = ..., + newline: Optional[Text] = ..., + closefd: bool = ..., +) -> IO[Any]: ... diff --git a/stdlib/2/_json.pyi b/stdlib/2/_json.pyi index 5bdd5c079469..a142d124de79 100644 --- a/stdlib/2/_json.pyi +++ b/stdlib/2/_json.pyi @@ -11,7 +11,5 @@ def encode_basestring_ascii(*args, **kwargs) -> str: def scanstring(a, b, *args, **kwargs) -> tuple: raise TypeError() - class Encoder(object): ... - class Scanner(object): ... diff --git a/stdlib/2/_socket.pyi b/stdlib/2/_socket.pyi index fc592bacb64c..2338abe77e89 100644 --- a/stdlib/2/_socket.pyi +++ b/stdlib/2/_socket.pyi @@ -251,7 +251,6 @@ class SocketType(object): type: int proto: int timeout: float - def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ... def accept(self) -> Tuple[SocketType, tuple]: ... def bind(self, address: tuple) -> None: ... @@ -273,8 +272,7 @@ class SocketType(object): def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ... def recvfrom(self, buffersize: int, flags: int = ...) -> tuple: raise error - def recvfrom_into(self, buffer: bytearray, nbytes: int = ..., - flags: int = ...) -> int: ... + def recvfrom_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ... def send(self, data: str, flags: int = ...) -> int: ... def sendall(self, data: str, flags: int = ...) -> None: ... @overload diff --git a/stdlib/2/_sre.pyi b/stdlib/2/_sre.pyi index 9af908b75166..36873faa62bf 100644 --- a/stdlib/2/_sre.pyi +++ b/stdlib/2/_sre.pyi @@ -42,12 +42,15 @@ class SRE_Pattern(object): def sub(self, repl: str, string: str, count: int = ...) -> tuple: ... def subn(self, repl: str, string: str, count: int = ...) -> tuple: ... -def compile(pattern: str, flags: int, code: List[int], - groups: int = ..., - groupindex: Mapping[str, int] = ..., - indexgroup: Sequence[int] = ...) -> SRE_Pattern: +def compile( + pattern: str, + flags: int, + code: List[int], + groups: int = ..., + groupindex: Mapping[str, int] = ..., + indexgroup: Sequence[int] = ..., +) -> SRE_Pattern: raise OverflowError() def getcodesize() -> int: ... - def getlower(a: int, b: int) -> int: ... diff --git a/stdlib/2/_struct.pyi b/stdlib/2/_struct.pyi index 49f44f2c58a3..263a9fcd954d 100644 --- a/stdlib/2/_struct.pyi +++ b/stdlib/2/_struct.pyi @@ -7,7 +7,6 @@ class error(Exception): ... class Struct(object): size: int format: str - def __init__(self, fmt: str) -> None: ... def pack_into(self, buffer: bytearray, offset: int, obj: Any) -> None: ... def pack(self, *args) -> str: ... diff --git a/stdlib/2/_symtable.pyi b/stdlib/2/_symtable.pyi index be332958e556..5b2370449c31 100644 --- a/stdlib/2/_symtable.pyi +++ b/stdlib/2/_symtable.pyi @@ -22,8 +22,7 @@ TYPE_FUNCTION: int TYPE_MODULE: int USE: int -class _symtable_entry(object): - ... +class _symtable_entry(object): ... class symtable(object): children: List[_symtable_entry] @@ -35,5 +34,4 @@ class symtable(object): symbols: Dict[str, int] type: int varnames: List[str] - def __init__(self, src: str, filename: str, startstr: str) -> None: ... diff --git a/stdlib/2/_warnings.pyi b/stdlib/2/_warnings.pyi index 9609faa4ec1d..fcac66252dad 100644 --- a/stdlib/2/_warnings.pyi +++ b/stdlib/2/_warnings.pyi @@ -5,7 +5,12 @@ filters: List[tuple] once_registry: dict def warn(message: Warning, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ... -def warn_explicit(message: Warning, category: Optional[Type[Warning]], - filename: str, lineno: int, - module: Any = ..., registry: dict = ..., - module_globals: dict = ...) -> None: ... +def warn_explicit( + message: Warning, + category: Optional[Type[Warning]], + filename: str, + lineno: int, + module: Any = ..., + registry: dict = ..., + module_globals: dict = ..., +) -> None: ... diff --git a/stdlib/2/ast.pyi b/stdlib/2/ast.pyi index c5ffd65562b9..a8432dd85978 100644 --- a/stdlib/2/ast.pyi +++ b/stdlib/2/ast.pyi @@ -20,7 +20,7 @@ def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ... def literal_eval(node_or_string: Union[str, unicode, AST]) -> Any: ... def walk(node: AST) -> Iterator[AST]: ... -class NodeVisitor(): +class NodeVisitor: def visit(self, node: AST) -> Any: ... def generic_visit(self, node: AST) -> Any: ... diff --git a/stdlib/2/atexit.pyi b/stdlib/2/atexit.pyi index 30a777912337..2336bf91149e 100644 --- a/stdlib/2/atexit.pyi +++ b/stdlib/2/atexit.pyi @@ -1,5 +1,5 @@ from typing import Any, TypeVar -_FT = TypeVar('_FT') +_FT = TypeVar("_FT") def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ... diff --git a/stdlib/2/cPickle.pyi b/stdlib/2/cPickle.pyi index 2bb9e83c09df..d8db140cdda1 100644 --- a/stdlib/2/cPickle.pyi +++ b/stdlib/2/cPickle.pyi @@ -6,20 +6,14 @@ format_version: str class Pickler: def __init__(self, file: IO[str], protocol: int = ...) -> None: ... - def dump(self, obj: Any) -> None: ... - def clear_memo(self) -> None: ... - class Unpickler: def __init__(self, file: IO[str]) -> None: ... - def load(self) -> Any: ... - def noload(self) -> Any: ... - def dump(obj: Any, file: IO[str], protocol: int = ...) -> None: ... def dumps(obj: Any, protocol: int = ...) -> str: ... def load(file: IO[str]) -> Any: ... diff --git a/stdlib/2/cStringIO.pyi b/stdlib/2/cStringIO.pyi index fbf9d2a55dea..f0358283a315 100644 --- a/stdlib/2/cStringIO.pyi +++ b/stdlib/2/cStringIO.pyi @@ -26,7 +26,6 @@ class InputType(IO[str], Iterator[str], metaclass=ABCMeta): def next(self) -> str: ... def reset(self) -> None: ... - class OutputType(IO[str], Iterator[str], metaclass=ABCMeta): @property def softspace(self) -> int: ... diff --git a/stdlib/2/collections.pyi b/stdlib/2/collections.pyi index a85162b4a005..114e16c1e106 100644 --- a/stdlib/2/collections.pyi +++ b/stdlib/2/collections.pyi @@ -22,18 +22,21 @@ from typing import Tuple, Type, TypeVar, Union from typing import ValuesView as ValuesView from typing import overload -_S = TypeVar('_S') -_T = TypeVar('_T') -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') +_S = TypeVar("_S") +_T = TypeVar("_T") +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") # namedtuple is special-cased in the type checker; the initializer is ignored. -def namedtuple(typename: Union[str, unicode], field_names: Union[str, unicode, Iterable[Union[str, unicode]]], - verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ... +def namedtuple( + typename: Union[str, unicode], + field_names: Union[str, unicode, Iterable[Union[str, unicode]]], + verbose: bool = ..., + rename: bool = ..., +) -> Type[tuple]: ... class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]): - def __init__(self, iterable: Iterable[_T] = ..., - maxlen: int = ...) -> None: ... + def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ... @property def maxlen(self) -> Optional[int]: ... def append(self, x: _T) -> None: ... @@ -57,7 +60,7 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]): def __reversed__(self) -> Iterator[_T]: ... def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ... -_CounterT = TypeVar('_CounterT', bound=Counter) +_CounterT = TypeVar("_CounterT", bound=Counter) class Counter(Dict[_T, int], Generic[_T]): @overload @@ -84,7 +87,6 @@ class Counter(Dict[_T, int], Generic[_T]): def update(self, __m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ... @overload def update(self, **kwargs: int) -> None: ... - def __add__(self, other: Counter[_T]) -> Counter[_T]: ... def __sub__(self, other: Counter[_T]) -> Counter[_T]: ... def __and__(self, other: Counter[_T]) -> Counter[_T]: ... @@ -94,14 +96,14 @@ class Counter(Dict[_T, int], Generic[_T]): def __iand__(self, other: Counter[_T]) -> Counter[_T]: ... def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... -_OrderedDictT = TypeVar('_OrderedDictT', bound=OrderedDict) +_OrderedDictT = TypeVar("_OrderedDictT", bound=OrderedDict) class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ... def copy(self: _OrderedDictT) -> _OrderedDictT: ... def __reversed__(self) -> Iterator[_KT]: ... -_DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict) +_DefaultDictT = TypeVar("_DefaultDictT", bound=defaultdict) class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): default_factory: Callable[[], _VT] @@ -112,16 +114,14 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): @overload def __init__(self, default_factory: Optional[Callable[[], _VT]], **kwargs: _VT) -> None: ... @overload - def __init__(self, default_factory: Optional[Callable[[], _VT]], - map: Mapping[_KT, _VT]) -> None: ... + def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT]) -> None: ... @overload - def __init__(self, default_factory: Optional[Callable[[], _VT]], - map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... + def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, default_factory: Optional[Callable[[], _VT]], - iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... + def __init__(self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... @overload - def __init__(self, default_factory: Optional[Callable[[], _VT]], - iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def __init__( + self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT + ) -> None: ... def __missing__(self, key: _KT) -> _VT: ... def copy(self: _DefaultDictT) -> _DefaultDictT: ... diff --git a/stdlib/2/commands.pyi b/stdlib/2/commands.pyi index 969bf258aea2..970d6ccf2032 100644 --- a/stdlib/2/commands.pyi +++ b/stdlib/2/commands.pyi @@ -3,10 +3,8 @@ from typing import AnyStr, Text, Tuple, overload def getstatus(file: Text) -> str: ... def getoutput(cmd: Text) -> str: ... def getstatusoutput(cmd: Text) -> Tuple[int, str]: ... - @overload def mk2arg(head: bytes, x: bytes) -> bytes: ... @overload def mk2arg(head: Text, x: Text) -> Text: ... - def mkarg(x: AnyStr) -> AnyStr: ... diff --git a/stdlib/2/compileall.pyi b/stdlib/2/compileall.pyi index c3e861e1e99d..14e80310bdec 100644 --- a/stdlib/2/compileall.pyi +++ b/stdlib/2/compileall.pyi @@ -5,6 +5,15 @@ from typing import Optional, Pattern, Union _Path = Union[str, bytes] # rx can be any object with a 'search' method; once we have Protocols we can change the type -def compile_dir(dir: _Path, maxlevels: int = ..., ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> int: ... -def compile_file(fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> int: ... +def compile_dir( + dir: _Path, + maxlevels: int = ..., + ddir: Optional[_Path] = ..., + force: bool = ..., + rx: Optional[Pattern] = ..., + quiet: int = ..., +) -> int: ... +def compile_file( + fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ... +) -> int: ... def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ... diff --git a/stdlib/2/cookielib.pyi b/stdlib/2/cookielib.pyi index abbf29894635..7405ba91c0ff 100644 --- a/stdlib/2/cookielib.pyi +++ b/stdlib/2/cookielib.pyi @@ -17,8 +17,26 @@ class Cookie: comment: Any comment_url: Any rfc2109: Any - def __init__(self, version, name, value, port, port_specified, domain, domain_specified, domain_initial_dot, path, - path_specified, secure, expires, discard, comment, comment_url, rest, rfc2109: bool = ...): ... + def __init__( + self, + version, + name, + value, + port, + port_specified, + domain, + domain_specified, + domain_initial_dot, + path, + path_specified, + secure, + expires, + discard, + comment, + comment_url, + rest, + rfc2109: bool = ..., + ): ... def has_nonstandard_attr(self, name): ... def get_nonstandard_attr(self, name, default: Optional[Any] = ...): ... def set_nonstandard_attr(self, name, value): ... @@ -46,10 +64,21 @@ class DefaultCookiePolicy(CookiePolicy): strict_ns_domain: Any strict_ns_set_initial_dollar: Any strict_ns_set_path: Any - def __init__(self, blocked_domains: Optional[Any] = ..., allowed_domains: Optional[Any] = ..., netscape: bool = ..., - rfc2965: bool = ..., rfc2109_as_netscape: Optional[Any] = ..., hide_cookie2: bool = ..., - strict_domain: bool = ..., strict_rfc2965_unverifiable: bool = ..., strict_ns_unverifiable: bool = ..., - strict_ns_domain=..., strict_ns_set_initial_dollar: bool = ..., strict_ns_set_path: bool = ...): ... + def __init__( + self, + blocked_domains: Optional[Any] = ..., + allowed_domains: Optional[Any] = ..., + netscape: bool = ..., + rfc2965: bool = ..., + rfc2109_as_netscape: Optional[Any] = ..., + hide_cookie2: bool = ..., + strict_domain: bool = ..., + strict_rfc2965_unverifiable: bool = ..., + strict_ns_unverifiable: bool = ..., + strict_ns_domain=..., + strict_ns_set_initial_dollar: bool = ..., + strict_ns_set_path: bool = ..., + ): ... def blocked_domains(self): ... def set_blocked_domains(self, blocked_domains): ... def is_blocked(self, domain): ... @@ -109,4 +138,5 @@ class LWPCookieJar(FileCookieJar): def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented MozillaCookieJar = FileCookieJar + def lwp_cookie_str(cookie: Cookie) -> str: ... diff --git a/stdlib/2/email/base64mime.pyi b/stdlib/2/email/base64mime.pyi index f05003b8d5a7..fc6552974e60 100644 --- a/stdlib/2/email/base64mime.pyi +++ b/stdlib/2/email/base64mime.pyi @@ -1,8 +1,11 @@ def base64_len(s: bytes) -> int: ... def header_encode(header, charset=..., keep_eols=..., maxlinelen=..., eol=...): ... def encode(s, binary=..., maxlinelen=..., eol=...): ... + body_encode = encode encodestring = encode + def decode(s, convert_eols=...): ... + body_decode = decode decodestring = decode diff --git a/stdlib/2/email/feedparser.pyi b/stdlib/2/email/feedparser.pyi index 51f825939347..fb2aa9f5ff1b 100644 --- a/stdlib/2/email/feedparser.pyi +++ b/stdlib/2/email/feedparser.pyi @@ -11,7 +11,6 @@ class BufferedSubFile: def __iter__(self): ... def next(self): ... - class FeedParser: def __init__(self, _factory=...) -> None: ... def feed(self, data) -> None: ... diff --git a/stdlib/2/email/generator.pyi b/stdlib/2/email/generator.pyi index 96cfe2d214a5..a5f5983b48e6 100644 --- a/stdlib/2/email/generator.pyi +++ b/stdlib/2/email/generator.pyi @@ -4,6 +4,5 @@ class Generator: def flatten(self, msg, unixfrom: bool = ...) -> None: ... def clone(self, fp): ... - class DecodedGenerator(Generator): def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ..., fmt=...) -> None: ... diff --git a/stdlib/2/email/header.pyi b/stdlib/2/email/header.pyi index 69c936300cce..429ee16d8917 100644 --- a/stdlib/2/email/header.pyi +++ b/stdlib/2/email/header.pyi @@ -2,8 +2,7 @@ def decode_header(header): ... def make_header(decoded_seq, maxlinelen=..., header_name=..., continuation_ws=...): ... class Header: - def __init__(self, s=..., charset=..., maxlinelen=..., header_name=..., continuation_ws=..., - errors=...) -> None: ... + def __init__(self, s=..., charset=..., maxlinelen=..., header_name=..., continuation_ws=..., errors=...) -> None: ... def __unicode__(self): ... def __eq__(self, other): ... def __ne__(self, other): ... diff --git a/stdlib/2/email/mime/application.pyi b/stdlib/2/email/mime/application.pyi index 49d84a52f234..1a120cf0dd49 100644 --- a/stdlib/2/email/mime/application.pyi +++ b/stdlib/2/email/mime/application.pyi @@ -6,6 +6,6 @@ from typing import Callable, Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] class MIMEApplication(MIMENonMultipart): - def __init__(self, _data: bytes, _subtype: str = ..., - _encoder: Callable[[MIMEApplication], None] = ..., - **_params: _ParamsType) -> None: ... + def __init__( + self, _data: bytes, _subtype: str = ..., _encoder: Callable[[MIMEApplication], None] = ..., **_params: _ParamsType + ) -> None: ... diff --git a/stdlib/2/encodings/__init__.pyi b/stdlib/2/encodings/__init__.pyi index 2c8884112d2f..d99d4a57e9ab 100644 --- a/stdlib/2/encodings/__init__.pyi +++ b/stdlib/2/encodings/__init__.pyi @@ -1,5 +1,4 @@ import codecs import typing -def search_function(encoding: str) -> codecs.CodecInfo: - ... +def search_function(encoding: str) -> codecs.CodecInfo: ... diff --git a/stdlib/2/fcntl.pyi b/stdlib/2/fcntl.pyi index 97d31fae992e..bdd46b6b8efc 100644 --- a/stdlib/2/fcntl.pyi +++ b/stdlib/2/fcntl.pyi @@ -79,9 +79,6 @@ _ANYFILE = Union[int, IO] def fcntl(fd: _ANYFILE, op: int, arg: Union[int, bytes] = ...) -> Any: ... # TODO: arg: int or read-only buffer interface or read-write buffer interface -def ioctl(fd: _ANYFILE, op: int, arg: Union[int, bytes] = ..., - mutate_flag: bool = ...) -> Any: ... - +def ioctl(fd: _ANYFILE, op: int, arg: Union[int, bytes] = ..., mutate_flag: bool = ...) -> Any: ... def flock(fd: _ANYFILE, op: int) -> None: ... -def lockf(fd: _ANYFILE, op: int, length: int = ..., start: int = ..., - whence: int = ...) -> Any: ... +def lockf(fd: _ANYFILE, op: int, length: int = ..., start: int = ..., whence: int = ...) -> Any: ... diff --git a/stdlib/2/functools.pyi b/stdlib/2/functools.pyi index ca7dfc712241..d64da11a3c27 100644 --- a/stdlib/2/functools.pyi +++ b/stdlib/2/functools.pyi @@ -15,21 +15,21 @@ _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") _S = TypeVar("_S") @overload -def reduce(function: Callable[[_T, _T], _T], - sequence: Iterable[_T]) -> _T: ... +def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ... @overload -def reduce(function: Callable[[_T, _S], _T], - sequence: Iterable[_S], initial: _T) -> _T: ... +def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ... WRAPPER_ASSIGNMENTS: Sequence[str] WRAPPER_UPDATES: Sequence[str] -def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ..., - updated: Sequence[str] = ...) -> _AnyCallable: ... -def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ... +def update_wrapper( + wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ... +) -> _AnyCallable: ... +def wraps( + wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ... +) -> Callable[[_AnyCallable], _AnyCallable]: ... def total_ordering(cls: type) -> type: ... def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ... - @overload def partial(__func: Callable[[_T], _S], __arg: _T) -> Callable[[], _S]: ... @overload @@ -40,62 +40,29 @@ def partial(__func: Callable[[_T, _T2, _T3], _S], __arg: _T) -> Callable[[_T2, _ def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg: _T) -> Callable[[_T2, _T3, _T4], _S]: ... @overload def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg: _T) -> Callable[[_T2, _T3, _T4, _T5], _S]: ... - @overload -def partial(__func: Callable[[_T, _T2], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[], _S]: ... +def partial(__func: Callable[[_T, _T2], _S], __arg1: _T, __arg2: _T2) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3, _T4], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3, _T4], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[_T4], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[_T4], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[_T4, _T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[_T4, _T5], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4) -> Callable[[], _S]: ... -@overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4) -> Callable[[_T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4, - __arg5: _T5) -> Callable[[], _S]: ... - +def partial( + __func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4 +) -> Callable[[_T5], _S]: ... +@overload +def partial( + __func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4, __arg5: _T5 +) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[..., _S], - *args: Any, - **kwargs: Any) -> Callable[..., _S]: ... +def partial(__func: Callable[..., _S], *args: Any, **kwargs: Any) -> Callable[..., _S]: ... diff --git a/stdlib/2/future_builtins.pyi b/stdlib/2/future_builtins.pyi index 9a45f9273223..fffe09c87c20 100644 --- a/stdlib/2/future_builtins.pyi +++ b/stdlib/2/future_builtins.pyi @@ -4,9 +4,5 @@ from itertools import izip as zip from typing import Any def ascii(obj: Any) -> str: ... - - def hex(x: int) -> str: ... - - def oct(x: int) -> str: ... diff --git a/stdlib/2/gc.pyi b/stdlib/2/gc.pyi index 5f552075baba..695ed2a59b95 100644 --- a/stdlib/2/gc.pyi +++ b/stdlib/2/gc.pyi @@ -9,8 +9,7 @@ def collect(generation: int = ...) -> int: ... def set_debug(flags: int) -> None: ... def get_debug() -> int: ... def get_objects() -> List[Any]: ... -def set_threshold(threshold0: int, threshold1: int = ..., - threshold2: int = ...) -> None: ... +def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ...) -> None: ... def get_count() -> Tuple[int, int, int]: ... def get_threshold() -> Tuple[int, int, int]: ... def get_referrers(*objs: Any) -> List[Any]: ... diff --git a/stdlib/2/gettext.pyi b/stdlib/2/gettext.pyi index 59e16ac4f635..0930fe63813e 100644 --- a/stdlib/2/gettext.pyi +++ b/stdlib/2/gettext.pyi @@ -32,10 +32,17 @@ class GNUTranslations(NullTranslations): LE_MAGIC: int BE_MAGIC: int -def find(domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ..., - all: Any = ...) -> Optional[Union[str, List[str]]]: ... - -def translation(domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ..., - class_: Optional[Type[NullTranslations]] = ..., fallback: bool = ..., codeset: Optional[str] = ...) -> NullTranslations: ... -def install(domain: str, localedir: Optional[str] = ..., unicode: bool = ..., codeset: Optional[str] = ..., - names: Container[str] = ...) -> None: ... +def find( + domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ..., all: Any = ... +) -> Optional[Union[str, List[str]]]: ... +def translation( + domain: str, + localedir: Optional[str] = ..., + languages: Optional[Sequence[str]] = ..., + class_: Optional[Type[NullTranslations]] = ..., + fallback: bool = ..., + codeset: Optional[str] = ..., +) -> NullTranslations: ... +def install( + domain: str, localedir: Optional[str] = ..., unicode: bool = ..., codeset: Optional[str] = ..., names: Container[str] = ... +) -> None: ... diff --git a/stdlib/2/gzip.pyi b/stdlib/2/gzip.pyi index 6817daf7df04..f5c5af9c4c40 100644 --- a/stdlib/2/gzip.pyi +++ b/stdlib/2/gzip.pyi @@ -14,8 +14,9 @@ class GzipFile(io.BufferedIOBase): fileobj: Any offset: Any mtime: Any - def __init__(self, filename: str = ..., mode: Text = ..., compresslevel: int = ..., - fileobj: IO[str] = ..., mtime: float = ...) -> None: ... + def __init__( + self, filename: str = ..., mode: Text = ..., compresslevel: int = ..., fileobj: IO[str] = ..., mtime: float = ... + ) -> None: ... @property def filename(self): ... size: Any diff --git a/stdlib/2/hashlib.pyi b/stdlib/2/hashlib.pyi index 22288203aaf5..b60a5d2522db 100644 --- a/stdlib/2/hashlib.pyi +++ b/stdlib/2/hashlib.pyi @@ -16,7 +16,6 @@ class _hash(object): # This is not actually in the module namespace. def copy(self) -> _hash: ... def new(name: str, data: str = ...) -> _hash: ... - def md5(s: _DataType = ...) -> _hash: ... def sha1(s: _DataType = ...) -> _hash: ... def sha224(s: _DataType = ...) -> _hash: ... diff --git a/stdlib/2/heapq.pyi b/stdlib/2/heapq.pyi index cdd6f63e72df..2353c4cfa46a 100644 --- a/stdlib/2/heapq.pyi +++ b/stdlib/2/heapq.pyi @@ -1,16 +1,17 @@ from typing import Any, Callable, Iterable, List, Optional, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") def cmp_lt(x, y) -> bool: ... def heappush(heap: List[_T], item: _T) -> None: ... def heappop(heap: List[_T]) -> _T: raise IndexError() # if heap is empty + def heappushpop(heap: List[_T], item: _T) -> _T: ... def heapify(x: List[_T]) -> None: ... def heapreplace(heap: List[_T], item: _T) -> _T: raise IndexError() # if heap is empty + def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ... -def nlargest(n: int, iterable: Iterable[_T], - key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ... +def nlargest(n: int, iterable: Iterable[_T], key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ... def nsmallest(n: int, iterable: Iterable[_T]) -> List[_T]: ... diff --git a/stdlib/2/httplib.pyi b/stdlib/2/httplib.pyi index 0cb837d9a030..911f0b4a100c 100644 --- a/stdlib/2/httplib.pyi +++ b/stdlib/2/httplib.pyi @@ -29,8 +29,9 @@ class HTTPResponse: chunk_left: Any length: Any will_close: Any - def __init__(self, sock, debuglevel: int = ..., strict: int = ..., method: Optional[Any] = ..., - buffering: bool = ...) -> None: ... + def __init__( + self, sock, debuglevel: int = ..., strict: int = ..., method: Optional[Any] = ..., buffering: bool = ... + ) -> None: ... def begin(self): ... def close(self): ... def isclosed(self): ... @@ -59,8 +60,9 @@ class HTTPConnection: sock: Any host: str = ... port: int = ... - def __init__(self, host, port: Optional[Any] = ..., strict: Optional[Any] = ..., timeout=..., - source_address: Optional[Any] = ...) -> None: ... + def __init__( + self, host, port: Optional[Any] = ..., strict: Optional[Any] = ..., timeout=..., source_address: Optional[Any] = ... + ) -> None: ... def set_tunnel(self, host, port: Optional[Any] = ..., headers: Optional[Any] = ...): ... def set_debuglevel(self, level): ... def connect(self): ... @@ -86,16 +88,32 @@ class HTTPSConnection(HTTPConnection): default_port: Any key_file: Any cert_file: Any - def __init__(self, host, port: Optional[Any] = ..., key_file: Optional[Any] = ..., cert_file: Optional[Any] = ..., - strict: Optional[Any] = ..., timeout=..., source_address: Optional[Any] = ..., - context: Optional[Any] = ...) -> None: ... + def __init__( + self, + host, + port: Optional[Any] = ..., + key_file: Optional[Any] = ..., + cert_file: Optional[Any] = ..., + strict: Optional[Any] = ..., + timeout=..., + source_address: Optional[Any] = ..., + context: Optional[Any] = ..., + ) -> None: ... sock: Any def connect(self): ... class HTTPS(HTTP): key_file: Any cert_file: Any - def __init__(self, host: str = ..., port: Optional[Any] = ..., key_file: Optional[Any] = ..., cert_file: Optional[Any] = ..., strict: Optional[Any] = ..., context: Optional[Any] = ...) -> None: ... + def __init__( + self, + host: str = ..., + port: Optional[Any] = ..., + key_file: Optional[Any] = ..., + cert_file: Optional[Any] = ..., + strict: Optional[Any] = ..., + context: Optional[Any] = ..., + ) -> None: ... class HTTPException(Exception): ... class NotConnected(HTTPException): ... diff --git a/stdlib/2/inspect.pyi b/stdlib/2/inspect.pyi index e4c11fe52b07..2051b3ff6233 100644 --- a/stdlib/2/inspect.pyi +++ b/stdlib/2/inspect.pyi @@ -10,8 +10,7 @@ class BlockFinder: started: bool passline: bool last: int - def tokeneater(self, type: int, token: str, srow_scol: Tuple[int, int], - erow_ecol: Tuple[int, int], line: str) -> None: ... + def tokeneater(self, type: int, token: str, srow_scol: Tuple[int, int], erow_ecol: Tuple[int, int], line: str) -> None: ... CO_GENERATOR: int CO_NESTED: int @@ -22,18 +21,11 @@ CO_VARARGS: int CO_VARKEYWORDS: int TPFLAGS_IS_ABSTRACT: int -ModuleInfo = NamedTuple('ModuleInfo', [('name', str), - ('suffix', str), - ('mode', str), - ('module_type', int), - ]) -def getmembers( - object: object, - predicate: Optional[Callable[[Any], bool]] = ... -) -> List[Tuple[str, Any]]: ... +ModuleInfo = NamedTuple("ModuleInfo", [("name", str), ("suffix", str), ("mode", str), ("module_type", int)]) + +def getmembers(object: object, predicate: Optional[Callable[[Any], bool]] = ...) -> List[Tuple[str, Any]]: ... def getmoduleinfo(path: str) -> Optional[ModuleInfo]: ... def getmodulename(path: str) -> Optional[str]: ... - def ismodule(object: object) -> bool: ... def isclass(object: object) -> bool: ... def ismethod(object: object) -> bool: ... @@ -60,9 +52,11 @@ def getcomments(object: object) -> str: ... def getfile(object: object) -> str: ... def getmodule(object: object) -> ModuleType: ... def getsourcefile(object: object) -> str: ... + # TODO restrict to "module, class, method, function, traceback, frame, # or code object" def getsourcelines(object: object) -> Tuple[List[str], int]: ... + # TODO restrict to "a module, class, method, function, traceback, frame, # or code object" def getsource(object: object) -> str: ... @@ -70,49 +64,36 @@ def cleandoc(doc: str) -> str: ... def indentsize(line: str) -> int: ... # Classes and functions -def getclasstree(classes: List[type], unique: bool = ...) -> List[ - Union[Tuple[type, Tuple[type, ...]], list]]: ... - -ArgSpec = NamedTuple('ArgSpec', [('args', List[str]), - ('varargs', Optional[str]), - ('keywords', Optional[str]), - ('defaults', tuple), - ]) - -ArgInfo = NamedTuple('ArgInfo', [('args', List[str]), - ('varargs', Optional[str]), - ('keywords', Optional[str]), - ('locals', Dict[str, Any]), - ]) - -Arguments = NamedTuple('Arguments', [('args', List[Union[str, List[Any]]]), - ('varargs', Optional[str]), - ('keywords', Optional[str]), - ]) +def getclasstree(classes: List[type], unique: bool = ...) -> List[Union[Tuple[type, Tuple[type, ...]], list]]: ... + +ArgSpec = NamedTuple( + "ArgSpec", [("args", List[str]), ("varargs", Optional[str]), ("keywords", Optional[str]), ("defaults", tuple)] +) + +ArgInfo = NamedTuple( + "ArgInfo", [("args", List[str]), ("varargs", Optional[str]), ("keywords", Optional[str]), ("locals", Dict[str, Any])] +) + +Arguments = NamedTuple( + "Arguments", [("args", List[Union[str, List[Any]]]), ("varargs", Optional[str]), ("keywords", Optional[str])] +) def getargs(co: CodeType) -> Arguments: ... def getargspec(func: object) -> ArgSpec: ... def getargvalues(frame: FrameType) -> ArgInfo: ... -def formatargspec(args, varargs=..., varkw=..., defaults=..., - formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., - join=...) -> str: ... -def formatargvalues(args, varargs=..., varkw=..., defaults=..., - formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., - join=...) -> str: ... +def formatargspec( + args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=... +) -> str: ... +def formatargvalues( + args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=... +) -> str: ... def getmro(cls: type) -> Tuple[type, ...]: ... def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ... # The interpreter stack Traceback = NamedTuple( - 'Traceback', - [ - ('filename', str), - ('lineno', int), - ('function', str), - ('code_context', List[str]), - ('index', int), - ] + "Traceback", [("filename", str), ("lineno", int), ("function", str), ("code_context", List[str]), ("index", int)] ) _FrameInfo = Tuple[FrameType, str, int, str, List[str], int] @@ -121,15 +102,10 @@ def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: .. def getframeinfo(frame: Union[FrameType, TracebackType], context: int = ...) -> Traceback: ... def getinnerframes(traceback: TracebackType, context: int = ...) -> List[_FrameInfo]: ... def getlineno(frame: FrameType) -> int: ... - def currentframe(depth: int = ...) -> FrameType: ... def stack(context: int = ...) -> List[_FrameInfo]: ... def trace(context: int = ...) -> List[_FrameInfo]: ... -Attribute = NamedTuple('Attribute', [('name', str), - ('kind', str), - ('defining_class', type), - ('object', object), - ]) +Attribute = NamedTuple("Attribute", [("name", str), ("kind", str), ("defining_class", type), ("object", object)]) def classify_class_attrs(cls: type) -> List[Attribute]: ... diff --git a/stdlib/2/io.pyi b/stdlib/2/io.pyi index 16afa1b804ae..a8df7843512c 100644 --- a/stdlib/2/io.pyi +++ b/stdlib/2/io.pyi @@ -21,20 +21,22 @@ from _io import TextIOWrapper as TextIOWrapper from _io import UnsupportedOperation as UnsupportedOperation from _io import open as open -def _OpenWrapper(file: Union[str, unicode, int], - mode: unicode = ..., buffering: int = ..., encoding: unicode = ..., - errors: unicode = ..., newline: unicode = ..., - closefd: bool = ...) -> IO[Any]: ... +def _OpenWrapper( + file: Union[str, unicode, int], + mode: unicode = ..., + buffering: int = ..., + encoding: unicode = ..., + errors: unicode = ..., + newline: unicode = ..., + closefd: bool = ..., +) -> IO[Any]: ... SEEK_SET: int SEEK_CUR: int SEEK_END: int - class IOBase(_io._IOBase): ... - class RawIOBase(_io._RawIOBase, IOBase): ... - class BufferedIOBase(_io._BufferedIOBase, IOBase): ... # Note: In the actual io.py, TextIOBase subclasses IOBase. diff --git a/stdlib/2/itertools.pyi b/stdlib/2/itertools.pyi index 8272d95c416b..9f97deb50ef7 100644 --- a/stdlib/2/itertools.pyi +++ b/stdlib/2/itertools.pyi @@ -4,15 +4,12 @@ from typing import Any, Callable, Generic, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload -_T = TypeVar('_T') -_S = TypeVar('_S') +_T = TypeVar("_T") +_S = TypeVar("_S") -def count(start: int = ..., - step: int = ...) -> Iterator[int]: ... # more general types? +def count(start: int = ..., step: int = ...) -> Iterator[int]: ... # more general types? def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ... - def repeat(object: _T, times: int = ...) -> Iterator[_T]: ... - def accumulate(iterable: Iterable[_T]) -> Iterator[_T]: ... class chain(Iterator[_T], Generic[_T]): @@ -23,142 +20,145 @@ class chain(Iterator[_T], Generic[_T]): def from_iterable(iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ... def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ... -def dropwhile(predicate: Callable[[_T], Any], - iterable: Iterable[_T]) -> Iterator[_T]: ... -def ifilter(predicate: Optional[Callable[[_T], Any]], - iterable: Iterable[_T]) -> Iterator[_T]: ... -def ifilterfalse(predicate: Optional[Callable[[_T], Any]], - iterable: Iterable[_T]) -> Iterator[_T]: ... - +def dropwhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ... +def ifilter(predicate: Optional[Callable[[_T], Any]], iterable: Iterable[_T]) -> Iterator[_T]: ... +def ifilterfalse(predicate: Optional[Callable[[_T], Any]], iterable: Iterable[_T]) -> Iterator[_T]: ... @overload def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ... @overload def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... - @overload def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ... @overload -def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int], - step: Optional[int] = ...) -> Iterator[_T]: ... - -_T1 = TypeVar('_T1') -_T2 = TypeVar('_T2') -_T3 = TypeVar('_T3') -_T4 = TypeVar('_T4') -_T5 = TypeVar('_T5') -_T6 = TypeVar('_T6') +def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> Iterator[_T]: ... +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") +_T4 = TypeVar("_T4") +_T5 = TypeVar("_T5") +_T6 = TypeVar("_T6") @overload def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ... @overload -def imap(func: Callable[[_T1, _T2], _S], - iter1: Iterable[_T1], - iter2: Iterable[_T2]) -> Iterator[_S]: ... -@overload -def imap(func: Callable[[_T1, _T2, _T3], _S], - iter1: Iterable[_T1], iter2: Iterable[_T2], - iter3: Iterable[_T3]) -> Iterator[_S]: ... - -@overload -def imap(func: Callable[[_T1, _T2, _T3, _T4], _S], - iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], - iter4: Iterable[_T4]) -> Iterator[_S]: ... - -@overload -def imap(func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], - iter4: Iterable[_T4], iter5: Iterable[_T5]) -> Iterator[_S]: ... - -@overload -def imap(func: Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _S], - iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], - iter4: Iterable[_T4], iter5: Iterable[_T5], - iter6: Iterable[_T6]) -> Iterator[_S]: ... - -@overload -def imap(func: Callable[..., _S], - iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any], - iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any], - iter7: Iterable[Any], *iterables: Iterable[Any]) -> Iterator[_S]: ... - +def imap(func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[_S]: ... +@overload +def imap( + func: Callable[[_T1, _T2, _T3], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3] +) -> Iterator[_S]: ... +@overload +def imap( + func: Callable[[_T1, _T2, _T3, _T4], _S], + iter1: Iterable[_T1], + iter2: Iterable[_T2], + iter3: Iterable[_T3], + iter4: Iterable[_T4], +) -> Iterator[_S]: ... +@overload +def imap( + func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], + iter1: Iterable[_T1], + iter2: Iterable[_T2], + iter3: Iterable[_T3], + iter4: Iterable[_T4], + iter5: Iterable[_T5], +) -> Iterator[_S]: ... +@overload +def imap( + func: Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _S], + iter1: Iterable[_T1], + iter2: Iterable[_T2], + iter3: Iterable[_T3], + iter4: Iterable[_T4], + iter5: Iterable[_T5], + iter6: Iterable[_T6], +) -> Iterator[_S]: ... +@overload +def imap( + func: Callable[..., _S], + iter1: Iterable[Any], + iter2: Iterable[Any], + iter3: Iterable[Any], + iter4: Iterable[Any], + iter5: Iterable[Any], + iter6: Iterable[Any], + iter7: Iterable[Any], + *iterables: Iterable[Any] +) -> Iterator[_S]: ... def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ... -def takewhile(predicate: Callable[[_T], Any], - iterable: Iterable[_T]) -> Iterator[_T]: ... +def takewhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ... def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ... - @overload def izip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... @overload -def izip(iter1: Iterable[_T1], - iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... -@overload -def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], - iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... -@overload -def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], - iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, - _T3, _T4]]: ... -@overload -def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], - iter3: Iterable[_T3], iter4: Iterable[_T4], - iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, - _T3, _T4, _T5]]: ... -@overload -def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], - iter3: Iterable[_T3], iter4: Iterable[_T4], - iter5: Iterable[_T5], iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, - _T4, _T5, _T6]]: ... -@overload -def izip(iter1: Iterable[Any], iter2: Iterable[Any], - iter3: Iterable[Any], iter4: Iterable[Any], - iter5: Iterable[Any], iter6: Iterable[Any], - iter7: Iterable[Any], *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ... - -def izip_longest(*p: Iterable[Any], - fillvalue: Any = ...) -> Iterator[Any]: ... - +def izip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... +@overload +def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... +@overload +def izip( + iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4] +) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... +@overload +def izip( + iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5] +) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +@overload +def izip( + iter1: Iterable[_T1], + iter2: Iterable[_T2], + iter3: Iterable[_T3], + iter4: Iterable[_T4], + iter5: Iterable[_T5], + iter6: Iterable[_T6], +) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... +@overload +def izip( + iter1: Iterable[Any], + iter2: Iterable[Any], + iter3: Iterable[Any], + iter4: Iterable[Any], + iter5: Iterable[Any], + iter6: Iterable[Any], + iter7: Iterable[Any], + *iterables: Iterable[Any] +) -> Iterator[Tuple[Any, ...]]: ... +def izip_longest(*p: Iterable[Any], fillvalue: Any = ...) -> Iterator[Any]: ... @overload def product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... @overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... -@overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... -@overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... -@overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], - iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... -@overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], - iter5: Iterable[_T5], - iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... -@overload -def product(iter1: Iterable[Any], - iter2: Iterable[Any], - iter3: Iterable[Any], - iter4: Iterable[Any], - iter5: Iterable[Any], - iter6: Iterable[Any], - iter7: Iterable[Any], - *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ... +def product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... +@overload +def product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... +@overload +def product( + iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4] +) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... +@overload +def product( + iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5] +) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +@overload +def product( + iter1: Iterable[_T1], + iter2: Iterable[_T2], + iter3: Iterable[_T3], + iter4: Iterable[_T4], + iter5: Iterable[_T5], + iter6: Iterable[_T6], +) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... +@overload +def product( + iter1: Iterable[Any], + iter2: Iterable[Any], + iter3: Iterable[Any], + iter4: Iterable[Any], + iter5: Iterable[Any], + iter6: Iterable[Any], + iter7: Iterable[Any], + *iterables: Iterable[Any] +) -> Iterator[Tuple[Any, ...]]: ... @overload def product(*iterables: Iterable[Any], repeat: int) -> Iterator[Tuple[Any, ...]]: ... - -def permutations(iterable: Iterable[_T], - r: int = ...) -> Iterator[Sequence[_T]]: ... -def combinations(iterable: Iterable[_T], - r: int) -> Iterator[Sequence[_T]]: ... -def combinations_with_replacement(iterable: Iterable[_T], - r: int) -> Iterator[Sequence[_T]]: ... +def permutations(iterable: Iterable[_T], r: int = ...) -> Iterator[Sequence[_T]]: ... +def combinations(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ... +def combinations_with_replacement(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ... diff --git a/stdlib/2/json.pyi b/stdlib/2/json.pyi index ce080bf66e38..e6aaa536b3fa 100644 --- a/stdlib/2/json.pyi +++ b/stdlib/2/json.pyi @@ -6,65 +6,73 @@ class JSONDecodeError(ValueError): def loads(self, s: str) -> Any: ... def load(self, fp: IO[str]) -> Any: ... -def dumps(obj: Any, - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - cls: Any = ..., - indent: Optional[int] = ..., - separators: Optional[Tuple[str, str]] = ..., - encoding: str = ..., - default: Optional[Callable[[Any], Any]] = ..., - sort_keys: bool = ..., - **kwds: Any) -> str: ... - -def dump(obj: Any, - fp: Union[IO[str], IO[Text]], - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - cls: Any = ..., - indent: Optional[int] = ..., - separators: Optional[Tuple[str, str]] = ..., - encoding: str = ..., - default: Optional[Callable[[Any], Any]] = ..., - sort_keys: bool = ..., - **kwds: Any) -> None: ... - -def loads(s: Union[Text, bytes], - encoding: Any = ..., - cls: Any = ..., - object_hook: Optional[Callable[[Dict], Any]] = ..., - parse_float: Optional[Callable[[str], Any]] = ..., - parse_int: Optional[Callable[[str], Any]] = ..., - parse_constant: Optional[Callable[[str], Any]] = ..., - object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., - **kwds: Any) -> Any: ... +def dumps( + obj: Any, + skipkeys: bool = ..., + ensure_ascii: bool = ..., + check_circular: bool = ..., + allow_nan: bool = ..., + cls: Any = ..., + indent: Optional[int] = ..., + separators: Optional[Tuple[str, str]] = ..., + encoding: str = ..., + default: Optional[Callable[[Any], Any]] = ..., + sort_keys: bool = ..., + **kwds: Any +) -> str: ... +def dump( + obj: Any, + fp: Union[IO[str], IO[Text]], + skipkeys: bool = ..., + ensure_ascii: bool = ..., + check_circular: bool = ..., + allow_nan: bool = ..., + cls: Any = ..., + indent: Optional[int] = ..., + separators: Optional[Tuple[str, str]] = ..., + encoding: str = ..., + default: Optional[Callable[[Any], Any]] = ..., + sort_keys: bool = ..., + **kwds: Any +) -> None: ... +def loads( + s: Union[Text, bytes], + encoding: Any = ..., + cls: Any = ..., + object_hook: Optional[Callable[[Dict], Any]] = ..., + parse_float: Optional[Callable[[str], Any]] = ..., + parse_int: Optional[Callable[[str], Any]] = ..., + parse_constant: Optional[Callable[[str], Any]] = ..., + object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., + **kwds: Any +) -> Any: ... class _Reader(Protocol): def read(self) -> Union[Text, bytes]: ... -def load(fp: _Reader, - encoding: Optional[str] = ..., - cls: Any = ..., - object_hook: Optional[Callable[[Dict], Any]] = ..., - parse_float: Optional[Callable[[str], Any]] = ..., - parse_int: Optional[Callable[[str], Any]] = ..., - parse_constant: Optional[Callable[[str], Any]] = ..., - object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., - **kwds: Any) -> Any: ... +def load( + fp: _Reader, + encoding: Optional[str] = ..., + cls: Any = ..., + object_hook: Optional[Callable[[Dict], Any]] = ..., + parse_float: Optional[Callable[[str], Any]] = ..., + parse_int: Optional[Callable[[str], Any]] = ..., + parse_constant: Optional[Callable[[str], Any]] = ..., + object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., + **kwds: Any +) -> Any: ... class JSONDecoder(object): - def __init__(self, - encoding: Union[Text, bytes] = ..., - object_hook: Callable[..., Any] = ..., - parse_float: Callable[[str], float] = ..., - parse_int: Callable[[str], int] = ..., - parse_constant: Callable[[str], Any] = ..., - strict: bool = ..., - object_pairs_hook: Callable[..., Any] = ...) -> None: ... + def __init__( + self, + encoding: Union[Text, bytes] = ..., + object_hook: Callable[..., Any] = ..., + parse_float: Callable[[str], float] = ..., + parse_int: Callable[[str], int] = ..., + parse_constant: Callable[[str], Any] = ..., + strict: bool = ..., + object_pairs_hook: Callable[..., Any] = ..., + ) -> None: ... def decode(self, s: Union[Text, bytes], _w: Any = ...) -> Any: ... def raw_decode(self, s: Union[Text, bytes], idx: int = ...) -> Tuple[Any, Any]: ... @@ -77,20 +85,18 @@ class JSONEncoder(object): allow_nan: bool sort_keys: bool indent: Optional[int] - - def __init__(self, - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - sort_keys: bool = ..., - indent: Optional[int] = ..., - separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ..., - encoding: Union[Text, bytes] = ..., - default: Callable[..., Any] = ...) -> None: ... - + def __init__( + self, + skipkeys: bool = ..., + ensure_ascii: bool = ..., + check_circular: bool = ..., + allow_nan: bool = ..., + sort_keys: bool = ..., + indent: Optional[int] = ..., + separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ..., + encoding: Union[Text, bytes] = ..., + default: Callable[..., Any] = ..., + ) -> None: ... def default(self, o: Any) -> Any: ... - def encode(self, o: Any) -> str: ... - def iterencode(self, o: Any, _one_shot: bool = ...) -> str: ... diff --git a/stdlib/2/markupbase.pyi b/stdlib/2/markupbase.pyi index 358ba16c3487..727daaacf25e 100644 --- a/stdlib/2/markupbase.pyi +++ b/stdlib/2/markupbase.pyi @@ -5,5 +5,4 @@ class ParserBase(object): def error(self, message: str) -> None: ... def reset(self) -> None: ... def getpos(self) -> Tuple[int, int]: ... - def unknown_decl(self, data: str) -> None: ... diff --git a/stdlib/2/multiprocessing/__init__.pyi b/stdlib/2/multiprocessing/__init__.pyi index 9cdcdcc21897..7a8ce8b37467 100644 --- a/stdlib/2/multiprocessing/__init__.pyi +++ b/stdlib/2/multiprocessing/__init__.pyi @@ -12,7 +12,7 @@ class BufferTooShort(ProcessError): ... class TimeoutError(ProcessError): ... class AuthenticationError(ProcessError): ... -_T = TypeVar('_T') +_T = TypeVar("_T") class Queue(_BaseQueue[_T]): def __init__(self, maxsize: int = ...) -> None: ... @@ -45,8 +45,9 @@ def RawValue(typecode_or_type, *args): ... def RawArray(typecode_or_type, size_or_initializer): ... def Value(typecode_or_type, *args, **kwds): ... def Array(typecode_or_type, size_or_initializer, **kwds): ... - -def Pool(processes: Optional[int] = ..., - initializer: Optional[Callable[..., Any]] = ..., - initargs: Iterable[Any] = ..., - maxtasksperchild: Optional[int] = ...) -> pool.Pool: ... +def Pool( + processes: Optional[int] = ..., + initializer: Optional[Callable[..., Any]] = ..., + initargs: Iterable[Any] = ..., + maxtasksperchild: Optional[int] = ..., +) -> pool.Pool: ... diff --git a/stdlib/2/multiprocessing/dummy/__init__.pyi b/stdlib/2/multiprocessing/dummy/__init__.pyi index 7132f69b081b..a0cce0f3fe91 100644 --- a/stdlib/2/multiprocessing/dummy/__init__.pyi +++ b/stdlib/2/multiprocessing/dummy/__init__.pyi @@ -18,7 +18,6 @@ class DummyProcess(threading.Thread): @property def exitcode(self) -> Optional[int]: ... - Process = DummyProcess # This should be threading._Condition but threading.pyi exports it as Condition diff --git a/stdlib/2/multiprocessing/dummy/connection.pyi b/stdlib/2/multiprocessing/dummy/connection.pyi index a7a4f995fdb0..648fc0a54903 100644 --- a/stdlib/2/multiprocessing/dummy/connection.pyi +++ b/stdlib/2/multiprocessing/dummy/connection.pyi @@ -21,6 +21,5 @@ class Listener(object): def accept(self) -> Connection: ... def close(self) -> None: ... - def Client(address) -> Connection: ... def Pipe(duplex=...) -> Tuple[Connection, Connection]: ... diff --git a/stdlib/2/multiprocessing/pool.pyi b/stdlib/2/multiprocessing/pool.pyi index 546480fce480..932051a5a3a2 100644 --- a/stdlib/2/multiprocessing/pool.pyi +++ b/stdlib/2/multiprocessing/pool.pyi @@ -1,8 +1,8 @@ from typing import Any, Callable, ContextManager, Dict, Iterable, Iterator, List, Optional, TypeVar -_T = TypeVar('_T', bound=Pool) +_T = TypeVar("_T", bound=Pool) -class AsyncResult(): +class AsyncResult: def get(self, timeout: Optional[float] = ...) -> Any: ... def wait(self, timeout: Optional[float] = ...) -> None: ... def ready(self) -> bool: ... @@ -15,42 +15,39 @@ class IMapIterator(Iterator[Any]): class IMapUnorderedIterator(IMapIterator): ... class Pool(ContextManager[Pool]): - def __init__(self, processes: Optional[int] = ..., - initializer: Optional[Callable[..., None]] = ..., - initargs: Iterable[Any] = ..., - maxtasksperchild: Optional[int] = ...) -> None: ... - def apply(self, - func: Callable[..., Any], - args: Iterable[Any] = ..., - kwds: Dict[str, Any] = ...) -> Any: ... - def apply_async(self, - func: Callable[..., Any], - args: Iterable[Any] = ..., - kwds: Dict[str, Any] = ..., - callback: Optional[Callable[..., None]] = ...) -> AsyncResult: ... - def map(self, - func: Callable[..., Any], - iterable: Iterable[Any] = ..., - chunksize: Optional[int] = ...) -> List[Any]: ... - def map_async(self, func: Callable[..., Any], - iterable: Iterable[Any] = ..., - chunksize: Optional[int] = ..., - callback: Optional[Callable[..., None]] = ...) -> AsyncResult: ... - def imap(self, - func: Callable[..., Any], - iterable: Iterable[Any] = ..., - chunksize: Optional[int] = ...) -> IMapIterator: ... - def imap_unordered(self, - func: Callable[..., Any], - iterable: Iterable[Any] = ..., - chunksize: Optional[int] = ...) -> IMapIterator: ... + def __init__( + self, + processes: Optional[int] = ..., + initializer: Optional[Callable[..., None]] = ..., + initargs: Iterable[Any] = ..., + maxtasksperchild: Optional[int] = ..., + ) -> None: ... + def apply(self, func: Callable[..., Any], args: Iterable[Any] = ..., kwds: Dict[str, Any] = ...) -> Any: ... + def apply_async( + self, + func: Callable[..., Any], + args: Iterable[Any] = ..., + kwds: Dict[str, Any] = ..., + callback: Optional[Callable[..., None]] = ..., + ) -> AsyncResult: ... + def map(self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: Optional[int] = ...) -> List[Any]: ... + def map_async( + self, + func: Callable[..., Any], + iterable: Iterable[Any] = ..., + chunksize: Optional[int] = ..., + callback: Optional[Callable[..., None]] = ..., + ) -> AsyncResult: ... + def imap(self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: Optional[int] = ...) -> IMapIterator: ... + def imap_unordered( + self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: Optional[int] = ... + ) -> IMapIterator: ... def close(self) -> None: ... def terminate(self) -> None: ... def join(self) -> None: ... def __enter__(self: _T) -> _T: ... class ThreadPool(Pool, ContextManager[ThreadPool]): - - def __init__(self, processes: Optional[int] = ..., - initializer: Optional[Callable[..., Any]] = ..., - initargs: Iterable[Any] = ...) -> None: ... + def __init__( + self, processes: Optional[int] = ..., initializer: Optional[Callable[..., Any]] = ..., initargs: Iterable[Any] = ... + ) -> None: ... diff --git a/stdlib/2/multiprocessing/process.pyi b/stdlib/2/multiprocessing/process.pyi index 476b40324fd2..9ab9628e0e32 100644 --- a/stdlib/2/multiprocessing/process.pyi +++ b/stdlib/2/multiprocessing/process.pyi @@ -4,8 +4,9 @@ def current_process(): ... def active_children(): ... class Process: - def __init__(self, group: Optional[Any] = ..., target: Optional[Any] = ..., name: Optional[Any] = ..., args=..., - kwargs=...): ... + def __init__( + self, group: Optional[Any] = ..., target: Optional[Any] = ..., name: Optional[Any] = ..., args=..., kwargs=... + ): ... def run(self): ... def start(self): ... def terminate(self): ... diff --git a/stdlib/2/mutex.pyi b/stdlib/2/mutex.pyi index 8da8bfbaffce..c22387ba08c2 100644 --- a/stdlib/2/mutex.pyi +++ b/stdlib/2/mutex.pyi @@ -3,7 +3,7 @@ from collections import deque from typing import Any, Callable, TypeVar -_ArgType = TypeVar('_ArgType') +_ArgType = TypeVar("_ArgType") class mutex: locked: bool diff --git a/stdlib/2/os/__init__.pyi b/stdlib/2/os/__init__.pyi index 867e19b5ea40..8760c506d4af 100644 --- a/stdlib/2/os/__init__.pyi +++ b/stdlib/2/os/__init__.pyi @@ -30,7 +30,7 @@ from typing import ( from . import path as path -_T = TypeVar('_T') +_T = TypeVar("_T") # ----- os variables ----- @@ -57,32 +57,32 @@ O_TRUNC: int # We don't use sys.platform for O_* flags to denote platform-dependent APIs because some codes, # including tests for mypy, use a more finer way than sys.platform before using these APIs # See https://github.com/python/typeshed/pull/2286 for discussions -O_DSYNC: int # Unix only -O_RSYNC: int # Unix only -O_SYNC: int # Unix only -O_NDELAY: int # Unix only +O_DSYNC: int # Unix only +O_RSYNC: int # Unix only +O_SYNC: int # Unix only +O_NDELAY: int # Unix only O_NONBLOCK: int # Unix only -O_NOCTTY: int # Unix only -O_SHLOCK: int # Unix only -O_EXLOCK: int # Unix only -O_BINARY: int # Windows only +O_NOCTTY: int # Unix only +O_SHLOCK: int # Unix only +O_EXLOCK: int # Unix only +O_BINARY: int # Windows only O_NOINHERIT: int # Windows only O_SHORT_LIVED: int # Windows only O_TEMPORARY: int # Windows only -O_RANDOM: int # Windows only +O_RANDOM: int # Windows only O_SEQUENTIAL: int # Windows only -O_TEXT: int # Windows only -O_ASYNC: int # Gnu extension if in C library -O_DIRECT: int # Gnu extension if in C library +O_TEXT: int # Windows only +O_ASYNC: int # Gnu extension if in C library +O_DIRECT: int # Gnu extension if in C library O_DIRECTORY: int # Gnu extension if in C library -O_NOFOLLOW: int # Gnu extension if in C library -O_NOATIME: int # Gnu extension if in C library +O_NOFOLLOW: int # Gnu extension if in C library +O_NOATIME: int # Gnu extension if in C library O_LARGEFILE: int # Gnu extension if in C library curdir: str pardir: str sep: str -if sys.platform == 'win32': +if sys.platform == "win32": altsep: str else: altsep: Optional[str] @@ -110,7 +110,7 @@ environ: _Environ[str] if sys.version_info >= (3, 2): environb: _Environ[bytes] -if sys.platform != 'win32': +if sys.platform != "win32": # Unix only confstr_names: Dict[str, int] pathconf_names: Dict[str, int] @@ -137,12 +137,12 @@ if sys.platform != 'win32': P_NOWAIT: int P_NOWAITO: int P_WAIT: int -if sys.platform == 'win32': +if sys.platform == "win32": P_DETACH: int P_OVERLAY: int # wait()/waitpid() options -if sys.platform != 'win32': +if sys.platform != "win32": WNOHANG: int # Unix only WCONTINUED: int # some Unix systems WUNTRACED: int # Unix only @@ -155,10 +155,21 @@ if sys.version_info >= (3, 6): _PathType = path._PathType -_StatVFS = NamedTuple('_StatVFS', [('f_bsize', int), ('f_frsize', int), ('f_blocks', int), - ('f_bfree', int), ('f_bavail', int), ('f_files', int), - ('f_ffree', int), ('f_favail', int), ('f_flag', int), - ('f_namemax', int)]) +_StatVFS = NamedTuple( + "_StatVFS", + [ + ("f_bsize", int), + ("f_frsize", int), + ("f_blocks", int), + ("f_bfree", int), + ("f_bavail", int), + ("f_files", int), + ("f_ffree", int), + ("f_favail", int), + ("f_flag", int), + ("f_namemax", int), + ], +) def getlogin() -> str: ... def getpid() -> int: ... @@ -166,7 +177,7 @@ def getppid() -> int: ... def strerror(code: int) -> str: ... def umask(mask: int) -> int: ... -if sys.platform != 'win32': +if sys.platform != "win32": def ctermid() -> str: ... def getegid() -> int: ... def geteuid() -> int: ... @@ -199,7 +210,6 @@ def getenv(key: Text) -> Optional[str]: ... def getenv(key: Text, default: _T) -> Union[str, _T]: ... def putenv(key: Union[bytes, Text], value: Union[bytes, Text]) -> None: ... def unsetenv(key: Union[bytes, Text]) -> None: ... - def fdopen(fd: int, *args, **kwargs) -> IO[Any]: ... def close(fd: int) -> None: ... def closerange(fd_low: int, fd_high: int) -> None: ... @@ -240,17 +250,19 @@ def stat_float_times() -> bool: ... def stat_float_times(newvalue: bool) -> None: ... def symlink(source: _PathType, link_name: _PathType) -> None: ... def unlink(path: _PathType) -> None: ... + # TODO: add ns, dir_fd, follow_symlinks argument if sys.version_info >= (3, 0): def utime(path: _PathType, times: Optional[Tuple[float, float]] = ...) -> None: ... + else: def utime(path: _PathType, times: Optional[Tuple[float, float]]) -> None: ... -if sys.platform != 'win32': +if sys.platform != "win32": # Unix only def fchmod(fd: int, mode: int) -> None: ... def fchown(fd: int, uid: int, gid: int) -> None: ... - if sys.platform != 'darwin': + if sys.platform != "darwin": def fdatasync(fd: int) -> None: ... # Unix only, not Mac def fpathconf(fd: int, name: Union[str, int]) -> int: ... def fstatvfs(fd: int) -> _StatVFS: ... @@ -271,16 +283,20 @@ if sys.platform != 'win32': def statvfs(path: _PathType) -> _StatVFS: ... if sys.version_info >= (3, 6): - def walk(top: Union[AnyStr, PathLike[AnyStr]], topdown: bool = ..., - onerror: Optional[Callable[[OSError], Any]] = ..., - followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr], - List[AnyStr]]]: ... + def walk( + top: Union[AnyStr, PathLike[AnyStr]], + topdown: bool = ..., + onerror: Optional[Callable[[OSError], Any]] = ..., + followlinks: bool = ..., + ) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ... + else: - def walk(top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., - followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr], - List[AnyStr]]]: ... + def walk( + top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., followlinks: bool = ... + ) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ... def abort() -> NoReturn: ... + # These are defined as execl(file, *args) but the first *arg is mandatory. def execl(file: _PathType, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ... def execlp(file: _PathType, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ... @@ -292,15 +308,15 @@ def execlpe(file: _PathType, __arg0: Union[bytes, Text], *args: Any) -> NoReturn # The docs say `args: tuple or list of strings` # The implementation enforces tuple or list so we can't use Sequence. _ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]] + def execv(path: _PathType, args: _ExecVArgs) -> NoReturn: ... def execve(path: _PathType, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ... def execvp(file: _PathType, args: _ExecVArgs) -> NoReturn: ... def execvpe(file: _PathType, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ... - def _exit(n: int) -> NoReturn: ... def kill(pid: int, sig: int) -> None: ... -if sys.platform != 'win32': +if sys.platform != "win32": # Unix only def fork() -> int: ... def forkpty() -> Tuple[int, int]: ... # some flavors of Unix @@ -311,9 +327,9 @@ if sys.platform != 'win32': if sys.version_info >= (3, 0): class popen(_TextIOWrapper): # TODO 'b' modes or bytes command not accepted? - def __init__(self, command: str, mode: str = ..., - bufsize: int = ...) -> None: ... + def __init__(self, command: str, mode: str = ..., bufsize: int = ...) -> None: ... def close(self) -> Any: ... # may return int + else: def popen(command: str, *args, **kwargs) -> IO[Any]: ... def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ... @@ -321,18 +337,17 @@ else: def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ... def spawnl(mode: int, path: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ... -def spawnle(mode: int, path: _PathType, arg0: Union[bytes, Text], - *args: Any) -> int: ... # Imprecise sig +def spawnle(mode: int, path: _PathType, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise sig def spawnv(mode: int, path: _PathType, args: List[Union[bytes, Text]]) -> int: ... -def spawnve(mode: int, path: _PathType, args: List[Union[bytes, Text]], - env: Mapping[str, str]) -> int: ... +def spawnve(mode: int, path: _PathType, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ... def system(command: _PathType) -> int: ... def times() -> Tuple[float, float, float, float, float]: ... def waitpid(pid: int, options: int) -> Tuple[int, int]: ... def urandom(n: int) -> bytes: ... -if sys.platform == 'win32': +if sys.platform == "win32": def startfile(path: _PathType, operation: Optional[str] = ...) -> None: ... + else: # Unix only def spawnlp(mode: int, file: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ... @@ -356,6 +371,7 @@ else: if sys.version_info >= (3, 0): def sched_getaffinity(id: int) -> Set[int]: ... + if sys.version_info >= (3, 3): class waitresult: si_pid: int @@ -371,17 +387,14 @@ WEXITED: int WNOWAIT: int if sys.version_info >= (3, 3): - if sys.platform != 'win32': + if sys.platform != "win32": # Unix only def sync() -> None: ... - def truncate(path: Union[_PathType, int], length: int) -> None: ... # Unix only up to version 3.4 - - def fwalk(top: AnyStr = ..., topdown: bool = ..., - onerror: Callable = ..., *, follow_symlinks: bool = ..., - dir_fd: int = ...) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr], int]]: ... - - terminal_size = NamedTuple('terminal_size', [('columns', int), ('lines', int)]) + def fwalk( + top: AnyStr = ..., topdown: bool = ..., onerror: Callable = ..., *, follow_symlinks: bool = ..., dir_fd: int = ... + ) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr], int]]: ... + terminal_size = NamedTuple("terminal_size", [("columns", int), ("lines", int)]) def get_terminal_size(fd: int = ...) -> terminal_size: ... if sys.version_info >= (3, 4): diff --git a/stdlib/2/os/path.pyi b/stdlib/2/os/path.pyi index dfd074fe7c7c..5828ac950b48 100644 --- a/stdlib/2/os/path.pyi +++ b/stdlib/2/os/path.pyi @@ -6,10 +6,11 @@ import os import sys from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3, 6): from builtins import _PathLike + _PathType = Union[bytes, Text, _PathLike] _StrPath = Union[Text, _PathLike[Text]] _BytesPath = Union[bytes, _PathLike[bytes]] @@ -24,7 +25,7 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -if sys.platform == 'win32': +if sys.platform == "win32": altsep: str else: altsep: Optional[str] @@ -64,7 +65,7 @@ if sys.version_info >= (3, 6): def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": @overload def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload @@ -83,7 +84,7 @@ else: def expandvars(path: AnyStr) -> AnyStr: ... def normcase(path: AnyStr) -> AnyStr: ... def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": def realpath(path: AnyStr) -> AnyStr: ... else: def realpath(filename: AnyStr) -> AnyStr: ... @@ -92,6 +93,7 @@ if sys.version_info >= (3, 6): # In reality it returns str for sequences of _StrPath and bytes for sequences # of _BytesPath, but mypy does not accept such a signature. def commonpath(paths: Sequence[_PathType]) -> Any: ... + elif sys.version_info >= (3, 5): def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... @@ -102,8 +104,10 @@ def commonprefix(list: Sequence[_PathType]) -> Any: ... if sys.version_info >= (3, 3): def exists(path: Union[_PathType, int]) -> bool: ... + else: def exists(path: _PathType) -> bool: ... + def lexists(path: _PathType) -> bool: ... # These return float if os.stat_float_times() == True, @@ -111,7 +115,6 @@ def lexists(path: _PathType) -> bool: ... def getatime(path: _PathType) -> float: ... def getmtime(path: _PathType) -> float: ... def getctime(path: _PathType) -> float: ... - def getsize(path: _PathType) -> int: ... def isabs(path: _PathType) -> bool: ... def isfile(path: _PathType) -> bool: ... @@ -134,12 +137,14 @@ if sys.version_info < (3, 0): def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ... @overload def join(__p1: Text, *p: _PathType) -> Text: ... + elif sys.version_info >= (3, 6): # Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway. @overload def join(path: _StrPath, *paths: _StrPath) -> Text: ... @overload def join(path: _BytesPath, *paths: _BytesPath) -> bytes: ... + else: def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ... @@ -147,7 +152,6 @@ else: def relpath(path: _BytesPath, start: Optional[_BytesPath] = ...) -> bytes: ... @overload def relpath(path: _StrPath, start: Optional[_StrPath] = ...) -> Text: ... - def samefile(path1: _PathType, path2: _PathType) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(stat1: os.stat_result, stat2: os.stat_result) -> bool: ... @@ -165,12 +169,13 @@ if sys.version_info >= (3, 6): def splitext(path: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... + else: def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -if sys.platform == 'win32': +if sys.platform == "win32": def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated if sys.version_info < (3,): diff --git a/stdlib/2/os2emxpath.pyi b/stdlib/2/os2emxpath.pyi index dfd074fe7c7c..5828ac950b48 100644 --- a/stdlib/2/os2emxpath.pyi +++ b/stdlib/2/os2emxpath.pyi @@ -6,10 +6,11 @@ import os import sys from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3, 6): from builtins import _PathLike + _PathType = Union[bytes, Text, _PathLike] _StrPath = Union[Text, _PathLike[Text]] _BytesPath = Union[bytes, _PathLike[bytes]] @@ -24,7 +25,7 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -if sys.platform == 'win32': +if sys.platform == "win32": altsep: str else: altsep: Optional[str] @@ -64,7 +65,7 @@ if sys.version_info >= (3, 6): def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": @overload def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload @@ -83,7 +84,7 @@ else: def expandvars(path: AnyStr) -> AnyStr: ... def normcase(path: AnyStr) -> AnyStr: ... def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": def realpath(path: AnyStr) -> AnyStr: ... else: def realpath(filename: AnyStr) -> AnyStr: ... @@ -92,6 +93,7 @@ if sys.version_info >= (3, 6): # In reality it returns str for sequences of _StrPath and bytes for sequences # of _BytesPath, but mypy does not accept such a signature. def commonpath(paths: Sequence[_PathType]) -> Any: ... + elif sys.version_info >= (3, 5): def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... @@ -102,8 +104,10 @@ def commonprefix(list: Sequence[_PathType]) -> Any: ... if sys.version_info >= (3, 3): def exists(path: Union[_PathType, int]) -> bool: ... + else: def exists(path: _PathType) -> bool: ... + def lexists(path: _PathType) -> bool: ... # These return float if os.stat_float_times() == True, @@ -111,7 +115,6 @@ def lexists(path: _PathType) -> bool: ... def getatime(path: _PathType) -> float: ... def getmtime(path: _PathType) -> float: ... def getctime(path: _PathType) -> float: ... - def getsize(path: _PathType) -> int: ... def isabs(path: _PathType) -> bool: ... def isfile(path: _PathType) -> bool: ... @@ -134,12 +137,14 @@ if sys.version_info < (3, 0): def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ... @overload def join(__p1: Text, *p: _PathType) -> Text: ... + elif sys.version_info >= (3, 6): # Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway. @overload def join(path: _StrPath, *paths: _StrPath) -> Text: ... @overload def join(path: _BytesPath, *paths: _BytesPath) -> bytes: ... + else: def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ... @@ -147,7 +152,6 @@ else: def relpath(path: _BytesPath, start: Optional[_BytesPath] = ...) -> bytes: ... @overload def relpath(path: _StrPath, start: Optional[_StrPath] = ...) -> Text: ... - def samefile(path1: _PathType, path2: _PathType) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(stat1: os.stat_result, stat2: os.stat_result) -> bool: ... @@ -165,12 +169,13 @@ if sys.version_info >= (3, 6): def splitext(path: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... + else: def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -if sys.platform == 'win32': +if sys.platform == "win32": def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated if sys.version_info < (3,): diff --git a/stdlib/2/popen2.pyi b/stdlib/2/popen2.pyi index 113cbbc5bd14..a7b947cd9427 100644 --- a/stdlib/2/popen2.pyi +++ b/stdlib/2/popen2.pyi @@ -1,7 +1,6 @@ from typing import Any, Iterable, List, Optional, TextIO, Tuple, TypeVar, Union -_T = TypeVar('_T') - +_T = TypeVar("_T") class Popen3: sts: int diff --git a/stdlib/2/posix.pyi b/stdlib/2/posix.pyi index dce87df67e22..1618d019315f 100644 --- a/stdlib/2/posix.pyi +++ b/stdlib/2/posix.pyi @@ -113,8 +113,10 @@ def fdatasync(fd: int) -> None: ... def fdopen(fd: int, mode: str = ..., bufsize: int = ...) -> IO[str]: ... def fork() -> int: raise OSError() + def forkpty() -> Tuple[int, int]: raise OSError() + def fpathconf(fd: int, name: str) -> None: ... def fstat(fd: int) -> stat_result: ... def fstatvfs(fd: int) -> statvfs_result: ... @@ -128,6 +130,7 @@ def getgid() -> int: ... def getgroups() -> List[int]: ... def getloadavg() -> Tuple[float, float, float]: raise OSError() + def getlogin() -> str: ... def getpgid(pid: int) -> int: ... def getpgrp() -> int: ... @@ -143,7 +146,9 @@ def kill(pid: int, sig: int) -> None: ... def killpg(pgid: int, sig: int) -> None: ... def lchown(path: unicode, uid: int, gid: int) -> None: ... def link(source: unicode, link_name: str) -> None: ... + _T = TypeVar("_T") + def listdir(path: _T) -> List[_T]: ... def lseek(fd: int, pos: int, how: int) -> None: ... def lstat(path: unicode) -> stat_result: ... @@ -196,10 +201,14 @@ def unsetenv(varname: str) -> None: ... def urandom(n: int) -> str: ... def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None: raise OSError + def wait() -> int: ... + _r = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int] + def wait3(options: int) -> Tuple[int, int, _r]: ... def wait4(pid: int, options: int) -> Tuple[int, int, _r]: ... def waitpid(pid: int, options: int) -> int: raise OSError() + def write(fd: int, str: str) -> int: ... diff --git a/stdlib/2/random.pyi b/stdlib/2/random.pyi index 4bdcc51e2124..00c7705c414c 100644 --- a/stdlib/2/random.pyi +++ b/stdlib/2/random.pyi @@ -9,7 +9,7 @@ import _random from typing import AbstractSet, Any, Callable, List, Sequence, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") class Random(_random.Random): def __init__(self, x: object = ...) -> None: ... @@ -40,8 +40,7 @@ class Random(_random.Random): def weibullvariate(self, alpha: float, beta: float) -> float: ... # SystemRandom is not implemented for all OS's; good on Windows & Linux -class SystemRandom(Random): - ... +class SystemRandom(Random): ... # ----- random function stubs ----- def seed(x: object = ...) -> None: ... @@ -59,8 +58,7 @@ def shuffle(x: List[Any], random: Callable[[], float] = ...) -> None: ... def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ... def random() -> float: ... def uniform(a: float, b: float) -> float: ... -def triangular(low: float = ..., high: float = ..., - mode: float = ...) -> float: ... +def triangular(low: float = ..., high: float = ..., mode: float = ...) -> float: ... def betavariate(alpha: float, beta: float) -> float: ... def expovariate(lambd: float) -> float: ... def gammavariate(alpha: float, beta: float) -> float: ... diff --git a/stdlib/2/re.pyi b/stdlib/2/re.pyi index db265399e474..4048cda04ffa 100644 --- a/stdlib/2/re.pyi +++ b/stdlib/2/re.pyi @@ -44,24 +44,20 @@ class error(Exception): ... def compile(pattern: AnyStr, flags: int = ...) -> Pattern[AnyStr]: ... @overload def compile(pattern: Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ... - @overload def search(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ... @overload def search(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ... - @overload def match(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ... @overload def match(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ... - @overload -def split(pattern: Union[str, unicode], string: AnyStr, - maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ... +def split(pattern: Union[str, unicode], string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ... @overload -def split(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, - maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ... - +def split( + pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, maxsplit: int = ..., flags: int = ... +) -> List[AnyStr]: ... @overload def findall(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> List[Any]: ... @overload @@ -72,41 +68,47 @@ def findall(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flag # matches are returned in the order found. Empty matches are included in the # result unless they touch the beginning of another match. @overload -def finditer(pattern: Union[str, unicode], string: AnyStr, - flags: int = ...) -> Iterator[Match[AnyStr]]: ... +def finditer(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ... @overload -def finditer(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, - flags: int = ...) -> Iterator[Match[AnyStr]]: ... - +def finditer(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ... @overload -def sub(pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., - flags: int = ...) -> AnyStr: ... +def sub(pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ... @overload -def sub(pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ... +def sub( + pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ... +) -> AnyStr: ... @overload -def sub(pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., - flags: int = ...) -> AnyStr: ... +def sub( + pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ... +) -> AnyStr: ... @overload -def sub(pattern: Union[Pattern[str], Pattern[unicode]], repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ... - +def sub( + pattern: Union[Pattern[str], Pattern[unicode]], + repl: Callable[[Match[AnyStr]], AnyStr], + string: AnyStr, + count: int = ..., + flags: int = ..., +) -> AnyStr: ... @overload -def subn(pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., - flags: int = ...) -> Tuple[AnyStr, int]: ... +def subn( + pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ... +) -> Tuple[AnyStr, int]: ... @overload -def subn(pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, count: int = ..., - flags: int = ...) -> Tuple[AnyStr, int]: ... +def subn( + pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ... +) -> Tuple[AnyStr, int]: ... @overload -def subn(pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., - flags: int = ...) -> Tuple[AnyStr, int]: ... +def subn( + pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ... +) -> Tuple[AnyStr, int]: ... @overload -def subn(pattern: Union[Pattern[str], Pattern[unicode]], repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, count: int = ..., - flags: int = ...) -> Tuple[AnyStr, int]: ... - +def subn( + pattern: Union[Pattern[str], Pattern[unicode]], + repl: Callable[[Match[AnyStr]], AnyStr], + string: AnyStr, + count: int = ..., + flags: int = ..., +) -> Tuple[AnyStr, int]: ... def escape(string: AnyStr) -> AnyStr: ... - def purge() -> None: ... def template(pattern: Union[AnyStr, Pattern[AnyStr]], flags: int = ...) -> Pattern[AnyStr]: ... diff --git a/stdlib/2/repr.pyi b/stdlib/2/repr.pyi index ad89789e5a6c..5149f8b6945c 100644 --- a/stdlib/2/repr.pyi +++ b/stdlib/2/repr.pyi @@ -28,4 +28,5 @@ class Repr: def _possibly_sorted(x) -> list: ... aRepr: Repr + def repr(x) -> str: ... diff --git a/stdlib/2/resource.pyi b/stdlib/2/resource.pyi index df51f8f88f25..6a1dff4b4212 100644 --- a/stdlib/2/resource.pyi +++ b/stdlib/2/resource.pyi @@ -3,6 +3,7 @@ from typing import NamedTuple, Tuple class error(Exception): ... RLIM_INFINITY: int + def getrlimit(resource: int) -> Tuple[int, int]: ... def setrlimit(resource: int, limits: Tuple[int, int]) -> None: ... @@ -19,12 +20,28 @@ RLIMIT_MEMLOCK: int RLIMIT_VMEM: int RLIMIT_AS: int -_RUsage = NamedTuple('_RUsage', [('ru_utime', float), ('ru_stime', float), ('ru_maxrss', int), - ('ru_ixrss', int), ('ru_idrss', int), ('ru_isrss', int), - ('ru_minflt', int), ('ru_majflt', int), ('ru_nswap', int), - ('ru_inblock', int), ('ru_oublock', int), ('ru_msgsnd', int), - ('ru_msgrcv', int), ('ru_nsignals', int), ('ru_nvcsw', int), - ('ru_nivcsw', int)]) +_RUsage = NamedTuple( + "_RUsage", + [ + ("ru_utime", float), + ("ru_stime", float), + ("ru_maxrss", int), + ("ru_ixrss", int), + ("ru_idrss", int), + ("ru_isrss", int), + ("ru_minflt", int), + ("ru_majflt", int), + ("ru_nswap", int), + ("ru_inblock", int), + ("ru_oublock", int), + ("ru_msgsnd", int), + ("ru_msgrcv", int), + ("ru_nsignals", int), + ("ru_nvcsw", int), + ("ru_nivcsw", int), + ], +) + def getrusage(who: int) -> _RUsage: ... def getpagesize() -> int: ... diff --git a/stdlib/2/sets.pyi b/stdlib/2/sets.pyi index a68994f2f2b6..994f7ed136fb 100644 --- a/stdlib/2/sets.pyi +++ b/stdlib/2/sets.pyi @@ -1,9 +1,9 @@ # Stubs for sets (Python 2) from typing import Any, Callable, Hashable, Iterable, Iterator, MutableMapping, Optional, TypeVar, Union -_T = TypeVar('_T') +_T = TypeVar("_T") _Setlike = Union[BaseSet[_T], Iterable[_T]] -_SelfT = TypeVar('_SelfT', bound=BaseSet) +_SelfT = TypeVar("_SelfT", bound=BaseSet) class BaseSet(Iterable[_T]): def __init__(self) -> None: ... diff --git a/stdlib/2/sha.pyi b/stdlib/2/sha.pyi index f1606fa8d69f..d3db96e9e99b 100644 --- a/stdlib/2/sha.pyi +++ b/stdlib/2/sha.pyi @@ -7,5 +7,6 @@ class sha(object): def copy(self) -> sha: ... def new(string: str = ...) -> sha: ... + blocksize = 0 digest_size = 0 diff --git a/stdlib/2/shelve.pyi b/stdlib/2/shelve.pyi index 61271b363431..46748dbf46fe 100644 --- a/stdlib/2/shelve.pyi +++ b/stdlib/2/shelve.pyi @@ -2,7 +2,9 @@ import collections from typing import Any, Dict, Iterator, List, Optional, Tuple class Shelf(collections.MutableMapping): - def __init__(self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ... + def __init__( + self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ... + ) -> None: ... def __iter__(self) -> Iterator[str]: ... def keys(self) -> List[Any]: ... def __len__(self) -> int: ... @@ -19,7 +21,9 @@ class Shelf(collections.MutableMapping): def sync(self) -> None: ... class BsdDbShelf(Shelf): - def __init__(self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ... + def __init__( + self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ... + ) -> None: ... def set_location(self, key: Any) -> Tuple[str, Any]: ... def next(self) -> Tuple[str, Any]: ... def previous(self) -> Tuple[str, Any]: ... diff --git a/stdlib/2/shlex.pyi b/stdlib/2/shlex.pyi index b78994da3cb1..cbe43db99194 100644 --- a/stdlib/2/shlex.pyi +++ b/stdlib/2/shlex.pyi @@ -2,7 +2,7 @@ from typing import IO, Any, List, Optional, TypeVar def split(s: Optional[str], comments: bool = ..., posix: bool = ...) -> List[str]: ... -_SLT = TypeVar('_SLT', bound=shlex) +_SLT = TypeVar("_SLT", bound=shlex) class shlex: def __init__(self, instream: IO[Any] = ..., infile: IO[Any] = ..., posix: bool = ...) -> None: ... @@ -14,7 +14,6 @@ class shlex: def push_source(self, stream: IO[Any], filename: str = ...) -> None: ... def pop_source(self) -> IO[Any]: ... def error_leader(self, file: str = ..., line: int = ...) -> str: ... - commenters: str wordchars: str whitespace: str diff --git a/stdlib/2/signal.pyi b/stdlib/2/signal.pyi index 387c9237b4b5..895d84594da0 100644 --- a/stdlib/2/signal.pyi +++ b/stdlib/2/signal.pyi @@ -65,7 +65,9 @@ def getitimer(which: int) -> Tuple[float, float]: ... def set_wakeup_fd(fd: int) -> int: ... def siginterrupt(signalnum: int, flag: bool) -> None: raise RuntimeError() + def signal(signalnum: int, handler: _HANDLER) -> _HANDLER: raise RuntimeError() + def default_int_handler(signum: int, frame: FrameType) -> None: raise KeyboardInterrupt() diff --git a/stdlib/2/spwd.pyi b/stdlib/2/spwd.pyi index 1d5899031919..bb87299cbc8e 100644 --- a/stdlib/2/spwd.pyi +++ b/stdlib/2/spwd.pyi @@ -1,14 +1,19 @@ from typing import List, NamedTuple -struct_spwd = NamedTuple("struct_spwd", [("sp_nam", str), - ("sp_pwd", str), - ("sp_lstchg", int), - ("sp_min", int), - ("sp_max", int), - ("sp_warn", int), - ("sp_inact", int), - ("sp_expire", int), - ("sp_flag", int)]) +struct_spwd = NamedTuple( + "struct_spwd", + [ + ("sp_nam", str), + ("sp_pwd", str), + ("sp_lstchg", int), + ("sp_min", int), + ("sp_max", int), + ("sp_warn", int), + ("sp_inact", int), + ("sp_expire", int), + ("sp_flag", int), + ], +) def getspall() -> List[struct_spwd]: ... def getspnam(name: str) -> struct_spwd: ... diff --git a/stdlib/2/sre_constants.pyi b/stdlib/2/sre_constants.pyi index 89d453ea22da..6e113fa9e5d5 100644 --- a/stdlib/2/sre_constants.pyi +++ b/stdlib/2/sre_constants.pyi @@ -72,7 +72,8 @@ CATEGORY_UNI_NOT_WORD: str CATEGORY_UNI_LINEBREAK: str CATEGORY_UNI_NOT_LINEBREAK: str -_T = TypeVar('_T') +_T = TypeVar("_T") + def makedict(list: List[_T]) -> Dict[_T, int]: ... OP_IGNORE: Dict[str, str] diff --git a/stdlib/2/sre_parse.pyi b/stdlib/2/sre_parse.pyi index baebf65f709e..636ffcaf8db7 100644 --- a/stdlib/2/sre_parse.pyi +++ b/stdlib/2/sre_parse.pyi @@ -25,7 +25,6 @@ class Pattern: def closegroup(self, gid: int) -> None: ... def checkgroup(self, gid: int) -> bool: ... - _OpSubpatternType = Tuple[Optional[int], int, int, SubPattern] _OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern] _OpInType = List[Tuple[str, int]] @@ -60,6 +59,8 @@ def isident(char: str) -> bool: ... def isdigit(char: str) -> bool: ... def isname(name: str) -> bool: ... def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ... + _Template = Tuple[List[Tuple[int, int]], List[Optional[int]]] + def parse_template(source: str, pattern: _Pattern) -> _Template: ... def expand_template(template: _Template, match: Match) -> str: ... diff --git a/stdlib/2/stat.pyi b/stdlib/2/stat.pyi index dd3418db9c45..eeeaeb5071af 100644 --- a/stdlib/2/stat.pyi +++ b/stdlib/2/stat.pyi @@ -5,7 +5,6 @@ def S_ISREG(mode: int) -> bool: ... def S_ISFIFO(mode: int) -> bool: ... def S_ISLNK(mode: int) -> bool: ... def S_ISSOCK(mode: int) -> bool: ... - def S_IMODE(mode: int) -> int: ... def S_IFMT(mode: int) -> int: ... diff --git a/stdlib/2/string.pyi b/stdlib/2/string.pyi index 9a68445c14ad..912c2ca6052e 100644 --- a/stdlib/2/string.pyi +++ b/stdlib/2/string.pyi @@ -18,6 +18,7 @@ uppercase: str whitespace: str def capwords(s: AnyStr, sep: AnyStr = ...) -> AnyStr: ... + # TODO: originally named 'from' def maketrans(_from: str, to: str) -> str: ... def atof(s: unicode) -> float: ... @@ -49,7 +50,6 @@ def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = ...) -> AnySt class Template: template: Text - def __init__(self, template: Text) -> None: ... @overload def substitute(self, mapping: Union[Mapping[str, str], Mapping[unicode, str]] = ..., **kwds: str) -> str: ... @@ -63,16 +63,12 @@ class Template: # TODO(MichalPokorny): This is probably badly and/or loosely typed. class Formatter(object): def format(self, format_string: str, *args, **kwargs) -> str: ... - def vformat(self, format_string: str, args: Sequence[Any], - kwargs: Mapping[str, Any]) -> str: ... + def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ... def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ... - def get_field(self, field_name: str, args: Sequence[Any], - kwargs: Mapping[str, Any]) -> Any: ... - def get_value(self, key: Union[int, str], args: Sequence[Any], - kwargs: Mapping[str, Any]) -> Any: + def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ... + def get_value(self, key: Union[int, str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: raise IndexError() raise KeyError() - def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any], - kwargs: Mapping[str, Any]) -> None: ... + def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ... def format_field(self, value: Any, format_spec: str) -> Any: ... def convert_field(self, value: Any, conversion: str) -> Any: ... diff --git a/stdlib/2/stringold.pyi b/stdlib/2/stringold.pyi index ab3e764ed213..ae592af64a9e 100644 --- a/stdlib/2/stringold.pyi +++ b/stdlib/2/stringold.pyi @@ -15,7 +15,6 @@ atoi_error = ValueError atof_error = ValueError atol_error = ValueError - def lower(s: AnyStr) -> AnyStr: ... def upper(s: AnyStr) -> AnyStr: ... def swapcase(s: AnyStr) -> AnyStr: ... diff --git a/stdlib/2/strop.pyi b/stdlib/2/strop.pyi index e1a098fe503c..d7e2cf9826ec 100644 --- a/stdlib/2/strop.pyi +++ b/stdlib/2/strop.pyi @@ -43,7 +43,6 @@ def lstrip(s: str) -> str: raise DeprecationWarning() def maketrans(frm: str, to: str) -> str: ... - def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str: raise DeprecationWarning() diff --git a/stdlib/2/subprocess.pyi b/stdlib/2/subprocess.pyi index 39e86b13cda9..c7ababb5189d 100644 --- a/stdlib/2/subprocess.pyi +++ b/stdlib/2/subprocess.pyi @@ -10,50 +10,55 @@ _CMD = Union[_TXT, Sequence[_TXT]] _ENV = Union[Mapping[bytes, _TXT], Mapping[Text, _TXT]] # Same args as Popen.__init__ -def call(args: _CMD, - bufsize: int = ..., - executable: _TXT = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: _TXT = ..., - env: _ENV = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ...) -> int: ... - -def check_call(args: _CMD, - bufsize: int = ..., - executable: _TXT = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: _TXT = ..., - env: _ENV = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ...) -> int: ... +def call( + args: _CMD, + bufsize: int = ..., + executable: _TXT = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: _TXT = ..., + env: _ENV = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., +) -> int: ... +def check_call( + args: _CMD, + bufsize: int = ..., + executable: _TXT = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: _TXT = ..., + env: _ENV = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., +) -> int: ... # Same args as Popen.__init__ except for stdout -def check_output(args: _CMD, - bufsize: int = ..., - executable: _TXT = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: _TXT = ..., - env: _ENV = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ...) -> bytes: ... +def check_output( + args: _CMD, + bufsize: int = ..., + executable: _TXT = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: _TXT = ..., + env: _ENV = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., +) -> bytes: ... PIPE: int STDOUT: int @@ -64,11 +69,7 @@ class CalledProcessError(Exception): cmd: Any # morally: Optional[bytes] output: Any - - def __init__(self, - returncode: int, - cmd: _CMD, - output: Optional[bytes] = ...) -> None: ... + def __init__(self, returncode: int, cmd: _CMD, output: Optional[bytes] = ...) -> None: ... class Popen: stdin: Optional[IO[Any]] @@ -76,23 +77,23 @@ class Popen: stderr: Optional[IO[Any]] pid = 0 returncode = 0 - - def __init__(self, - args: _CMD, - bufsize: int = ..., - executable: Optional[_TXT] = ..., - stdin: Optional[_FILE] = ..., - stdout: Optional[_FILE] = ..., - stderr: Optional[_FILE] = ..., - preexec_fn: Optional[Callable[[], Any]] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_TXT] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Optional[Any] = ..., - creationflags: int = ...) -> None: ... - + def __init__( + self, + args: _CMD, + bufsize: int = ..., + executable: Optional[_TXT] = ..., + stdin: Optional[_FILE] = ..., + stdout: Optional[_FILE] = ..., + stderr: Optional[_FILE] = ..., + preexec_fn: Optional[Callable[[], Any]] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_TXT] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Optional[Any] = ..., + creationflags: int = ..., + ) -> None: ... def poll(self) -> int: ... def wait(self) -> int: ... # morally: -> Tuple[Optional[bytes], Optional[bytes]] diff --git a/stdlib/2/sys.pyi b/stdlib/2/sys.pyi index f9dfea6a3be7..39da1c2b5c09 100644 --- a/stdlib/2/sys.pyi +++ b/stdlib/2/sys.pyi @@ -104,7 +104,6 @@ class _WindowsVersionType: product_type: Any def getwindowsversion() -> _WindowsVersionType: ... - def _clear_type_cache() -> None: ... def _current_frames() -> Dict[int, FrameType]: ... def _getframe(depth: int = ...) -> FrameType: ... @@ -113,11 +112,13 @@ def __displayhook__(value: int) -> None: ... def __excepthook__(type_: type, value: BaseException, traceback: TracebackType) -> None: ... def exc_clear() -> None: raise DeprecationWarning() + def exc_info() -> _OptExcInfo: ... # sys.exit() accepts an optional argument of anything printable def exit(arg: Any = ...) -> NoReturn: raise SystemExit() + def getcheckinterval() -> int: ... # deprecated def getdefaultencoding() -> str: ... def getdlopenflags() -> int: ... diff --git a/stdlib/2/tempfile.pyi b/stdlib/2/tempfile.pyi index a92c0717c507..28124d23edc6 100644 --- a/stdlib/2/tempfile.pyi +++ b/stdlib/2/tempfile.pyi @@ -48,7 +48,6 @@ class _TemporaryFileWrapper(IO[str]): def write(self, s: Text) -> int: ... def writelines(self, lines: Iterable[str]) -> None: ... - # TODO text files def TemporaryFile( @@ -56,36 +55,30 @@ def TemporaryFile( bufsize: int = ..., suffix: Union[bytes, unicode] = ..., prefix: Union[bytes, unicode] = ..., - dir: Union[bytes, unicode] = ... -) -> _TemporaryFileWrapper: - ... - + dir: Union[bytes, unicode] = ..., +) -> _TemporaryFileWrapper: ... def NamedTemporaryFile( mode: Union[bytes, unicode] = ..., bufsize: int = ..., suffix: Union[bytes, unicode] = ..., prefix: Union[bytes, unicode] = ..., dir: Union[bytes, unicode] = ..., - delete: bool = ... -) -> _TemporaryFileWrapper: - ... - + delete: bool = ..., +) -> _TemporaryFileWrapper: ... def SpooledTemporaryFile( max_size: int = ..., mode: Union[bytes, unicode] = ..., buffering: int = ..., suffix: Union[bytes, unicode] = ..., prefix: Union[bytes, unicode] = ..., - dir: Union[bytes, unicode] = ... -) -> _TemporaryFileWrapper: - ... + dir: Union[bytes, unicode] = ..., +) -> _TemporaryFileWrapper: ... class TemporaryDirectory: name: Any - def __init__(self, - suffix: Union[bytes, unicode] = ..., - prefix: Union[bytes, unicode] = ..., - dir: Union[bytes, unicode] = ...) -> None: ... + def __init__( + self, suffix: Union[bytes, unicode] = ..., prefix: Union[bytes, unicode] = ..., dir: Union[bytes, unicode] = ... + ) -> None: ... def cleanup(self) -> None: ... def __enter__(self) -> Any: ... # Can be str or unicode def __exit__(self, type, value, traceback) -> bool: ... @@ -93,8 +86,7 @@ class TemporaryDirectory: @overload def mkstemp() -> Tuple[int, str]: ... @overload -def mkstemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: Optional[AnyStr] = ..., - text: bool = ...) -> Tuple[int, AnyStr]: ... +def mkstemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: Optional[AnyStr] = ..., text: bool = ...) -> Tuple[int, AnyStr]: ... @overload def mkdtemp() -> str: ... @overload @@ -105,7 +97,6 @@ def mktemp() -> str: ... def mktemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: Optional[AnyStr] = ...) -> AnyStr: ... def gettempdir() -> str: ... def gettempprefix() -> str: ... - def _candidate_tempdir_list() -> List[str]: ... def _get_candidate_names() -> Optional[_RandomNameSequence]: ... def _get_default_tempdir() -> str: ... diff --git a/stdlib/2/textwrap.pyi b/stdlib/2/textwrap.pyi index 83c36aa88510..c4147b4bd538 100644 --- a/stdlib/2/textwrap.pyi +++ b/stdlib/2/textwrap.pyi @@ -19,43 +19,43 @@ class TextWrapper(object): unicode_whitespace_trans: Dict[int, int] = ... uspace: int = ... x: int = ... - def __init__( - self, - width: int = ..., - initial_indent: str = ..., - subsequent_indent: str = ..., - expand_tabs: bool = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - drop_whitespace: bool = ..., - break_on_hyphens: bool = ...) -> None: - ... - + self, + width: int = ..., + initial_indent: str = ..., + subsequent_indent: str = ..., + expand_tabs: bool = ..., + replace_whitespace: bool = ..., + fix_sentence_endings: bool = ..., + break_long_words: bool = ..., + drop_whitespace: bool = ..., + break_on_hyphens: bool = ..., + ) -> None: ... def wrap(self, text: AnyStr) -> List[AnyStr]: ... def fill(self, text: AnyStr) -> AnyStr: ... -def wrap(text: AnyStr, - width: int = ..., - initial_indent: AnyStr = ..., - subsequent_indent: AnyStr = ..., - expand_tabs: bool = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - drop_whitespace: bool = ..., - break_on_hyphens: bool = ...) -> List[AnyStr]: ... - -def fill(text: AnyStr, - width: int = ..., - initial_indent: AnyStr = ..., - subsequent_indent: AnyStr = ..., - expand_tabs: bool = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - drop_whitespace: bool = ..., - break_on_hyphens: bool = ...) -> AnyStr: ... - +def wrap( + text: AnyStr, + width: int = ..., + initial_indent: AnyStr = ..., + subsequent_indent: AnyStr = ..., + expand_tabs: bool = ..., + replace_whitespace: bool = ..., + fix_sentence_endings: bool = ..., + break_long_words: bool = ..., + drop_whitespace: bool = ..., + break_on_hyphens: bool = ..., +) -> List[AnyStr]: ... +def fill( + text: AnyStr, + width: int = ..., + initial_indent: AnyStr = ..., + subsequent_indent: AnyStr = ..., + expand_tabs: bool = ..., + replace_whitespace: bool = ..., + fix_sentence_endings: bool = ..., + break_long_words: bool = ..., + drop_whitespace: bool = ..., + break_on_hyphens: bool = ..., +) -> AnyStr: ... def dedent(text: AnyStr) -> AnyStr: ... diff --git a/stdlib/2/thread.pyi b/stdlib/2/thread.pyi index d36635286290..062883aadd8f 100644 --- a/stdlib/2/thread.pyi +++ b/stdlib/2/thread.pyi @@ -23,8 +23,10 @@ def start_new_thread(function: Callable[..., Any], args: Any, kwargs: Any = ...) def interrupt_main() -> None: ... def exit() -> None: raise SystemExit() + def exit_thread() -> Any: raise SystemExit() + def allocate_lock() -> LockType: ... def get_ident() -> int: ... def stack_size(size: int = ...) -> int: ... diff --git a/stdlib/2/tokenize.pyi b/stdlib/2/tokenize.pyi index 21570647760f..c77a81abe9f7 100644 --- a/stdlib/2/tokenize.pyi +++ b/stdlib/2/tokenize.pyi @@ -123,7 +123,6 @@ def tokenize_loop(readline: Callable[[], str], tokeneater: Callable[[Tuple[int, def untokenize(iterable: Iterable[_TokenType]) -> str: ... class StopTokenizing(Exception): ... - class TokenError(Exception): ... class Untokenizer: diff --git a/stdlib/2/types.pyi b/stdlib/2/types.pyi index 0843e4abbc24..130cb3fb8e3e 100644 --- a/stdlib/2/types.pyi +++ b/stdlib/2/types.pyi @@ -3,9 +3,10 @@ from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Type, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") class NoneType: ... + TypeType = type ObjectType = object @@ -40,7 +41,14 @@ class FunctionType: __dict__ = func_dict __globals__ = func_globals __name__ = func_name - def __init__(self, code: CodeType, globals: Dict[str, Any], name: Optional[str] = ..., argdefs: Optional[Tuple[object, ...]] = ..., closure: Optional[Tuple[_Cell, ...]] = ...) -> None: ... + def __init__( + self, + code: CodeType, + globals: Dict[str, Any], + name: Optional[str] = ..., + argdefs: Optional[Tuple[object, ...]] = ..., + closure: Optional[Tuple[_Cell, ...]] = ..., + ) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def __get__(self, obj: Optional[object], type: Optional[type]) -> UnboundMethodType: ... @@ -93,6 +101,7 @@ class GeneratorType: def throw(self, typ: type, val: BaseException = ..., tb: TracebackType = ...) -> Any: ... class ClassType: ... + class UnboundMethodType: im_class: type = ... im_func: FunctionType = ... @@ -110,6 +119,7 @@ MethodType = UnboundMethodType class BuiltinFunctionType: __self__: Optional[object] def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + BuiltinMethodType = BuiltinFunctionType class ModuleType: @@ -120,6 +130,7 @@ class ModuleType: __path__: Optional[Iterable[str]] __dict__: Dict[str, Any] def __init__(self, name: str, doc: Optional[str] = ...) -> None: ... + FileType = file XRangeType = xrange @@ -142,10 +153,10 @@ class FrameType: f_locals: Dict[str, Any] f_restricted: bool f_trace: Callable[[], None] - def clear(self) -> None: ... SliceType = slice + class EllipsisType: ... class DictProxyType: @@ -173,6 +184,7 @@ class GetSetDescriptorType: def __get__(self, obj: Any, type: type = ...) -> Any: ... def __set__(self, obj: Any) -> None: ... def __delete__(self, obj: Any) -> None: ... + # Same type on Jython, different on CPython and PyPy, unknown on IronPython. class MemberDescriptorType: __name__: str diff --git a/stdlib/2/typing.pyi b/stdlib/2/typing.pyi index c87ea030c207..23638b3a98dd 100644 --- a/stdlib/2/typing.pyi +++ b/stdlib/2/typing.pyi @@ -48,25 +48,24 @@ Counter = TypeAlias(object) Deque = TypeAlias(object) # Predefined type variables. -AnyStr = TypeVar('AnyStr', str, unicode) +AnyStr = TypeVar("AnyStr", str, unicode) # Abstract base classes. # These type variables are used by the container types. -_T = TypeVar('_T') -_S = TypeVar('_S') -_KT = TypeVar('_KT') # Key type. -_VT = TypeVar('_VT') # Value type. -_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers. -_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers. -_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers. -_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers. -_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant. -_TC = TypeVar('_TC', bound=Type[object]) +_T = TypeVar("_T") +_S = TypeVar("_S") +_KT = TypeVar("_KT") # Key type. +_VT = TypeVar("_VT") # Value type. +_T_co = TypeVar("_T_co", covariant=True) # Any type covariant containers. +_V_co = TypeVar("_V_co", covariant=True) # Any type covariant containers. +_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers. +_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. +_T_contra = TypeVar("_T_contra", contravariant=True) # Ditto contravariant. +_TC = TypeVar("_TC", bound=Type[object]) _C = TypeVar("_C", bound=Callable) def runtime(cls: _TC) -> _TC: ... - @runtime class SupportsInt(Protocol, metaclass=ABCMeta): @abstractmethod @@ -119,13 +118,10 @@ class Iterator(Iterable[_T_co], Protocol[_T_co]): class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]): @abstractmethod def next(self) -> _T_co: ... - @abstractmethod def send(self, value: _T_contra) -> _T_co: ... - @abstractmethod - def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ..., - tb: TracebackType = ...) -> _T_co: ... + def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ..., tb: TracebackType = ...) -> _T_co: ... @abstractmethod def close(self) -> None: ... @property @@ -204,7 +200,6 @@ class AbstractSet(Iterable[_T_co], Container[_T_co], Generic[_T_co]): @abstractmethod def __len__(self) -> int: ... - class MutableSet(AbstractSet[_T], Generic[_T]): @abstractmethod def add(self, x: _T) -> None: ... @@ -237,16 +232,18 @@ class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]): @runtime class ContextManager(Protocol[_T_co]): def __enter__(self) -> _T_co: ... - def __exit__(self, __exc_type: Optional[Type[BaseException]], - __exc_value: Optional[BaseException], - __traceback: Optional[TracebackType]) -> Optional[bool]: ... + def __exit__( + self, + __exc_type: Optional[Type[BaseException]], + __exc_value: Optional[BaseException], + __traceback: Optional[TracebackType], + ) -> Optional[bool]: ... class Mapping(Iterable[_KT], Container[_KT], Generic[_KT, _VT_co]): # TODO: We wish the key type could also be covariant, but that doesn't work, # see discussion in https: //github.com/python/typing/pull/273. @abstractmethod - def __getitem__(self, k: _KT) -> _VT_co: - ... + def __getitem__(self, k: _KT) -> _VT_co: ... # Mixin methods @overload def get(self, k: _KT) -> Optional[_VT_co]: ... @@ -268,7 +265,6 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): def __setitem__(self, k: _KT, v: _VT) -> None: ... @abstractmethod def __delitem__(self, v: _KT) -> None: ... - def clear(self) -> None: ... @overload def pop(self, k: _KT) -> _VT: ... @@ -328,7 +324,6 @@ class IO(Iterator[AnyStr], Generic[AnyStr]): def write(self, s: AnyStr) -> int: ... @abstractmethod def writelines(self, lines: Iterable[AnyStr]) -> None: ... - @abstractmethod def next(self) -> AnyStr: ... @abstractmethod @@ -336,8 +331,9 @@ class IO(Iterator[AnyStr], Generic[AnyStr]): @abstractmethod def __enter__(self) -> IO[AnyStr]: ... @abstractmethod - def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], - traceback: Optional[TracebackType]) -> bool: ... + def __exit__( + self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType] + ) -> bool: ... class BinaryIO(IO[str]): # TODO readinto @@ -379,20 +375,15 @@ class Match(Generic[AnyStr]): # Can be None if there are no groups or if the last group was unnamed; # otherwise matches the type of the pattern. lastgroup: Optional[Any] - def expand(self, template: Union[str, Text]) -> Any: ... - @overload def group(self, group1: int = ...) -> AnyStr: ... @overload def group(self, group1: str) -> AnyStr: ... @overload - def group(self, group1: int, group2: int, - *groups: int) -> Tuple[AnyStr, ...]: ... + def group(self, group1: int, group2: int, *groups: int) -> Tuple[AnyStr, ...]: ... @overload - def group(self, group1: str, group2: str, - *groups: str) -> Tuple[AnyStr, ...]: ... - + def group(self, group1: str, group2: str, *groups: str) -> Tuple[AnyStr, ...]: ... def groups(self, default: AnyStr = ...) -> Tuple[AnyStr, ...]: ... def groupdict(self, default: AnyStr = ...) -> Dict[str, AnyStr]: ... def start(self, group: Union[int, str] = ...) -> int: ... @@ -403,45 +394,34 @@ class Match(Generic[AnyStr]): # Pattern is generic over AnyStr (determining the type of its .pattern # attribute), but at the same time its methods take either bytes or # Text and return the same type, regardless of the type of the pattern. -_AnyStr2 = TypeVar('_AnyStr2', bytes, Text) +_AnyStr2 = TypeVar("_AnyStr2", bytes, Text) class Pattern(Generic[AnyStr]): flags: int groupindex: Dict[AnyStr, int] groups: int pattern: AnyStr - - def search(self, string: _AnyStr2, pos: int = ..., - endpos: int = ...) -> Optional[Match[_AnyStr2]]: ... - def match(self, string: _AnyStr2, pos: int = ..., - endpos: int = ...) -> Optional[Match[_AnyStr2]]: ... + def search(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Optional[Match[_AnyStr2]]: ... + def match(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Optional[Match[_AnyStr2]]: ... def split(self, string: _AnyStr2, maxsplit: int = ...) -> List[_AnyStr2]: ... # Returns either a list of _AnyStr2 or a list of tuples, depending on # whether there are groups in the pattern. - def findall(self, string: Union[bytes, Text], pos: int = ..., - endpos: int = ...) -> List[Any]: ... - def finditer(self, string: _AnyStr2, pos: int = ..., - endpos: int = ...) -> Iterator[Match[_AnyStr2]]: ... - + def findall(self, string: Union[bytes, Text], pos: int = ..., endpos: int = ...) -> List[Any]: ... + def finditer(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Iterator[Match[_AnyStr2]]: ... @overload - def sub(self, repl: _AnyStr2, string: _AnyStr2, - count: int = ...) -> _AnyStr2: ... + def sub(self, repl: _AnyStr2, string: _AnyStr2, count: int = ...) -> _AnyStr2: ... @overload - def sub(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2, - count: int = ...) -> _AnyStr2: ... - + def sub(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2, count: int = ...) -> _AnyStr2: ... @overload - def subn(self, repl: _AnyStr2, string: _AnyStr2, - count: int = ...) -> Tuple[_AnyStr2, int]: ... + def subn(self, repl: _AnyStr2, string: _AnyStr2, count: int = ...) -> Tuple[_AnyStr2, int]: ... @overload - def subn(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2, - count: int = ...) -> Tuple[_AnyStr2, int]: ... + def subn(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2, count: int = ...) -> Tuple[_AnyStr2, int]: ... # Functions -def get_type_hints(obj: Callable, globalns: Optional[dict[Text, Any]] = ..., - localns: Optional[dict[Text, Any]] = ...) -> None: ... - +def get_type_hints( + obj: Callable, globalns: Optional[dict[Text, Any]] = ..., localns: Optional[dict[Text, Any]] = ... +) -> None: ... @overload def cast(tp: Type[_T], obj: Any) -> _T: ... @overload @@ -452,13 +432,11 @@ def cast(tp: str, obj: Any) -> Any: ... # NamedTuple is special-cased in the type checker class NamedTuple(tuple): _fields: Tuple[str, ...] - - def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ..., *, - verbose: bool = ..., rename: bool = ..., **kwargs: Any) -> None: ... - + def __init__( + self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ..., *, verbose: bool = ..., rename: bool = ..., **kwargs: Any + ) -> None: ... @classmethod def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ... - def _asdict(self) -> dict: ... def _replace(self: _T, **kwargs: Any) -> _T: ... diff --git a/stdlib/2/unittest.pyi b/stdlib/2/unittest.pyi index 51515aa23117..28d4a53df773 100644 --- a/stdlib/2/unittest.pyi +++ b/stdlib/2/unittest.pyi @@ -26,8 +26,8 @@ from typing import ( overload, ) -_T = TypeVar('_T') -_FT = TypeVar('_FT') +_T = TypeVar("_T") +_FT = TypeVar("_FT") _ExceptionType = Union[Type[BaseException], Tuple[Type[BaseException], ...]] _Regexp = Union[Text, Pattern[Text]] @@ -52,7 +52,6 @@ class TestResult: testsRun: int buffer: bool failfast: bool - def wasSuccessful(self) -> bool: ... def stop(self) -> None: ... def startTest(self, test: Testable) -> None: ... @@ -95,73 +94,54 @@ class TestCase(Testable): def assert_(self, expr: Any, msg: object = ...) -> None: ... def failUnless(self, expr: Any, msg: object = ...) -> None: ... def assertTrue(self, expr: Any, msg: object = ...) -> None: ... - def assertEqual(self, first: Any, second: Any, - msg: object = ...) -> None: ... - def assertEquals(self, first: Any, second: Any, - msg: object = ...) -> None: ... - def failUnlessEqual(self, first: Any, second: Any, - msg: object = ...) -> None: ... - def assertNotEqual(self, first: Any, second: Any, - msg: object = ...) -> None: ... - def assertNotEquals(self, first: Any, second: Any, - msg: object = ...) -> None: ... - def failIfEqual(self, first: Any, second: Any, - msg: object = ...) -> None: ... + def assertEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... + def assertEquals(self, first: Any, second: Any, msg: object = ...) -> None: ... + def failUnlessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... + def assertNotEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... + def assertNotEquals(self, first: Any, second: Any, msg: object = ...) -> None: ... + def failIfEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... @overload - def assertAlmostEqual(self, first: float, second: float, - places: int = ..., msg: Any = ...) -> None: ... + def assertAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... @overload - def assertAlmostEqual(self, first: float, second: float, *, - msg: Any = ..., delta: float = ...) -> None: ... + def assertAlmostEqual(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... @overload - def assertAlmostEquals(self, first: float, second: float, - places: int = ..., msg: Any = ...) -> None: ... + def assertAlmostEquals(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... @overload - def assertAlmostEquals(self, first: float, second: float, *, - msg: Any = ..., delta: float = ...) -> None: ... - def failUnlessAlmostEqual(self, first: float, second: float, places: int = ..., - msg: object = ...) -> None: ... + def assertAlmostEquals(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... + def failUnlessAlmostEqual(self, first: float, second: float, places: int = ..., msg: object = ...) -> None: ... @overload - def assertNotAlmostEqual(self, first: float, second: float, - places: int = ..., msg: Any = ...) -> None: ... + def assertNotAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... @overload - def assertNotAlmostEqual(self, first: float, second: float, *, - msg: Any = ..., delta: float = ...) -> None: ... + def assertNotAlmostEqual(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... @overload - def assertNotAlmostEquals(self, first: float, second: float, - places: int = ..., msg: Any = ...) -> None: ... + def assertNotAlmostEquals(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... @overload - def assertNotAlmostEquals(self, first: float, second: float, *, - msg: Any = ..., delta: float = ...) -> None: ... - def failIfAlmostEqual(self, first: float, second: float, places: int = ..., - msg: object = ..., - delta: float = ...) -> None: ... - def assertGreater(self, first: Any, second: Any, - msg: object = ...) -> None: ... - def assertGreaterEqual(self, first: Any, second: Any, - msg: object = ...) -> None: ... - def assertMultiLineEqual(self, first: str, second: str, - msg: object = ...) -> None: ... - def assertSequenceEqual(self, first: Sequence[Any], second: Sequence[Any], - msg: object = ..., seq_type: type = ...) -> None: ... - def assertListEqual(self, first: List[Any], second: List[Any], - msg: object = ...) -> None: ... - def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], - msg: object = ...) -> None: ... - def assertSetEqual(self, first: Union[Set[Any], FrozenSet[Any]], - second: Union[Set[Any], FrozenSet[Any]], msg: object = ...) -> None: ... - def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], - msg: object = ...) -> None: ... - def assertLess(self, first: Any, second: Any, - msg: object = ...) -> None: ... - def assertLessEqual(self, first: Any, second: Any, - msg: object = ...) -> None: ... + def assertNotAlmostEquals(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... + def failIfAlmostEqual( + self, first: float, second: float, places: int = ..., msg: object = ..., delta: float = ... + ) -> None: ... + def assertGreater(self, first: Any, second: Any, msg: object = ...) -> None: ... + def assertGreaterEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... + def assertMultiLineEqual(self, first: str, second: str, msg: object = ...) -> None: ... + def assertSequenceEqual( + self, first: Sequence[Any], second: Sequence[Any], msg: object = ..., seq_type: type = ... + ) -> None: ... + def assertListEqual(self, first: List[Any], second: List[Any], msg: object = ...) -> None: ... + def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], msg: object = ...) -> None: ... + def assertSetEqual( + self, first: Union[Set[Any], FrozenSet[Any]], second: Union[Set[Any], FrozenSet[Any]], msg: object = ... + ) -> None: ... + def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], msg: object = ...) -> None: ... + def assertLess(self, first: Any, second: Any, msg: object = ...) -> None: ... + def assertLessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ... @overload def assertRaises(self, exception: _ExceptionType, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... @overload def assertRaises(self, exception: _ExceptionType) -> _AssertRaisesContext: ... @overload - def assertRaisesRegexp(self, exception: _ExceptionType, regexp: _Regexp, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... + def assertRaisesRegexp( + self, exception: _ExceptionType, regexp: _Regexp, callable: Callable[..., Any], *args: Any, **kwargs: Any + ) -> None: ... @overload def assertRaisesRegexp(self, exception: _ExceptionType, regexp: _Regexp) -> _AssertRaisesContext: ... def assertRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ... @@ -175,20 +155,14 @@ class TestCase(Testable): def failUnlessRaises(self, exception: _ExceptionType) -> _AssertRaisesContext: ... def failIf(self, expr: Any, msg: object = ...) -> None: ... def assertFalse(self, expr: Any, msg: object = ...) -> None: ... - def assertIs(self, first: object, second: object, - msg: object = ...) -> None: ... - def assertIsNot(self, first: object, second: object, - msg: object = ...) -> None: ... + def assertIs(self, first: object, second: object, msg: object = ...) -> None: ... + def assertIsNot(self, first: object, second: object, msg: object = ...) -> None: ... def assertIsNone(self, expr: Any, msg: object = ...) -> None: ... def assertIsNotNone(self, expr: Any, msg: object = ...) -> None: ... - def assertIn(self, first: _T, second: Iterable[_T], - msg: object = ...) -> None: ... - def assertNotIn(self, first: _T, second: Iterable[_T], - msg: object = ...) -> None: ... - def assertIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], - msg: object = ...) -> None: ... - def assertNotIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], - msg: object = ...) -> None: ... + def assertIn(self, first: _T, second: Iterable[_T], msg: object = ...) -> None: ... + def assertNotIn(self, first: _T, second: Iterable[_T], msg: object = ...) -> None: ... + def assertIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], msg: object = ...) -> None: ... + def assertNotIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], msg: object = ...) -> None: ... def fail(self, msg: object = ...) -> NoReturn: ... def countTestCases(self) -> int: ... def defaultTestResult(self) -> TestResult: ... @@ -201,10 +175,13 @@ class TestCase(Testable): def _getAssertEqualityFunc(self, first: Any, second: Any) -> Callable[..., None]: ... # undocumented class FunctionTestCase(Testable): - def __init__(self, testFunc: Callable[[], None], - setUp: Optional[Callable[[], None]] = ..., - tearDown: Optional[Callable[[], None]] = ..., - description: Optional[str] = ...) -> None: ... + def __init__( + self, + testFunc: Callable[[], None], + setUp: Optional[Callable[[], None]] = ..., + tearDown: Optional[Callable[[], None]] = ..., + description: Optional[str] = ..., + ) -> None: ... def run(self, result: TestResult) -> None: ... def debug(self) -> None: ... def countTestCases(self) -> int: ... @@ -222,16 +199,11 @@ class TestLoader: testMethodPrefix: str sortTestMethodsUsing: Optional[Callable[[str, str], int]] suiteClass: Callable[[List[TestCase]], TestSuite] - def loadTestsFromTestCase(self, - testCaseClass: Type[TestCase]) -> TestSuite: ... - def loadTestsFromModule(self, module: types.ModuleType = ..., - use_load_tests: bool = ...) -> TestSuite: ... - def loadTestsFromName(self, name: str = ..., - module: Optional[types.ModuleType] = ...) -> TestSuite: ... - def loadTestsFromNames(self, names: List[str] = ..., - module: Optional[types.ModuleType] = ...) -> TestSuite: ... - def discover(self, start_dir: str, pattern: str = ..., - top_level_dir: Optional[str] = ...) -> TestSuite: ... + def loadTestsFromTestCase(self, testCaseClass: Type[TestCase]) -> TestSuite: ... + def loadTestsFromModule(self, module: types.ModuleType = ..., use_load_tests: bool = ...) -> TestSuite: ... + def loadTestsFromName(self, name: str = ..., module: Optional[types.ModuleType] = ...) -> TestSuite: ... + def loadTestsFromNames(self, names: List[str] = ..., module: Optional[types.ModuleType] = ...) -> TestSuite: ... + def discover(self, start_dir: str, pattern: str = ..., top_level_dir: Optional[str] = ...) -> TestSuite: ... def getTestCaseNames(self, testCaseClass: Type[TestCase] = ...) -> List[str]: ... defaultTestLoader: TestLoader @@ -240,13 +212,18 @@ class TextTestResult(TestResult): def __init__(self, stream: TextIO, descriptions: bool, verbosity: int) -> None: ... class TextTestRunner: - def __init__(self, stream: Optional[TextIO] = ..., descriptions: bool = ..., - verbosity: int = ..., failfast: bool = ..., buffer: bool = ..., - resultclass: Optional[Type[TestResult]] = ...) -> None: ... + def __init__( + self, + stream: Optional[TextIO] = ..., + descriptions: bool = ..., + verbosity: int = ..., + failfast: bool = ..., + buffer: bool = ..., + resultclass: Optional[Type[TestResult]] = ..., + ) -> None: ... def _makeResult(self) -> TestResult: ... -class SkipTest(Exception): - ... +class SkipTest(Exception): ... # TODO precise types def skipUnless(condition: Any, reason: Union[str, unicode]) -> Any: ... @@ -259,15 +236,19 @@ class TestProgram: result: TestResult def runTests(self) -> None: ... # undocumented -def main(module: Union[None, Text, types.ModuleType] = ..., defaultTest: Optional[str] = ..., - argv: Optional[Sequence[str]] = ..., - testRunner: Union[Type[TextTestRunner], TextTestRunner, None] = ..., - testLoader: TestLoader = ..., exit: bool = ..., verbosity: int = ..., - failfast: Optional[bool] = ..., catchbreak: Optional[bool] = ..., - buffer: Optional[bool] = ...) -> TestProgram: ... - +def main( + module: Union[None, Text, types.ModuleType] = ..., + defaultTest: Optional[str] = ..., + argv: Optional[Sequence[str]] = ..., + testRunner: Union[Type[TextTestRunner], TextTestRunner, None] = ..., + testLoader: TestLoader = ..., + exit: bool = ..., + verbosity: int = ..., + failfast: Optional[bool] = ..., + catchbreak: Optional[bool] = ..., + buffer: Optional[bool] = ..., +) -> TestProgram: ... def load_tests(loader: TestLoader, tests: TestSuite, pattern: Optional[Text]) -> TestSuite: ... - def installHandler() -> None: ... def registerResult(result: TestResult) -> None: ... def removeResult(result: TestResult) -> bool: ... diff --git a/stdlib/2/urllib.pyi b/stdlib/2/urllib.pyi index 6f2bc29842da..e268a9c4904f 100644 --- a/stdlib/2/urllib.pyi +++ b/stdlib/2/urllib.pyi @@ -126,7 +126,6 @@ def unquote_plus(s: AnyStr) -> AnyStr: ... def quote(s: AnyStr, safe: Text = ...) -> AnyStr: ... def quote_plus(s: AnyStr, safe: Text = ...) -> AnyStr: ... def urlencode(query: Union[Sequence[Tuple[Any, Any]], Mapping[Any, Any]], doseq=...) -> str: ... - def getproxies() -> Mapping[str, str]: ... def proxy_bypass(host): ... diff --git a/stdlib/2/urllib2.pyi b/stdlib/2/urllib2.pyi index 23ebc0c34722..4468ad104256 100644 --- a/stdlib/2/urllib2.pyi +++ b/stdlib/2/urllib2.pyi @@ -1,4 +1,3 @@ - import ssl from httplib import HTTPConnectionProtocol, HTTPResponse from typing import Any, AnyStr, Callable, Dict, List, Mapping, Optional, Sequence, Text, Tuple, Type, Union @@ -23,9 +22,14 @@ class Request(object): type: Optional[str] origin_req_host = ... unredirected_hdrs: Dict[str, str] - - def __init__(self, url: str, data: Optional[str] = ..., headers: Dict[str, str] = ..., - origin_req_host: Optional[str] = ..., unverifiable: bool = ...) -> None: ... + def __init__( + self, + url: str, + data: Optional[str] = ..., + headers: Dict[str, str] = ..., + origin_req_host: Optional[str] = ..., + unverifiable: bool = ..., + ) -> None: ... def __getattr__(self, attr): ... def get_method(self) -> str: ... def add_data(self, data) -> None: ... @@ -47,23 +51,29 @@ class Request(object): class OpenerDirector(object): addheaders: List[Tuple[str, str]] - def add_handler(self, handler: BaseHandler) -> None: ... - def open(self, fullurl: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ...) -> Optional[addinfourl]: ... + def open( + self, fullurl: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ... + ) -> Optional[addinfourl]: ... def error(self, proto: _string, *args: Any): ... # Note that this type is somewhat a lie. The return *can* be None if # a custom opener has been installed that fails to handle the request. -def urlopen(url: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ..., - cafile: Optional[_string] = ..., capath: Optional[_string] = ..., cadefault: bool = ..., - context: Optional[ssl.SSLContext] = ...) -> addinfourl: ... +def urlopen( + url: Union[Request, _string], + data: Optional[_string] = ..., + timeout: Optional[float] = ..., + cafile: Optional[_string] = ..., + capath: Optional[_string] = ..., + cadefault: bool = ..., + context: Optional[ssl.SSLContext] = ..., +) -> addinfourl: ... def install_opener(opener: OpenerDirector) -> None: ... def build_opener(*handlers: Union[BaseHandler, Type[BaseHandler]]) -> OpenerDirector: ... class BaseHandler: handler_order: int parent: OpenerDirector - def add_parent(self, parent: OpenerDirector) -> None: ... def close(self) -> None: ... def __lt__(self, other: Any) -> bool: ... @@ -84,10 +94,8 @@ class HTTPRedirectHandler(BaseHandler): def http_error_307(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ... inf_msg: str - class ProxyHandler(BaseHandler): proxies: Mapping[str, str] - def __init__(self, proxies: Optional[Mapping[str, str]] = ...): ... def proxy_open(self, req: Request, proxy, type): ... @@ -118,8 +126,7 @@ class AbstractDigestAuthHandler: def __init__(self, passwd: Optional[HTTPPasswordMgr] = ...) -> None: ... def add_password(self, realm: Optional[Text], uri: Union[Text, Sequence[Text]], user: Text, passwd: Text) -> None: ... def reset_retry_count(self) -> None: ... - def http_error_auth_reqed(self, auth_header: str, host: str, req: Request, - headers: Mapping[str, str]) -> None: ... + def http_error_auth_reqed(self, auth_header: str, host: str, req: Request, headers: Mapping[str, str]) -> None: ... def retry_http_digest_auth(self, req: Request, auth: str) -> Optional[HTTPResponse]: ... def get_cnonce(self, nonce: str) -> str: ... def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ... @@ -140,10 +147,7 @@ class AbstractHTTPHandler(BaseHandler): # undocumented def __init__(self, debuglevel: int = ...) -> None: ... def set_http_debuglevel(self, level: int) -> None: ... def do_request_(self, request: Request) -> Request: ... - def do_open(self, - http_class: HTTPConnectionProtocol, - req: Request, - **http_conn_args: Optional[Any]) -> addinfourl: ... + def do_open(self, http_class: HTTPConnectionProtocol, req: Request, **http_conn_args: Optional[Any]) -> addinfourl: ... class HTTPHandler(AbstractHTTPHandler): def http_open(self, req: Request) -> addinfourl: ... diff --git a/stdlib/2/urlparse.pyi b/stdlib/2/urlparse.pyi index 368e7664417f..ef844131ff59 100644 --- a/stdlib/2/urlparse.pyi +++ b/stdlib/2/urlparse.pyi @@ -26,32 +26,20 @@ class ResultMixin(object): def port(self) -> int: ... class SplitResult( - NamedTuple( - 'SplitResult', - [ - ('scheme', str), ('netloc', str), ('path', str), ('query', str), ('fragment', str) - ] - ), - ResultMixin + NamedTuple("SplitResult", [("scheme", str), ("netloc", str), ("path", str), ("query", str), ("fragment", str)]), ResultMixin ): def geturl(self) -> str: ... class ParseResult( NamedTuple( - 'ParseResult', - [ - ('scheme', str), ('netloc', str), ('path', str), ('params', str), ('query', str), - ('fragment', str) - ] + "ParseResult", [("scheme", str), ("netloc", str), ("path", str), ("params", str), ("query", str), ("fragment", str)] ), - ResultMixin + ResultMixin, ): def geturl(self) -> str: ... -def urlparse(url: _String, scheme: _String = ..., - allow_fragments: bool = ...) -> ParseResult: ... -def urlsplit(url: _String, scheme: _String = ..., - allow_fragments: bool = ...) -> SplitResult: ... +def urlparse(url: _String, scheme: _String = ..., allow_fragments: bool = ...) -> ParseResult: ... +def urlsplit(url: _String, scheme: _String = ..., allow_fragments: bool = ...) -> SplitResult: ... @overload def urlunparse(data: Tuple[_String, _String, _String, _String, _String, _String]) -> str: ... @overload @@ -60,11 +48,8 @@ def urlunparse(data: Sequence[_String]) -> str: ... def urlunsplit(data: Tuple[_String, _String, _String, _String, _String]) -> str: ... @overload def urlunsplit(data: Sequence[_String]) -> str: ... -def urljoin(base: _String, url: _String, - allow_fragments: bool = ...) -> str: ... +def urljoin(base: _String, url: _String, allow_fragments: bool = ...) -> str: ... def urldefrag(url: AnyStr) -> Tuple[AnyStr, str]: ... def unquote(s: AnyStr) -> AnyStr: ... -def parse_qs(qs: AnyStr, keep_blank_values: bool = ..., - strict_parsing: bool = ...) -> Dict[AnyStr, List[AnyStr]]: ... -def parse_qsl(qs: AnyStr, keep_blank_values: int = ..., - strict_parsing: bool = ...) -> List[Tuple[AnyStr, AnyStr]]: ... +def parse_qs(qs: AnyStr, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[AnyStr, List[AnyStr]]: ... +def parse_qsl(qs: AnyStr, keep_blank_values: int = ..., strict_parsing: bool = ...) -> List[Tuple[AnyStr, AnyStr]]: ... diff --git a/stdlib/2/user.pyi b/stdlib/2/user.pyi index e857a3a9516e..3a5bd1dd4512 100644 --- a/stdlib/2/user.pyi +++ b/stdlib/2/user.pyi @@ -5,5 +5,6 @@ from typing import Any def __getattr__(name) -> Any: ... + home: str pythonrc: str diff --git a/stdlib/2/xmlrpclib.pyi b/stdlib/2/xmlrpclib.pyi index 3ab276ed467c..03a0a43fbe0f 100644 --- a/stdlib/2/xmlrpclib.pyi +++ b/stdlib/2/xmlrpclib.pyi @@ -104,16 +104,36 @@ class Marshaller: allow_none: bool def __init__(self, encoding: Optional[str] = ..., allow_none: bool = ...) -> None: ... dispatch: Mapping[type, Callable[[Marshaller, str, Callable[[str], None]], None]] - def dumps(self, values: Union[Iterable[Union[None, int, bool, long, float, str, unicode, List, Tuple, Mapping, datetime, InstanceType]], Fault]) -> str: ... + def dumps( + self, + values: Union[ + Iterable[Union[None, int, bool, long, float, str, unicode, List, Tuple, Mapping, datetime, InstanceType]], Fault + ], + ) -> str: ... def dump_nil(self, value: None, write: Callable[[str], None]) -> None: ... def dump_int(self, value: int, write: Callable[[str], None]) -> None: ... def dump_bool(self, value: bool, write: Callable[[str], None]) -> None: ... def dump_long(self, value: long, write: Callable[[str], None]) -> None: ... def dump_double(self, value: float, write: Callable[[str], None]) -> None: ... - def dump_string(self, value: str, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ... - def dump_unicode(self, value: unicode, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ... + def dump_string( + self, + value: str, + write: Callable[[str], None], + escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ..., + ) -> None: ... + def dump_unicode( + self, + value: unicode, + write: Callable[[str], None], + escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ..., + ) -> None: ... def dump_array(self, value: Union[List, Tuple], write: Callable[[str], None]) -> None: ... - def dump_struct(self, value: Mapping, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ... + def dump_struct( + self, + value: Mapping, + write: Callable[[str], None], + escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ..., + ) -> None: ... def dump_datetime(self, value: datetime, write: Callable[[str], None]) -> None: ... def dump_instance(self, value: InstanceType, write: Callable[[str], None]) -> None: ... @@ -144,6 +164,7 @@ class Unmarshaller: class _MultiCallMethod: def __init__(self, call_list: List[Tuple[str, tuple]], name: str) -> None: ... + class MultiCallIterator: def __init__(self, results: List) -> None: ... @@ -153,9 +174,14 @@ class MultiCall: def __call__(self) -> MultiCallIterator: ... def getparser(use_datetime: bool = ...) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ... -def dumps(params: Union[tuple, Fault], methodname: Optional[str] = ..., methodresponse: Optional[bool] = ..., encoding: Optional[str] = ..., allow_none: bool = ...) -> str: ... +def dumps( + params: Union[tuple, Fault], + methodname: Optional[str] = ..., + methodresponse: Optional[bool] = ..., + encoding: Optional[str] = ..., + allow_none: bool = ..., +) -> str: ... def loads(data: str, use_datetime: bool = ...) -> Tuple[tuple, Optional[str]]: ... - def gzip_encode(data: str) -> str: ... def gzip_decode(data: str, max_decode: int = ...) -> str: ... @@ -192,7 +218,16 @@ class SafeTransport(Transport): def make_connection(self, host: _hostDesc) -> HTTPSConnection: ... class ServerProxy: - def __init__(self, uri: str, transport: Optional[Transport] = ..., encoding: Optional[str] = ..., verbose: bool = ..., allow_none: bool = ..., use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ... + def __init__( + self, + uri: str, + transport: Optional[Transport] = ..., + encoding: Optional[str] = ..., + verbose: bool = ..., + allow_none: bool = ..., + use_datetime: bool = ..., + context: Optional[SSLContext] = ..., + ) -> None: ... def __getattr__(self, name: str) -> _Method: ... def __call__(self, attr: str) -> Optional[Transport]: ... diff --git a/stdlib/2and3/_bisect.pyi b/stdlib/2and3/_bisect.pyi index 62335472f8ae..63b93a51fbe8 100644 --- a/stdlib/2and3/_bisect.pyi +++ b/stdlib/2and3/_bisect.pyi @@ -2,7 +2,8 @@ from typing import Sequence, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") + def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... diff --git a/stdlib/2and3/_codecs.pyi b/stdlib/2and3/_codecs.pyi index 31bd06e91526..95ea16bd4bec 100644 --- a/stdlib/2and3/_codecs.pyi +++ b/stdlib/2and3/_codecs.pyi @@ -18,6 +18,7 @@ else: # This type is not exposed; it is defined in unicodeobject.c class _EncodingMap(object): def size(self) -> int: ... + _MapT = Union[Dict[int, int], _EncodingMap] def register(search_function: Callable[[str], Any]) -> None: ... @@ -27,7 +28,6 @@ def lookup_error(name: Union[str, Text]) -> _Handler: ... def decode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ... def encode(obj: Any, encoding: Union[str, Text] = ..., errors: _Errors = ...) -> Any: ... def charmap_build(map: Text) -> _MapT: ... - def ascii_decode(data: _Decodable, errors: _Errors = ...) -> Tuple[Text, int]: ... def ascii_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ... def charbuffer_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ... @@ -63,7 +63,7 @@ def utf_7_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: def utf_8_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ... def utf_8_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ... -if sys.platform == 'win32': +if sys.platform == "win32": def mbcs_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ... def mbcs_encode(str: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ... if sys.version_info >= (3, 0): diff --git a/stdlib/2and3/_csv.pyi b/stdlib/2and3/_csv.pyi index 66be513c8482..3870a69b7f8e 100644 --- a/stdlib/2and3/_csv.pyi +++ b/stdlib/2and3/_csv.pyi @@ -37,7 +37,6 @@ class _writer: def writerow(self, row: Sequence[Any]) -> None: ... def writerows(self, rows: Iterable[Sequence[Any]]) -> None: ... - # TODO: precise type def writer(csvfile: Any, dialect: Any = ..., **fmtparams: Any) -> _writer: ... def reader(csvfile: Iterable[Text], dialect: Any = ..., **fmtparams: Any) -> _reader: ... diff --git a/stdlib/2and3/_curses.pyi b/stdlib/2and3/_curses.pyi index 3ab9fac1b867..4f55f424afaf 100644 --- a/stdlib/2and3/_curses.pyi +++ b/stdlib/2and3/_curses.pyi @@ -283,15 +283,30 @@ def termname() -> bytes: ... def tigetflag(capname: str) -> int: ... def tigetnum(capname: str) -> int: ... def tigetstr(capname: str) -> bytes: ... -def tparm(fmt: bytes, i1: int = ..., i2: int = ..., i3: int = ..., i4: int = ..., i5: int = ..., i6: int = ..., i7: int = ..., i8: int = ..., i9: int = ...) -> bytes: ... +def tparm( + fmt: bytes, + i1: int = ..., + i2: int = ..., + i3: int = ..., + i4: int = ..., + i5: int = ..., + i6: int = ..., + i7: int = ..., + i8: int = ..., + i9: int = ..., +) -> bytes: ... def typeahead(fd: int) -> None: ... def unctrl(ch: _chtype) -> bytes: ... + if sys.version_info >= (3, 3): def unget_wch(ch: _chtype) -> None: ... + def ungetch(ch: _chtype) -> None: ... def ungetmouse(id: int, x: int, y: int, z: int, bstate: int) -> None: ... + if sys.version_info >= (3, 5): def update_lines_cols() -> int: ... + def use_default_colors() -> None: ... def use_env(flag: bool) -> None: ... @@ -317,7 +332,17 @@ class _CursesWindow: def attrset(self, attr: int) -> None: ... def bkgd(self, ch: _chtype, attr: int = ...) -> None: ... def bkgset(self, ch: _chtype, attr: int = ...) -> None: ... - def border(self, ls: _chtype = ..., rs: _chtype = ..., ts: _chtype = ..., bs: _chtype = ..., tl: _chtype = ..., tr: _chtype = ..., bl: _chtype = ..., br: _chtype = ...) -> None: ... + def border( + self, + ls: _chtype = ..., + rs: _chtype = ..., + ts: _chtype = ..., + bs: _chtype = ..., + tl: _chtype = ..., + tr: _chtype = ..., + bl: _chtype = ..., + br: _chtype = ..., + ) -> None: ... @overload def box(self) -> None: ... @overload @@ -415,11 +440,15 @@ class _CursesWindow: @overload def overlay(self, destwin: _CursesWindow) -> None: ... @overload - def overlay(self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int) -> None: ... + def overlay( + self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int + ) -> None: ... @overload def overwrite(self, destwin: _CursesWindow) -> None: ... @overload - def overwrite(self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int) -> None: ... + def overwrite( + self, destwin: _CursesWindow, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int + ) -> None: ... def putwin(self, file: IO[Any]) -> None: ... def redrawln(self, beg: int, num: int) -> None: ... def redrawwin(self) -> None: ... diff --git a/stdlib/2and3/_heapq.pyi b/stdlib/2and3/_heapq.pyi index 493566ac92f8..0e172980f3ee 100644 --- a/stdlib/2and3/_heapq.pyi +++ b/stdlib/2and3/_heapq.pyi @@ -7,9 +7,11 @@ _T = TypeVar("_T") def heapify(heap: List[_T]) -> None: ... def heappop(heap: List[_T]) -> _T: raise IndexError() # if list is empty + def heappush(heap: List[_T], item: _T) -> None: ... def heappushpop(heap: List[_T], item: _T) -> _T: ... def heapreplace(heap: List[_T], item: _T) -> _T: raise IndexError() # if list is empty + def nlargest(a: int, b: List[_T]) -> List[_T]: ... def nsmallest(a: int, b: List[_T]) -> List[_T]: ... diff --git a/stdlib/2and3/_weakref.pyi b/stdlib/2and3/_weakref.pyi index 6a527c1894a6..a76922f6d02a 100644 --- a/stdlib/2and3/_weakref.pyi +++ b/stdlib/2and3/_weakref.pyi @@ -1,8 +1,8 @@ import sys from typing import Any, Callable, Generic, Optional, TypeVar, overload -_C = TypeVar('_C', bound=Callable[..., Any]) -_T = TypeVar('_T') +_C = TypeVar("_C", bound=Callable[..., Any]) +_T = TypeVar("_T") class CallableProxyType(object): # "weakcallableproxy" def __getattr__(self, attr: str) -> Any: ... @@ -23,6 +23,7 @@ def getweakrefcount(object: Any) -> int: ... def getweakrefs(object: Any) -> int: ... @overload def proxy(object: _C, callback: Optional[Callable[[_C], Any]] = ...) -> CallableProxyType: ... + # Return CallableProxyType if object is callable, ProxyType otherwise @overload def proxy(object: _T, callback: Optional[Callable[[_T], Any]] = ...) -> Any: ... diff --git a/stdlib/2and3/_weakrefset.pyi b/stdlib/2and3/_weakrefset.pyi index 1263f9070564..93a7e97e4a46 100644 --- a/stdlib/2and3/_weakrefset.pyi +++ b/stdlib/2and3/_weakrefset.pyi @@ -1,12 +1,11 @@ from typing import Any, Generic, Iterable, Iterator, MutableSet, Optional, TypeVar, Union -_S = TypeVar('_S') -_T = TypeVar('_T') -_SelfT = TypeVar('_SelfT', bound=WeakSet) +_S = TypeVar("_S") +_T = TypeVar("_T") +_SelfT = TypeVar("_SelfT", bound=WeakSet) class WeakSet(MutableSet[_T], Generic[_T]): def __init__(self, data: Optional[Iterable[_T]] = ...) -> None: ... - def add(self, item: _T) -> None: ... def clear(self) -> None: ... def discard(self, item: _T) -> None: ... @@ -17,7 +16,6 @@ class WeakSet(MutableSet[_T], Generic[_T]): def __contains__(self, item: object) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... - def __ior__(self, other: Iterable[_S]) -> WeakSet[Union[_S, _T]]: ... def difference(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... def __sub__(self: _SelfT, other: Iterable[_T]) -> _SelfT: ... diff --git a/stdlib/2and3/argparse.pyi b/stdlib/2and3/argparse.pyi index fc60e0bc48bf..b9d8c2db058c 100644 --- a/stdlib/2and3/argparse.pyi +++ b/stdlib/2and3/argparse.pyi @@ -19,9 +19,9 @@ from typing import ( overload, ) -_T = TypeVar('_T') -_ActionT = TypeVar('_ActionT', bound='Action') -_N = TypeVar('_N') +_T = TypeVar("_T") +_ActionT = TypeVar("_ActionT", bound="Action") +_N = TypeVar("_N") if sys.version_info >= (3,): _Text = str @@ -58,27 +58,29 @@ class _ActionsContainer: _defaults: Dict[str, Any] _negative_number_matcher: Pattern[str] _has_negative_number_optionals: List[bool] - - def __init__(self, description: Optional[Text], prefix_chars: Text, - argument_default: Optional[Text], conflict_handler: Text) -> None: ... + def __init__( + self, description: Optional[Text], prefix_chars: Text, argument_default: Optional[Text], conflict_handler: Text + ) -> None: ... def register(self, registry_name: Text, value: Any, object: Any) -> None: ... def _registry_get(self, registry_name: Text, value: Any, default: Any = ...) -> Any: ... def set_defaults(self, **kwargs: Any) -> None: ... def get_default(self, dest: Text) -> Any: ... - def add_argument(self, - *name_or_flags: Text, - action: Union[Text, Type[Action]] = ..., - nargs: Union[int, Text] = ..., - const: Any = ..., - default: Any = ..., - type: Union[Callable[[Text], _T], Callable[[str], _T], FileType] = ..., - choices: Iterable[_T] = ..., - required: bool = ..., - help: Optional[Text] = ..., - metavar: Optional[Union[Text, Tuple[Text, ...]]] = ..., - dest: Optional[Text] = ..., - version: Text = ..., - **kwargs: Any) -> Action: ... + def add_argument( + self, + *name_or_flags: Text, + action: Union[Text, Type[Action]] = ..., + nargs: Union[int, Text] = ..., + const: Any = ..., + default: Any = ..., + type: Union[Callable[[Text], _T], Callable[[str], _T], FileType] = ..., + choices: Iterable[_T] = ..., + required: bool = ..., + help: Optional[Text] = ..., + metavar: Optional[Union[Text, Tuple[Text, ...]]] = ..., + dest: Optional[Text] = ..., + version: Text = ..., + **kwargs: Any + ) -> Action: ... def add_argument_group(self, *args: Any, **kwargs: Any) -> _ArgumentGroup: ... def add_mutually_exclusive_group(self, **kwargs: Any) -> _MutuallyExclusiveGroup: ... def _add_action(self, action: _ActionT) -> _ActionT: ... @@ -109,33 +111,36 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): _subparsers: Optional[_ArgumentGroup] if sys.version_info >= (3, 5): - def __init__(self, - prog: Optional[str] = ..., - usage: Optional[str] = ..., - description: Optional[str] = ..., - epilog: Optional[str] = ..., - parents: Sequence[ArgumentParser] = ..., - formatter_class: Type[HelpFormatter] = ..., - prefix_chars: str = ..., - fromfile_prefix_chars: Optional[str] = ..., - argument_default: Optional[str] = ..., - conflict_handler: str = ..., - add_help: bool = ..., - allow_abbrev: bool = ...) -> None: ... + def __init__( + self, + prog: Optional[str] = ..., + usage: Optional[str] = ..., + description: Optional[str] = ..., + epilog: Optional[str] = ..., + parents: Sequence[ArgumentParser] = ..., + formatter_class: Type[HelpFormatter] = ..., + prefix_chars: str = ..., + fromfile_prefix_chars: Optional[str] = ..., + argument_default: Optional[str] = ..., + conflict_handler: str = ..., + add_help: bool = ..., + allow_abbrev: bool = ..., + ) -> None: ... else: - def __init__(self, - prog: Optional[Text] = ..., - usage: Optional[Text] = ..., - description: Optional[Text] = ..., - epilog: Optional[Text] = ..., - parents: Sequence[ArgumentParser] = ..., - formatter_class: Type[HelpFormatter] = ..., - prefix_chars: Text = ..., - fromfile_prefix_chars: Optional[Text] = ..., - argument_default: Optional[Text] = ..., - conflict_handler: Text = ..., - add_help: bool = ...) -> None: ... - + def __init__( + self, + prog: Optional[Text] = ..., + usage: Optional[Text] = ..., + description: Optional[Text] = ..., + epilog: Optional[Text] = ..., + parents: Sequence[ArgumentParser] = ..., + formatter_class: Type[HelpFormatter] = ..., + prefix_chars: Text = ..., + fromfile_prefix_chars: Optional[Text] = ..., + argument_default: Optional[Text] = ..., + conflict_handler: Text = ..., + add_help: bool = ..., + ) -> None: ... # The type-ignores in these overloads should be temporary. See: # https://github.com/python/typeshed/pull/2643#issuecomment-442280277 @overload @@ -148,44 +153,50 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore @overload def parse_args(self, *, namespace: _N) -> _N: ... - if sys.version_info >= (3, 7): - def add_subparsers(self, title: str = ..., - description: Optional[str] = ..., - prog: str = ..., - parser_class: Type[ArgumentParser] = ..., - action: Type[Action] = ..., - option_string: str = ..., - dest: Optional[str] = ..., - required: bool = ..., - help: Optional[str] = ..., - metavar: Optional[str] = ...) -> _SubParsersAction: ... + def add_subparsers( + self, + title: str = ..., + description: Optional[str] = ..., + prog: str = ..., + parser_class: Type[ArgumentParser] = ..., + action: Type[Action] = ..., + option_string: str = ..., + dest: Optional[str] = ..., + required: bool = ..., + help: Optional[str] = ..., + metavar: Optional[str] = ..., + ) -> _SubParsersAction: ... else: - def add_subparsers(self, title: Text = ..., - description: Optional[Text] = ..., - prog: Text = ..., - parser_class: Type[ArgumentParser] = ..., - action: Type[Action] = ..., - option_string: Text = ..., - dest: Optional[Text] = ..., - help: Optional[Text] = ..., - metavar: Optional[Text] = ...) -> _SubParsersAction: ... - + def add_subparsers( + self, + title: Text = ..., + description: Optional[Text] = ..., + prog: Text = ..., + parser_class: Type[ArgumentParser] = ..., + action: Type[Action] = ..., + option_string: Text = ..., + dest: Optional[Text] = ..., + help: Optional[Text] = ..., + metavar: Optional[Text] = ..., + ) -> _SubParsersAction: ... def print_usage(self, file: Optional[IO[str]] = ...) -> None: ... def print_help(self, file: Optional[IO[str]] = ...) -> None: ... def format_usage(self) -> str: ... def format_help(self) -> str: ... - def parse_known_args(self, args: Optional[Sequence[Text]] = ..., - namespace: Optional[Namespace] = ...) -> Tuple[Namespace, List[str]]: ... + def parse_known_args( + self, args: Optional[Sequence[Text]] = ..., namespace: Optional[Namespace] = ... + ) -> Tuple[Namespace, List[str]]: ... def convert_arg_line_to_args(self, arg_line: Text) -> List[str]: ... def exit(self, status: int = ..., message: Optional[Text] = ...) -> NoReturn: ... def error(self, message: Text) -> NoReturn: ... if sys.version_info >= (3, 7): - def parse_intermixed_args(self, args: Optional[Sequence[str]] = ..., - namespace: Optional[Namespace] = ...) -> Namespace: ... - def parse_known_intermixed_args(self, - args: Optional[Sequence[str]] = ..., - namespace: Optional[Namespace] = ...) -> Tuple[Namespace, List[str]]: ... + def parse_intermixed_args( + self, args: Optional[Sequence[str]] = ..., namespace: Optional[Namespace] = ... + ) -> Namespace: ... + def parse_known_intermixed_args( + self, args: Optional[Sequence[str]] = ..., namespace: Optional[Namespace] = ... + ) -> Tuple[Namespace, List[str]]: ... # undocumented def _get_optional_actions(self) -> List[Action]: ... def _get_positional_actions(self) -> List[Action]: ... @@ -216,21 +227,25 @@ class HelpFormatter: _whitespace_matcher: Pattern[str] _long_break_matcher: Pattern[str] _Section: Type[Any] # Nested class - def __init__(self, prog: Text, indent_increment: int = ..., - max_help_position: int = ..., - width: Optional[int] = ...) -> None: ... + def __init__( + self, prog: Text, indent_increment: int = ..., max_help_position: int = ..., width: Optional[int] = ... + ) -> None: ... def _indent(self) -> None: ... def _dedent(self) -> None: ... def _add_item(self, func: Callable[..., _Text], args: Iterable[Any]) -> None: ... def start_section(self, heading: Optional[Text]) -> None: ... def end_section(self) -> None: ... def add_text(self, text: Optional[Text]) -> None: ... - def add_usage(self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text] = ...) -> None: ... + def add_usage( + self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text] = ... + ) -> None: ... def add_argument(self, action: Action) -> None: ... def add_arguments(self, actions: Iterable[Action]) -> None: ... def format_help(self) -> _Text: ... def _join_parts(self, part_strings: Iterable[Text]) -> _Text: ... - def _format_usage(self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text]) -> _Text: ... + def _format_usage( + self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text] + ) -> _Text: ... def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_ArgumentGroup]) -> _Text: ... def _format_text(self, text: Text) -> _Text: ... def _format_action(self, action: Action) -> _Text: ... @@ -248,6 +263,7 @@ class HelpFormatter: class RawDescriptionHelpFormatter(HelpFormatter): ... class RawTextHelpFormatter(HelpFormatter): ... class ArgumentDefaultsHelpFormatter(HelpFormatter): ... + if sys.version_info >= (3,): class MetavarTypeHelpFormatter(HelpFormatter): ... @@ -262,21 +278,26 @@ class Action(_AttributeHolder): required: bool help: Optional[_Text] metavar: Optional[Union[_Text, Tuple[_Text, ...]]] - - def __init__(self, - option_strings: Sequence[Text], - dest: Text, - nargs: Optional[Union[int, Text]] = ..., - const: Any = ..., - default: Any = ..., - type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ..., - choices: Optional[Iterable[_T]] = ..., - required: bool = ..., - help: Optional[Text] = ..., - metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ... - def __call__(self, parser: ArgumentParser, namespace: Namespace, - values: Union[Text, Sequence[Any], None], - option_string: Optional[Text] = ...) -> None: ... + def __init__( + self, + option_strings: Sequence[Text], + dest: Text, + nargs: Optional[Union[int, Text]] = ..., + const: Any = ..., + default: Any = ..., + type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ..., + choices: Optional[Iterable[_T]] = ..., + required: bool = ..., + help: Optional[Text] = ..., + metavar: Optional[Union[Text, Tuple[Text, ...]]] = ..., + ) -> None: ... + def __call__( + self, + parser: ArgumentParser, + namespace: Namespace, + values: Union[Text, Sequence[Any], None], + option_string: Optional[Text] = ..., + ) -> None: ... class Namespace(_AttributeHolder): def __init__(self, **kwargs: Any) -> None: ... @@ -291,21 +312,20 @@ class FileType: if sys.version_info >= (3,): _encoding: Optional[str] _errors: Optional[str] - def __init__(self, mode: str = ..., bufsize: int = ..., - encoding: Optional[str] = ..., - errors: Optional[str] = ...) -> None: ... + def __init__( + self, mode: str = ..., bufsize: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ... + ) -> None: ... else: - def __init__(self, - mode: Text = ..., bufsize: Optional[int] = ...) -> None: ... + def __init__(self, mode: Text = ..., bufsize: Optional[int] = ...) -> None: ... def __call__(self, string: Text) -> IO[Any]: ... # undocumented class _ArgumentGroup(_ActionsContainer): title: Optional[_Text] _group_actions: List[Action] - def __init__(self, container: _ActionsContainer, - title: Optional[Text] = ..., - description: Optional[Text] = ..., **kwargs: Any) -> None: ... + def __init__( + self, container: _ActionsContainer, title: Optional[Text] = ..., description: Optional[Text] = ..., **kwargs: Any + ) -> None: ... # undocumented class _MutuallyExclusiveGroup(_ArgumentGroup): @@ -318,73 +338,68 @@ class _StoreAction(Action): ... # undocumented class _StoreConstAction(Action): - def __init__(self, - option_strings: Sequence[Text], - dest: Text, - const: Any, - default: Any = ..., - required: bool = ..., - help: Optional[Text] = ..., - metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ... + def __init__( + self, + option_strings: Sequence[Text], + dest: Text, + const: Any, + default: Any = ..., + required: bool = ..., + help: Optional[Text] = ..., + metavar: Optional[Union[Text, Tuple[Text, ...]]] = ..., + ) -> None: ... # undocumented class _StoreTrueAction(_StoreConstAction): - def __init__(self, - option_strings: Sequence[Text], - dest: Text, - default: bool = ..., - required: bool = ..., - help: Optional[Text] = ...) -> None: ... + def __init__( + self, option_strings: Sequence[Text], dest: Text, default: bool = ..., required: bool = ..., help: Optional[Text] = ... + ) -> None: ... # undocumented class _StoreFalseAction(_StoreConstAction): - def __init__(self, - option_strings: Sequence[Text], - dest: Text, - default: bool = ..., - required: bool = ..., - help: Optional[Text] = ...) -> None: ... + def __init__( + self, option_strings: Sequence[Text], dest: Text, default: bool = ..., required: bool = ..., help: Optional[Text] = ... + ) -> None: ... # undocumented class _AppendAction(Action): ... # undocumented class _AppendConstAction(Action): - def __init__(self, - option_strings: Sequence[Text], - dest: Text, - const: Any, - default: Any = ..., - required: bool = ..., - help: Optional[Text] = ..., - metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ... + def __init__( + self, + option_strings: Sequence[Text], + dest: Text, + const: Any, + default: Any = ..., + required: bool = ..., + help: Optional[Text] = ..., + metavar: Optional[Union[Text, Tuple[Text, ...]]] = ..., + ) -> None: ... # undocumented class _CountAction(Action): - def __init__(self, - option_strings: Sequence[Text], - dest: Text, - default: Any = ..., - required: bool = ..., - help: Optional[Text] = ...) -> None: ... + def __init__( + self, option_strings: Sequence[Text], dest: Text, default: Any = ..., required: bool = ..., help: Optional[Text] = ... + ) -> None: ... # undocumented class _HelpAction(Action): - def __init__(self, - option_strings: Sequence[Text], - dest: Text = ..., - default: Text = ..., - help: Optional[Text] = ...) -> None: ... + def __init__( + self, option_strings: Sequence[Text], dest: Text = ..., default: Text = ..., help: Optional[Text] = ... + ) -> None: ... # undocumented class _VersionAction(Action): version: Optional[_Text] - def __init__(self, - option_strings: Sequence[Text], - version: Optional[Text] = ..., - dest: Text = ..., - default: Text = ..., - help: Text = ...) -> None: ... + def __init__( + self, + option_strings: Sequence[Text], + version: Optional[Text] = ..., + dest: Text = ..., + default: Text = ..., + help: Text = ..., + ) -> None: ... # undocumented class _SubParsersAction(Action): @@ -394,14 +409,16 @@ class _SubParsersAction(Action): _name_parser_map: Dict[_Text, ArgumentParser] choices: Dict[_Text, ArgumentParser] _choices_actions: List[Action] - def __init__(self, - option_strings: Sequence[Text], - prog: Text, - parser_class: Type[ArgumentParser], - dest: Text = ..., - required: bool = ..., - help: Optional[Text] = ..., - metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ... + def __init__( + self, + option_strings: Sequence[Text], + prog: Text, + parser_class: Type[ArgumentParser], + dest: Text = ..., + required: bool = ..., + help: Optional[Text] = ..., + metavar: Optional[Union[Text, Tuple[Text, ...]]] = ..., + ) -> None: ... # TODO: Type keyword args properly. def add_parser(self, name: Text, **kwargs: Any) -> ArgumentParser: ... def _get_subactions(self) -> List[Action]: ... diff --git a/stdlib/2and3/array.pyi b/stdlib/2and3/array.pyi index c7eb6e4ac673..735fc68ab641 100644 --- a/stdlib/2and3/array.pyi +++ b/stdlib/2and3/array.pyi @@ -5,7 +5,7 @@ import sys from typing import Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence, Text, Tuple, TypeVar, Union, overload -_T = TypeVar('_T', int, float, Text) +_T = TypeVar("_T", int, float, Text) if sys.version_info >= (3,): typecodes: str @@ -13,8 +13,7 @@ if sys.version_info >= (3,): class array(MutableSequence[_T], Generic[_T]): typecode: str itemsize: int - def __init__(self, typecode: str, - __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ... + def __init__(self, typecode: str, __initializer: Union[bytes, Iterable[_T]] = ...) -> None: ... def append(self, x: _T) -> None: ... def buffer_info(self) -> Tuple[int, int]: ... def byteswap(self) -> None: ... @@ -41,19 +40,15 @@ class array(MutableSequence[_T], Generic[_T]): def tounicode(self) -> str: ... if sys.version_info < (3,): def write(self, f: BinaryIO) -> None: ... - def __len__(self) -> int: ... - @overload def __getitem__(self, i: int) -> _T: ... @overload def __getitem__(self, s: slice) -> array[_T]: ... - @overload # type: ignore # Overrides MutableSequence def __setitem__(self, i: int, o: _T) -> None: ... @overload def __setitem__(self, s: slice, o: array[_T]) -> None: ... - def __delitem__(self, i: Union[int, slice]) -> None: ... def __add__(self, x: array[_T]) -> array[_T]: ... def __ge__(self, other: array[_T]) -> bool: ... diff --git a/stdlib/2and3/asynchat.pyi b/stdlib/2and3/asynchat.pyi index 601a6ae15458..34039b993400 100644 --- a/stdlib/2and3/asynchat.pyi +++ b/stdlib/2and3/asynchat.pyi @@ -12,7 +12,6 @@ class async_chat(asyncore.dispatcher): ac_in_buffer_size: int ac_out_buffer_size: int def __init__(self, sock: Optional[socket.socket] = ..., map: Optional[asyncore._maptype] = ...) -> None: ... - @abstractmethod def collect_incoming_data(self, data: bytes) -> None: ... @abstractmethod diff --git a/stdlib/2and3/asyncore.pyi b/stdlib/2and3/asyncore.pyi index 93cbd0b91c0d..b317f5ed63ac 100644 --- a/stdlib/2and3/asyncore.pyi +++ b/stdlib/2and3/asyncore.pyi @@ -25,7 +25,6 @@ from typing import Any, Dict, Optional, Tuple, Union, overload # cyclic dependence with asynchat _maptype = Dict[str, Any] - class ExitNow(Exception): ... def read(obj: Any) -> None: ... @@ -38,7 +37,6 @@ poll3 = poll2 def loop(timeout: float = ..., use_poll: bool = ..., map: _maptype = ..., count: Optional[int] = ...) -> None: ... - # Not really subclass of socket.socket; it's only delegation. # It is not covariant to it. class dispatcher: @@ -50,7 +48,6 @@ class dispatcher: closing: bool ignore_log_types: frozenset[str] socket: Optional[SocketType] - def __init__(self, sock: Optional[SocketType] = ..., map: _maptype = ...) -> None: ... def add_channel(self, map: _maptype = ...) -> None: ... def del_channel(self, map: _maptype = ...) -> None: ... @@ -66,7 +63,6 @@ class dispatcher: def send(self, data: bytes) -> int: ... def recv(self, buffer_size: int) -> bytes: ... def close(self) -> None: ... - def log(self, message: Any) -> None: ... def log_info(self, message: Any, type: str = ...) -> None: ... def handle_read_event(self) -> None: ... @@ -80,34 +76,26 @@ class dispatcher: def handle_connect(self) -> None: ... def handle_accept(self) -> None: ... def handle_close(self) -> None: ... - if sys.version_info < (3, 5): # Historically, some methods were "imported" from `self.socket` by # means of `__getattr__`. This was long deprecated, and as of Python # 3.5 has been removed; simply call the relevant methods directly on # self.socket if necessary. - def detach(self) -> int: ... def fileno(self) -> int: ... - # return value is an address def getpeername(self) -> Any: ... def getsockname(self) -> Any: ... - @overload def getsockopt(self, level: int, optname: int) -> int: ... @overload def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... - def gettimeout(self) -> float: ... - def ioctl(self, control: object, - option: Tuple[int, int, int]) -> None: ... + def ioctl(self, control: object, option: Tuple[int, int, int]) -> None: ... # TODO the return value may be BinaryIO or TextIO, depending on mode - def makefile(self, mode: str = ..., buffering: int = ..., - encoding: str = ..., errors: str = ..., - newline: str = ...) -> Any: - ... - + def makefile( + self, mode: str = ..., buffering: int = ..., encoding: str = ..., errors: str = ..., newline: str = ... + ) -> Any: ... # return type is an address def recvfrom(self, bufsize: int, flags: int = ...) -> Any: ... def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ... @@ -133,19 +121,15 @@ def close_all(map: _maptype = ..., ignore_all: bool = ...) -> None: ... # import fcntl class file_wrapper: fd: int - def __init__(self, fd: int) -> None: ... def recv(self, bufsize: int, flags: int = ...) -> bytes: ... def send(self, data: bytes, flags: int = ...) -> int: ... - @overload def getsockopt(self, level: int, optname: int) -> int: ... @overload def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... - def read(self, bufsize: int, flags: int = ...) -> bytes: ... def write(self, data: bytes, flags: int = ...) -> int: ... - def close(self) -> None: ... def fileno(self) -> int: ... diff --git a/stdlib/2and3/base64.pyi b/stdlib/2and3/base64.pyi index 635301013caa..b3a994494677 100644 --- a/stdlib/2and3/base64.pyi +++ b/stdlib/2and3/base64.pyi @@ -11,22 +11,19 @@ else: _decodable = Union[bytes, str] def b64encode(s: _encodable, altchars: bytes = ...) -> bytes: ... -def b64decode(s: _decodable, altchars: bytes = ..., - validate: bool = ...) -> bytes: ... +def b64decode(s: _decodable, altchars: bytes = ..., validate: bool = ...) -> bytes: ... def standard_b64encode(s: _encodable) -> bytes: ... def standard_b64decode(s: _decodable) -> bytes: ... def urlsafe_b64encode(s: _encodable) -> bytes: ... def urlsafe_b64decode(s: _decodable) -> bytes: ... def b32encode(s: _encodable) -> bytes: ... -def b32decode(s: _decodable, casefold: bool = ..., - map01: bytes = ...) -> bytes: ... +def b32decode(s: _decodable, casefold: bool = ..., map01: bytes = ...) -> bytes: ... def b16encode(s: _encodable) -> bytes: ... def b16decode(s: _decodable, casefold: bool = ...) -> bytes: ... + if sys.version_info >= (3, 4): - def a85encode(b: _encodable, *, foldspaces: bool = ..., wrapcol: int = ..., - pad: bool = ..., adobe: bool = ...) -> bytes: ... - def a85decode(b: _decodable, *, foldspaces: bool = ..., - adobe: bool = ..., ignorechars: Union[str, bytes] = ...) -> bytes: ... + def a85encode(b: _encodable, *, foldspaces: bool = ..., wrapcol: int = ..., pad: bool = ..., adobe: bool = ...) -> bytes: ... + def a85decode(b: _decodable, *, foldspaces: bool = ..., adobe: bool = ..., ignorechars: Union[str, bytes] = ...) -> bytes: ... def b85encode(b: _encodable, pad: bool = ...) -> bytes: ... def b85decode(b: _decodable) -> bytes: ... diff --git a/stdlib/2and3/binascii.pyi b/stdlib/2and3/binascii.pyi index d3c07507cb7d..9e2ff673b91e 100644 --- a/stdlib/2and3/binascii.pyi +++ b/stdlib/2and3/binascii.pyi @@ -20,15 +20,21 @@ else: _Ascii = Union[bytes, Text] def a2b_uu(string: _Ascii) -> bytes: ... + if sys.version_info >= (3, 7): def b2a_uu(data: _Bytes, *, backtick: bool = ...) -> bytes: ... + else: def b2a_uu(data: _Bytes) -> bytes: ... + def a2b_base64(string: _Ascii) -> bytes: ... + if sys.version_info >= (3, 6): def b2a_base64(data: _Bytes, *, newline: bool = ...) -> bytes: ... + else: def b2a_base64(data: _Bytes) -> bytes: ... + def a2b_qp(string: _Ascii, header: bool = ...) -> bytes: ... def b2a_qp(data: _Bytes, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ... def a2b_hqx(string: _Ascii) -> bytes: ... diff --git a/stdlib/2and3/bisect.pyi b/stdlib/2and3/bisect.pyi index 5c541124ab58..bca67f0f1a7d 100644 --- a/stdlib/2and3/bisect.pyi +++ b/stdlib/2and3/bisect.pyi @@ -2,7 +2,7 @@ from typing import Any, Sequence, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") # TODO uncomment when mypy# 2035 is fixed # def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ... @@ -16,7 +16,6 @@ _T = TypeVar('_T') def bisect_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ... def bisect_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ... def bisect(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ... - def insort_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ... def insort_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ... def insort(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 5d47593011b5..ee457a579cac 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -49,17 +49,17 @@ from typing import ( if sys.version_info >= (3,): from typing import SupportsBytes, SupportsRound -_T = TypeVar('_T') -_T_co = TypeVar('_T_co', covariant=True) -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') -_S = TypeVar('_S') -_T1 = TypeVar('_T1') -_T2 = TypeVar('_T2') -_T3 = TypeVar('_T3') -_T4 = TypeVar('_T4') -_T5 = TypeVar('_T5') -_TT = TypeVar('_TT', bound='type') +_T = TypeVar("_T") +_T_co = TypeVar("_T_co", covariant=True) +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") +_S = TypeVar("_S") +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") +_T4 = TypeVar("_T4") +_T5 = TypeVar("_T5") +_TT = TypeVar("_TT", bound="type") class object: __doc__: Optional[str] @@ -68,7 +68,6 @@ class object: __module__: str if sys.version_info >= (3, 6): __annotations__: Dict[str, Any] - @property def __class__(self: _T) -> Type[_T]: ... @__class__.setter @@ -96,7 +95,6 @@ class staticmethod(object): # Special, only valid as a decorator. __func__: Callable if sys.version_info >= (3,): __isabstractmethod__: bool - def __init__(self, f: Callable) -> None: ... def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ... @@ -105,7 +103,6 @@ class classmethod(object): # Special, only valid as a decorator. __func__: Callable if sys.version_info >= (3,): __isabstractmethod__: bool - def __init__(self, f: Callable) -> None: ... def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ... def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ... @@ -125,7 +122,6 @@ class type(object): __qualname__: str __text_signature__: Optional[str] __weakrefoffset__: int - @overload def __init__(self, o: object) -> None: ... @overload @@ -164,7 +160,6 @@ class int: def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ... @overload def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ... - @property def real(self) -> int: ... @property @@ -174,14 +169,13 @@ class int: @property def denominator(self) -> int: ... def conjugate(self) -> int: ... - def bit_length(self) -> int: ... if sys.version_info >= (3,): def to_bytes(self, length: int, byteorder: str, *, signed: bool = ...) -> bytes: ... @classmethod - def from_bytes(cls, bytes: Sequence[int], byteorder: str, *, - signed: bool = ...) -> int: ... # TODO buffer object argument - + def from_bytes( + cls, bytes: Sequence[int], byteorder: str, *, signed: bool = ... + ) -> int: ... # TODO buffer object argument def __add__(self, x: int) -> int: ... def __sub__(self, x: int) -> int: ... def __mul__(self, x: int) -> int: ... @@ -218,14 +212,12 @@ class int: if sys.version_info >= (3,): def __round__(self, ndigits: Optional[int] = ...) -> int: ... def __getnewargs__(self) -> Tuple[int]: ... - def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... def __lt__(self, x: int) -> bool: ... def __le__(self, x: int) -> bool: ... def __gt__(self, x: int) -> bool: ... def __ge__(self, x: int) -> bool: ... - def __str__(self) -> str: ... def __float__(self) -> float: ... def __int__(self) -> int: ... @@ -244,13 +236,11 @@ class float: def is_integer(self) -> bool: ... @classmethod def fromhex(cls, s: str) -> float: ... - @property def real(self) -> float: ... @property def imag(self) -> float: ... def conjugate(self) -> float: ... - def __add__(self, x: float) -> float: ... def __sub__(self, x: float) -> float: ... def __mul__(self, x: float) -> float: ... @@ -279,7 +269,6 @@ class float: def __round__(self, ndigits: None) -> int: ... @overload def __round__(self, ndigits: int) -> float: ... - def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... def __lt__(self, x: float) -> bool: ... @@ -288,7 +277,6 @@ class float: def __ge__(self, x: float) -> bool: ... def __neg__(self) -> float: ... def __pos__(self) -> float: ... - def __str__(self) -> str: ... def __int__(self) -> int: ... def __float__(self) -> float: ... @@ -306,14 +294,11 @@ class complex: def __init__(self, s: str) -> None: ... @overload def __init__(self, s: SupportsComplex) -> None: ... - @property def real(self) -> float: ... @property def imag(self) -> float: ... - def conjugate(self) -> complex: ... - def __add__(self, x: complex) -> complex: ... def __sub__(self, x: complex) -> complex: ... def __mul__(self, x: complex) -> complex: ... @@ -328,12 +313,10 @@ class complex: if sys.version_info < (3,): def __rdiv__(self, x: complex) -> complex: ... def __rtruediv__(self, x: complex) -> complex: ... - def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... def __neg__(self) -> complex: ... def __pos__(self) -> complex: ... - def __str__(self) -> str: ... def __complex__(self) -> complex: ... def __abs__(self) -> float: ... @@ -347,7 +330,6 @@ if sys.version_info >= (3,): _str_base = object else: class basestring(metaclass=ABCMeta): ... - class unicode(basestring, Sequence[unicode]): @overload def __init__(self) -> None: ... @@ -360,8 +342,7 @@ else: def count(self, x: unicode) -> int: ... def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... - def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = ..., - end: int = ...) -> bool: ... + def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = ..., end: int = ...) -> bool: ... def expandtabs(self, tabsize: int = ...) -> unicode: ... def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def format(self, *args: Any, **kwargs: Any) -> unicode: ... @@ -391,15 +372,13 @@ else: def rstrip(self, chars: unicode = ...) -> unicode: ... def split(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ... def splitlines(self, keepends: bool = ...) -> List[unicode]: ... - def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = ..., - end: int = ...) -> bool: ... + def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = ..., end: int = ...) -> bool: ... def strip(self, chars: unicode = ...) -> unicode: ... def swapcase(self) -> unicode: ... def title(self) -> unicode: ... def translate(self, table: Union[Dict[int, Any], unicode]) -> unicode: ... def upper(self) -> unicode: ... def zfill(self, width: int) -> unicode: ... - @overload def __getitem__(self, i: int) -> unicode: ... @overload @@ -415,7 +394,6 @@ else: def __le__(self, x: unicode) -> bool: ... def __gt__(self, x: unicode) -> bool: ... def __ge__(self, x: unicode) -> bool: ... - def __len__(self) -> int: ... # The argument type is incompatible with Sequence def __contains__(self, s: Union[unicode, bytes]) -> bool: ... # type: ignore @@ -426,7 +404,6 @@ else: def __float__(self) -> float: ... def __hash__(self) -> int: ... def __getnewargs__(self) -> Tuple[unicode]: ... - _str_base = basestring class str(Sequence[str], _str_base): @@ -437,7 +414,6 @@ class str(Sequence[str], _str_base): def __init__(self, o: bytes, encoding: str = ..., errors: str = ...) -> None: ... else: def __init__(self, o: object = ...) -> None: ... - def capitalize(self) -> str: ... if sys.version_info >= (3, 3): def casefold(self) -> str: ... @@ -447,8 +423,9 @@ class str(Sequence[str], _str_base): def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ... def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ... if sys.version_info >= (3,): - def endswith(self, suffix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., - end: Optional[int] = ...) -> bool: ... + def endswith( + self, suffix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ... + ) -> bool: ... else: def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ... def expandtabs(self, tabsize: int = ...) -> str: ... @@ -524,8 +501,9 @@ class str(Sequence[str], _str_base): def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... def splitlines(self, keepends: bool = ...) -> List[str]: ... if sys.version_info >= (3,): - def startswith(self, prefix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., - end: Optional[int] = ...) -> bool: ... + def startswith( + self, prefix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ... + ) -> bool: ... def strip(self, chars: Optional[str] = ...) -> str: ... else: def startswith(self, prefix: Union[Text, Tuple[Text, ...]]) -> bool: ... @@ -548,7 +526,6 @@ class str(Sequence[str], _str_base): @staticmethod @overload def maketrans(x: str, y: str, z: str = ...) -> Dict[int, Union[int, None]]: ... - if sys.version_info >= (3,): def __add__(self, s: str) -> str: ... else: @@ -571,7 +548,6 @@ class str(Sequence[str], _str_base): def __rmul__(self, n: int) -> str: ... def __str__(self) -> str: ... def __getnewargs__(self) -> Tuple[str]: ... - if sys.version_info < (3,): def __getslice__(self, start: int, stop: int) -> str: ... def __float__(self) -> float: ... @@ -582,8 +558,7 @@ if sys.version_info >= (3,): @overload def __init__(self, ints: Iterable[int]) -> None: ... @overload - def __init__(self, string: str, encoding: str, - errors: str = ...) -> None: ... + def __init__(self, string: str, encoding: str, errors: str = ...) -> None: ... @overload def __init__(self, length: int) -> None: ... @overload @@ -624,10 +599,7 @@ if sys.version_info >= (3,): def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ... def splitlines(self, keepends: bool = ...) -> List[bytes]: ... def startswith( - self, - prefix: Union[bytes, Tuple[bytes, ...]], - start: Optional[int] = ..., - end: Optional[int] = ..., + self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ... ) -> bool: ... def strip(self, chars: Optional[bytes] = ...) -> bytes: ... def swapcase(self) -> bytes: ... @@ -639,7 +611,6 @@ if sys.version_info >= (3,): def fromhex(cls, s: str) -> bytes: ... @classmethod def maketrans(cls, frm: bytes, to: bytes) -> bytes: ... - def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ... def __str__(self) -> str: ... @@ -665,6 +636,7 @@ if sys.version_info >= (3,): def __gt__(self, x: bytes) -> bool: ... def __ge__(self, x: bytes) -> bool: ... def __getnewargs__(self) -> Tuple[bytes]: ... + else: bytes = str @@ -740,10 +712,7 @@ class bytearray(MutableSequence[int], ByteString): def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ... def splitlines(self, keepends: bool = ...) -> List[bytearray]: ... def startswith( - self, - prefix: Union[bytes, Tuple[bytes, ...]], - start: Optional[int] = ..., - end: Optional[int] = ..., + self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ... ) -> bool: ... def strip(self, chars: Optional[bytes] = ...) -> bytearray: ... def swapcase(self) -> bytearray: ... @@ -759,7 +728,6 @@ class bytearray(MutableSequence[int], ByteString): if sys.version_info >= (3,): @classmethod def maketrans(cls, frm: bytes, to: bytes) -> bytes: ... - def __len__(self) -> int: ... def __iter__(self) -> Iterator[int]: ... def __str__(self) -> str: ... @@ -818,29 +786,26 @@ class memoryview(Sized, Container[_mv_container_type]): contiguous: bool def __init__(self, obj: Union[bytes, bytearray, memoryview]) -> None: ... def __enter__(self) -> memoryview: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... else: def __init__(self, obj: Union[bytes, bytearray, buffer, memoryview]) -> None: ... - @overload def __getitem__(self, i: int) -> _mv_container_type: ... @overload def __getitem__(self, s: slice) -> memoryview: ... - def __contains__(self, x: object) -> bool: ... def __iter__(self) -> Iterator[_mv_container_type]: ... def __len__(self) -> int: ... - @overload def __setitem__(self, i: int, o: bytes) -> None: ... @overload def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ... @overload def __setitem__(self, s: slice, o: memoryview) -> None: ... - def tobytes(self) -> bytes: ... def tolist(self) -> List[int]: ... - if sys.version_info >= (3, 5): def hex(self) -> str: ... @@ -933,7 +898,6 @@ class list(MutableSequence[_T], Generic[_T]): def sort(self, *, key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...) -> None: ... else: def sort(self, cmp: Callable[[_T, _T], Any] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ...) -> None: ... - def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... def __str__(self) -> str: ... @@ -973,9 +937,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __init__(self, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... - def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ... - if sys.version_info < (3,): def has_key(self, k: _KT) -> bool: ... def clear(self) -> None: ... @@ -1099,6 +1061,7 @@ if sys.version_info >= (3,): def __getitem__(self, s: slice) -> range: ... def __repr__(self) -> str: ... def __reversed__(self) -> Iterator[int]: ... + else: class xrange(Sized, Iterable[int], Reversible[int]): @overload @@ -1111,10 +1074,13 @@ else: def __reversed__(self) -> Iterator[int]: ... class property(object): - def __init__(self, fget: Optional[Callable[[Any], Any]] = ..., - fset: Optional[Callable[[Any, Any], None]] = ..., - fdel: Optional[Callable[[Any], None]] = ..., - doc: Optional[str] = ...) -> None: ... + def __init__( + self, + fget: Optional[Callable[[Any], Any]] = ..., + fset: Optional[Callable[[Any, Any], None]] = ..., + fdel: Optional[Callable[[Any], None]] = ..., + doc: Optional[str] = ..., + ) -> None: ... def getter(self, fget: Callable[[Any], Any]) -> property: ... def setter(self, fset: Callable[[Any, Any], None]) -> property: ... def deleter(self, fdel: Callable[[Any], None]) -> property: ... @@ -1133,82 +1099,133 @@ NotImplemented: Any def abs(__n: SupportsAbs[_T]) -> _T: ... def all(__i: Iterable[object]) -> bool: ... def any(__i: Iterable[object]) -> bool: ... + if sys.version_info < (3,): - def apply(__func: Callable[..., _T], __args: Optional[Sequence[Any]] = ..., __kwds: Optional[Mapping[str, Any]] = ...) -> _T: ... + def apply( + __func: Callable[..., _T], __args: Optional[Sequence[Any]] = ..., __kwds: Optional[Mapping[str, Any]] = ... + ) -> _T: ... + if sys.version_info >= (3,): def ascii(__o: object) -> str: ... class _SupportsIndex(Protocol): def __index__(self) -> int: ... + def bin(__number: Union[int, _SupportsIndex]) -> str: ... if sys.version_info >= (3, 7): def breakpoint(*args: Any, **kws: Any) -> None: ... + def callable(__o: object) -> bool: ... def chr(__code: int) -> str: ... + if sys.version_info < (3,): def cmp(__x: Any, __y: Any) -> int: ... - _N1 = TypeVar('_N1', bool, int, float, complex) + _N1 = TypeVar("_N1", bool, int, float, complex) def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ... + if sys.version_info >= (3, 6): # This class is to be exported as PathLike from os, # but we define it here as _PathLike to avoid import cycle issues. # See https://github.com/python/typeshed/pull/991#issuecomment-288160993 class _PathLike(Generic[AnyStr]): def __fspath__(self) -> AnyStr: ... - def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ... + def compile( + source: Union[str, bytes, mod, AST], + filename: Union[str, bytes, _PathLike], + mode: str, + flags: int = ..., + dont_inherit: int = ..., + optimize: int = ..., + ) -> Any: ... + elif sys.version_info >= (3,): - def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ... + def compile( + source: Union[str, bytes, mod, AST], + filename: Union[str, bytes], + mode: str, + flags: int = ..., + dont_inherit: int = ..., + optimize: int = ..., + ) -> Any: ... + else: def compile(source: Union[Text, mod], filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ... + if sys.version_info >= (3,): def copyright() -> None: ... def credits() -> None: ... + def delattr(__o: Any, __name: Text) -> None: ... def dir(__o: object = ...) -> List[str]: ... -_N2 = TypeVar('_N2', int, float) + +_N2 = TypeVar("_N2", int, float) + def divmod(__a: _N2, __b: _N2) -> Tuple[_N2, _N2]: ... -def eval(__source: Union[Text, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...) -> Any: ... +def eval( + __source: Union[Text, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ... +) -> Any: ... + if sys.version_info >= (3,): - def exec(__object: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...) -> Any: ... + def exec( + __object: Union[str, bytes, CodeType], + __globals: Optional[Dict[str, Any]] = ..., + __locals: Optional[Mapping[str, Any]] = ..., + ) -> Any: ... + else: - def execfile(__filename: str, __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Dict[str, Any]] = ...) -> None: ... + def execfile( + __filename: str, __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Dict[str, Any]] = ... + ) -> None: ... + def exit(code: object = ...) -> NoReturn: ... + if sys.version_info >= (3,): @overload def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> Iterator[_T]: ... @overload def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ... + else: @overload - def filter(__function: Callable[[AnyStr], Any], # type: ignore - __iterable: AnyStr) -> AnyStr: ... + def filter( + __function: Callable[[AnyStr], Any], # type: ignore + __iterable: AnyStr, + ) -> AnyStr: ... @overload - def filter(__function: None, # type: ignore - __iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ... + def filter( + __function: None, # type: ignore + __iterable: Tuple[Optional[_T], ...], + ) -> Tuple[_T, ...]: ... @overload - def filter(__function: Callable[[_T], Any], # type: ignore - __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... + def filter( + __function: Callable[[_T], Any], # type: ignore + __iterable: Tuple[_T, ...], + ) -> Tuple[_T, ...]: ... @overload - def filter(__function: None, - __iterable: Iterable[Optional[_T]]) -> List[_T]: ... + def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> List[_T]: ... @overload - def filter(__function: Callable[[_T], Any], - __iterable: Iterable[_T]) -> List[_T]: ... + def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ... + def format(__o: object, __format_spec: str = ...) -> str: ... # TODO unicode def getattr(__o: Any, name: Text, __default: Any = ...) -> Any: ... def globals() -> Dict[str, Any]: ... def hasattr(__o: Any, __name: Text) -> bool: ... def hash(__o: object) -> int: ... + if sys.version_info >= (3,): def help(*args: Any, **kwds: Any) -> None: ... + def hex(__i: Union[int, _SupportsIndex]) -> str: ... def id(__o: object) -> int: ... + if sys.version_info >= (3,): def input(__prompt: Any = ...) -> str: ... + else: def input(__prompt: Any = ...) -> Any: ... def intern(__string: str) -> str: ... + @overload def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... @overload @@ -1216,109 +1233,120 @@ def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ... def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ... def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ... def len(__o: Sized) -> int: ... + if sys.version_info >= (3,): def license() -> None: ... + def locals() -> Dict[str, Any]: ... + if sys.version_info >= (3,): @overload def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> Iterator[_S]: ... @overload - def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], - __iter2: Iterable[_T2]) -> Iterator[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> Iterator[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3, _T4], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> Iterator[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5]) -> Iterator[_S]: ... - @overload - def map(__func: Callable[..., _S], - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> Iterator[_S]: ... + def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] + ) -> Iterator[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3, _T4], _S], + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + ) -> Iterator[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + __iter5: Iterable[_T5], + ) -> Iterator[_S]: ... + @overload + def map( + __func: Callable[..., _S], + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> Iterator[_S]: ... + else: @overload def map(__func: None, __iter1: Iterable[_T1]) -> List[_T1]: ... @overload - def map(__func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... - @overload - def map(__func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... - @overload - def map(__func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... - @overload - def map(__func: None, - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... - @overload - def map(__func: None, - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ... + def map(__func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... + @overload + def map( + __func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] + ) -> List[Tuple[_T1, _T2, _T3]]: ... + @overload + def map( + __func: None, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] + ) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... + @overload + def map( + __func: None, + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + __iter5: Iterable[_T5], + ) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + @overload + def map( + __func: None, + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> List[Tuple[Any, ...]]: ... @overload def map(__func: Callable[[_T1], _S], __iter1: Iterable[_T1]) -> List[_S]: ... @overload - def map(__func: Callable[[_T1, _T2], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2]) -> List[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> List[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3, _T4], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> List[_S]: ... - @overload - def map(__func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - __iter3: Iterable[_T3], - __iter4: Iterable[_T4], - __iter5: Iterable[_T5]) -> List[_S]: ... - @overload - def map(__func: Callable[..., _S], - __iter1: Iterable[Any], - __iter2: Iterable[Any], - __iter3: Iterable[Any], - __iter4: Iterable[Any], - __iter5: Iterable[Any], - __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> List[_S]: ... + def map(__func: Callable[[_T1, _T2], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3], _S], __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3] + ) -> List[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3, _T4], _S], + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + ) -> List[_S]: ... + @overload + def map( + __func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], + __iter1: Iterable[_T1], + __iter2: Iterable[_T2], + __iter3: Iterable[_T3], + __iter4: Iterable[_T4], + __iter5: Iterable[_T5], + ) -> List[_S]: ... + @overload + def map( + __func: Callable[..., _S], + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> List[_S]: ... + if sys.version_info >= (3,): @overload def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @@ -1326,11 +1354,13 @@ if sys.version_info >= (3,): def max(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... @overload def max(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ..., default: _VT) -> Union[_T, _VT]: ... + else: @overload def max(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @overload def max(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... + if sys.version_info >= (3,): @overload def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @@ -1338,11 +1368,13 @@ if sys.version_info >= (3,): def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... @overload def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ..., default: _VT) -> Union[_T, _VT]: ... + else: @overload def min(__arg1: _T, __arg2: _T, *_args: _T, key: Callable[[_T], Any] = ...) -> _T: ... @overload def min(__iterable: Iterable[_T], *, key: Callable[[_T], Any] = ...) -> _T: ... + @overload def next(__i: Iterator[_T]) -> _T: ... @overload @@ -1350,26 +1382,45 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ... def oct(__i: Union[int, _SupportsIndex]) -> str: ... if sys.version_info >= (3, 6): - def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., - opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... + def open( + file: Union[str, bytes, int, _PathLike], + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ..., + closefd: bool = ..., + opener: Optional[Callable[[str, int], int]] = ..., + ) -> IO[Any]: ... + elif sys.version_info >= (3,): - def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., - opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... + def open( + file: Union[str, bytes, int], + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ..., + closefd: bool = ..., + opener: Optional[Callable[[str, int], int]] = ..., + ) -> IO[Any]: ... + else: def open(name: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ... def ord(__c: Union[Text, bytes]) -> int: ... + if sys.version_info >= (3,): class _Writer(Protocol): def write(self, __s: str) -> Any: ... def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ..., flush: bool = ...) -> None: ... + else: class _Writer(Protocol): def write(self, __s: Any) -> Any: ... # This is only available after from __future__ import print_function. def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ...) -> None: ... + @overload def pow(__x: int, __y: int) -> Any: ... # The return type can be int or float, depending on y @overload @@ -1379,6 +1430,7 @@ def pow(__x: float, __y: float) -> float: ... @overload def pow(__x: float, __y: float, __z: float) -> float: ... def quit(code: object = ...) -> NoReturn: ... + if sys.version_info < (3,): def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... def raw_input(__prompt: Any = ...) -> str: ... @@ -1387,11 +1439,13 @@ if sys.version_info < (3,): @overload def reduce(__function: Callable[[_T, _T], _T], __iterable: Iterable[_T]) -> _T: ... def reload(__module: Any) -> Any: ... + @overload def reversed(__object: Sequence[_T]) -> Iterator[_T]: ... @overload def reversed(__object: Reversible[_T]) -> Iterator[_T]: ... def repr(__o: object) -> str: ... + if sys.version_info >= (3,): @overload def round(number: float) -> int: ... @@ -1405,6 +1459,7 @@ if sys.version_info >= (3,): def round(number: SupportsRound[_T], ndigits: None) -> int: ... # type: ignore @overload def round(number: SupportsRound[_T], ndigits: int) -> _T: ... + else: @overload def round(number: float) -> float: ... @@ -1414,72 +1469,92 @@ else: def round(number: SupportsFloat) -> float: ... @overload def round(number: SupportsFloat, ndigits: int) -> float: ... + def setattr(__object: Any, __name: Text, __value: Any) -> None: ... + if sys.version_info >= (3,): - def sorted(__iterable: Iterable[_T], *, - key: Optional[Callable[[_T], Any]] = ..., - reverse: bool = ...) -> List[_T]: ... + def sorted(__iterable: Iterable[_T], *, key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...) -> List[_T]: ... + else: - def sorted(__iterable: Iterable[_T], *, - cmp: Callable[[_T, _T], int] = ..., - key: Callable[[_T], Any] = ..., - reverse: bool = ...) -> List[_T]: ... + def sorted( + __iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Callable[[_T], Any] = ..., reverse: bool = ... + ) -> List[_T]: ... + @overload def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ... @overload def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ... + if sys.version_info < (3,): def unichr(__i: int) -> unicode: ... + def vars(__object: Any = ...) -> Dict[str, Any]: ... + if sys.version_info >= (3,): @overload def zip(__iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... @overload def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... + def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... + def zip( + __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] + ) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], - __iter4: Iterable[_T4], __iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + def zip( + __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] + ) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload - def zip(__iter1: Iterable[Any], __iter2: Iterable[Any], __iter3: Iterable[Any], - __iter4: Iterable[Any], __iter5: Iterable[Any], __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ... + def zip( + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> Iterator[Tuple[Any, ...]]: ... + else: @overload def zip(__iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ... @overload - def zip(__iter1: Iterable[_T1], - __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... + def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], - __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... + def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], - __iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... + def zip( + __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] + ) -> List[Tuple[_T1, _T2, _T3, _T4]]: ... @overload - def zip(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], - __iter4: Iterable[_T4], __iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... + def zip( + __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] + ) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload - def zip(__iter1: Iterable[Any], __iter2: Iterable[Any], __iter3: Iterable[Any], - __iter4: Iterable[Any], __iter5: Iterable[Any], __iter6: Iterable[Any], - *iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ... -def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ..., - fromlist: List[str] = ..., level: int = ...) -> Any: ... + def zip( + __iter1: Iterable[Any], + __iter2: Iterable[Any], + __iter3: Iterable[Any], + __iter4: Iterable[Any], + __iter5: Iterable[Any], + __iter6: Iterable[Any], + *iterables: Iterable[Any] + ) -> List[Tuple[Any, ...]]: ... + +def __import__( + name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ..., fromlist: List[str] = ..., level: int = ... +) -> Any: ... # Actually the type of Ellipsis is , but since it's # not exposed anywhere under that name, we make it private here. class ellipsis: ... + Ellipsis: ellipsis if sys.version_info < (3,): # TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check. - _AnyBuffer = TypeVar('_AnyBuffer', str, unicode, bytearray, buffer) - + _AnyBuffer = TypeVar("_AnyBuffer", str, unicode, bytearray, buffer) class buffer(Sized): def __init__(self, object: _AnyBuffer, offset: int = ..., size: int = ...) -> None: ... def __add__(self, other: _AnyBuffer) -> str: ... @@ -1507,12 +1582,16 @@ class BaseException(object): class GeneratorExit(BaseException): ... class KeyboardInterrupt(BaseException): ... + class SystemExit(BaseException): code: int + class Exception(BaseException): ... + class StopIteration(Exception): if sys.version_info >= (3,): value: Any + if sys.version_info >= (3,): _StandardError = Exception class OSError(Exception): @@ -1539,28 +1618,32 @@ class AssertionError(_StandardError): ... class AttributeError(_StandardError): ... class BufferError(_StandardError): ... class EOFError(_StandardError): ... + class ImportError(_StandardError): if sys.version_info >= (3,): name: str path: str + class LookupError(_StandardError): ... class MemoryError(_StandardError): ... class NameError(_StandardError): ... class ReferenceError(_StandardError): ... class RuntimeError(_StandardError): ... + if sys.version_info >= (3, 5): class StopAsyncIteration(Exception): value: Any + class SyntaxError(_StandardError): msg: str lineno: int offset: Optional[int] text: str filename: str + class SystemError(_StandardError): ... class TypeError(_StandardError): ... class ValueError(_StandardError): ... - class FloatingPointError(ArithmeticError): ... class OverflowError(ArithmeticError): ... class ZeroDivisionError(ArithmeticError): ... @@ -1570,11 +1653,11 @@ if sys.version_info >= (3, 6): class IndexError(LookupError): ... class KeyError(LookupError): ... - class UnboundLocalError(NameError): ... class WindowsError(OSError): winerror: int + if sys.version_info >= (3,): class BlockingIOError(OSError): characters_written: int @@ -1594,31 +1677,31 @@ if sys.version_info >= (3,): class TimeoutError(OSError): ... class NotImplementedError(RuntimeError): ... + if sys.version_info >= (3, 5): class RecursionError(RuntimeError): ... class IndentationError(SyntaxError): ... class TabError(IndentationError): ... - class UnicodeError(ValueError): ... + class UnicodeDecodeError(UnicodeError): encoding: str object: bytes start: int end: int reason: str - def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, - __reason: str) -> None: ... + def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, __reason: str) -> None: ... + class UnicodeEncodeError(UnicodeError): encoding: str object: Text start: int end: int reason: str - def __init__(self, __encoding: str, __object: Text, __start: int, __end: int, - __reason: str) -> None: ... -class UnicodeTranslateError(UnicodeError): ... + def __init__(self, __encoding: str, __object: Text, __start: int, __end: int, __reason: str) -> None: ... +class UnicodeTranslateError(UnicodeError): ... class Warning(Exception): ... class UserWarning(Warning): ... class DeprecationWarning(Warning): ... @@ -1629,6 +1712,7 @@ class PendingDeprecationWarning(Warning): ... class ImportWarning(Warning): ... class UnicodeWarning(Warning): ... class BytesWarning(Warning): ... + if sys.version_info >= (3, 2): class ResourceWarning(Warning): ... @@ -1649,7 +1733,6 @@ if sys.version_info < (3,): def fileno(self) -> int: ... def isatty(self) -> bool: ... def close(self) -> None: ... - def readable(self) -> bool: ... def writable(self) -> bool: ... def seekable(self) -> bool: ... diff --git a/stdlib/2and3/bz2.pyi b/stdlib/2and3/bz2.pyi index 2a1082e3b243..2bfb56abdbd6 100644 --- a/stdlib/2and3/bz2.pyi +++ b/stdlib/2and3/bz2.pyi @@ -4,6 +4,7 @@ from typing import IO, Any, Optional, Union if sys.version_info >= (3, 6): from os import PathLike + _PathOrFile = Union[str, bytes, IO[Any], PathLike[Any]] elif sys.version_info >= (3, 3): _PathOrFile = Union[str, bytes, IO[Any]] @@ -14,19 +15,19 @@ def compress(data: bytes, compresslevel: int = ...) -> bytes: ... def decompress(data: bytes) -> bytes: ... if sys.version_info >= (3, 3): - def open(filename: _PathOrFile, - mode: str = ..., - compresslevel: int = ..., - encoding: Optional[str] = ..., - errors: Optional[str] = ..., - newline: Optional[str] = ...) -> IO[Any]: ... + def open( + filename: _PathOrFile, + mode: str = ..., + compresslevel: int = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ..., + ) -> IO[Any]: ... class BZ2File(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#5027 - def __init__(self, - filename: _PathOrFile, - mode: str = ..., - buffering: Optional[Any] = ..., - compresslevel: int = ...) -> None: ... + def __init__( + self, filename: _PathOrFile, mode: str = ..., buffering: Optional[Any] = ..., compresslevel: int = ... + ) -> None: ... class BZ2Compressor(object): def __init__(self, compresslevel: int = ...) -> None: ... diff --git a/stdlib/2and3/cProfile.pyi b/stdlib/2and3/cProfile.pyi index 71e25edb8355..57115c008d02 100644 --- a/stdlib/2and3/cProfile.pyi +++ b/stdlib/2and3/cProfile.pyi @@ -3,17 +3,21 @@ import sys from typing import Any, Callable, Dict, Optional, Text, TypeVar, Union def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ... -def runctx(statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ... +def runctx( + statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ... +) -> None: ... -_SelfT = TypeVar('_SelfT', bound='Profile') -_T = TypeVar('_T') +_SelfT = TypeVar("_SelfT", bound="Profile") +_T = TypeVar("_T") if sys.version_info >= (3, 6): _Path = Union[bytes, Text, os.PathLike[Any]] else: _Path = Union[bytes, Text] class Profile: - def __init__(self, custom_timer: Callable[[], float] = ..., time_unit: float = ..., subcalls: bool = ..., builtins: bool = ...) -> None: ... + def __init__( + self, custom_timer: Callable[[], float] = ..., time_unit: float = ..., subcalls: bool = ..., builtins: bool = ... + ) -> None: ... def enable(self) -> None: ... def disable(self) -> None: ... def print_stats(self, sort: Union[str, int] = ...) -> None: ... diff --git a/stdlib/2and3/calendar.pyi b/stdlib/2and3/calendar.pyi index 2472908d1646..af2aa83edbdb 100644 --- a/stdlib/2and3/calendar.pyi +++ b/stdlib/2and3/calendar.pyi @@ -81,6 +81,7 @@ if sys.version_info < (3, 0): def __init__(self, locale: _LocaleType) -> None: ... def __enter__(self) -> _LocaleType: ... def __exit__(self, *args: Any) -> None: ... + else: class different_locale: def __init__(self, locale: _LocaleType) -> None: ... @@ -98,6 +99,7 @@ class LocaleHTMLCalendar(HTMLCalendar): def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... c: TextCalendar + def setfirstweekday(firstweekday: int) -> None: ... def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... diff --git a/stdlib/2and3/cgi.pyi b/stdlib/2and3/cgi.pyi index b4272c3298db..e7efb16f14c8 100644 --- a/stdlib/2and3/cgi.pyi +++ b/stdlib/2and3/cgi.pyi @@ -1,28 +1,35 @@ import sys from typing import IO, Any, AnyStr, Dict, Iterable, List, Mapping, Optional, Tuple, TypeVar, Union -_T = TypeVar('_T', bound=FieldStorage) +_T = TypeVar("_T", bound=FieldStorage) -def parse(fp: IO[Any] = ..., environ: Mapping[str, str] = ..., - keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ... +def parse( + fp: IO[Any] = ..., environ: Mapping[str, str] = ..., keep_blank_values: bool = ..., strict_parsing: bool = ... +) -> Dict[str, List[str]]: ... def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ... def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ... + if sys.version_info >= (3, 7): - def parse_multipart(fp: IO[Any], pdict: Mapping[str, bytes], encoding: str = ..., errors: str = ...) -> Dict[str, List[Any]]: ... + def parse_multipart( + fp: IO[Any], pdict: Mapping[str, bytes], encoding: str = ..., errors: str = ... + ) -> Dict[str, List[Any]]: ... + else: def parse_multipart(fp: IO[Any], pdict: Mapping[str, bytes]) -> Dict[str, List[bytes]]: ... + def parse_header(s: str) -> Tuple[str, Dict[str, str]]: ... def test(environ: Mapping[str, str] = ...) -> None: ... def print_environ(environ: Mapping[str, str] = ...) -> None: ... def print_form(form: Dict[str, Any]) -> None: ... def print_directory() -> None: ... def print_environ_usage() -> None: ... + if sys.version_info >= (3, 0): def escape(s: str, quote: bool = ...) -> str: ... + else: def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ... - class MiniFieldStorage: # The first five "Any" attributes here are always None, but mypy doesn't support that filename: Any @@ -35,11 +42,9 @@ class MiniFieldStorage: headers: Dict[Any, Any] name: Any value: Any - def __init__(self, name: Any, value: Any) -> None: ... def __repr__(self) -> str: ... - class FieldStorage(object): FieldStorageClass: Optional[type] keep_blank_values: int @@ -65,13 +70,28 @@ class FieldStorage(object): value: Union[None, bytes, List[Any]] if sys.version_info >= (3, 0): - def __init__(self, fp: IO[Any] = ..., headers: Mapping[str, str] = ..., outerboundary: bytes = ..., - environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ..., - limit: int = ..., encoding: str = ..., errors: str = ...) -> None: ... + def __init__( + self, + fp: IO[Any] = ..., + headers: Mapping[str, str] = ..., + outerboundary: bytes = ..., + environ: Mapping[str, str] = ..., + keep_blank_values: int = ..., + strict_parsing: int = ..., + limit: int = ..., + encoding: str = ..., + errors: str = ..., + ) -> None: ... else: - def __init__(self, fp: IO[Any] = ..., headers: Mapping[str, str] = ..., outerboundary: bytes = ..., - environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ... - + def __init__( + self, + fp: IO[Any] = ..., + headers: Mapping[str, str] = ..., + outerboundary: bytes = ..., + environ: Mapping[str, str] = ..., + keep_blank_values: int = ..., + strict_parsing: int = ..., + ) -> None: ... if sys.version_info >= (3, 0): def __enter__(self: _T) -> _T: ... def __exit__(self, *args: Any) -> None: ... @@ -97,19 +117,14 @@ class FieldStorage(object): # In Python 2 it always returns bytes and ignores the "binary" flag def make_file(self, binary: Any = ...) -> IO[bytes]: ... - if sys.version_info < (3, 0): from UserDict import UserDict - class FormContentDict(UserDict): query_string: str def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ... - class SvFormContentDict(FormContentDict): def getlist(self, key: Any) -> Any: ... - class InterpFormContentDict(SvFormContentDict): ... - class FormContent(FormContentDict): # TODO this should have # def values(self, key: Any) -> Any: ... diff --git a/stdlib/2and3/cmath.pyi b/stdlib/2and3/cmath.pyi index 4b15f0b78f0f..db8072198b71 100644 --- a/stdlib/2and3/cmath.pyi +++ b/stdlib/2and3/cmath.pyi @@ -23,8 +23,10 @@ def atanh(x: _C) -> complex: ... def cos(x: _C) -> complex: ... def cosh(x: _C) -> complex: ... def exp(x: _C) -> complex: ... + if sys.version_info >= (3, 5): def isclose(a: _C, b: _C, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ... + def isinf(z: _C) -> bool: ... def isnan(z: _C) -> bool: ... def log(x: _C, base: _C = ...) -> complex: ... diff --git a/stdlib/2and3/code.pyi b/stdlib/2and3/code.pyi index 81b3e47ccfaa..da59019011da 100644 --- a/stdlib/2and3/code.pyi +++ b/stdlib/2and3/code.pyi @@ -6,19 +6,16 @@ from typing import Any, Callable, Mapping, Optional class InteractiveInterpreter: def __init__(self, locals: Optional[Mapping[str, Any]] = ...) -> None: ... - def runsource(self, source: str, filename: str = ..., - symbol: str = ...) -> bool: ... + def runsource(self, source: str, filename: str = ..., symbol: str = ...) -> bool: ... def runcode(self, code: CodeType) -> None: ... def showsyntaxerror(self, filename: Optional[str] = ...) -> None: ... def showtraceback(self) -> None: ... def write(self, data: str) -> None: ... class InteractiveConsole(InteractiveInterpreter): - def __init__(self, locals: Optional[Mapping[str, Any]] = ..., - filename: str = ...) -> None: ... + def __init__(self, locals: Optional[Mapping[str, Any]] = ..., filename: str = ...) -> None: ... if sys.version_info >= (3, 6): - def interact(self, banner: Optional[str] = ..., - exitmsg: Optional[str] = ...) -> None: ... + def interact(self, banner: Optional[str] = ..., exitmsg: Optional[str] = ...) -> None: ... else: def interact(self, banner: Optional[str] = ...) -> None: ... def push(self, line: str) -> bool: ... @@ -26,13 +23,16 @@ class InteractiveConsole(InteractiveInterpreter): def raw_input(self, prompt: str = ...) -> str: ... if sys.version_info >= (3, 6): - def interact(banner: Optional[str] = ..., - readfunc: Optional[Callable[[str], str]] = ..., - local: Optional[Mapping[str, Any]] = ..., - exitmsg: Optional[str] = ...) -> None: ... + def interact( + banner: Optional[str] = ..., + readfunc: Optional[Callable[[str], str]] = ..., + local: Optional[Mapping[str, Any]] = ..., + exitmsg: Optional[str] = ..., + ) -> None: ... + else: - def interact(banner: Optional[str] = ..., - readfunc: Optional[Callable[[str], str]] = ..., - local: Optional[Mapping[str, Any]] = ...) -> None: ... -def compile_command(source: str, filename: str = ..., - symbol: str = ...) -> Optional[CodeType]: ... + def interact( + banner: Optional[str] = ..., readfunc: Optional[Callable[[str], str]] = ..., local: Optional[Mapping[str, Any]] = ... + ) -> None: ... + +def compile_command(source: str, filename: str = ..., symbol: str = ...) -> Optional[CodeType]: ... diff --git a/stdlib/2and3/codecs.pyi b/stdlib/2and3/codecs.pyi index 2e12261a364a..a644ac64aadc 100644 --- a/stdlib/2and3/codecs.pyi +++ b/stdlib/2and3/codecs.pyi @@ -31,16 +31,19 @@ _Encoded = bytes class _Encoder(Protocol): def __call__(self, input: _Decoded, errors: str = ...) -> Tuple[_Encoded, int]: ... # signature of Codec().encode + class _Decoder(Protocol): def __call__(self, input: _Encoded, errors: str = ...) -> Tuple[_Decoded, int]: ... # signature of Codec().decode class _StreamReader(Protocol): def __call__(self, stream: IO[_Encoded], errors: str = ...) -> StreamReader: ... + class _StreamWriter(Protocol): def __call__(self, stream: IO[_Encoded], errors: str = ...) -> StreamWriter: ... class _IncrementalEncoder(Protocol): def __call__(self, errors: str = ...) -> IncrementalEncoder: ... + class _IncrementalDecoder(Protocol): def __call__(self, errors: str = ...) -> IncrementalDecoder: ... diff --git a/stdlib/2and3/contextlib.pyi b/stdlib/2and3/contextlib.pyi index 1d994a81cdf1..eb0297d749e1 100644 --- a/stdlib/2and3/contextlib.pyi +++ b/stdlib/2and3/contextlib.pyi @@ -2,6 +2,7 @@ import sys from types import TracebackType + # Aliased here for backwards compatibility; TODO eventually remove this from typing import IO, Any, Callable from typing import ContextManager as ContextManager @@ -15,17 +16,16 @@ if sys.version_info >= (3, 6): if sys.version_info >= (3, 7): from typing import AsyncContextManager as AbstractAsyncContextManager -_T = TypeVar('_T') +_T = TypeVar("_T") -_ExitFunc = Callable[[Optional[Type[BaseException]], - Optional[BaseException], - Optional[TracebackType]], bool] -_CM_EF = TypeVar('_CM_EF', ContextManager, _ExitFunc) +_ExitFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], bool] +_CM_EF = TypeVar("_CM_EF", ContextManager, _ExitFunc) if sys.version_info >= (3, 2): class GeneratorContextManager(ContextManager[_T], Generic[_T]): def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ... def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., GeneratorContextManager[_T]]: ... + else: def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ... @@ -41,7 +41,6 @@ class closing(ContextManager[_T], Generic[_T]): if sys.version_info >= (3, 4): class suppress(ContextManager[None]): def __init__(self, *exceptions: Type[BaseException]) -> None: ... - class redirect_stdout(ContextManager[None]): def __init__(self, new_target: IO[str]) -> None: ... @@ -52,15 +51,12 @@ if sys.version_info >= (3, 5): if sys.version_info >= (3,): class ContextDecorator: def __call__(self, func: Callable[..., None]) -> Callable[..., ContextManager[None]]: ... - - _U = TypeVar('_U', bound='ExitStack') - + _U = TypeVar("_U", bound="ExitStack") class ExitStack(ContextManager[ExitStack]): def __init__(self) -> None: ... def enter_context(self, cm: ContextManager[_T]) -> _T: ... def push(self, exit: _CM_EF) -> _CM_EF: ... - def callback(self, callback: Callable[..., Any], - *args: Any, **kwds: Any) -> Callable[..., Any]: ... + def callback(self, callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ... def pop_all(self: _U) -> _U: ... def close(self) -> None: ... def __enter__(self: _U) -> _U: ... @@ -68,24 +64,19 @@ if sys.version_info >= (3,): if sys.version_info >= (3, 7): from typing import Awaitable - _S = TypeVar('_S', bound='AsyncExitStack') + _S = TypeVar("_S", bound="AsyncExitStack") - _ExitCoroFunc = Callable[[Optional[Type[BaseException]], - Optional[BaseException], - Optional[TracebackType]], Awaitable[bool]] + _ExitCoroFunc = Callable[[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]], Awaitable[bool]] _CallbackCoroFunc = Callable[..., Awaitable[Any]] - _ACM_EF = TypeVar('_ACM_EF', AsyncContextManager, _ExitCoroFunc) - + _ACM_EF = TypeVar("_ACM_EF", AsyncContextManager, _ExitCoroFunc) class AsyncExitStack(AsyncContextManager[AsyncExitStack]): def __init__(self) -> None: ... def enter_context(self, cm: ContextManager[_T]) -> _T: ... def enter_async_context(self, cm: AsyncContextManager[_T]) -> Awaitable[_T]: ... def push(self, exit: _CM_EF) -> _CM_EF: ... def push_async_exit(self, exit: _ACM_EF) -> _ACM_EF: ... - def callback(self, callback: Callable[..., Any], - *args: Any, **kwds: Any) -> Callable[..., Any]: ... - def push_async_callback(self, callback: _CallbackCoroFunc, - *args: Any, **kwds: Any) -> _CallbackCoroFunc: ... + def callback(self, callback: Callable[..., Any], *args: Any, **kwds: Any) -> Callable[..., Any]: ... + def push_async_callback(self, callback: _CallbackCoroFunc, *args: Any, **kwds: Any) -> _CallbackCoroFunc: ... def pop_all(self: _S) -> _S: ... def aclose(self) -> Awaitable[None]: ... def __aenter__(self: _S) -> Awaitable[_S]: ... diff --git a/stdlib/2and3/copy.pyi b/stdlib/2and3/copy.pyi index 9d48432409df..8958711560a9 100644 --- a/stdlib/2and3/copy.pyi +++ b/stdlib/2and3/copy.pyi @@ -2,7 +2,7 @@ from typing import Any, Dict, Optional, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") # None in CPython but non-None in Jython PyStringMap: Any @@ -10,5 +10,7 @@ PyStringMap: Any # Note: memo and _nil are internal kwargs. def deepcopy(x: _T, memo: Optional[Dict[int, _T]] = ..., _nil: Any = ...) -> _T: ... def copy(x: _T) -> _T: ... + class Error(Exception): ... + error = Error diff --git a/stdlib/2and3/crypt.pyi b/stdlib/2and3/crypt.pyi index 522d95e1d7c0..7b71d9190cff 100644 --- a/stdlib/2and3/crypt.pyi +++ b/stdlib/2and3/crypt.pyi @@ -3,7 +3,6 @@ from typing import List, NamedTuple, Optional, Union if sys.version_info >= (3, 3): class _Method: ... - METHOD_CRYPT: _Method METHOD_MD5: _Method METHOD_SHA256: _Method @@ -18,5 +17,6 @@ if sys.version_info >= (3, 3): else: def mksalt(method: Optional[_Method] = ...) -> str: ... def crypt(word: str, salt: Optional[Union[str, _Method]] = ...) -> str: ... + else: def crypt(word: str, salt: str) -> str: ... diff --git a/stdlib/2and3/csv.pyi b/stdlib/2and3/csv.pyi index bd511cb742a0..50287fa3c0eb 100644 --- a/stdlib/2and3/csv.pyi +++ b/stdlib/2and3/csv.pyi @@ -53,7 +53,6 @@ if sys.version_info >= (3, 6): else: _DRMapping = Dict[str, str] - class DictReader(Iterator[_DRMapping]): restkey: Optional[str] restval: Optional[str] @@ -61,24 +60,37 @@ class DictReader(Iterator[_DRMapping]): dialect: _Dialect line_num: int fieldnames: Sequence[str] - def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ..., - restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ..., - *args: Any, **kwds: Any) -> None: ... + def __init__( + self, + f: Iterable[str], + fieldnames: Sequence[str] = ..., + restkey: Optional[str] = ..., + restval: Optional[str] = ..., + dialect: _Dialect = ..., + *args: Any, + **kwds: Any + ) -> None: ... def __iter__(self) -> DictReader: ... if sys.version_info >= (3,): def __next__(self) -> _DRMapping: ... else: def next(self) -> _DRMapping: ... - class DictWriter(object): fieldnames: Sequence[str] restval: Optional[Any] extrasaction: str writer: _writer - def __init__(self, f: Any, fieldnames: Sequence[str], - restval: Optional[Any] = ..., extrasaction: str = ..., dialect: _Dialect = ..., - *args: Any, **kwds: Any) -> None: ... + def __init__( + self, + f: Any, + fieldnames: Sequence[str], + restval: Optional[Any] = ..., + extrasaction: str = ..., + dialect: _Dialect = ..., + *args: Any, + **kwds: Any + ) -> None: ... def writeheader(self) -> None: ... def writerow(self, rowdict: _DictRow) -> None: ... def writerows(self, rowdicts: Iterable[_DictRow]) -> None: ... diff --git a/stdlib/2and3/ctypes/__init__.pyi b/stdlib/2and3/ctypes/__init__.pyi index 1b9d3e65fe72..cbd0e3163f9c 100644 --- a/stdlib/2and3/ctypes/__init__.pyi +++ b/stdlib/2and3/ctypes/__init__.pyi @@ -22,29 +22,30 @@ from typing import ( from typing import Union as _UnionT from typing import overload -_T = TypeVar('_T') -_DLLT = TypeVar('_DLLT', bound=CDLL) -_CT = TypeVar('_CT', bound=_CData) - +_T = TypeVar("_T") +_DLLT = TypeVar("_DLLT", bound=CDLL) +_CT = TypeVar("_CT", bound=_CData) RTLD_GLOBAL: int = ... RTLD_LOCAL: int = ... DEFAULT_MODE: int = ... - class CDLL(object): _func_flags_: ClassVar[int] = ... _func_restype_: ClassVar[_CData] = ... _name: str = ... _handle: int = ... _FuncPtr: Type[_FuncPointer] = ... - def __init__(self, name: str, mode: int = ..., handle: Optional[int] = ..., - use_errno: bool = ..., use_last_error: bool = ...) -> None: ... + def __init__( + self, name: str, mode: int = ..., handle: Optional[int] = ..., use_errno: bool = ..., use_last_error: bool = ... + ) -> None: ... def __getattr__(self, name: str) -> _FuncPointer: ... def __getitem__(self, name: str) -> _FuncPointer: ... -if sys.platform == 'win32': + +if sys.platform == "win32": class OleDLL(CDLL): ... class WinDLL(CDLL): ... + class PyDLL(CDLL): ... class LibraryLoader(Generic[_DLLT]): @@ -54,7 +55,7 @@ class LibraryLoader(Generic[_DLLT]): def LoadLibrary(self, name: str) -> _DLLT: ... cdll: LibraryLoader[CDLL] = ... -if sys.platform == 'win32': +if sys.platform == "win32": windll: LibraryLoader[WinDLL] = ... oledll: LibraryLoader[OleDLL] = ... pydll: LibraryLoader[PyDLL] = ... @@ -73,6 +74,7 @@ class _CDataMeta(type): # uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here. def __mul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore def __rmul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore + class _CData(metaclass=_CDataMeta): _b_base: int = ... _b_needsfree_: bool = ... @@ -90,15 +92,9 @@ class _CData(metaclass=_CDataMeta): class _PointerLike(_CData): ... -_ECT = Callable[[Optional[Type[_CData]], - _FuncPointer, - Tuple[_CData, ...]], - _CData] -_PF = _UnionT[ - Tuple[int], - Tuple[int, str], - Tuple[int, str, Any] -] +_ECT = Callable[[Optional[Type[_CData]], _FuncPointer, Tuple[_CData, ...]], _CData] +_PF = _UnionT[Tuple[int], Tuple[int, str], Tuple[int, str, Any]] + class _FuncPointer(_PointerLike, _CData): restype: _UnionT[Type[_CData], Callable[[int], None], None] = ... argtypes: Sequence[Type[_CData]] = ... @@ -108,28 +104,23 @@ class _FuncPointer(_PointerLike, _CData): @overload def __init__(self, callable: Callable[..., Any]) -> None: ... @overload - def __init__(self, func_spec: Tuple[_UnionT[str, int], CDLL], - paramflags: Tuple[_PF, ...] = ...) -> None: ... + def __init__(self, func_spec: Tuple[_UnionT[str, int], CDLL], paramflags: Tuple[_PF, ...] = ...) -> None: ... @overload - def __init__(self, vtlb_index: int, name: str, - paramflags: Tuple[_PF, ...] = ..., - iid: pointer[c_int] = ...) -> None: ... + def __init__(self, vtlb_index: int, name: str, paramflags: Tuple[_PF, ...] = ..., iid: pointer[c_int] = ...) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class ArgumentError(Exception): ... +def CFUNCTYPE( + restype: Optional[Type[_CData]], *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ... +) -> Type[_FuncPointer]: ... + +if sys.platform == "win32": + def WINFUNCTYPE( + restype: Optional[Type[_CData]], *argtypes: Type[_CData], use_errno: bool = ..., use_last_error: bool = ... + ) -> Type[_FuncPointer]: ... -def CFUNCTYPE(restype: Optional[Type[_CData]], - *argtypes: Type[_CData], - use_errno: bool = ..., - use_last_error: bool = ...) -> Type[_FuncPointer]: ... -if sys.platform == 'win32': - def WINFUNCTYPE(restype: Optional[Type[_CData]], - *argtypes: Type[_CData], - use_errno: bool = ..., - use_last_error: bool = ...) -> Type[_FuncPointer]: ... -def PYFUNCTYPE(restype: Optional[Type[_CData]], - *argtypes: Type[_CData]) -> Type[_FuncPointer]: ... +def PYFUNCTYPE(restype: Optional[Type[_CData]], *argtypes: Type[_CData]) -> Type[_FuncPointer]: ... class _CArgObject: ... @@ -145,21 +136,27 @@ _CVoidConstPLike = _UnionT[_CVoidPLike, bytes] def addressof(obj: _CData) -> int: ... def alignment(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ... def byref(obj: _CData, offset: int = ...) -> _CArgObject: ... -_PT = TypeVar('_PT', bound=_PointerLike) + +_PT = TypeVar("_PT", bound=_PointerLike) + def cast(obj: _UnionT[_CData, _CArgObject], type: Type[_PT]) -> _PT: ... -def create_string_buffer(init_or_size: _UnionT[int, bytes], - size: Optional[int] = ...) -> Array[c_char]: ... +def create_string_buffer(init_or_size: _UnionT[int, bytes], size: Optional[int] = ...) -> Array[c_char]: ... + c_buffer = create_string_buffer -def create_unicode_buffer(init_or_size: _UnionT[int, Text], - size: Optional[int] = ...) -> Array[c_wchar]: ... -if sys.platform == 'win32': + +def create_unicode_buffer(init_or_size: _UnionT[int, Text], size: Optional[int] = ...) -> Array[c_wchar]: ... + +if sys.platform == "win32": def DllCanUnloadNow() -> int: ... def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO not documented def FormatError(code: int) -> str: ... def GetLastError() -> int: ... + def get_errno() -> int: ... -if sys.platform == 'win32': + +if sys.platform == "win32": def get_last_error() -> int: ... + def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> None: ... def memset(dst: _CVoidPLike, c: int, count: int) -> None: ... def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ... @@ -181,16 +178,21 @@ class pointer(Generic[_CT], _PointerLike, _CData): def __setitem__(self, s: slice, o: Iterable[_CT]) -> None: ... def resize(obj: _CData, size: int) -> None: ... + if sys.version_info < (3,): def set_conversion_mode(encoding: str, errors: str) -> Tuple[str, str]: ... + def set_errno(value: int) -> int: ... -if sys.platform == 'win32': + +if sys.platform == "win32": def set_last_error(value: int) -> int: ... + def sizeof(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ... def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ... -if sys.platform == 'win32': - def WinError(code: Optional[int] = ..., - desc: Optional[str] = ...) -> WindowsError: ... + +if sys.platform == "win32": + def WinError(code: Optional[int] = ..., desc: Optional[str] = ...) -> WindowsError: ... + def wstring_at(address: _CVoidConstPLike, size: int = ...) -> str: ... class _SimpleCData(Generic[_T], _CData): @@ -201,50 +203,42 @@ class c_byte(_SimpleCData[int]): ... class c_char(_SimpleCData[bytes]): def __init__(self, value: _UnionT[int, bytes] = ...) -> None: ... + class c_char_p(_PointerLike, _SimpleCData[Optional[bytes]]): def __init__(self, value: Optional[_UnionT[int, bytes]] = ...) -> None: ... class c_double(_SimpleCData[float]): ... class c_longdouble(_SimpleCData[float]): ... class c_float(_SimpleCData[float]): ... - class c_int(_SimpleCData[int]): ... class c_int8(_SimpleCData[int]): ... class c_int16(_SimpleCData[int]): ... class c_int32(_SimpleCData[int]): ... class c_int64(_SimpleCData[int]): ... - class c_long(_SimpleCData[int]): ... class c_longlong(_SimpleCData[int]): ... - class c_short(_SimpleCData[int]): ... - class c_size_t(_SimpleCData[int]): ... class c_ssize_t(_SimpleCData[int]): ... - class c_ubyte(_SimpleCData[int]): ... - class c_uint(_SimpleCData[int]): ... class c_uint8(_SimpleCData[int]): ... class c_uint16(_SimpleCData[int]): ... class c_uint32(_SimpleCData[int]): ... class c_uint64(_SimpleCData[int]): ... - class c_ulong(_SimpleCData[int]): ... class c_ulonglong(_SimpleCData[int]): ... - class c_ushort(_SimpleCData[int]): ... - class c_void_p(_PointerLike, _SimpleCData[Optional[int]]): ... - class c_wchar(_SimpleCData[Text]): ... + class c_wchar_p(_PointerLike, _SimpleCData[Optional[Text]]): def __init__(self, value: Optional[_UnionT[int, Text]] = ...) -> None: ... class c_bool(_SimpleCData[bool]): def __init__(self, value: bool) -> None: ... -if sys.platform == 'win32': +if sys.platform == "win32": class HRESULT(_SimpleCData[int]): ... # TODO undocumented class py_object(_SimpleCData[_T]): ... @@ -252,11 +246,13 @@ class py_object(_SimpleCData[_T]): ... class _CField: offset: int = ... size: int = ... + class _StructUnionMeta(_CDataMeta): _fields_: Sequence[_UnionT[Tuple[str, Type[_CData]], Tuple[str, Type[_CData], int]]] = ... _pack_: int = ... _anonymous_: Sequence[str] = ... def __getattr__(self, name: str) -> _CField: ... + class _StructUnionBase(_CData, metaclass=_StructUnionMeta): def __init__(self, *args: Any, **kw: Any) -> None: ... def __getattr__(self, name: str) -> Any: ... diff --git a/stdlib/2and3/ctypes/util.pyi b/stdlib/2and3/ctypes/util.pyi index 45ddc3b599f6..3e95efc938cf 100644 --- a/stdlib/2and3/ctypes/util.pyi +++ b/stdlib/2and3/ctypes/util.pyi @@ -4,5 +4,6 @@ import sys from typing import Optional def find_library(name: str) -> Optional[str]: ... -if sys.platform == 'win32': + +if sys.platform == "win32": def find_msvcrt() -> Optional[str]: ... diff --git a/stdlib/2and3/ctypes/wintypes.pyi b/stdlib/2and3/ctypes/wintypes.pyi index 633096539aa8..c178a9bdf936 100644 --- a/stdlib/2and3/ctypes/wintypes.pyi +++ b/stdlib/2and3/ctypes/wintypes.pyi @@ -32,7 +32,9 @@ DOUBLE = c_double FLOAT = c_float BOOLEAN = BYTE BOOL = c_long + class VARIANT_BOOL(_SimpleCData[bool]): ... + ULONG = c_ulong LONG = c_long USHORT = c_ushort @@ -103,6 +105,7 @@ class RECT(Structure): top: LONG right: LONG bottom: LONG + RECTL = RECT _RECTL = RECT tagRECT = RECT @@ -112,6 +115,7 @@ class _SMALL_RECT(Structure): Top: SHORT Right: SHORT Bottom: SHORT + SMALL_RECT = _SMALL_RECT class _COORD(Structure): @@ -121,6 +125,7 @@ class _COORD(Structure): class POINT(Structure): x: LONG y: LONG + POINTL = POINT _POINTL = POINT tagPOINT = POINT @@ -128,6 +133,7 @@ tagPOINT = POINT class SIZE(Structure): cx: LONG cy: LONG + SIZEL = SIZE tagSIZE = SIZE @@ -136,6 +142,7 @@ def RGB(red: int, green: int, blue: int) -> int: ... class FILETIME(Structure): dwLowDateTime: DWORD dwHighDateTime: DWORD + _FILETIME = FILETIME class MSG(Structure): @@ -145,6 +152,7 @@ class MSG(Structure): lParam: LPARAM time: DWORD pt: POINT + tagMSG = MSG MAX_PATH: int diff --git a/stdlib/2and3/curses/__init__.pyi b/stdlib/2and3/curses/__init__.pyi index 315bac1c7ebe..585b79fa9b46 100644 --- a/stdlib/2and3/curses/__init__.pyi +++ b/stdlib/2and3/curses/__init__.pyi @@ -1,7 +1,7 @@ from _curses import * # noqa: F403 from typing import Any, Callable, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") LINES: int COLS: int diff --git a/stdlib/2and3/curses/ascii.pyi b/stdlib/2and3/curses/ascii.pyi index 95abff1f51a0..00ee4008f380 100644 --- a/stdlib/2and3/curses/ascii.pyi +++ b/stdlib/2and3/curses/ascii.pyi @@ -1,6 +1,6 @@ from typing import List, TypeVar, Union, overload -_Ch = TypeVar('_Ch', str, int) +_Ch = TypeVar("_Ch", str, int) NUL: int SOH: int diff --git a/stdlib/2and3/datetime.pyi b/stdlib/2and3/datetime.pyi index 5c83728a48e3..7469c5d30354 100644 --- a/stdlib/2and3/datetime.pyi +++ b/stdlib/2and3/datetime.pyi @@ -21,7 +21,6 @@ if sys.version_info >= (3, 2): utc: ClassVar[timezone] min: ClassVar[timezone] max: ClassVar[timezone] - def __init__(self, offset: timedelta, name: str = ...) -> None: ... def __hash__(self) -> int: ... @@ -31,9 +30,7 @@ class date: min: ClassVar[date] max: ClassVar[date] resolution: ClassVar[timedelta] - def __init__(self, year: int, month: int, day: int) -> None: ... - @classmethod def fromtimestamp(cls, t: float) -> date: ... @classmethod @@ -43,14 +40,12 @@ class date: if sys.version_info >= (3, 7): @classmethod def fromisoformat(cls, date_string: str) -> date: ... - @property def year(self) -> int: ... @property def month(self) -> int: ... @property def day(self) -> int: ... - def ctime(self) -> str: ... def strftime(self, fmt: _Text) -> str: ... if sys.version_info >= (3,): @@ -81,12 +76,20 @@ class time: resolution: ClassVar[timedelta] if sys.version_info >= (3, 6): - def __init__(self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., - tzinfo: Optional[_tzinfo] = ..., *, fold: int = ...) -> None: ... + def __init__( + self, + hour: int = ..., + minute: int = ..., + second: int = ..., + microsecond: int = ..., + tzinfo: Optional[_tzinfo] = ..., + *, + fold: int = ... + ) -> None: ... else: - def __init__(self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., - tzinfo: Optional[_tzinfo] = ...) -> None: ... - + def __init__( + self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[_tzinfo] = ... + ) -> None: ... @property def hour(self) -> int: ... @property @@ -100,7 +103,6 @@ class time: if sys.version_info >= (3, 6): @property def fold(self) -> int: ... - def __le__(self, other: time) -> bool: ... def __lt__(self, other: time) -> bool: ... def __ge__(self, other: time) -> bool: ... @@ -119,12 +121,20 @@ class time: def tzname(self) -> Optional[str]: ... def dst(self) -> Optional[int]: ... if sys.version_info >= (3, 6): - def replace(self, hour: int = ..., minute: int = ..., second: int = ..., - microsecond: int = ..., tzinfo: Optional[_tzinfo] = ..., - *, fold: int = ...) -> time: ... + def replace( + self, + hour: int = ..., + minute: int = ..., + second: int = ..., + microsecond: int = ..., + tzinfo: Optional[_tzinfo] = ..., + *, + fold: int = ... + ) -> time: ... else: - def replace(self, hour: int = ..., minute: int = ..., second: int = ..., - microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...) -> time: ... + def replace( + self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[_tzinfo] = ... + ) -> time: ... _date = date _time = time @@ -135,21 +145,35 @@ class timedelta(SupportsAbs[timedelta]): resolution: ClassVar[timedelta] if sys.version_info >= (3, 6): - def __init__(self, days: float = ..., seconds: float = ..., microseconds: float = ..., - milliseconds: float = ..., minutes: float = ..., hours: float = ..., - weeks: float = ..., *, fold: int = ...) -> None: ... + def __init__( + self, + days: float = ..., + seconds: float = ..., + microseconds: float = ..., + milliseconds: float = ..., + minutes: float = ..., + hours: float = ..., + weeks: float = ..., + *, + fold: int = ... + ) -> None: ... else: - def __init__(self, days: float = ..., seconds: float = ..., microseconds: float = ..., - milliseconds: float = ..., minutes: float = ..., hours: float = ..., - weeks: float = ...) -> None: ... - + def __init__( + self, + days: float = ..., + seconds: float = ..., + microseconds: float = ..., + milliseconds: float = ..., + minutes: float = ..., + hours: float = ..., + weeks: float = ..., + ) -> None: ... @property def days(self) -> int: ... @property def seconds(self) -> int: ... @property def microseconds(self) -> int: ... - def total_seconds(self) -> float: ... def __add__(self, other: timedelta) -> timedelta: ... def __radd__(self, other: timedelta) -> timedelta: ... @@ -188,14 +212,31 @@ class datetime(date): resolution: ClassVar[timedelta] if sys.version_info >= (3, 6): - def __init__(self, year: int, month: int, day: int, hour: int = ..., - minute: int = ..., second: int = ..., microsecond: int = ..., - tzinfo: Optional[_tzinfo] = ..., *, fold: int = ...) -> None: ... + def __init__( + self, + year: int, + month: int, + day: int, + hour: int = ..., + minute: int = ..., + second: int = ..., + microsecond: int = ..., + tzinfo: Optional[_tzinfo] = ..., + *, + fold: int = ... + ) -> None: ... else: - def __init__(self, year: int, month: int, day: int, hour: int = ..., - minute: int = ..., second: int = ..., microsecond: int = ..., - tzinfo: Optional[_tzinfo] = ...) -> None: ... - + def __init__( + self, + year: int, + month: int, + day: int, + hour: int = ..., + minute: int = ..., + second: int = ..., + microsecond: int = ..., + tzinfo: Optional[_tzinfo] = ..., + ) -> None: ... @property def year(self) -> int: ... @property @@ -215,7 +256,6 @@ class datetime(date): if sys.version_info >= (3, 6): @property def fold(self) -> int: ... - @classmethod def fromtimestamp(cls, t: float, tz: Optional[_tzinfo] = ...) -> datetime: ... @classmethod @@ -251,13 +291,31 @@ class datetime(date): def time(self) -> _time: ... def timetz(self) -> _time: ... if sys.version_info >= (3, 6): - def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ..., - minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: - Optional[_tzinfo] = ..., *, fold: int = ...) -> datetime: ... + def replace( + self, + year: int = ..., + month: int = ..., + day: int = ..., + hour: int = ..., + minute: int = ..., + second: int = ..., + microsecond: int = ..., + tzinfo: Optional[_tzinfo] = ..., + *, + fold: int = ... + ) -> datetime: ... else: - def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ..., - minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: - Optional[_tzinfo] = ...) -> datetime: ... + def replace( + self, + year: int = ..., + month: int = ..., + day: int = ..., + hour: int = ..., + minute: int = ..., + second: int = ..., + microsecond: int = ..., + tzinfo: Optional[_tzinfo] = ..., + ) -> datetime: ... if sys.version_info >= (3, 3): def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ... else: diff --git a/stdlib/2and3/decimal.pyi b/stdlib/2and3/decimal.pyi index 555f55c8af8f..976a8ea831e5 100644 --- a/stdlib/2and3/decimal.pyi +++ b/stdlib/2and3/decimal.pyi @@ -9,12 +9,9 @@ if sys.version_info >= (3,): _ComparableNum = Union[Decimal, float, numbers.Rational] else: _ComparableNum = Union[Decimal, float] -_DecimalT = TypeVar('_DecimalT', bound=Decimal) +_DecimalT = TypeVar("_DecimalT", bound=Decimal) -DecimalTuple = NamedTuple('DecimalTuple', - [('sign', int), - ('digits', Tuple[int, ...]), - ('exponent', int)]) +DecimalTuple = NamedTuple("DecimalTuple", [("sign", int), ("digits", Tuple[int, ...]), ("exponent", int)]) ROUND_DOWN: str ROUND_HALF_UP: str @@ -36,27 +33,16 @@ class DecimalException(ArithmeticError): def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ... class Clamped(DecimalException): ... - class InvalidOperation(DecimalException): ... - class ConversionSyntax(InvalidOperation): ... - class DivisionByZero(DecimalException, ZeroDivisionError): ... - class DivisionImpossible(InvalidOperation): ... - class DivisionUndefined(InvalidOperation, ZeroDivisionError): ... - class Inexact(DecimalException): ... - class InvalidContext(InvalidOperation): ... - class Rounded(DecimalException): ... - class Subnormal(DecimalException): ... - class Overflow(Inexact, Rounded): ... - class Underflow(Inexact, Rounded, Subnormal): ... if sys.version_info >= (3,): @@ -132,12 +118,12 @@ class Decimal(object): def __rpow__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ... def normalize(self, context: Optional[Context] = ...) -> Decimal: ... if sys.version_info >= (3,): - def quantize(self, exp: _Decimal, rounding: Optional[str] = ..., - context: Optional[Context] = ...) -> Decimal: ... + def quantize(self, exp: _Decimal, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ... def same_quantum(self, other: _Decimal, context: Optional[Context] = ...) -> bool: ... else: - def quantize(self, exp: _Decimal, rounding: Optional[str] = ..., - context: Optional[Context] = ..., watchexp: bool = ...) -> Decimal: ... + def quantize( + self, exp: _Decimal, rounding: Optional[str] = ..., context: Optional[Context] = ..., watchexp: bool = ... + ) -> Decimal: ... def same_quantum(self, other: _Decimal) -> bool: ... def to_integral_exact(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ... def to_integral_value(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ... @@ -218,19 +204,31 @@ class Context(object): traps: Dict[_TrapType, bool] flags: Dict[_TrapType, bool] if sys.version_info >= (3,): - def __init__(self, prec: Optional[int] = ..., rounding: Optional[str] = ..., - Emin: Optional[int] = ..., Emax: Optional[int] = ..., - capitals: Optional[int] = ..., clamp: Optional[int] = ..., - flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ..., - traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ..., - _ignored_flags: Optional[List[_TrapType]] = ...) -> None: ... + def __init__( + self, + prec: Optional[int] = ..., + rounding: Optional[str] = ..., + Emin: Optional[int] = ..., + Emax: Optional[int] = ..., + capitals: Optional[int] = ..., + clamp: Optional[int] = ..., + flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ..., + traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ..., + _ignored_flags: Optional[List[_TrapType]] = ..., + ) -> None: ... else: - def __init__(self, prec: Optional[int] = ..., rounding: Optional[str] = ..., - traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ..., - flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ..., - Emin: Optional[int] = ..., Emax: Optional[int] = ..., - capitals: Optional[int] = ..., _clamp: Optional[int] = ..., - _ignored_flags: Optional[List[_TrapType]] = ...) -> None: ... + def __init__( + self, + prec: Optional[int] = ..., + rounding: Optional[str] = ..., + traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ..., + flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ..., + Emin: Optional[int] = ..., + Emax: Optional[int] = ..., + capitals: Optional[int] = ..., + _clamp: Optional[int] = ..., + _ignored_flags: Optional[List[_TrapType]] = ..., + ) -> None: ... if sys.version_info >= (3,): # __setattr__() only allows to set a specific set of attributes, # already defined above. diff --git a/stdlib/2and3/difflib.pyi b/stdlib/2and3/difflib.pyi index 6b7b85f6a229..c5cfffeb2a0e 100644 --- a/stdlib/2and3/difflib.pyi +++ b/stdlib/2and3/difflib.pyi @@ -17,41 +17,36 @@ from typing import ( Union, ) -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3,): _StrType = Text else: # Aliases can't point to type vars, so we need to redeclare AnyStr - _StrType = TypeVar('_StrType', Text, bytes) + _StrType = TypeVar("_StrType", Text, bytes) _JunkCallback = Union[Callable[[Text], bool], Callable[[str], bool]] -Match = NamedTuple('Match', [ - ('a', int), - ('b', int), - ('size', int), -]) +Match = NamedTuple("Match", [("a", int), ("b", int), ("size", int)]) class SequenceMatcher(Generic[_T]): - def __init__(self, isjunk: Optional[Callable[[_T], bool]] = ..., - a: Sequence[_T] = ..., b: Sequence[_T] = ..., - autojunk: bool = ...) -> None: ... + def __init__( + self, isjunk: Optional[Callable[[_T], bool]] = ..., a: Sequence[_T] = ..., b: Sequence[_T] = ..., autojunk: bool = ... + ) -> None: ... def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ... def set_seq1(self, a: Sequence[_T]) -> None: ... def set_seq2(self, b: Sequence[_T]) -> None: ... - def find_longest_match(self, alo: int, ahi: int, blo: int, - bhi: int) -> Match: ... + def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ... def get_matching_blocks(self) -> List[Match]: ... def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ... - def get_grouped_opcodes(self, n: int = ... - ) -> Iterable[List[Tuple[str, int, int, int, int]]]: ... + def get_grouped_opcodes(self, n: int = ...) -> Iterable[List[Tuple[str, int, int, int, int]]]: ... def ratio(self) -> float: ... def quick_ratio(self) -> float: ... def real_quick_ratio(self) -> float: ... -def get_close_matches(word: Sequence[_T], possibilities: Iterable[Sequence[_T]], - n: int = ..., cutoff: float = ...) -> List[Sequence[_T]]: ... +def get_close_matches( + word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ... +) -> List[Sequence[_T]]: ... class Differ: def __init__(self, linejunk: _JunkCallback = ..., charjunk: _JunkCallback = ...) -> None: ... @@ -59,28 +54,52 @@ class Differ: def IS_LINE_JUNK(line: _StrType) -> bool: ... def IS_CHARACTER_JUNK(line: _StrType) -> bool: ... -def unified_diff(a: Sequence[_StrType], b: Sequence[_StrType], fromfile: _StrType = ..., - tofile: _StrType = ..., fromfiledate: _StrType = ..., tofiledate: _StrType = ..., - n: int = ..., lineterm: _StrType = ...) -> Iterator[_StrType]: ... -def context_diff(a: Sequence[_StrType], b: Sequence[_StrType], fromfile: _StrType = ..., - tofile: _StrType = ..., fromfiledate: _StrType = ..., tofiledate: _StrType = ..., - n: int = ..., lineterm: _StrType = ...) -> Iterator[_StrType]: ... -def ndiff(a: Sequence[_StrType], b: Sequence[_StrType], - linejunk: _JunkCallback = ..., - charjunk: _JunkCallback = ... - ) -> Iterator[_StrType]: ... +def unified_diff( + a: Sequence[_StrType], + b: Sequence[_StrType], + fromfile: _StrType = ..., + tofile: _StrType = ..., + fromfiledate: _StrType = ..., + tofiledate: _StrType = ..., + n: int = ..., + lineterm: _StrType = ..., +) -> Iterator[_StrType]: ... +def context_diff( + a: Sequence[_StrType], + b: Sequence[_StrType], + fromfile: _StrType = ..., + tofile: _StrType = ..., + fromfiledate: _StrType = ..., + tofiledate: _StrType = ..., + n: int = ..., + lineterm: _StrType = ..., +) -> Iterator[_StrType]: ... +def ndiff( + a: Sequence[_StrType], b: Sequence[_StrType], linejunk: _JunkCallback = ..., charjunk: _JunkCallback = ... +) -> Iterator[_StrType]: ... class HtmlDiff(object): - def __init__(self, tabsize: int = ..., wrapcolumn: int = ..., - linejunk: _JunkCallback = ..., - charjunk: _JunkCallback = ... - ) -> None: ... - def make_file(self, fromlines: Sequence[_StrType], tolines: Sequence[_StrType], - fromdesc: _StrType = ..., todesc: _StrType = ..., context: bool = ..., - numlines: int = ...) -> _StrType: ... - def make_table(self, fromlines: Sequence[_StrType], tolines: Sequence[_StrType], - fromdesc: _StrType = ..., todesc: _StrType = ..., context: bool = ..., - numlines: int = ...) -> _StrType: ... + def __init__( + self, tabsize: int = ..., wrapcolumn: int = ..., linejunk: _JunkCallback = ..., charjunk: _JunkCallback = ... + ) -> None: ... + def make_file( + self, + fromlines: Sequence[_StrType], + tolines: Sequence[_StrType], + fromdesc: _StrType = ..., + todesc: _StrType = ..., + context: bool = ..., + numlines: int = ..., + ) -> _StrType: ... + def make_table( + self, + fromlines: Sequence[_StrType], + tolines: Sequence[_StrType], + fromdesc: _StrType = ..., + todesc: _StrType = ..., + context: bool = ..., + numlines: int = ..., + ) -> _StrType: ... def restore(delta: Iterable[_StrType], which: int) -> Iterator[_StrType]: ... @@ -94,5 +113,5 @@ if sys.version_info >= (3, 5): fromfiledate: bytes = ..., tofiledate: bytes = ..., n: int = ..., - lineterm: bytes = ... + lineterm: bytes = ..., ) -> Iterator[bytes]: ... diff --git a/stdlib/2and3/dis.pyi b/stdlib/2and3/dis.pyi index 63aa89e9c917..717e5f0ddd9f 100644 --- a/stdlib/2and3/dis.pyi +++ b/stdlib/2and3/dis.pyi @@ -25,39 +25,35 @@ if sys.version_info >= (3, 6): _have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]] _have_code_or_string = Union[_have_code, str, bytes] - if sys.version_info >= (3, 4): Instruction = NamedTuple( "Instruction", [ - ('opname', str), - ('opcode', int), - ('arg', Optional[int]), - ('argval', Any), - ('argrepr', str), - ('offset', int), - ('starts_line', Optional[int]), - ('is_jump_target', bool) - ] + ("opname", str), + ("opcode", int), + ("arg", Optional[int]), + ("argval", Any), + ("argrepr", str), + ("offset", int), + ("starts_line", Optional[int]), + ("is_jump_target", bool), + ], ) - class Bytecode: codeobj: types.CodeType first_line: int - def __init__(self, x: _have_code_or_string, *, first_line: Optional[int] = ..., - current_offset: Optional[int] = ...) -> None: ... + def __init__( + self, x: _have_code_or_string, *, first_line: Optional[int] = ..., current_offset: Optional[int] = ... + ) -> None: ... def __iter__(self) -> Iterator[Instruction]: ... def __repr__(self) -> str: ... def info(self) -> str: ... def dis(self) -> str: ... - @classmethod def from_traceback(cls, tb: types.TracebackType) -> Bytecode: ... - COMPILER_FLAG_NAMES: Dict[int, str] - def findlabels(code: _have_code) -> List[int]: ... def findlinestarts(code: _have_code) -> Iterator[Tuple[int, int]]: ... @@ -71,13 +67,12 @@ if sys.version_info >= (3, 4): def disassemble(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ... def disco(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ... def show_code(co: _have_code, *, file: Optional[IO[str]] = ...) -> None: ... - def get_instructions(x: _have_code, *, first_line: Optional[int] = ...) -> Iterator[Instruction]: ... + else: def dis(x: _have_code_or_string = ...) -> None: ... def distb(tb: types.TracebackType = ...) -> None: ... def disassemble(co: _have_code, lasti: int = ...) -> None: ... def disco(co: _have_code, lasti: int = ...) -> None: ... - if sys.version_info >= (3, 0): def show_code(co: _have_code) -> None: ... diff --git a/stdlib/2and3/distutils/archive_util.pyi b/stdlib/2and3/distutils/archive_util.pyi index 002982a93910..533130f3fd7f 100644 --- a/stdlib/2and3/distutils/archive_util.pyi +++ b/stdlib/2and3/distutils/archive_util.pyi @@ -2,10 +2,13 @@ from typing import Optional -def make_archive(base_name: str, format: str, root_dir: Optional[str] = ..., - base_dir: Optional[str] = ..., verbose: int = ..., - dry_run: int = ...) -> str: ... -def make_tarball(base_name: str, base_dir: str, compress: Optional[str] = ..., - verbose: int = ..., dry_run: int = ...) -> str: ... -def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., - dry_run: int = ...) -> str: ... +def make_archive( + base_name: str, + format: str, + root_dir: Optional[str] = ..., + base_dir: Optional[str] = ..., + verbose: int = ..., + dry_run: int = ..., +) -> str: ... +def make_tarball(base_name: str, base_dir: str, compress: Optional[str] = ..., verbose: int = ..., dry_run: int = ...) -> str: ... +def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ... diff --git a/stdlib/2and3/distutils/ccompiler.pyi b/stdlib/2and3/distutils/ccompiler.pyi index da6361fa5342..33c137fadd50 100644 --- a/stdlib/2and3/distutils/ccompiler.pyi +++ b/stdlib/2and3/distutils/ccompiler.pyi @@ -4,22 +4,18 @@ from typing import Any, Callable, List, Optional, Tuple, Union _Macro = Union[Tuple[str], Tuple[str, str]] - -def gen_lib_options(compiler: CCompiler, library_dirs: List[str], - runtime_library_dirs: List[str], - libraries: List[str]) -> List[str]: ... -def gen_preprocess_options(macros: List[_Macro], - include_dirs: List[str]) -> List[str]: ... -def get_default_compiler(osname: Optional[str] = ..., - platform: Optional[str] = ...) -> str: ... -def new_compiler(plat: Optional[str] = ..., compiler: Optional[str] = ..., - verbose: int = ..., dry_run: int = ..., - force: int = ...) -> CCompiler: ... +def gen_lib_options( + compiler: CCompiler, library_dirs: List[str], runtime_library_dirs: List[str], libraries: List[str] +) -> List[str]: ... +def gen_preprocess_options(macros: List[_Macro], include_dirs: List[str]) -> List[str]: ... +def get_default_compiler(osname: Optional[str] = ..., platform: Optional[str] = ...) -> str: ... +def new_compiler( + plat: Optional[str] = ..., compiler: Optional[str] = ..., verbose: int = ..., dry_run: int = ..., force: int = ... +) -> CCompiler: ... def show_compilers() -> None: ... class CCompiler: - def __init__(self, verbose: int = ..., dry_run: int = ..., - force: int = ...) -> None: ... + def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ... def add_include_dir(self, dir: str) -> None: ... def set_include_dirs(self, dirs: List[str]) -> None: ... def add_library(self, libname: str) -> None: ... @@ -33,83 +29,111 @@ class CCompiler: def add_link_object(self, object: str) -> None: ... def set_link_objects(self, objects: List[str]) -> None: ... def detect_language(self, sources: Union[str, List[str]]) -> Optional[str]: ... - def find_library_file(self, dirs: List[str], lib: str, - debug: bool = ...) -> Optional[str]: ... - def has_function(self, funcname: str, includes: Optional[List[str]] = ..., - include_dirs: Optional[List[str]] = ..., - libraries: Optional[List[str]] = ..., - library_dirs: Optional[List[str]] = ...) -> bool: ... + def find_library_file(self, dirs: List[str], lib: str, debug: bool = ...) -> Optional[str]: ... + def has_function( + self, + funcname: str, + includes: Optional[List[str]] = ..., + include_dirs: Optional[List[str]] = ..., + libraries: Optional[List[str]] = ..., + library_dirs: Optional[List[str]] = ..., + ) -> bool: ... def library_dir_option(self, dir: str) -> str: ... def library_option(self, lib: str) -> str: ... def runtime_library_dir_option(self, dir: str) -> str: ... def set_executables(self, **args: str) -> None: ... - def compile(self, sources: List[str], output_dir: Optional[str] = ..., - macros: Optional[_Macro] = ..., - include_dirs: Optional[List[str]] = ..., debug: bool = ..., - extra_preargs: Optional[List[str]] = ..., - extra_postargs: Optional[List[str]] = ..., - depends: Optional[List[str]] = ...) -> List[str]: ... - def create_static_lib(self, objects: List[str], output_libname: str, - output_dir: Optional[str] = ..., debug: bool = ..., - target_lang: Optional[str] = ...) -> None: ... - def link(self, target_desc: str, objects: List[str], output_filename: str, - output_dir: Optional[str] = ..., - libraries: Optional[List[str]] = ..., - library_dirs: Optional[List[str]] = ..., - runtime_library_dirs: Optional[List[str]] = ..., - export_symbols: Optional[List[str]] = ..., debug: bool = ..., - extra_preargs: Optional[List[str]] = ..., - extra_postargs: Optional[List[str]] = ..., - build_temp: Optional[str] = ..., - target_lang: Optional[str] = ...) -> None: ... - def link_executable(self, objects: List[str], output_progname: str, - output_dir: Optional[str] = ..., - libraries: Optional[List[str]] = ..., - library_dirs: Optional[List[str]] = ..., - runtime_library_dirs: Optional[List[str]] = ..., - debug: bool = ..., - extra_preargs: Optional[List[str]] = ..., - extra_postargs: Optional[List[str]] = ..., - target_lang: Optional[str] = ...) -> None: ... - def link_shared_lib(self, objects: List[str], output_libname: str, - output_dir: Optional[str] = ..., - libraries: Optional[List[str]] = ..., - library_dirs: Optional[List[str]] = ..., - runtime_library_dirs: Optional[List[str]] = ..., - export_symbols: Optional[List[str]] = ..., - debug: bool = ..., - extra_preargs: Optional[List[str]] = ..., - extra_postargs: Optional[List[str]] = ..., - build_temp: Optional[str] = ..., - target_lang: Optional[str] = ...) -> None: ... - def link_shared_object(self, objects: List[str], output_filename: str, - output_dir: Optional[str] = ..., - libraries: Optional[List[str]] = ..., - library_dirs: Optional[List[str]] = ..., - runtime_library_dirs: Optional[List[str]] = ..., - export_symbols: Optional[List[str]] = ..., - debug: bool = ..., - extra_preargs: Optional[List[str]] = ..., - extra_postargs: Optional[List[str]] = ..., - build_temp: Optional[str] = ..., - target_lang: Optional[str] = ...) -> None: ... - def preprocess(self, source: str, output_file: Optional[str] = ..., - macros: Optional[List[_Macro]] = ..., - include_dirs: Optional[List[str]] = ..., - extra_preargs: Optional[List[str]] = ..., - extra_postargs: Optional[List[str]] = ...) -> None: ... - def executable_filename(self, basename: str, strip_dir: int = ..., - output_dir: str = ...) -> str: ... - def library_filename(self, libname: str, lib_type: str = ..., - strip_dir: int = ..., - output_dir: str = ...) -> str: ... - def object_filenames(self, source_filenames: List[str], - strip_dir: int = ..., - output_dir: str = ...) -> List[str]: ... - def shared_object_filename(self, basename: str, strip_dir: int = ..., - output_dir: str = ...) -> str: ... - def execute(self, func: Callable[..., None], args: Tuple[Any, ...], - msg: Optional[str] = ..., level: int = ...) -> None: ... + def compile( + self, + sources: List[str], + output_dir: Optional[str] = ..., + macros: Optional[_Macro] = ..., + include_dirs: Optional[List[str]] = ..., + debug: bool = ..., + extra_preargs: Optional[List[str]] = ..., + extra_postargs: Optional[List[str]] = ..., + depends: Optional[List[str]] = ..., + ) -> List[str]: ... + def create_static_lib( + self, + objects: List[str], + output_libname: str, + output_dir: Optional[str] = ..., + debug: bool = ..., + target_lang: Optional[str] = ..., + ) -> None: ... + def link( + self, + target_desc: str, + objects: List[str], + output_filename: str, + output_dir: Optional[str] = ..., + libraries: Optional[List[str]] = ..., + library_dirs: Optional[List[str]] = ..., + runtime_library_dirs: Optional[List[str]] = ..., + export_symbols: Optional[List[str]] = ..., + debug: bool = ..., + extra_preargs: Optional[List[str]] = ..., + extra_postargs: Optional[List[str]] = ..., + build_temp: Optional[str] = ..., + target_lang: Optional[str] = ..., + ) -> None: ... + def link_executable( + self, + objects: List[str], + output_progname: str, + output_dir: Optional[str] = ..., + libraries: Optional[List[str]] = ..., + library_dirs: Optional[List[str]] = ..., + runtime_library_dirs: Optional[List[str]] = ..., + debug: bool = ..., + extra_preargs: Optional[List[str]] = ..., + extra_postargs: Optional[List[str]] = ..., + target_lang: Optional[str] = ..., + ) -> None: ... + def link_shared_lib( + self, + objects: List[str], + output_libname: str, + output_dir: Optional[str] = ..., + libraries: Optional[List[str]] = ..., + library_dirs: Optional[List[str]] = ..., + runtime_library_dirs: Optional[List[str]] = ..., + export_symbols: Optional[List[str]] = ..., + debug: bool = ..., + extra_preargs: Optional[List[str]] = ..., + extra_postargs: Optional[List[str]] = ..., + build_temp: Optional[str] = ..., + target_lang: Optional[str] = ..., + ) -> None: ... + def link_shared_object( + self, + objects: List[str], + output_filename: str, + output_dir: Optional[str] = ..., + libraries: Optional[List[str]] = ..., + library_dirs: Optional[List[str]] = ..., + runtime_library_dirs: Optional[List[str]] = ..., + export_symbols: Optional[List[str]] = ..., + debug: bool = ..., + extra_preargs: Optional[List[str]] = ..., + extra_postargs: Optional[List[str]] = ..., + build_temp: Optional[str] = ..., + target_lang: Optional[str] = ..., + ) -> None: ... + def preprocess( + self, + source: str, + output_file: Optional[str] = ..., + macros: Optional[List[_Macro]] = ..., + include_dirs: Optional[List[str]] = ..., + extra_preargs: Optional[List[str]] = ..., + extra_postargs: Optional[List[str]] = ..., + ) -> None: ... + def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... + def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ... + def object_filenames(self, source_filenames: List[str], strip_dir: int = ..., output_dir: str = ...) -> List[str]: ... + def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... + def execute(self, func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., level: int = ...) -> None: ... def spawn(self, cmd: List[str]) -> None: ... def mkpath(self, name: str, mode: int = ...) -> None: ... def move_file(self, src: str, dst: str) -> str: ... diff --git a/stdlib/2and3/distutils/cmd.pyi b/stdlib/2and3/distutils/cmd.pyi index 3e155e5c25bf..06cb19894bf1 100644 --- a/stdlib/2and3/distutils/cmd.pyi +++ b/stdlib/2and3/distutils/cmd.pyi @@ -13,28 +13,57 @@ class Command: def finalize_options(self) -> None: ... @abstractmethod def run(self) -> None: ... - def announce(self, msg: Text, level: int = ...) -> None: ... def debug_print(self, msg: Text) -> None: ... - def ensure_string(self, option: str, default: Optional[str] = ...) -> None: ... def ensure_string_list(self, option: Union[str, List[str]]) -> None: ... def ensure_filename(self, option: str) -> None: ... def ensure_dirname(self, option: str) -> None: ... - def get_command_name(self) -> str: ... def set_undefined_options(self, src_cmd: Text, *option_pairs: Tuple[str, str]) -> None: ... def get_finalized_command(self, command: Text, create: int = ...) -> Command: ... def reinitialize_command(self, command: Union[Command, Text], reinit_subcommands: int = ...) -> Command: ... def run_command(self, command: Text) -> None: ... def get_sub_commands(self) -> List[str]: ... - def warn(self, msg: Text) -> None: ... def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Optional[Text] = ..., level: int = ...) -> None: ... def mkpath(self, name: str, mode: int = ...) -> None: ... - def copy_file(self, infile: str, outfile: str, preserve_mode: int = ..., preserve_times: int = ..., link: Optional[str] = ..., level: Any = ...) -> Tuple[str, bool]: ... # level is not used - def copy_tree(self, infile: str, outfile: str, preserve_mode: int = ..., preserve_times: int = ..., preserve_symlinks: int = ..., level: Any = ...) -> List[str]: ... # level is not used + def copy_file( + self, + infile: str, + outfile: str, + preserve_mode: int = ..., + preserve_times: int = ..., + link: Optional[str] = ..., + level: Any = ..., + ) -> Tuple[str, bool]: ... # level is not used + def copy_tree( + self, + infile: str, + outfile: str, + preserve_mode: int = ..., + preserve_times: int = ..., + preserve_symlinks: int = ..., + level: Any = ..., + ) -> List[str]: ... # level is not used def move_file(self, src: str, dest: str, level: Any = ...) -> str: ... # level is not used def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used - def make_archive(self, base_name: str, format: str, root_dir: Optional[str] = ..., base_dir: Optional[str] = ..., owner: Optional[str] = ..., group: Optional[str] = ...) -> str: ... - def make_file(self, infiles: Union[str, List[str], Tuple[str]], outfile: str, func: Callable[..., Any], args: List[Any], exec_msg: Optional[str] = ..., skip_msg: Optional[str] = ..., level: Any = ...) -> None: ... # level is not used + def make_archive( + self, + base_name: str, + format: str, + root_dir: Optional[str] = ..., + base_dir: Optional[str] = ..., + owner: Optional[str] = ..., + group: Optional[str] = ..., + ) -> str: ... + def make_file( + self, + infiles: Union[str, List[str], Tuple[str]], + outfile: str, + func: Callable[..., Any], + args: List[Any], + exec_msg: Optional[str] = ..., + skip_msg: Optional[str] = ..., + level: Any = ..., + ) -> None: ... # level is not used diff --git a/stdlib/2and3/distutils/command/build_py.pyi b/stdlib/2and3/distutils/command/build_py.pyi index c1e118e5d232..8737234fa4ce 100644 --- a/stdlib/2and3/distutils/command/build_py.pyi +++ b/stdlib/2and3/distutils/command/build_py.pyi @@ -6,5 +6,4 @@ if sys.version_info >= (3,): def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def run(self) -> None: ... - class build_py_2to3(build_py): ... diff --git a/stdlib/2and3/distutils/command/install.pyi b/stdlib/2and3/distutils/command/install.pyi index 205f6d4471f6..dc6d96b82a62 100644 --- a/stdlib/2and3/distutils/command/install.pyi +++ b/stdlib/2and3/distutils/command/install.pyi @@ -7,7 +7,6 @@ class install(Command): home: Optional[Text] root: Optional[Text] install_lib: Optional[Text] - def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def run(self) -> None: ... diff --git a/stdlib/2and3/distutils/core.pyi b/stdlib/2and3/distutils/core.pyi index 6ec326b4e971..842824f5829a 100644 --- a/stdlib/2and3/distutils/core.pyi +++ b/stdlib/2and3/distutils/core.pyi @@ -5,46 +5,45 @@ from distutils.dist import Distribution as Distribution from distutils.extension import Extension as Extension from typing import Any, List, Mapping, Optional, Tuple, Type, Union -def setup(name: str = ..., - version: str = ..., - description: str = ..., - long_description: str = ..., - author: str = ..., - author_email: str = ..., - maintainer: str = ..., - maintainer_email: str = ..., - url: str = ..., - download_url: str = ..., - packages: List[str] = ..., - py_modules: List[str] = ..., - scripts: List[str] = ..., - ext_modules: List[Extension] = ..., - classifiers: List[str] = ..., - distclass: Type[Distribution] = ..., - script_name: str = ..., - script_args: List[str] = ..., - options: Mapping[str, Any] = ..., - license: str = ..., - keywords: Union[List[str], str] = ..., - platforms: Union[List[str], str] = ..., - cmdclass: Mapping[str, Type[Command]] = ..., - data_files: List[Tuple[str, List[str]]] = ..., - package_dir: Mapping[str, str] = ..., - obsoletes: List[str] = ..., - provides: List[str] = ..., - requires: List[str] = ..., - command_packages: List[str] = ..., - command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ..., - package_data: Mapping[str, List[str]] = ..., - include_package_data: bool = ..., - libraries: List[str] = ..., - headers: List[str] = ..., - ext_package: str = ..., - include_dirs: List[str] = ..., - password: str = ..., - fullname: str = ..., - **attrs: Any) -> None: ... - -def run_setup(script_name: str, - script_args: Optional[List[str]] = ..., - stop_after: str = ...) -> Distribution: ... +def setup( + name: str = ..., + version: str = ..., + description: str = ..., + long_description: str = ..., + author: str = ..., + author_email: str = ..., + maintainer: str = ..., + maintainer_email: str = ..., + url: str = ..., + download_url: str = ..., + packages: List[str] = ..., + py_modules: List[str] = ..., + scripts: List[str] = ..., + ext_modules: List[Extension] = ..., + classifiers: List[str] = ..., + distclass: Type[Distribution] = ..., + script_name: str = ..., + script_args: List[str] = ..., + options: Mapping[str, Any] = ..., + license: str = ..., + keywords: Union[List[str], str] = ..., + platforms: Union[List[str], str] = ..., + cmdclass: Mapping[str, Type[Command]] = ..., + data_files: List[Tuple[str, List[str]]] = ..., + package_dir: Mapping[str, str] = ..., + obsoletes: List[str] = ..., + provides: List[str] = ..., + requires: List[str] = ..., + command_packages: List[str] = ..., + command_options: Mapping[str, Mapping[str, Tuple[Any, Any]]] = ..., + package_data: Mapping[str, List[str]] = ..., + include_package_data: bool = ..., + libraries: List[str] = ..., + headers: List[str] = ..., + ext_package: str = ..., + include_dirs: List[str] = ..., + password: str = ..., + fullname: str = ..., + **attrs: Any +) -> None: ... +def run_setup(script_name: str, script_args: Optional[List[str]] = ..., stop_after: str = ...) -> Distribution: ... diff --git a/stdlib/2and3/distutils/dep_util.pyi b/stdlib/2and3/distutils/dep_util.pyi index 7df58478132d..64d1ee748741 100644 --- a/stdlib/2and3/distutils/dep_util.pyi +++ b/stdlib/2and3/distutils/dep_util.pyi @@ -3,6 +3,5 @@ from typing import List, Tuple def newer(source: str, target: str) -> bool: ... -def newer_pairwise(sources: List[str], - targets: List[str]) -> List[Tuple[str, str]]: ... +def newer_pairwise(sources: List[str], targets: List[str]) -> List[Tuple[str, str]]: ... def newer_group(sources: List[str], target: str, missing: str = ...) -> bool: ... diff --git a/stdlib/2and3/distutils/dir_util.pyi b/stdlib/2and3/distutils/dir_util.pyi index 3ee56281898f..03db4fd7b093 100644 --- a/stdlib/2and3/distutils/dir_util.pyi +++ b/stdlib/2and3/distutils/dir_util.pyi @@ -2,13 +2,16 @@ from typing import List -def mkpath(name: str, mode: int = ..., verbose: int = ..., - dry_run: int = ...) -> List[str]: ... -def create_tree(base_dir: str, files: List[str], mode: int = ..., - verbose: int = ..., dry_run: int = ...) -> None: ... -def copy_tree(src: str, dst: str, preserve_mode: int = ..., - preserve_times: int = ..., preserve_symlinks: int = ..., - update: int = ..., verbose: int = ..., - dry_run: int = ...) -> List[str]: ... -def remove_tree(directory: str, verbose: int = ..., - dry_run: int = ...) -> None: ... +def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ... +def create_tree(base_dir: str, files: List[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ... +def copy_tree( + src: str, + dst: str, + preserve_mode: int = ..., + preserve_times: int = ..., + preserve_symlinks: int = ..., + update: int = ..., + verbose: int = ..., + dry_run: int = ..., +) -> List[str]: ... +def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ... diff --git a/stdlib/2and3/distutils/extension.pyi b/stdlib/2and3/distutils/extension.pyi index 6487043692fc..5782edd587c6 100644 --- a/stdlib/2and3/distutils/extension.pyi +++ b/stdlib/2and3/distutils/extension.pyi @@ -5,35 +5,39 @@ from typing import List, Optional, Tuple class Extension: if sys.version_info >= (3,): - def __init__(self, - name: str, - sources: List[str], - include_dirs: List[str] = ..., - define_macros: List[Tuple[str, Optional[str]]] = ..., - undef_macros: List[str] = ..., - library_dirs: List[str] = ..., - libraries: List[str] = ..., - runtime_library_dirs: List[str] = ..., - extra_objects: List[str] = ..., - extra_compile_args: List[str] = ..., - extra_link_args: List[str] = ..., - export_symbols: List[str] = ..., - depends: List[str] = ..., - language: str = ..., - optional: bool = ...) -> None: ... + def __init__( + self, + name: str, + sources: List[str], + include_dirs: List[str] = ..., + define_macros: List[Tuple[str, Optional[str]]] = ..., + undef_macros: List[str] = ..., + library_dirs: List[str] = ..., + libraries: List[str] = ..., + runtime_library_dirs: List[str] = ..., + extra_objects: List[str] = ..., + extra_compile_args: List[str] = ..., + extra_link_args: List[str] = ..., + export_symbols: List[str] = ..., + depends: List[str] = ..., + language: str = ..., + optional: bool = ..., + ) -> None: ... else: - def __init__(self, - name: str, - sources: List[str], - include_dirs: List[str] = ..., - define_macros: List[Tuple[str, Optional[str]]] = ..., - undef_macros: List[str] = ..., - library_dirs: List[str] = ..., - libraries: List[str] = ..., - runtime_library_dirs: List[str] = ..., - extra_objects: List[str] = ..., - extra_compile_args: List[str] = ..., - extra_link_args: List[str] = ..., - export_symbols: List[str] = ..., - depends: List[str] = ..., - language: str = ...) -> None: ... + def __init__( + self, + name: str, + sources: List[str], + include_dirs: List[str] = ..., + define_macros: List[Tuple[str, Optional[str]]] = ..., + undef_macros: List[str] = ..., + library_dirs: List[str] = ..., + libraries: List[str] = ..., + runtime_library_dirs: List[str] = ..., + extra_objects: List[str] = ..., + extra_compile_args: List[str] = ..., + extra_link_args: List[str] = ..., + export_symbols: List[str] = ..., + depends: List[str] = ..., + language: str = ..., + ) -> None: ... diff --git a/stdlib/2and3/distutils/fancy_getopt.pyi b/stdlib/2and3/distutils/fancy_getopt.pyi index 357fb64e4f34..13da3d84265d 100644 --- a/stdlib/2and3/distutils/fancy_getopt.pyi +++ b/stdlib/2and3/distutils/fancy_getopt.pyi @@ -5,10 +5,9 @@ from typing import Any, List, Mapping, Optional, Tuple, TypeVar, Union, overload _Option = Tuple[str, str, str] _GR = Tuple[List[str], OptionDummy] -def fancy_getopt(options: List[_Option], - negative_opt: Mapping[_Option, _Option], - object: Any, - args: Optional[List[str]]) -> Union[List[str], _GR]: ... +def fancy_getopt( + options: List[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: Optional[List[str]] +) -> Union[List[str], _GR]: ... def wrap_text(text: str, width: int) -> List[str]: ... class FancyGetopt: diff --git a/stdlib/2and3/distutils/file_util.pyi b/stdlib/2and3/distutils/file_util.pyi index 74a360f8d94b..37c5f59a0729 100644 --- a/stdlib/2and3/distutils/file_util.pyi +++ b/stdlib/2and3/distutils/file_util.pyi @@ -2,10 +2,15 @@ from typing import Optional, Sequence, Tuple -def copy_file(src: str, dst: str, preserve_mode: bool = ..., - preserve_times: bool = ..., update: bool = ..., - link: Optional[str] = ..., verbose: bool = ..., - dry_run: bool = ...) -> Tuple[str, str]: ... -def move_file(src: str, dst: str, verbose: bool = ..., - dry_run: bool = ...) -> str: ... +def copy_file( + src: str, + dst: str, + preserve_mode: bool = ..., + preserve_times: bool = ..., + update: bool = ..., + link: Optional[str] = ..., + verbose: bool = ..., + dry_run: bool = ..., +) -> Tuple[str, str]: ... +def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ... def write_file(filename: str, contents: Sequence[str]) -> None: ... diff --git a/stdlib/2and3/distutils/spawn.pyi b/stdlib/2and3/distutils/spawn.pyi index 8df9ebab7f23..924a74e46e90 100644 --- a/stdlib/2and3/distutils/spawn.pyi +++ b/stdlib/2and3/distutils/spawn.pyi @@ -2,7 +2,5 @@ from typing import List, Optional -def spawn(cmd: List[str], search_path: bool = ..., - verbose: bool = ..., dry_run: bool = ...) -> None: ... -def find_executable(executable: str, - path: Optional[str] = ...) -> Optional[str]: ... +def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ... +def find_executable(executable: str, path: Optional[str] = ...) -> Optional[str]: ... diff --git a/stdlib/2and3/distutils/sysconfig.pyi b/stdlib/2and3/distutils/sysconfig.pyi index f937c0660f9f..fe2f43c3510d 100644 --- a/stdlib/2and3/distutils/sysconfig.pyi +++ b/stdlib/2and3/distutils/sysconfig.pyi @@ -10,10 +10,7 @@ def get_config_var(name: str) -> Union[int, str, None]: ... def get_config_vars(*args: str) -> Mapping[str, Union[int, str]]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... -def get_python_inc(plat_specific: bool = ..., - prefix: Optional[str] = ...) -> str: ... -def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., - prefix: Optional[str] = ...) -> str: ... - +def get_python_inc(plat_specific: bool = ..., prefix: Optional[str] = ...) -> str: ... +def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: Optional[str] = ...) -> str: ... def customize_compiler(compiler: CCompiler) -> None: ... def set_python_build() -> None: ... diff --git a/stdlib/2and3/distutils/text_file.pyi b/stdlib/2and3/distutils/text_file.pyi index 8f90d41d10f6..51e5533580f7 100644 --- a/stdlib/2and3/distutils/text_file.pyi +++ b/stdlib/2and3/distutils/text_file.pyi @@ -3,16 +3,21 @@ from typing import IO, List, Optional, Tuple, Union class TextFile: - def __init__(self, filename: Optional[str] = ..., - file: Optional[IO[str]] = ..., - *, strip_comments: bool = ..., - lstrip_ws: bool = ..., rstrip_ws: bool = ..., - skip_blanks: bool = ..., join_lines: bool = ..., - collapse_join: bool = ...) -> None: ... + def __init__( + self, + filename: Optional[str] = ..., + file: Optional[IO[str]] = ..., + *, + strip_comments: bool = ..., + lstrip_ws: bool = ..., + rstrip_ws: bool = ..., + skip_blanks: bool = ..., + join_lines: bool = ..., + collapse_join: bool = ... + ) -> None: ... def open(self, filename: str) -> None: ... def close(self) -> None: ... - def warn(self, msg: str, - line: Union[List[int], Tuple[int, int], int] = ...) -> None: ... + def warn(self, msg: str, line: Union[List[int], Tuple[int, int], int] = ...) -> None: ... def readline(self) -> Optional[str]: ... def readlines(self) -> List[str]: ... def unreadline(self, line: str) -> str: ... diff --git a/stdlib/2and3/distutils/util.pyi b/stdlib/2and3/distutils/util.pyi index 6db47ecbbf2a..9998ede981d4 100644 --- a/stdlib/2and3/distutils/util.pyi +++ b/stdlib/2and3/distutils/util.pyi @@ -8,12 +8,18 @@ def change_root(new_root: str, pathname: str) -> str: ... def check_environ() -> None: ... def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ... def split_quoted(s: str) -> List[str]: ... -def execute(func: Callable[..., None], args: Tuple[Any, ...], - msg: Optional[str] = ..., verbose: bool = ..., - dry_run: bool = ...) -> None: ... +def execute( + func: Callable[..., None], args: Tuple[Any, ...], msg: Optional[str] = ..., verbose: bool = ..., dry_run: bool = ... +) -> None: ... def strtobool(val: str) -> bool: ... -def byte_compile(py_files: List[str], optimize: int = ..., force: bool = ..., - prefix: Optional[str] = ..., base_dir: Optional[str] = ..., - verbose: bool = ..., dry_run: bool = ..., - direct: Optional[bool] = ...) -> None: ... +def byte_compile( + py_files: List[str], + optimize: int = ..., + force: bool = ..., + prefix: Optional[str] = ..., + base_dir: Optional[str] = ..., + verbose: bool = ..., + dry_run: bool = ..., + direct: Optional[bool] = ..., +) -> None: ... def rfc822_escape(header: str) -> str: ... diff --git a/stdlib/2and3/distutils/version.pyi b/stdlib/2and3/distutils/version.pyi index 67331fd19fe7..679b0e934013 100644 --- a/stdlib/2and3/distutils/version.pyi +++ b/stdlib/2and3/distutils/version.pyi @@ -2,18 +2,16 @@ import sys from abc import abstractmethod from typing import Any, Optional, Pattern, Text, Tuple, TypeVar, Union -_T = TypeVar('_T', bound='Version') +_T = TypeVar("_T", bound="Version") class Version: def __repr__(self) -> str: ... - if sys.version_info >= (3,): def __eq__(self, other: object) -> bool: ... def __lt__(self: _T, other: Union[_T, str]) -> bool: ... def __le__(self: _T, other: Union[_T, str]) -> bool: ... def __gt__(self: _T, other: Union[_T, str]) -> bool: ... def __ge__(self: _T, other: Union[_T, str]) -> bool: ... - @abstractmethod def __init__(self, vstring: Optional[Text] = ...) -> None: ... @abstractmethod @@ -31,7 +29,6 @@ class StrictVersion(Version): version_re: Pattern[str] version: Tuple[int, int, int] prerelease: Optional[Tuple[Text, int]] - def __init__(self, vstring: Optional[Text] = ...) -> None: ... def parse(self: _T, vstring: Text) -> _T: ... def __str__(self) -> str: ... @@ -44,7 +41,6 @@ class LooseVersion(Version): component_re: Pattern[str] vstring: Text version: Tuple[Union[Text, int], ...] - def __init__(self, vstring: Optional[Text] = ...) -> None: ... def parse(self: _T, vstring: Text) -> _T: ... def __str__(self) -> str: ... diff --git a/stdlib/2and3/doctest.pyi b/stdlib/2and3/doctest.pyi index 07b097afe5da..680009018eda 100644 --- a/stdlib/2and3/doctest.pyi +++ b/stdlib/2and3/doctest.pyi @@ -3,13 +3,12 @@ import types import unittest from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Type, Union -TestResults = NamedTuple('TestResults', [ - ('failed', int), - ('attempted', int), -]) +TestResults = NamedTuple("TestResults", [("failed", int), ("attempted", int)]) OPTIONFLAGS_BY_NAME: Dict[str, int] + def register_optionflag(name: str) -> int: ... + DONT_ACCEPT_TRUE_FOR_1: int DONT_ACCEPT_BLANKLINE: int NORMALIZE_WHITESPACE: int @@ -38,8 +37,15 @@ class Example: lineno: int indent: int options: Dict[int, bool] - def __init__(self, source: str, want: str, exc_msg: Optional[str] = ..., lineno: int = ..., indent: int = ..., - options: Optional[Dict[int, bool]] = ...) -> None: ... + def __init__( + self, + source: str, + want: str, + exc_msg: Optional[str] = ..., + lineno: int = ..., + indent: int = ..., + options: Optional[Dict[int, bool]] = ..., + ) -> None: ... def __hash__(self) -> int: ... class DocTest: @@ -49,20 +55,37 @@ class DocTest: filename: Optional[str] lineno: Optional[int] docstring: Optional[str] - def __init__(self, examples: List[Example], globs: Dict[str, Any], name: str, filename: Optional[str], lineno: Optional[int], docstring: Optional[str]) -> None: ... + def __init__( + self, + examples: List[Example], + globs: Dict[str, Any], + name: str, + filename: Optional[str], + lineno: Optional[int], + docstring: Optional[str], + ) -> None: ... def __hash__(self) -> int: ... def __lt__(self, other: DocTest) -> bool: ... class DocTestParser: def parse(self, string: str, name: str = ...) -> List[Union[str, Example]]: ... - def get_doctest(self, string: str, globs: Dict[str, Any], name: str, filename: Optional[str], lineno: Optional[str]) -> DocTest: ... + def get_doctest( + self, string: str, globs: Dict[str, Any], name: str, filename: Optional[str], lineno: Optional[str] + ) -> DocTest: ... def get_examples(self, strin: str, name: str = ...) -> List[Example]: ... class DocTestFinder: - def __init__(self, verbose: bool = ..., parser: DocTestParser = ..., - recurse: bool = ..., exclude_empty: bool = ...) -> None: ... - def find(self, obj: object, name: Optional[str] = ..., module: Union[None, bool, types.ModuleType] = ..., - globs: Optional[Dict[str, Any]] = ..., extraglobs: Optional[Dict[str, Any]] = ...) -> List[DocTest]: ... + def __init__( + self, verbose: bool = ..., parser: DocTestParser = ..., recurse: bool = ..., exclude_empty: bool = ... + ) -> None: ... + def find( + self, + obj: object, + name: Optional[str] = ..., + module: Union[None, bool, types.ModuleType] = ..., + globs: Optional[Dict[str, Any]] = ..., + extraglobs: Optional[Dict[str, Any]] = ..., + ) -> List[DocTest]: ... _Out = Callable[[str], Any] _ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType] @@ -74,13 +97,14 @@ class DocTestRunner: tries: int failures: int test: DocTest - def __init__(self, checker: Optional[OutputChecker] = ..., verbose: Optional[bool] = ..., optionflags: int = ...) -> None: ... def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ... def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ... def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ... def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ... - def run(self, test: DocTest, compileflags: Optional[int] = ..., out: Optional[_Out] = ..., clear_globs: bool = ...) -> TestResults: ... + def run( + self, test: DocTest, compileflags: Optional[int] = ..., out: Optional[_Out] = ..., clear_globs: bool = ... + ) -> TestResults: ... def summarize(self, verbose: Optional[bool] = ...) -> TestResults: ... def merge(self, other: DocTestRunner) -> None: ... @@ -92,35 +116,62 @@ class DocTestFailure(Exception): test: DocTest example: Example got: str - def __init__(self, test: DocTest, example: Example, got: str) -> None: ... class UnexpectedException(Exception): test: DocTest example: Example exc_info: _ExcInfo - def __init__(self, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ... class DebugRunner(DocTestRunner): ... master: Optional[DocTestRunner] -def testmod(m: Optional[types.ModuleType] = ..., name: Optional[str] = ..., globs: Dict[str, Any] = ..., verbose: Optional[bool] = ..., - report: bool = ..., optionflags: int = ..., extraglobs: Dict[str, Any] = ..., - raise_on_error: bool = ..., exclude_empty: bool = ...) -> TestResults: ... -def testfile(filename: str, module_relative: bool = ..., name: Optional[str] = ..., package: Union[None, str, types.ModuleType] = ..., - globs: Optional[Dict[str, Any]] = ..., verbose: Optional[bool] = ..., report: bool = ..., optionflags: int = ..., - extraglobs: Optional[Dict[str, Any]] = ..., raise_on_error: bool = ..., parser: DocTestParser = ..., - encoding: Optional[str] = ...) -> TestResults: ... -def run_docstring_examples(f: object, globs: Dict[str, Any], verbose: bool = ..., name: str = ..., - compileflags: Optional[int] = ..., optionflags: int = ...) -> None: ... +def testmod( + m: Optional[types.ModuleType] = ..., + name: Optional[str] = ..., + globs: Dict[str, Any] = ..., + verbose: Optional[bool] = ..., + report: bool = ..., + optionflags: int = ..., + extraglobs: Dict[str, Any] = ..., + raise_on_error: bool = ..., + exclude_empty: bool = ..., +) -> TestResults: ... +def testfile( + filename: str, + module_relative: bool = ..., + name: Optional[str] = ..., + package: Union[None, str, types.ModuleType] = ..., + globs: Optional[Dict[str, Any]] = ..., + verbose: Optional[bool] = ..., + report: bool = ..., + optionflags: int = ..., + extraglobs: Optional[Dict[str, Any]] = ..., + raise_on_error: bool = ..., + parser: DocTestParser = ..., + encoding: Optional[str] = ..., +) -> TestResults: ... +def run_docstring_examples( + f: object, + globs: Dict[str, Any], + verbose: bool = ..., + name: str = ..., + compileflags: Optional[int] = ..., + optionflags: int = ..., +) -> None: ... def set_unittest_reportflags(flags: int) -> int: ... class DocTestCase(unittest.TestCase): - def __init__(self, test: DocTest, optionflags: int = ..., setUp: Optional[Callable[[DocTest], Any]] = ..., - tearDown: Optional[Callable[[DocTest], Any]] = ..., - checker: Optional[OutputChecker] = ...) -> None: ... + def __init__( + self, + test: DocTest, + optionflags: int = ..., + setUp: Optional[Callable[[DocTest], Any]] = ..., + tearDown: Optional[Callable[[DocTest], Any]] = ..., + checker: Optional[OutputChecker] = ..., + ) -> None: ... def setUp(self) -> None: ... def tearDown(self) -> None: ... def runTest(self) -> None: ... @@ -138,20 +189,31 @@ class SkipDocTestCase(DocTestCase): if sys.version_info >= (3, 4): class _DocTestSuite(unittest.TestSuite): ... + else: _DocTestSuite = unittest.TestSuite -def DocTestSuite(module: Union[None, str, types.ModuleType] = ..., globs: Optional[Dict[str, Any]] = ..., - extraglobs: Optional[Dict[str, Any]] = ..., test_finder: Optional[DocTestFinder] = ..., - **options: Any) -> _DocTestSuite: ... +def DocTestSuite( + module: Union[None, str, types.ModuleType] = ..., + globs: Optional[Dict[str, Any]] = ..., + extraglobs: Optional[Dict[str, Any]] = ..., + test_finder: Optional[DocTestFinder] = ..., + **options: Any +) -> _DocTestSuite: ... class DocFileCase(DocTestCase): def id(self) -> str: ... def format_failure(self, err: str) -> str: ... -def DocFileTest(path: str, module_relative: bool = ..., package: Union[None, str, types.ModuleType] = ..., - globs: Optional[Dict[str, Any]] = ..., parser: DocTestParser = ..., - encoding: Optional[str] = ..., **options: Any) -> DocFileCase: ... +def DocFileTest( + path: str, + module_relative: bool = ..., + package: Union[None, str, types.ModuleType] = ..., + globs: Optional[Dict[str, Any]] = ..., + parser: DocTestParser = ..., + encoding: Optional[str] = ..., + **options: Any +) -> DocFileCase: ... def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ... def script_from_examples(s: str) -> str: ... def testsource(module: Union[None, str, types.ModuleType], name: str) -> str: ... diff --git a/stdlib/2and3/filecmp.pyi b/stdlib/2and3/filecmp.pyi index e702f84984a4..d867a562b9ac 100644 --- a/stdlib/2and3/filecmp.pyi +++ b/stdlib/2and3/filecmp.pyi @@ -5,14 +5,14 @@ from typing import AnyStr, Callable, Dict, Generic, Iterable, List, Optional, Se DEFAULT_IGNORES: List[str] def cmp(f1: Union[bytes, Text], f2: Union[bytes, Text], shallow: Union[int, bool] = ...) -> bool: ... -def cmpfiles(a: AnyStr, b: AnyStr, common: Iterable[AnyStr], - shallow: Union[int, bool] = ...) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ... +def cmpfiles( + a: AnyStr, b: AnyStr, common: Iterable[AnyStr], shallow: Union[int, bool] = ... +) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ... class dircmp(Generic[AnyStr]): - def __init__(self, a: AnyStr, b: AnyStr, - ignore: Optional[Sequence[AnyStr]] = ..., - hide: Optional[Sequence[AnyStr]] = ...) -> None: ... - + def __init__( + self, a: AnyStr, b: AnyStr, ignore: Optional[Sequence[AnyStr]] = ..., hide: Optional[Sequence[AnyStr]] = ... + ) -> None: ... left: AnyStr right: AnyStr hide: Sequence[AnyStr] @@ -31,11 +31,9 @@ class dircmp(Generic[AnyStr]): right_only: List[AnyStr] left_list: List[AnyStr] right_list: List[AnyStr] - def report(self) -> None: ... def report_partial_closure(self) -> None: ... def report_full_closure(self) -> None: ... - methodmap: Dict[str, Callable[[], None]] def phase0(self) -> None: ... def phase1(self) -> None: ... diff --git a/stdlib/2and3/fileinput.pyi b/stdlib/2and3/fileinput.pyi index e86b66d9c433..bbd0d362bb5c 100644 --- a/stdlib/2and3/fileinput.pyi +++ b/stdlib/2and3/fileinput.pyi @@ -7,16 +7,14 @@ if sys.version_info >= (3, 6): else: _Path = Union[Text, bytes] - def input( files: Union[_Path, Iterable[_Path], None] = ..., inplace: bool = ..., backup: str = ..., bufsize: int = ..., mode: str = ..., - openhook: Callable[[_Path, str], IO[AnyStr]] = ...) -> FileInput[AnyStr]: ... - - + openhook: Callable[[_Path, str], IO[AnyStr]] = ..., +) -> FileInput[AnyStr]: ... def close() -> None: ... def nextfile() -> None: ... def filename() -> str: ... @@ -34,9 +32,8 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]): backup: str = ..., bufsize: int = ..., mode: str = ..., - openhook: Callable[[_Path, str], IO[AnyStr]] = ... + openhook: Callable[[_Path, str], IO[AnyStr]] = ..., ) -> None: ... - def __del__(self) -> None: ... def close(self) -> None: ... if sys.version_info >= (3, 2): @@ -55,7 +52,9 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]): def isstdin(self) -> bool: ... def hook_compressed(filename: _Path, mode: str) -> IO[Any]: ... + if sys.version_info >= (3, 6): def hook_encoded(encoding: str, errors: Optional[str] = ...) -> Callable[[_Path, str], IO[Any]]: ... + else: def hook_encoded(encoding: str) -> Callable[[_Path, str], IO[Any]]: ... diff --git a/stdlib/2and3/fractions.pyi b/stdlib/2and3/fractions.pyi index be5fe103d2ed..62becf00d1df 100644 --- a/stdlib/2and3/fractions.pyi +++ b/stdlib/2and3/fractions.pyi @@ -10,8 +10,6 @@ from numbers import Integral, Rational, Real from typing import Any, Optional, TypeVar, Union, overload _ComparableNum = Union[int, float, Decimal, Real] - - @overload def gcd(a: int, b: int) -> int: ... @overload @@ -21,32 +19,26 @@ def gcd(a: int, b: Integral) -> Integral: ... @overload def gcd(a: Integral, b: Integral) -> Integral: ... - class Fraction(Rational): @overload - def __init__(self, - numerator: Union[int, Rational] = ..., - denominator: Optional[Union[int, Rational]] = ..., - *, - _normalize: bool = ...) -> None: ... + def __init__( + self, numerator: Union[int, Rational] = ..., denominator: Optional[Union[int, Rational]] = ..., *, _normalize: bool = ... + ) -> None: ... @overload def __init__(self, value: float, *, _normalize: bool = ...) -> None: ... @overload def __init__(self, value: Decimal, *, _normalize: bool = ...) -> None: ... @overload def __init__(self, value: str, *, _normalize: bool = ...) -> None: ... - @classmethod def from_float(cls, f: float) -> Fraction: ... @classmethod def from_decimal(cls, dec: Decimal) -> Fraction: ... def limit_denominator(self, max_denominator: int = ...) -> Fraction: ... - @property def numerator(self) -> int: ... @property def denominator(self) -> int: ... - def __add__(self, other): ... def __radd__(self, other): ... def __sub__(self, other): ... @@ -66,7 +58,6 @@ class Fraction(Rational): def __rdivmod__(self, other): ... def __pow__(self, other): ... def __rpow__(self, other): ... - def __pos__(self) -> Fraction: ... def __neg__(self) -> Fraction: ... def __abs__(self) -> Fraction: ... @@ -75,7 +66,6 @@ class Fraction(Rational): def __floor__(self) -> int: ... def __ceil__(self) -> int: ... def __round__(self, ndigits: Optional[Any] = ...): ... - def __hash__(self) -> int: ... def __eq__(self, other: object) -> bool: ... def __lt__(self, other: _ComparableNum) -> bool: ... @@ -86,7 +76,6 @@ class Fraction(Rational): def __bool__(self) -> bool: ... else: def __nonzero__(self) -> bool: ... - # Not actually defined within fractions.py, but provides more useful # overrides @property diff --git a/stdlib/2and3/ftplib.pyi b/stdlib/2and3/ftplib.pyi index 999602de9e82..479c0387990e 100644 --- a/stdlib/2and3/ftplib.pyi +++ b/stdlib/2and3/ftplib.pyi @@ -21,7 +21,7 @@ from typing import ( Union, ) -_T = TypeVar('_T') +_T = TypeVar("_T") _IntOrStr = Union[int, Text] MSG_OOB: int @@ -59,22 +59,31 @@ class FTP: file: Optional[TextIO] encoding: str def __enter__(self: _T) -> _T: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... else: file: Optional[BinaryIO] if sys.version_info >= (3, 3): source_address: Optional[Tuple[str, int]] - def __init__(self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ..., - timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...) -> None: ... - def connect(self, host: Text = ..., port: int = ..., timeout: float = ..., - source_address: Optional[Tuple[str, int]] = ...) -> str: ... + def __init__( + self, + host: Text = ..., + user: Text = ..., + passwd: Text = ..., + acct: Text = ..., + timeout: float = ..., + source_address: Optional[Tuple[str, int]] = ..., + ) -> None: ... + def connect( + self, host: Text = ..., port: int = ..., timeout: float = ..., source_address: Optional[Tuple[str, int]] = ... + ) -> str: ... else: - def __init__(self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ..., - timeout: float = ...) -> None: ... + def __init__( + self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ..., timeout: float = ... + ) -> None: ... def connect(self, host: Text = ..., port: int = ..., timeout: float = ...) -> str: ... - def getwelcome(self) -> str: ... def set_debuglevel(self, level: int) -> None: ... def debug(self, level: int) -> None: ... @@ -94,22 +103,26 @@ class FTP: def makeport(self) -> socket: ... def makepasv(self) -> Tuple[str, int]: ... def login(self, user: Text = ..., passwd: Text = ..., acct: Text = ...) -> str: ... - # In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers. def ntransfercmd(self, cmd: Text, rest: Optional[_IntOrStr] = ...) -> Tuple[socket, int]: ... def transfercmd(self, cmd: Text, rest: Optional[_IntOrStr] = ...) -> socket: ... - def retrbinary(self, cmd: Text, callback: Callable[[bytes], Any], blocksize: int = ..., rest: Optional[_IntOrStr] = ...) -> str: ... - def storbinary(self, cmd: Text, fp: BinaryIO, blocksize: int = ..., callback: Optional[Callable[[bytes], Any]] = ..., rest: Optional[_IntOrStr] = ...) -> str: ... - + def retrbinary( + self, cmd: Text, callback: Callable[[bytes], Any], blocksize: int = ..., rest: Optional[_IntOrStr] = ... + ) -> str: ... + def storbinary( + self, + cmd: Text, + fp: BinaryIO, + blocksize: int = ..., + callback: Optional[Callable[[bytes], Any]] = ..., + rest: Optional[_IntOrStr] = ..., + ) -> str: ... def retrlines(self, cmd: Text, callback: Optional[Callable[[str], Any]] = ...) -> str: ... def storlines(self, cmd: Text, fp: BinaryIO, callback: Optional[Callable[[bytes], Any]] = ...) -> str: ... - def acct(self, password: Text) -> str: ... def nlst(self, *args: Text) -> List[str]: ... - # Technically only the last arg can be a Callable but ... def dir(self, *args: Union[str, Callable[[str], None]]) -> None: ... - if sys.version_info >= (3, 3): def mlsd(self, path: Text = ..., facts: Iterable[str] = ...) -> Iterator[Tuple[str, Dict[str, str]]]: ... def rename(self, fromname: Text, toname: Text) -> str: ... @@ -123,21 +136,26 @@ class FTP: def close(self) -> None: ... class FTP_TLS(FTP): - def __init__(self, host: Text = ..., user: Text = ..., passwd: Text = ..., acct: Text = ..., - keyfile: Optional[str] = ..., certfile: Optional[str] = ..., - context: Optional[SSLContext] = ..., timeout: float = ..., - source_address: Optional[Tuple[str, int]] = ...) -> None: ... - + def __init__( + self, + host: Text = ..., + user: Text = ..., + passwd: Text = ..., + acct: Text = ..., + keyfile: Optional[str] = ..., + certfile: Optional[str] = ..., + context: Optional[SSLContext] = ..., + timeout: float = ..., + source_address: Optional[Tuple[str, int]] = ..., + ) -> None: ... ssl_version: int keyfile: Optional[str] certfile: Optional[str] context: SSLContext - def login(self, user: Text = ..., passwd: Text = ..., acct: Text = ..., secure: bool = ...) -> str: ... def auth(self) -> str: ... def prot_p(self) -> str: ... def prot_c(self) -> str: ... - if sys.version_info >= (3, 3): def ccc(self) -> str: ... diff --git a/stdlib/2and3/genericpath.pyi b/stdlib/2and3/genericpath.pyi index eb1c3bf15301..046a10952de0 100644 --- a/stdlib/2and3/genericpath.pyi +++ b/stdlib/2and3/genericpath.pyi @@ -3,6 +3,7 @@ from typing import AnyStr, Sequence, Text if sys.version_info >= (3, 0): def commonprefix(m: Sequence[str]) -> str: ... + else: def commonprefix(m: Sequence[AnyStr]) -> AnyStr: ... @@ -14,7 +15,6 @@ def getmtime(filename: Text) -> float: ... def getatime(filename: Text) -> float: ... def getctime(filename: Text) -> float: ... - if sys.version_info >= (3, 4): def samestat(s1: str, s2: str) -> int: ... def samefile(f1: str, f2: str) -> int: ... diff --git a/stdlib/2and3/grp.pyi b/stdlib/2and3/grp.pyi index 605472721b89..cc0c78c4b244 100644 --- a/stdlib/2and3/grp.pyi +++ b/stdlib/2and3/grp.pyi @@ -1,9 +1,8 @@ from typing import List, NamedTuple, Optional -struct_group = NamedTuple("struct_group", [("gr_name", str), - ("gr_passwd", Optional[str]), - ("gr_gid", int), - ("gr_mem", List[str])]) +struct_group = NamedTuple( + "struct_group", [("gr_name", str), ("gr_passwd", Optional[str]), ("gr_gid", int), ("gr_mem", List[str])] +) def getgrall() -> List[struct_group]: ... def getgrgid(gid: int) -> struct_group: ... diff --git a/stdlib/2and3/hmac.pyi b/stdlib/2and3/hmac.pyi index 5df6ad790472..e348b61b022a 100644 --- a/stdlib/2and3/hmac.pyi +++ b/stdlib/2and3/hmac.pyi @@ -12,11 +12,10 @@ _Hash = Any digest_size: None if sys.version_info >= (3, 4): - def new(key: _B, msg: Optional[_B] = ..., - digestmod: Optional[Union[str, Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ... + def new(key: _B, msg: Optional[_B] = ..., digestmod: Optional[Union[str, Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ... + else: - def new(key: _B, msg: Optional[_B] = ..., - digestmod: Optional[Union[Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ... + def new(key: _B, msg: Optional[_B] = ..., digestmod: Optional[Union[Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ... class HMAC: if sys.version_info >= (3,): diff --git a/stdlib/2and3/imaplib.pyi b/stdlib/2and3/imaplib.pyi index 60975d715680..8d681cae52af 100644 --- a/stdlib/2and3/imaplib.pyi +++ b/stdlib/2and3/imaplib.pyi @@ -10,7 +10,6 @@ from typing import IO, Any, Callable, Dict, List, Optional, Pattern, Text, Tuple CommandResults = Tuple[str, List[Any]] - class IMAP4: error: Type[Exception] = ... abort: Type[Exception] = ... @@ -103,7 +102,6 @@ class IMAP4_SSL(IMAP4): def socket(self) -> _socket: ... def ssl(self) -> SSLSocket: ... - class IMAP4_stream(IMAP4): command: str = ... def __init__(self, command: str) -> None: ... diff --git a/stdlib/2and3/imghdr.pyi b/stdlib/2and3/imghdr.pyi index dce5d3cb0762..5f82117db6fa 100644 --- a/stdlib/2and3/imghdr.pyi +++ b/stdlib/2and3/imghdr.pyi @@ -7,9 +7,9 @@ if sys.version_info >= (3, 6): else: _File = Union[Text, BinaryIO] - @overload def what(file: _File) -> Optional[str]: ... @overload def what(file: Any, h: bytes) -> Optional[str]: ... + tests: List[Callable[[bytes, BinaryIO], Optional[str]]] diff --git a/stdlib/2and3/keyword.pyi b/stdlib/2and3/keyword.pyi index f9e3376eeca0..5d7ec363a253 100644 --- a/stdlib/2and3/keyword.pyi +++ b/stdlib/2and3/keyword.pyi @@ -3,4 +3,5 @@ from typing import Sequence, Text, Union def iskeyword(s: Union[Text, bytes]) -> bool: ... + kwlist: Sequence[str] diff --git a/stdlib/2and3/lib2to3/pgen2/driver.pyi b/stdlib/2and3/lib2to3/pgen2/driver.pyi index 57d287e09f21..deee94626b1d 100644 --- a/stdlib/2and3/lib2to3/pgen2/driver.pyi +++ b/stdlib/2and3/lib2to3/pgen2/driver.pyi @@ -19,4 +19,6 @@ class Driver: def parse_file(self, filename: _Path, encoding: Optional[Text] = ..., debug: bool = ...) -> _NL: ... def parse_string(self, text: Text, debug: bool = ...) -> _NL: ... -def load_grammar(gt: Text = ..., gp: Optional[Text] = ..., save: bool = ..., force: bool = ..., logger: Optional[Logger] = ...) -> Grammar: ... +def load_grammar( + gt: Text = ..., gp: Optional[Text] = ..., save: bool = ..., force: bool = ..., logger: Optional[Logger] = ... +) -> Grammar: ... diff --git a/stdlib/2and3/lib2to3/pgen2/grammar.pyi b/stdlib/2and3/lib2to3/pgen2/grammar.pyi index 485de0c89f9b..5644e0c9b77f 100644 --- a/stdlib/2and3/lib2to3/pgen2/grammar.pyi +++ b/stdlib/2and3/lib2to3/pgen2/grammar.pyi @@ -3,7 +3,7 @@ from lib2to3.pgen2 import _Path from typing import Any, Dict, List, Optional, Text, Tuple, TypeVar -_P = TypeVar('_P') +_P = TypeVar("_P") _Label = Tuple[int, Optional[Text]] _DFA = List[List[Tuple[int, int]]] _DFAS = Tuple[_DFA, Dict[int, int]] diff --git a/stdlib/2and3/lib2to3/pgen2/tokenize.pyi b/stdlib/2and3/lib2to3/pgen2/tokenize.pyi index f5acccb2febb..0b5d65748a1a 100644 --- a/stdlib/2and3/lib2to3/pgen2/tokenize.pyi +++ b/stdlib/2and3/lib2to3/pgen2/tokenize.pyi @@ -8,7 +8,6 @@ _Coord = Tuple[int, int] _TokenEater = Callable[[int, Text, _Coord, _Coord, Text], None] _TokenInfo = Tuple[int, Text, _Coord, _Coord, Text] - class TokenError(Exception): ... class StopTokenizing(Exception): ... @@ -24,6 +23,4 @@ class Untokenizer: def compat(self, token: Tuple[int, Text], iterable: Iterable[_TokenInfo]) -> None: ... def untokenize(iterable: Iterable[_TokenInfo]) -> Text: ... -def generate_tokens( - readline: Callable[[], Text] -) -> Iterator[_TokenInfo]: ... +def generate_tokens(readline: Callable[[], Text]) -> Iterator[_TokenInfo]: ... diff --git a/stdlib/2and3/lib2to3/pytree.pyi b/stdlib/2and3/lib2to3/pytree.pyi index afcfe822831e..8ed6cd9bba4a 100644 --- a/stdlib/2and3/lib2to3/pytree.pyi +++ b/stdlib/2and3/lib2to3/pytree.pyi @@ -4,7 +4,7 @@ import sys from lib2to3.pgen2.grammar import Grammar from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union -_P = TypeVar('_P') +_P = TypeVar("_P") _NL = Union[Node, Leaf] _Context = Tuple[Text, int, int] _Results = Dict[Text, _NL] @@ -44,7 +44,14 @@ class Base: class Node(Base): fixers_applied: List[Any] - def __init__(self, type: int, children: List[_NL], context: Optional[Any] = ..., prefix: Optional[Text] = ..., fixers_applied: Optional[List[Any]] = ...) -> None: ... + def __init__( + self, + type: int, + children: List[_NL], + context: Optional[Any] = ..., + prefix: Optional[Text] = ..., + fixers_applied: Optional[List[Any]] = ..., + ) -> None: ... def set_child(self, i: int, child: _NL) -> None: ... def insert_child(self, i: int, child: _NL) -> None: ... def append_child(self, child: _NL) -> None: ... @@ -54,7 +61,14 @@ class Leaf(Base): column: int value: Text fixers_applied: List[Any] - def __init__(self, type: int, value: Text, context: Optional[_Context] = ..., prefix: Optional[Text] = ..., fixers_applied: List[Any] = ...) -> None: ... + def __init__( + self, + type: int, + value: Text, + context: Optional[_Context] = ..., + prefix: Optional[Text] = ..., + fixers_applied: List[Any] = ..., + ) -> None: ... def convert(gr: Grammar, raw_node: _RawNode) -> _NL: ... diff --git a/stdlib/2and3/linecache.pyi b/stdlib/2and3/linecache.pyi index 3f35f469eb3f..f52267bdba98 100644 --- a/stdlib/2and3/linecache.pyi +++ b/stdlib/2and3/linecache.pyi @@ -8,5 +8,6 @@ def clearcache() -> None: ... def getlines(filename: Text, module_globals: Optional[_ModuleGlobals] = ...) -> List[str]: ... def checkcache(filename: Optional[Text] = ...) -> None: ... def updatecache(filename: Text, module_globals: Optional[_ModuleGlobals] = ...) -> List[str]: ... + if sys.version_info >= (3, 5): def lazycache(filename: Text, module_globals: _ModuleGlobals) -> bool: ... diff --git a/stdlib/2and3/locale.pyi b/stdlib/2and3/locale.pyi index bb61f66098d7..9bc4f59e6f5f 100644 --- a/stdlib/2and3/locale.pyi +++ b/stdlib/2and3/locale.pyi @@ -81,8 +81,7 @@ CHAR_MAX: int class Error(Exception): ... -def setlocale(category: int, - locale: Union[_str, Iterable[_str], None] = ...) -> _str: ... +def setlocale(category: int, locale: Union[_str, Iterable[_str], None] = ...) -> _str: ... def localeconv() -> Mapping[_str, Union[int, _str, List[int]]]: ... def nl_langinfo(option: int) -> _str: ... def getdefaultlocale(envvars: Tuple[_str, ...] = ...) -> Tuple[Optional[_str], Optional[_str]]: ... @@ -92,18 +91,19 @@ def normalize(localename: _str) -> _str: ... def resetlocale(category: int = ...) -> None: ... def strcoll(string1: _str, string2: _str) -> int: ... def strxfrm(string: _str) -> _str: ... -def format(format: _str, val: Union[float, Decimal], grouping: bool = ..., - monetary: bool = ...) -> _str: ... +def format(format: _str, val: Union[float, Decimal], grouping: bool = ..., monetary: bool = ...) -> _str: ... + if sys.version_info >= (3, 7): - def format_string(format: _str, val: Any, - grouping: bool = ..., monetary: bool = ...) -> _str: ... + def format_string(format: _str, val: Any, grouping: bool = ..., monetary: bool = ...) -> _str: ... + else: - def format_string(format: _str, val: Any, - grouping: bool = ...) -> _str: ... -def currency(val: Union[int, float, Decimal], symbol: bool = ..., grouping: bool = ..., - international: bool = ...) -> _str: ... + def format_string(format: _str, val: Any, grouping: bool = ...) -> _str: ... + +def currency(val: Union[int, float, Decimal], symbol: bool = ..., grouping: bool = ..., international: bool = ...) -> _str: ... + if sys.version_info >= (3, 5): def delocalize(string: _str) -> None: ... + def atof(string: _str) -> float: ... def atoi(string: _str) -> int: ... def str(float: float) -> _str: ... diff --git a/stdlib/2and3/logging/__init__.pyi b/stdlib/2and3/logging/__init__.pyi index 2fafbbd4a483..d090ff140cd5 100644 --- a/stdlib/2and3/logging/__init__.pyi +++ b/stdlib/2and3/logging/__init__.pyi @@ -7,8 +7,7 @@ from time import struct_time from types import FrameType, TracebackType from typing import IO, Any, Callable, Dict, Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, Union, overload -_SysExcInfoType = Union[Tuple[type, BaseException, Optional[TracebackType]], - Tuple[None, None, None]] +_SysExcInfoType = Union[Tuple[type, BaseException, Optional[TracebackType]], Tuple[None, None, None]] if sys.version_info >= (3, 5): _ExcInfoType = Union[None, bool, _SysExcInfoType, BaseException] else: @@ -18,6 +17,7 @@ _FilterType = Union[Filter, Callable[[LogRecord], int]] _Level = Union[int, Text] if sys.version_info >= (3, 6): from os import PathLike + _Path = Union[str, PathLike[str]] else: _Path = str @@ -52,55 +52,110 @@ class Logger(Filterer): def getEffectiveLevel(self) -> int: ... def getChild(self, suffix: str) -> Logger: ... if sys.version_info >= (3,): - def debug(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def info(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def warning(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def warn(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def error(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def critical(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... + def debug( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def info( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def warning( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def warn( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def error( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def critical( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... fatal = critical - def log(self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def exception(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... + def log( + self, + level: int, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def exception( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... else: - def debug(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def info(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def warning(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... + def debug( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def info( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def warning( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... warn = warning - def error(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def critical(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... + def error( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def critical( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... fatal = critical - def log(self, - level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def exception(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... + def log( + self, + level: int, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def exception( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... def addFilter(self, filt: _FilterType) -> None: ... def removeFilter(self, filt: _FilterType) -> None: ... def filter(self, record: LogRecord) -> bool: ... @@ -112,23 +167,35 @@ class Logger(Filterer): def findCaller(self) -> Tuple[str, int, str]: ... def handle(self, record: LogRecord) -> None: ... if sys.version_info >= (3,): - def makeRecord(self, name: str, lvl: int, fn: str, lno: int, msg: Any, - args: _ArgsType, - exc_info: Optional[_SysExcInfoType], - func: Optional[str] = ..., - extra: Optional[Mapping[str, Any]] = ..., - sinfo: Optional[str] = ...) -> LogRecord: ... + def makeRecord( + self, + name: str, + lvl: int, + fn: str, + lno: int, + msg: Any, + args: _ArgsType, + exc_info: Optional[_SysExcInfoType], + func: Optional[str] = ..., + extra: Optional[Mapping[str, Any]] = ..., + sinfo: Optional[str] = ..., + ) -> LogRecord: ... else: - def makeRecord(self, - name: str, lvl: int, fn: str, lno: int, msg: Any, - args: _ArgsType, - exc_info: Optional[_SysExcInfoType], - func: Optional[str] = ..., - extra: Optional[Mapping[str, Any]] = ...) -> LogRecord: ... + def makeRecord( + self, + name: str, + lvl: int, + fn: str, + lno: int, + msg: Any, + args: _ArgsType, + exc_info: Optional[_SysExcInfoType], + func: Optional[str] = ..., + extra: Optional[Mapping[str, Any]] = ..., + ) -> LogRecord: ... if sys.version_info >= (3,): def hasHandlers(self) -> bool: ... - CRITICAL: int FATAL: int ERROR: int @@ -138,7 +205,6 @@ INFO: int DEBUG: int NOTSET: int - class Handler(Filterer): level: int # undocumented formatter: Optional[Formatter] # undocumented @@ -160,7 +226,6 @@ class Handler(Filterer): def format(self, record: LogRecord) -> str: ... def emit(self, record: LogRecord) -> None: ... - class Formatter: converter: Callable[[Optional[float]], struct_time] _fmt: Optional[str] @@ -171,14 +236,9 @@ class Formatter: default_msec_format: str if sys.version_info >= (3,): - def __init__(self, fmt: Optional[str] = ..., - datefmt: Optional[str] = ..., - style: str = ...) -> None: ... + def __init__(self, fmt: Optional[str] = ..., datefmt: Optional[str] = ..., style: str = ...) -> None: ... else: - def __init__(self, - fmt: Optional[str] = ..., - datefmt: Optional[str] = ...) -> None: ... - + def __init__(self, fmt: Optional[str] = ..., datefmt: Optional[str] = ...) -> None: ... def format(self, record: LogRecord) -> str: ... def formatTime(self, record: LogRecord, datefmt: str = ...) -> str: ... def formatException(self, exc_info: _SysExcInfoType) -> str: ... @@ -186,12 +246,10 @@ class Formatter: def formatMessage(self, record: LogRecord) -> str: ... # undocumented def formatStack(self, stack_info: str) -> str: ... - class Filter: def __init__(self, name: str = ...) -> None: ... def filter(self, record: LogRecord) -> int: ... - class LogRecord: args: _ArgsType asctime: str @@ -217,214 +275,331 @@ class LogRecord: thread: int threadName: str if sys.version_info >= (3,): - def __init__(self, name: str, level: int, pathname: str, lineno: int, - msg: Any, args: _ArgsType, - exc_info: Optional[_SysExcInfoType], - func: Optional[str] = ..., - sinfo: Optional[str] = ...) -> None: ... + def __init__( + self, + name: str, + level: int, + pathname: str, + lineno: int, + msg: Any, + args: _ArgsType, + exc_info: Optional[_SysExcInfoType], + func: Optional[str] = ..., + sinfo: Optional[str] = ..., + ) -> None: ... else: - def __init__(self, - name: str, level: int, pathname: str, lineno: int, - msg: Any, args: _ArgsType, - exc_info: Optional[_SysExcInfoType], - func: Optional[str] = ...) -> None: ... + def __init__( + self, + name: str, + level: int, + pathname: str, + lineno: int, + msg: Any, + args: _ArgsType, + exc_info: Optional[_SysExcInfoType], + func: Optional[str] = ..., + ) -> None: ... def getMessage(self) -> str: ... - class LoggerAdapter: logger: Logger extra: Mapping[str, Any] def __init__(self, logger: Logger, extra: Mapping[str, Any]) -> None: ... def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> Tuple[Any, MutableMapping[str, Any]]: ... if sys.version_info >= (3,): - def debug(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def info(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def warning(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def warn(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def error(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def exception(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def critical(self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def log(self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... + def debug( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def info( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def warning( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def warn( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def error( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def exception( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def critical( + self, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def log( + self, + level: int, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... else: - def debug(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def info(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def warning(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def error(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def exception(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def critical(self, - msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def log(self, - level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... + def debug( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def info( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def warning( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def error( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def exception( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def critical( + self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def log( + self, + level: int, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... def isEnabledFor(self, lvl: int) -> bool: ... if sys.version_info >= (3,): def getEffectiveLevel(self) -> int: ... def setLevel(self, lvl: Union[int, str]) -> None: ... def hasHandlers(self) -> bool: ... - if sys.version_info >= (3,): def getLogger(name: Optional[str] = ...) -> Logger: ... + else: @overload def getLogger() -> Logger: ... @overload def getLogger(name: Union[Text, str]) -> Logger: ... + def getLoggerClass() -> type: ... + if sys.version_info >= (3,): def getLogRecordFactory() -> Callable[..., LogRecord]: ... if sys.version_info >= (3,): - def debug(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def info(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def warning(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def warn(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def error(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def critical(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def exception(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... - def log(level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - stack_info: bool = ..., extra: Optional[Dict[str, Any]] = ..., - **kwargs: Any) -> None: ... + def debug( + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def info( + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def warning( + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def warn( + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def error( + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def critical( + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def exception( + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + def log( + level: int, + msg: Any, + *args: Any, + exc_info: _ExcInfoType = ..., + stack_info: bool = ..., + extra: Optional[Dict[str, Any]] = ..., + **kwargs: Any + ) -> None: ... + else: - def debug(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def info(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def warning(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... + def debug( + msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def info( + msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def warning( + msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... warn = warning - def error(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def critical(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def exception(msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... - def log(level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., - extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ... + def error( + msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def critical( + msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def exception( + msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + def log( + level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any + ) -> None: ... + fatal = critical def disable(lvl: int) -> None: ... def addLevelName(lvl: int, levelName: str) -> None: ... def getLevelName(lvl: Union[int, str]) -> Any: ... - def makeLogRecord(attrdict: Mapping[str, Any]) -> LogRecord: ... if sys.version_info >= (3,): - def basicConfig(*, filename: _Path = ..., filemode: str = ..., - format: str = ..., datefmt: str = ..., style: str = ..., - level: _Level = ..., stream: IO[str] = ..., - handlers: Iterable[Handler] = ...) -> None: ... + def basicConfig( + *, + filename: _Path = ..., + filemode: str = ..., + format: str = ..., + datefmt: str = ..., + style: str = ..., + level: _Level = ..., + stream: IO[str] = ..., + handlers: Iterable[Handler] = ... + ) -> None: ... + else: @overload def basicConfig() -> None: ... @overload - def basicConfig(*, filename: str = ..., filemode: str = ..., - format: str = ..., datefmt: str = ..., - level: _Level = ..., stream: IO[str] = ...) -> None: ... -def shutdown() -> None: ... + def basicConfig( + *, + filename: str = ..., + filemode: str = ..., + format: str = ..., + datefmt: str = ..., + level: _Level = ..., + stream: IO[str] = ... + ) -> None: ... +def shutdown() -> None: ... def setLoggerClass(klass: type) -> None: ... - def captureWarnings(capture: bool) -> None: ... if sys.version_info >= (3,): def setLogRecordFactory(factory: Callable[..., LogRecord]) -> None: ... - if sys.version_info >= (3,): lastResort: Optional[StreamHandler] - class StreamHandler(Handler): stream: IO[str] if sys.version_info >= (3,): terminator: str def __init__(self, stream: Optional[IO[str]] = ...) -> None: ... - class FileHandler(Handler): baseFilename: str mode: str encoding: Optional[str] delay: bool - def __init__(self, filename: _Path, mode: str = ..., - encoding: Optional[str] = ..., delay: bool = ...) -> None: ... - + def __init__(self, filename: _Path, mode: str = ..., encoding: Optional[str] = ..., delay: bool = ...) -> None: ... class NullHandler(Handler): ... - class PlaceHolder: def __init__(self, alogger: Logger) -> None: ... def append(self, alogger: Logger) -> None: ... - # Below aren't in module docs but still visible class RootLogger(Logger): ... root: RootLogger - if sys.version_info >= (3,): class PercentStyle(object): default_format: str asctime_format: str asctime_search: str _fmt: str - def __init__(self, fmt: str) -> None: ... def usesTime(self) -> bool: ... def format(self, record: Any) -> str: ... - - class StrFormatStyle(PercentStyle): - ... - + class StrFormatStyle(PercentStyle): ... class StringTemplateStyle(PercentStyle): _tpl: Template - _STYLES: Dict[str, Tuple[PercentStyle, str]] - BASIC_FORMAT: str diff --git a/stdlib/2and3/logging/config.pyi b/stdlib/2and3/logging/config.pyi index 3884cfbb02ca..297a5b984c8b 100644 --- a/stdlib/2and3/logging/config.pyi +++ b/stdlib/2and3/logging/config.pyi @@ -18,17 +18,20 @@ elif sys.version_info >= (3, 6): else: _Path = str - def dictConfig(config: Dict[str, Any]) -> None: ... + if sys.version_info >= (3, 4): - def fileConfig(fname: Union[_Path, IO[str], RawConfigParser], - defaults: Optional[Dict[str, str]] = ..., - disable_existing_loggers: bool = ...) -> None: ... - def listen(port: int = ..., - verify: Optional[Callable[[bytes], Optional[bytes]]] = ...) -> Thread: ... + def fileConfig( + fname: Union[_Path, IO[str], RawConfigParser], + defaults: Optional[Dict[str, str]] = ..., + disable_existing_loggers: bool = ..., + ) -> None: ... + def listen(port: int = ..., verify: Optional[Callable[[bytes], Optional[bytes]]] = ...) -> Thread: ... + else: - def fileConfig(fname: Union[str, IO[str]], - defaults: Optional[Dict[str, str]] = ..., - disable_existing_loggers: bool = ...) -> None: ... + def fileConfig( + fname: Union[str, IO[str]], defaults: Optional[Dict[str, str]] = ..., disable_existing_loggers: bool = ... + ) -> None: ... def listen(port: int = ...) -> Thread: ... + def stopListening() -> None: ... diff --git a/stdlib/2and3/logging/handlers.pyi b/stdlib/2and3/logging/handlers.pyi index 8acdb8ace605..95f5e5b44eec 100644 --- a/stdlib/2and3/logging/handlers.pyi +++ b/stdlib/2and3/logging/handlers.pyi @@ -16,6 +16,7 @@ else: _SocketKind = int if sys.version_info >= (3, 6): from os import PathLike + _Path = Union[str, PathLike[str]] else: _Path = str @@ -33,62 +34,86 @@ class WatchedFileHandler(FileHandler): @overload def __init__(self, filename: _Path, mode: str) -> None: ... @overload - def __init__(self, filename: _Path, mode: str, - encoding: Optional[str]) -> None: ... + def __init__(self, filename: _Path, mode: str, encoding: Optional[str]) -> None: ... @overload - def __init__(self, filename: _Path, mode: str, encoding: Optional[str], - delay: bool) -> None: ... - + def __init__(self, filename: _Path, mode: str, encoding: Optional[str], delay: bool) -> None: ... if sys.version_info >= (3,): class BaseRotatingHandler(FileHandler): terminator: str namer: Optional[Callable[[str], str]] rotator: Optional[Callable[[str, str], None]] - def __init__(self, filename: _Path, mode: str, - encoding: Optional[str] = ..., - delay: bool = ...) -> None: ... + def __init__(self, filename: _Path, mode: str, encoding: Optional[str] = ..., delay: bool = ...) -> None: ... def rotation_filename(self, default_name: str) -> None: ... def rotate(self, source: str, dest: str) -> None: ... - if sys.version_info >= (3,): class RotatingFileHandler(BaseRotatingHandler): - def __init__(self, filename: _Path, mode: str = ..., maxBytes: int = ..., - backupCount: int = ..., encoding: Optional[str] = ..., - delay: bool = ...) -> None: ... + def __init__( + self, + filename: _Path, + mode: str = ..., + maxBytes: int = ..., + backupCount: int = ..., + encoding: Optional[str] = ..., + delay: bool = ..., + ) -> None: ... def doRollover(self) -> None: ... + else: class RotatingFileHandler(Handler): - def __init__(self, filename: str, mode: str = ..., maxBytes: int = ..., - backupCount: int = ..., encoding: Optional[str] = ..., - delay: bool = ...) -> None: ... + def __init__( + self, + filename: str, + mode: str = ..., + maxBytes: int = ..., + backupCount: int = ..., + encoding: Optional[str] = ..., + delay: bool = ..., + ) -> None: ... def doRollover(self) -> None: ... - if sys.version_info >= (3,): class TimedRotatingFileHandler(BaseRotatingHandler): if sys.version_info >= (3, 4): - def __init__(self, filename: _Path, when: str = ..., - interval: int = ..., - backupCount: int = ..., encoding: Optional[str] = ..., - delay: bool = ..., utc: bool = ..., - atTime: Optional[datetime.datetime] = ...) -> None: ... + def __init__( + self, + filename: _Path, + when: str = ..., + interval: int = ..., + backupCount: int = ..., + encoding: Optional[str] = ..., + delay: bool = ..., + utc: bool = ..., + atTime: Optional[datetime.datetime] = ..., + ) -> None: ... else: - def __init__(self, - filename: str, when: str = ..., interval: int = ..., - backupCount: int = ..., encoding: Optional[str] = ..., - delay: bool = ..., utc: bool = ...) -> None: ... + def __init__( + self, + filename: str, + when: str = ..., + interval: int = ..., + backupCount: int = ..., + encoding: Optional[str] = ..., + delay: bool = ..., + utc: bool = ..., + ) -> None: ... def doRollover(self) -> None: ... + else: class TimedRotatingFileHandler(Handler): - def __init__(self, - filename: str, when: str = ..., interval: int = ..., - backupCount: int = ..., encoding: Optional[str] = ..., - delay: bool = ..., utc: bool = ...) -> None: ... + def __init__( + self, + filename: str, + when: str = ..., + interval: int = ..., + backupCount: int = ..., + encoding: Optional[str] = ..., + delay: bool = ..., + utc: bool = ..., + ) -> None: ... def doRollover(self) -> None: ... - class SocketHandler(Handler): retryStart: float retryFactor: float @@ -102,10 +127,8 @@ class SocketHandler(Handler): def send(self, packet: bytes) -> None: ... def createSocket(self) -> None: ... - class DatagramHandler(SocketHandler): ... - class SysLogHandler(Handler): LOG_ALERT: int LOG_CRIT: int @@ -135,78 +158,79 @@ class SysLogHandler(Handler): LOG_LOCAL5: int LOG_LOCAL6: int LOG_LOCAL7: int - def __init__(self, address: Union[Tuple[str, int], str] = ..., - facility: int = ..., socktype: _SocketKind = ...) -> None: ... - def encodePriority(self, facility: Union[int, str], - priority: Union[int, str]) -> int: ... + def __init__(self, address: Union[Tuple[str, int], str] = ..., facility: int = ..., socktype: _SocketKind = ...) -> None: ... + def encodePriority(self, facility: Union[int, str], priority: Union[int, str]) -> int: ... def mapPriority(self, levelName: str) -> str: ... - class NTEventLogHandler(Handler): - def __init__(self, appname: str, dllname: str = ..., - logtype: str = ...) -> None: ... + def __init__(self, appname: str, dllname: str = ..., logtype: str = ...) -> None: ... def getEventCategory(self, record: LogRecord) -> int: ... # TODO correct return value? def getEventType(self, record: LogRecord) -> int: ... def getMessageID(self, record: LogRecord) -> int: ... - class SMTPHandler(Handler): # TODO `secure` can also be an empty tuple if sys.version_info >= (3,): - def __init__(self, mailhost: Union[str, Tuple[str, int]], fromaddr: str, - toaddrs: List[str], subject: str, - credentials: Optional[Tuple[str, str]] = ..., - secure: Union[Tuple[str], Tuple[str, str], None] = ..., - timeout: float = ...) -> None: ... + def __init__( + self, + mailhost: Union[str, Tuple[str, int]], + fromaddr: str, + toaddrs: List[str], + subject: str, + credentials: Optional[Tuple[str, str]] = ..., + secure: Union[Tuple[str], Tuple[str, str], None] = ..., + timeout: float = ..., + ) -> None: ... else: - def __init__(self, - mailhost: Union[str, Tuple[str, int]], fromaddr: str, - toaddrs: List[str], subject: str, - credentials: Optional[Tuple[str, str]] = ..., - secure: Union[Tuple[str], Tuple[str, str], None] = ...) -> None: ... + def __init__( + self, + mailhost: Union[str, Tuple[str, int]], + fromaddr: str, + toaddrs: List[str], + subject: str, + credentials: Optional[Tuple[str, str]] = ..., + secure: Union[Tuple[str], Tuple[str, str], None] = ..., + ) -> None: ... def getSubject(self, record: LogRecord) -> str: ... - class BufferingHandler(Handler): def __init__(self, capacity: int) -> None: ... def shouldFlush(self, record: LogRecord) -> bool: ... class MemoryHandler(BufferingHandler): - def __init__(self, capacity: int, flushLevel: int = ..., - target: Optional[Handler] = ...) -> None: ... + def __init__(self, capacity: int, flushLevel: int = ..., target: Optional[Handler] = ...) -> None: ... def setTarget(self, target: Handler) -> None: ... - class HTTPHandler(Handler): if sys.version_info >= (3, 5): - def __init__(self, host: str, url: str, method: str = ..., - secure: bool = ..., - credentials: Optional[Tuple[str, str]] = ..., - context: Optional[ssl.SSLContext] = ...) -> None: ... + def __init__( + self, + host: str, + url: str, + method: str = ..., + secure: bool = ..., + credentials: Optional[Tuple[str, str]] = ..., + context: Optional[ssl.SSLContext] = ..., + ) -> None: ... elif sys.version_info >= (3,): - def __init__(self, - host: str, url: str, method: str = ..., secure: bool = ..., - credentials: Optional[Tuple[str, str]] = ...) -> None: ... + def __init__( + self, host: str, url: str, method: str = ..., secure: bool = ..., credentials: Optional[Tuple[str, str]] = ... + ) -> None: ... else: - def __init__(self, - host: str, url: str, method: str = ...) -> None: ... + def __init__(self, host: str, url: str, method: str = ...) -> None: ... def mapLogRecord(self, record: LogRecord) -> Dict[str, Any]: ... - if sys.version_info >= (3,): class QueueHandler(Handler): def __init__(self, queue: Queue) -> None: ... def prepare(self, record: LogRecord) -> Any: ... def enqueue(self, record: LogRecord) -> None: ... - class QueueListener: if sys.version_info >= (3, 5): - def __init__(self, queue: Queue, *handlers: Handler, - respect_handler_level: bool = ...) -> None: ... + def __init__(self, queue: Queue, *handlers: Handler, respect_handler_level: bool = ...) -> None: ... else: - def __init__(self, - queue: Queue, *handlers: Handler) -> None: ... + def __init__(self, queue: Queue, *handlers: Handler) -> None: ... def dequeue(self, block: bool) -> LogRecord: ... def prepare(self, record: LogRecord) -> Any: ... def start(self) -> None: ... diff --git a/stdlib/2and3/macpath.pyi b/stdlib/2and3/macpath.pyi index dfd074fe7c7c..5828ac950b48 100644 --- a/stdlib/2and3/macpath.pyi +++ b/stdlib/2and3/macpath.pyi @@ -6,10 +6,11 @@ import os import sys from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3, 6): from builtins import _PathLike + _PathType = Union[bytes, Text, _PathLike] _StrPath = Union[Text, _PathLike[Text]] _BytesPath = Union[bytes, _PathLike[bytes]] @@ -24,7 +25,7 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -if sys.platform == 'win32': +if sys.platform == "win32": altsep: str else: altsep: Optional[str] @@ -64,7 +65,7 @@ if sys.version_info >= (3, 6): def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": @overload def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload @@ -83,7 +84,7 @@ else: def expandvars(path: AnyStr) -> AnyStr: ... def normcase(path: AnyStr) -> AnyStr: ... def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": def realpath(path: AnyStr) -> AnyStr: ... else: def realpath(filename: AnyStr) -> AnyStr: ... @@ -92,6 +93,7 @@ if sys.version_info >= (3, 6): # In reality it returns str for sequences of _StrPath and bytes for sequences # of _BytesPath, but mypy does not accept such a signature. def commonpath(paths: Sequence[_PathType]) -> Any: ... + elif sys.version_info >= (3, 5): def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... @@ -102,8 +104,10 @@ def commonprefix(list: Sequence[_PathType]) -> Any: ... if sys.version_info >= (3, 3): def exists(path: Union[_PathType, int]) -> bool: ... + else: def exists(path: _PathType) -> bool: ... + def lexists(path: _PathType) -> bool: ... # These return float if os.stat_float_times() == True, @@ -111,7 +115,6 @@ def lexists(path: _PathType) -> bool: ... def getatime(path: _PathType) -> float: ... def getmtime(path: _PathType) -> float: ... def getctime(path: _PathType) -> float: ... - def getsize(path: _PathType) -> int: ... def isabs(path: _PathType) -> bool: ... def isfile(path: _PathType) -> bool: ... @@ -134,12 +137,14 @@ if sys.version_info < (3, 0): def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ... @overload def join(__p1: Text, *p: _PathType) -> Text: ... + elif sys.version_info >= (3, 6): # Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway. @overload def join(path: _StrPath, *paths: _StrPath) -> Text: ... @overload def join(path: _BytesPath, *paths: _BytesPath) -> bytes: ... + else: def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ... @@ -147,7 +152,6 @@ else: def relpath(path: _BytesPath, start: Optional[_BytesPath] = ...) -> bytes: ... @overload def relpath(path: _StrPath, start: Optional[_StrPath] = ...) -> Text: ... - def samefile(path1: _PathType, path2: _PathType) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(stat1: os.stat_result, stat2: os.stat_result) -> bool: ... @@ -165,12 +169,13 @@ if sys.version_info >= (3, 6): def splitext(path: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... + else: def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -if sys.platform == 'win32': +if sys.platform == "win32": def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated if sys.version_info < (3,): diff --git a/stdlib/2and3/math.pyi b/stdlib/2and3/math.pyi index f80a4a5e7b1d..d83949d72177 100644 --- a/stdlib/2and3/math.pyi +++ b/stdlib/2and3/math.pyi @@ -19,10 +19,13 @@ def asinh(x: SupportsFloat) -> float: ... def atan(x: SupportsFloat) -> float: ... def atan2(y: SupportsFloat, x: SupportsFloat) -> float: ... def atanh(x: SupportsFloat) -> float: ... + if sys.version_info >= (3,): def ceil(x: SupportsFloat) -> int: ... + else: def ceil(x: SupportsFloat) -> float: ... + def copysign(x: SupportsFloat, y: SupportsFloat) -> float: ... def cos(x: SupportsFloat) -> float: ... def cosh(x: SupportsFloat) -> float: ... @@ -33,35 +36,48 @@ def exp(x: SupportsFloat) -> float: ... def expm1(x: SupportsFloat) -> float: ... def fabs(x: SupportsFloat) -> float: ... def factorial(x: SupportsInt) -> int: ... + if sys.version_info >= (3,): def floor(x: SupportsFloat) -> int: ... + else: def floor(x: SupportsFloat) -> float: ... + def fmod(x: SupportsFloat, y: SupportsFloat) -> float: ... def frexp(x: SupportsFloat) -> Tuple[float, int]: ... def fsum(iterable: Iterable) -> float: ... def gamma(x: SupportsFloat) -> float: ... + if sys.version_info >= (3, 5): def gcd(a: int, b: int) -> int: ... + def hypot(x: SupportsFloat, y: SupportsFloat) -> float: ... + if sys.version_info >= (3, 5): def isclose(a: SupportsFloat, b: SupportsFloat, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ... + def isinf(x: SupportsFloat) -> bool: ... + if sys.version_info >= (3,): def isfinite(x: SupportsFloat) -> bool: ... + def isnan(x: SupportsFloat) -> bool: ... def ldexp(x: SupportsFloat, i: int) -> float: ... def lgamma(x: SupportsFloat) -> float: ... def log(x: SupportsFloat, base: SupportsFloat = ...) -> float: ... def log10(x: SupportsFloat) -> float: ... def log1p(x: SupportsFloat) -> float: ... + if sys.version_info >= (3, 3): def log2(x: SupportsFloat) -> float: ... + def modf(x: SupportsFloat) -> Tuple[float, float]: ... def pow(x: SupportsFloat, y: SupportsFloat) -> float: ... def radians(x: SupportsFloat) -> float: ... + if sys.version_info >= (3, 7): def remainder(x: SupportsFloat, y: SupportsFloat) -> float: ... + def sin(x: SupportsFloat) -> float: ... def sinh(x: SupportsFloat) -> float: ... def sqrt(x: SupportsFloat) -> float: ... diff --git a/stdlib/2and3/mimetypes.pyi b/stdlib/2and3/mimetypes.pyi index 43248c50013e..03041214e969 100644 --- a/stdlib/2and3/mimetypes.pyi +++ b/stdlib/2and3/mimetypes.pyi @@ -3,11 +3,9 @@ import sys from typing import IO, Dict, List, Optional, Sequence, Text, Tuple -def guess_type(url: Text, - strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... +def guess_type(url: Text, strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... def guess_all_extensions(type: str, strict: bool = ...) -> List[str]: ... def guess_extension(type: str, strict: bool = ...) -> Optional[str]: ... - def init(files: Optional[Sequence[str]] = ...) -> None: ... def read_mime_types(filename: str) -> Optional[Dict[str, str]]: ... def add_type(type: str, ext: str, strict: bool = ...) -> None: ... @@ -24,15 +22,11 @@ class MimeTypes: encodings_map: Dict[str, str] types_map: Tuple[Dict[str, str], Dict[str, str]] types_map_inv: Tuple[Dict[str, str], Dict[str, str]] - def __init__(self, filenames: Tuple[str, ...] = ..., - strict: bool = ...) -> None: ... - def guess_extension(self, type: str, - strict: bool = ...) -> Optional[str]: ... - def guess_type(self, url: str, - strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... - def guess_all_extensions(self, type: str, - strict: bool = ...) -> List[str]: ... + def __init__(self, filenames: Tuple[str, ...] = ..., strict: bool = ...) -> None: ... + def guess_extension(self, type: str, strict: bool = ...) -> Optional[str]: ... + def guess_type(self, url: str, strict: bool = ...) -> Tuple[Optional[str], Optional[str]]: ... + def guess_all_extensions(self, type: str, strict: bool = ...) -> List[str]: ... def read(self, filename: str, strict: bool = ...) -> None: ... def readfp(self, fp: IO[str], strict: bool = ...) -> None: ... - if sys.platform == 'win32': + if sys.platform == "win32": def read_windows_registry(self, strict: bool = ...) -> None: ... diff --git a/stdlib/2and3/mmap.pyi b/stdlib/2and3/mmap.pyi index ede5739725ac..9d34bb30f14e 100644 --- a/stdlib/2and3/mmap.pyi +++ b/stdlib/2and3/mmap.pyi @@ -8,7 +8,7 @@ ACCESS_COPY: int ALLOCATIONGRANULARITY: int -if sys.platform != 'win32': +if sys.platform != "win32": MAP_ANON: int MAP_ANONYMOUS: int MAP_DENYWRITE: int @@ -22,18 +22,16 @@ if sys.platform != 'win32': PAGESIZE: int class _mmap(Generic[AnyStr]): - if sys.platform == 'win32': - def __init__(self, fileno: int, length: int, - tagname: Optional[str] = ..., access: int = ..., - offset: int = ...) -> None: ... + if sys.platform == "win32": + def __init__( + self, fileno: int, length: int, tagname: Optional[str] = ..., access: int = ..., offset: int = ... + ) -> None: ... else: - def __init__(self, - fileno: int, length: int, flags: int = ..., - prot: int = ..., access: int = ..., - offset: int = ...) -> None: ... + def __init__( + self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... + ) -> None: ... def close(self) -> None: ... - def find(self, sub: AnyStr, - start: int = ..., end: int = ...) -> int: ... + def find(self, sub: AnyStr, start: int = ..., end: int = ...) -> int: ... def flush(self, offset: int = ..., size: int = ...) -> int: ... def move(self, dest: int, src: int, count: int) -> None: ... def read(self, n: int = ...) -> AnyStr: ... @@ -63,6 +61,7 @@ if sys.version_info >= (3,): # Doesn't actually exist, but the object is actually iterable because it has __getitem__ and # __len__, so we claim that there is also an __iter__ to help type checkers. def __iter__(self) -> Iterator[bytes]: ... + else: class mmap(_mmap, Sequence[bytes]): def rfind(self, string: bytes, start: int = ..., stop: int = ...) -> int: ... diff --git a/stdlib/2and3/netrc.pyi b/stdlib/2and3/netrc.pyi index d08f73a59da0..758a0457c072 100644 --- a/stdlib/2and3/netrc.pyi +++ b/stdlib/2and3/netrc.pyi @@ -5,14 +5,11 @@ class NetrcParseError(Exception): lineno: Optional[int] msg: str - # (login, account, password) tuple _NetrcTuple = Tuple[str, Optional[str], Optional[str]] - class netrc: hosts: Dict[str, _NetrcTuple] macros: Dict[str, List[str]] - def __init__(self, file: str = ...) -> None: ... def authenticators(self, host: str) -> Optional[_NetrcTuple]: ... diff --git a/stdlib/2and3/nis.pyi b/stdlib/2and3/nis.pyi index 87223caf2e39..bc6c2bc07256 100644 --- a/stdlib/2and3/nis.pyi +++ b/stdlib/2and3/nis.pyi @@ -1,10 +1,9 @@ import sys from typing import Dict, List -if sys.platform != 'win32': +if sys.platform != "win32": def cat(map: str, domain: str = ...) -> Dict[str, str]: ... def get_default_domain() -> str: ... def maps(domain: str = ...) -> List[str]: ... def match(key: str, map: str, domain: str = ...) -> str: ... - class error(Exception): ... diff --git a/stdlib/2and3/ntpath.pyi b/stdlib/2and3/ntpath.pyi index dfd074fe7c7c..5828ac950b48 100644 --- a/stdlib/2and3/ntpath.pyi +++ b/stdlib/2and3/ntpath.pyi @@ -6,10 +6,11 @@ import os import sys from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3, 6): from builtins import _PathLike + _PathType = Union[bytes, Text, _PathLike] _StrPath = Union[Text, _PathLike[Text]] _BytesPath = Union[bytes, _PathLike[bytes]] @@ -24,7 +25,7 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -if sys.platform == 'win32': +if sys.platform == "win32": altsep: str else: altsep: Optional[str] @@ -64,7 +65,7 @@ if sys.version_info >= (3, 6): def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": @overload def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload @@ -83,7 +84,7 @@ else: def expandvars(path: AnyStr) -> AnyStr: ... def normcase(path: AnyStr) -> AnyStr: ... def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": def realpath(path: AnyStr) -> AnyStr: ... else: def realpath(filename: AnyStr) -> AnyStr: ... @@ -92,6 +93,7 @@ if sys.version_info >= (3, 6): # In reality it returns str for sequences of _StrPath and bytes for sequences # of _BytesPath, but mypy does not accept such a signature. def commonpath(paths: Sequence[_PathType]) -> Any: ... + elif sys.version_info >= (3, 5): def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... @@ -102,8 +104,10 @@ def commonprefix(list: Sequence[_PathType]) -> Any: ... if sys.version_info >= (3, 3): def exists(path: Union[_PathType, int]) -> bool: ... + else: def exists(path: _PathType) -> bool: ... + def lexists(path: _PathType) -> bool: ... # These return float if os.stat_float_times() == True, @@ -111,7 +115,6 @@ def lexists(path: _PathType) -> bool: ... def getatime(path: _PathType) -> float: ... def getmtime(path: _PathType) -> float: ... def getctime(path: _PathType) -> float: ... - def getsize(path: _PathType) -> int: ... def isabs(path: _PathType) -> bool: ... def isfile(path: _PathType) -> bool: ... @@ -134,12 +137,14 @@ if sys.version_info < (3, 0): def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ... @overload def join(__p1: Text, *p: _PathType) -> Text: ... + elif sys.version_info >= (3, 6): # Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway. @overload def join(path: _StrPath, *paths: _StrPath) -> Text: ... @overload def join(path: _BytesPath, *paths: _BytesPath) -> bytes: ... + else: def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ... @@ -147,7 +152,6 @@ else: def relpath(path: _BytesPath, start: Optional[_BytesPath] = ...) -> bytes: ... @overload def relpath(path: _StrPath, start: Optional[_StrPath] = ...) -> Text: ... - def samefile(path1: _PathType, path2: _PathType) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(stat1: os.stat_result, stat2: os.stat_result) -> bool: ... @@ -165,12 +169,13 @@ if sys.version_info >= (3, 6): def splitext(path: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... + else: def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -if sys.platform == 'win32': +if sys.platform == "win32": def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated if sys.version_info < (3,): diff --git a/stdlib/2and3/operator.pyi b/stdlib/2and3/operator.pyi index 655e3d58809b..86fc5182bee1 100644 --- a/stdlib/2and3/operator.pyi +++ b/stdlib/2and3/operator.pyi @@ -15,10 +15,9 @@ from typing import ( overload, ) -_T = TypeVar('_T') -_K = TypeVar('_K') -_V = TypeVar('_V') - +_T = TypeVar("_T") +_K = TypeVar("_K") +_V = TypeVar("_V") def lt(a: Any, b: Any) -> Any: ... def le(a: Any, b: Any) -> Any: ... @@ -32,46 +31,34 @@ def __eq__(a: Any, b: Any) -> Any: ... def __ne__(a: Any, b: Any) -> Any: ... def __ge__(a: Any, b: Any) -> Any: ... def __gt__(a: Any, b: Any) -> Any: ... - def not_(obj: Any) -> bool: ... def __not__(obj: Any) -> bool: ... - def truth(x: Any) -> bool: ... - def is_(a: Any, b: Any) -> bool: ... - def is_not(a: Any, b: Any) -> bool: ... - def abs(x: SupportsAbs) -> Any: ... def __abs__(a: SupportsAbs) -> Any: ... - def add(a: Any, b: Any) -> Any: ... def __add__(a: Any, b: Any) -> Any: ... - def and_(a: Any, b: Any) -> Any: ... def __and__(a: Any, b: Any) -> Any: ... -if sys.version_info < (3, ): +if sys.version_info < (3,): def div(a: Any, b: Any) -> Any: ... def __div__(a: Any, b: Any) -> Any: ... def floordiv(a: Any, b: Any) -> Any: ... def __floordiv__(a: Any, b: Any) -> Any: ... - def index(a: Any) -> int: ... def __index__(a: Any) -> int: ... - def inv(obj: Any) -> Any: ... def invert(obj: Any) -> Any: ... def __inv__(obj: Any) -> Any: ... def __invert__(obj: Any) -> Any: ... - def lshift(a: Any, b: Any) -> Any: ... def __lshift__(a: Any, b: Any) -> Any: ... - def mod(a: Any, b: Any) -> Any: ... def __mod__(a: Any, b: Any) -> Any: ... - def mul(a: Any, b: Any) -> Any: ... def __mul__(a: Any, b: Any) -> Any: ... @@ -81,36 +68,25 @@ if sys.version_info >= (3, 5): def neg(obj: Any) -> Any: ... def __neg__(obj: Any) -> Any: ... - def or_(a: Any, b: Any) -> Any: ... def __or__(a: Any, b: Any) -> Any: ... - def pos(obj: Any) -> Any: ... def __pos__(obj: Any) -> Any: ... - def pow(a: Any, b: Any) -> Any: ... def __pow__(a: Any, b: Any) -> Any: ... - def rshift(a: Any, b: Any) -> Any: ... def __rshift__(a: Any, b: Any) -> Any: ... - def sub(a: Any, b: Any) -> Any: ... def __sub__(a: Any, b: Any) -> Any: ... - def truediv(a: Any, b: Any) -> Any: ... def __truediv__(a: Any, b: Any) -> Any: ... - def xor(a: Any, b: Any) -> Any: ... def __xor__(a: Any, b: Any) -> Any: ... - def concat(a: Sequence[_T], b: Sequence[_T]) -> Sequence[_T]: ... def __concat__(a: Sequence[_T], b: Sequence[_T]) -> Sequence[_T]: ... - def contains(a: Container[Any], b: Any) -> bool: ... def __contains__(a: Container[Any], b: Any) -> bool: ... - def countOf(a: Container[Any], b: Any) -> int: ... - @overload def delitem(a: MutableSequence[_T], b: int) -> None: ... @overload @@ -120,7 +96,7 @@ def __delitem__(a: MutableSequence[_T], b: int) -> None: ... @overload def __delitem__(a: MutableMapping[_K, _V], b: _K) -> None: ... -if sys.version_info < (3, ): +if sys.version_info < (3,): def delslice(a: MutableSequence[Any], b: int, c: int) -> None: ... def __delslice__(a: MutableSequence[Any], b: int, c: int) -> None: ... @@ -133,17 +109,17 @@ def __getitem__(a: Sequence[_T], b: int) -> _T: ... @overload def __getitem__(a: Mapping[_K, _V], b: _K) -> _V: ... -if sys.version_info < (3, ): +if sys.version_info < (3,): def getslice(a: Sequence[_T], b: int, c: int) -> Sequence[_T]: ... def __getslice__(a: Sequence[_T], b: int, c: int) -> Sequence[_T]: ... def indexOf(a: Sequence[_T], b: _T) -> int: ... -if sys.version_info < (3, ): +if sys.version_info < (3,): def repeat(a: Any, b: int) -> Any: ... def __repeat__(a: Any, b: int) -> Any: ... -if sys.version_info < (3, ): +if sys.version_info < (3,): def sequenceIncludes(a: Container[Any], b: Any) -> bool: ... @overload @@ -155,11 +131,10 @@ def __setitem__(a: MutableSequence[_T], b: int, c: _T) -> None: ... @overload def __setitem__(a: MutableMapping[_K, _V], b: _K, c: _V) -> None: ... -if sys.version_info < (3, ): +if sys.version_info < (3,): def setslice(a: MutableSequence[_T], b: int, c: int, v: Sequence[_T]) -> None: ... def __setslice__(a: MutableSequence[_T], b: int, c: int, v: Sequence[_T]) -> None: ... - if sys.version_info >= (3, 4): def length_hint(obj: Any, default: int = ...) -> int: ... @@ -167,37 +142,28 @@ if sys.version_info >= (3, 4): def attrgetter(attr: str) -> Callable[[Any], Any]: ... @overload def attrgetter(*attrs: str) -> Callable[[Any], Tuple[Any, ...]]: ... - @overload def itemgetter(item: Any) -> Callable[[Any], Any]: ... @overload def itemgetter(*items: Any) -> Callable[[Any], Tuple[Any, ...]]: ... - def methodcaller(name: str, *args: Any, **kwargs: Any) -> Callable[..., Any]: ... - - def iadd(a: Any, b: Any) -> Any: ... def __iadd__(a: Any, b: Any) -> Any: ... - def iand(a: Any, b: Any) -> Any: ... def __iand__(a: Any, b: Any) -> Any: ... - def iconcat(a: Any, b: Any) -> Any: ... def __iconcat__(a: Any, b: Any) -> Any: ... -if sys.version_info < (3, ): +if sys.version_info < (3,): def idiv(a: Any, b: Any) -> Any: ... def __idiv__(a: Any, b: Any) -> Any: ... def ifloordiv(a: Any, b: Any) -> Any: ... def __ifloordiv__(a: Any, b: Any) -> Any: ... - def ilshift(a: Any, b: Any) -> Any: ... def __ilshift__(a: Any, b: Any) -> Any: ... - def imod(a: Any, b: Any) -> Any: ... def __imod__(a: Any, b: Any) -> Any: ... - def imul(a: Any, b: Any) -> Any: ... def __imul__(a: Any, b: Any) -> Any: ... @@ -207,28 +173,23 @@ if sys.version_info >= (3, 5): def ior(a: Any, b: Any) -> Any: ... def __ior__(a: Any, b: Any) -> Any: ... - def ipow(a: Any, b: Any) -> Any: ... def __ipow__(a: Any, b: Any) -> Any: ... -if sys.version_info < (3, ): +if sys.version_info < (3,): def irepeat(a: Any, b: int) -> Any: ... def __irepeat__(a: Any, b: int) -> Any: ... def irshift(a: Any, b: Any) -> Any: ... def __irshift__(a: Any, b: Any) -> Any: ... - def isub(a: Any, b: Any) -> Any: ... def __isub__(a: Any, b: Any) -> Any: ... - def itruediv(a: Any, b: Any) -> Any: ... def __itruediv__(a: Any, b: Any) -> Any: ... - def ixor(a: Any, b: Any) -> Any: ... def __ixor__(a: Any, b: Any) -> Any: ... - -if sys.version_info < (3, ): +if sys.version_info < (3,): def isCallable(x: Any) -> bool: ... def isMappingType(x: Any) -> bool: ... def isNumberType(x: Any) -> bool: ... diff --git a/stdlib/2and3/optparse.pyi b/stdlib/2and3/optparse.pyi index cdb9b94058b7..328647030bf9 100644 --- a/stdlib/2and3/optparse.pyi +++ b/stdlib/2and3/optparse.pyi @@ -14,6 +14,7 @@ SUPPRESS_USAGE: _Text def check_builtin(option: Option, opt: Any, value: _Text) -> Any: ... def check_choice(option: Option, opt: Any, value: _Text) -> Any: ... + if sys.version_info < (3,): def isbasestring(x: Any) -> bool: ... @@ -35,10 +36,8 @@ class OptionError(OptParseError): def __init__(self, msg: _Text, option: Option) -> None: ... class OptionConflictError(OptionError): ... - class OptionValueError(OptParseError): ... - class HelpFormatter: NO_DEFAULT_VALUE: _Text _long_opt_fmt: _Text @@ -71,20 +70,16 @@ class HelpFormatter: def store_option_strings(self, parser: OptionParser) -> None: ... class IndentedHelpFormatter(HelpFormatter): - def __init__(self, - indent_increment: int = ..., - max_help_position: int = ..., - width: Optional[int] = ..., - short_first: int = ...) -> None: ... + def __init__( + self, indent_increment: int = ..., max_help_position: int = ..., width: Optional[int] = ..., short_first: int = ... + ) -> None: ... def format_heading(self, heading: _Text) -> _Text: ... def format_usage(self, usage: _Text) -> _Text: ... class TitledHelpFormatter(HelpFormatter): - def __init__(self, - indent_increment: int = ..., - max_help_position: int = ..., - width: Optional[int] = ..., - short_first: int = ...) -> None: ... + def __init__( + self, indent_increment: int = ..., max_help_position: int = ..., width: Optional[int] = ..., short_first: int = ... + ) -> None: ... def format_heading(self, heading: _Text) -> _Text: ... def format_usage(self, usage: _Text) -> _Text: ... @@ -181,17 +176,19 @@ class OptionParser(OptionContainer): usage: Optional[_Text] values: Optional[Values] version: _Text - def __init__(self, - usage: Optional[_Text] = ..., - option_list: Iterable[Option] = ..., - option_class: Option = ..., - version: Optional[_Text] = ..., - conflict_handler: _Text = ..., - description: Optional[_Text] = ..., - formatter: Optional[HelpFormatter] = ..., - add_help_option: bool = ..., - prog: Optional[_Text] = ..., - epilog: Optional[_Text] = ...) -> None: ... + def __init__( + self, + usage: Optional[_Text] = ..., + option_list: Iterable[Option] = ..., + option_class: Option = ..., + version: Optional[_Text] = ..., + conflict_handler: _Text = ..., + description: Optional[_Text] = ..., + formatter: Optional[HelpFormatter] = ..., + add_help_option: bool = ..., + prog: Optional[_Text] = ..., + epilog: Optional[_Text] = ..., + ) -> None: ... def _add_help_option(self) -> None: ... def _add_version_option(self) -> None: ... def _create_option_list(self) -> None: ... @@ -218,7 +215,9 @@ class OptionParser(OptionContainer): def get_prog_name(self) -> _Text: ... def get_usage(self) -> _Text: ... def get_version(self) -> _Text: ... - def parse_args(self, args: Optional[Sequence[AnyStr]] = ..., values: Optional[Values] = ...) -> Tuple[Values, List[AnyStr]]: ... + def parse_args( + self, args: Optional[Sequence[AnyStr]] = ..., values: Optional[Values] = ... + ) -> Tuple[Values, List[AnyStr]]: ... def print_usage(self, file: Optional[IO[str]] = ...) -> None: ... def print_help(self, file: Optional[IO[str]] = ...) -> None: ... def print_version(self, file: Optional[IO[str]] = ...) -> None: ... diff --git a/stdlib/2and3/pdb.pyi b/stdlib/2and3/pdb.pyi index 425cfe060b92..fb059fb5b4be 100644 --- a/stdlib/2and3/pdb.pyi +++ b/stdlib/2and3/pdb.pyi @@ -5,19 +5,18 @@ from cmd import Cmd from types import FrameType from typing import IO, Any, Callable, Dict, Iterable, Optional, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") class Restart(Exception): ... -def run(statement: str, globals: Optional[Dict[str, Any]] = ..., - locals: Optional[Dict[str, Any]] = ...) -> None: ... -def runeval(expression: str, globals: Optional[Dict[str, Any]] = ..., - locals: Optional[Dict[str, Any]] = ...) -> Any: ... +def run(statement: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ...) -> None: ... +def runeval(expression: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ...) -> Any: ... def runctx(statement: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> None: ... def runcall(*args: Any, **kwds: Any) -> Any: ... if sys.version_info >= (3, 7): def set_trace(*, header: Optional[str] = ...) -> None: ... + else: def set_trace() -> None: ... @@ -54,9 +53,9 @@ class Pdb(Cmd): ) -> None: ... # TODO: The run* and set_trace() methods are actually defined on bdb.Bdb, from which Pdb inherits. # Move these methods there once we have a bdb stub. - def run(self, statement: str, globals: Optional[Dict[str, Any]] = ..., - locals: Optional[Dict[str, Any]] = ...) -> None: ... - def runeval(self, expression: str, globals: Optional[Dict[str, Any]] = ..., - locals: Optional[Dict[str, Any]] = ...) -> Any: ... + def run(self, statement: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ...) -> None: ... + def runeval( + self, expression: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Dict[str, Any]] = ... + ) -> Any: ... def runcall(self, func: Callable[..., _T], *args: Any, **kwds: Any) -> Optional[_T]: ... def set_trace(self, frame: Optional[FrameType] = ...) -> None: ... diff --git a/stdlib/2and3/pickle.pyi b/stdlib/2and3/pickle.pyi index 795405c103d8..2c3e19299f83 100644 --- a/stdlib/2and3/pickle.pyi +++ b/stdlib/2and3/pickle.pyi @@ -5,16 +5,12 @@ HIGHEST_PROTOCOL: int if sys.version_info >= (3, 0): DEFAULT_PROTOCOL: int - if sys.version_info >= (3, 0): - def dump(obj: Any, file: IO[bytes], protocol: Optional[int] = ..., *, - fix_imports: bool = ...) -> None: ... - def dumps(obj: Any, protocol: Optional[int] = ..., *, - fix_imports: bool = ...) -> bytes: ... - def loads(bytes_object: bytes, *, fix_imports: bool = ..., - encoding: str = ..., errors: str = ...) -> Any: ... - def load(file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., - errors: str = ...) -> Any: ... + def dump(obj: Any, file: IO[bytes], protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> None: ... + def dumps(obj: Any, protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> bytes: ... + def loads(bytes_object: bytes, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... + def load(file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... + else: def dump(obj: Any, file: IO[bytes], protocol: Optional[int] = ...) -> None: ... def dumps(obj: Any, protocol: Optional[int] = ...) -> bytes: ... @@ -25,14 +21,13 @@ class PickleError(Exception): ... class PicklingError(PickleError): ... class UnpicklingError(PickleError): ... -_reducedtype = Union[str, - Tuple[Callable[..., Any], Tuple], - Tuple[Callable[..., Any], Tuple, Any], - Tuple[Callable[..., Any], Tuple, Any, - Optional[Iterator]], - Tuple[Callable[..., Any], Tuple, Any, - Optional[Iterator], Optional[Iterator]]] - +_reducedtype = Union[ + str, + Tuple[Callable[..., Any], Tuple], + Tuple[Callable[..., Any], Tuple, Any], + Tuple[Callable[..., Any], Tuple, Any, Optional[Iterator]], + Tuple[Callable[..., Any], Tuple, Any, Optional[Iterator], Optional[Iterator]], +] class Pickler: fast: bool @@ -40,23 +35,18 @@ class Pickler: dispatch_table: Mapping[type, Callable[[Any], _reducedtype]] if sys.version_info >= (3, 0): - def __init__(self, file: IO[bytes], protocol: Optional[int] = ..., *, - fix_imports: bool = ...) -> None: ... + def __init__(self, file: IO[bytes], protocol: Optional[int] = ..., *, fix_imports: bool = ...) -> None: ... else: def __init__(self, file: IO[bytes], protocol: Optional[int] = ...) -> None: ... - def dump(self, obj: Any) -> None: ... def clear_memo(self) -> None: ... def persistent_id(self, obj: Any) -> Any: ... - class Unpickler: if sys.version_info >= (3, 0): - def __init__(self, file: IO[bytes], *, fix_imports: bool = ..., - encoding: str = ..., errors: str = ...) -> None: ... + def __init__(self, file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> None: ... else: def __init__(self, file: IO[bytes]) -> None: ... - def load(self) -> Any: ... def find_class(self, module: str, name: str) -> Any: ... if sys.version_info >= (3, 0): diff --git a/stdlib/2and3/pickletools.pyi b/stdlib/2and3/pickletools.pyi index 856866655723..1c938eda59d2 100644 --- a/stdlib/2and3/pickletools.pyi +++ b/stdlib/2and3/pickletools.pyi @@ -23,12 +23,15 @@ class ArgumentDescriptor(object): def __init__(self, name: str, n: int, reader: _Reader, doc: str) -> None: ... def read_uint1(f: IO[bytes]) -> int: ... + uint1: ArgumentDescriptor def read_uint2(f: IO[bytes]) -> int: ... + uint2: ArgumentDescriptor def read_int4(f: IO[bytes]) -> int: ... + int4: ArgumentDescriptor if sys.version_info >= (3, 3): @@ -40,24 +43,28 @@ if sys.version_info >= (3, 5): uint8: ArgumentDescriptor def read_stringnl(f: IO[bytes], decode: bool = ..., stripquotes: bool = ...) -> Union[bytes, Text]: ... + stringnl: ArgumentDescriptor def read_stringnl_noescape(f: IO[bytes]) -> str: ... + stringnl_noescape: ArgumentDescriptor def read_stringnl_noescape_pair(f: IO[bytes]) -> Text: ... + stringnl_noescape_pair: ArgumentDescriptor def read_string1(f: IO[bytes]) -> str: ... + string1: ArgumentDescriptor def read_string4(f: IO[bytes]) -> str: ... + string4: ArgumentDescriptor if sys.version_info >= (3, 3): def read_bytes1(f: IO[bytes]) -> bytes: ... bytes1: ArgumentDescriptor - def read_bytes4(f: IO[bytes]) -> bytes: ... bytes4: ArgumentDescriptor @@ -66,6 +73,7 @@ if sys.version_info >= (3, 4): bytes8: ArgumentDescriptor def read_unicodestringnl(f: IO[bytes]) -> Text: ... + unicodestringnl: ArgumentDescriptor if sys.version_info >= (3, 4): @@ -73,6 +81,7 @@ if sys.version_info >= (3, 4): unicodestring1: ArgumentDescriptor def read_unicodestring4(f: IO[bytes]) -> Text: ... + unicodestring4: ArgumentDescriptor if sys.version_info >= (3, 4): @@ -81,19 +90,24 @@ if sys.version_info >= (3, 4): def read_decimalnl_short(f: IO[bytes]) -> int: ... def read_decimalnl_long(f: IO[bytes]) -> int: ... + decimalnl_short: ArgumentDescriptor decimalnl_long: ArgumentDescriptor def read_floatnl(f: IO[bytes]) -> float: ... + floatnl: ArgumentDescriptor def read_float8(f: IO[bytes]) -> float: ... + float8: ArgumentDescriptor def read_long1(f: IO[bytes]) -> int: ... + long1: ArgumentDescriptor def read_long4(f: IO[bytes]) -> int: ... + long4: ArgumentDescriptor class StackObject(object): @@ -132,14 +146,35 @@ class OpcodeInfo(object): stack_after: List[StackObject] proto: int doc: str - def __init__(self, name: str, code: str, arg: Optional[ArgumentDescriptor], - stack_before: List[StackObject], stack_after: List[StackObject], proto: int, doc: str) -> None: ... + def __init__( + self, + name: str, + code: str, + arg: Optional[ArgumentDescriptor], + stack_before: List[StackObject], + stack_after: List[StackObject], + proto: int, + doc: str, + ) -> None: ... opcodes: List[OpcodeInfo] def genops(pickle: Union[bytes, IO[bytes]]) -> Iterator[Tuple[OpcodeInfo, Optional[Any], Optional[int]]]: ... def optimize(p: Union[bytes, IO[bytes]]) -> bytes: ... + if sys.version_info >= (3, 2): - def dis(pickle: Union[bytes, IO[bytes]], out: Optional[IO[str]] = ..., memo: Optional[MutableMapping[int, Any]] = ..., indentlevel: int = ..., annotate: int = ...) -> None: ... + def dis( + pickle: Union[bytes, IO[bytes]], + out: Optional[IO[str]] = ..., + memo: Optional[MutableMapping[int, Any]] = ..., + indentlevel: int = ..., + annotate: int = ..., + ) -> None: ... + else: - def dis(pickle: Union[bytes, IO[bytes]], out: Optional[IO[str]] = ..., memo: Optional[MutableMapping[int, Any]] = ..., indentlevel: int = ...) -> None: ... + def dis( + pickle: Union[bytes, IO[bytes]], + out: Optional[IO[str]] = ..., + memo: Optional[MutableMapping[int, Any]] = ..., + indentlevel: int = ..., + ) -> None: ... diff --git a/stdlib/2and3/pkgutil.pyi b/stdlib/2and3/pkgutil.pyi index d582736df7e6..6d8bf6fac4cb 100644 --- a/stdlib/2and3/pkgutil.pyi +++ b/stdlib/2and3/pkgutil.pyi @@ -9,27 +9,25 @@ else: Loader = Any if sys.version_info >= (3, 6): - ModuleInfo = NamedTuple('ModuleInfo', [('module_finder', Any), ('name', str), ('ispkg', bool)]) + ModuleInfo = NamedTuple("ModuleInfo", [("module_finder", Any), ("name", str), ("ispkg", bool)]) _YMFNI = Generator[ModuleInfo, None, None] else: _YMFNI = Generator[Tuple[Any, str, bool], None, None] - def extend_path(path: Iterable[str], name: str) -> Iterable[str]: ... class ImpImporter: def __init__(self, dirname: Optional[str] = ...) -> None: ... class ImpLoader: - def __init__(self, fullname: str, file: IO[str], filename: str, - etc: Tuple[str, str, int]) -> None: ... + def __init__(self, fullname: str, file: IO[str], filename: str, etc: Tuple[str, str, int]) -> None: ... def find_loader(fullname: str) -> Loader: ... def get_importer(path_item: str) -> Any: ... # TODO precise type def get_loader(module_or_name: str) -> Loader: ... def iter_importers(fullname: str = ...) -> Generator[Any, None, None]: ... # TODO precise type -def iter_modules(path: Optional[Iterable[str]] = ..., - prefix: str = ...) -> _YMFNI: ... # TODO precise type -def walk_packages(path: Optional[Iterable[str]] = ..., prefix: str = ..., - onerror: Optional[Callable[[str], None]] = ...) -> _YMFNI: ... +def iter_modules(path: Optional[Iterable[str]] = ..., prefix: str = ...) -> _YMFNI: ... # TODO precise type +def walk_packages( + path: Optional[Iterable[str]] = ..., prefix: str = ..., onerror: Optional[Callable[[str], None]] = ... +) -> _YMFNI: ... def get_data(package: str, resource: str) -> Optional[bytes]: ... diff --git a/stdlib/2and3/plistlib.pyi b/stdlib/2and3/plistlib.pyi index f1f272dc6e88..c5ab6c951b3f 100644 --- a/stdlib/2and3/plistlib.pyi +++ b/stdlib/2and3/plistlib.pyi @@ -7,7 +7,6 @@ from typing import Mapping, MutableMapping, Optional, Type, TypeVar, Union if sys.version_info >= (3,): from enum import Enum - class PlistFormat(Enum): FMT_XML = ... FMT_BINARY = ... @@ -15,33 +14,32 @@ if sys.version_info >= (3,): FMT_BINARY = PlistFormat.FMT_BINARY mm = MutableMapping[str, Any] -_D = TypeVar('_D', bound=mm) +_D = TypeVar("_D", bound=mm) if sys.version_info >= (3,): _Path = str else: _Path = Union[str, unicode] if sys.version_info >= (3, 4): - def load(fp: IO[bytes], *, fmt: Optional[PlistFormat] = ..., - use_builtin_types: bool = ..., dict_type: Type[_D] = ...) -> _D: ... - def loads(data: bytes, *, fmt: Optional[PlistFormat] = ..., - use_builtin_types: bool = ..., dict_type: Type[_D] = ...) -> _D: ... - def dump(value: Mapping[str, Any], fp: IO[bytes], *, - fmt: PlistFormat = ..., sort_keys: bool = ..., - skipkeys: bool = ...) -> None: ... - def dumps(value: Mapping[str, Any], *, fmt: PlistFormat = ..., - skipkeys: bool = ..., sort_keys: bool = ...) -> bytes: ... + def load( + fp: IO[bytes], *, fmt: Optional[PlistFormat] = ..., use_builtin_types: bool = ..., dict_type: Type[_D] = ... + ) -> _D: ... + def loads( + data: bytes, *, fmt: Optional[PlistFormat] = ..., use_builtin_types: bool = ..., dict_type: Type[_D] = ... + ) -> _D: ... + def dump( + value: Mapping[str, Any], fp: IO[bytes], *, fmt: PlistFormat = ..., sort_keys: bool = ..., skipkeys: bool = ... + ) -> None: ... + def dumps(value: Mapping[str, Any], *, fmt: PlistFormat = ..., skipkeys: bool = ..., sort_keys: bool = ...) -> bytes: ... def readPlist(pathOrFile: Union[_Path, IO[bytes]]) -> DictT[str, Any]: ... def writePlist(value: Mapping[str, Any], pathOrFile: Union[_Path, IO[bytes]]) -> None: ... def readPlistFromBytes(data: bytes) -> DictT[str, Any]: ... def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ... + if sys.version_info < (3,): - def readPlistFromResource(path: _Path, restype: str = ..., - resid: int = ...) -> DictT[str, Any]: ... - def writePlistToResource(rootObject: Mapping[str, Any], path: _Path, - restype: str = ..., - resid: int = ...) -> None: ... + def readPlistFromResource(path: _Path, restype: str = ..., resid: int = ...) -> DictT[str, Any]: ... + def writePlistToResource(rootObject: Mapping[str, Any], path: _Path, restype: str = ..., resid: int = ...) -> None: ... def readPlistFromString(data: str) -> DictT[str, Any]: ... def writePlistToString(rootObject: Mapping[str, Any]) -> str: ... diff --git a/stdlib/2and3/poplib.pyi b/stdlib/2and3/poplib.pyi index 5a74d49f92c2..1c5a43a9519d 100644 --- a/stdlib/2and3/poplib.pyi +++ b/stdlib/2and3/poplib.pyi @@ -15,7 +15,6 @@ CR: bytes LF: bytes CRLF: bytes - class POP3: if sys.version_info >= (3, 0): encoding: Text @@ -25,7 +24,6 @@ class POP3: sock: socket.socket file: BinaryIO welcome: bytes - def __init__(self, host: Text, port: int = ..., timeout: float = ...) -> None: ... def getwelcome(self) -> bytes: ... def set_debuglevel(self, level: int) -> None: ... @@ -40,7 +38,6 @@ class POP3: def quit(self) -> bytes: ... def close(self) -> None: ... def rpop(self, user: Text) -> bytes: ... - timestamp: Pattern[Text] if sys.version_info < (3, 0): @@ -48,27 +45,31 @@ class POP3: else: def apop(self, user: Text, password: Text) -> bytes: ... def top(self, which: Any, howmuch: int) -> _LongResp: ... - @overload def uidl(self) -> _LongResp: ... @overload def uidl(self, which: Any) -> bytes: ... - if sys.version_info >= (3, 5): def utf8(self) -> bytes: ... if sys.version_info >= (3, 4): def capa(self) -> Dict[Text, List[Text]]: ... def stls(self, context: Optional[ssl.SSLContext] = ...) -> bytes: ... - class POP3_SSL(POP3): if sys.version_info >= (3, 0): - def __init__(self, host: Text, port: int = ..., keyfile: Optional[Text] = ..., certfile: Optional[Text] = ..., - timeout: float = ..., context: Optional[ssl.SSLContext] = ...) -> None: ... + def __init__( + self, + host: Text, + port: int = ..., + keyfile: Optional[Text] = ..., + certfile: Optional[Text] = ..., + timeout: float = ..., + context: Optional[ssl.SSLContext] = ..., + ) -> None: ... else: - def __init__(self, host: Text, port: int = ..., keyfile: Optional[Text] = ..., certfile: Optional[Text] = ..., - timeout: float = ...) -> None: ... - + def __init__( + self, host: Text, port: int = ..., keyfile: Optional[Text] = ..., certfile: Optional[Text] = ..., timeout: float = ... + ) -> None: ... if sys.version_info >= (3, 4): # "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored def stls(self, context: Any = ..., keyfile: Any = ..., certfile: Any = ...) -> bytes: ... diff --git a/stdlib/2and3/posixpath.pyi b/stdlib/2and3/posixpath.pyi index dfd074fe7c7c..5828ac950b48 100644 --- a/stdlib/2and3/posixpath.pyi +++ b/stdlib/2and3/posixpath.pyi @@ -6,10 +6,11 @@ import os import sys from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3, 6): from builtins import _PathLike + _PathType = Union[bytes, Text, _PathLike] _StrPath = Union[Text, _PathLike[Text]] _BytesPath = Union[bytes, _PathLike[bytes]] @@ -24,7 +25,7 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -if sys.platform == 'win32': +if sys.platform == "win32": altsep: str else: altsep: Optional[str] @@ -64,7 +65,7 @@ if sys.version_info >= (3, 6): def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": @overload def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload @@ -83,7 +84,7 @@ else: def expandvars(path: AnyStr) -> AnyStr: ... def normcase(path: AnyStr) -> AnyStr: ... def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": def realpath(path: AnyStr) -> AnyStr: ... else: def realpath(filename: AnyStr) -> AnyStr: ... @@ -92,6 +93,7 @@ if sys.version_info >= (3, 6): # In reality it returns str for sequences of _StrPath and bytes for sequences # of _BytesPath, but mypy does not accept such a signature. def commonpath(paths: Sequence[_PathType]) -> Any: ... + elif sys.version_info >= (3, 5): def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... @@ -102,8 +104,10 @@ def commonprefix(list: Sequence[_PathType]) -> Any: ... if sys.version_info >= (3, 3): def exists(path: Union[_PathType, int]) -> bool: ... + else: def exists(path: _PathType) -> bool: ... + def lexists(path: _PathType) -> bool: ... # These return float if os.stat_float_times() == True, @@ -111,7 +115,6 @@ def lexists(path: _PathType) -> bool: ... def getatime(path: _PathType) -> float: ... def getmtime(path: _PathType) -> float: ... def getctime(path: _PathType) -> float: ... - def getsize(path: _PathType) -> int: ... def isabs(path: _PathType) -> bool: ... def isfile(path: _PathType) -> bool: ... @@ -134,12 +137,14 @@ if sys.version_info < (3, 0): def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ... @overload def join(__p1: Text, *p: _PathType) -> Text: ... + elif sys.version_info >= (3, 6): # Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway. @overload def join(path: _StrPath, *paths: _StrPath) -> Text: ... @overload def join(path: _BytesPath, *paths: _BytesPath) -> bytes: ... + else: def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ... @@ -147,7 +152,6 @@ else: def relpath(path: _BytesPath, start: Optional[_BytesPath] = ...) -> bytes: ... @overload def relpath(path: _StrPath, start: Optional[_StrPath] = ...) -> Text: ... - def samefile(path1: _PathType, path2: _PathType) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(stat1: os.stat_result, stat2: os.stat_result) -> bool: ... @@ -165,12 +169,13 @@ if sys.version_info >= (3, 6): def splitext(path: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... + else: def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -if sys.platform == 'win32': +if sys.platform == "win32": def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated if sys.version_info < (3,): diff --git a/stdlib/2and3/pprint.pyi b/stdlib/2and3/pprint.pyi index 2bbd1718c374..93ca536643e0 100644 --- a/stdlib/2and3/pprint.pyi +++ b/stdlib/2and3/pprint.pyi @@ -7,18 +7,18 @@ import sys from typing import IO, Any, Dict, Tuple if sys.version_info >= (3, 4): - def pformat(o: object, indent: int = ..., width: int = ..., - depth: int = ..., compact: bool = ...) -> str: ... + def pformat(o: object, indent: int = ..., width: int = ..., depth: int = ..., compact: bool = ...) -> str: ... + else: - def pformat(o: object, indent: int = ..., width: int = ..., - depth: int = ...) -> str: ... + def pformat(o: object, indent: int = ..., width: int = ..., depth: int = ...) -> str: ... if sys.version_info >= (3, 4): - def pprint(o: object, stream: IO[str] = ..., indent: int = ..., width: int = ..., - depth: int = ..., compact: bool = ...) -> None: ... + def pprint( + o: object, stream: IO[str] = ..., indent: int = ..., width: int = ..., depth: int = ..., compact: bool = ... + ) -> None: ... + else: - def pprint(o: object, stream: IO[str] = ..., indent: int = ..., width: int = ..., - depth: int = ...) -> None: ... + def pprint(o: object, stream: IO[str] = ..., indent: int = ..., width: int = ..., depth: int = ...) -> None: ... def isreadable(o: object) -> bool: ... def isrecursive(o: object) -> bool: ... @@ -26,15 +26,13 @@ def saferepr(o: object) -> str: ... class PrettyPrinter: if sys.version_info >= (3, 4): - def __init__(self, indent: int = ..., width: int = ..., depth: int = ..., - stream: IO[str] = ..., compact: bool = ...) -> None: ... + def __init__( + self, indent: int = ..., width: int = ..., depth: int = ..., stream: IO[str] = ..., compact: bool = ... + ) -> None: ... else: - def __init__(self, indent: int = ..., width: int = ..., depth: int = ..., - stream: IO[str] = ...) -> None: ... - + def __init__(self, indent: int = ..., width: int = ..., depth: int = ..., stream: IO[str] = ...) -> None: ... def pformat(self, o: object) -> str: ... def pprint(self, o: object) -> None: ... def isreadable(self, o: object) -> bool: ... def isrecursive(self, o: object) -> bool: ... - def format(self, o: object, context: Dict[int, Any], maxlevels: int, - level: int) -> Tuple[str, bool, bool]: ... + def format(self, o: object, context: Dict[int, Any], maxlevels: int, level: int) -> Tuple[str, bool, bool]: ... diff --git a/stdlib/2and3/profile.pyi b/stdlib/2and3/profile.pyi index 31236bbfb100..efeb1aa981bf 100644 --- a/stdlib/2and3/profile.pyi +++ b/stdlib/2and3/profile.pyi @@ -3,10 +3,12 @@ import sys from typing import Any, Callable, Dict, Optional, Text, TypeVar, Union def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ... -def runctx(statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ... +def runctx( + statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ... +) -> None: ... -_SelfT = TypeVar('_SelfT', bound='Profile') -_T = TypeVar('_T') +_SelfT = TypeVar("_SelfT", bound="Profile") +_T = TypeVar("_T") if sys.version_info >= (3, 6): _Path = Union[bytes, Text, os.PathLike[Any]] else: diff --git a/stdlib/2and3/pstats.pyi b/stdlib/2and3/pstats.pyi index 104061577ac5..410741c63fc1 100644 --- a/stdlib/2and3/pstats.pyi +++ b/stdlib/2and3/pstats.pyi @@ -5,16 +5,19 @@ from profile import Profile from typing import IO, Any, Dict, Iterable, List, Text, Tuple, TypeVar, Union, overload _Selector = Union[str, float, int] -_T = TypeVar('_T', bound='Stats') +_T = TypeVar("_T", bound="Stats") if sys.version_info >= (3, 6): _Path = Union[bytes, Text, os.PathLike[Any]] else: _Path = Union[bytes, Text] class Stats: - def __init__(self: _T, __arg: Union[None, str, Text, Profile, _cProfile] = ..., - *args: Union[None, str, Text, Profile, _cProfile, _T], - stream: IO[Any] = ...) -> None: ... + def __init__( + self: _T, + __arg: Union[None, str, Text, Profile, _cProfile] = ..., + *args: Union[None, str, Text, Profile, _cProfile, _T], + stream: IO[Any] = ... + ) -> None: ... def init(self, arg: Union[None, str, Text, Profile, _cProfile]) -> None: ... def load_stats(self, arg: Union[None, str, Text, Profile, _cProfile]) -> None: ... def get_top_level_stats(self) -> None: ... diff --git a/stdlib/2and3/pty.pyi b/stdlib/2and3/pty.pyi index 3931bb0a91e2..7be053aefa81 100644 --- a/stdlib/2and3/pty.pyi +++ b/stdlib/2and3/pty.pyi @@ -14,7 +14,9 @@ def openpty() -> Tuple[int, int]: ... def master_open() -> Tuple[int, str]: ... def slave_open(tty_name: str) -> int: ... def fork() -> Tuple[int, int]: ... + if sys.version_info >= (3, 4): def spawn(argv: Union[str, Iterable[str]], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ... + else: def spawn(argv: Union[str, Iterable[str]], master_read: _Reader = ..., stdin_read: _Reader = ...) -> None: ... diff --git a/stdlib/2and3/py_compile.pyi b/stdlib/2and3/py_compile.pyi index 089712ec989b..6d1cabfa72cc 100644 --- a/stdlib/2and3/py_compile.pyi +++ b/stdlib/2and3/py_compile.pyi @@ -12,8 +12,13 @@ class PyCompileError(Exception): def __init__(self, exc_type: str, exc_value: BaseException, file: str, msg: str = ...) -> None: ... if sys.version_info >= (3, 2): - def compile(file: AnyStr, cfile: Optional[AnyStr] = ..., dfile: Optional[AnyStr] = ..., doraise: bool = ..., optimize: int = ...) -> Optional[AnyStr]: ... + def compile( + file: AnyStr, cfile: Optional[AnyStr] = ..., dfile: Optional[AnyStr] = ..., doraise: bool = ..., optimize: int = ... + ) -> Optional[AnyStr]: ... + else: - def compile(file: _EitherStr, cfile: Optional[_EitherStr] = ..., dfile: Optional[_EitherStr] = ..., doraise: bool = ...) -> None: ... + def compile( + file: _EitherStr, cfile: Optional[_EitherStr] = ..., dfile: Optional[_EitherStr] = ..., doraise: bool = ... + ) -> None: ... def main(args: Optional[List[Text]] = ...) -> int: ... diff --git a/stdlib/2and3/pyclbr.pyi b/stdlib/2and3/pyclbr.pyi index 24355f65e614..855a2963c453 100644 --- a/stdlib/2and3/pyclbr.pyi +++ b/stdlib/2and3/pyclbr.pyi @@ -7,33 +7,14 @@ class Class: methods: Dict[str, int] file: int lineno: int - - def __init__(self, - module: str, - name: str, - super: Optional[List[Union[Class, str]]], - file: str, - lineno: int) -> None: ... - + def __init__(self, module: str, name: str, super: Optional[List[Union[Class, str]]], file: str, lineno: int) -> None: ... class Function: module: str name: str file: int lineno: int + def __init__(self, module: str, name: str, file: str, lineno: int) -> None: ... - def __init__(self, - module: str, - name: str, - file: str, - lineno: int) -> None: ... - - -def readmodule(module: str, - path: Optional[Sequence[str]] = ... - ) -> Dict[str, Class]: ... - - -def readmodule_ex(module: str, - path: Optional[Sequence[str]] = ... - ) -> Dict[str, Union[Class, Function, List[str]]]: ... +def readmodule(module: str, path: Optional[Sequence[str]] = ...) -> Dict[str, Class]: ... +def readmodule_ex(module: str, path: Optional[Sequence[str]] = ...) -> Dict[str, Union[Class, Function, List[str]]]: ... diff --git a/stdlib/2and3/pydoc.pyi b/stdlib/2and3/pydoc.pyi index 69d3b32c61a2..090aeef10541 100644 --- a/stdlib/2and3/pydoc.pyi +++ b/stdlib/2and3/pydoc.pyi @@ -42,7 +42,6 @@ def stripid(text: str) -> str: ... def allmethods(cl: type) -> MutableMapping[str, MethodType]: ... def visiblename(name: str, all: Optional[Container[str]] = ..., obj: Optional[object] = ...) -> bool: ... def classify_class_attrs(object: object) -> List[Tuple[str, str, type, str]]: ... - def ispackage(path: str) -> bool: ... def source_synopsis(file: IO[AnyStr]) -> Optional[AnyStr]: ... def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> Optional[str]: ... @@ -88,7 +87,17 @@ class HTMLDoc(Doc): def escape(self, test: str) -> str: ... def page(self, title: str, contents: str) -> str: ... def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ... - def section(self, title: str, fgcol: str, bgcol: str, contents: str, width: int = ..., prelude: str = ..., marginalia: Optional[str] = ..., gap: str = ...) -> str: ... + def section( + self, + title: str, + fgcol: str, + bgcol: str, + contents: str, + width: int = ..., + prelude: str = ..., + marginalia: Optional[str] = ..., + gap: str = ..., + ) -> str: ... def bigsection(self, title: str, *args) -> str: ... def preformat(self, text: str) -> str: ... def multicolumn(self, list: List[Any], format: Callable[[Any], str], cols: int = ...) -> str: ... @@ -97,15 +106,46 @@ class HTMLDoc(Doc): def classlink(self, object: object, modname: str) -> str: ... def modulelink(self, object: object) -> str: ... def modpkglink(self, data: Tuple[str, str, bool, bool]) -> str: ... - def markup(self, text: str, escape: Optional[Callable[[str], str]] = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ...) -> str: ... - def formattree(self, tree: List[Union[Tuple[type, Tuple[type, ...]], list]], modname: str, parent: Optional[type] = ...) -> str: ... + def markup( + self, + text: str, + escape: Optional[Callable[[str], str]] = ..., + funcs: Mapping[str, str] = ..., + classes: Mapping[str, str] = ..., + methods: Mapping[str, str] = ..., + ) -> str: ... + def formattree( + self, tree: List[Union[Tuple[type, Tuple[type, ...]], list]], modname: str, parent: Optional[type] = ... + ) -> str: ... def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored) -> str: ... - def docclass(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., *ignored) -> str: ... + def docclass( + self, + object: object, + name: Optional[str] = ..., + mod: Optional[str] = ..., + funcs: Mapping[str, str] = ..., + classes: Mapping[str, str] = ..., + *ignored + ) -> str: ... def formatvalue(self, object: object) -> str: ... - def docroutine(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., cl: Optional[type] = ..., *ignored) -> str: ... - def docproperty(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored) -> str: ... + def docroutine( + self, + object: object, + name: Optional[str] = ..., + mod: Optional[str] = ..., + funcs: Mapping[str, str] = ..., + classes: Mapping[str, str] = ..., + methods: Mapping[str, str] = ..., + cl: Optional[type] = ..., + *ignored + ) -> str: ... + def docproperty( + self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored + ) -> str: ... def docother(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., *ignored) -> str: ... - def docdata(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored) -> str: ... + def docdata( + self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored + ) -> str: ... def index(self, dir: str, shadowed: Optional[MutableMapping[str, bool]] = ...) -> str: ... class TextRepr(Repr): @@ -125,14 +165,35 @@ class TextDoc(Doc): def bold(self, text: str) -> str: ... def indent(self, text: str, prefix: str = ...) -> str: ... def section(self, title: str, contents: str) -> str: ... - def formattree(self, tree: List[Union[Tuple[type, Tuple[type, ...]], list]], modname: str, parent: Optional[type] = ..., prefix: str = ...) -> str: ... + def formattree( + self, + tree: List[Union[Tuple[type, Tuple[type, ...]], list]], + modname: str, + parent: Optional[type] = ..., + prefix: str = ..., + ) -> str: ... def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., *ignored) -> str: ... def docclass(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored) -> str: ... def formatvalue(self, object: object) -> str: ... - def docroutine(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored) -> str: ... - def docproperty(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored) -> str: ... - def docdata(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored) -> str: ... - def docother(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., parent: Optional[str] = ..., maxlen: Optional[int] = ..., doc: Optional[Any] = ..., *ignored) -> str: ... + def docroutine( + self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored + ) -> str: ... + def docproperty( + self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored + ) -> str: ... + def docdata( + self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored + ) -> str: ... + def docother( + self, + object: object, + name: Optional[str] = ..., + mod: Optional[str] = ..., + parent: Optional[str] = ..., + maxlen: Optional[int] = ..., + doc: Optional[Any] = ..., + *ignored + ) -> str: ... def pager(text: str) -> None: ... def getpager() -> Callable[[str], None]: ... @@ -188,7 +249,13 @@ help: Helper class ModuleScanner: quit: bool - def run(self, callback: Callable[[Optional[str], str, str], None], key: Optional[Any] = ..., completer: Optional[Callable[[], None]] = ..., onerror: Optional[Callable] = ...) -> None: ... + def run( + self, + callback: Callable[[Optional[str], str, str], None], + key: Optional[Any] = ..., + completer: Optional[Callable[[], None]] = ..., + onerror: Optional[Callable] = ..., + ) -> None: ... def apropos(key: str) -> None: ... def serve(port: int, callback: Optional[Callable[[Any], None]] = ..., completer: Optional[Callable[[], None]] = ...) -> None: ... diff --git a/stdlib/2and3/pyexpat/__init__.pyi b/stdlib/2and3/pyexpat/__init__.pyi index 0c0f6b848138..ff424cf2bc60 100644 --- a/stdlib/2and3/pyexpat/__init__.pyi +++ b/stdlib/2and3/pyexpat/__init__.pyi @@ -50,10 +50,13 @@ class XMLParserType(object): EndDoctypeDeclHandler: Optional[Callable[[], Any]] ElementDeclHandler: Optional[Callable[[str, _Model], Any]] AttlistDeclHandler: Optional[Callable[[str, str, str, Optional[str], bool], Any]] - StartElementHandler: Optional[Union[ - Callable[[str, Dict[str, str]], Any], - Callable[[str, List[str]], Any], - Callable[[str, Union[Dict[str, str]], List[str]], Any]]] + StartElementHandler: Optional[ + Union[ + Callable[[str, Dict[str, str]], Any], + Callable[[str, List[str]], Any], + Callable[[str, Union[Dict[str, str]], List[str]], Any], + ] + ] EndElementHandler: Optional[Callable[[str], Any]] ProcessingInstructionHandler: Optional[Callable[[str, str], Any]] CharacterDataHandler: Optional[Callable[[str], Any]] diff --git a/stdlib/2and3/readline.pyi b/stdlib/2and3/readline.pyi index 1724af3e96d3..7a96c6a16c82 100644 --- a/stdlib/2and3/readline.pyi +++ b/stdlib/2and3/readline.pyi @@ -6,31 +6,27 @@ from typing import Callable, Optional, Sequence _CompleterT = Optional[Callable[[str, int], Optional[str]]] _CompDispT = Optional[Callable[[str, Sequence[str], int], None]] - def parse_and_bind(string: str) -> None: ... def read_init_file(filename: str = ...) -> None: ... - def get_line_buffer() -> str: ... def insert_text(string: str) -> None: ... def redisplay() -> None: ... - def read_history_file(filename: str = ...) -> None: ... def write_history_file(filename: str = ...) -> None: ... + if sys.version_info >= (3, 5): def append_history_file(nelements: int, filename: str = ...) -> None: ... + def get_history_length() -> int: ... def set_history_length(length: int) -> None: ... - def clear_history() -> None: ... def get_current_history_length() -> int: ... def get_history_item(index: int) -> str: ... def remove_history_item(pos: int) -> None: ... def replace_history_item(pos: int, line: str) -> None: ... def add_history(string: str) -> None: ... - def set_startup_hook(function: Optional[Callable[[], None]] = ...) -> None: ... def set_pre_input_hook(function: Optional[Callable[[], None]] = ...) -> None: ... - def set_completer(function: _CompleterT = ...) -> None: ... def get_completer() -> _CompleterT: ... def get_completion_type() -> int: ... diff --git a/stdlib/2and3/rlcompleter.pyi b/stdlib/2and3/rlcompleter.pyi index e0d6f7991a84..9d48a086ddaa 100644 --- a/stdlib/2and3/rlcompleter.pyi +++ b/stdlib/2and3/rlcompleter.pyi @@ -8,7 +8,6 @@ if sys.version_info >= (3,): else: _Text = Union[str, unicode] - class Completer: def __init__(self, namespace: Optional[Dict[str, Any]] = ...) -> None: ... def complete(self, text: _Text, state: int) -> Optional[str]: ... diff --git a/stdlib/2and3/sched.pyi b/stdlib/2and3/sched.pyi index 5d5cf33d23f3..f227aac97926 100644 --- a/stdlib/2and3/sched.pyi +++ b/stdlib/2and3/sched.pyi @@ -1,26 +1,42 @@ import sys from typing import Any, Callable, Dict, List, NamedTuple, Optional, Text, Tuple -Event = NamedTuple('Event', [ - ('time', float), - ('priority', Any), - ('action', Callable[..., Any]), - ('argument', Tuple[Any, ...]), - ('kwargs', Dict[Text, Any]), -]) +Event = NamedTuple( + "Event", + [ + ("time", float), + ("priority", Any), + ("action", Callable[..., Any]), + ("argument", Tuple[Any, ...]), + ("kwargs", Dict[Text, Any]), + ], +) class scheduler: if sys.version_info >= (3, 3): def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], None] = ...) -> None: ... - def enterabs(self, time: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...] = ..., kwargs: Dict[str, Any] = ...) -> Event: ... - def enter(self, delay: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...] = ..., kwargs: Dict[str, Any] = ...) -> Event: ... + def enterabs( + self, + time: float, + priority: Any, + action: Callable[..., Any], + argument: Tuple[Any, ...] = ..., + kwargs: Dict[str, Any] = ..., + ) -> Event: ... + def enter( + self, + delay: float, + priority: Any, + action: Callable[..., Any], + argument: Tuple[Any, ...] = ..., + kwargs: Dict[str, Any] = ..., + ) -> Event: ... def run(self, blocking: bool = ...) -> Optional[float]: ... else: def __init__(self, timefunc: Callable[[], float], delayfunc: Callable[[float], None]) -> None: ... def enterabs(self, time: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ... def enter(self, delay: float, priority: Any, action: Callable[..., Any], argument: Tuple[Any, ...]) -> Event: ... def run(self) -> None: ... - def cancel(self, event: Event) -> None: ... def empty(self) -> bool: ... @property diff --git a/stdlib/2and3/select.pyi b/stdlib/2and3/select.pyi index 3fc05450bc40..85c81d0bdcec 100644 --- a/stdlib/2and3/select.pyi +++ b/stdlib/2and3/select.pyi @@ -76,10 +76,9 @@ class poll: def unregister(self, fd: _FileDescriptor) -> None: ... def poll(self, timeout: Optional[float] = ...) -> List[Tuple[int, int]]: ... -def select(rlist: Sequence[Any], wlist: Sequence[Any], xlist: Sequence[Any], - timeout: Optional[float] = ...) -> Tuple[List[Any], - List[Any], - List[Any]]: ... +def select( + rlist: Sequence[Any], wlist: Sequence[Any], xlist: Sequence[Any], timeout: Optional[float] = ... +) -> Tuple[List[Any], List[Any], List[Any]]: ... if sys.version_info >= (3, 3): error = OSError @@ -94,7 +93,9 @@ class kevent(object): flags: int ident: int udata: Any - def __init__(self, ident: _FileDescriptor, filter: int = ..., flags: int = ..., fflags: int = ..., data: Any = ..., udata: Any = ...) -> None: ... + def __init__( + self, ident: _FileDescriptor, filter: int = ..., flags: int = ..., fflags: int = ..., data: Any = ..., udata: Any = ... + ) -> None: ... # BSD only class kqueue(object): diff --git a/stdlib/2and3/shutil.pyi b/stdlib/2and3/shutil.pyi index 8545b0d10fff..b6c54d9953ff 100644 --- a/stdlib/2and3/shutil.pyi +++ b/stdlib/2and3/shutil.pyi @@ -24,7 +24,6 @@ from typing import ( # sometimes they only work partially (broken exception messages), and the test # cases don't use them. - if sys.version_info >= (3, 6): _Path = Union[str, os.PathLike[str]] _AnyStr = str @@ -50,6 +49,7 @@ if sys.version_info >= (3,): class ExecError(OSError): ... class ReadError(OSError): ... class RegistryError(Exception): ... + else: class Error(EnvironmentError): ... class SpecialFileError(EnvironmentError): ... @@ -64,20 +64,15 @@ class _Reader(Protocol[_S_co]): class _Writer(Protocol[_S_contra]): def write(self, data: _S_contra) -> Any: ... -def copyfileobj(fsrc: _Reader[AnyStr], fdst: _Writer[AnyStr], - length: int = ...) -> None: ... +def copyfileobj(fsrc: _Reader[AnyStr], fdst: _Writer[AnyStr], length: int = ...) -> None: ... if sys.version_info >= (3,): - def copyfile(src: _Path, dst: _AnyPath, *, - follow_symlinks: bool = ...) -> _AnyPath: ... - def copymode(src: _Path, dst: _Path, *, - follow_symlinks: bool = ...) -> None: ... - def copystat(src: _Path, dst: _Path, *, - follow_symlinks: bool = ...) -> None: ... - def copy(src: _Path, dst: _Path, *, - follow_symlinks: bool = ...) -> _PathReturn: ... - def copy2(src: _Path, dst: _Path, *, - follow_symlinks: bool = ...) -> _PathReturn: ... + def copyfile(src: _Path, dst: _AnyPath, *, follow_symlinks: bool = ...) -> _AnyPath: ... + def copymode(src: _Path, dst: _Path, *, follow_symlinks: bool = ...) -> None: ... + def copystat(src: _Path, dst: _Path, *, follow_symlinks: bool = ...) -> None: ... + def copy(src: _Path, dst: _Path, *, follow_symlinks: bool = ...) -> _PathReturn: ... + def copy2(src: _Path, dst: _Path, *, follow_symlinks: bool = ...) -> _PathReturn: ... + else: def copyfile(src: _Path, dst: _Path) -> None: ... def copymode(src: _Path, dst: _Path) -> None: ... @@ -89,62 +84,71 @@ def ignore_patterns(*patterns: _Path) -> Callable[[Any, List[_AnyStr]], Set[_Any if sys.version_info >= (3,): _IgnoreFn = Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[_Path, List[str]], Iterable[str]]] - def copytree(src: _Path, dst: _Path, symlinks: bool = ..., - ignore: _IgnoreFn = ..., - copy_function: Callable[[str, str], None] = ..., - ignore_dangling_symlinks: bool = ...) -> _PathReturn: ... + def copytree( + src: _Path, + dst: _Path, + symlinks: bool = ..., + ignore: _IgnoreFn = ..., + copy_function: Callable[[str, str], None] = ..., + ignore_dangling_symlinks: bool = ..., + ) -> _PathReturn: ... + else: _IgnoreFn = Union[None, Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]] - def copytree(src: AnyStr, dst: AnyStr, symlinks: bool = ..., - ignore: _IgnoreFn = ...) -> _PathReturn: ... + def copytree(src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: _IgnoreFn = ...) -> _PathReturn: ... if sys.version_info >= (3,): @overload - def rmtree(path: bytes, ignore_errors: bool = ..., - onerror: Optional[Callable[[Any, str, Any], Any]] = ...) -> None: ... + def rmtree(path: bytes, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, str, Any], Any]] = ...) -> None: ... @overload - def rmtree(path: _AnyPath, ignore_errors: bool = ..., - onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ... + def rmtree( + path: _AnyPath, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ... + ) -> None: ... + else: - def rmtree(path: _AnyPath, ignore_errors: bool = ..., - onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ... + def rmtree( + path: _AnyPath, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ... + ) -> None: ... if sys.version_info >= (3, 5): _CopyFn = Union[Callable[[str, str], None], Callable[[_Path, _Path], None]] - def move(src: _Path, dst: _Path, - copy_function: _CopyFn = ...) -> _PathReturn: ... + def move(src: _Path, dst: _Path, copy_function: _CopyFn = ...) -> _PathReturn: ... + else: def move(src: _Path, dst: _Path) -> _PathReturn: ... if sys.version_info >= (3,): - _ntuple_diskusage = NamedTuple('usage', [('total', int), - ('used', int), - ('free', int)]) + _ntuple_diskusage = NamedTuple("usage", [("total", int), ("used", int), ("free", int)]) def disk_usage(path: _Path) -> _ntuple_diskusage: ... - def chown(path: _Path, user: Optional[str] = ..., - group: Optional[str] = ...) -> None: ... - def which(cmd: _Path, mode: int = ..., - path: Optional[_Path] = ...) -> Optional[str]: ... - -def make_archive(base_name: _AnyStr, format: str, root_dir: Optional[_Path] = ..., - base_dir: Optional[_Path] = ..., verbose: bool = ..., - dry_run: bool = ..., owner: Optional[str] = ..., group: Optional[str] = ..., - logger: Optional[Any] = ...) -> _AnyStr: ... + def chown(path: _Path, user: Optional[str] = ..., group: Optional[str] = ...) -> None: ... + def which(cmd: _Path, mode: int = ..., path: Optional[_Path] = ...) -> Optional[str]: ... + +def make_archive( + base_name: _AnyStr, + format: str, + root_dir: Optional[_Path] = ..., + base_dir: Optional[_Path] = ..., + verbose: bool = ..., + dry_run: bool = ..., + owner: Optional[str] = ..., + group: Optional[str] = ..., + logger: Optional[Any] = ..., +) -> _AnyStr: ... def get_archive_formats() -> List[Tuple[str, str]]: ... - -def register_archive_format(name: str, function: Callable[..., Any], - extra_args: Optional[Sequence[Union[Tuple[str, Any], List[Any]]]] = ..., - description: str = ...) -> None: ... +def register_archive_format( + name: str, + function: Callable[..., Any], + extra_args: Optional[Sequence[Union[Tuple[str, Any], List[Any]]]] = ..., + description: str = ..., +) -> None: ... def unregister_archive_format(name: str) -> None: ... if sys.version_info >= (3,): # Should be _Path once http://bugs.python.org/issue30218 is fixed - def unpack_archive(filename: str, extract_dir: Optional[_Path] = ..., - format: Optional[str] = ...) -> None: ... - def register_unpack_format(name: str, extensions: List[str], function: Any, - extra_args: Sequence[Tuple[str, Any]] = ..., - description: str = ...) -> None: ... + def unpack_archive(filename: str, extract_dir: Optional[_Path] = ..., format: Optional[str] = ...) -> None: ... + def register_unpack_format( + name: str, extensions: List[str], function: Any, extra_args: Sequence[Tuple[str, Any]] = ..., description: str = ... + ) -> None: ... def unregister_unpack_format(name: str) -> None: ... def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ... - def get_terminal_size(fallback: Tuple[int, int] = ...) -> os.terminal_size: ... diff --git a/stdlib/2and3/site.pyi b/stdlib/2and3/site.pyi index e3c4221a3800..65a57834dc4f 100644 --- a/stdlib/2and3/site.pyi +++ b/stdlib/2and3/site.pyi @@ -10,8 +10,8 @@ USER_BASE: Optional[str] if sys.version_info < (3,): def main() -> None: ... -def addsitedir(sitedir: str, - known_paths: Optional[Iterable[str]] = ...) -> None: ... + +def addsitedir(sitedir: str, known_paths: Optional[Iterable[str]] = ...) -> None: ... def getsitepackages(prefixes: Optional[Iterable[str]] = ...) -> List[str]: ... def getuserbase() -> str: ... def getusersitepackages() -> str: ... diff --git a/stdlib/2and3/smtpd.pyi b/stdlib/2and3/smtpd.pyi index 8f712057f412..9b85dc5627a7 100644 --- a/stdlib/2and3/smtpd.pyi +++ b/stdlib/2and3/smtpd.pyi @@ -7,7 +7,6 @@ from typing import Any, DefaultDict, List, Optional, Text, Tuple, Type _Address = Tuple[str, int] # (host, port) - class SMTPChannel(asynchat.async_chat): COMMAND: int DATA: int @@ -37,13 +36,26 @@ class SMTPChannel(asynchat.async_chat): if sys.version_info >= (3, 3): @property def max_command_size_limit(self) -> int: ... - if sys.version_info >= (3, 5): - def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ..., - map: Optional[asyncore._maptype] = ..., enable_SMTPUTF8: bool = ..., decode_data: bool = ...) -> None: ... + def __init__( + self, + server: SMTPServer, + conn: socket.socket, + addr: Any, + data_size_limit: int = ..., + map: Optional[asyncore._maptype] = ..., + enable_SMTPUTF8: bool = ..., + decode_data: bool = ..., + ) -> None: ... elif sys.version_info >= (3, 4): - def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ..., - map: Optional[asyncore._maptype] = ...) -> None: ... + def __init__( + self, + server: SMTPServer, + conn: socket.socket, + addr: Any, + data_size_limit: int = ..., + map: Optional[asyncore._maptype] = ..., + ) -> None: ... else: def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...) -> None: ... def push(self, msg: bytes) -> None: ... @@ -69,15 +81,21 @@ class SMTPServer(asyncore.dispatcher): enable_SMTPUTF8: bool if sys.version_info >= (3, 5): - def __init__(self, localaddr: _Address, remoteaddr: _Address, - data_size_limit: int = ..., map: Optional[asyncore._maptype] = ..., - enable_SMTPUTF8: bool = ..., decode_data: bool = ...) -> None: ... + def __init__( + self, + localaddr: _Address, + remoteaddr: _Address, + data_size_limit: int = ..., + map: Optional[asyncore._maptype] = ..., + enable_SMTPUTF8: bool = ..., + decode_data: bool = ..., + ) -> None: ... elif sys.version_info >= (3, 4): - def __init__(self, localaddr: _Address, remoteaddr: _Address, - data_size_limit: int = ..., map: Optional[asyncore._maptype] = ...) -> None: ... + def __init__( + self, localaddr: _Address, remoteaddr: _Address, data_size_limit: int = ..., map: Optional[asyncore._maptype] = ... + ) -> None: ... else: - def __init__(self, localaddr: _Address, remoteaddr: _Address, - data_size_limit: int = ...) -> None: ... + def __init__(self, localaddr: _Address, remoteaddr: _Address, data_size_limit: int = ...) -> None: ... def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ... def process_message(self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: str, **kwargs: Any) -> Optional[str]: ... diff --git a/stdlib/2and3/sndhdr.pyi b/stdlib/2and3/sndhdr.pyi index aecd70b46843..db5d47e2256f 100644 --- a/stdlib/2and3/sndhdr.pyi +++ b/stdlib/2and3/sndhdr.pyi @@ -5,13 +5,10 @@ import sys from typing import Any, NamedTuple, Optional, Tuple, Union if sys.version_info >= (3, 5): - SndHeaders = NamedTuple('SndHeaders', [ - ('filetype', str), - ('framerate', int), - ('nchannels', int), - ('nframes', int), - ('sampwidth', Union[int, str]), - ]) + SndHeaders = NamedTuple( + "SndHeaders", + [("filetype", str), ("framerate", int), ("nchannels", int), ("nframes", int), ("sampwidth", Union[int, str])], + ) _SndHeaders = SndHeaders else: _SndHeaders = Tuple[str, int, int, int, Union[int, str]] diff --git a/stdlib/2and3/socket.pyi b/stdlib/2and3/socket.pyi index 7cebf8a702df..236f7f7a28c5 100644 --- a/stdlib/2and3/socket.pyi +++ b/stdlib/2and3/socket.pyi @@ -394,7 +394,7 @@ if sys.version_info >= (3, 6): ALG_OP_SIGN: int ALG_OP_VERIFY: int -if sys.platform == 'win32': +if sys.platform == "win32": SIO_RCVALL: int SIO_KEEPALIVE_VALS: int RCVALL_IPLEVEL: int @@ -409,7 +409,6 @@ if sys.platform == 'win32': # enum versions of above flags py 3.4+ if sys.version_info >= (3, 4): from enum import IntEnum - class AddressFamily(IntEnum): AF_UNIX = ... AF_INET = ... @@ -441,7 +440,6 @@ if sys.version_info >= (3, 4): AF_WANPIPE = ... AF_X25 = ... AF_LINK = ... - class SocketKind(IntEnum): SOCK_STREAM = ... SOCK_DGRAM = ... @@ -450,13 +448,13 @@ if sys.version_info >= (3, 4): SOCK_SEQPACKET = ... SOCK_CLOEXEC = ... SOCK_NONBLOCK = ... + else: AddressFamily = int SocketKind = int if sys.version_info >= (3, 6): from enum import IntFlag - class AddressInfo(IntFlag): AI_ADDRCONFIG = ... AI_ALL = ... @@ -465,7 +463,6 @@ if sys.version_info >= (3, 6): AI_NUMERICSERV = ... AI_PASSIVE = ... AI_V4MAPPED = ... - class MsgFlag(IntFlag): MSG_CTRUNC = ... MSG_DONTROUTE = ... @@ -475,14 +472,13 @@ if sys.version_info >= (3, 6): MSG_PEEK = ... MSG_TRUNC = ... MSG_WAITALL = ... + else: AddressInfo = int MsgFlag = int - # ----- exceptions ----- -class error(IOError): - ... +class error(IOError): ... class herror(error): def __init__(self, herror: int, string: str) -> None: ... @@ -490,9 +486,7 @@ class herror(error): class gaierror(error): def __init__(self, error: int, string: str) -> None: ... -class timeout(error): - ... - +class timeout(error): ... # Addresses can be either tuples of varying lengths (AF_INET, AF_INET6, # AF_NETLINK, AF_TIPC) or strings (AF_UNIX). @@ -503,7 +497,7 @@ _RetAddress = Any # TODO AF_PACKET and AF_BLUETOOTH address objects _CMSG = Tuple[int, int, bytes] -_SelfT = TypeVar('_SelfT', bound=socket) +_SelfT = TypeVar("_SelfT", bound=socket) # ----- classes ----- class socket: @@ -515,11 +509,9 @@ class socket: def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ... else: def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: Optional[int] = ...) -> None: ... - if sys.version_info >= (3, 2): def __enter__(self: _SelfT) -> _SelfT: ... def __exit__(self, *args: Any) -> None: ... - # --- methods --- def accept(self) -> Tuple[socket, _RetAddress]: ... def bind(self, address: Union[_Address, bytes]) -> None: ... @@ -528,37 +520,28 @@ class socket: def connect_ex(self, address: Union[_Address, bytes]) -> int: ... def detach(self) -> int: ... def fileno(self) -> int: ... - def getpeername(self) -> _RetAddress: ... def getsockname(self) -> _RetAddress: ... - @overload def getsockopt(self, level: int, optname: int) -> int: ... @overload def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... - def gettimeout(self) -> Optional[float]: ... - def ioctl(self, control: object, - option: Tuple[int, int, int]) -> None: ... + def ioctl(self, control: object, option: Tuple[int, int, int]) -> None: ... if sys.version_info < (3, 5): def listen(self, backlog: int) -> None: ... else: def listen(self, backlog: int = ...) -> None: ... # TODO the return value may be BinaryIO or TextIO, depending on mode - def makefile(self, mode: str = ..., buffering: int = ..., - encoding: str = ..., errors: str = ..., - newline: str = ...) -> Any: - ... + def makefile( + self, mode: str = ..., buffering: int = ..., encoding: str = ..., errors: str = ..., newline: str = ... + ) -> Any: ... def recv(self, bufsize: int, flags: int = ...) -> bytes: ... - def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ... - def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int, - flags: int = ...) -> Tuple[int, _RetAddress]: ... - def recv_into(self, buffer: _WriteBuffer, nbytes: int, - flags: int = ...) -> int: ... + def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int, flags: int = ...) -> Tuple[int, _RetAddress]: ... + def recv_into(self, buffer: _WriteBuffer, nbytes: int, flags: int = ...) -> int: ... def send(self, data: bytes, flags: int = ...) -> int: ... - def sendall(self, data: bytes, flags: int = ...) -> None: - ... # return type: None on success + def sendall(self, data: bytes, flags: int = ...) -> None: ... # return type: None on success @overload def sendto(self, data: bytes, address: _Address) -> int: ... @overload @@ -567,32 +550,35 @@ class socket: def settimeout(self, value: Optional[float]) -> None: ... def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ... def shutdown(self, how: int) -> None: ... - if sys.version_info >= (3, 3): - def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., - __flags: int = ...) -> Tuple[bytes, List[_CMSG], int, Any]: ... - def recvmsg_into(self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ..., - __flags: int = ...) -> Tuple[int, List[_CMSG], int, Any]: ... - def sendmsg(self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., - __flags: int = ..., __address: _Address = ...) -> int: ... + def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, List[_CMSG], int, Any]: ... + def recvmsg_into( + self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ..., __flags: int = ... + ) -> Tuple[int, List[_CMSG], int, Any]: ... + def sendmsg( + self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __flags: int = ..., __address: _Address = ... + ) -> int: ... if sys.version_info >= (3, 4): def set_inheritable(self, inheritable: bool) -> None: ... - # ----- functions ----- -def create_connection(address: Tuple[Optional[str], int], - timeout: Optional[float] = ..., - source_address: Tuple[Union[bytearray, bytes, Text], int] = ...) -> socket: ... +def create_connection( + address: Tuple[Optional[str], int], + timeout: Optional[float] = ..., + source_address: Tuple[Union[bytearray, bytes, Text], int] = ..., +) -> socket: ... # the 5th tuple item is an address # TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers # https://github.com/python/mypy/issues/2509 def getaddrinfo( - host: Optional[Union[bytearray, bytes, Text]], port: Union[str, int, None], family: int = ..., - socktype: int = ..., proto: int = ..., - flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]: - ... - + host: Optional[Union[bytearray, bytes, Text]], + port: Union[str, int, None], + family: int = ..., + socktype: int = ..., + proto: int = ..., + flags: int = ..., +) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]: ... def getfqdn(name: str = ...) -> str: ... def gethostbyname(hostname: str) -> str: ... def gethostbyname_ex(hostname: str) -> Tuple[str, List[str], List[str]]: ... @@ -602,9 +588,7 @@ def getnameinfo(sockaddr: tuple, flags: int) -> Tuple[str, int]: ... def getprotobyname(protocolname: str) -> int: ... def getservbyname(servicename: str, protocolname: str = ...) -> int: ... def getservbyport(port: int, protocolname: str = ...) -> str: ... -def socketpair(family: int = ..., - type: int = ..., - proto: int = ...) -> Tuple[socket, socket]: ... +def socketpair(family: int = ..., type: int = ..., proto: int = ...) -> Tuple[socket, socket]: ... def fromfd(fd: int, family: int, type: int, proto: int = ...) -> socket: ... def ntohl(x: int) -> int: ... # param & ret val are 32-bit ints def ntohs(x: int) -> int: ... # param & ret val are 16-bit ints diff --git a/stdlib/2and3/sqlite3/dbapi2.pyi b/stdlib/2and3/sqlite3/dbapi2.pyi index ce61a367249e..bf3d63023cd4 100644 --- a/stdlib/2and3/sqlite3/dbapi2.pyi +++ b/stdlib/2and3/sqlite3/dbapi2.pyi @@ -6,7 +6,7 @@ import sys from datetime import date, datetime, time from typing import Any, Callable, Iterable, Iterator, List, Optional, Text, Tuple, Type, TypeVar, Union -_T = TypeVar('_T') +_T = TypeVar("_T") paramstyle: str threadsafety: int @@ -71,32 +71,42 @@ version: str # TODO: adapt needs to get probed def adapt(obj, protocol, alternate): ... def complete_statement(sql: str) -> bool: ... + if sys.version_info >= (3, 7): - def connect(database: Union[bytes, Text, os.PathLike[Text]], - timeout: float = ..., - detect_types: int = ..., - isolation_level: Optional[str] = ..., - check_same_thread: bool = ..., - factory: Optional[Type[Connection]] = ..., - cached_statements: int = ..., - uri: bool = ...) -> Connection: ... + def connect( + database: Union[bytes, Text, os.PathLike[Text]], + timeout: float = ..., + detect_types: int = ..., + isolation_level: Optional[str] = ..., + check_same_thread: bool = ..., + factory: Optional[Type[Connection]] = ..., + cached_statements: int = ..., + uri: bool = ..., + ) -> Connection: ... + elif sys.version_info >= (3, 4): - def connect(database: Union[bytes, Text], - timeout: float = ..., - detect_types: int = ..., - isolation_level: Optional[str] = ..., - check_same_thread: bool = ..., - factory: Optional[Type[Connection]] = ..., - cached_statements: int = ..., - uri: bool = ...) -> Connection: ... + def connect( + database: Union[bytes, Text], + timeout: float = ..., + detect_types: int = ..., + isolation_level: Optional[str] = ..., + check_same_thread: bool = ..., + factory: Optional[Type[Connection]] = ..., + cached_statements: int = ..., + uri: bool = ..., + ) -> Connection: ... + else: - def connect(database: Union[bytes, Text], - timeout: float = ..., - detect_types: int = ..., - isolation_level: Optional[str] = ..., - check_same_thread: bool = ..., - factory: Optional[Type[Connection]] = ..., - cached_statements: int = ...) -> Connection: ... + def connect( + database: Union[bytes, Text], + timeout: float = ..., + detect_types: int = ..., + isolation_level: Optional[str] = ..., + check_same_thread: bool = ..., + factory: Optional[Type[Connection]] = ..., + cached_statements: int = ..., + ) -> Connection: ... + def enable_callback_tracebacks(flag: bool) -> None: ... def enable_shared_cache(do_enable: int) -> None: ... def register_adapter(type: Type[_T], callable: Callable[[_T], Union[int, float, str, bytes]]) -> None: ... @@ -149,9 +159,15 @@ class Connection(object): def enable_load_extension(self, enabled: bool) -> None: ... def load_extension(self, path: str) -> None: ... if sys.version_info >= (3, 7): - def backup(self, target: Connection, *, pages: int = ..., - progress: Optional[Callable[[int, int, int], object]] = ..., name: str = ..., - sleep: float = ...) -> None: ... + def backup( + self, + target: Connection, + *, + pages: int = ..., + progress: Optional[Callable[[int, int, int], object]] = ..., + name: str = ..., + sleep: float = ... + ) -> None: ... def __call__(self, *args, **kwargs): ... def __enter__(self, *args, **kwargs): ... def __exit__(self, *args, **kwargs): ... @@ -182,21 +198,13 @@ class Cursor(Iterator[Any]): else: def next(self) -> Any: ... - class DataError(DatabaseError): ... - class DatabaseError(Error): ... - class Error(Exception): ... - class IntegrityError(DatabaseError): ... - class InterfaceError(Error): ... - class InternalError(DatabaseError): ... - class NotSupportedError(DatabaseError): ... - class OperationalError(DatabaseError): ... class OptimizedUnicode(object): diff --git a/stdlib/2and3/ssl.pyi b/stdlib/2and3/ssl.pyi index 5469f7b3978a..73f78dee421f 100644 --- a/stdlib/2and3/ssl.pyi +++ b/stdlib/2and3/ssl.pyi @@ -20,6 +20,7 @@ _SrvnmeCbType = Callable[[_SC1ArgT, Optional[str], SSLSocket], Optional[int]] class SSLError(OSError): library: str reason: str + class SSLZeroReturnError(SSLError): ... class SSLWantReadError(SSLError): ... class SSLWantWriteError(SSLError): ... @@ -30,68 +31,75 @@ if sys.version_info >= (3, 7): class SSLCertVerificationError(SSLError, ValueError): verify_code: int verify_message: str - CertificateError = SSLCertVerificationError else: class CertificateError(ValueError): ... - -def wrap_socket(sock: socket.socket, keyfile: Optional[str] = ..., - certfile: Optional[str] = ..., server_side: bool = ..., - cert_reqs: int = ..., ssl_version: int = ..., - ca_certs: Optional[str] = ..., - do_handshake_on_connect: bool = ..., - suppress_ragged_eofs: bool = ..., - ciphers: Optional[str] = ...) -> SSLSocket: ... - +def wrap_socket( + sock: socket.socket, + keyfile: Optional[str] = ..., + certfile: Optional[str] = ..., + server_side: bool = ..., + cert_reqs: int = ..., + ssl_version: int = ..., + ca_certs: Optional[str] = ..., + do_handshake_on_connect: bool = ..., + suppress_ragged_eofs: bool = ..., + ciphers: Optional[str] = ..., +) -> SSLSocket: ... if sys.version_info < (3,) or sys.version_info >= (3, 4): - def create_default_context(purpose: Any = ..., *, - cafile: Optional[str] = ..., - capath: Optional[str] = ..., - cadata: Optional[str] = ...) -> SSLContext: ... + def create_default_context( + purpose: Any = ..., *, cafile: Optional[str] = ..., capath: Optional[str] = ..., cadata: Optional[str] = ... + ) -> SSLContext: ... if sys.version_info >= (3, 4): - def _create_unverified_context(protocol: int = ..., *, - cert_reqs: int = ..., - check_hostname: bool = ..., - purpose: Any = ..., - certfile: Optional[str] = ..., - keyfile: Optional[str] = ..., - cafile: Optional[str] = ..., - capath: Optional[str] = ..., - cadata: Optional[str] = ...) -> SSLContext: ... + def _create_unverified_context( + protocol: int = ..., + *, + cert_reqs: int = ..., + check_hostname: bool = ..., + purpose: Any = ..., + certfile: Optional[str] = ..., + keyfile: Optional[str] = ..., + cafile: Optional[str] = ..., + capath: Optional[str] = ..., + cadata: Optional[str] = ... + ) -> SSLContext: ... _create_default_https_context: Callable[..., SSLContext] if sys.version_info >= (3, 3): def RAND_bytes(num: int) -> bytes: ... def RAND_pseudo_bytes(num: int) -> Tuple[bytes, bool]: ... + def RAND_status() -> bool: ... def RAND_egd(path: str) -> None: ... def RAND_add(bytes: bytes, entropy: float) -> None: ... - - def match_hostname(cert: _PeerCertRetType, hostname: str) -> None: ... def cert_time_to_seconds(cert_time: str) -> int: ... -def get_server_certificate(addr: Tuple[str, int], ssl_version: int = ..., - ca_certs: Optional[str] = ...) -> str: ... +def get_server_certificate(addr: Tuple[str, int], ssl_version: int = ..., ca_certs: Optional[str] = ...) -> str: ... def DER_cert_to_PEM_cert(der_cert_bytes: bytes) -> str: ... def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ... + if sys.version_info < (3,) or sys.version_info >= (3, 4): - DefaultVerifyPaths = NamedTuple('DefaultVerifyPaths', - [('cafile', str), ('capath', str), - ('openssl_cafile_env', str), - ('openssl_cafile', str), - ('openssl_capath_env', str), - ('openssl_capath', str)]) + DefaultVerifyPaths = NamedTuple( + "DefaultVerifyPaths", + [ + ("cafile", str), + ("capath", str), + ("openssl_cafile_env", str), + ("openssl_cafile", str), + ("openssl_capath_env", str), + ("openssl_capath", str), + ], + ) def get_default_verify_paths() -> DefaultVerifyPaths: ... -if sys.platform == 'win32': +if sys.platform == "win32": if sys.version_info < (3,) or sys.version_info >= (3, 4): def enum_certificates(store_name: str) -> _EnumRetType: ... def enum_crls(store_name: str) -> _EnumRetType: ... - CERT_NONE: int CERT_OPTIONAL: int CERT_REQUIRED: int @@ -171,12 +179,11 @@ if sys.version_info < (3,) or sys.version_info >= (3, 4): ALERT_DESCRIPTION_USER_CANCELLED: int if sys.version_info < (3,) or sys.version_info >= (3, 4): - _PurposeType = NamedTuple('_PurposeType', [('nid', int), ('shortname', str), ('longname', str), ('oid', str)]) + _PurposeType = NamedTuple("_PurposeType", [("nid", int), ("shortname", str), ("longname", str), ("oid", str)]) class Purpose: SERVER_AUTH: _PurposeType CLIENT_AUTH: _PurposeType - class SSLSocket(socket.socket): context: SSLContext server_side: bool @@ -184,9 +191,7 @@ class SSLSocket(socket.socket): if sys.version_info >= (3, 6): session: Optional[SSLSession] session_reused: Optional[bool] - - def read(self, len: int = ..., - buffer: Optional[bytearray] = ...) -> bytes: ... + def read(self, len: int = ..., buffer: Optional[bytearray] = ...) -> bytes: ... def write(self, buf: bytes) -> int: ... def do_handshake(self) -> None: ... def getpeercert(self, binary_form: bool = ...) -> _PeerCertRetType: ... @@ -203,7 +208,6 @@ class SSLSocket(socket.socket): def version(self) -> Optional[str]: ... def pending(self) -> int: ... - class SSLContext: if sys.version_info < (3,) or sys.version_info >= (3, 4): check_hostname: bool @@ -219,39 +223,37 @@ class SSLContext: def __init__(self, protocol: int) -> None: ... if sys.version_info < (3,) or sys.version_info >= (3, 4): def cert_store_stats(self) -> Dict[str, int]: ... - def load_cert_chain(self, certfile: str, keyfile: Optional[str] = ..., - password: _PasswordType = ...) -> None: ... + def load_cert_chain(self, certfile: str, keyfile: Optional[str] = ..., password: _PasswordType = ...) -> None: ... if sys.version_info < (3,) or sys.version_info >= (3, 4): def load_default_certs(self, purpose: _PurposeType = ...) -> None: ... - def load_verify_locations(self, cafile: Optional[str] = ..., - capath: Optional[str] = ..., - cadata: Union[str, bytes, None] = ...) -> None: ... - def get_ca_certs(self, - binary_form: bool = ...) -> Union[List[_PeerCertRetDictType], List[bytes]]: ... + def load_verify_locations( + self, cafile: Optional[str] = ..., capath: Optional[str] = ..., cadata: Union[str, bytes, None] = ... + ) -> None: ... + def get_ca_certs(self, binary_form: bool = ...) -> Union[List[_PeerCertRetDictType], List[bytes]]: ... else: - def load_verify_locations(self, - cafile: Optional[str] = ..., - capath: Optional[str] = ...) -> None: ... + def load_verify_locations(self, cafile: Optional[str] = ..., capath: Optional[str] = ...) -> None: ... def set_default_verify_paths(self) -> None: ... def set_ciphers(self, ciphers: str) -> None: ... if sys.version_info < (3,) or sys.version_info >= (3, 5): def set_alpn_protocols(self, protocols: List[str]) -> None: ... def set_npn_protocols(self, protocols: List[str]) -> None: ... - def set_servername_callback(self, - server_name_callback: Optional[_SrvnmeCbType]) -> None: ... + def set_servername_callback(self, server_name_callback: Optional[_SrvnmeCbType]) -> None: ... def load_dh_params(self, dhfile: str) -> None: ... def set_ecdh_curve(self, curve_name: str) -> None: ... - def wrap_socket(self, sock: socket.socket, server_side: bool = ..., - do_handshake_on_connect: bool = ..., - suppress_ragged_eofs: bool = ..., - server_hostname: Optional[str] = ...) -> SSLSocket: ... + def wrap_socket( + self, + sock: socket.socket, + server_side: bool = ..., + do_handshake_on_connect: bool = ..., + suppress_ragged_eofs: bool = ..., + server_hostname: Optional[str] = ..., + ) -> SSLSocket: ... if sys.version_info >= (3, 5): - def wrap_bio(self, incoming: MemoryBIO, outgoing: MemoryBIO, - server_side: bool = ..., - server_hostname: Optional[str] = ...) -> SSLObject: ... + def wrap_bio( + self, incoming: MemoryBIO, outgoing: MemoryBIO, server_side: bool = ..., server_hostname: Optional[str] = ... + ) -> SSLObject: ... def session_stats(self) -> Dict[str, int]: ... - if sys.version_info >= (3, 5): class SSLObject: context: SSLContext @@ -260,8 +262,7 @@ if sys.version_info >= (3, 5): if sys.version_info >= (3, 6): session: Optional[SSLSession] session_reused: bool - def read(self, len: int = ..., - buffer: Optional[bytearray] = ...) -> bytes: ... + def read(self, len: int = ..., buffer: Optional[bytearray] = ...) -> bytes: ... def write(self, buf: bytes) -> int: ... def getpeercert(self, binary_form: bool = ...) -> _PeerCertRetType: ... def selected_npn_protocol(self) -> Optional[str]: ... @@ -272,7 +273,6 @@ if sys.version_info >= (3, 5): def do_handshake(self) -> None: ... def unwrap(self) -> None: ... def get_channel_binding(self, cb_type: str = ...) -> Optional[bytes]: ... - class MemoryBIO: pending: int eof: bool @@ -288,7 +288,6 @@ if sys.version_info >= (3, 6): ticket_lifetime_hint: int has_ticket: bool - # TODO below documented in cpython but not in docs.python.org # taken from python 3.4 SSL_ERROR_EOF: int diff --git a/stdlib/2and3/struct.pyi b/stdlib/2and3/struct.pyi index 5ebc07584c72..93e0440bbd68 100644 --- a/stdlib/2and3/struct.pyi +++ b/stdlib/2and3/struct.pyi @@ -22,6 +22,7 @@ def pack(fmt: _FmtType, *v: Any) -> bytes: ... def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ... def unpack(fmt: _FmtType, buffer: _BufferType) -> Tuple[Any, ...]: ... def unpack_from(fmt: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ... + if sys.version_info >= (3, 4): def iter_unpack(fmt: _FmtType, buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ... @@ -33,9 +34,7 @@ class Struct: else: format: bytes size: int - def __init__(self, format: _FmtType) -> None: ... - def pack(self, *v: Any) -> bytes: ... def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ... def unpack(self, buffer: _BufferType) -> Tuple[Any, ...]: ... diff --git a/stdlib/2and3/sunau.pyi b/stdlib/2and3/sunau.pyi index 45ecef2f207c..1ab139cb7784 100644 --- a/stdlib/2and3/sunau.pyi +++ b/stdlib/2and3/sunau.pyi @@ -25,14 +25,10 @@ AUDIO_UNKNOWN_SIZE: int if sys.version_info < (3, 0): _sunau_params = Tuple[int, int, int, int, str, str] else: - _sunau_params = NamedTuple('_sunau_params', [ - ('nchannels', int), - ('sampwidth', int), - ('framerate', int), - ('nframes', int), - ('comptype', str), - ('compname', str), - ]) + _sunau_params = NamedTuple( + "_sunau_params", + [("nchannels", int), ("sampwidth", int), ("framerate", int), ("nframes", int), ("comptype", str), ("compname", str)], + ) class Au_read: def __init__(self, f: _File) -> None: ... @@ -84,4 +80,5 @@ class Au_write: # Returns a Au_read if mode is rb and Au_write if mode is wb def open(f: _File, mode: Optional[str] = ...) -> Any: ... + openfp = open diff --git a/stdlib/2and3/sysconfig.pyi b/stdlib/2and3/sysconfig.pyi index ae8b844fc317..8378174919f4 100644 --- a/stdlib/2and3/sysconfig.pyi +++ b/stdlib/2and3/sysconfig.pyi @@ -1,7 +1,6 @@ # Stubs for sysconfig from typing import IO, Any, Dict, List, Optional, Tuple, Union, overload - @overload def get_config_vars() -> Dict[str, Any]: ... @overload diff --git a/stdlib/2and3/syslog.pyi b/stdlib/2and3/syslog.pyi index 1237a6b0b241..49169f40db5c 100644 --- a/stdlib/2and3/syslog.pyi +++ b/stdlib/2and3/syslog.pyi @@ -37,7 +37,6 @@ def LOG_UPTO(a: int) -> int: ... def closelog() -> None: ... def openlog(ident: str = ..., logoption: int = ..., facility: int = ...) -> None: ... def setlogmask(x: int) -> int: ... - @overload def syslog(priority: int, message: str) -> None: ... @overload diff --git a/stdlib/2and3/tarfile.pyi b/stdlib/2and3/tarfile.pyi index 57121128ec03..3f7d23a9d4c6 100644 --- a/stdlib/2and3/tarfile.pyi +++ b/stdlib/2and3/tarfile.pyi @@ -34,16 +34,23 @@ if sys.version_info < (3,): TAR_PLAIN: int TAR_GZIPPED: int -def open(name: Optional[_Path] = ..., mode: str = ..., - fileobj: Optional[IO[bytes]] = ..., bufsize: int = ..., - *, format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ..., - dereference: Optional[bool] = ..., - ignore_zeros: Optional[bool] = ..., - encoding: Optional[str] = ..., errors: str = ..., - pax_headers: Optional[Mapping[str, str]] = ..., - debug: Optional[int] = ..., - errorlevel: Optional[int] = ..., - compresslevel: Optional[int] = ...) -> TarFile: ... +def open( + name: Optional[_Path] = ..., + mode: str = ..., + fileobj: Optional[IO[bytes]] = ..., + bufsize: int = ..., + *, + format: Optional[int] = ..., + tarinfo: Optional[TarInfo] = ..., + dereference: Optional[bool] = ..., + ignore_zeros: Optional[bool] = ..., + encoding: Optional[str] = ..., + errors: str = ..., + pax_headers: Optional[Mapping[str, str]] = ..., + debug: Optional[int] = ..., + errorlevel: Optional[int] = ..., + compresslevel: Optional[int] = ... +) -> TarFile: ... class TarFile(Iterable[TarInfo]): name: Optional[_Path] @@ -60,79 +67,98 @@ class TarFile(Iterable[TarInfo]): errorlevel: Optional[int] if sys.version_info < (3,): posix: bool - def __init__(self, name: Optional[_Path] = ..., mode: str = ..., - fileobj: Optional[IO[bytes]] = ..., - format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ..., - dereference: Optional[bool] = ..., - ignore_zeros: Optional[bool] = ..., - encoding: Optional[str] = ..., errors: str = ..., - pax_headers: Optional[Mapping[str, str]] = ..., - debug: Optional[int] = ..., - errorlevel: Optional[int] = ..., - compresslevel: Optional[int] = ...) -> None: ... + def __init__( + self, + name: Optional[_Path] = ..., + mode: str = ..., + fileobj: Optional[IO[bytes]] = ..., + format: Optional[int] = ..., + tarinfo: Optional[TarInfo] = ..., + dereference: Optional[bool] = ..., + ignore_zeros: Optional[bool] = ..., + encoding: Optional[str] = ..., + errors: str = ..., + pax_headers: Optional[Mapping[str, str]] = ..., + debug: Optional[int] = ..., + errorlevel: Optional[int] = ..., + compresslevel: Optional[int] = ..., + ) -> None: ... def __enter__(self) -> TarFile: ... - def __exit__(self, - exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... def __iter__(self) -> Iterator[TarInfo]: ... @classmethod - def open(cls, name: Optional[_Path] = ..., mode: str = ..., - fileobj: Optional[IO[bytes]] = ..., bufsize: int = ..., - *, format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ..., - dereference: Optional[bool] = ..., - ignore_zeros: Optional[bool] = ..., - encoding: Optional[str] = ..., errors: str = ..., - pax_headers: Optional[Mapping[str, str]] = ..., - debug: Optional[int] = ..., - errorlevel: Optional[int] = ...) -> TarFile: ... + def open( + cls, + name: Optional[_Path] = ..., + mode: str = ..., + fileobj: Optional[IO[bytes]] = ..., + bufsize: int = ..., + *, + format: Optional[int] = ..., + tarinfo: Optional[TarInfo] = ..., + dereference: Optional[bool] = ..., + ignore_zeros: Optional[bool] = ..., + encoding: Optional[str] = ..., + errors: str = ..., + pax_headers: Optional[Mapping[str, str]] = ..., + debug: Optional[int] = ..., + errorlevel: Optional[int] = ... + ) -> TarFile: ... def getmember(self, name: str) -> TarInfo: ... def getmembers(self) -> List[TarInfo]: ... def getnames(self) -> List[str]: ... if sys.version_info >= (3, 5): - def list(self, verbose: bool = ..., - *, members: Optional[List[TarInfo]] = ...) -> None: ... + def list(self, verbose: bool = ..., *, members: Optional[List[TarInfo]] = ...) -> None: ... else: def list(self, verbose: bool = ...) -> None: ... def next(self) -> Optional[TarInfo]: ... if sys.version_info >= (3, 5): - def extractall(self, path: _Path = ..., - members: Optional[List[TarInfo]] = ..., - *, numeric_owner: bool = ...) -> None: ... + def extractall(self, path: _Path = ..., members: Optional[List[TarInfo]] = ..., *, numeric_owner: bool = ...) -> None: ... else: - def extractall(self, path: _Path = ..., - members: Optional[List[TarInfo]] = ...) -> None: ... + def extractall(self, path: _Path = ..., members: Optional[List[TarInfo]] = ...) -> None: ... if sys.version_info >= (3, 5): - def extract(self, member: Union[str, TarInfo], path: _Path = ..., - set_attrs: bool = ..., - *, numeric_owner: bool = ...) -> None: ... + def extract( + self, member: Union[str, TarInfo], path: _Path = ..., set_attrs: bool = ..., *, numeric_owner: bool = ... + ) -> None: ... elif sys.version_info >= (3,): - def extract(self, member: Union[str, TarInfo], path: _Path = ..., - set_attrs: bool = ...) -> None: ... + def extract(self, member: Union[str, TarInfo], path: _Path = ..., set_attrs: bool = ...) -> None: ... else: - def extract(self, member: Union[str, TarInfo], - path: _Path = ...) -> None: ... - def extractfile(self, - member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ... + def extract(self, member: Union[str, TarInfo], path: _Path = ...) -> None: ... + def extractfile(self, member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ... if sys.version_info >= (3, 7): - def add(self, name: str, arcname: Optional[str] = ..., - recursive: bool = ..., *, - filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...) -> None: ... + def add( + self, + name: str, + arcname: Optional[str] = ..., + recursive: bool = ..., + *, + filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ... + ) -> None: ... elif sys.version_info >= (3,): - def add(self, name: str, arcname: Optional[str] = ..., - recursive: bool = ..., - exclude: Optional[Callable[[str], bool]] = ..., *, - filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...) -> None: ... + def add( + self, + name: str, + arcname: Optional[str] = ..., + recursive: bool = ..., + exclude: Optional[Callable[[str], bool]] = ..., + *, + filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ... + ) -> None: ... else: - def add(self, name: str, arcname: Optional[str] = ..., - recursive: bool = ..., - exclude: Optional[Callable[[str], bool]] = ..., - filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ...) -> None: ... - def addfile(self, tarinfo: TarInfo, - fileobj: Optional[IO[bytes]] = ...) -> None: ... - def gettarinfo(self, name: Optional[str] = ..., - arcname: Optional[str] = ..., - fileobj: Optional[IO[bytes]] = ...) -> TarInfo: ... + def add( + self, + name: str, + arcname: Optional[str] = ..., + recursive: bool = ..., + exclude: Optional[Callable[[str], bool]] = ..., + filter: Optional[Callable[[TarInfo], Optional[TarInfo]]] = ..., + ) -> None: ... + def addfile(self, tarinfo: TarInfo, fileobj: Optional[IO[bytes]] = ...) -> None: ... + def gettarinfo( + self, name: Optional[str] = ..., arcname: Optional[str] = ..., fileobj: Optional[IO[bytes]] = ... + ) -> TarInfo: ... def close(self) -> None: ... def is_tarfile(name: str) -> bool: ... @@ -142,8 +168,7 @@ if sys.version_info < (3, 8): if sys.version_info < (3,): class TarFileCompat: - def __init__(self, filename: str, mode: str = ..., - compression: int = ...) -> None: ... + def __init__(self, filename: str, mode: str = ..., compression: int = ...) -> None: ... class TarError(Exception): ... class ReadError(TarError): ... @@ -173,8 +198,7 @@ class TarInfo: def frombuf(cls, buf: bytes) -> TarInfo: ... @classmethod def fromtarfile(cls, tarfile: TarFile) -> TarInfo: ... - def tobuf(self, format: Optional[int] = ..., - encoding: Optional[str] = ..., errors: str = ...) -> bytes: ... + def tobuf(self, format: Optional[int] = ..., encoding: Optional[str] = ..., errors: str = ...) -> bytes: ... def isfile(self) -> bool: ... def isreg(self) -> bool: ... def isdir(self) -> bool: ... diff --git a/stdlib/2and3/telnetlib.pyi b/stdlib/2and3/telnetlib.pyi index 50b90b58dfe2..c6df711c3757 100644 --- a/stdlib/2and3/telnetlib.pyi +++ b/stdlib/2and3/telnetlib.pyi @@ -84,8 +84,7 @@ EXOPL: bytes NOOPT: bytes class Telnet: - def __init__(self, host: Optional[str] = ..., port: int = ..., - timeout: int = ...) -> None: ... + def __init__(self, host: Optional[str] = ..., port: int = ..., timeout: int = ...) -> None: ... def open(self, host: str, port: int = ..., timeout: int = ...) -> None: ... def msg(self, msg: str, *args: Any) -> None: ... def set_debuglevel(self, debuglevel: int) -> None: ... @@ -109,7 +108,9 @@ class Telnet: def interact(self) -> None: ... def mt_interact(self) -> None: ... def listener(self) -> None: ... - def expect(self, list: Sequence[Union[Pattern[bytes], bytes]], timeout: Optional[int] = ...) -> Tuple[int, Optional[Match[bytes]], bytes]: ... + def expect( + self, list: Sequence[Union[Pattern[bytes], bytes]], timeout: Optional[int] = ... + ) -> Tuple[int, Optional[Match[bytes]], bytes]: ... if sys.version_info >= (3, 6): def __enter__(self) -> Telnet: ... def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... diff --git a/stdlib/2and3/threading.pyi b/stdlib/2and3/threading.pyi index eab8454116df..f77e33ae6aa4 100644 --- a/stdlib/2and3/threading.pyi +++ b/stdlib/2and3/threading.pyi @@ -8,10 +8,10 @@ from typing import Any, Callable, Iterable, List, Mapping, Optional, Tuple, Type _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] -_T = TypeVar('_T') - +_T = TypeVar("_T") def active_count() -> int: ... + if sys.version_info < (3,): def activeCount() -> int: ... @@ -35,30 +35,35 @@ if sys.version_info >= (3,): class ThreadError(Exception): ... - class local(object): def __getattribute__(self, name: str) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... def __delattr__(self, name: str) -> None: ... - class Thread: name: str ident: Optional[int] daemon: bool if sys.version_info >= (3,): - def __init__(self, group: None = ..., - target: Optional[Callable[..., Any]] = ..., - name: Optional[str] = ..., - args: Iterable = ..., - kwargs: Mapping[str, Any] = ..., - *, daemon: Optional[bool] = ...) -> None: ... + def __init__( + self, + group: None = ..., + target: Optional[Callable[..., Any]] = ..., + name: Optional[str] = ..., + args: Iterable = ..., + kwargs: Mapping[str, Any] = ..., + *, + daemon: Optional[bool] = ... + ) -> None: ... else: - def __init__(self, group: None = ..., - target: Optional[Callable[..., Any]] = ..., - name: Optional[str] = ..., - args: Iterable = ..., - kwargs: Mapping[str, Any] = ...) -> None: ... + def __init__( + self, + group: None = ..., + target: Optional[Callable[..., Any]] = ..., + name: Optional[str] = ..., + args: Iterable = ..., + kwargs: Mapping[str, Any] = ..., + ) -> None: ... def start(self) -> None: ... def run(self) -> None: ... def join(self, timeout: Optional[float] = ...) -> None: ... @@ -69,16 +74,14 @@ class Thread: def isDaemon(self) -> bool: ... def setDaemon(self, daemonic: bool) -> None: ... - class _DummyThread(Thread): ... - class Lock: def __init__(self) -> None: ... def __enter__(self) -> bool: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... if sys.version_info >= (3,): def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... else: @@ -86,29 +89,26 @@ class Lock: def release(self) -> None: ... def locked(self) -> bool: ... - class _RLock: def __init__(self) -> None: ... def __enter__(self) -> bool: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... if sys.version_info >= (3,): def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... else: def acquire(self, blocking: bool = ...) -> bool: ... def release(self) -> None: ... - RLock = _RLock - class Condition: def __init__(self, lock: Union[Lock, _RLock, None] = ...) -> None: ... def __enter__(self) -> bool: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... if sys.version_info >= (3,): def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... else: @@ -116,19 +116,17 @@ class Condition: def release(self) -> None: ... def wait(self, timeout: Optional[float] = ...) -> bool: ... if sys.version_info >= (3,): - def wait_for(self, predicate: Callable[[], _T], - timeout: Optional[float] = ...) -> _T: ... + def wait_for(self, predicate: Callable[[], _T], timeout: Optional[float] = ...) -> _T: ... def notify(self, n: int = ...) -> None: ... def notify_all(self) -> None: ... def notifyAll(self) -> None: ... - class Semaphore: def __init__(self, value: int = ...) -> None: ... def __enter__(self) -> bool: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... if sys.version_info >= (3,): def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... else: @@ -138,16 +136,15 @@ class Semaphore: class BoundedSemaphore: def __init__(self, value: int = ...) -> None: ... def __enter__(self) -> bool: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... if sys.version_info >= (3,): def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... else: def acquire(self, blocking: bool = ...) -> bool: ... def release(self) -> None: ... - class Event: def __init__(self) -> None: ... def is_set(self) -> bool: ... @@ -157,28 +154,28 @@ class Event: def clear(self) -> None: ... def wait(self, timeout: Optional[float] = ...) -> bool: ... - class Timer(Thread): if sys.version_info >= (3,): - def __init__(self, interval: float, function: Callable[..., None], - args: Optional[Iterable[Any]] = ..., - kwargs: Optional[Mapping[str, Any]] = ...) -> None: ... + def __init__( + self, + interval: float, + function: Callable[..., None], + args: Optional[Iterable[Any]] = ..., + kwargs: Optional[Mapping[str, Any]] = ..., + ) -> None: ... else: - def __init__(self, interval: float, function: Callable[..., None], - args: Iterable[Any] = ..., - kwargs: Mapping[str, Any] = ...) -> None: ... + def __init__( + self, interval: float, function: Callable[..., None], args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ... + ) -> None: ... def cancel(self) -> None: ... - if sys.version_info >= (3,): class Barrier: parties: int n_waiting: int broken: bool - def __init__(self, parties: int, action: Optional[Callable[[], None]] = ..., - timeout: Optional[float] = ...) -> None: ... + def __init__(self, parties: int, action: Optional[Callable[[], None]] = ..., timeout: Optional[float] = ...) -> None: ... def wait(self, timeout: Optional[float] = ...) -> int: ... def reset(self) -> None: ... def abort(self) -> None: ... - class BrokenBarrierError(RuntimeError): ... diff --git a/stdlib/2and3/time.pyi b/stdlib/2and3/time.pyi index 1f97703df1ce..231cfaa8f30c 100644 --- a/stdlib/2and3/time.pyi +++ b/stdlib/2and3/time.pyi @@ -16,12 +16,12 @@ daylight: int timezone: int tzname: Tuple[str, str] -if sys.version_info >= (3, 7) and sys.platform != 'win32': +if sys.version_info >= (3, 7) and sys.platform != "win32": CLOCK_BOOTTIME: int # Linux CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD CLOCK_UPTIME: int # FreeBSD, OpenBSD -if sys.version_info >= (3, 3) and sys.platform != 'win32': +if sys.version_info >= (3, 3) and sys.platform != "win32": CLOCK_HIGHRES: int = ... # Solaris only CLOCK_MONOTONIC: int = ... # Unix only CLOCK_MONOTONIC_RAW: int = ... # Linux 2.6.28 or later @@ -29,15 +29,23 @@ if sys.version_info >= (3, 3) and sys.platform != 'win32': CLOCK_REALTIME: int = ... # Unix only CLOCK_THREAD_CPUTIME_ID: int = ... # Unix only - if sys.version_info >= (3, 3): class struct_time( NamedTuple( - '_struct_time', - [('tm_year', int), ('tm_mon', int), ('tm_mday', int), - ('tm_hour', int), ('tm_min', int), ('tm_sec', int), - ('tm_wday', int), ('tm_yday', int), ('tm_isdst', int), - ('tm_zone', str), ('tm_gmtoff', int)] + "_struct_time", + [ + ("tm_year", int), + ("tm_mon", int), + ("tm_mday", int), + ("tm_hour", int), + ("tm_min", int), + ("tm_sec", int), + ("tm_wday", int), + ("tm_yday", int), + ("tm_isdst", int), + ("tm_zone", str), + ("tm_gmtoff", int), + ], ) ): def __init__( @@ -45,7 +53,7 @@ if sys.version_info >= (3, 3): o: Union[ Tuple[int, int, int, int, int, int, int, int, int], Tuple[int, int, int, int, int, int, int, int, int, str], - Tuple[int, int, int, int, int, int, int, int, int, str, int] + Tuple[int, int, int, int, int, int, int, int, int, str, int], ], _arg: Any = ..., ) -> None: ... @@ -54,17 +62,26 @@ if sys.version_info >= (3, 3): o: Union[ Tuple[int, int, int, int, int, int, int, int, int], Tuple[int, int, int, int, int, int, int, int, int, str], - Tuple[int, int, int, int, int, int, int, int, int, str, int] + Tuple[int, int, int, int, int, int, int, int, int, str, int], ], _arg: Any = ..., ) -> struct_time: ... + else: class struct_time( NamedTuple( - '_struct_time', - [('tm_year', int), ('tm_mon', int), ('tm_mday', int), - ('tm_hour', int), ('tm_min', int), ('tm_sec', int), - ('tm_wday', int), ('tm_yday', int), ('tm_isdst', int)] + "_struct_time", + [ + ("tm_year", int), + ("tm_mon", int), + ("tm_mday", int), + ("tm_hour", int), + ("tm_min", int), + ("tm_sec", int), + ("tm_wday", int), + ("tm_yday", int), + ("tm_isdst", int), + ], ) ): def __init__(self, o: _TimeTuple, _arg: Any = ...) -> None: ... @@ -80,7 +97,8 @@ def sleep(secs: float) -> None: ... def strftime(format: str, t: Union[_TimeTuple, struct_time] = ...) -> str: ... def strptime(string: str, format: str = ...) -> struct_time: ... def time() -> float: ... -if sys.platform != 'win32': + +if sys.platform != "win32": def tzset() -> None: ... # Unix only if sys.version_info >= (3, 3): @@ -88,7 +106,7 @@ if sys.version_info >= (3, 3): def monotonic() -> float: ... def perf_counter() -> float: ... def process_time() -> float: ... - if sys.platform != 'win32': + if sys.platform != "win32": def clock_getres(clk_id: int) -> float: ... # Unix only def clock_gettime(clk_id: int) -> float: ... # Unix only def clock_settime(clk_id: int, time: float) -> None: ... # Unix only diff --git a/stdlib/2and3/timeit.pyi b/stdlib/2and3/timeit.pyi index 1079ef88f115..941a97a3750f 100644 --- a/stdlib/2and3/timeit.pyi +++ b/stdlib/2and3/timeit.pyi @@ -11,8 +11,9 @@ default_timer: _Timer class Timer: if sys.version_info >= (3, 5): - def __init__(self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., - globals: Optional[Dict[str, Any]] = ...) -> None: ... + def __init__( + self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., globals: Optional[Dict[str, Any]] = ... + ) -> None: ... else: def __init__(self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...) -> None: ... def print_exc(self, file: Optional[IO[str]] = ...) -> None: ... @@ -22,13 +23,22 @@ class Timer: def autorange(self, callback: Optional[Callable[[int, float], Any]] = ...) -> Tuple[int, float]: ... if sys.version_info >= (3, 5): - def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., - number: int = ..., globals: Optional[Dict[str, Any]] = ...) -> float: ... - def repeat(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., - repeat: int = ..., number: int = ..., globals: Optional[Dict[str, Any]] = ...) -> List[float]: ... + def timeit( + stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ..., globals: Optional[Dict[str, Any]] = ... + ) -> float: ... + def repeat( + stmt: _stmt = ..., + setup: _stmt = ..., + timer: _Timer = ..., + repeat: int = ..., + number: int = ..., + globals: Optional[Dict[str, Any]] = ..., + ) -> List[float]: ... + else: - def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., - number: int = ...) -> float: ... - def repeat(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., - repeat: int = ..., number: int = ...) -> List[float]: ... + def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., number: int = ...) -> float: ... + def repeat( + stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ..., repeat: int = ..., number: int = ... + ) -> List[float]: ... + def main(args: Optional[Sequence[str]]) -> None: ... diff --git a/stdlib/2and3/trace.pyi b/stdlib/2and3/trace.pyi index af06d39c0232..4ffea36fe0fd 100644 --- a/stdlib/2and3/trace.pyi +++ b/stdlib/2and3/trace.pyi @@ -5,7 +5,7 @@ import sys import types from typing import Any, Callable, Mapping, Optional, Sequence, Text, Tuple, TypeVar, Union -_T = TypeVar('_T') +_T = TypeVar("_T") _localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]] if sys.version_info >= (3, 6): @@ -16,14 +16,30 @@ else: class CoverageResults: def update(self, other: CoverageResults) -> None: ... def write_results(self, show_missing: bool = ..., summary: bool = ..., coverdir: Optional[_Path] = ...) -> None: ... - def write_results_file(self, path: _Path, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: Optional[str] = ...) -> Tuple[int, int]: ... + def write_results_file( + self, path: _Path, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: Optional[str] = ... + ) -> Tuple[int, int]: ... class Trace: - def __init__(self, count: int = ..., trace: int = ..., countfuncs: int = ..., countcallers: int = ..., - ignoremods: Sequence[str] = ..., ignoredirs: Sequence[str] = ..., infile: Optional[_Path] = ..., - outfile: Optional[_Path] = ..., timing: bool = ...) -> None: ... + def __init__( + self, + count: int = ..., + trace: int = ..., + countfuncs: int = ..., + countcallers: int = ..., + ignoremods: Sequence[str] = ..., + ignoredirs: Sequence[str] = ..., + infile: Optional[_Path] = ..., + outfile: Optional[_Path] = ..., + timing: bool = ..., + ) -> None: ... def run(self, cmd: Union[str, types.CodeType]) -> None: ... - def runctx(self, cmd: Union[str, types.CodeType], globals: Optional[Mapping[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> None: ... + def runctx( + self, + cmd: Union[str, types.CodeType], + globals: Optional[Mapping[str, Any]] = ..., + locals: Optional[Mapping[str, Any]] = ..., + ) -> None: ... def runfunc(self, func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... def file_module_function_of(self, frame: types.FrameType) -> Tuple[str, Optional[str], str]: ... def globaltrace_trackcallers(self, frame: types.FrameType, why: str, arg: Any) -> None: ... diff --git a/stdlib/2and3/traceback.pyi b/stdlib/2and3/traceback.pyi index 4c81e5c8fa76..24fad3fb4bb1 100644 --- a/stdlib/2and3/traceback.pyi +++ b/stdlib/2and3/traceback.pyi @@ -6,70 +6,81 @@ from typing import IO, Any, Dict, Generator, Iterable, Iterator, List, Mapping, _PT = Tuple[str, int, str, Optional[str]] +def print_tb(tb: Optional[TracebackType], limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ... -def print_tb(tb: Optional[TracebackType], limit: Optional[int] = ..., - file: Optional[IO[str]] = ...) -> None: ... if sys.version_info >= (3,): - def print_exception(etype: Optional[Type[BaseException]], - value: Optional[BaseException], - tb: Optional[TracebackType], limit: Optional[int] = ..., - file: Optional[IO[str]] = ..., - chain: bool = ...) -> None: ... - def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., - chain: bool = ...) -> None: ... - def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., - chain: bool = ...) -> None: ... + def print_exception( + etype: Optional[Type[BaseException]], + value: Optional[BaseException], + tb: Optional[TracebackType], + limit: Optional[int] = ..., + file: Optional[IO[str]] = ..., + chain: bool = ..., + ) -> None: ... + def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., chain: bool = ...) -> None: ... + def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., chain: bool = ...) -> None: ... + else: - def print_exception(etype: Optional[Type[BaseException]], - value: Optional[BaseException], - tb: Optional[TracebackType], limit: Optional[int] = ..., - file: Optional[IO[str]] = ...) -> None: ... - def print_exc(limit: Optional[int] = ..., - file: Optional[IO[str]] = ...) -> None: ... - def print_last(limit: Optional[int] = ..., - file: Optional[IO[str]] = ...) -> None: ... -def print_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ..., - file: Optional[IO[str]] = ...) -> None: ... + def print_exception( + etype: Optional[Type[BaseException]], + value: Optional[BaseException], + tb: Optional[TracebackType], + limit: Optional[int] = ..., + file: Optional[IO[str]] = ..., + ) -> None: ... + def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ... + def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ... + +def print_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ... if sys.version_info >= (3, 5): def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> StackSummary: ... - def extract_stack(f: Optional[FrameType] = ..., - limit: Optional[int] = ...) -> StackSummary: ... + def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> StackSummary: ... def format_list(extracted_list: List[FrameSummary]) -> List[str]: ... class _Writer(Protocol): def write(self, s: str) -> Any: ... # undocumented def print_list(extracted_list: List[FrameSummary], file: Optional[_Writer] = ...) -> None: ... + else: def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[_PT]: ... - def extract_stack(f: Optional[FrameType] = ..., - limit: Optional[int] = ...) -> List[_PT]: ... + def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> List[_PT]: ... def format_list(extracted_list: List[_PT]) -> List[str]: ... -def format_exception_only(etype: Optional[Type[BaseException]], - value: Optional[BaseException]) -> List[str]: ... + +def format_exception_only(etype: Optional[Type[BaseException]], value: Optional[BaseException]) -> List[str]: ... + if sys.version_info >= (3,): - def format_exception(etype: Optional[Type[BaseException]], value: Optional[BaseException], - tb: Optional[TracebackType], limit: Optional[int] = ..., - chain: bool = ...) -> List[str]: ... + def format_exception( + etype: Optional[Type[BaseException]], + value: Optional[BaseException], + tb: Optional[TracebackType], + limit: Optional[int] = ..., + chain: bool = ..., + ) -> List[str]: ... def format_exc(limit: Optional[int] = ..., chain: bool = ...) -> str: ... + else: - def format_exception(etype: Optional[Type[BaseException]], - value: Optional[BaseException], - tb: Optional[TracebackType], - limit: Optional[int] = ...) -> List[str]: ... + def format_exception( + etype: Optional[Type[BaseException]], + value: Optional[BaseException], + tb: Optional[TracebackType], + limit: Optional[int] = ..., + ) -> List[str]: ... def format_exc(limit: Optional[int] = ...) -> str: ... + def format_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[str]: ... -def format_stack(f: Optional[FrameType] = ..., - limit: Optional[int] = ...) -> List[str]: ... +def format_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> List[str]: ... + if sys.version_info >= (3, 4): def clear_frames(tb: TracebackType) -> None: ... + if sys.version_info >= (3, 5): def walk_stack(f: Optional[FrameType]) -> Iterator[Tuple[FrameType, int]]: ... def walk_tb(tb: Optional[TracebackType]) -> Iterator[Tuple[FrameType, int]]: ... + if sys.version_info < (3,): def tb_lineno(tb: TracebackType) -> int: ... - if sys.version_info >= (3, 5): class TracebackException: __cause__: TracebackException @@ -82,39 +93,51 @@ if sys.version_info >= (3, 5): text: str offset: int msg: str - def __init__(self, exc_type: Type[BaseException], - exc_value: BaseException, exc_traceback: TracebackType, - *, limit: Optional[int] = ..., lookup_lines: bool = ..., - capture_locals: bool = ...) -> None: ... + def __init__( + self, + exc_type: Type[BaseException], + exc_value: BaseException, + exc_traceback: TracebackType, + *, + limit: Optional[int] = ..., + lookup_lines: bool = ..., + capture_locals: bool = ... + ) -> None: ... @classmethod - def from_exception(cls, exc: BaseException, - *, limit: Optional[int] = ..., - lookup_lines: bool = ..., - capture_locals: bool = ...) -> TracebackException: ... + def from_exception( + cls, exc: BaseException, *, limit: Optional[int] = ..., lookup_lines: bool = ..., capture_locals: bool = ... + ) -> TracebackException: ... def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ... def format_exception_only(self) -> Generator[str, None, None]: ... - class FrameSummary(Iterable): filename: str lineno: int name: str line: str locals: Optional[Dict[str, str]] - def __init__(self, filename: str, lineno: int, name: str, - lookup_line: bool = ..., - locals: Optional[Mapping[str, str]] = ..., - line: Optional[str] = ...) -> None: ... + def __init__( + self, + filename: str, + lineno: int, + name: str, + lookup_line: bool = ..., + locals: Optional[Mapping[str, str]] = ..., + line: Optional[str] = ..., + ) -> None: ... # TODO: more precise typing for __getitem__ and __iter__, # for a namedtuple-like view on (filename, lineno, name, str). def __getitem__(self, i: int) -> Any: ... def __iter__(self) -> Iterator[Any]: ... - class StackSummary(List[FrameSummary]): @classmethod - def extract(cls, - frame_gen: Generator[Tuple[FrameType, int], None, None], - *, limit: Optional[int] = ..., lookup_lines: bool = ..., - capture_locals: bool = ...) -> StackSummary: ... + def extract( + cls, + frame_gen: Generator[Tuple[FrameType, int], None, None], + *, + limit: Optional[int] = ..., + lookup_lines: bool = ..., + capture_locals: bool = ... + ) -> StackSummary: ... @classmethod def from_list(cls, a_list: List[_PT]) -> StackSummary: ... def format(self) -> List[str]: ... diff --git a/stdlib/2and3/turtle.pyi b/stdlib/2and3/turtle.pyi index 8a317ee8eca7..41985dc55f35 100644 --- a/stdlib/2and3/turtle.pyi +++ b/stdlib/2and3/turtle.pyi @@ -35,7 +35,14 @@ class TurtleScreenBase(object): if sys.version_info >= (3,): def mainloop(self) -> None: ... def textinput(self, title: str, prompt: str) -> Optional[str]: ... - def numinput(self, title: str, prompt: str, default: Optional[float] = ..., minval: Optional[float] = ..., maxval: Optional[float] = ...) -> Optional[float]: ... + def numinput( + self, + title: str, + prompt: str, + default: Optional[float] = ..., + minval: Optional[float] = ..., + maxval: Optional[float] = ..., + ) -> Optional[float]: ... class Terminator(Exception): ... class TurtleGraphicsError(Exception): ... @@ -142,7 +149,6 @@ class TNavigator(object): setposition = goto seth = setheading - class TPen(object): def __init__(self, resizemode: str = ...) -> None: ... @overload @@ -187,10 +193,21 @@ class TPen(object): @overload def pen(self) -> _PenState: ... # type: ignore @overload - def pen(self, pen: Optional[_PenState] = ..., *, - shown: bool = ..., pendown: bool = ..., pencolor: _Color = ..., fillcolor: _Color = ..., - pensize: int = ..., speed: int = ..., resizemode: str = ..., stretchfactor: Tuple[float, float] = ..., - outline: int = ..., tilt: float = ...) -> None: ... + def pen( + self, + pen: Optional[_PenState] = ..., + *, + shown: bool = ..., + pendown: bool = ..., + pencolor: _Color = ..., + fillcolor: _Color = ..., + pensize: int = ..., + speed: int = ..., + resizemode: str = ..., + stretchfactor: Tuple[float, float] = ..., + outline: int = ..., + tilt: float = ... + ) -> None: ... width = pensize up = penup pu = penup @@ -199,10 +216,12 @@ class TPen(object): st = showturtle ht = hideturtle -_T = TypeVar('_T') +_T = TypeVar("_T") class RawTurtle(TPen, TNavigator): - def __init__(self, canvas: Union[Canvas, TurtleScreen, None] = ..., shape: str = ..., undobuffersize: int = ..., visible: bool = ...) -> None: ... + def __init__( + self, canvas: Union[Canvas, TurtleScreen, None] = ..., shape: str = ..., undobuffersize: int = ..., visible: bool = ... + ) -> None: ... def reset(self) -> None: ... def setundobuffer(self, size: Optional[int]) -> None: ... def undobufferentries(self) -> int: ... @@ -216,7 +235,9 @@ class RawTurtle(TPen, TNavigator): @overload def shapesize(self) -> Tuple[float, float, float]: ... # type: ignore @overload - def shapesize(self, stretch_wid: Optional[float] = ..., stretch_len: Optional[float] = ..., outline: Optional[float] = ...) -> None: ... + def shapesize( + self, stretch_wid: Optional[float] = ..., stretch_len: Optional[float] = ..., outline: Optional[float] = ... + ) -> None: ... if sys.version_info >= (3,): @overload def shearfactor(self) -> float: ... @@ -226,7 +247,9 @@ class RawTurtle(TPen, TNavigator): @overload def shapetransform(self) -> Tuple[float, float, float, float]: ... # type: ignore @overload - def shapetransform(self, t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ...) -> None: ... + def shapetransform( + self, t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ... + ) -> None: ... def get_shapepoly(self) -> Optional[_PolygonCoords]: ... def settiltangle(self, angle: float) -> None: ... @overload @@ -288,9 +311,12 @@ def write_docstringdict(filename: str) -> None: ... # Note: mainloop() was always present in the global scope, but was added to # TurtleScreenBase in Python 3.0 def mainloop() -> None: ... + if sys.version_info >= (3,): def textinput(title: str, prompt: str) -> Optional[str]: ... - def numinput(title: str, prompt: str, default: Optional[float] = ..., minval: Optional[float] = ..., maxval: Optional[float] = ...) -> Optional[float]: ... + def numinput( + title: str, prompt: str, default: Optional[float] = ..., minval: Optional[float] = ..., maxval: Optional[float] = ... + ) -> Optional[float]: ... # Functions copied from TurtleScreen: @@ -338,6 +364,7 @@ def bgpic(picname: str) -> None: ... def screensize() -> Tuple[int, int]: ... @overload def screensize(canvwidth: int, canvheight: int, bg: Optional[_Color] = ...) -> None: ... + onscreenclick = onclick resetscreen = reset clearscreen = clear @@ -375,6 +402,7 @@ def towards(x: float, y: float) -> float: ... def heading() -> float: ... def setheading(to_angle: float) -> None: ... def circle(radius: float, extent: Optional[float] = ..., steps: Optional[int] = ...) -> None: ... + fd = forward bk = back backward = back @@ -386,7 +414,6 @@ setposition = goto seth = setheading # Functions copied from TPen: - @overload def resizemode() -> str: ... @overload @@ -425,14 +452,26 @@ def color(color1: _Color, color2: _Color) -> None: ... def showturtle() -> None: ... def hideturtle() -> None: ... def isvisible() -> bool: ... + # Note: signatures 1 and 2 overlap unsafely when no arguments are provided @overload def pen() -> _PenState: ... # type: ignore @overload -def pen(pen: Optional[_PenState] = ..., *, - shown: bool = ..., pendown: bool = ..., pencolor: _Color = ..., fillcolor: _Color = ..., - pensize: int = ..., speed: int = ..., resizemode: str = ..., stretchfactor: Tuple[float, float] = ..., - outline: int = ..., tilt: float = ...) -> None: ... +def pen( + pen: Optional[_PenState] = ..., + *, + shown: bool = ..., + pendown: bool = ..., + pencolor: _Color = ..., + fillcolor: _Color = ..., + pensize: int = ..., + speed: int = ..., + resizemode: str = ..., + stretchfactor: Tuple[float, float] = ..., + outline: int = ..., + tilt: float = ... +) -> None: ... + width = pensize up = penup pu = penup @@ -449,11 +488,13 @@ def undobufferentries() -> int: ... def shape() -> str: ... @overload def shape(name: str) -> None: ... + # Unsafely overlaps when no arguments are provided @overload def shapesize() -> Tuple[float, float, float]: ... # type: ignore @overload def shapesize(stretch_wid: Optional[float] = ..., stretch_len: Optional[float] = ..., outline: Optional[float] = ...) -> None: ... + if sys.version_info >= (3,): @overload def shearfactor() -> float: ... @@ -463,14 +504,18 @@ if sys.version_info >= (3,): @overload def shapetransform() -> Tuple[float, float, float, float]: ... # type: ignore @overload - def shapetransform(t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ...) -> None: ... + def shapetransform( + t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ... + ) -> None: ... def get_shapepoly() -> Optional[_PolygonCoords]: ... + def settiltangle(angle: float) -> None: ... @overload def tiltangle() -> float: ... @overload def tiltangle(angle: float) -> None: ... def tilt(angle: float) -> None: ... + # Can return either 'int' or Tuple[int, ...] based on if the stamp is # a compound stamp or not. So, as per the "no Union return" policy, # we return Any. @@ -487,10 +532,13 @@ def end_poly() -> None: ... def get_poly() -> Optional[_PolygonCoords]: ... def getscreen() -> TurtleScreen: ... def getturtle() -> Turtle: ... + getpen = getturtle + def onrelease(fun: Callable[[float, float], Any], btn: int = ..., add: Optional[Any] = ...) -> None: ... def ondrag(fun: Callable[[float, float], Any], btn: int = ..., add: Optional[Any] = ...) -> None: ... def undo() -> None: ... + turtlesize = shapesize # Functions copied from RawTurtle with a few tweaks: diff --git a/stdlib/2and3/unicodedata.pyi b/stdlib/2and3/unicodedata.pyi index bf4f30b1ddf9..3d61aac0d98d 100644 --- a/stdlib/2and3/unicodedata.pyi +++ b/stdlib/2and3/unicodedata.pyi @@ -5,7 +5,7 @@ ucd_3_2_0: UCD ucnhash_CAPI: Any unidata_version: str -_default = TypeVar('_default') +_default = TypeVar("_default") def bidirectional(__chr: Text) -> Text: ... def category(__chr: Text) -> Text: ... diff --git a/stdlib/2and3/uu.pyi b/stdlib/2and3/uu.pyi index 238fcf3bbdec..7cee78671ef1 100644 --- a/stdlib/2and3/uu.pyi +++ b/stdlib/2and3/uu.pyi @@ -7,7 +7,11 @@ _File = Union[Text, BinaryIO] class Error(Exception): ... if sys.version_info >= (3, 7): - def encode(in_file: _File, out_file: _File, name: Optional[str] = ..., mode: Optional[int] = ..., backtick: bool = ...) -> None: ... + def encode( + in_file: _File, out_file: _File, name: Optional[str] = ..., mode: Optional[int] = ..., backtick: bool = ... + ) -> None: ... + else: def encode(in_file: _File, out_file: _File, name: Optional[str] = ..., mode: Optional[int] = ...) -> None: ... + def decode(in_file: _File, out_file: Optional[_File] = ..., mode: Optional[int] = ..., quiet: int = ...) -> None: ... diff --git a/stdlib/2and3/uuid.pyi b/stdlib/2and3/uuid.pyi index 6a290780370a..12a626338ef6 100644 --- a/stdlib/2and3/uuid.pyi +++ b/stdlib/2and3/uuid.pyi @@ -9,12 +9,15 @@ _Bytes = bytes _FieldsType = Tuple[int, int, int, int, int, int] class UUID: - def __init__(self, hex: Optional[Text] = ..., - bytes: Optional[_Bytes] = ..., - bytes_le: Optional[_Bytes] = ..., - fields: Optional[_FieldsType] = ..., - int: Optional[_Int] = ..., - version: Optional[_Int] = ...) -> None: ... + def __init__( + self, + hex: Optional[Text] = ..., + bytes: Optional[_Bytes] = ..., + bytes_le: Optional[_Bytes] = ..., + fields: Optional[_FieldsType] = ..., + int: Optional[_Int] = ..., + version: Optional[_Int] = ..., + ) -> None: ... @property def bytes(self) -> _Bytes: ... @property @@ -47,9 +50,7 @@ class UUID: def variant(self) -> str: ... @property def version(self) -> Optional[_Int]: ... - def __int__(self) -> _Int: ... - if sys.version_info >= (3,): def __eq__(self, other: Any) -> bool: ... def __lt__(self, other: Any) -> bool: ... diff --git a/stdlib/2and3/warnings.pyi b/stdlib/2and3/warnings.pyi index f2b84e2c5fb9..fb8c6b51fdc2 100644 --- a/stdlib/2and3/warnings.pyi +++ b/stdlib/2and3/warnings.pyi @@ -3,36 +3,41 @@ from types import ModuleType, TracebackType from typing import Any, Dict, List, NamedTuple, Optional, TextIO, Tuple, Type, Union -def warn(message: Union[str, Warning], category: Optional[Type[Warning]] = ..., - stacklevel: int = ...) -> None: ... -def warn_explicit(message: Union[str, Warning], category: Type[Warning], - filename: str, lineno: int, module: Optional[str] = ..., - registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ..., - module_globals: Optional[Dict[str, Any]] = ...) -> None: ... -def showwarning(message: str, category: Type[Warning], filename: str, - lineno: int, file: Optional[TextIO] = ..., - line: Optional[str] = ...) -> None: ... -def formatwarning(message: str, category: Type[Warning], filename: str, - lineno: int, line: Optional[str] = ...) -> str: ... -def filterwarnings(action: str, message: str = ..., - category: Type[Warning] = ..., module: str = ..., - lineno: int = ..., append: bool = ...) -> None: ... -def simplefilter(action: str, category: Type[Warning] = ..., lineno: int = ..., - append: bool = ...) -> None: ... +def warn(message: Union[str, Warning], category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ... +def warn_explicit( + message: Union[str, Warning], + category: Type[Warning], + filename: str, + lineno: int, + module: Optional[str] = ..., + registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ..., + module_globals: Optional[Dict[str, Any]] = ..., +) -> None: ... +def showwarning( + message: str, category: Type[Warning], filename: str, lineno: int, file: Optional[TextIO] = ..., line: Optional[str] = ... +) -> None: ... +def formatwarning(message: str, category: Type[Warning], filename: str, lineno: int, line: Optional[str] = ...) -> str: ... +def filterwarnings( + action: str, message: str = ..., category: Type[Warning] = ..., module: str = ..., lineno: int = ..., append: bool = ... +) -> None: ... +def simplefilter(action: str, category: Type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ... def resetwarnings() -> None: ... -_Record = NamedTuple('_Record', - [('message', str), - ('category', Type[Warning]), - ('filename', str), - ('lineno', int), - ('file', Optional[TextIO]), - ('line', Optional[str])]) +_Record = NamedTuple( + "_Record", + [ + ("message", str), + ("category", Type[Warning]), + ("filename", str), + ("lineno", int), + ("file", Optional[TextIO]), + ("line", Optional[str]), + ], +) class catch_warnings: - def __init__(self, *, record: bool = ..., - module: Optional[ModuleType] = ...) -> None: ... + def __init__(self, *, record: bool = ..., module: Optional[ModuleType] = ...) -> None: ... def __enter__(self) -> Optional[List[_Record]]: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... diff --git a/stdlib/2and3/wave.pyi b/stdlib/2and3/wave.pyi index 1ebc8ccb8cf3..318373681544 100644 --- a/stdlib/2and3/wave.pyi +++ b/stdlib/2and3/wave.pyi @@ -12,14 +12,10 @@ WAVE_FORMAT_PCM: int if sys.version_info < (3, 0): _wave_params = Tuple[int, int, int, int, str, str] else: - _wave_params = NamedTuple('_wave_params', [ - ('nchannels', int), - ('sampwidth', int), - ('framerate', int), - ('nframes', int), - ('comptype', str), - ('compname', str), - ]) + _wave_params = NamedTuple( + "_wave_params", + [("nchannels", int), ("sampwidth", int), ("framerate", int), ("nframes", int), ("comptype", str), ("compname", str)], + ) class Wave_read: def __init__(self, f: _File) -> None: ... @@ -71,4 +67,5 @@ class Wave_write: # Returns a Wave_read if mode is rb and Wave_write if mode is wb def open(f: _File, mode: Optional[str] = ...) -> Any: ... + openfp = open diff --git a/stdlib/2and3/weakref.pyi b/stdlib/2and3/weakref.pyi index e488e9854918..2c77bcc5494e 100644 --- a/stdlib/2and3/weakref.pyi +++ b/stdlib/2and3/weakref.pyi @@ -30,10 +30,10 @@ from _weakref import ref as ref if sys.version_info < (3, 0): from exceptions import ReferenceError as ReferenceError -_S = TypeVar('_S') -_T = TypeVar('_T') -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') +_S = TypeVar("_S") +_T = TypeVar("_T") +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") ProxyTypes: Tuple[Type[Any], ...] @@ -47,7 +47,6 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def __init__(self) -> None: ... @overload def __init__(self, __map: Union[Mapping[_KT, _VT], Iterable[Tuple[_KT, _VT]]], **kwargs: _VT) -> None: ... - def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... @@ -57,9 +56,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_KT]: ... def __str__(self) -> str: ... - def copy(self) -> WeakValueDictionary[_KT, _VT]: ... - if sys.version_info < (3, 0): def keys(self) -> List[_KT]: ... def values(self) -> List[_VT]: ... @@ -84,7 +81,6 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def __init__(self) -> None: ... @overload def __init__(self, __map: Union[Mapping[_KT, _VT], Iterable[Tuple[_KT, _VT]]], **kwargs: _VT) -> None: ... - def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... @@ -94,9 +90,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_KT]: ... def __str__(self) -> str: ... - def copy(self) -> WeakKeyDictionary[_KT, _VT]: ... - if sys.version_info < (3, 0): def keys(self) -> List[_KT]: ... def values(self) -> List[_VT]: ... diff --git a/stdlib/2and3/webbrowser.pyi b/stdlib/2and3/webbrowser.pyi index fb14c8f3005b..d96744adc1d8 100644 --- a/stdlib/2and3/webbrowser.pyi +++ b/stdlib/2and3/webbrowser.pyi @@ -4,9 +4,15 @@ from typing import Any, Callable, List, Optional, Sequence, Text, Union class Error(Exception): ... if sys.version_info >= (3, 7): - def register(name: Text, klass: Optional[Callable[[], BaseBrowser]], instance: BaseBrowser = ..., *, preferred: bool = ...) -> None: ... + def register( + name: Text, klass: Optional[Callable[[], BaseBrowser]], instance: BaseBrowser = ..., *, preferred: bool = ... + ) -> None: ... + else: - def register(name: Text, klass: Optional[Callable[[], BaseBrowser]], instance: BaseBrowser = ..., update_tryorder: int = ...) -> None: ... + def register( + name: Text, klass: Optional[Callable[[], BaseBrowser]], instance: BaseBrowser = ..., update_tryorder: int = ... + ) -> None: ... + def get(using: Optional[Text] = ...) -> BaseBrowser: ... def open(url: Text, new: int = ..., autoraise: bool = ...) -> bool: ... def open_new(url: Text) -> bool: ... diff --git a/stdlib/2and3/wsgiref/handlers.pyi b/stdlib/2and3/wsgiref/handlers.pyi index ba148891945e..16e2ae263646 100644 --- a/stdlib/2and3/wsgiref/handlers.pyi +++ b/stdlib/2and3/wsgiref/handlers.pyi @@ -7,11 +7,10 @@ from .headers import Headers from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment from .util import FileWrapper, guess_scheme -_exc_info = Tuple[Optional[Type[BaseException]], - Optional[BaseException], - Optional[TracebackType]] +_exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] def format_date_time(timestamp: Optional[float]) -> str: ... # undocumented + if sys.version_info >= (3, 2): def read_environ() -> Dict[str, str]: ... @@ -34,15 +33,15 @@ class BaseHandler: error_status: str error_headers: List[Tuple[Text, Text]] error_body: bytes - def run(self, application: WSGIApplication) -> None: ... - def setup_environ(self) -> None: ... def finish_response(self) -> None: ... def get_scheme(self) -> str: ... def set_content_length(self) -> None: ... def cleanup_headers(self) -> None: ... - def start_response(self, status: Text, headers: List[Tuple[Text, Text]], exc_info: Optional[_exc_info] = ...) -> Callable[[bytes], None]: ... + def start_response( + self, status: Text, headers: List[Tuple[Text, Text]], exc_info: Optional[_exc_info] = ... + ) -> Callable[[bytes], None]: ... def send_preamble(self) -> None: ... def write(self, data: bytes) -> None: ... def sendfile(self) -> bool: ... @@ -54,7 +53,6 @@ class BaseHandler: def log_exception(self, exc_info: _exc_info) -> None: ... def handle_error(self) -> None: ... def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... - @abstractmethod def _write(self, data: bytes) -> None: ... @abstractmethod @@ -71,7 +69,15 @@ class SimpleHandler(BaseHandler): stdout: IO[bytes] stderr: ErrorStream base_env: MutableMapping[str, str] - def __init__(self, stdin: InputStream, stdout: IO[bytes], stderr: ErrorStream, environ: MutableMapping[str, str], multithread: bool = ..., multiprocess: bool = ...) -> None: ... + def __init__( + self, + stdin: InputStream, + stdout: IO[bytes], + stderr: ErrorStream, + environ: MutableMapping[str, str], + multithread: bool = ..., + multiprocess: bool = ..., + ) -> None: ... def get_stdin(self) -> InputStream: ... def get_stderr(self) -> ErrorStream: ... def add_cgi_vars(self) -> None: ... diff --git a/stdlib/2and3/wsgiref/simple_server.pyi b/stdlib/2and3/wsgiref/simple_server.pyi index 1cd1943800a4..0421098c39d4 100644 --- a/stdlib/2and3/wsgiref/simple_server.pyi +++ b/stdlib/2and3/wsgiref/simple_server.pyi @@ -33,8 +33,9 @@ class WSGIRequestHandler(BaseHTTPRequestHandler): def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ... _S = TypeVar("_S", bound=WSGIServer) - @overload def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: Type[WSGIRequestHandler] = ...) -> WSGIServer: ... @overload -def make_server(host: str, port: int, app: WSGIApplication, server_class: Type[_S], handler_class: Type[WSGIRequestHandler] = ...) -> _S: ... +def make_server( + host: str, port: int, app: WSGIApplication, server_class: Type[_S], handler_class: Type[WSGIRequestHandler] = ... +) -> _S: ... diff --git a/stdlib/2and3/wsgiref/types.pyi b/stdlib/2and3/wsgiref/types.pyi index c05f51c26c2e..76b80a77aec0 100644 --- a/stdlib/2and3/wsgiref/types.pyi +++ b/stdlib/2and3/wsgiref/types.pyi @@ -19,7 +19,9 @@ from sys import _OptExcInfo from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol, Text, Tuple class StartResponse(Protocol): - def __call__(self, status: str, headers: List[Tuple[str, str]], exc_info: Optional[_OptExcInfo] = ...) -> Callable[[bytes], Any]: ... + def __call__( + self, status: str, headers: List[Tuple[str, str]], exc_info: Optional[_OptExcInfo] = ... + ) -> Callable[[bytes], Any]: ... WSGIEnvironment = Dict[Text, Any] WSGIApplication = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]] @@ -39,6 +41,7 @@ class ErrorStream(Protocol): class _Readable(Protocol): def read(self, size: int = ...) -> bytes: ... + # Optional file wrapper in wsgi.file_wrapper class FileWrapper(Protocol): def __call__(self, file: _Readable, block_size: int = ...) -> Iterable[bytes]: ... diff --git a/stdlib/2and3/xdrlib.pyi b/stdlib/2and3/xdrlib.pyi index 864aced9c03a..75d5fc7d8f40 100644 --- a/stdlib/2and3/xdrlib.pyi +++ b/stdlib/2and3/xdrlib.pyi @@ -1,7 +1,7 @@ # Structs for xdrlib (Python 2 and 3) from typing import Callable, List, Sequence, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") class Error(Exception): msg: str diff --git a/stdlib/2and3/xml/etree/ElementPath.pyi b/stdlib/2and3/xml/etree/ElementPath.pyi index f397cb7fc0ed..027e4d416bc1 100644 --- a/stdlib/2and3/xml/etree/ElementPath.pyi +++ b/stdlib/2and3/xml/etree/ElementPath.pyi @@ -25,9 +25,11 @@ class _SelectorContext: root: Element def __init__(self, root: Element) -> None: ... -_T = TypeVar('_T') +_T = TypeVar("_T") def iterfind(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> List[Element]: ... def find(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> Optional[Element]: ... def findall(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> List[Element]: ... -def findtext(elem: Element, path: str, default: Optional[_T] = ..., namespaces: Optional[Dict[str, str]] = ...) -> Union[_T, str]: ... +def findtext( + elem: Element, path: str, default: Optional[_T] = ..., namespaces: Optional[Dict[str, str]] = ... +) -> Union[_T, str]: ... diff --git a/stdlib/2and3/xml/etree/ElementTree.pyi b/stdlib/2and3/xml/etree/ElementTree.pyi index e4608f2477bb..21cb20af987d 100644 --- a/stdlib/2and3/xml/etree/ElementTree.pyi +++ b/stdlib/2and3/xml/etree/ElementTree.pyi @@ -29,7 +29,7 @@ class ParseError(SyntaxError): ... def iselement(element: object) -> bool: ... -_T = TypeVar('_T') +_T = TypeVar("_T") # Type for parser inputs. Parser will accept any unicode/str/bytes and coerce, # and this is true in py2 and py3 (even fromstringlist() in python3 can be @@ -65,14 +65,28 @@ class Element(MutableSequence[Element]): attrib: Dict[_str_result_type, _str_result_type] text: Optional[_str_result_type] tail: Optional[_str_result_type] - def __init__(self, tag: Union[_str_argument_type, Callable[..., Element]], attrib: Dict[_str_argument_type, _str_argument_type] = ..., **extra: _str_argument_type) -> None: ... + def __init__( + self, + tag: Union[_str_argument_type, Callable[..., Element]], + attrib: Dict[_str_argument_type, _str_argument_type] = ..., + **extra: _str_argument_type + ) -> None: ... def append(self, subelement: Element) -> None: ... def clear(self) -> None: ... def copy(self) -> Element: ... def extend(self, elements: Iterable[Element]) -> None: ... - def find(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[Element]: ... - def findall(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ... - def findtext(self, path: _str_argument_type, default: Optional[_T] = ..., namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ... + def find( + self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ... + ) -> Optional[Element]: ... + def findall( + self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ... + ) -> List[Element]: ... + def findtext( + self, + path: _str_argument_type, + default: Optional[_T] = ..., + namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ..., + ) -> Union[_T, _str_result_type]: ... def get(self, key: _str_argument_type, default: Optional[_T] = ...) -> Union[_str_result_type, _T]: ... def getchildren(self) -> List[Element]: ... def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ... @@ -82,7 +96,9 @@ class Element(MutableSequence[Element]): def insert(self, index: int, element: Element) -> None: ... def items(self) -> ItemsView[_str_result_type, _str_result_type]: ... def iter(self, tag: Optional[_str_argument_type] = ...) -> Generator[Element, None, None]: ... - def iterfind(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ... + def iterfind( + self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ... + ) -> List[Element]: ... def itertext(self) -> Generator[_str_result_type, None, None]: ... def keys(self) -> KeysView[_str_result_type]: ... def makeelement(self, tag: _str_argument_type, attrib: Dict[_str_argument_type, _str_argument_type]) -> Element: ... @@ -100,8 +116,12 @@ class Element(MutableSequence[Element]): @overload def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ... - -def SubElement(parent: Element, tag: _str_argument_type, attrib: Dict[_str_argument_type, _str_argument_type] = ..., **extra: _str_argument_type) -> Element: ... +def SubElement( + parent: Element, + tag: _str_argument_type, + attrib: Dict[_str_argument_type, _str_argument_type] = ..., + **extra: _str_argument_type +) -> Element: ... def Comment(text: Optional[_str_argument_type] = ...) -> Element: ... def ProcessingInstruction(target: _str_argument_type, text: Optional[_str_argument_type] = ...) -> Element: ... @@ -111,7 +131,6 @@ class QName: text: str def __init__(self, text_or_uri: _str_argument_type, tag: Optional[_str_argument_type] = ...) -> None: ... - _file_or_filename = Union[str, bytes, int, IO[Any]] class ElementTree: @@ -120,26 +139,64 @@ class ElementTree: def parse(self, source: _file_or_filename, parser: Optional[XMLParser] = ...) -> Element: ... def iter(self, tag: Optional[_str_argument_type] = ...) -> Generator[Element, None, None]: ... def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ... - def find(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Optional[Element]: ... - def findtext(self, path: _str_argument_type, default: Optional[_T] = ..., namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> Union[_T, _str_result_type]: ... - def findall(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ... - def iterfind(self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...) -> List[Element]: ... + def find( + self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ... + ) -> Optional[Element]: ... + def findtext( + self, + path: _str_argument_type, + default: Optional[_T] = ..., + namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ..., + ) -> Union[_T, _str_result_type]: ... + def findall( + self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ... + ) -> List[Element]: ... + def iterfind( + self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ... + ) -> List[Element]: ... if sys.version_info >= (3, 4): - def write(self, file_or_filename: _file_or_filename, encoding: Optional[str] = ..., xml_declaration: Optional[bool] = ..., default_namespace: Optional[_str_argument_type] = ..., method: Optional[str] = ..., *, short_empty_elements: bool = ...) -> None: ... + def write( + self, + file_or_filename: _file_or_filename, + encoding: Optional[str] = ..., + xml_declaration: Optional[bool] = ..., + default_namespace: Optional[_str_argument_type] = ..., + method: Optional[str] = ..., + *, + short_empty_elements: bool = ... + ) -> None: ... else: - def write(self, file_or_filename: _file_or_filename, encoding: Optional[str] = ..., xml_declaration: Optional[bool] = ..., default_namespace: Optional[_str_argument_type] = ..., method: Optional[str] = ...) -> None: ... + def write( + self, + file_or_filename: _file_or_filename, + encoding: Optional[str] = ..., + xml_declaration: Optional[bool] = ..., + default_namespace: Optional[_str_argument_type] = ..., + method: Optional[str] = ..., + ) -> None: ... def write_c14n(self, file: _file_or_filename) -> None: ... def register_namespace(prefix: _str_argument_type, uri: _str_argument_type) -> None: ... + if sys.version_info >= (3, 4): - def tostring(element: Element, encoding: Optional[str] = ..., method: Optional[str] = ..., *, short_empty_elements: bool = ...) -> _tostring_result_type: ... - def tostringlist(element: Element, encoding: Optional[str] = ..., method: Optional[str] = ..., *, short_empty_elements: bool = ...) -> List[_tostring_result_type]: ... + def tostring( + element: Element, encoding: Optional[str] = ..., method: Optional[str] = ..., *, short_empty_elements: bool = ... + ) -> _tostring_result_type: ... + def tostringlist( + element: Element, encoding: Optional[str] = ..., method: Optional[str] = ..., *, short_empty_elements: bool = ... + ) -> List[_tostring_result_type]: ... + else: def tostring(element: Element, encoding: Optional[str] = ..., method: Optional[str] = ...) -> _tostring_result_type: ... - def tostringlist(element: Element, encoding: Optional[str] = ..., method: Optional[str] = ...) -> List[_tostring_result_type]: ... + def tostringlist( + element: Element, encoding: Optional[str] = ..., method: Optional[str] = ... + ) -> List[_tostring_result_type]: ... + def dump(elem: Element) -> None: ... def parse(source: _file_or_filename, parser: Optional[XMLParser] = ...) -> ElementTree: ... -def iterparse(source: _file_or_filename, events: Optional[Sequence[str]] = ..., parser: Optional[XMLParser] = ...) -> Iterator[Tuple[str, Any]]: ... +def iterparse( + source: _file_or_filename, events: Optional[Sequence[str]] = ..., parser: Optional[XMLParser] = ... +) -> Iterator[Tuple[str, Any]]: ... if sys.version_info >= (3, 4): class XMLPullParser: diff --git a/stdlib/2and3/xml/sax/__init__.pyi b/stdlib/2and3/xml/sax/__init__.pyi index e50c9a8fa726..0f12187efa6e 100644 --- a/stdlib/2and3/xml/sax/__init__.pyi +++ b/stdlib/2and3/xml/sax/__init__.pyi @@ -23,11 +23,12 @@ class SAXReaderNotAvailable(SAXNotSupportedException): ... default_parser_list: List[str] def make_parser(parser_list: List[str] = ...) -> xml.sax.xmlreader.XMLReader: ... - -def parse(source: Union[str, IO[str]], handler: xml.sax.handler.ContentHandler, - errorHandler: xml.sax.handler.ErrorHandler = ...) -> None: ... - -def parseString(string: Union[bytes, Text], handler: xml.sax.handler.ContentHandler, - errorHandler: Optional[xml.sax.handler.ErrorHandler] = ...) -> None: ... - +def parse( + source: Union[str, IO[str]], handler: xml.sax.handler.ContentHandler, errorHandler: xml.sax.handler.ErrorHandler = ... +) -> None: ... +def parseString( + string: Union[bytes, Text], + handler: xml.sax.handler.ContentHandler, + errorHandler: Optional[xml.sax.handler.ErrorHandler] = ..., +) -> None: ... def _create_parser(parser_name: str) -> xml.sax.xmlreader.XMLReader: ... diff --git a/stdlib/2and3/zipfile.pyi b/stdlib/2and3/zipfile.pyi index bcd54faa6512..7b98723e343f 100644 --- a/stdlib/2and3/zipfile.pyi +++ b/stdlib/2and3/zipfile.pyi @@ -12,12 +12,12 @@ else: _SZI = Union[Text, ZipInfo] _DT = Tuple[int, int, int, int, int, int] - if sys.version_info >= (3,): class BadZipFile(Exception): ... BadZipfile = BadZipFile else: class BadZipfile(Exception): ... + error = BadZipfile class LargeZipFile(Exception): ... @@ -28,47 +28,40 @@ class ZipFile: filelist: List[ZipInfo] fp: IO[bytes] NameToInfo: Dict[Text, ZipInfo] - def __init__(self, file: Union[_Path, IO[bytes]], mode: Text = ..., compression: int = ..., - allowZip64: bool = ...) -> None: ... + def __init__( + self, file: Union[_Path, IO[bytes]], mode: Text = ..., compression: int = ..., allowZip64: bool = ... + ) -> None: ... def __enter__(self) -> ZipFile: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... def close(self) -> None: ... def getinfo(self, name: Text) -> ZipInfo: ... def infolist(self) -> List[ZipInfo]: ... def namelist(self) -> List[Text]: ... - def open(self, name: _SZI, mode: Text = ..., - pwd: Optional[bytes] = ...) -> IO[bytes]: ... - def extract(self, member: _SZI, path: Optional[_SZI] = ..., - pwd: bytes = ...) -> str: ... - def extractall(self, path: Optional[_Path] = ..., - members: Optional[Iterable[Text]] = ..., - pwd: Optional[bytes] = ...) -> None: ... + def open(self, name: _SZI, mode: Text = ..., pwd: Optional[bytes] = ...) -> IO[bytes]: ... + def extract(self, member: _SZI, path: Optional[_SZI] = ..., pwd: bytes = ...) -> str: ... + def extractall( + self, path: Optional[_Path] = ..., members: Optional[Iterable[Text]] = ..., pwd: Optional[bytes] = ... + ) -> None: ... def printdir(self) -> None: ... def setpassword(self, pwd: bytes) -> None: ... def read(self, name: _SZI, pwd: Optional[bytes] = ...) -> bytes: ... def testzip(self) -> Optional[str]: ... - def write(self, filename: _Path, arcname: Optional[_Path] = ..., - compress_type: Optional[int] = ...) -> None: ... + def write(self, filename: _Path, arcname: Optional[_Path] = ..., compress_type: Optional[int] = ...) -> None: ... if sys.version_info >= (3,): - def writestr(self, zinfo_or_arcname: _SZI, data: Union[bytes, str], - compress_type: Optional[int] = ...) -> None: ... + def writestr(self, zinfo_or_arcname: _SZI, data: Union[bytes, str], compress_type: Optional[int] = ...) -> None: ... else: - def writestr(self, - zinfo_or_arcname: _SZI, bytes: bytes, - compress_type: Optional[int] = ...) -> None: ... + def writestr(self, zinfo_or_arcname: _SZI, bytes: bytes, compress_type: Optional[int] = ...) -> None: ... class PyZipFile(ZipFile): if sys.version_info >= (3,): - def __init__(self, file: Union[str, IO[bytes]], mode: str = ..., - compression: int = ..., allowZip64: bool = ..., - opimize: int = ...) -> None: ... - def writepy(self, pathname: str, basename: str = ..., - filterfunc: Optional[Callable[[str], bool]] = ...) -> None: ... + def __init__( + self, file: Union[str, IO[bytes]], mode: str = ..., compression: int = ..., allowZip64: bool = ..., opimize: int = ... + ) -> None: ... + def writepy(self, pathname: str, basename: str = ..., filterfunc: Optional[Callable[[str], bool]] = ...) -> None: ... else: - def writepy(self, - pathname: Text, basename: Text = ...) -> None: ... + def writepy(self, pathname: Text, basename: Text = ...) -> None: ... class ZipInfo: filename: Text @@ -88,13 +81,11 @@ class ZipInfo: CRC: int compress_size: int file_size: int - def __init__(self, filename: Optional[Text] = ..., - date_time: Optional[_DT] = ...) -> None: ... + def __init__(self, filename: Optional[Text] = ..., date_time: Optional[_DT] = ...) -> None: ... if sys.version_info >= (3, 6): def is_dir(self) -> bool: ... def FileHeader(self, zip64: Optional[bool] = ...) -> bytes: ... - def is_zipfile(filename: Union[_Path, IO[bytes]]) -> bool: ... ZIP_STORED: int diff --git a/stdlib/2and3/zlib.pyi b/stdlib/2and3/zlib.pyi index 4ea537215d53..f2db5dd1d043 100644 --- a/stdlib/2and3/zlib.pyi +++ b/stdlib/2and3/zlib.pyi @@ -21,13 +21,11 @@ if sys.version_info >= (3,): class error(Exception): ... - class _Compress: def compress(self, data: bytes) -> bytes: ... def flush(self, mode: int = ...) -> bytes: ... def copy(self) -> _Compress: ... - class _Decompress: unused_data: bytes unconsumed_tail: bytes @@ -37,19 +35,24 @@ class _Decompress: def flush(self, length: int = ...) -> bytes: ... def copy(self) -> _Decompress: ... - def adler32(data: bytes, value: int = ...) -> int: ... def compress(data: bytes, level: int = ...) -> bytes: ... + if sys.version_info >= (3,): - def compressobj(level: int = ..., method: int = ..., wbits: int = ..., - memLevel: int = ..., strategy: int = ..., - zdict: bytes = ...) -> _Compress: ... + def compressobj( + level: int = ..., method: int = ..., wbits: int = ..., memLevel: int = ..., strategy: int = ..., zdict: bytes = ... + ) -> _Compress: ... + else: - def compressobj(level: int = ..., method: int = ..., wbits: int = ..., - memlevel: int = ..., strategy: int = ...) -> _Compress: ... + def compressobj( + level: int = ..., method: int = ..., wbits: int = ..., memlevel: int = ..., strategy: int = ... + ) -> _Compress: ... + def crc32(data: bytes, value: int = ...) -> int: ... def decompress(data: bytes, wbits: int = ..., bufsize: int = ...) -> bytes: ... + if sys.version_info >= (3,): def decompressobj(wbits: int = ..., zdict: bytes = ...) -> _Decompress: ... + else: def decompressobj(wbits: int = ...) -> _Decompress: ... diff --git a/stdlib/3.5/zipapp.pyi b/stdlib/3.5/zipapp.pyi index 94971f8ace17..e90f1234de8b 100644 --- a/stdlib/3.5/zipapp.pyi +++ b/stdlib/3.5/zipapp.pyi @@ -9,8 +9,18 @@ _Path = Union[str, Path, BinaryIO] class ZipAppError(Exception): ... if sys.version_info >= (3, 7): - def create_archive(source: _Path, target: Optional[_Path] = ..., interpreter: Optional[str] = ..., main: Optional[str] = ..., - filter: Optional[Callable[[Path], bool]] = ..., compressed: bool = ...) -> None: ... + def create_archive( + source: _Path, + target: Optional[_Path] = ..., + interpreter: Optional[str] = ..., + main: Optional[str] = ..., + filter: Optional[Callable[[Path], bool]] = ..., + compressed: bool = ..., + ) -> None: ... + else: - def create_archive(source: _Path, target: Optional[_Path] = ..., interpreter: Optional[str] = ..., main: Optional[str] = ...) -> None: ... + def create_archive( + source: _Path, target: Optional[_Path] = ..., interpreter: Optional[str] = ..., main: Optional[str] = ... + ) -> None: ... + def get_interpreter(archive: _Path) -> str: ... diff --git a/stdlib/3.6/secrets.pyi b/stdlib/3.6/secrets.pyi index 290d72246e65..b8afd43a3722 100644 --- a/stdlib/3.6/secrets.pyi +++ b/stdlib/3.6/secrets.pyi @@ -4,7 +4,7 @@ from hmac import compare_digest as compare_digest from random import SystemRandom as SystemRandom from typing import Optional, Sequence, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") def randbelow(exclusive_upper_bound: int) -> int: ... def randbits(k: int) -> int: ... diff --git a/stdlib/3.7/contextvars.pyi b/stdlib/3.7/contextvars.pyi index ab2ae9e5fabf..e228d3af431f 100644 --- a/stdlib/3.7/contextvars.pyi +++ b/stdlib/3.7/contextvars.pyi @@ -1,6 +1,6 @@ from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union -_T = TypeVar('_T') +_T = TypeVar("_T") class ContextVar(Generic[_T]): def __init__(self, name: str, *, default: _T = ...) -> None: ... diff --git a/stdlib/3.7/dataclasses.pyi b/stdlib/3.7/dataclasses.pyi index ec10fc4d65c2..f378e747a605 100644 --- a/stdlib/3.7/dataclasses.pyi +++ b/stdlib/3.7/dataclasses.pyi @@ -1,28 +1,24 @@ from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") class _MISSING_TYPE: ... -MISSING: _MISSING_TYPE +MISSING: _MISSING_TYPE @overload def asdict(obj: Any) -> Dict[str, Any]: ... @overload def asdict(obj: Any, *, dict_factory: Callable[[List[Tuple[str, Any]]], _T]) -> _T: ... - @overload def astuple(obj: Any) -> Tuple[Any, ...]: ... @overload def astuple(obj: Any, *, tuple_factory: Callable[[List[Any]], _T]) -> _T: ... - - @overload def dataclass(_cls: Type[_T]) -> Type[_T]: ... - @overload -def dataclass(*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., - unsafe_hash: bool = ..., frozen: bool = ...) -> Callable[[Type[_T]], Type[_T]]: ... - +def dataclass( + *, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ... +) -> Callable[[Type[_T]], Type[_T]]: ... class Field(Generic[_T]): name: str @@ -35,36 +31,54 @@ class Field(Generic[_T]): compare: bool metadata: Optional[Mapping[str, Any]] - # NOTE: Actual return type is 'Field[_T]', but we want to help type checkers # to understand the magic that happens at runtime. @overload # `default` and `default_factory` are optional and mutually exclusive. -def field(*, default: _T, - init: bool = ..., repr: bool = ..., hash: Optional[bool] = ..., compare: bool = ..., - metadata: Optional[Mapping[str, Any]] = ...) -> _T: ... - +def field( + *, + default: _T, + init: bool = ..., + repr: bool = ..., + hash: Optional[bool] = ..., + compare: bool = ..., + metadata: Optional[Mapping[str, Any]] = ... +) -> _T: ... @overload -def field(*, default_factory: Callable[[], _T], - init: bool = ..., repr: bool = ..., hash: Optional[bool] = ..., compare: bool = ..., - metadata: Optional[Mapping[str, Any]] = ...) -> _T: ... - +def field( + *, + default_factory: Callable[[], _T], + init: bool = ..., + repr: bool = ..., + hash: Optional[bool] = ..., + compare: bool = ..., + metadata: Optional[Mapping[str, Any]] = ... +) -> _T: ... @overload -def field(*, - init: bool = ..., repr: bool = ..., hash: Optional[bool] = ..., compare: bool = ..., - metadata: Optional[Mapping[str, Any]] = ...) -> Any: ... - - +def field( + *, + init: bool = ..., + repr: bool = ..., + hash: Optional[bool] = ..., + compare: bool = ..., + metadata: Optional[Mapping[str, Any]] = ... +) -> Any: ... def fields(class_or_instance: Any) -> Tuple[Field[Any], ...]: ... - def is_dataclass(obj: Any) -> bool: ... class FrozenInstanceError(AttributeError): ... - class InitVar(Generic[_T]): ... -def make_dataclass(cls_name: str, fields: Iterable[Union[str, Tuple[str, type], Tuple[str, type, Field[Any]]]], *, - bases: Tuple[type, ...] = ..., namespace: Optional[Dict[str, Any]] = ..., - init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., hash: bool = ..., - frozen: bool = ...): ... - +def make_dataclass( + cls_name: str, + fields: Iterable[Union[str, Tuple[str, type], Tuple[str, type, Field[Any]]]], + *, + bases: Tuple[type, ...] = ..., + namespace: Optional[Dict[str, Any]] = ..., + init: bool = ..., + repr: bool = ..., + eq: bool = ..., + order: bool = ..., + hash: bool = ..., + frozen: bool = ... +): ... def replace(obj: _T, **changes: Any) -> _T: ... diff --git a/stdlib/3/_ast.pyi b/stdlib/3/_ast.pyi index 341547bf4056..66c360977592 100644 --- a/stdlib/3/_ast.pyi +++ b/stdlib/3/_ast.pyi @@ -18,14 +18,11 @@ class AST: end_col_offset: Optional[int] type_comment: Optional[str] -class mod(AST): - ... +class mod(AST): ... if sys.version_info >= (3, 8): class type_ignore(AST): ... - class TypeIgnore(type_ignore): ... - class FunctionType(mod): argtypes: typing.List[expr] returns: expr @@ -46,7 +43,6 @@ class Expression(mod): class Suite(mod): body: typing.List[stmt] - class stmt(AST): ... class FunctionDef(stmt): @@ -162,10 +158,7 @@ class Expr(stmt): class Pass(stmt): ... class Break(stmt): ... class Continue(stmt): ... - - -class slice(AST): - ... +class slice(AST): ... _slice = slice # this lets us type the variable named 'slice' below @@ -180,7 +173,6 @@ class ExtSlice(slice): class Index(slice): value: expr - class expr(AST): ... class BoolOp(expr): @@ -259,7 +251,6 @@ if sys.version_info >= (3, 6): value: expr conversion: Optional[int] format_spec: Optional[expr] - class JoinedStr(expr): values: typing.List[expr] @@ -276,7 +267,6 @@ if sys.version_info >= (3, 8): # Aliases for value, for backwards compatibility s: Any n: complex - class NamedExpr(expr): target: expr value: expr @@ -309,27 +299,17 @@ class Tuple(expr): elts: typing.List[expr] ctx: expr_context - -class expr_context(AST): - ... - +class expr_context(AST): ... class AugLoad(expr_context): ... class AugStore(expr_context): ... class Del(expr_context): ... class Load(expr_context): ... class Param(expr_context): ... class Store(expr_context): ... - - -class boolop(AST): - ... - +class boolop(AST): ... class And(boolop): ... class Or(boolop): ... - -class operator(AST): - ... - +class operator(AST): ... class Add(operator): ... class BitAnd(operator): ... class BitOr(operator): ... @@ -343,18 +323,12 @@ class MatMult(operator): ... class Pow(operator): ... class RShift(operator): ... class Sub(operator): ... - -class unaryop(AST): - ... - +class unaryop(AST): ... class Invert(unaryop): ... class Not(unaryop): ... class UAdd(unaryop): ... class USub(unaryop): ... - -class cmpop(AST): - ... - +class cmpop(AST): ... class Eq(cmpop): ... class Gt(cmpop): ... class GtE(cmpop): ... @@ -366,7 +340,6 @@ class LtE(cmpop): ... class NotEq(cmpop): ... class NotIn(cmpop): ... - class comprehension(AST): target: expr iter: expr @@ -374,16 +347,13 @@ class comprehension(AST): if sys.version_info >= (3, 6): is_async: int - -class excepthandler(AST): - ... +class excepthandler(AST): ... class ExceptHandler(excepthandler): type: Optional[expr] name: Optional[_identifier] body: typing.List[stmt] - class arguments(AST): args: typing.List[arg] vararg: Optional[arg] diff --git a/stdlib/3/_importlib_modulespec.pyi b/stdlib/3/_importlib_modulespec.pyi index d765e887cc92..ddd10f1409f3 100644 --- a/stdlib/3/_importlib_modulespec.pyi +++ b/stdlib/3/_importlib_modulespec.pyi @@ -15,9 +15,15 @@ class _Loader(Protocol): def load_module(self, fullname: str) -> ModuleType: ... class ModuleSpec: - def __init__(self, name: str, loader: Optional[Loader], *, - origin: Optional[str] = ..., loader_state: Any = ..., - is_package: Optional[bool] = ...) -> None: ... + def __init__( + self, + name: str, + loader: Optional[Loader], + *, + origin: Optional[str] = ..., + loader_state: Any = ..., + is_package: Optional[bool] = ... + ) -> None: ... name: str loader: Optional[_Loader] origin: Optional[str] diff --git a/stdlib/3/_json.pyi b/stdlib/3/_json.pyi index 217fadd13209..f9067ccd2a2c 100644 --- a/stdlib/3/_json.pyi +++ b/stdlib/3/_json.pyi @@ -11,8 +11,9 @@ class make_encoder: default: Any encoder: Any item_separator: Any - def __init__(self, markers, default, encoder, indent, key_separator, - item_separator, sort_keys, skipkeys, allow_nan) -> None: ... + def __init__( + self, markers, default, encoder, indent, key_separator, item_separator, sort_keys, skipkeys, allow_nan + ) -> None: ... def __call__(self, *args, **kwargs) -> Any: ... class make_scanner: diff --git a/stdlib/3/_markupbase.pyi b/stdlib/3/_markupbase.pyi index 09f69c7420b4..d8bc79f34e8c 100644 --- a/stdlib/3/_markupbase.pyi +++ b/stdlib/3/_markupbase.pyi @@ -5,5 +5,4 @@ class ParserBase: def error(self, message: str) -> None: ... def reset(self) -> None: ... def getpos(self) -> Tuple[int, int]: ... - def unknown_decl(self, data: str) -> None: ... diff --git a/stdlib/3/_operator.pyi b/stdlib/3/_operator.pyi index 9ecdd91ab96d..48022b007b64 100644 --- a/stdlib/3/_operator.pyi +++ b/stdlib/3/_operator.pyi @@ -1,6 +1,7 @@ # Stubs for _operator (Python 3.5) import sys + # In reality the import is the other way around, but this way we can keep the operator stub in 2and3 from operator import abs as abs from operator import add as add diff --git a/stdlib/3/_posixsubprocess.pyi b/stdlib/3/_posixsubprocess.pyi index 49fcbb7f5685..3ff76b517bf3 100644 --- a/stdlib/3/_posixsubprocess.pyi +++ b/stdlib/3/_posixsubprocess.pyi @@ -5,10 +5,22 @@ from typing import Callable, Sequence, Tuple def cloexec_pipe() -> Tuple[int, int]: ... -def fork_exec(args: Sequence[str], - executable_list: Sequence[bytes], close_fds: bool, fds_to_keep: Sequence[int], - cwd: str, env_list: Sequence[bytes], - p2cread: int, p2cwrite: int, c2pred: int, c2pwrite: int, - errread: int, errwrite: int, errpipe_read: int, - errpipe_write: int, restore_signals: int, start_new_session: int, - preexec_fn: Callable[[], None]) -> int: ... +def fork_exec( + args: Sequence[str], + executable_list: Sequence[bytes], + close_fds: bool, + fds_to_keep: Sequence[int], + cwd: str, + env_list: Sequence[bytes], + p2cread: int, + p2cwrite: int, + c2pred: int, + c2pwrite: int, + errread: int, + errwrite: int, + errpipe_read: int, + errpipe_write: int, + restore_signals: int, + start_new_session: int, + preexec_fn: Callable[[], None], +) -> int: ... diff --git a/stdlib/3/_stat.pyi b/stdlib/3/_stat.pyi index ffd28cb8ad9c..72d3f687973b 100644 --- a/stdlib/3/_stat.pyi +++ b/stdlib/3/_stat.pyi @@ -54,7 +54,6 @@ UF_OPAQUE: int def S_IMODE(mode: int) -> int: ... def S_IFMT(mode: int) -> int: ... - def S_ISBLK(mode: int) -> bool: ... def S_ISCHR(mode: int) -> bool: ... def S_ISDIR(mode: int) -> bool: ... @@ -65,5 +64,4 @@ def S_ISPORT(mode: int) -> bool: ... def S_ISREG(mode: int) -> bool: ... def S_ISSOCK(mode: int) -> bool: ... def S_ISWHT(mode: int) -> bool: ... - def filemode(mode: int) -> str: ... diff --git a/stdlib/3/_subprocess.pyi b/stdlib/3/_subprocess.pyi index a58b16f92fff..957b7cd51bd4 100644 --- a/stdlib/3/_subprocess.pyi +++ b/stdlib/3/_subprocess.pyi @@ -23,16 +23,20 @@ class Handle: def GetVersion() -> int: ... def GetExitCodeProcess(handle: Handle) -> int: ... def WaitForSingleObject(handle: Handle, timeout: int) -> int: ... -def CreateProcess(executable: str, cmd_line: str, - proc_attrs, thread_attrs, - inherit: int, flags: int, - env_mapping: Mapping[str, str], - curdir: str, - startupinfo: Any) -> Tuple[Any, Handle, int, int]: ... +def CreateProcess( + executable: str, + cmd_line: str, + proc_attrs, + thread_attrs, + inherit: int, + flags: int, + env_mapping: Mapping[str, str], + curdir: str, + startupinfo: Any, +) -> Tuple[Any, Handle, int, int]: ... def GetModuleFileName(module: int) -> str: ... def GetCurrentProcess() -> Handle: ... -def DuplicateHandle(source_proc: Handle, source: Handle, target_proc: Handle, - target: Any, access: int, inherit: int) -> int: ... +def DuplicateHandle(source_proc: Handle, source: Handle, target_proc: Handle, target: Any, access: int, inherit: int) -> int: ... def CreatePipe(pipe_attrs, size: int) -> Tuple[Handle, Handle]: ... def GetStdHandle(arg: int) -> int: ... def TerminateProcess(handle: Handle, exit_code: int) -> None: ... diff --git a/stdlib/3/_thread.pyi b/stdlib/3/_thread.pyi index 41f02b04210f..1a71853dbc76 100644 --- a/stdlib/3/_thread.pyi +++ b/stdlib/3/_thread.pyi @@ -15,10 +15,7 @@ class LockType: def locked(self) -> bool: ... def __enter__(self) -> bool: ... def __exit__( - self, - type: Optional[Type[BaseException]], - value: Optional[BaseException], - traceback: Optional[TracebackType], + self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType] ) -> None: ... def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> int: ... diff --git a/stdlib/3/_tracemalloc.pyi b/stdlib/3/_tracemalloc.pyi index 21d00332ad37..30c5380f1338 100644 --- a/stdlib/3/_tracemalloc.pyi +++ b/stdlib/3/_tracemalloc.pyi @@ -6,20 +6,14 @@ from typing import Any def _get_object_traceback(*args, **kwargs) -> Any: ... - def _get_traces() -> Any: raise MemoryError() def clear_traces() -> None: ... - def get_traceback_limit() -> int: ... - def get_traced_memory() -> tuple: ... - def get_tracemalloc_memory() -> Any: ... - def is_tracing() -> bool: ... - def start(*args, **kwargs) -> None: raise ValueError() diff --git a/stdlib/3/_warnings.pyi b/stdlib/3/_warnings.pyi index 6529c40b9993..165a36ffd62b 100644 --- a/stdlib/3/_warnings.pyi +++ b/stdlib/3/_warnings.pyi @@ -5,7 +5,12 @@ _onceregistry: dict filters: List[tuple] def warn(message: Warning, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ... -def warn_explicit(message: Warning, category: Optional[Type[Warning]], - filename: str, lineno: int, - module: Any = ..., registry: dict = ..., - module_globals: dict = ...) -> None: ... +def warn_explicit( + message: Warning, + category: Optional[Type[Warning]], + filename: str, + lineno: int, + module: Any = ..., + registry: dict = ..., + module_globals: dict = ..., +) -> None: ... diff --git a/stdlib/3/_winapi.pyi b/stdlib/3/_winapi.pyi index 3a6d5436ad2a..3bc93dd50b3e 100644 --- a/stdlib/3/_winapi.pyi +++ b/stdlib/3/_winapi.pyi @@ -51,13 +51,46 @@ def CloseHandle(handle: int) -> None: ... def ConnectNamedPipe(handle: int, overlapped: Union[int, bool]) -> Any: ... @overload def ConnectNamedPipe(handle: int) -> None: ... - -def CreateFile(file_name: str, desired_access: int, share_mode: int, security_attributes: int, creation_disposition: int, flags_and_attributes: int, template_file: int) -> int: ... +def CreateFile( + file_name: str, + desired_access: int, + share_mode: int, + security_attributes: int, + creation_disposition: int, + flags_and_attributes: int, + template_file: int, +) -> int: ... def CreateJunction(src_path: str, dest_path: str) -> None: ... -def CreateNamedPipe(name: str, open_mode: int, pipe_mode: int, max_instances: int, out_buffer_size: int, in_buffer_size: int, default_timeout: int, security_attributes: int) -> int: ... +def CreateNamedPipe( + name: str, + open_mode: int, + pipe_mode: int, + max_instances: int, + out_buffer_size: int, + in_buffer_size: int, + default_timeout: int, + security_attributes: int, +) -> int: ... def CreatePipe(pipe_attrs: Any, size: int) -> Tuple[int, int]: ... -def CreateProcess(application_name: Optional[str], command_line: Optional[str], proc_attrs: Any, thread_attrs: Any, inherit_handles: bool, creation_flags: int, env_mapping: Dict[str, str], cwd: Optional[str], startup_info: Any) -> Tuple[int, int, int, int]: ... -def DuplicateHandle(source_process_handle: int, source_handle: int, target_process_handle: int, desired_access: int, inherit_handle: bool, options: int = ...) -> int: ... +def CreateProcess( + application_name: Optional[str], + command_line: Optional[str], + proc_attrs: Any, + thread_attrs: Any, + inherit_handles: bool, + creation_flags: int, + env_mapping: Dict[str, str], + cwd: Optional[str], + startup_info: Any, +) -> Tuple[int, int, int, int]: ... +def DuplicateHandle( + source_process_handle: int, + source_handle: int, + target_process_handle: int, + desired_access: int, + inherit_handle: bool, + options: int = ..., +) -> int: ... def ExitProcess(ExitCode: int) -> NoReturn: ... def GetACP() -> int: ... def GetFileType(handle: int) -> int: ... @@ -75,8 +108,9 @@ def PeekNamedPipe(handle: int, size: int = ...) -> Union[Tuple[int, int], Tuple[ def ReadFile(handle: int, size: int, overlapped: Union[int, bool]) -> Any: ... @overload def ReadFile(handle: int, size: int) -> Tuple[int, int]: ... - -def SetNamedPipeHandleState(named_pipe: int, mode: Optional[int], max_collection_count: Optional[int], collect_data_timeout: Optional[int]) -> None: ... +def SetNamedPipeHandleState( + named_pipe: int, mode: Optional[int], max_collection_count: Optional[int], collect_data_timeout: Optional[int] +) -> None: ... def TerminateProcess(handle: int, exit_code: int) -> None: ... def WaitForMultipleObjects(handle_seq: Sequence[int], wait_flag: bool, milliseconds: int = ...) -> int: ... def WaitForSingleObject(handle: int, milliseconds: int) -> int: ... @@ -88,7 +122,6 @@ def WriteFile(handle: int, buffer: bytes, overlapped: Union[int, bool]) -> Any: @overload def WriteFile(handle: int, buffer: bytes) -> Tuple[bytes, int]: ... - class Overlapped: event: int = ... def GetOverlappedResult(self, wait: bool) -> Tuple[int, int]: ... diff --git a/stdlib/3/abc.pyi b/stdlib/3/abc.pyi index 49a1c8a04590..81e6b0ace24e 100644 --- a/stdlib/3/abc.pyi +++ b/stdlib/3/abc.pyi @@ -2,15 +2,17 @@ from typing import Any, Callable, Type, TypeVar # Stubs for abc. -_T = TypeVar('_T') -_FuncT = TypeVar('_FuncT', bound=Callable[..., Any]) +_T = TypeVar("_T") +_FuncT = TypeVar("_FuncT", bound=Callable[..., Any]) # Thesee definitions have special processing in mypy class ABCMeta(type): def register(cls: ABCMeta, subclass: Type[_T]) -> Type[_T]: ... def abstractmethod(callable: _FuncT) -> _FuncT: ... + class abstractproperty(property): ... + # These two are deprecated and not supported by mypy def abstractstaticmethod(callable: _FuncT) -> _FuncT: ... def abstractclassmethod(callable: _FuncT) -> _FuncT: ... diff --git a/stdlib/3/ast.pyi b/stdlib/3/ast.pyi index b13e82306b46..b628932a6300 100644 --- a/stdlib/3/ast.pyi +++ b/stdlib/3/ast.pyi @@ -1,6 +1,7 @@ # Python 3.5 ast import sys + # Rename typing to _typing, as not to conflict with typing imported # from _ast below when loaded in an unorthodox way by the Dropbox # internal Bazel integration. @@ -9,18 +10,24 @@ from typing import Any, Iterator, Optional, TypeVar, Union from _ast import * # type: ignore -class NodeVisitor(): +class NodeVisitor: def visit(self, node: AST) -> Any: ... def generic_visit(self, node: AST) -> Any: ... class NodeTransformer(NodeVisitor): def generic_visit(self, node: AST) -> Optional[AST]: ... -_T = TypeVar('_T', bound=AST) +_T = TypeVar("_T", bound=AST) if sys.version_info >= (3, 8): - def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ..., - type_comments: bool = ..., feature_version: int = ...) -> AST: ... + def parse( + source: Union[str, bytes], + filename: Union[str, bytes] = ..., + mode: str = ..., + type_comments: bool = ..., + feature_version: int = ..., + ) -> AST: ... + else: def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> AST: ... diff --git a/stdlib/3/asyncio/__init__.pyi b/stdlib/3/asyncio/__init__.pyi index f919622b1ab0..8cc55da95a52 100644 --- a/stdlib/3/asyncio/__init__.pyi +++ b/stdlib/3/asyncio/__init__.pyi @@ -67,35 +67,20 @@ if sys.version_info < (3, 5): from asyncio.queues import JoinableQueue as JoinableQueue else: from asyncio.futures import isfuture as isfuture - from asyncio.events import ( - _set_running_loop as _set_running_loop, - _get_running_loop as _get_running_loop, - ) -if sys.platform != 'win32': - from asyncio.streams import ( - open_unix_connection as open_unix_connection, - start_unix_server as start_unix_server, - ) + from asyncio.events import _set_running_loop as _set_running_loop, _get_running_loop as _get_running_loop +if sys.platform != "win32": + from asyncio.streams import open_unix_connection as open_unix_connection, start_unix_server as start_unix_server if sys.version_info >= (3, 7): - from asyncio.events import ( - get_running_loop as get_running_loop, - ) - from asyncio.tasks import ( - all_tasks as all_tasks, - create_task as create_task, - current_task as current_task, - ) - from asyncio.runners import ( - run as run, - ) - + from asyncio.events import get_running_loop as get_running_loop + from asyncio.tasks import all_tasks as all_tasks, create_task as create_task, current_task as current_task + from asyncio.runners import run as run # TODO: It should be possible to instantiate these classes, but mypy # currently disallows this. # See https://github.com/python/mypy/issues/1843 SelectorEventLoop: Type[AbstractEventLoop] -if sys.platform == 'win32': +if sys.platform == "win32": ProactorEventLoop: Type[AbstractEventLoop] DefaultEventLoopPolicy: Type[AbstractEventLoopPolicy] diff --git a/stdlib/3/asyncio/base_events.pyi b/stdlib/3/asyncio/base_events.pyi index 658396443d79..37b1cd6f4ae3 100644 --- a/stdlib/3/asyncio/base_events.pyi +++ b/stdlib/3/asyncio/base_events.pyi @@ -10,7 +10,7 @@ from asyncio.transports import BaseTransport from socket import socket from typing import Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") _Context = Dict[str, Any] _ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any] _ProtocolFactory = Callable[[], BaseProtocol] @@ -19,13 +19,11 @@ _TransProtPair = Tuple[BaseTransport, BaseProtocol] class BaseEventLoop(AbstractEventLoop): def run_forever(self) -> None: ... - # Can't use a union, see mypy issue # 1873. @overload def run_until_complete(self, future: Generator[Any, None, _T]) -> _T: ... @overload def run_until_complete(self, future: Awaitable[_T]) -> _T: ... - def stop(self) -> None: ... def is_running(self) -> bool: ... def is_closed(self) -> bool: ... @@ -43,76 +41,160 @@ class BaseEventLoop(AbstractEventLoop): def create_future(self) -> Future[Any]: ... # Tasks methods def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ... - def set_task_factory(self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]) -> None: ... + def set_task_factory( + self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]] + ) -> None: ... def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ... # Methods for interacting with threads def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ... @coroutine - def run_in_executor(self, executor: Any, - func: Callable[..., _T], *args: Any) -> Generator[Any, None, _T]: ... + def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Generator[Any, None, _T]: ... def set_default_executor(self, executor: Any) -> None: ... # Network I/O methods returning Futures. @coroutine # TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers # https://github.com/python/mypy/issues/2509 - def getaddrinfo(self, host: Optional[str], port: Union[str, int, None], *, - family: int = ..., type: int = ..., proto: int = ..., - flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ... + def getaddrinfo( + self, + host: Optional[str], + port: Union[str, int, None], + *, + family: int = ..., + type: int = ..., + proto: int = ..., + flags: int = ... + ) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ... @coroutine def getnameinfo(self, sockaddr: tuple, flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ... @overload @coroutine - def create_connection(self, protocol_factory: _ProtocolFactory, host: str = ..., port: int = ..., *, - ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: None = ..., - local_addr: Optional[str] = ..., server_hostname: Optional[str] = ...) -> Generator[Any, None, _TransProtPair]: ... + def create_connection( + self, + protocol_factory: _ProtocolFactory, + host: str = ..., + port: int = ..., + *, + ssl: _SSLContext = ..., + family: int = ..., + proto: int = ..., + flags: int = ..., + sock: None = ..., + local_addr: Optional[str] = ..., + server_hostname: Optional[str] = ... + ) -> Generator[Any, None, _TransProtPair]: ... @overload @coroutine - def create_connection(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *, - ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: socket, - local_addr: None = ..., server_hostname: Optional[str] = ...) -> Generator[Any, None, _TransProtPair]: ... + def create_connection( + self, + protocol_factory: _ProtocolFactory, + host: None = ..., + port: None = ..., + *, + ssl: _SSLContext = ..., + family: int = ..., + proto: int = ..., + flags: int = ..., + sock: socket, + local_addr: None = ..., + server_hostname: Optional[str] = ... + ) -> Generator[Any, None, _TransProtPair]: ... @overload @coroutine - def create_server(self, protocol_factory: _ProtocolFactory, host: Optional[Union[str, Sequence[str]]] = ..., port: int = ..., *, - family: int = ..., flags: int = ..., - sock: None = ..., backlog: int = ..., ssl: _SSLContext = ..., - reuse_address: Optional[bool] = ..., - reuse_port: Optional[bool] = ...) -> Generator[Any, None, AbstractServer]: ... + def create_server( + self, + protocol_factory: _ProtocolFactory, + host: Optional[Union[str, Sequence[str]]] = ..., + port: int = ..., + *, + family: int = ..., + flags: int = ..., + sock: None = ..., + backlog: int = ..., + ssl: _SSLContext = ..., + reuse_address: Optional[bool] = ..., + reuse_port: Optional[bool] = ... + ) -> Generator[Any, None, AbstractServer]: ... @overload @coroutine - def create_server(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *, - family: int = ..., flags: int = ..., - sock: socket, backlog: int = ..., ssl: _SSLContext = ..., - reuse_address: Optional[bool] = ..., - reuse_port: Optional[bool] = ...) -> Generator[Any, None, AbstractServer]: ... - @coroutine - def create_unix_connection(self, protocol_factory: _ProtocolFactory, path: str, *, - ssl: _SSLContext = ..., sock: Optional[socket] = ..., - server_hostname: str = ...) -> Generator[Any, None, _TransProtPair]: ... - @coroutine - def create_unix_server(self, protocol_factory: _ProtocolFactory, path: str, *, - sock: Optional[socket] = ..., backlog: int = ..., ssl: _SSLContext = ...) -> Generator[Any, None, AbstractServer]: ... - @coroutine - def create_datagram_endpoint(self, protocol_factory: _ProtocolFactory, - local_addr: Optional[Tuple[str, int]] = ..., remote_addr: Optional[Tuple[str, int]] = ..., *, - family: int = ..., proto: int = ..., flags: int = ..., - reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ..., - allow_broadcast: Optional[bool] = ..., - sock: Optional[socket] = ...) -> Generator[Any, None, _TransProtPair]: ... - @coroutine - def connect_accepted_socket(self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...) -> Generator[Any, None, _TransProtPair]: ... + def create_server( + self, + protocol_factory: _ProtocolFactory, + host: None = ..., + port: None = ..., + *, + family: int = ..., + flags: int = ..., + sock: socket, + backlog: int = ..., + ssl: _SSLContext = ..., + reuse_address: Optional[bool] = ..., + reuse_port: Optional[bool] = ... + ) -> Generator[Any, None, AbstractServer]: ... + @coroutine + def create_unix_connection( + self, + protocol_factory: _ProtocolFactory, + path: str, + *, + ssl: _SSLContext = ..., + sock: Optional[socket] = ..., + server_hostname: str = ... + ) -> Generator[Any, None, _TransProtPair]: ... + @coroutine + def create_unix_server( + self, + protocol_factory: _ProtocolFactory, + path: str, + *, + sock: Optional[socket] = ..., + backlog: int = ..., + ssl: _SSLContext = ... + ) -> Generator[Any, None, AbstractServer]: ... + @coroutine + def create_datagram_endpoint( + self, + protocol_factory: _ProtocolFactory, + local_addr: Optional[Tuple[str, int]] = ..., + remote_addr: Optional[Tuple[str, int]] = ..., + *, + family: int = ..., + proto: int = ..., + flags: int = ..., + reuse_address: Optional[bool] = ..., + reuse_port: Optional[bool] = ..., + allow_broadcast: Optional[bool] = ..., + sock: Optional[socket] = ... + ) -> Generator[Any, None, _TransProtPair]: ... + @coroutine + def connect_accepted_socket( + self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ... + ) -> Generator[Any, None, _TransProtPair]: ... # Pipes and subprocesses. @coroutine def connect_read_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> Generator[Any, None, _TransProtPair]: ... @coroutine def connect_write_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> Generator[Any, None, _TransProtPair]: ... @coroutine - def subprocess_shell(self, protocol_factory: _ProtocolFactory, cmd: Union[bytes, str], *, stdin: Any = ..., - stdout: Any = ..., stderr: Any = ..., - **kwargs: Any) -> Generator[Any, None, _TransProtPair]: ... - @coroutine - def subprocess_exec(self, protocol_factory: _ProtocolFactory, *args: Any, stdin: Any = ..., - stdout: Any = ..., stderr: Any = ..., - **kwargs: Any) -> Generator[Any, None, _TransProtPair]: ... + def subprocess_shell( + self, + protocol_factory: _ProtocolFactory, + cmd: Union[bytes, str], + *, + stdin: Any = ..., + stdout: Any = ..., + stderr: Any = ..., + **kwargs: Any + ) -> Generator[Any, None, _TransProtPair]: ... + @coroutine + def subprocess_exec( + self, + protocol_factory: _ProtocolFactory, + *args: Any, + stdin: Any = ..., + stdout: Any = ..., + stderr: Any = ..., + **kwargs: Any + ) -> Generator[Any, None, _TransProtPair]: ... def add_reader(self, fd: selectors._FileObject, callback: Callable[..., Any], *args: Any) -> None: ... def remove_reader(self, fd: selectors._FileObject) -> None: ... def add_writer(self, fd: selectors._FileObject, callback: Callable[..., Any], *args: Any) -> None: ... diff --git a/stdlib/3/asyncio/coroutines.pyi b/stdlib/3/asyncio/coroutines.pyi index 981ccd5a0018..70129622840b 100644 --- a/stdlib/3/asyncio/coroutines.pyi +++ b/stdlib/3/asyncio/coroutines.pyi @@ -2,7 +2,7 @@ from typing import Any, Callable, Generator, List, TypeVar __all__: List[str] -_F = TypeVar('_F', bound=Callable[..., Any]) +_F = TypeVar("_F", bound=Callable[..., Any]) def coroutine(func: _F) -> _F: ... def iscoroutinefunction(func: Callable[..., Any]) -> bool: ... diff --git a/stdlib/3/asyncio/events.pyi b/stdlib/3/asyncio/events.pyi index e8490d137bb6..53fc1aa30a21 100644 --- a/stdlib/3/asyncio/events.pyi +++ b/stdlib/3/asyncio/events.pyi @@ -12,7 +12,7 @@ from typing import Any, Awaitable, Callable, Dict, Generator, List, Optional, Se __all__: List[str] -_T = TypeVar('_T') +_T = TypeVar("_T") _Context = Dict[str, Any] _ExceptionHandler = Callable[[AbstractEventLoop, _Context], Any] _ProtocolFactory = Callable[[], BaseProtocol] @@ -28,8 +28,7 @@ class Handle: def _run(self) -> None: ... class TimerHandle(Handle): - def __init__(self, when: float, callback: Callable[..., Any], args: List[Any], - loop: AbstractEventLoop) -> None: ... + def __init__(self, when: float, callback: Callable[..., Any], args: List[Any], loop: AbstractEventLoop) -> None: ... def __hash__(self) -> int: ... class AbstractServer: @@ -42,7 +41,6 @@ class AbstractEventLoop(metaclass=ABCMeta): slow_callback_duration: float = ... @abstractmethod def run_forever(self) -> None: ... - # Can't use a union, see mypy issue # 1873. @overload @abstractmethod @@ -50,7 +48,6 @@ class AbstractEventLoop(metaclass=ABCMeta): @overload @abstractmethod def run_until_complete(self, future: Awaitable[_T]) -> _T: ... - @abstractmethod def stop(self) -> None: ... @abstractmethod @@ -80,7 +77,9 @@ class AbstractEventLoop(metaclass=ABCMeta): @abstractmethod def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ... @abstractmethod - def set_task_factory(self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]) -> None: ... + def set_task_factory( + self, factory: Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]] + ) -> None: ... @abstractmethod def get_task_factory(self) -> Optional[Callable[[AbstractEventLoop, Generator[Any, None, _T]], Future[_T]]]: ... # Methods for interacting with threads @@ -88,8 +87,7 @@ class AbstractEventLoop(metaclass=ABCMeta): def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ... @abstractmethod @coroutine - def run_in_executor(self, executor: Any, - func: Callable[..., _T], *args: Any) -> Generator[Any, None, _T]: ... + def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Generator[Any, None, _T]: ... @abstractmethod def set_default_executor(self, executor: Any) -> None: ... # Network I/O methods returning Futures. @@ -97,60 +95,130 @@ class AbstractEventLoop(metaclass=ABCMeta): @coroutine # TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers # https://github.com/python/mypy/issues/2509 - def getaddrinfo(self, host: Optional[str], port: Union[str, int, None], *, - family: int = ..., type: int = ..., proto: int = ..., - flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ... + def getaddrinfo( + self, + host: Optional[str], + port: Union[str, int, None], + *, + family: int = ..., + type: int = ..., + proto: int = ..., + flags: int = ... + ) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ... @abstractmethod @coroutine def getnameinfo(self, sockaddr: tuple, flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ... @overload @abstractmethod @coroutine - def create_connection(self, protocol_factory: _ProtocolFactory, host: str = ..., port: int = ..., *, - ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: None = ..., - local_addr: Optional[str] = ..., server_hostname: Optional[str] = ...) -> Generator[Any, None, _TransProtPair]: ... + def create_connection( + self, + protocol_factory: _ProtocolFactory, + host: str = ..., + port: int = ..., + *, + ssl: _SSLContext = ..., + family: int = ..., + proto: int = ..., + flags: int = ..., + sock: None = ..., + local_addr: Optional[str] = ..., + server_hostname: Optional[str] = ... + ) -> Generator[Any, None, _TransProtPair]: ... @overload @abstractmethod @coroutine - def create_connection(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *, - ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: socket, - local_addr: None = ..., server_hostname: Optional[str] = ...) -> Generator[Any, None, _TransProtPair]: ... + def create_connection( + self, + protocol_factory: _ProtocolFactory, + host: None = ..., + port: None = ..., + *, + ssl: _SSLContext = ..., + family: int = ..., + proto: int = ..., + flags: int = ..., + sock: socket, + local_addr: None = ..., + server_hostname: Optional[str] = ... + ) -> Generator[Any, None, _TransProtPair]: ... @overload @abstractmethod @coroutine - def create_server(self, protocol_factory: _ProtocolFactory, host: Optional[Union[str, Sequence[str]]] = ..., port: int = ..., *, - family: int = ..., flags: int = ..., - sock: None = ..., backlog: int = ..., ssl: _SSLContext = ..., - reuse_address: Optional[bool] = ..., - reuse_port: Optional[bool] = ...) -> Generator[Any, None, AbstractServer]: ... + def create_server( + self, + protocol_factory: _ProtocolFactory, + host: Optional[Union[str, Sequence[str]]] = ..., + port: int = ..., + *, + family: int = ..., + flags: int = ..., + sock: None = ..., + backlog: int = ..., + ssl: _SSLContext = ..., + reuse_address: Optional[bool] = ..., + reuse_port: Optional[bool] = ... + ) -> Generator[Any, None, AbstractServer]: ... @overload @abstractmethod @coroutine - def create_server(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *, - family: int = ..., flags: int = ..., - sock: socket, backlog: int = ..., ssl: _SSLContext = ..., - reuse_address: Optional[bool] = ..., - reuse_port: Optional[bool] = ...) -> Generator[Any, None, AbstractServer]: ... + def create_server( + self, + protocol_factory: _ProtocolFactory, + host: None = ..., + port: None = ..., + *, + family: int = ..., + flags: int = ..., + sock: socket, + backlog: int = ..., + ssl: _SSLContext = ..., + reuse_address: Optional[bool] = ..., + reuse_port: Optional[bool] = ... + ) -> Generator[Any, None, AbstractServer]: ... @abstractmethod @coroutine - def create_unix_connection(self, protocol_factory: _ProtocolFactory, path: str, *, - ssl: _SSLContext = ..., sock: Optional[socket] = ..., - server_hostname: str = ...) -> Generator[Any, None, _TransProtPair]: ... + def create_unix_connection( + self, + protocol_factory: _ProtocolFactory, + path: str, + *, + ssl: _SSLContext = ..., + sock: Optional[socket] = ..., + server_hostname: str = ... + ) -> Generator[Any, None, _TransProtPair]: ... @abstractmethod @coroutine - def create_unix_server(self, protocol_factory: _ProtocolFactory, path: str, *, - sock: Optional[socket] = ..., backlog: int = ..., ssl: _SSLContext = ...) -> Generator[Any, None, AbstractServer]: ... + def create_unix_server( + self, + protocol_factory: _ProtocolFactory, + path: str, + *, + sock: Optional[socket] = ..., + backlog: int = ..., + ssl: _SSLContext = ... + ) -> Generator[Any, None, AbstractServer]: ... @abstractmethod @coroutine - def create_datagram_endpoint(self, protocol_factory: _ProtocolFactory, - local_addr: Optional[Tuple[str, int]] = ..., remote_addr: Optional[Tuple[str, int]] = ..., *, - family: int = ..., proto: int = ..., flags: int = ..., - reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ..., - allow_broadcast: Optional[bool] = ..., - sock: Optional[socket] = ...) -> Generator[Any, None, _TransProtPair]: ... + def create_datagram_endpoint( + self, + protocol_factory: _ProtocolFactory, + local_addr: Optional[Tuple[str, int]] = ..., + remote_addr: Optional[Tuple[str, int]] = ..., + *, + family: int = ..., + proto: int = ..., + flags: int = ..., + reuse_address: Optional[bool] = ..., + reuse_port: Optional[bool] = ..., + allow_broadcast: Optional[bool] = ..., + sock: Optional[socket] = ... + ) -> Generator[Any, None, _TransProtPair]: ... @abstractmethod @coroutine - def connect_accepted_socket(self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...) -> Generator[Any, None, _TransProtPair]: ... + def connect_accepted_socket( + self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ... + ) -> Generator[Any, None, _TransProtPair]: ... # Pipes and subprocesses. @abstractmethod @coroutine @@ -160,14 +228,27 @@ class AbstractEventLoop(metaclass=ABCMeta): def connect_write_pipe(self, protocol_factory: _ProtocolFactory, pipe: Any) -> Generator[Any, None, _TransProtPair]: ... @abstractmethod @coroutine - def subprocess_shell(self, protocol_factory: _ProtocolFactory, cmd: Union[bytes, str], *, stdin: Any = ..., - stdout: Any = ..., stderr: Any = ..., - **kwargs: Any) -> Generator[Any, None, _TransProtPair]: ... + def subprocess_shell( + self, + protocol_factory: _ProtocolFactory, + cmd: Union[bytes, str], + *, + stdin: Any = ..., + stdout: Any = ..., + stderr: Any = ..., + **kwargs: Any + ) -> Generator[Any, None, _TransProtPair]: ... @abstractmethod @coroutine - def subprocess_exec(self, protocol_factory: _ProtocolFactory, *args: Any, stdin: Any = ..., - stdout: Any = ..., stderr: Any = ..., - **kwargs: Any) -> Generator[Any, None, _TransProtPair]: ... + def subprocess_exec( + self, + protocol_factory: _ProtocolFactory, + *args: Any, + stdin: Any = ..., + stdout: Any = ..., + stderr: Any = ..., + **kwargs: Any + ) -> Generator[Any, None, _TransProtPair]: ... @abstractmethod def add_reader(self, fd: selectors._FileObject, callback: Callable[..., Any], *args: Any) -> None: ... @abstractmethod @@ -231,14 +312,11 @@ class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta): def get_event_loop_policy() -> AbstractEventLoopPolicy: ... def set_event_loop_policy(policy: AbstractEventLoopPolicy) -> None: ... - def get_event_loop() -> AbstractEventLoop: ... def set_event_loop(loop: Optional[AbstractEventLoop]) -> None: ... def new_event_loop() -> AbstractEventLoop: ... - def get_child_watcher() -> Any: ... # TODO: unix_events.AbstractChildWatcher def set_child_watcher(watcher: Any) -> None: ... # TODO: unix_events.AbstractChildWatcher - def _set_running_loop(loop: Optional[AbstractEventLoop]) -> None: ... def _get_running_loop() -> AbstractEventLoop: ... diff --git a/stdlib/3/asyncio/futures.pyi b/stdlib/3/asyncio/futures.pyi index 49d708fde890..be31e7e733c7 100644 --- a/stdlib/3/asyncio/futures.pyi +++ b/stdlib/3/asyncio/futures.pyi @@ -12,8 +12,8 @@ if sys.version_info >= (3, 7): __all__: List[str] -_T = TypeVar('_T') -_S = TypeVar('_S', bound=Future) +_T = TypeVar("_T") +_S = TypeVar("_S", bound=Future) class InvalidStateError(Error): ... diff --git a/stdlib/3/asyncio/locks.pyi b/stdlib/3/asyncio/locks.pyi index 189c4241b00d..1ea1c47f4dc8 100644 --- a/stdlib/3/asyncio/locks.pyi +++ b/stdlib/3/asyncio/locks.pyi @@ -5,7 +5,7 @@ from .coroutines import coroutine from .events import AbstractEventLoop from .futures import Future -_T = TypeVar('_T') +_T = TypeVar("_T") __all__: List[str] @@ -19,7 +19,9 @@ class _ContextManagerMixin(Future[_ContextManager]): def __enter__(self) -> object: ... def __exit__(self, *args: Any) -> None: ... def __aenter__(self) -> Awaitable[None]: ... - def __aexit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> Awaitable[None]: ... + def __aexit__( + self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType] + ) -> Awaitable[None]: ... class Lock(_ContextManagerMixin): def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ... diff --git a/stdlib/3/asyncio/protocols.pyi b/stdlib/3/asyncio/protocols.pyi index bb258e119697..01eda98cfa5e 100644 --- a/stdlib/3/asyncio/protocols.pyi +++ b/stdlib/3/asyncio/protocols.pyi @@ -3,7 +3,6 @@ from typing import List, Optional, Text, Tuple, Union __all__: List[str] - class BaseProtocol: def connection_made(self, transport: transports.BaseTransport) -> None: ... def connection_lost(self, exc: Optional[Exception]) -> None: ... diff --git a/stdlib/3/asyncio/queues.pyi b/stdlib/3/asyncio/queues.pyi index ddc93c5f9bea..6fb820335923 100644 --- a/stdlib/3/asyncio/queues.pyi +++ b/stdlib/3/asyncio/queues.pyi @@ -7,11 +7,10 @@ from .futures import Future __all__: List[str] - class QueueEmpty(Exception): ... class QueueFull(Exception): ... -_T = TypeVar('_T') +_T = TypeVar("_T") class Queue(Generic[_T]): def __init__(self, maxsize: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ... @@ -38,10 +37,7 @@ class Queue(Generic[_T]): def join(self) -> Generator[Any, None, bool]: ... def task_done(self) -> None: ... - class PriorityQueue(Queue[_T]): ... - - class LifoQueue(Queue[_T]): ... if sys.version_info < (3, 5): diff --git a/stdlib/3/asyncio/runners.pyi b/stdlib/3/asyncio/runners.pyi index 581c9fb3c74a..0293fd9b133a 100644 --- a/stdlib/3/asyncio/runners.pyi +++ b/stdlib/3/asyncio/runners.pyi @@ -3,6 +3,5 @@ import sys if sys.version_info >= (3, 7): from typing import Awaitable, TypeVar - _T = TypeVar('_T') - + _T = TypeVar("_T") def run(main: Awaitable[_T], *, debug: bool = ...) -> _T: ... diff --git a/stdlib/3/asyncio/streams.pyi b/stdlib/3/asyncio/streams.pyi index d9bd60814edf..1d160f21687e 100644 --- a/stdlib/3/asyncio/streams.pyi +++ b/stdlib/3/asyncio/streams.pyi @@ -5,7 +5,6 @@ from . import coroutines, events, protocols, transports _ClientConnectedCallback = Callable[[StreamReader, StreamWriter], Optional[Awaitable[None]]] - __all__: List[str] class IncompleteReadError(EOFError): @@ -19,14 +18,8 @@ class LimitOverrunError(Exception): @coroutines.coroutine def open_connection( - host: str = ..., - port: Union[int, str] = ..., - *, - loop: Optional[events.AbstractEventLoop] = ..., - limit: int = ..., - **kwds: Any + host: str = ..., port: Union[int, str] = ..., *, loop: Optional[events.AbstractEventLoop] = ..., limit: int = ..., **kwds: Any ) -> Generator[Any, None, Tuple[StreamReader, StreamWriter]]: ... - @coroutines.coroutine def start_server( client_connected_cb: _ClientConnectedCallback, @@ -38,22 +31,17 @@ def start_server( **kwds: Any ) -> Generator[Any, None, events.AbstractServer]: ... -if sys.platform != 'win32': +if sys.platform != "win32": if sys.version_info >= (3, 7): from os import PathLike + _PathType = Union[str, PathLike[str]] else: _PathType = str - @coroutines.coroutine def open_unix_connection( - path: _PathType = ..., - *, - loop: Optional[events.AbstractEventLoop] = ..., - limit: int = ..., - **kwds: Any + path: _PathType = ..., *, loop: Optional[events.AbstractEventLoop] = ..., limit: int = ..., **kwds: Any ) -> Generator[Any, None, Tuple[StreamReader, StreamWriter]]: ... - @coroutines.coroutine def start_unix_server( client_connected_cb: _ClientConnectedCallback, @@ -61,26 +49,31 @@ if sys.platform != 'win32': *, loop: Optional[events.AbstractEventLoop] = ..., limit: int = ..., - **kwds: Any) -> Generator[Any, None, events.AbstractServer]: ... + **kwds: Any + ) -> Generator[Any, None, events.AbstractServer]: ... class FlowControlMixin(protocols.Protocol): ... class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): - def __init__(self, - stream_reader: StreamReader, - client_connected_cb: _ClientConnectedCallback = ..., - loop: Optional[events.AbstractEventLoop] = ...) -> None: ... + def __init__( + self, + stream_reader: StreamReader, + client_connected_cb: _ClientConnectedCallback = ..., + loop: Optional[events.AbstractEventLoop] = ..., + ) -> None: ... def connection_made(self, transport: transports.BaseTransport) -> None: ... def connection_lost(self, exc: Optional[Exception]) -> None: ... def data_received(self, data: bytes) -> None: ... def eof_received(self) -> bool: ... class StreamWriter: - def __init__(self, - transport: transports.BaseTransport, - protocol: protocols.BaseProtocol, - reader: Optional[StreamReader], - loop: events.AbstractEventLoop) -> None: ... + def __init__( + self, + transport: transports.BaseTransport, + protocol: protocols.BaseProtocol, + reader: Optional[StreamReader], + loop: events.AbstractEventLoop, + ) -> None: ... @property def transport(self) -> transports.BaseTransport: ... def write(self, data: bytes) -> None: ... @@ -97,9 +90,7 @@ class StreamWriter: def drain(self) -> Generator[Any, None, None]: ... class StreamReader: - def __init__(self, - limit: int = ..., - loop: Optional[events.AbstractEventLoop] = ...) -> None: ... + def __init__(self, limit: int = ..., loop: Optional[events.AbstractEventLoop] = ...) -> None: ... def exception(self) -> Exception: ... def set_exception(self, exc: Exception) -> None: ... def set_transport(self, transport: transports.BaseTransport) -> None: ... diff --git a/stdlib/3/asyncio/subprocess.pyi b/stdlib/3/asyncio/subprocess.pyi index b014f3d845a3..3aa2002dd391 100644 --- a/stdlib/3/asyncio/subprocess.pyi +++ b/stdlib/3/asyncio/subprocess.pyi @@ -8,8 +8,7 @@ PIPE: int STDOUT: int DEVNULL: int -class SubprocessStreamProtocol(streams.FlowControlMixin, - protocols.SubprocessProtocol): +class SubprocessStreamProtocol(streams.FlowControlMixin, protocols.SubprocessProtocol): stdin: Optional[streams.StreamWriter] stdout: Optional[streams.StreamReader] stderr: Optional[streams.StreamReader] @@ -19,16 +18,14 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, def pipe_connection_lost(self, fd: int, exc: Optional[Exception]) -> None: ... def process_exited(self) -> None: ... - class Process: stdin: Optional[streams.StreamWriter] stdout: Optional[streams.StreamReader] stderr: Optional[streams.StreamReader] pid: int - def __init__(self, - transport: transports.BaseTransport, - protocol: protocols.BaseProtocol, - loop: events.AbstractEventLoop) -> None: ... + def __init__( + self, transport: transports.BaseTransport, protocol: protocols.BaseProtocol, loop: events.AbstractEventLoop + ) -> None: ... @property def returncode(self) -> int: ... @coroutine @@ -39,7 +36,6 @@ class Process: @coroutine def communicate(self, input: Optional[bytes] = ...) -> Generator[Any, None, Tuple[bytes, bytes]]: ... - @coroutine def create_subprocess_shell( *Args: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236 @@ -50,7 +46,6 @@ def create_subprocess_shell( limit: int = ..., **kwds: Any ) -> Generator[Any, None, Process]: ... - @coroutine def create_subprocess_exec( program: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236 diff --git a/stdlib/3/asyncio/tasks.pyi b/stdlib/3/asyncio/tasks.pyi index 518466ae1e3f..ab6e38472b77 100644 --- a/stdlib/3/asyncio/tasks.pyi +++ b/stdlib/3/asyncio/tasks.pyi @@ -27,54 +27,86 @@ from .futures import Future __all__: List[str] -_T = TypeVar('_T') -_T1 = TypeVar('_T1') -_T2 = TypeVar('_T2') -_T3 = TypeVar('_T3') -_T4 = TypeVar('_T4') -_T5 = TypeVar('_T5') +_T = TypeVar("_T") +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") +_T4 = TypeVar("_T4") +_T5 = TypeVar("_T5") _FutureT = Union[Future[_T], Generator[Any, None, _T], Awaitable[_T]] FIRST_EXCEPTION: str FIRST_COMPLETED: str ALL_COMPLETED: str -def as_completed(fs: Sequence[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., - timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ... -def ensure_future(coro_or_future: _FutureT[_T], - *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ... +def as_completed( + fs: Sequence[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., timeout: Optional[float] = ... +) -> Iterator[Future[_T]]: ... +def ensure_future(coro_or_future: _FutureT[_T], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ... + # Prior to Python 3.7 'async' was an alias for 'ensure_future'. # It became a keyword in 3.7. @overload -def gather(coro_or_future1: _FutureT[_T1], - *, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1]]: ... +def gather( + coro_or_future1: _FutureT[_T1], *, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ... +) -> Future[Tuple[_T1]]: ... @overload -def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], - *, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1, _T2]]: ... +def gather( + coro_or_future1: _FutureT[_T1], + coro_or_future2: _FutureT[_T2], + *, + loop: Optional[AbstractEventLoop] = ..., + return_exceptions: bool = ... +) -> Future[Tuple[_T1, _T2]]: ... @overload -def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3], - *, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1, _T2, _T3]]: ... +def gather( + coro_or_future1: _FutureT[_T1], + coro_or_future2: _FutureT[_T2], + coro_or_future3: _FutureT[_T3], + *, + loop: Optional[AbstractEventLoop] = ..., + return_exceptions: bool = ... +) -> Future[Tuple[_T1, _T2, _T3]]: ... @overload -def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], - *, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ... +def gather( + coro_or_future1: _FutureT[_T1], + coro_or_future2: _FutureT[_T2], + coro_or_future3: _FutureT[_T3], + coro_or_future4: _FutureT[_T4], + *, + loop: Optional[AbstractEventLoop] = ..., + return_exceptions: bool = ... +) -> Future[Tuple[_T1, _T2, _T3, _T4]]: ... @overload -def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_or_future3: _FutureT[_T3], - coro_or_future4: _FutureT[_T4], coro_or_future5: _FutureT[_T5], - *, loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +def gather( + coro_or_future1: _FutureT[_T1], + coro_or_future2: _FutureT[_T2], + coro_or_future3: _FutureT[_T3], + coro_or_future4: _FutureT[_T4], + coro_or_future5: _FutureT[_T5], + *, + loop: Optional[AbstractEventLoop] = ..., + return_exceptions: bool = ... +) -> Future[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload -def gather(coro_or_future1: _FutureT[Any], coro_or_future2: _FutureT[Any], coro_or_future3: _FutureT[Any], - coro_or_future4: _FutureT[Any], coro_or_future5: _FutureT[Any], coro_or_future6: _FutureT[Any], - *coros_or_futures: _FutureT[Any], - loop: Optional[AbstractEventLoop] = ..., return_exceptions: bool = ...) -> Future[Tuple[Any, ...]]: ... -def run_coroutine_threadsafe(coro: _FutureT[_T], - loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ... +def gather( + coro_or_future1: _FutureT[Any], + coro_or_future2: _FutureT[Any], + coro_or_future3: _FutureT[Any], + coro_or_future4: _FutureT[Any], + coro_or_future5: _FutureT[Any], + coro_or_future6: _FutureT[Any], + *coros_or_futures: _FutureT[Any], + loop: Optional[AbstractEventLoop] = ..., + return_exceptions: bool = ... +) -> Future[Tuple[Any, ...]]: ... +def run_coroutine_threadsafe(coro: _FutureT[_T], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ... def shield(arg: _FutureT[_T], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ... def sleep(delay: float, result: _T = ..., loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ... -def wait(fs: Iterable[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., timeout: Optional[float] = ..., - return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ... -def wait_for(fut: _FutureT[_T], timeout: Optional[float], - *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ... +def wait( + fs: Iterable[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., timeout: Optional[float] = ..., return_when: str = ... +) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ... +def wait_for(fut: _FutureT[_T], timeout: Optional[float], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ... class Task(Future[_T], Generic[_T]): @classmethod diff --git a/stdlib/3/asyncio/transports.pyi b/stdlib/3/asyncio/transports.pyi index 441fa5047d2e..44baba3d0af1 100644 --- a/stdlib/3/asyncio/transports.pyi +++ b/stdlib/3/asyncio/transports.pyi @@ -13,9 +13,7 @@ class ReadTransport(BaseTransport): def resume_reading(self) -> None: ... class WriteTransport(BaseTransport): - def set_write_buffer_limits( - self, high: int = ..., low: int = ... - ) -> None: ... + def set_write_buffer_limits(self, high: int = ..., low: int = ...) -> None: ... def get_write_buffer_size(self) -> int: ... def write(self, data: Any) -> None: ... def writelines(self, list_of_data: List[Any]) -> None: ... diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 6eb5c4efa52d..263937fc743c 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -32,10 +32,7 @@ from typing import overload from . import abc if sys.version_info >= (3, 6): - from typing import ( - Collection as Collection, - AsyncGenerator as AsyncGenerator, - ) + from typing import Collection as Collection, AsyncGenerator as AsyncGenerator if sys.version_info >= (3, 5): from typing import ( Awaitable as Awaitable, @@ -44,24 +41,38 @@ if sys.version_info >= (3, 5): AsyncIterator as AsyncIterator, ) -_S = TypeVar('_S') -_T = TypeVar('_T') -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') - +_S = TypeVar("_S") +_T = TypeVar("_T") +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") # namedtuple is special-cased in the type checker; the initializer is ignored. if sys.version_info >= (3, 7): - def namedtuple(typename: str, field_names: Union[str, Iterable[str]], *, - rename: bool = ..., module: Optional[str] = ..., defaults: Optional[Iterable[Any]] = ...) -> Type[tuple]: ... + def namedtuple( + typename: str, + field_names: Union[str, Iterable[str]], + *, + rename: bool = ..., + module: Optional[str] = ..., + defaults: Optional[Iterable[Any]] = ... + ) -> Type[tuple]: ... + elif sys.version_info >= (3, 6): - def namedtuple(typename: str, field_names: Union[str, Iterable[str]], *, - verbose: bool = ..., rename: bool = ..., module: Optional[str] = ...) -> Type[tuple]: ... + def namedtuple( + typename: str, + field_names: Union[str, Iterable[str]], + *, + verbose: bool = ..., + rename: bool = ..., + module: Optional[str] = ... + ) -> Type[tuple]: ... + else: - def namedtuple(typename: str, field_names: Union[str, Iterable[str]], - verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ... + def namedtuple( + typename: str, field_names: Union[str, Iterable[str]], verbose: bool = ..., rename: bool = ... + ) -> Type[tuple]: ... -_UserDictT = TypeVar('_UserDictT', bound=UserDict) +_UserDictT = TypeVar("_UserDictT", bound=UserDict) class UserDict(MutableMapping[_KT, _VT]): data: Dict[_KT, _VT] @@ -76,7 +87,7 @@ class UserDict(MutableMapping[_KT, _VT]): @classmethod def fromkeys(cls: Type[_UserDictT], iterable: Iterable[_KT], value: Optional[_VT] = ...) -> _UserDictT: ... -_UserListT = TypeVar('_UserListT', bound=UserList) +_UserListT = TypeVar("_UserListT", bound=UserList) class UserList(MutableSequence[_T]): data: List[_T] @@ -112,7 +123,7 @@ class UserList(MutableSequence[_T]): def sort(self, *args: Any, **kwds: Any) -> None: ... def extend(self, other: Iterable[_T]) -> None: ... -_UserStringT = TypeVar('_UserStringT', bound=UserString) +_UserStringT = TypeVar("_UserStringT", bound=UserString) class UserString(Sequence[str]): data: str @@ -170,7 +181,9 @@ class UserString(Sequence[str]): @overload def maketrans(x: str, y: str, z: str = ...) -> Dict[int, Union[int, None]]: ... def partition(self, sep: str) -> Tuple[str, str, str]: ... - def replace(self: _UserStringT, old: Union[str, UserString], new: Union[str, UserString], maxsplit: int = ...) -> _UserStringT: ... + def replace( + self: _UserStringT, old: Union[str, UserString], new: Union[str, UserString], maxsplit: int = ... + ) -> _UserStringT: ... def rfind(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ... def rindex(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ... def rjust(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ... @@ -187,15 +200,13 @@ class UserString(Sequence[str]): def upper(self: _UserStringT) -> _UserStringT: ... def zfill(self: _UserStringT, width: int) -> _UserStringT: ... - # Technically, deque only derives from MutableSequence in 3.5 (before then, the insert and index # methods did not exist). # But in practice it's not worth losing sleep over. class deque(MutableSequence[_T], Generic[_T]): @property def maxlen(self) -> Optional[int]: ... - def __init__(self, iterable: Iterable[_T] = ..., - maxlen: Optional[int] = ...) -> None: ... + def __init__(self, iterable: Iterable[_T] = ..., maxlen: Optional[int] = ...) -> None: ... def append(self, x: _T) -> None: ... def appendleft(self, x: _T) -> None: ... def clear(self) -> None: ... @@ -211,12 +222,10 @@ class deque(MutableSequence[_T], Generic[_T]): def remove(self, value: _T) -> None: ... def reverse(self) -> None: ... def rotate(self, n: int) -> None: ... - def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... def __str__(self) -> str: ... def __hash__(self) -> int: ... - # These methods of deque don't really take slices, but we need to # define them as taking a slice to satisfy MutableSequence. @overload @@ -234,18 +243,15 @@ class deque(MutableSequence[_T], Generic[_T]): @overload def __delitem__(self, s: slice) -> None: raise TypeError - def __contains__(self, o: object) -> bool: ... def __reversed__(self) -> Iterator[_T]: ... - def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ... - if sys.version_info >= (3, 5): def __add__(self, other: deque[_T]) -> deque[_T]: ... def __mul__(self, other: int) -> deque[_T]: ... def __imul__(self, other: int) -> None: ... -_CounterT = TypeVar('_CounterT', bound=Counter) +_CounterT = TypeVar("_CounterT", bound=Counter) class Counter(Dict[_T, int], Generic[_T]): @overload @@ -256,14 +262,11 @@ class Counter(Dict[_T, int], Generic[_T]): def __init__(self, iterable: Iterable[_T]) -> None: ... def copy(self: _CounterT) -> _CounterT: ... def elements(self) -> Iterator[_T]: ... - def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ... - @overload def subtract(self, __mapping: Mapping[_T, int]) -> None: ... @overload def subtract(self, iterable: Iterable[_T]) -> None: ... - # The Iterable[Tuple[...]] argument type is not actually desirable # (the tuples will be added as keys, breaking type safety) but # it's included so that the signature is compatible with @@ -275,7 +278,6 @@ class Counter(Dict[_T, int], Generic[_T]): def update(self, __m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ... @overload def update(self, **kwargs: int) -> None: ... - def __add__(self, other: Counter[_T]) -> Counter[_T]: ... def __sub__(self, other: Counter[_T]) -> Counter[_T]: ... def __and__(self, other: Counter[_T]) -> Counter[_T]: ... @@ -287,12 +289,14 @@ class Counter(Dict[_T, int], Generic[_T]): def __iand__(self, other: Counter[_T]) -> Counter[_T]: ... def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... -_OrderedDictT = TypeVar('_OrderedDictT', bound=OrderedDict) +_OrderedDictT = TypeVar("_OrderedDictT", bound=OrderedDict) class _OrderedDictKeysView(KeysView[_KT], Reversible[_KT]): def __reversed__(self) -> Iterator[_KT]: ... + class _OrderedDictItemsView(ItemsView[_KT, _VT], Reversible[Tuple[_KT, _VT]]): def __reversed__(self) -> Iterator[Tuple[_KT, _VT]]: ... + class _OrderedDictValuesView(ValuesView[_VT], Reversible[_VT]): def __reversed__(self) -> Iterator[_VT]: ... @@ -305,11 +309,10 @@ class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): def items(self) -> _OrderedDictItemsView[_KT, _VT]: ... def values(self) -> _OrderedDictValuesView[_VT]: ... -_DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict) +_DefaultDictT = TypeVar("_DefaultDictT", bound=defaultdict) class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): default_factory: Optional[Callable[[], _VT]] - @overload def __init__(self, **kwargs: _VT) -> None: ... @overload @@ -317,32 +320,26 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): @overload def __init__(self, default_factory: Optional[Callable[[], _VT]], **kwargs: _VT) -> None: ... @overload - def __init__(self, default_factory: Optional[Callable[[], _VT]], - map: Mapping[_KT, _VT]) -> None: ... + def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT]) -> None: ... @overload - def __init__(self, default_factory: Optional[Callable[[], _VT]], - map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... + def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ... @overload - def __init__(self, default_factory: Optional[Callable[[], _VT]], - iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... + def __init__(self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]]) -> None: ... @overload - def __init__(self, default_factory: Optional[Callable[[], _VT]], - iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ... + def __init__( + self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT + ) -> None: ... def __missing__(self, key: _KT) -> _VT: ... # TODO __reversed__ def copy(self: _DefaultDictT) -> _DefaultDictT: ... class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ... - @property def maps(self) -> List[Mapping[_KT, _VT]]: ... - def new_child(self, m: Mapping[_KT, _VT] = ...) -> typing.ChainMap[_KT, _VT]: ... - @property def parents(self) -> typing.ChainMap[_KT, _VT]: ... - def __setitem__(self, k: _KT, v: _VT) -> None: ... def __delitem__(self, v: _KT) -> None: ... def __getitem__(self, k: _KT) -> _VT: ... diff --git a/stdlib/3/collections/abc.pyi b/stdlib/3/collections/abc.pyi index 8c45a0c02120..3792992bcb4e 100644 --- a/stdlib/3/collections/abc.pyi +++ b/stdlib/3/collections/abc.pyi @@ -31,8 +31,4 @@ if sys.version_info >= (3, 5): ) if sys.version_info >= (3, 6): - from . import ( - Collection as Collection, - Reversible as Reversible, - AsyncGenerator as AsyncGenerator, - ) + from . import Collection as Collection, Reversible as Reversible, AsyncGenerator as AsyncGenerator diff --git a/stdlib/3/compileall.pyi b/stdlib/3/compileall.pyi index b3761f1805a4..11524d44086b 100644 --- a/stdlib/3/compileall.pyi +++ b/stdlib/3/compileall.pyi @@ -13,8 +13,39 @@ else: # rx can be any object with a 'search' method; once we have Protocols we can change the type if sys.version_info < (3, 5): - def compile_dir(dir: _Path, maxlevels: int = ..., ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> _SuccessType: ... + def compile_dir( + dir: _Path, + maxlevels: int = ..., + ddir: Optional[_Path] = ..., + force: bool = ..., + rx: Optional[Pattern] = ..., + quiet: int = ..., + legacy: bool = ..., + optimize: int = ..., + ) -> _SuccessType: ... + else: - def compile_dir(dir: _Path, maxlevels: int = ..., ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ..., workers: int = ...) -> _SuccessType: ... -def compile_file(fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> _SuccessType: ... -def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> _SuccessType: ... + def compile_dir( + dir: _Path, + maxlevels: int = ..., + ddir: Optional[_Path] = ..., + force: bool = ..., + rx: Optional[Pattern] = ..., + quiet: int = ..., + legacy: bool = ..., + optimize: int = ..., + workers: int = ..., + ) -> _SuccessType: ... + +def compile_file( + fullname: _Path, + ddir: Optional[_Path] = ..., + force: bool = ..., + rx: Optional[Pattern] = ..., + quiet: int = ..., + legacy: bool = ..., + optimize: int = ..., +) -> _SuccessType: ... +def compile_path( + skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ... +) -> _SuccessType: ... diff --git a/stdlib/3/concurrent/futures/_base.pyi b/stdlib/3/concurrent/futures/_base.pyi index 1c1695784387..51cd67d45e3d 100644 --- a/stdlib/3/concurrent/futures/_base.pyi +++ b/stdlib/3/concurrent/futures/_base.pyi @@ -16,7 +16,7 @@ class Error(Exception): ... class CancelledError(Error): ... class TimeoutError(Error): ... -_T = TypeVar('_T') +_T = TypeVar("_T") class Future(Generic[_T]): def __init__(self) -> None: ... @@ -28,7 +28,6 @@ class Future(Generic[_T]): def result(self, timeout: Optional[float] = ...) -> _T: ... def set_running_or_notify_cancel(self) -> bool: ... def set_result(self, result: _T) -> None: ... - if sys.version_info >= (3,): def exception(self, timeout: Optional[float] = ...) -> Optional[BaseException]: ... def set_exception(self, exception: Optional[BaseException]) -> None: ... @@ -38,19 +37,19 @@ class Future(Generic[_T]): def set_exception(self, exception: Any) -> None: ... def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ... - class Executor: def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... if sys.version_info >= (3, 5): - def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., - chunksize: int = ...) -> Iterator[_T]: ... + def map( + self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ... + ) -> Iterator[_T]: ... else: - def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...,) -> Iterator[_T]: ... + def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ... def shutdown(self, wait: bool = ...) -> None: ... def __enter__(self: _T) -> _T: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool: ... def as_completed(fs: Iterable[Future[_T]], timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ... - -def wait(fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ...) -> Tuple[Set[Future[_T]], - Set[Future[_T]]]: ... +def wait( + fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ... +) -> Tuple[Set[Future[_T]], Set[Future[_T]]]: ... diff --git a/stdlib/3/concurrent/futures/process.pyi b/stdlib/3/concurrent/futures/process.pyi index f5d3e0f4b479..37da1e11cf42 100644 --- a/stdlib/3/concurrent/futures/process.pyi +++ b/stdlib/3/concurrent/futures/process.pyi @@ -10,9 +10,13 @@ if sys.version_info >= (3,): if sys.version_info >= (3, 7): class ProcessPoolExecutor(Executor): - def __init__(self, max_workers: Optional[int] = ..., - initializer: Optional[Callable[..., None]] = ..., - initargs: Tuple[Any, ...] = ...) -> None: ... + def __init__( + self, + max_workers: Optional[int] = ..., + initializer: Optional[Callable[..., None]] = ..., + initargs: Tuple[Any, ...] = ..., + ) -> None: ... + else: class ProcessPoolExecutor(Executor): def __init__(self, max_workers: Optional[int] = ...) -> None: ... diff --git a/stdlib/3/concurrent/futures/thread.pyi b/stdlib/3/concurrent/futures/thread.pyi index 44dac203675b..e37cbc5b97e7 100644 --- a/stdlib/3/concurrent/futures/thread.pyi +++ b/stdlib/3/concurrent/futures/thread.pyi @@ -5,12 +5,14 @@ from ._base import Executor, Future class ThreadPoolExecutor(Executor): if sys.version_info >= (3, 7): - def __init__(self, max_workers: Optional[int] = ..., - thread_name_prefix: str = ..., - initializer: Optional[Callable[..., None]] = ..., - initargs: Tuple[Any, ...] = ...) -> None: ... + def __init__( + self, + max_workers: Optional[int] = ..., + thread_name_prefix: str = ..., + initializer: Optional[Callable[..., None]] = ..., + initargs: Tuple[Any, ...] = ..., + ) -> None: ... elif sys.version_info >= (3, 6) or sys.version_info < (3,): - def __init__(self, max_workers: Optional[int] = ..., - thread_name_prefix: str = ...) -> None: ... + def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ... else: def __init__(self, max_workers: Optional[int] = ...) -> None: ... diff --git a/stdlib/3/configparser.pyi b/stdlib/3/configparser.pyi index f7cb01b4910c..b2fdfcd712e2 100644 --- a/stdlib/3/configparser.pyi +++ b/stdlib/3/configparser.pyi @@ -2,6 +2,7 @@ # reading configparser.py. import sys + # Types only used in type comments only from typing import ( # noqa IO, @@ -32,7 +33,7 @@ _section = Mapping[str, str] _parser = MutableMapping[str, _section] _converter = Callable[[str], Any] _converters = Dict[str, _converter] -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3, 7): _Path = Union[str, bytes, PathLike[str]] @@ -45,126 +46,99 @@ DEFAULTSECT: str MAX_INTERPOLATION_DEPTH: int class Interpolation: - def before_get(self, parser: _parser, - section: str, - option: str, - value: str, - defaults: _section) -> str: ... - - def before_set(self, parser: _parser, - section: str, - option: str, - value: str) -> str: ... - - def before_read(self, parser: _parser, - section: str, - option: str, - value: str) -> str: ... - - def before_write(self, parser: _parser, - section: str, - option: str, - value: str) -> str: ... - + def before_get(self, parser: _parser, section: str, option: str, value: str, defaults: _section) -> str: ... + def before_set(self, parser: _parser, section: str, option: str, value: str) -> str: ... + def before_read(self, parser: _parser, section: str, option: str, value: str) -> str: ... + def before_write(self, parser: _parser, section: str, option: str, value: str) -> str: ... class BasicInterpolation(Interpolation): ... class ExtendedInterpolation(Interpolation): ... class LegacyInterpolation(Interpolation): ... - class RawConfigParser(_parser): - def __init__(self, - defaults: Optional[_section] = ..., - dict_type: Type[Mapping[str, str]] = ..., - allow_no_value: bool = ..., - *, - delimiters: Sequence[str] = ..., - comment_prefixes: Sequence[str] = ..., - inline_comment_prefixes: Optional[Sequence[str]] = ..., - strict: bool = ..., - empty_lines_in_values: bool = ..., - default_section: str = ..., - interpolation: Optional[Interpolation] = ...) -> None: ... - + def __init__( + self, + defaults: Optional[_section] = ..., + dict_type: Type[Mapping[str, str]] = ..., + allow_no_value: bool = ..., + *, + delimiters: Sequence[str] = ..., + comment_prefixes: Sequence[str] = ..., + inline_comment_prefixes: Optional[Sequence[str]] = ..., + strict: bool = ..., + empty_lines_in_values: bool = ..., + default_section: str = ..., + interpolation: Optional[Interpolation] = ... + ) -> None: ... def __len__(self) -> int: ... - def __getitem__(self, section: str) -> SectionProxy: ... - def __setitem__(self, section: str, options: _section) -> None: ... - def __delitem__(self, section: str) -> None: ... - def __iter__(self) -> Iterator[str]: ... - def defaults(self) -> _section: ... - def sections(self) -> List[str]: ... - def add_section(self, section: str) -> None: ... - def has_section(self, section: str) -> bool: ... - def options(self, section: str) -> List[str]: ... - def has_option(self, section: str, option: str) -> bool: ... - - def read(self, filenames: Union[_Path, Iterable[_Path]], - encoding: Optional[str] = ...) -> List[str]: ... + def read(self, filenames: Union[_Path, Iterable[_Path]], encoding: Optional[str] = ...) -> List[str]: ... def read_file(self, f: Iterable[str], source: Optional[str] = ...) -> None: ... def read_string(self, string: str, source: str = ...) -> None: ... - def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], - source: str = ...) -> None: ... + def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = ...) -> None: ... def readfp(self, fp: Iterable[str], filename: Optional[str] = ...) -> None: ... - # These get* methods are partially applied (with the same names) in # SectionProxy; the stubs should be kept updated together - def getint(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: int = ...) -> int: ... - - def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: float = ...) -> float: ... - - def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: bool = ...) -> bool: ... - - def _get_conv(self, section: str, option: str, conv: Callable[[str], _T], *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T = ...) -> _T: ... - + def getint( + self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: int = ... + ) -> int: ... + def getfloat( + self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: float = ... + ) -> float: ... + def getboolean( + self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: bool = ... + ) -> bool: ... + def _get_conv( + self, + section: str, + option: str, + conv: Callable[[str], _T], + *, + raw: bool = ..., + vars: Optional[_section] = ..., + fallback: _T = ... + ) -> _T: ... # This is incompatible with MutableMapping so we ignore the type @overload # type: ignore def get(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ...) -> str: ... - @overload # type: ignore - def get(self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T) -> Union[str, _T]: ... - + def get( + self, section: str, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: _T + ) -> Union[str, _T]: ... @overload def items(self, *, raw: bool = ..., vars: Optional[_section] = ...) -> AbstractSet[Tuple[str, SectionProxy]]: ... - @overload def items(self, section: str, raw: bool = ..., vars: Optional[_section] = ...) -> List[Tuple[str, str]]: ... - def set(self, section: str, option: str, value: str) -> None: ... - - def write(self, - fileobject: IO[str], - space_around_delimiters: bool = ...) -> None: ... - + def write(self, fileobject: IO[str], space_around_delimiters: bool = ...) -> None: ... def remove_option(self, section: str, option: str) -> bool: ... - def remove_section(self, section: str) -> bool: ... - def optionxform(self, option: str) -> str: ... - class ConfigParser(RawConfigParser): - def __init__(self, - defaults: Optional[_section] = ..., - dict_type: Type[Mapping[str, str]] = ..., - allow_no_value: bool = ..., - delimiters: Sequence[str] = ..., - comment_prefixes: Sequence[str] = ..., - inline_comment_prefixes: Optional[Sequence[str]] = ..., - strict: bool = ..., - empty_lines_in_values: bool = ..., - default_section: str = ..., - interpolation: Optional[Interpolation] = ..., - converters: _converters = ...) -> None: ... + def __init__( + self, + defaults: Optional[_section] = ..., + dict_type: Type[Mapping[str, str]] = ..., + allow_no_value: bool = ..., + delimiters: Sequence[str] = ..., + comment_prefixes: Sequence[str] = ..., + inline_comment_prefixes: Optional[Sequence[str]] = ..., + strict: bool = ..., + empty_lines_in_values: bool = ..., + default_section: str = ..., + interpolation: Optional[Interpolation] = ..., + converters: _converters = ..., + ) -> None: ... class SafeConfigParser(ConfigParser): ... @@ -180,14 +154,14 @@ class SectionProxy(MutableMapping[str, str]): def parser(self) -> RawConfigParser: ... @property def name(self) -> str: ... - def get(self, option: str, fallback: Optional[str] = ..., *, raw: bool = ..., vars: Optional[_section] = ..., **kwargs: Any) -> str: ... # type: ignore - + def get( + self, option: str, fallback: Optional[str] = ..., *, raw: bool = ..., vars: Optional[_section] = ..., **kwargs: Any + ) -> str: ... # type: ignore # These are partially-applied version of the methods with the same names in # RawConfigParser; the stubs should be kept updated together def getint(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: int = ...) -> int: ... def getfloat(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: float = ...) -> float: ... def getboolean(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: bool = ...) -> bool: ... - # SectionProxy can have arbitrary attributes when custon converters are used def __getattr__(self, key: str) -> Callable[..., Any]: ... @@ -200,51 +174,39 @@ class ConverterMapping(MutableMapping[str, Optional[_converter]]): def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... - class Error(Exception): ... - - class NoSectionError(Error): ... - class DuplicateSectionError(Error): section: str source: Optional[str] lineno: Optional[int] - class DuplicateOptionError(Error): section: str option: str source: Optional[str] lineno: Optional[int] - class NoOptionError(Error): section: str option: str - class InterpolationError(Error): section: str option: str - class InterpolationDepthError(InterpolationError): ... - class InterpolationMissingOptionError(InterpolationError): reference: str - class InterpolationSyntaxError(InterpolationError): ... - class ParsingError(Error): source: str errors: Sequence[Tuple[int, str]] - class MissingSectionHeaderError(ParsingError): lineno: int line: str diff --git a/stdlib/3/email/charset.pyi b/stdlib/3/email/charset.pyi index 6c912d432243..7399d076e972 100644 --- a/stdlib/3/email/charset.pyi +++ b/stdlib/3/email/charset.pyi @@ -17,15 +17,14 @@ class Charset: def get_body_encoding(self) -> str: ... def get_output_charset(self) -> Optional[str]: ... def header_encode(self, string: str) -> str: ... - def header_encode_lines(self, string: str, - maxlengths: Iterator[int]) -> List[str]: ... + def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> List[str]: ... def body_encode(self, string: str) -> str: ... def __str__(self) -> str: ... def __eq__(self, other: Any) -> bool: ... def __ne__(self, other: Any) -> bool: ... -def add_charset(charset: str, header_enc: Optional[int] = ..., - body_enc: Optional[int] = ..., - output_charset: Optional[str] = ...) -> None: ... +def add_charset( + charset: str, header_enc: Optional[int] = ..., body_enc: Optional[int] = ..., output_charset: Optional[str] = ... +) -> None: ... def add_alias(alias: str, canonical: str) -> None: ... def add_codec(charset: str, codecname: str) -> None: ... diff --git a/stdlib/3/email/contentmanager.pyi b/stdlib/3/email/contentmanager.pyi index 460c36419a6b..e61399ef6374 100644 --- a/stdlib/3/email/contentmanager.pyi +++ b/stdlib/3/email/contentmanager.pyi @@ -6,10 +6,8 @@ from typing import Any, Callable class ContentManager: def __init__(self) -> None: ... def get_content(self, msg: Message, *args: Any, **kw: Any) -> Any: ... - def set_content(self, msg: Message, obj: Any, *args: Any, - **kw: Any) -> Any: ... + def set_content(self, msg: Message, obj: Any, *args: Any, **kw: Any) -> Any: ... def add_get_handler(self, key: str, handler: Callable[..., Any]) -> None: ... - def add_set_handler(self, typekey: type, - handler: Callable[..., Any]) -> None: ... + def add_set_handler(self, typekey: type, handler: Callable[..., Any]) -> None: ... raw_data_manager: ContentManager diff --git a/stdlib/3/email/errors.pyi b/stdlib/3/email/errors.pyi index 77d9902cca20..03b6858d61df 100644 --- a/stdlib/3/email/errors.pyi +++ b/stdlib/3/email/errors.pyi @@ -5,7 +5,6 @@ class MessageParseError(MessageError): ... class HeaderParseError(MessageParseError): ... class BoundaryError(MessageParseError): ... class MultipartConversionError(MessageError, TypeError): ... - class MessageDefect(ValueError): ... class NoBoundaryInMultipartDefect(MessageDefect): ... class StartBoundaryNotFoundDefect(MessageDefect): ... diff --git a/stdlib/3/email/feedparser.pyi b/stdlib/3/email/feedparser.pyi index 313060dd7323..7e83233e0f3d 100644 --- a/stdlib/3/email/feedparser.pyi +++ b/stdlib/3/email/feedparser.pyi @@ -6,13 +6,11 @@ from email.policy import Policy from typing import Callable class FeedParser: - def __init__(self, _factory: Callable[[], Message] = ..., *, - policy: Policy = ...) -> None: ... + def __init__(self, _factory: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... def feed(self, data: str) -> None: ... def close(self) -> Message: ... class BytesFeedParser: - def __init__(self, _factory: Callable[[], Message] = ..., *, - policy: Policy = ...) -> None: ... + def __init__(self, _factory: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... def feed(self, data: str) -> None: ... def close(self) -> Message: ... diff --git a/stdlib/3/email/generator.pyi b/stdlib/3/email/generator.pyi index 97eaff96f735..6796de0747d7 100644 --- a/stdlib/3/email/generator.pyi +++ b/stdlib/3/email/generator.pyi @@ -7,21 +7,14 @@ from typing import Optional, TextIO class Generator: def clone(self, fp: TextIO) -> Generator: ... def write(self, s: str) -> None: ... - def __init__(self, outfp: TextIO, mangle_from_: bool = ..., - maxheaderlen: int = ..., *, - policy: Policy = ...) -> None: ... - def flatten(self, msg: Message, unixfrom: bool = ..., - linesep: Optional[str] = ...) -> None: ... + def __init__(self, outfp: TextIO, mangle_from_: bool = ..., maxheaderlen: int = ..., *, policy: Policy = ...) -> None: ... + def flatten(self, msg: Message, unixfrom: bool = ..., linesep: Optional[str] = ...) -> None: ... class BytesGenerator: def clone(self, fp: TextIO) -> Generator: ... def write(self, s: str) -> None: ... - def __init__(self, outfp: TextIO, mangle_from_: bool = ..., - maxheaderlen: int = ..., *, - policy: Policy = ...) -> None: ... - def flatten(self, msg: Message, unixfrom: bool = ..., - linesep: Optional[str] = ...) -> None: ... + def __init__(self, outfp: TextIO, mangle_from_: bool = ..., maxheaderlen: int = ..., *, policy: Policy = ...) -> None: ... + def flatten(self, msg: Message, unixfrom: bool = ..., linesep: Optional[str] = ...) -> None: ... class DecodedGenerator(Generator): - def __init__(self, outfp: TextIO, mangle_from_: bool = ..., - maxheaderlen: int = ..., *, fmt: Optional[str] = ...) -> None: ... + def __init__(self, outfp: TextIO, mangle_from_: bool = ..., maxheaderlen: int = ..., *, fmt: Optional[str] = ...) -> None: ... diff --git a/stdlib/3/email/header.pyi b/stdlib/3/email/header.pyi index 8dc3f608acbb..b4d56aca9d03 100644 --- a/stdlib/3/email/header.pyi +++ b/stdlib/3/email/header.pyi @@ -4,22 +4,25 @@ from email.charset import Charset from typing import Any, List, Optional, Tuple, Union class Header: - def __init__(self, s: Union[bytes, str, None] = ..., - charset: Union[Charset, str, None] = ..., - maxlinelen: Optional[int] = ..., - header_name: Optional[str] = ..., continuation_ws: str = ..., - errors: str = ...) -> None: ... - def append(self, s: Union[bytes, str], - charset: Union[Charset, str, None] = ..., - errors: str = ...) -> None: ... - def encode(self, splitchars: str = ..., maxlinelen: Optional[int] = ..., - linesep: str = ...) -> str: ... + def __init__( + self, + s: Union[bytes, str, None] = ..., + charset: Union[Charset, str, None] = ..., + maxlinelen: Optional[int] = ..., + header_name: Optional[str] = ..., + continuation_ws: str = ..., + errors: str = ..., + ) -> None: ... + def append(self, s: Union[bytes, str], charset: Union[Charset, str, None] = ..., errors: str = ...) -> None: ... + def encode(self, splitchars: str = ..., maxlinelen: Optional[int] = ..., linesep: str = ...) -> str: ... def __str__(self) -> str: ... def __eq__(self, other: Any) -> bool: ... def __ne__(self, other: Any) -> bool: ... def decode_header(header: Union[Header, str]) -> List[Tuple[bytes, Optional[str]]]: ... -def make_header(decoded_seq: List[Tuple[bytes, Optional[str]]], - maxlinelen: Optional[int] = ..., - header_name: Optional[str] = ..., - continuation_ws: str = ...) -> Header: ... +def make_header( + decoded_seq: List[Tuple[bytes, Optional[str]]], + maxlinelen: Optional[int] = ..., + header_name: Optional[str] = ..., + continuation_ws: str = ..., +) -> Header: ... diff --git a/stdlib/3/email/headerregistry.pyi b/stdlib/3/email/headerregistry.pyi index 40822fab95b7..78248d723444 100644 --- a/stdlib/3/email/headerregistry.pyi +++ b/stdlib/3/email/headerregistry.pyi @@ -25,8 +25,7 @@ class UniqueUnstructuredHeader(UnstructuredHeader): ... class DateHeader: datetime: _datetime @classmethod - def parse(cls, string: Union[str, _datetime], - kwds: Dict[str, Any]) -> None: ... + def parse(cls, string: Union[str, _datetime], kwds: Dict[str, Any]) -> None: ... class UniqueDateHeader(DateHeader): ... @@ -70,9 +69,7 @@ class ContentTransferEncodingHeader: def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ... class HeaderRegistry: - def __init__(self, base_class: BaseHeader = ..., - default_class: BaseHeader = ..., - use_default_map: bool = ...) -> None: ... + def __init__(self, base_class: BaseHeader = ..., default_class: BaseHeader = ..., use_default_map: bool = ...) -> None: ... def map_to_type(self, name: str, cls: BaseHeader) -> None: ... def __getitem__(self, name: str) -> BaseHeader: ... def __call__(self, name: str, value: Any) -> BaseHeader: ... @@ -83,15 +80,13 @@ class Address: domain: str @property def addr_spec(self) -> str: ... - def __init__(self, display_name: str = ..., - username: Optional[str] = ..., - domain: Optional[str] = ..., - addr_spec: Optional[str] = ...) -> None: ... + def __init__( + self, display_name: str = ..., username: Optional[str] = ..., domain: Optional[str] = ..., addr_spec: Optional[str] = ... + ) -> None: ... def __str__(self) -> str: ... class Group: display_name: Optional[str] addresses: Tuple[Address, ...] - def __init__(self, display_name: Optional[str] = ..., - addresses: Optional[Tuple[Address, ...]] = ...) -> None: ... + def __init__(self, display_name: Optional[str] = ..., addresses: Optional[Tuple[Address, ...]] = ...) -> None: ... def __str__(self) -> str: ... diff --git a/stdlib/3/email/iterators.pyi b/stdlib/3/email/iterators.pyi index c07b69c16c76..4f85a6c87163 100644 --- a/stdlib/3/email/iterators.pyi +++ b/stdlib/3/email/iterators.pyi @@ -4,5 +4,4 @@ from email.message import Message from typing import Iterator, Optional def body_line_iterator(msg: Message, decode: bool = ...) -> Iterator[str]: ... -def typed_subpart_iterator(msg: Message, maintype: str = ..., - subtype: Optional[str] = ...) -> Iterator[str]: ... +def typed_subpart_iterator(msg: Message, maintype: str = ..., subtype: Optional[str] = ...) -> Iterator[str]: ... diff --git a/stdlib/3/email/message.pyi b/stdlib/3/email/message.pyi index 61f2bd08f9c2..ec8e009fc702 100644 --- a/stdlib/3/email/message.pyi +++ b/stdlib/3/email/message.pyi @@ -8,7 +8,7 @@ from email.header import Header from email.policy import Policy from typing import Any, Generator, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union -_T = TypeVar('_T') +_T = TypeVar("_T") _PayloadType = Union[List[Message], str, bytes] _CharsetType = Union[Charset, str, None] @@ -26,8 +26,7 @@ class Message: def get_unixfrom(self) -> Optional[str]: ... def attach(self, payload: Message) -> None: ... def get_payload(self, i: int = ..., decode: bool = ...) -> Optional[_PayloadType]: ... - def set_payload(self, payload: _PayloadType, - charset: _CharsetType = ...) -> None: ... + def set_payload(self, payload: _PayloadType, charset: _CharsetType = ...) -> None: ... def set_charset(self, charset: _CharsetType) -> None: ... def get_charset(self) -> _CharsetType: ... def __len__(self) -> int: ... @@ -47,14 +46,10 @@ class Message: def get_content_subtype(self) -> str: ... def get_default_type(self) -> str: ... def set_default_type(self, ctype: str) -> None: ... - def get_params(self, failobj: _T = ..., header: str = ..., - unquote: bool = ...) -> Union[List[Tuple[str, str]], _T]: ... - def get_param(self, param: str, failobj: _T = ..., header: str = ..., - unquote: bool = ...) -> Union[_T, _ParamType]: ... - def del_param(self, param: str, header: str = ..., - requote: bool = ...) -> None: ... - def set_type(self, type: str, header: str = ..., - requote: bool = ...) -> None: ... + def get_params(self, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> Union[List[Tuple[str, str]], _T]: ... + def get_param(self, param: str, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> Union[_T, _ParamType]: ... + def del_param(self, param: str, header: str = ..., requote: bool = ...) -> None: ... + def set_type(self, type: str, header: str = ..., requote: bool = ...) -> None: ... def get_filename(self, failobj: _T = ...) -> Union[_T, str]: ... def get_boundary(self, failobj: _T = ...) -> Union[_T, str]: ... def set_boundary(self, boundary: str) -> None: ... @@ -63,39 +58,33 @@ class Message: def walk(self) -> Generator[Message, None, None]: ... if sys.version_info >= (3, 5): def get_content_disposition(self) -> Optional[str]: ... - def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ..., - policy: Optional[Policy] = ...) -> str: ... - def as_bytes(self, unixfrom: bool = ..., - policy: Optional[Policy] = ...) -> bytes: ... + def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ..., policy: Optional[Policy] = ...) -> str: ... + def as_bytes(self, unixfrom: bool = ..., policy: Optional[Policy] = ...) -> bytes: ... def __bytes__(self) -> bytes: ... - def set_param(self, param: str, value: str, header: str = ..., - requote: bool = ..., charset: str = ..., - language: str = ..., replace: bool = ...) -> None: ... + def set_param( + self, + param: str, + value: str, + header: str = ..., + requote: bool = ..., + charset: str = ..., + language: str = ..., + replace: bool = ..., + ) -> None: ... def __init__(self, policy: Policy = ...) -> None: ... class MIMEPart(Message): - def get_body(self, - preferencelist: Sequence[str] = ...) -> Optional[Message]: ... + def get_body(self, preferencelist: Sequence[str] = ...) -> Optional[Message]: ... def iter_attachments(self) -> Iterator[Message]: ... def iter_parts(self) -> Iterator[Message]: ... - def get_content(self, *args: Any, - content_manager: Optional[ContentManager] = ..., - **kw: Any) -> Any: ... - def set_content(self, *args: Any, - content_manager: Optional[ContentManager] = ..., - **kw: Any) -> None: ... + def get_content(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> Any: ... + def set_content(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> None: ... def make_related(self, boundary: Optional[str] = ...) -> None: ... def make_alternative(self, boundary: Optional[str] = ...) -> None: ... def make_mixed(self, boundary: Optional[str] = ...) -> None: ... - def add_related(self, *args: Any, - content_manager: Optional[ContentManager] = ..., - **kw: Any) -> None: ... - def add_alternative(self, *args: Any, - content_manager: Optional[ContentManager] = ..., - **kw: Any) -> None: ... - def add_attachment(self, *args: Any, - content_manager: Optional[ContentManager] = ..., - **kw: Any) -> None: ... + def add_related(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> None: ... + def add_alternative(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> None: ... + def add_attachment(self, *args: Any, content_manager: Optional[ContentManager] = ..., **kw: Any) -> None: ... def clear(self) -> None: ... def clear_content(self) -> None: ... def is_attachment(self) -> bool: ... diff --git a/stdlib/3/email/mime/application.pyi b/stdlib/3/email/mime/application.pyi index 2817b786d907..13fad4e3c339 100644 --- a/stdlib/3/email/mime/application.pyi +++ b/stdlib/3/email/mime/application.pyi @@ -6,6 +6,10 @@ from typing import Callable, Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] class MIMEApplication(MIMENonMultipart): - def __init__(self, _data: Union[str, bytes], _subtype: str = ..., - _encoder: Callable[[MIMEApplication], None] = ..., - **_params: _ParamsType) -> None: ... + def __init__( + self, + _data: Union[str, bytes], + _subtype: str = ..., + _encoder: Callable[[MIMEApplication], None] = ..., + **_params: _ParamsType + ) -> None: ... diff --git a/stdlib/3/email/mime/audio.pyi b/stdlib/3/email/mime/audio.pyi index 4fb01f5ed40b..3159081e2847 100644 --- a/stdlib/3/email/mime/audio.pyi +++ b/stdlib/3/email/mime/audio.pyi @@ -6,6 +6,10 @@ from typing import Callable, Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] class MIMEAudio(MIMENonMultipart): - def __init__(self, _audiodata: Union[str, bytes], _subtype: Optional[str] = ..., - _encoder: Callable[[MIMEAudio], None] = ..., - **_params: _ParamsType) -> None: ... + def __init__( + self, + _audiodata: Union[str, bytes], + _subtype: Optional[str] = ..., + _encoder: Callable[[MIMEAudio], None] = ..., + **_params: _ParamsType + ) -> None: ... diff --git a/stdlib/3/email/mime/base.pyi b/stdlib/3/email/mime/base.pyi index 8a0470bdbb4e..9c3c22472a11 100644 --- a/stdlib/3/email/mime/base.pyi +++ b/stdlib/3/email/mime/base.pyi @@ -6,5 +6,4 @@ from typing import Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] class MIMEBase(email.message.Message): - def __init__(self, _maintype: str, _subtype: str, - **_params: _ParamsType) -> None: ... + def __init__(self, _maintype: str, _subtype: str, **_params: _ParamsType) -> None: ... diff --git a/stdlib/3/email/mime/image.pyi b/stdlib/3/email/mime/image.pyi index c3ae502d3d2a..c82cb5999bbb 100644 --- a/stdlib/3/email/mime/image.pyi +++ b/stdlib/3/email/mime/image.pyi @@ -6,6 +6,10 @@ from typing import Callable, Optional, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] class MIMEImage(MIMENonMultipart): - def __init__(self, _imagedata: Union[str, bytes], _subtype: Optional[str] = ..., - _encoder: Callable[[MIMEImage], None] = ..., - **_params: _ParamsType) -> None: ... + def __init__( + self, + _imagedata: Union[str, bytes], + _subtype: Optional[str] = ..., + _encoder: Callable[[MIMEImage], None] = ..., + **_params: _ParamsType + ) -> None: ... diff --git a/stdlib/3/email/mime/multipart.pyi b/stdlib/3/email/mime/multipart.pyi index f1434b24d241..180bd9645f9b 100644 --- a/stdlib/3/email/mime/multipart.pyi +++ b/stdlib/3/email/mime/multipart.pyi @@ -7,6 +7,10 @@ from typing import Optional, Sequence, Tuple, Union _ParamsType = Union[str, None, Tuple[str, Optional[str], str]] class MIMEMultipart(MIMEBase): - def __init__(self, _subtype: str = ..., boundary: Optional[str] = ..., - _subparts: Optional[Sequence[Message]] = ..., - **_params: _ParamsType) -> None: ... + def __init__( + self, + _subtype: str = ..., + boundary: Optional[str] = ..., + _subparts: Optional[Sequence[Message]] = ..., + **_params: _ParamsType + ) -> None: ... diff --git a/stdlib/3/email/mime/text.pyi b/stdlib/3/email/mime/text.pyi index c5519ccd230b..e64ad2764c09 100644 --- a/stdlib/3/email/mime/text.pyi +++ b/stdlib/3/email/mime/text.pyi @@ -4,5 +4,4 @@ from email.mime.nonmultipart import MIMENonMultipart from typing import Optional class MIMEText(MIMENonMultipart): - def __init__(self, _text: str, _subtype: str = ..., - _charset: Optional[str] = ...) -> None: ... + def __init__(self, _text: str, _subtype: str = ..., _charset: Optional[str] = ...) -> None: ... diff --git a/stdlib/3/email/parser.pyi b/stdlib/3/email/parser.pyi index 180e382ee8e4..03be817d18d8 100644 --- a/stdlib/3/email/parser.pyi +++ b/stdlib/3/email/parser.pyi @@ -9,25 +9,21 @@ FeedParser = email.feedparser.FeedParser BytesFeedParser = email.feedparser.BytesFeedParser class Parser: - def __init__(self, _class: Callable[[], Message] = ..., *, - policy: Policy = ...) -> None: ... + def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ... def parsestr(self, text: str, headersonly: bool = ...) -> Message: ... class HeaderParser(Parser): - def __init__(self, _class: Callable[[], Message] = ..., *, - policy: Policy = ...) -> None: ... + def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ... def parsestr(self, text: str, headersonly: bool = ...) -> Message: ... class BytesHeaderParser(BytesParser): - def __init__(self, _class: Callable[[], Message] = ..., *, - policy: Policy = ...) -> None: ... + def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ... def parsebytes(self, text: bytes, headersonly: bool = ...) -> Message: ... class BytesParser: - def __init__(self, _class: Callable[[], Message] = ..., *, - policy: Policy = ...) -> None: ... + def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ... def parsebytes(self, text: bytes, headersonly: bool = ...) -> Message: ... diff --git a/stdlib/3/email/policy.pyi b/stdlib/3/email/policy.pyi index a56d9d8eaaef..d1a16eab5c89 100644 --- a/stdlib/3/email/policy.pyi +++ b/stdlib/3/email/policy.pyi @@ -17,19 +17,15 @@ class Policy: mange_from: bool def __init__(self, **kw: Any) -> None: ... def clone(self, **kw: Any) -> Policy: ... - def handle_defect(self, obj: Message, - defect: MessageDefect) -> None: ... - def register_defect(self, obj: Message, - defect: MessageDefect) -> None: ... + def handle_defect(self, obj: Message, defect: MessageDefect) -> None: ... + def register_defect(self, obj: Message, defect: MessageDefect) -> None: ... def header_max_count(self, name: str) -> Optional[int]: ... @abstractmethod def header_source_parse(self, sourcelines: List[str]) -> str: ... @abstractmethod - def header_store_parse(self, name: str, - value: str) -> Tuple[str, str]: ... + def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... @abstractmethod - def header_fetch_parse(self, name: str, - value: str) -> str: ... + def header_fetch_parse(self, name: str, value: str) -> str: ... @abstractmethod def fold(self, name: str, value: str) -> str: ... @abstractmethod @@ -37,8 +33,7 @@ class Policy: class Compat32(Policy): def header_source_parse(self, sourcelines: List[str]) -> str: ... - def header_store_parse(self, name: str, - value: str) -> Tuple[str, str]: ... + def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... def header_fetch_parse(self, name: str, value: str) -> Union[str, Header]: ... # type: ignore def fold(self, name: str, value: str) -> str: ... def fold_binary(self, name: str, value: str) -> bytes: ... @@ -51,8 +46,7 @@ class EmailPolicy(Policy): header_factory: Callable[[str, str], str] content_manager: ContentManager def header_source_parse(self, sourcelines: List[str]) -> str: ... - def header_store_parse(self, name: str, - value: str) -> Tuple[str, str]: ... + def header_store_parse(self, name: str, value: str) -> Tuple[str, str]: ... def header_fetch_parse(self, name: str, value: str) -> str: ... def fold(self, name: str, value: str) -> str: ... def fold_binary(self, name: str, value: str) -> bytes: ... diff --git a/stdlib/3/email/utils.pyi b/stdlib/3/email/utils.pyi index 61c90b33ae6e..f83feaec3e33 100644 --- a/stdlib/3/email/utils.pyi +++ b/stdlib/3/email/utils.pyi @@ -10,24 +10,17 @@ _PDTZ = Tuple[int, int, int, int, int, int, int, int, int, Optional[int]] def quote(str: str) -> str: ... def unquote(str: str) -> str: ... def parseaddr(address: Optional[str]) -> Tuple[str, str]: ... -def formataddr(pair: Tuple[Optional[str], str], - charset: Union[str, Charset] = ...) -> str: ... +def formataddr(pair: Tuple[Optional[str], str], charset: Union[str, Charset] = ...) -> str: ... def getaddresses(fieldvalues: List[str]) -> List[Tuple[str, str]]: ... def parsedate(date: str) -> Optional[Tuple[int, int, int, int, int, int, int, int, int]]: ... def parsedate_tz(date: str) -> Optional[_PDTZ]: ... def parsedate_to_datetime(date: str) -> datetime.datetime: ... def mktime_tz(tuple: _PDTZ) -> int: ... -def formatdate(timeval: Optional[float] = ..., localtime: bool = ..., - usegmt: bool = ...) -> str: ... +def formatdate(timeval: Optional[float] = ..., localtime: bool = ..., usegmt: bool = ...) -> str: ... def format_datetime(dt: datetime.datetime, usegmt: bool = ...) -> str: ... def localtime(dt: Optional[datetime.datetime] = ...) -> datetime.datetime: ... -def make_msgid(idstring: Optional[str] = ..., - domain: Optional[str] = ...) -> str: ... +def make_msgid(idstring: Optional[str] = ..., domain: Optional[str] = ...) -> str: ... def decode_rfc2231(s: str) -> Tuple[Optional[str], Optional[str], str]: ... -def encode_rfc2231(s: str, charset: Optional[str] = ..., - language: Optional[str] = ...) -> str: ... -def collapse_rfc2231_value(value: _ParamType, errors: str = ..., - fallback_charset: str = ...) -> str: ... -def decode_params( - params: List[Tuple[str, str]] -) -> List[Tuple[str, _ParamType]]: ... +def encode_rfc2231(s: str, charset: Optional[str] = ..., language: Optional[str] = ...) -> str: ... +def collapse_rfc2231_value(value: _ParamType, errors: str = ..., fallback_charset: str = ...) -> str: ... +def decode_params(params: List[Tuple[str, str]]) -> List[Tuple[str, _ParamType]]: ... diff --git a/stdlib/3/encodings/__init__.pyi b/stdlib/3/encodings/__init__.pyi index 2c8884112d2f..d99d4a57e9ab 100644 --- a/stdlib/3/encodings/__init__.pyi +++ b/stdlib/3/encodings/__init__.pyi @@ -1,5 +1,4 @@ import codecs import typing -def search_function(encoding: str) -> codecs.CodecInfo: - ... +def search_function(encoding: str) -> codecs.CodecInfo: ... diff --git a/stdlib/3/enum.pyi b/stdlib/3/enum.pyi index b472bfa3ce39..946551f2e442 100644 --- a/stdlib/3/enum.pyi +++ b/stdlib/3/enum.pyi @@ -3,8 +3,8 @@ import sys from abc import ABCMeta from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union -_T = TypeVar('_T') -_S = TypeVar('_S', bound=Type[Enum]) +_T = TypeVar("_T") +_S = TypeVar("_S", bound=Type[Enum]) # Note: EnumMeta actually subclasses type directly, not ABCMeta. # This is a temporary workaround to allow multiple creation of enums with builtins @@ -55,7 +55,6 @@ if sys.version_info >= (3, 6): # subclassing IntFlag so it picks up all implemented base functions, best modeling behavior of enum.auto() class auto(IntFlag): value: Any - class Flag(Enum): def __contains__(self: _T, other: _T) -> bool: ... def __repr__(self) -> str: ... @@ -65,7 +64,6 @@ if sys.version_info >= (3, 6): def __and__(self: _T, other: _T) -> _T: ... def __xor__(self: _T, other: _T) -> _T: ... def __invert__(self: _T) -> _T: ... - # The `type: ignore` comment is needed because mypy considers the type # signatures of several methods defined in int and Flag to be incompatible. class IntFlag(int, Flag): # type: ignore diff --git a/stdlib/3/faulthandler.pyi b/stdlib/3/faulthandler.pyi index b60f57896d67..9bf712d85919 100644 --- a/stdlib/3/faulthandler.pyi +++ b/stdlib/3/faulthandler.pyi @@ -4,19 +4,18 @@ from typing import Protocol, Union class _HasFileno(Protocol): def fileno(self) -> int: ... - if sys.version_info >= (3, 5): _File = Union[_HasFileno, int] else: _File = _HasFileno - def cancel_dump_traceback_later() -> None: ... def disable() -> None: ... def dump_traceback(file: _File = ..., all_threads: bool = ...) -> None: ... def dump_traceback_later(timeout: int, repeat: bool = ..., file: _File = ..., exit: bool = ...) -> None: ... def enable(file: _File = ..., all_threads: bool = ...) -> None: ... def is_enabled() -> bool: ... + if sys.platform != "win32": def register(signum: int, file: _File = ..., all_threads: bool = ..., chain: bool = ...) -> None: ... def unregister(signum: int) -> None: ... diff --git a/stdlib/3/fcntl.pyi b/stdlib/3/fcntl.pyi index a2593f119ac4..74bffa1c3f38 100644 --- a/stdlib/3/fcntl.pyi +++ b/stdlib/3/fcntl.pyi @@ -79,18 +79,10 @@ _AnyFile = Union[int, IO[Any], IOBase] # TODO All these return either int or bytes depending on the value of # cmd (not on the type of arg). -def fcntl(fd: _AnyFile, - cmd: int, - arg: Union[int, bytes] = ...) -> Any: ... +def fcntl(fd: _AnyFile, cmd: int, arg: Union[int, bytes] = ...) -> Any: ... + # TODO This function accepts any object supporting a buffer interface, # as arg, is there a better way to express this than bytes? -def ioctl(fd: _AnyFile, - request: int, - arg: Union[int, bytes] = ..., - mutate_flag: bool = ...) -> Any: ... +def ioctl(fd: _AnyFile, request: int, arg: Union[int, bytes] = ..., mutate_flag: bool = ...) -> Any: ... def flock(fd: _AnyFile, operation: int) -> None: ... -def lockf(fd: _AnyFile, - cmd: int, - len: int = ..., - start: int = ..., - whence: int = ...) -> Any: ... +def lockf(fd: _AnyFile, cmd: int, len: int = ..., start: int = ..., whence: int = ...) -> Any: ... diff --git a/stdlib/3/functools.pyi b/stdlib/3/functools.pyi index 5cf9640a4334..df5e24b9e26f 100644 --- a/stdlib/3/functools.pyi +++ b/stdlib/3/functools.pyi @@ -25,19 +25,11 @@ _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") _S = TypeVar("_S") @overload -def reduce(function: Callable[[_T, _S], _T], - sequence: Iterable[_S], initial: _T) -> _T: ... +def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ... @overload -def reduce(function: Callable[[_T, _T], _T], - sequence: Iterable[_T]) -> _T: ... +def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ... - -class _CacheInfo(NamedTuple('CacheInfo', [ - ('hits', int), - ('misses', int), - ('maxsize', int), - ('currsize', int) -])): ... +class _CacheInfo(NamedTuple("CacheInfo", [("hits", int), ("misses", int), ("maxsize", int), ("currsize", int)])): ... class _lru_cache_wrapper(Generic[_T]): __wrapped__: Callable[..., _T] @@ -45,20 +37,21 @@ class _lru_cache_wrapper(Generic[_T]): def cache_info(self) -> _CacheInfo: ... def cache_clear(self) -> None: ... -class lru_cache(): +class lru_cache: def __init__(self, maxsize: Optional[int] = ..., typed: bool = ...) -> None: ... def __call__(self, f: Callable[..., _T]) -> _lru_cache_wrapper[_T]: ... - WRAPPER_ASSIGNMENTS: Sequence[str] WRAPPER_UPDATES: Sequence[str] -def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ..., - updated: Sequence[str] = ...) -> _AnyCallable: ... -def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ... +def update_wrapper( + wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ... +) -> _AnyCallable: ... +def wraps( + wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ... +) -> Callable[[_AnyCallable], _AnyCallable]: ... def total_ordering(cls: type) -> type: ... def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ... - @overload def partial(__func: Callable[[_T], _S], __arg: _T) -> Callable[[], _S]: ... @overload @@ -69,65 +62,32 @@ def partial(__func: Callable[[_T, _T2, _T3], _S], __arg: _T) -> Callable[[_T2, _ def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg: _T) -> Callable[[_T2, _T3, _T4], _S]: ... @overload def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg: _T) -> Callable[[_T2, _T3, _T4, _T5], _S]: ... - @overload -def partial(__func: Callable[[_T, _T2], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[], _S]: ... +def partial(__func: Callable[[_T, _T2], _S], __arg1: _T, __arg2: _T2) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3, _T4], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3, _T4], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[_T4], _S]: ... +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[_T4], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3) -> Callable[[_T4, _T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3) -> Callable[[_T4, _T5], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4) -> Callable[[], _S]: ... -@overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4) -> Callable[[_T5], _S]: ... - +def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4) -> Callable[[], _S]: ... @overload -def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], - __arg1: _T, - __arg2: _T2, - __arg3: _T3, - __arg4: _T4, - __arg5: _T5) -> Callable[[], _S]: ... - +def partial( + __func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4 +) -> Callable[[_T5], _S]: ... @overload -def partial(__func: Callable[..., _S], - *args: Any, - **kwargs: Any) -> Callable[..., _S]: ... +def partial( + __func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg1: _T, __arg2: _T2, __arg3: _T3, __arg4: _T4, __arg5: _T5 +) -> Callable[[], _S]: ... +@overload +def partial(__func: Callable[..., _S], *args: Any, **kwargs: Any) -> Callable[..., _S]: ... # With protocols, this could change into a generic protocol that defines __get__ and returns _T _Descriptor = Any @@ -136,7 +96,6 @@ class partialmethod(Generic[_T]): func: Union[Callable[..., _T], _Descriptor] args: Tuple[Any, ...] keywords: Dict[str, Any] - @overload def __init__(self, func: Callable[..., _T], *args: Any, **keywords: Any) -> None: ... @overload diff --git a/stdlib/3/gc.pyi b/stdlib/3/gc.pyi index a188e8ff215e..87b0a9b94a70 100644 --- a/stdlib/3/gc.pyi +++ b/stdlib/3/gc.pyi @@ -23,5 +23,4 @@ def get_threshold() -> Tuple[int, int, int]: ... def is_tracked(obj: Any) -> bool: ... def isenabled() -> bool: ... def set_debug(flags: int) -> None: ... -def set_threshold(threshold0: int, threshold1: int = ..., - threshold2: int = ...) -> None: ... +def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ...) -> None: ... diff --git a/stdlib/3/getpass.pyi b/stdlib/3/getpass.pyi index f8f5ff4b72df..9a155701fbdd 100644 --- a/stdlib/3/getpass.pyi +++ b/stdlib/3/getpass.pyi @@ -3,9 +3,6 @@ from typing import Optional, TextIO def getpass(prompt: str = ..., stream: Optional[TextIO] = ...) -> str: ... - - def getuser() -> str: ... - class GetPassWarning(UserWarning): ... diff --git a/stdlib/3/gettext.pyi b/stdlib/3/gettext.pyi index 355ecbdd9a62..6160f9cd365b 100644 --- a/stdlib/3/gettext.pyi +++ b/stdlib/3/gettext.pyi @@ -19,16 +19,16 @@ class GNUTranslations(NullTranslations): LE_MAGIC: int BE_MAGIC: int -def find(domain: str, localedir: str = ..., languages: List[str] = ..., - all: bool = ...): ... - -def translation(domain: str, localedir: str = ..., languages: List[str] = ..., - class_: Callable[[IO[str]], NullTranslations] = ..., - fallback: bool = ..., codeset: Any = ...) -> NullTranslations: ... - -def install(domain: str, localedir: str = ..., codeset: Any = ..., - names: List[str] = ...): ... - +def find(domain: str, localedir: str = ..., languages: List[str] = ..., all: bool = ...): ... +def translation( + domain: str, + localedir: str = ..., + languages: List[str] = ..., + class_: Callable[[IO[str]], NullTranslations] = ..., + fallback: bool = ..., + codeset: Any = ..., +) -> NullTranslations: ... +def install(domain: str, localedir: str = ..., codeset: Any = ..., names: List[str] = ...): ... def textdomain(domain: str = ...) -> str: ... def bindtextdomain(domain: str, localedir: str = ...) -> str: ... def bind_textdomain_codeset(domain: str, codeset: str = ...) -> str: ... diff --git a/stdlib/3/glob.pyi b/stdlib/3/glob.pyi index 02293be035e5..4c661a890e80 100644 --- a/stdlib/3/glob.pyi +++ b/stdlib/3/glob.pyi @@ -6,6 +6,7 @@ from typing import AnyStr, Iterator, List, Union if sys.version_info >= (3, 6): def glob0(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ... + else: def glob0(dirname: AnyStr, basename: AnyStr) -> List[AnyStr]: ... @@ -14,10 +15,10 @@ def glob1(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ... if sys.version_info >= (3, 5): def glob(pathname: AnyStr, *, recursive: bool = ...) -> List[AnyStr]: ... def iglob(pathname: AnyStr, *, recursive: bool = ...) -> Iterator[AnyStr]: ... + else: def glob(pathname: AnyStr) -> List[AnyStr]: ... def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ... def escape(pathname: AnyStr) -> AnyStr: ... - def has_magic(s: Union[str, bytes]) -> bool: ... # undocumented diff --git a/stdlib/3/gzip.pyi b/stdlib/3/gzip.pyi index 74524d91aba3..bda2819a21c8 100644 --- a/stdlib/3/gzip.pyi +++ b/stdlib/3/gzip.pyi @@ -3,7 +3,14 @@ import zlib from os.path import _PathType from typing import IO, Any, Optional -def open(filename, mode: str = ..., compresslevel: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., newline: Optional[str] = ...) -> IO[Any]: ... +def open( + filename, + mode: str = ..., + compresslevel: int = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ..., +) -> IO[Any]: ... class _PaddedFile: file: IO[bytes] @@ -19,7 +26,14 @@ class GzipFile(_compression.BaseStream): name: str compress: zlib._Compress fileobj: IO[bytes] - def __init__(self, filename: Optional[_PathType] = ..., mode: Optional[str] = ..., compresslevel: int = ..., fileobj: Optional[IO[bytes]] = ..., mtime: Optional[float] = ...) -> None: ... + def __init__( + self, + filename: Optional[_PathType] = ..., + mode: Optional[str] = ..., + compresslevel: int = ..., + fileobj: Optional[IO[bytes]] = ..., + mtime: Optional[float] = ..., + ) -> None: ... @property def filename(self) -> str: ... @property diff --git a/stdlib/3/hashlib.pyi b/stdlib/3/hashlib.pyi index 616bb0fdee22..224dabf9b6da 100644 --- a/stdlib/3/hashlib.pyi +++ b/stdlib/3/hashlib.pyi @@ -13,9 +13,7 @@ class _Hash(object): # been present in CPython since its inception, but until Python 3.4 was not # formally specified, so may not exist on some platforms name: str - def __init__(self, data: _DataType = ...) -> None: ... - def copy(self) -> _Hash: ... def digest(self) -> bytes: ... def hexdigest(self) -> str: ... @@ -27,7 +25,6 @@ def sha224(arg: _DataType = ...) -> _Hash: ... def sha256(arg: _DataType = ...) -> _Hash: ... def sha384(arg: _DataType = ...) -> _Hash: ... def sha512(arg: _DataType = ...) -> _Hash: ... - def new(name: str, data: _DataType = ...) -> _Hash: ... algorithms_guaranteed: AbstractSet[str] @@ -40,30 +37,37 @@ if sys.version_info >= (3, 6): digest_size: int block_size: int name: str - def __init__(self, data: _DataType = ...) -> None: ... - def copy(self) -> _VarLenHash: ... def digest(self, length: int) -> bytes: ... def hexdigest(self, length: int) -> str: ... def update(self, arg: _DataType) -> None: ... - sha3_224 = _Hash sha3_256 = _Hash sha3_384 = _Hash sha3_512 = _Hash shake_128 = _VarLenHash shake_256 = _VarLenHash - def scrypt(password: _DataType, *, salt: _DataType, n: int, r: int, p: int, maxmem: int = ..., dklen: int = ...) -> bytes: ... - class _BlakeHash(_Hash): MAX_DIGEST_SIZE: int MAX_KEY_SIZE: int PERSON_SIZE: int SALT_SIZE: int - - def __init__(self, data: _DataType = ..., digest_size: int = ..., key: _DataType = ..., salt: _DataType = ..., person: _DataType = ..., fanout: int = ..., depth: int = ..., leaf_size: int = ..., node_offset: int = ..., node_depth: int = ..., inner_size: int = ..., last_node: bool = ...) -> None: ... - + def __init__( + self, + data: _DataType = ..., + digest_size: int = ..., + key: _DataType = ..., + salt: _DataType = ..., + person: _DataType = ..., + fanout: int = ..., + depth: int = ..., + leaf_size: int = ..., + node_offset: int = ..., + node_depth: int = ..., + inner_size: int = ..., + last_node: bool = ..., + ) -> None: ... blake2b = _BlakeHash blake2s = _BlakeHash diff --git a/stdlib/3/heapq.pyi b/stdlib/3/heapq.pyi index bd03bba22cde..0d073fc718b4 100644 --- a/stdlib/3/heapq.pyi +++ b/stdlib/3/heapq.pyi @@ -5,19 +5,19 @@ import sys from typing import Any, Callable, Iterable, List, Optional, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") def heappush(heap: List[_T], item: _T) -> None: ... def heappop(heap: List[_T]) -> _T: ... def heappushpop(heap: List[_T], item: _T) -> _T: ... def heapify(x: List[_T]) -> None: ... def heapreplace(heap: List[_T], item: _T) -> _T: ... + if sys.version_info >= (3, 5): - def merge(*iterables: Iterable[_T], key: Callable[[_T], Any] = ..., - reverse: bool = ...) -> Iterable[_T]: ... + def merge(*iterables: Iterable[_T], key: Callable[[_T], Any] = ..., reverse: bool = ...) -> Iterable[_T]: ... + else: def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ... -def nlargest(n: int, iterable: Iterable[_T], - key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ... -def nsmallest(n: int, iterable: Iterable[_T], - key: Callable[[_T], Any] = ...) -> List[_T]: ... + +def nlargest(n: int, iterable: Iterable[_T], key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ... +def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], Any] = ...) -> List[_T]: ... diff --git a/stdlib/3/html/parser.pyi b/stdlib/3/html/parser.pyi index 2c86cd2b83fc..f11fec11caaa 100644 --- a/stdlib/3/html/parser.pyi +++ b/stdlib/3/html/parser.pyi @@ -6,19 +6,15 @@ class HTMLParser(ParserBase): if sys.version_info >= (3, 5): def __init__(self, *, convert_charrefs: bool = ...) -> None: ... else: - def __init__(self, strict: bool = ..., *, - convert_charrefs: bool = ...) -> None: ... + def __init__(self, strict: bool = ..., *, convert_charrefs: bool = ...) -> None: ... def feed(self, feed: str) -> None: ... def close(self) -> None: ... def reset(self) -> None: ... def getpos(self) -> Tuple[int, int]: ... def get_starttag_text(self) -> str: ... - - def handle_starttag(self, tag: str, - attrs: List[Tuple[str, Optional[str]]]) -> None: ... + def handle_starttag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None: ... def handle_endtag(self, tag: str) -> None: ... - def handle_startendtag(self, tag: str, - attrs: List[Tuple[str, str]]) -> None: ... + def handle_startendtag(self, tag: str, attrs: List[Tuple[str, str]]) -> None: ... def handle_data(self, data: str) -> None: ... def handle_entityref(self, name: str) -> None: ... def handle_charref(self, name: str) -> None: ... diff --git a/stdlib/3/http/__init__.pyi b/stdlib/3/http/__init__.pyi index adc0ba9ccb44..d9ba51973147 100644 --- a/stdlib/3/http/__init__.pyi +++ b/stdlib/3/http/__init__.pyi @@ -3,9 +3,7 @@ from enum import IntEnum if sys.version_info >= (3, 5): class HTTPStatus(IntEnum): - def __init__(self, *a) -> None: ... - phrase: str description: str diff --git a/stdlib/3/http/client.pyi b/stdlib/3/http/client.pyi index 8beb77eb57d4..d247b2eca506 100644 --- a/stdlib/3/http/client.pyi +++ b/stdlib/3/http/client.pyi @@ -23,7 +23,7 @@ from typing import ( ) _DataType = Union[bytes, IO[Any], Iterable[bytes], str] -_T = TypeVar('_T') +_T = TypeVar("_T") HTTP_PORT: int HTTPS_PORT: int @@ -100,8 +100,9 @@ if sys.version_info >= (3, 5): closed: bool status: int reason: str - def __init__(self, sock: socket, debuglevel: int = ..., - method: Optional[str] = ..., url: Optional[str] = ...) -> None: ... + def __init__( + self, sock: socket, debuglevel: int = ..., method: Optional[str] = ..., url: Optional[str] = ... + ) -> None: ... def read(self, amt: Optional[int] = ...) -> bytes: ... @overload def getheader(self, name: str) -> Optional[str]: ... @@ -112,13 +113,14 @@ if sys.version_info >= (3, 5): def isclosed(self) -> bool: ... def __iter__(self) -> Iterator[bytes]: ... def __enter__(self) -> HTTPResponse: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[types.TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType] + ) -> bool: ... def info(self) -> email.message.Message: ... def geturl(self) -> str: ... def getcode(self) -> int: ... def begin(self) -> None: ... + else: class HTTPResponse(io.RawIOBase, BinaryIO): # type: ignore msg: HTTPMessage @@ -138,9 +140,9 @@ else: def fileno(self) -> int: ... def __iter__(self) -> Iterator[bytes]: ... def __enter__(self) -> HTTPResponse: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[types.TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType] + ) -> bool: ... def info(self) -> email.message.Message: ... def geturl(self) -> str: ... def getcode(self) -> int: ... @@ -150,14 +152,18 @@ else: # urllib.request uses it for a parameter. class HTTPConnectionProtocol(Protocol): if sys.version_info >= (3, 7): - def __call__(self, host: str, port: Optional[int] = ..., - timeout: int = ..., - source_address: Optional[Tuple[str, int]] = ..., - blocksize: int = ...): ... + def __call__( + self, + host: str, + port: Optional[int] = ..., + timeout: int = ..., + source_address: Optional[Tuple[str, int]] = ..., + blocksize: int = ..., + ): ... else: - def __call__(self, host: str, port: Optional[int] = ..., - timeout: int = ..., - source_address: Optional[Tuple[str, int]] = ...): ... + def __call__( + self, host: str, port: Optional[int] = ..., timeout: int = ..., source_address: Optional[Tuple[str, int]] = ... + ): ... class HTTPConnection: host: str = ... @@ -165,53 +171,57 @@ class HTTPConnection: if sys.version_info >= (3, 7): def __init__( self, - host: str, port: Optional[int] = ..., + host: str, + port: Optional[int] = ..., timeout: int = ..., - source_address: Optional[Tuple[str, int]] = ..., blocksize: int = ... + source_address: Optional[Tuple[str, int]] = ..., + blocksize: int = ..., ) -> None: ... else: def __init__( - self, - host: str, port: Optional[int] = ..., - timeout: int = ..., - source_address: Optional[Tuple[str, int]] = ... + self, host: str, port: Optional[int] = ..., timeout: int = ..., source_address: Optional[Tuple[str, int]] = ... ) -> None: ... if sys.version_info >= (3, 6): - def request(self, method: str, url: str, - body: Optional[_DataType] = ..., - headers: Mapping[str, str] = ..., - *, encode_chunked: bool = ...) -> None: ... + def request( + self, + method: str, + url: str, + body: Optional[_DataType] = ..., + headers: Mapping[str, str] = ..., + *, + encode_chunked: bool = ... + ) -> None: ... else: - def request(self, method: str, url: str, - body: Optional[_DataType] = ..., - headers: Mapping[str, str] = ...) -> None: ... + def request(self, method: str, url: str, body: Optional[_DataType] = ..., headers: Mapping[str, str] = ...) -> None: ... def getresponse(self) -> HTTPResponse: ... def set_debuglevel(self, level: int) -> None: ... - def set_tunnel(self, host: str, port: Optional[int] = ..., - headers: Optional[Mapping[str, str]] = ...) -> None: ... + def set_tunnel(self, host: str, port: Optional[int] = ..., headers: Optional[Mapping[str, str]] = ...) -> None: ... def connect(self) -> None: ... def close(self) -> None: ... - def putrequest(self, request: str, selector: str, skip_host: bool = ..., - skip_accept_encoding: bool = ...) -> None: ... + def putrequest(self, request: str, selector: str, skip_host: bool = ..., skip_accept_encoding: bool = ...) -> None: ... def putheader(self, header: str, *argument: str) -> None: ... if sys.version_info >= (3, 6): - def endheaders(self, message_body: Optional[_DataType] = ..., - *, encode_chunked: bool = ...) -> None: ... + def endheaders(self, message_body: Optional[_DataType] = ..., *, encode_chunked: bool = ...) -> None: ... else: def endheaders(self, message_body: Optional[_DataType] = ...) -> None: ... def send(self, data: _DataType) -> None: ... class HTTPSConnection(HTTPConnection): - def __init__(self, - host: str, port: Optional[int] = ..., - key_file: Optional[str] = ..., - cert_file: Optional[str] = ..., - timeout: int = ..., - source_address: Optional[Tuple[str, int]] = ..., - *, context: Optional[ssl.SSLContext] = ..., - check_hostname: Optional[bool] = ...) -> None: ... + def __init__( + self, + host: str, + port: Optional[int] = ..., + key_file: Optional[str] = ..., + cert_file: Optional[str] = ..., + timeout: int = ..., + source_address: Optional[Tuple[str, int]] = ..., + *, + context: Optional[ssl.SSLContext] = ..., + check_hostname: Optional[bool] = ... + ) -> None: ... class HTTPException(Exception): ... + error = HTTPException class NotConnected(HTTPException): ... @@ -220,12 +230,10 @@ class UnknownProtocol(HTTPException): ... class UnknownTransferEncoding(HTTPException): ... class UnimplementedFileMode(HTTPException): ... class IncompleteRead(HTTPException): ... - class ImproperConnectionState(HTTPException): ... class CannotSendRequest(ImproperConnectionState): ... class CannotSendHeader(ImproperConnectionState): ... class ResponseNotReady(ImproperConnectionState): ... - class BadStatusLine(HTTPException): ... class LineTooLong(HTTPException): ... diff --git a/stdlib/3/http/cookiejar.pyi b/stdlib/3/http/cookiejar.pyi index 16d51b0cee5c..156ae207c64e 100644 --- a/stdlib/3/http/cookiejar.pyi +++ b/stdlib/3/http/cookiejar.pyi @@ -2,24 +2,19 @@ from http.client import HTTPResponse from typing import Dict, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload from urllib.request import Request -_T = TypeVar('_T') +_T = TypeVar("_T") class LoadError(OSError): ... - class CookieJar(Iterable[Cookie]): def __init__(self, policy: Optional[CookiePolicy] = ...) -> None: ... def add_cookie_header(self, request: Request) -> None: ... - def extract_cookies(self, response: HTTPResponse, - request: Request) -> None: ... + def extract_cookies(self, response: HTTPResponse, request: Request) -> None: ... def set_policy(self, policy: CookiePolicy) -> None: ... - def make_cookies(self, response: HTTPResponse, - request: Request) -> Sequence[Cookie]: ... + def make_cookies(self, response: HTTPResponse, request: Request) -> Sequence[Cookie]: ... def set_cookie(self, cookie: Cookie) -> None: ... - def set_cookie_if_ok(self, cookie: Cookie, - request: Request) -> None: ... - def clear(self, domain: str = ..., path: str = ..., - name: str = ...) -> None: ... + def set_cookie_if_ok(self, cookie: Cookie, request: Request) -> None: ... + def clear(self, domain: str = ..., path: str = ..., name: str = ...) -> None: ... def clear_session_cookies(self) -> None: ... def __iter__(self) -> Iterator[Cookie]: ... def __len__(self) -> int: ... @@ -27,14 +22,10 @@ class CookieJar(Iterable[Cookie]): class FileCookieJar(CookieJar): filename: str delayload: bool - def __init__(self, filename: str = ..., delayload: bool = ..., - policy: Optional[CookiePolicy] = ...) -> None: ... - def save(self, filename: Optional[str] = ..., ignore_discard: bool = ..., - ignore_expires: bool = ...) -> None: ... - def load(self, filename: Optional[str] = ..., ignore_discard: bool = ..., - ignore_expires: bool = ...) -> None: ... - def revert(self, filename: Optional[str] = ..., ignore_discard: bool = ..., - ignore_expires: bool = ...) -> None: ... + def __init__(self, filename: str = ..., delayload: bool = ..., policy: Optional[CookiePolicy] = ...) -> None: ... + def save(self, filename: Optional[str] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... + def load(self, filename: Optional[str] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... + def revert(self, filename: Optional[str] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... class MozillaCookieJar(FileCookieJar): ... @@ -50,7 +41,6 @@ class CookiePolicy: def domain_return_ok(self, domain: str, request: Request) -> bool: ... def path_return_ok(self, path: str, request: Request) -> bool: ... - class DefaultCookiePolicy(CookiePolicy): rfc2109_as_netscape: bool strict_domain: bool @@ -64,17 +54,21 @@ class DefaultCookiePolicy(CookiePolicy): DomainRFC2965Match: int DomainLiberal: int DomainStrict: int - def __init__(self, blocked_domains: Optional[Sequence[str]] = ..., - allowed_domains: Optional[Sequence[str]] = ..., - netscape: bool = ..., - rfc2965: bool = ..., - rfc2109_as_netscape: Optional[bool] = ..., - hide_cookie2: bool = ..., strict_domain: bool = ..., - strict_rfc2965_unverifiable: bool = ..., - strict_ns_unverifiable: bool = ..., - strict_ns_domain: int = ..., - strict_ns_set_initial_dollar: bool = ..., - strict_ns_set_path: bool = ...) -> None: ... + def __init__( + self, + blocked_domains: Optional[Sequence[str]] = ..., + allowed_domains: Optional[Sequence[str]] = ..., + netscape: bool = ..., + rfc2965: bool = ..., + rfc2109_as_netscape: Optional[bool] = ..., + hide_cookie2: bool = ..., + strict_domain: bool = ..., + strict_rfc2965_unverifiable: bool = ..., + strict_ns_unverifiable: bool = ..., + strict_ns_domain: int = ..., + strict_ns_set_initial_dollar: bool = ..., + strict_ns_set_path: bool = ..., + ) -> None: ... def blocked_domains(self) -> Tuple[str, ...]: ... def set_blocked_domains(self, blocked_domains: Sequence[str]) -> None: ... def is_blocked(self, domain: str) -> bool: ... @@ -82,7 +76,6 @@ class DefaultCookiePolicy(CookiePolicy): def set_allowed_domains(self, allowed_domains: Optional[Sequence[str]]) -> None: ... def is_not_allowed(self, domain: str) -> bool: ... - class Cookie: version: Optional[int] name: str @@ -99,14 +92,26 @@ class Cookie: domain: str # undocumented domain_specified: bool domain_initial_dot: bool - def __init__(self, version: Optional[int], name: str, value: Optional[str], # undocumented - port: Optional[str], port_specified: bool, - domain: str, domain_specified: bool, domain_initial_dot: bool, - path: str, path_specified: bool, - secure: bool, expires: Optional[int], discard: bool, - comment: Optional[str], comment_url: Optional[str], - rest: Dict[str, str], - rfc2109: bool = ...) -> None: ... + def __init__( + self, + version: Optional[int], + name: str, + value: Optional[str], # undocumented + port: Optional[str], + port_specified: bool, + domain: str, + domain_specified: bool, + domain_initial_dot: bool, + path: str, + path_specified: bool, + secure: bool, + expires: Optional[int], + discard: bool, + comment: Optional[str], + comment_url: Optional[str], + rest: Dict[str, str], + rfc2109: bool = ..., + ) -> None: ... def has_nonstandard_attr(self, name: str) -> bool: ... @overload def get_nonstandard_attr(self, name: str) -> Optional[str]: ... diff --git a/stdlib/3/http/cookies.pyi b/stdlib/3/http/cookies.pyi index 9a1fdeb7fc18..c652e289dea5 100644 --- a/stdlib/3/http/cookies.pyi +++ b/stdlib/3/http/cookies.pyi @@ -3,7 +3,7 @@ from typing import Dict, Generic, List, Mapping, MutableMapping, Optional, TypeVar, Union _DataType = Union[str, Mapping[str, Union[str, Morsel]]] -_T = TypeVar('_T') +_T = TypeVar("_T") class CookieError(Exception): ... @@ -13,8 +13,7 @@ class Morsel(Dict[str, str], Generic[_T]): key: str def set(self, key: str, val: str, coded_val: _T) -> None: ... def isReservedKey(self, K: str) -> bool: ... - def output(self, attrs: Optional[List[str]] = ..., - header: str = ...) -> str: ... + def output(self, attrs: Optional[List[str]] = ..., header: str = ...) -> str: ... def js_output(self, attrs: Optional[List[str]] = ...) -> str: ... def OutputString(self, attrs: Optional[List[str]] = ...) -> str: ... @@ -22,8 +21,7 @@ class BaseCookie(Dict[str, Morsel], Generic[_T]): def __init__(self, input: Optional[_DataType] = ...) -> None: ... def value_decode(self, val: str) -> _T: ... def value_encode(self, val: _T) -> str: ... - def output(self, attrs: Optional[List[str]] = ..., header: str = ..., - sep: str = ...) -> str: ... + def output(self, attrs: Optional[List[str]] = ..., header: str = ..., sep: str = ...) -> str: ... def js_output(self, attrs: Optional[List[str]] = ...) -> str: ... def load(self, rawdata: _DataType) -> None: ... def __setitem__(self, key: str, value: Union[str, Morsel]) -> None: ... diff --git a/stdlib/3/http/server.pyi b/stdlib/3/http/server.pyi index 2c8218d87e65..e66f692c5a06 100644 --- a/stdlib/3/http/server.pyi +++ b/stdlib/3/http/server.pyi @@ -11,8 +11,7 @@ if sys.version_info >= (3, 7): class HTTPServer(socketserver.TCPServer): server_name: str server_port: int - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type) -> None: ... class BaseHTTPRequestHandler: client_address: Tuple[str, int] @@ -32,22 +31,17 @@ class BaseHTTPRequestHandler: protocol_version: str MessageClass: type responses: Mapping[int, Tuple[str, str]] - def __init__(self, request: bytes, client_address: Tuple[str, int], - server: socketserver.BaseServer) -> None: ... + def __init__(self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer) -> None: ... def handle(self) -> None: ... def handle_one_request(self) -> None: ... def handle_expect_100(self) -> bool: ... - def send_error(self, code: int, message: Optional[str] = ..., - explain: Optional[str] = ...) -> None: ... - def send_response(self, code: int, - message: Optional[str] = ...) -> None: ... + def send_error(self, code: int, message: Optional[str] = ..., explain: Optional[str] = ...) -> None: ... + def send_response(self, code: int, message: Optional[str] = ...) -> None: ... def send_header(self, keyword: str, value: str) -> None: ... - def send_response_only(self, code: int, - message: Optional[str] = ...) -> None: ... + def send_response_only(self, code: int, message: Optional[str] = ...) -> None: ... def end_headers(self) -> None: ... def flush_headers(self) -> None: ... - def log_request(self, code: Union[int, str] = ..., - size: Union[int, str] = ...) -> None: ... + def log_request(self, code: Union[int, str] = ..., size: Union[int, str] = ...) -> None: ... def log_error(self, format: str, *args: Any) -> None: ... def log_message(self, format: str, *args: Any) -> None: ... def version_string(self) -> str: ... @@ -58,11 +52,15 @@ class BaseHTTPRequestHandler: class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): extensions_map: Dict[str, str] if sys.version_info >= (3, 7): - def __init__(self, request: bytes, client_address: Tuple[str, int], - server: socketserver.BaseServer, directory: Optional[Union[str, _PathLike[str]]]) -> None: ... + def __init__( + self, + request: bytes, + client_address: Tuple[str, int], + server: socketserver.BaseServer, + directory: Optional[Union[str, _PathLike[str]]], + ) -> None: ... else: - def __init__(self, request: bytes, client_address: Tuple[str, int], - server: socketserver.BaseServer) -> None: ... + def __init__(self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer) -> None: ... def do_GET(self) -> None: ... def do_HEAD(self) -> None: ... diff --git a/stdlib/3/imp.pyi b/stdlib/3/imp.pyi index b491db2bd095..8536aa84bfe8 100644 --- a/stdlib/3/imp.pyi +++ b/stdlib/3/imp.pyi @@ -17,7 +17,7 @@ from _imp import release_lock as release_lock if sys.version_info >= (3, 5): from _imp import create_dynamic as create_dynamic -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3, 6): _Path = Union[str, os.PathLike[str]] @@ -51,10 +51,15 @@ def load_source(name: str, pathname: str, file: Optional[IO[Any]] = ...) -> type def load_compiled(name: str, pathname: str, file: Optional[IO[Any]] = ...) -> types.ModuleType: ... def load_package(name: str, path: _Path) -> types.ModuleType: ... def load_module(name: str, file: IO[Any], filename: str, details: Tuple[str, str, int]) -> types.ModuleType: ... + if sys.version_info >= (3, 6): - def find_module(name: str, path: Union[None, List[str], List[os.PathLike[str]], List[_Path]] = ...) -> Tuple[str, str, Tuple[IO[Any], str, int]]: ... + def find_module( + name: str, path: Union[None, List[str], List[os.PathLike[str]], List[_Path]] = ... + ) -> Tuple[str, str, Tuple[IO[Any], str, int]]: ... + else: def find_module(name: str, path: Optional[List[str]] = ...) -> Tuple[str, str, Tuple[IO[Any], str, int]]: ... + def reload(module: types.ModuleType) -> types.ModuleType: ... def init_builtin(name: str) -> Optional[types.ModuleType]: ... def load_dynamic(name: str, path: str, file: Optional[IO[Any]] = ...) -> types.ModuleType: ... diff --git a/stdlib/3/importlib/__init__.pyi b/stdlib/3/importlib/__init__.pyi index 70788d734e43..4a8f0c9ae166 100644 --- a/stdlib/3/importlib/__init__.pyi +++ b/stdlib/3/importlib/__init__.pyi @@ -3,15 +3,14 @@ import types from importlib.abc import Loader from typing import Any, Mapping, Optional, Sequence -def __import__(name: str, globals: Optional[Mapping[str, Any]] = ..., - locals: Optional[Mapping[str, Any]] = ..., - fromlist: Sequence[str] = ..., - level: int = ...) -> types.ModuleType: ... - +def __import__( + name: str, + globals: Optional[Mapping[str, Any]] = ..., + locals: Optional[Mapping[str, Any]] = ..., + fromlist: Sequence[str] = ..., + level: int = ..., +) -> types.ModuleType: ... def import_module(name: str, package: Optional[str] = ...) -> types.ModuleType: ... - def find_loader(name: str, path: Optional[str] = ...) -> Optional[Loader]: ... - def invalidate_caches() -> None: ... - def reload(module: types.ModuleType) -> types.ModuleType: ... diff --git a/stdlib/3/importlib/abc.pyi b/stdlib/3/importlib/abc.pyi index babcda1c5d44..fbea8bcdddd2 100644 --- a/stdlib/3/importlib/abc.pyi +++ b/stdlib/3/importlib/abc.pyi @@ -11,14 +11,7 @@ from _importlib_modulespec import ModuleSpec _Path = Union[bytes, str] -class Finder(metaclass=ABCMeta): - ... - # Technically this class defines the following method, but its subclasses - # in this module violate its signature. Since this class is deprecated, it's - # easier to simply ignore that this method exists. - # @abstractmethod - # def find_module(self, fullname: str, - # path: Optional[Sequence[_Path]] = ...) -> Optional[Loader]: ... +class Finder(metaclass=ABCMeta): ... class ResourceLoader(Loader): @abstractmethod @@ -32,12 +25,10 @@ class InspectLoader(Loader): def get_source(self, fullname: str) -> Optional[str]: ... def exec_module(self, module: types.ModuleType) -> None: ... if sys.version_info < (3, 5): - def source_to_code(self, data: Union[bytes, str], - path: str = ...) -> types.CodeType: ... + def source_to_code(self, data: Union[bytes, str], path: str = ...) -> types.CodeType: ... else: @staticmethod - def source_to_code(data: Union[bytes, str], - path: str = ...) -> types.CodeType: ... + def source_to_code(data: Union[bytes, str], path: str = ...) -> types.CodeType: ... class ExecutionLoader(InspectLoader): @abstractmethod @@ -50,30 +41,20 @@ class SourceLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta): def get_source(self, fullname: str) -> Optional[str]: ... def path_stats(self, path: _Path) -> Mapping[str, Any]: ... - class MetaPathFinder(Finder): - def find_module(self, fullname: str, - path: Optional[Sequence[_Path]]) -> Optional[Loader]: - ... + def find_module(self, fullname: str, path: Optional[Sequence[_Path]]) -> Optional[Loader]: ... def invalidate_caches(self) -> None: ... # Not defined on the actual class, but expected to exist. def find_spec( - self, fullname: str, path: Optional[Sequence[_Path]], - target: Optional[types.ModuleType] = ... - ) -> Optional[ModuleSpec]: - ... + self, fullname: str, path: Optional[Sequence[_Path]], target: Optional[types.ModuleType] = ... + ) -> Optional[ModuleSpec]: ... class PathEntryFinder(Finder): def find_module(self, fullname: str) -> Optional[Loader]: ... - def find_loader( - self, fullname: str - ) -> Tuple[Optional[Loader], Sequence[_Path]]: ... + def find_loader(self, fullname: str) -> Tuple[Optional[Loader], Sequence[_Path]]: ... def invalidate_caches(self) -> None: ... # Not defined on the actual class, but expected to exist. - def find_spec( - self, fullname: str, - target: Optional[types.ModuleType] = ... - ) -> Optional[ModuleSpec]: ... + def find_spec(self, fullname: str, target: Optional[types.ModuleType] = ...) -> Optional[ModuleSpec]: ... class FileLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta): name: str @@ -84,7 +65,6 @@ class FileLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta): if sys.version_info >= (3, 7): _PathLike = Union[bytes, str, os.PathLike[Any]] - class ResourceReader(metaclass=ABCMeta): @abstractmethod def open_resource(self, resource: _PathLike) -> IO[bytes]: ... diff --git a/stdlib/3/importlib/machinery.pyi b/stdlib/3/importlib/machinery.pyi index 036a91fe487e..3a32b2092e10 100644 --- a/stdlib/3/importlib/machinery.pyi +++ b/stdlib/3/importlib/machinery.pyi @@ -7,20 +7,14 @@ from typing import Any, Callable, List, Optional, Sequence, Tuple, Union # reasons exists in its own stub file (with Loader and ModuleType). from _importlib_modulespec import ModuleSpec as ModuleSpec # Exported -class BuiltinImporter(importlib.abc.MetaPathFinder, - importlib.abc.InspectLoader): +class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder @classmethod - def find_module( - cls, fullname: str, - path: Optional[Sequence[importlib.abc._Path]] - ) -> Optional[importlib.abc.Loader]: - ... + def find_module(cls, fullname: str, path: Optional[Sequence[importlib.abc._Path]]) -> Optional[importlib.abc.Loader]: ... @classmethod - def find_spec(cls, fullname: str, - path: Optional[Sequence[importlib.abc._Path]], - target: Optional[types.ModuleType] = ...) -> Optional[ModuleSpec]: - ... + def find_spec( + cls, fullname: str, path: Optional[Sequence[importlib.abc._Path]], target: Optional[types.ModuleType] = ... + ) -> Optional[ModuleSpec]: ... # InspectLoader @classmethod def is_package(cls, fullname: str) -> bool: ... @@ -41,16 +35,11 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder @classmethod - def find_module( - cls, fullname: str, - path: Optional[Sequence[importlib.abc._Path]] - ) -> Optional[importlib.abc.Loader]: - ... + def find_module(cls, fullname: str, path: Optional[Sequence[importlib.abc._Path]]) -> Optional[importlib.abc.Loader]: ... @classmethod - def find_spec(cls, fullname: str, - path: Optional[Sequence[importlib.abc._Path]], - target: Optional[types.ModuleType] = ...) -> Optional[ModuleSpec]: - ... + def find_spec( + cls, fullname: str, path: Optional[Sequence[importlib.abc._Path]], target: Optional[types.ModuleType] = ... + ) -> Optional[ModuleSpec]: ... # InspectLoader @classmethod def is_package(cls, fullname: str) -> bool: ... @@ -64,23 +53,17 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): @staticmethod def module_repr(module: types.ModuleType) -> str: ... @classmethod - def create_module(cls, spec: ModuleSpec) -> Optional[types.ModuleType]: - ... + def create_module(cls, spec: ModuleSpec) -> Optional[types.ModuleType]: ... @staticmethod def exec_module(module: types.ModuleType) -> None: ... class WindowsRegistryFinder(importlib.abc.MetaPathFinder): @classmethod - def find_module( - cls, fullname: str, - path: Optional[Sequence[importlib.abc._Path]] - ) -> Optional[importlib.abc.Loader]: - ... + def find_module(cls, fullname: str, path: Optional[Sequence[importlib.abc._Path]]) -> Optional[importlib.abc.Loader]: ... @classmethod - def find_spec(cls, fullname: str, - path: Optional[Sequence[importlib.abc._Path]], - target: Optional[types.ModuleType] = ...) -> Optional[ModuleSpec]: - ... + def find_spec( + cls, fullname: str, path: Optional[Sequence[importlib.abc._Path]], target: Optional[types.ModuleType] = ... + ) -> Optional[ModuleSpec]: ... class PathFinder(importlib.abc.MetaPathFinder): ... @@ -94,22 +77,14 @@ def all_suffixes() -> List[str]: ... class FileFinder(importlib.abc.PathEntryFinder): path: str - def __init__( - self, path: str, - *loader_details: Tuple[importlib.abc.Loader, List[str]] - ) -> None: ... + def __init__(self, path: str, *loader_details: Tuple[importlib.abc.Loader, List[str]]) -> None: ... @classmethod def path_hook( cls, *loader_details: Tuple[importlib.abc.Loader, List[str]] ) -> Callable[[str], importlib.abc.PathEntryFinder]: ... -class SourceFileLoader(importlib.abc.FileLoader, - importlib.abc.SourceLoader): - ... - -class SourcelessFileLoader(importlib.abc.FileLoader, - importlib.abc.SourceLoader): - ... +class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): ... +class SourcelessFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): ... class ExtensionFileLoader(importlib.abc.ExecutionLoader): def get_filename(self, fullname: str) -> importlib.abc._Path: ... diff --git a/stdlib/3/importlib/resources.pyi b/stdlib/3/importlib/resources.pyi index b8942e76258c..6f103fb0946e 100644 --- a/stdlib/3/importlib/resources.pyi +++ b/stdlib/3/importlib/resources.pyi @@ -10,17 +10,10 @@ if sys.version_info >= (3, 7): Package = Union[str, ModuleType] Resource = Union[str, os.PathLike] - def open_binary(package: Package, resource: Resource) -> BinaryIO: ... - def open_text(package: Package, - resource: Resource, - encoding: str = ..., - errors: str = ...) -> TextIO: ... + def open_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> TextIO: ... def read_binary(package: Package, resource: Resource) -> bytes: ... - def read_text(package: Package, - resource: Resource, - encoding: str = ..., - errors: str = ...) -> str: ... + def read_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> str: ... def path(package: Package, resource: Resource) -> ContextManager[Path]: ... def is_resource(package: Package, name: str) -> bool: ... def contents(package: Package) -> Iterator[str]: ... diff --git a/stdlib/3/importlib/util.pyi b/stdlib/3/importlib/util.pyi index 32d97cf276cd..71f774114e32 100644 --- a/stdlib/3/importlib/util.pyi +++ b/stdlib/3/importlib/util.pyi @@ -4,57 +4,46 @@ import sys import types from typing import Any, Callable, List, Optional, Union -def module_for_loader( - fxn: Callable[..., types.ModuleType] -) -> Callable[..., types.ModuleType]: ... -def set_loader( - fxn: Callable[..., types.ModuleType] -) -> Callable[..., types.ModuleType]: ... -def set_package( - fxn: Callable[..., types.ModuleType] -) -> Callable[..., types.ModuleType]: ... - +def module_for_loader(fxn: Callable[..., types.ModuleType]) -> Callable[..., types.ModuleType]: ... +def set_loader(fxn: Callable[..., types.ModuleType]) -> Callable[..., types.ModuleType]: ... +def set_package(fxn: Callable[..., types.ModuleType]) -> Callable[..., types.ModuleType]: ... def resolve_name(name: str, package: str) -> str: ... MAGIC_NUMBER: bytes -def cache_from_source(path: str, debug_override: Optional[bool] = ..., *, - optimization: Optional[Any] = ...) -> str: ... +def cache_from_source(path: str, debug_override: Optional[bool] = ..., *, optimization: Optional[Any] = ...) -> str: ... def source_from_cache(path: str) -> str: ... def decode_source(source_bytes: bytes) -> str: ... -def find_spec( - name: str, package: Optional[str] = ... -) -> Optional[importlib.machinery.ModuleSpec]: ... +def find_spec(name: str, package: Optional[str] = ...) -> Optional[importlib.machinery.ModuleSpec]: ... def spec_from_loader( - name: str, loader: Optional[importlib.abc.Loader], *, - origin: Optional[str] = ..., loader_state: Optional[Any] = ..., + name: str, + loader: Optional[importlib.abc.Loader], + *, + origin: Optional[str] = ..., + loader_state: Optional[Any] = ..., is_package: Optional[bool] = ... ) -> importlib.machinery.ModuleSpec: ... if sys.version_info >= (3, 6): import os + _Path = Union[str, bytes, os.PathLike] else: _Path = str def spec_from_file_location( - name: str, location: _Path, *, + name: str, + location: _Path, + *, loader: Optional[importlib.abc.Loader] = ..., submodule_search_locations: Optional[List[str]] = ... ) -> importlib.machinery.ModuleSpec: ... if sys.version_info >= (3, 5): - def module_from_spec( - spec: importlib.machinery.ModuleSpec - ) -> types.ModuleType: ... - + def module_from_spec(spec: importlib.machinery.ModuleSpec) -> types.ModuleType: ... class LazyLoader(importlib.abc.Loader): def __init__(self, loader: importlib.abc.Loader) -> None: ... @classmethod - def factory( - cls, loader: importlib.abc.Loader - ) -> Callable[..., LazyLoader]: ... - def create_module( - self, spec: importlib.machinery.ModuleSpec - ) -> Optional[types.ModuleType]: ... + def factory(cls, loader: importlib.abc.Loader) -> Callable[..., LazyLoader]: ... + def create_module(self, spec: importlib.machinery.ModuleSpec) -> Optional[types.ModuleType]: ... def exec_module(self, module: types.ModuleType) -> None: ... diff --git a/stdlib/3/inspect.pyi b/stdlib/3/inspect.pyi index 72d59c6eb0c7..fa2535513a61 100644 --- a/stdlib/3/inspect.pyi +++ b/stdlib/3/inspect.pyi @@ -16,8 +16,7 @@ class BlockFinder: indecorator: bool decoratorhasargs: bool last: int - def tokeneater(self, type: int, token: str, srow_scol: Tuple[int, int], - erow_ecol: Tuple[int, int], line: str) -> None: ... + def tokeneater(self, type: int, token: str, srow_scol: Tuple[int, int], erow_ecol: Tuple[int, int], line: str) -> None: ... CO_OPTIMIZED: int CO_NEWLOCALS: int @@ -34,18 +33,11 @@ if sys.version_info >= (3, 6): TPFLAGS_IS_ABSTRACT: int if sys.version_info < (3, 6): - ModuleInfo = NamedTuple('ModuleInfo', [('name', str), - ('suffix', str), - ('mode', str), - ('module_type', int), - ]) + ModuleInfo = NamedTuple("ModuleInfo", [("name", str), ("suffix", str), ("mode", str), ("module_type", int)]) def getmoduleinfo(path: str) -> Optional[ModuleInfo]: ... -def getmembers(object: object, - predicate: Optional[Callable[[Any], bool]] = ..., - ) -> List[Tuple[str, Any]]: ... +def getmembers(object: object, predicate: Optional[Callable[[Any], bool]] = ...) -> List[Tuple[str, Any]]: ... def getmodulename(path: str) -> Optional[str]: ... - def ismodule(object: object) -> bool: ... def isclass(object: object) -> bool: ... def ismethod(object: object) -> bool: ... @@ -57,9 +49,11 @@ if sys.version_info >= (3, 5): def iscoroutinefunction(object: object) -> bool: ... def iscoroutine(object: object) -> bool: ... def isawaitable(object: object) -> bool: ... + if sys.version_info >= (3, 6): def isasyncgenfunction(object: object) -> bool: ... def isasyncgen(object: object) -> bool: ... + def istraceback(object: object) -> bool: ... def isframe(object: object) -> bool: ... def iscode(object: object) -> bool: ... @@ -71,7 +65,6 @@ def isdatadescriptor(object: object) -> bool: ... def isgetsetdescriptor(object: object) -> bool: ... def ismemberdescriptor(object: object) -> bool: ... - # # Retrieving source code # @@ -83,28 +76,24 @@ def getcomments(object: object) -> str: ... def getfile(object: object) -> str: ... def getmodule(object: object) -> ModuleType: ... def getsourcefile(object: object) -> str: ... + # TODO restrict to "module, class, method, function, traceback, frame, # or code object" def getsourcelines(object: object) -> Tuple[List[str], int]: ... + # TODO restrict to "a module, class, method, function, traceback, frame, # or code object" def getsource(object: object) -> str: ... def cleandoc(doc: str) -> str: ... def indentsize(line: str) -> int: ... - # # Introspecting callables with the Signature object # -def signature(callable: Callable[..., Any], - *, - follow_wrapped: bool = ...) -> Signature: ... +def signature(callable: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ... class Signature: - def __init__(self, - parameters: Optional[Sequence[Parameter]] = ..., - *, - return_annotation: Any = ...) -> None: ... + def __init__(self, parameters: Optional[Sequence[Parameter]] = ..., *, return_annotation: Any = ...) -> None: ... # TODO: can we be more specific here? empty: object = ... @@ -112,31 +101,18 @@ class Signature: # TODO: can we be more specific here? return_annotation: Any - def bind(self, *args: Any, **kwargs: Any) -> BoundArguments: ... def bind_partial(self, *args: Any, **kwargs: Any) -> BoundArguments: ... - def replace(self, - *, - parameters: Optional[Sequence[Parameter]] = ..., - return_annotation: Any = ...) -> Signature: ... - + def replace(self, *, parameters: Optional[Sequence[Parameter]] = ..., return_annotation: Any = ...) -> Signature: ... if sys.version_info >= (3, 5): @classmethod - def from_callable(cls, - obj: Callable[..., Any], - *, - follow_wrapped: bool = ...) -> Signature: ... + def from_callable(cls, obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ... # The name is the same as the enum's name in CPython class _ParameterKind: ... class Parameter: - def __init__(self, - name: str, - kind: _ParameterKind, - *, - default: Any = ..., - annotation: Any = ...) -> None: ... + def __init__(self, name: str, kind: _ParameterKind, *, default: Any = ..., annotation: Any = ...) -> None: ... empty: Any = ... name: str default: Any @@ -148,13 +124,9 @@ class Parameter: VAR_POSITIONAL: _ParameterKind = ... KEYWORD_ONLY: _ParameterKind = ... VAR_KEYWORD: _ParameterKind = ... - - def replace(self, - *, - name: Optional[str] = ..., - kind: Optional[_ParameterKind] = ..., - default: Any = ..., - annotation: Any = ...) -> Parameter: ... + def replace( + self, *, name: Optional[str] = ..., kind: Optional[_ParameterKind] = ..., default: Any = ..., annotation: Any = ... + ) -> Parameter: ... class BoundArguments: arguments: OrderedDict[str, Any] @@ -165,7 +137,6 @@ class BoundArguments: if sys.version_info >= (3, 5): def apply_defaults(self) -> None: ... - # # Classes and functions # @@ -175,106 +146,90 @@ class BoundArguments: # _ClassTreeItem = Union[List[_ClassTreeItem], Tuple[type, Tuple[type, ...]]] def getclasstree(classes: List[type], unique: bool = ...) -> Any: ... -ArgSpec = NamedTuple('ArgSpec', [('args', List[str]), - ('varargs', str), - ('keywords', str), - ('defaults', tuple), - ]) +ArgSpec = NamedTuple("ArgSpec", [("args", List[str]), ("varargs", str), ("keywords", str), ("defaults", tuple)]) -Arguments = NamedTuple('Arguments', [('args', List[str]), - ('varargs', Optional[str]), - ('varkw', Optional[str]), - ]) +Arguments = NamedTuple("Arguments", [("args", List[str]), ("varargs", Optional[str]), ("varkw", Optional[str])]) def getargs(co: CodeType) -> Arguments: ... def getargspec(func: object) -> ArgSpec: ... -FullArgSpec = NamedTuple('FullArgSpec', [('args', List[str]), - ('varargs', Optional[str]), - ('varkw', Optional[str]), - ('defaults', tuple), - ('kwonlyargs', List[str]), - ('kwonlydefaults', Dict[str, Any]), - ('annotations', Dict[str, Any]), - ]) +FullArgSpec = NamedTuple( + "FullArgSpec", + [ + ("args", List[str]), + ("varargs", Optional[str]), + ("varkw", Optional[str]), + ("defaults", tuple), + ("kwonlyargs", List[str]), + ("kwonlydefaults", Dict[str, Any]), + ("annotations", Dict[str, Any]), + ], +) def getfullargspec(func: object) -> FullArgSpec: ... # TODO make the field types more specific here -ArgInfo = NamedTuple('ArgInfo', [('args', List[str]), - ('varargs', Optional[str]), - ('keywords', Optional[str]), - ('locals', Dict[str, Any]), - ]) +ArgInfo = NamedTuple( + "ArgInfo", [("args", List[str]), ("varargs", Optional[str]), ("keywords", Optional[str]), ("locals", Dict[str, Any])] +) def getargvalues(frame: FrameType) -> ArgInfo: ... def formatannotation(annotation: object, base_module: Optional[str] = ...) -> str: ... def formatannotationrelativeto(object: object) -> Callable[[object], str]: ... -def formatargspec(args: List[str], - varargs: Optional[str] = ..., - varkw: Optional[str] = ..., - defaults: Optional[Tuple[Any, ...]] = ..., - kwonlyargs: Optional[List[str]] = ..., - kwonlydefaults: Optional[Dict[str, Any]] = ..., - annotations: Dict[str, Any] = ..., - formatarg: Callable[[str], str] = ..., - formatvarargs: Callable[[str], str] = ..., - formatvarkw: Callable[[str], str] = ..., - formatvalue: Callable[[Any], str] = ..., - formatreturns: Callable[[Any], str] = ..., - formatannotations: Callable[[Any], str] = ..., - ) -> str: ... -def formatargvalues(args: List[str], - varargs: Optional[str] = ..., - varkw: Optional[str] = ..., - locals: Optional[Dict[str, Any]] = ..., - formatarg: Optional[Callable[[str], str]] = ..., - formatvarargs: Optional[Callable[[str], str]] = ..., - formatvarkw: Optional[Callable[[str], str]] = ..., - formatvalue: Optional[Callable[[Any], str]] = ..., - ) -> str: ... +def formatargspec( + args: List[str], + varargs: Optional[str] = ..., + varkw: Optional[str] = ..., + defaults: Optional[Tuple[Any, ...]] = ..., + kwonlyargs: Optional[List[str]] = ..., + kwonlydefaults: Optional[Dict[str, Any]] = ..., + annotations: Dict[str, Any] = ..., + formatarg: Callable[[str], str] = ..., + formatvarargs: Callable[[str], str] = ..., + formatvarkw: Callable[[str], str] = ..., + formatvalue: Callable[[Any], str] = ..., + formatreturns: Callable[[Any], str] = ..., + formatannotations: Callable[[Any], str] = ..., +) -> str: ... +def formatargvalues( + args: List[str], + varargs: Optional[str] = ..., + varkw: Optional[str] = ..., + locals: Optional[Dict[str, Any]] = ..., + formatarg: Optional[Callable[[str], str]] = ..., + formatvarargs: Optional[Callable[[str], str]] = ..., + formatvarkw: Optional[Callable[[str], str]] = ..., + formatvalue: Optional[Callable[[Any], str]] = ..., +) -> str: ... def getmro(cls: type) -> Tuple[type, ...]: ... +def getcallargs(func: Callable[..., Any], *args: Any, **kwds: Any) -> Dict[str, Any]: ... -def getcallargs(func: Callable[..., Any], - *args: Any, - **kwds: Any) -> Dict[str, Any]: ... - +ClosureVars = NamedTuple( + "ClosureVars", + [ + ("nonlocals", Mapping[str, Any]), + ("globals", Mapping[str, Any]), + ("builtins", Mapping[str, Any]), + ("unbound", AbstractSet[str]), + ], +) -ClosureVars = NamedTuple('ClosureVars', [('nonlocals', Mapping[str, Any]), - ('globals', Mapping[str, Any]), - ('builtins', Mapping[str, Any]), - ('unbound', AbstractSet[str]), - ]) def getclosurevars(func: Callable[..., Any]) -> ClosureVars: ... - -def unwrap(func: Callable[..., Any], - *, - stop: Optional[Callable[[Any], Any]] = ...) -> Any: ... - +def unwrap(func: Callable[..., Any], *, stop: Optional[Callable[[Any], Any]] = ...) -> Any: ... # # The interpreter stack # Traceback = NamedTuple( - 'Traceback', - [ - ('filename', str), - ('lineno', int), - ('function', str), - ('code_context', List[str]), - ('index', int), - ] + "Traceback", [("filename", str), ("lineno", int), ("function", str), ("code_context", List[str]), ("index", int)] ) # Python 3.5+ (functions returning it used to return regular tuples) -FrameInfo = NamedTuple('FrameInfo', [('frame', FrameType), - ('filename', str), - ('lineno', int), - ('function', str), - ('code_context', List[str]), - ('index', int), - ]) +FrameInfo = NamedTuple( + "FrameInfo", + [("frame", FrameType), ("filename", str), ("lineno", int), ("function", str), ("code_context", List[str]), ("index", int)], +) def getframeinfo(frame: Union[FrameType, TracebackType], context: int = ...) -> Traceback: ... def getouterframes(frame: Any, context: int = ...) -> List[FrameInfo]: ... @@ -290,7 +245,6 @@ def trace(context: int = ...) -> List[FrameInfo]: ... def getattr_static(obj: object, attr: str, default: Optional[Any] = ...) -> Any: ... - # # Current State of Generators and Coroutines # @@ -302,6 +256,7 @@ GEN_CREATED: str GEN_RUNNING: str GEN_SUSPENDED: str GEN_CLOSED: str + def getgeneratorstate(generator: Generator[Any, Any, Any]) -> str: ... if sys.version_info >= (3, 5): @@ -318,10 +273,6 @@ if sys.version_info >= (3, 5): # TODO can we be more specific than "object"? def getcoroutinelocals(coroutine: object) -> Dict[str, Any]: ... -Attribute = NamedTuple('Attribute', [('name', str), - ('kind', str), - ('defining_class', type), - ('object', object), - ]) +Attribute = NamedTuple("Attribute", [("name", str), ("kind", str), ("defining_class", type), ("object", object)]) def classify_class_attrs(cls: type) -> List[Attribute]: ... diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index 2a739a624a42..0ed9728cf08b 100644 --- a/stdlib/3/io.pyi +++ b/stdlib/3/io.pyi @@ -13,19 +13,21 @@ SEEK_SET: int SEEK_CUR: int SEEK_END: int -_T = TypeVar('_T', bound='IOBase') +_T = TypeVar("_T", bound="IOBase") open = builtins.open BlockingIOError = builtins.BlockingIOError + class UnsupportedOperation(OSError, ValueError): ... class IOBase: def __iter__(self) -> Iterator[bytes]: ... def __next__(self) -> bytes: ... def __enter__(self: _T) -> _T: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... def close(self) -> None: ... def fileno(self) -> int: ... def flush(self) -> None: ... @@ -58,7 +60,6 @@ class BufferedIOBase(IOBase): def read(self, size: Optional[int] = ...) -> bytes: ... def read1(self, size: int = ...) -> bytes: ... - class FileIO(RawIOBase): mode: str name: Union[int, str] @@ -67,7 +68,7 @@ class FileIO(RawIOBase): name: Union[str, bytes, int], mode: str = ..., closefd: bool = ..., - opener: Optional[Callable[[Union[int, str], str], int]] = ... + opener: Optional[Callable[[Union[int, str], str], int]] = ..., ) -> None: ... # TODO should extend from BufferedIOBase @@ -83,8 +84,12 @@ class BytesIO(BinaryIO): def __iter__(self) -> Iterator[bytes]: ... def __next__(self) -> bytes: ... def __enter__(self) -> BytesIO: ... - def __exit__(self, t: Optional[Type[BaseException]] = ..., value: Optional[BaseException] = ..., - traceback: Optional[TracebackType] = ...) -> bool: ... + def __exit__( + self, + t: Optional[Type[BaseException]] = ..., + value: Optional[BaseException] = ..., + traceback: Optional[TracebackType] = ..., + ) -> bool: ... def close(self) -> None: ... def fileno(self) -> int: ... def flush(self) -> None: ... @@ -126,9 +131,7 @@ class BufferedRandom(BufferedReader, BufferedWriter): def tell(self) -> int: ... class BufferedRWPair(BufferedIOBase): - def __init__(self, reader: RawIOBase, writer: RawIOBase, - buffer_size: int = ...) -> None: ... - + def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = ...) -> None: ... class TextIOBase(IOBase): encoding: str @@ -160,11 +163,15 @@ class TextIOWrapper(TextIO): errors: Optional[str] = ..., newline: Optional[str] = ..., line_buffering: bool = ..., - write_through: bool = ... + write_through: bool = ..., ) -> None: ... # copied from IOBase - def __exit__(self, t: Optional[Type[BaseException]] = ..., value: Optional[BaseException] = ..., - traceback: Optional[TracebackType] = ...) -> bool: ... + def __exit__( + self, + t: Optional[Type[BaseException]] = ..., + value: Optional[BaseException] = ..., + traceback: Optional[TracebackType] = ..., + ) -> bool: ... def close(self) -> None: ... def fileno(self) -> int: ... def flush(self) -> None: ... @@ -194,8 +201,7 @@ class TextIOWrapper(TextIO): def tell(self) -> int: ... class StringIO(TextIOWrapper): - def __init__(self, initial_value: str = ..., - newline: Optional[str] = ...) -> None: ... + def __init__(self, initial_value: str = ..., newline: Optional[str] = ...) -> None: ... # StringIO does not contain a "name" field. This workaround is necessary # to allow StringIO sub-classes to add this field, as it is defined # as a read-only property on IO[]. diff --git a/stdlib/3/itertools.pyi b/stdlib/3/itertools.pyi index db7076a93f39..fd81758886fe 100644 --- a/stdlib/3/itertools.pyi +++ b/stdlib/3/itertools.pyi @@ -4,20 +4,17 @@ from typing import Any, Callable, Generic, Iterable, Iterator, Optional, Tuple, TypeVar, overload -_T = TypeVar('_T') -_S = TypeVar('_S') -_N = TypeVar('_N', int, float) +_T = TypeVar("_T") +_S = TypeVar("_S") +_N = TypeVar("_N", int, float) Predicate = Callable[[_T], object] -def count(start: _N = ..., - step: _N = ...) -> Iterator[_N]: ... # more general types? +def count(start: _N = ..., step: _N = ...) -> Iterator[_N]: ... # more general types? def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ... - @overload def repeat(object: _T) -> Iterator[_T]: ... @overload def repeat(object: _T, times: int) -> Iterator[_T]: ... - def accumulate(iterable: Iterable[_T], func: Callable[[_T, _T], _T] = ...) -> Iterator[_T]: ... class chain(Iterator[_T], Generic[_T]): @@ -28,78 +25,63 @@ class chain(Iterator[_T], Generic[_T]): def from_iterable(iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ... def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ... -def dropwhile(predicate: Predicate[_T], - iterable: Iterable[_T]) -> Iterator[_T]: ... -def filterfalse(predicate: Optional[Predicate[_T]], - iterable: Iterable[_T]) -> Iterator[_T]: ... - +def dropwhile(predicate: Predicate[_T], iterable: Iterable[_T]) -> Iterator[_T]: ... +def filterfalse(predicate: Optional[Predicate[_T]], iterable: Iterable[_T]) -> Iterator[_T]: ... @overload def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ... @overload def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... - @overload def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ... @overload -def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int], - step: Optional[int] = ...) -> Iterator[_T]: ... - +def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> Iterator[_T]: ... def starmap(func: Callable[..., _S], iterable: Iterable[Iterable[Any]]) -> Iterator[_S]: ... -def takewhile(predicate: Predicate[_T], - iterable: Iterable[_T]) -> Iterator[_T]: ... +def takewhile(predicate: Predicate[_T], iterable: Iterable[_T]) -> Iterator[_T]: ... def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ... -def zip_longest(*p: Iterable[Any], - fillvalue: Any = ...) -> Iterator[Any]: ... - -_T1 = TypeVar('_T1') -_T2 = TypeVar('_T2') -_T3 = TypeVar('_T3') -_T4 = TypeVar('_T4') -_T5 = TypeVar('_T5') -_T6 = TypeVar('_T6') +def zip_longest(*p: Iterable[Any], fillvalue: Any = ...) -> Iterator[Any]: ... +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") +_T4 = TypeVar("_T4") +_T5 = TypeVar("_T5") +_T6 = TypeVar("_T6") @overload def product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... @overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... +def product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... @overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... +def product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... @overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... +def product( + iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4] +) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... @overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], - iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... +def product( + iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5] +) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... @overload -def product(iter1: Iterable[_T1], - iter2: Iterable[_T2], - iter3: Iterable[_T3], - iter4: Iterable[_T4], - iter5: Iterable[_T5], - iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... +def product( + iter1: Iterable[_T1], + iter2: Iterable[_T2], + iter3: Iterable[_T3], + iter4: Iterable[_T4], + iter5: Iterable[_T5], + iter6: Iterable[_T6], +) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... @overload -def product(iter1: Iterable[Any], - iter2: Iterable[Any], - iter3: Iterable[Any], - iter4: Iterable[Any], - iter5: Iterable[Any], - iter6: Iterable[Any], - iter7: Iterable[Any], - *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ... +def product( + iter1: Iterable[Any], + iter2: Iterable[Any], + iter3: Iterable[Any], + iter4: Iterable[Any], + iter5: Iterable[Any], + iter6: Iterable[Any], + iter7: Iterable[Any], + *iterables: Iterable[Any] +) -> Iterator[Tuple[Any, ...]]: ... @overload def product(*iterables: Iterable[Any], repeat: int = ...) -> Iterator[Tuple[Any, ...]]: ... - -def permutations(iterable: Iterable[_T], - r: Optional[int] = ...) -> Iterator[Tuple[_T, ...]]: ... -def combinations(iterable: Iterable[_T], - r: int) -> Iterator[Tuple[_T, ...]]: ... -def combinations_with_replacement(iterable: Iterable[_T], - r: int) -> Iterator[Tuple[_T, ...]]: ... +def permutations(iterable: Iterable[_T], r: Optional[int] = ...) -> Iterator[Tuple[_T, ...]]: ... +def combinations(iterable: Iterable[_T], r: int) -> Iterator[Tuple[_T, ...]]: ... +def combinations_with_replacement(iterable: Iterable[_T], r: int) -> Iterator[Tuple[_T, ...]]: ... diff --git a/stdlib/3/json/__init__.pyi b/stdlib/3/json/__init__.pyi index bbd285ca3747..87921039d4bf 100644 --- a/stdlib/3/json/__init__.pyi +++ b/stdlib/3/json/__init__.pyi @@ -7,53 +7,61 @@ from .encoder import JSONEncoder as JSONEncoder if sys.version_info >= (3, 5): from .decoder import JSONDecodeError as JSONDecodeError -def dumps(obj: Any, - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - cls: Any = ..., - indent: Union[None, int, str] = ..., - separators: Optional[Tuple[str, str]] = ..., - default: Optional[Callable[[Any], Any]] = ..., - sort_keys: bool = ..., - **kwds: Any) -> str: ... - -def dump(obj: Any, - fp: IO[str], - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - cls: Any = ..., - indent: Union[None, int, str] = ..., - separators: Optional[Tuple[str, str]] = ..., - default: Optional[Callable[[Any], Any]] = ..., - sort_keys: bool = ..., - **kwds: Any) -> None: ... +def dumps( + obj: Any, + skipkeys: bool = ..., + ensure_ascii: bool = ..., + check_circular: bool = ..., + allow_nan: bool = ..., + cls: Any = ..., + indent: Union[None, int, str] = ..., + separators: Optional[Tuple[str, str]] = ..., + default: Optional[Callable[[Any], Any]] = ..., + sort_keys: bool = ..., + **kwds: Any +) -> str: ... +def dump( + obj: Any, + fp: IO[str], + skipkeys: bool = ..., + ensure_ascii: bool = ..., + check_circular: bool = ..., + allow_nan: bool = ..., + cls: Any = ..., + indent: Union[None, int, str] = ..., + separators: Optional[Tuple[str, str]] = ..., + default: Optional[Callable[[Any], Any]] = ..., + sort_keys: bool = ..., + **kwds: Any +) -> None: ... if sys.version_info >= (3, 6): _LoadsString = Union[str, bytes, bytearray] else: _LoadsString = str -def loads(s: _LoadsString, - encoding: Any = ..., # ignored and deprecated - cls: Any = ..., - object_hook: Optional[Callable[[Dict], Any]] = ..., - parse_float: Optional[Callable[[str], Any]] = ..., - parse_int: Optional[Callable[[str], Any]] = ..., - parse_constant: Optional[Callable[[str], Any]] = ..., - object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., - **kwds: Any) -> Any: ... + +def loads( + s: _LoadsString, + encoding: Any = ..., # ignored and deprecated + cls: Any = ..., + object_hook: Optional[Callable[[Dict], Any]] = ..., + parse_float: Optional[Callable[[str], Any]] = ..., + parse_int: Optional[Callable[[str], Any]] = ..., + parse_constant: Optional[Callable[[str], Any]] = ..., + object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., + **kwds: Any +) -> Any: ... class _Reader(Protocol): def read(self) -> _LoadsString: ... -def load(fp: _Reader, - cls: Any = ..., - object_hook: Optional[Callable[[Dict], Any]] = ..., - parse_float: Optional[Callable[[str], Any]] = ..., - parse_int: Optional[Callable[[str], Any]] = ..., - parse_constant: Optional[Callable[[str], Any]] = ..., - object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., - **kwds: Any) -> Any: ... +def load( + fp: _Reader, + cls: Any = ..., + object_hook: Optional[Callable[[Dict], Any]] = ..., + parse_float: Optional[Callable[[str], Any]] = ..., + parse_int: Optional[Callable[[str], Any]] = ..., + parse_constant: Optional[Callable[[str], Any]] = ..., + object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ..., + **kwds: Any +) -> Any: ... diff --git a/stdlib/3/json/decoder.pyi b/stdlib/3/json/decoder.pyi index 8e30c1e73359..b91be1cb3f62 100644 --- a/stdlib/3/json/decoder.pyi +++ b/stdlib/3/json/decoder.pyi @@ -17,12 +17,14 @@ class JSONDecoder: parse_constant = ... # Callable[[str], Any] strict: bool object_pairs_hook: Callable[[List[Tuple[str, Any]]], Any] - - def __init__(self, object_hook: Optional[Callable[[Dict[str, Any]], Any]] = ..., - parse_float: Optional[Callable[[str], Any]] = ..., - parse_int: Optional[Callable[[str], Any]] = ..., - parse_constant: Optional[Callable[[str], Any]] = ..., - strict: bool = ..., - object_pairs_hook: Optional[Callable[[List[Tuple[str, Any]]], Any]] = ...) -> None: ... + def __init__( + self, + object_hook: Optional[Callable[[Dict[str, Any]], Any]] = ..., + parse_float: Optional[Callable[[str], Any]] = ..., + parse_int: Optional[Callable[[str], Any]] = ..., + parse_constant: Optional[Callable[[str], Any]] = ..., + strict: bool = ..., + object_pairs_hook: Optional[Callable[[List[Tuple[str, Any]]], Any]] = ..., + ) -> None: ... def decode(self, s: str) -> Any: ... def raw_decode(self, s: str, idx: int = ...) -> Tuple[Any, int]: ... diff --git a/stdlib/3/json/encoder.pyi b/stdlib/3/json/encoder.pyi index e35f344b2f40..c3ad75eea6eb 100644 --- a/stdlib/3/json/encoder.pyi +++ b/stdlib/3/json/encoder.pyi @@ -10,12 +10,17 @@ class JSONEncoder: allow_nan: bool sort_keys: bool indent: int - - def __init__(self, skipkeys: bool = ..., ensure_ascii: bool = ..., - check_circular: bool = ..., allow_nan: bool = ..., sort_keys: bool = ..., - indent: Optional[int] = ..., separators: Optional[Tuple[str, str]] = ..., - default: Optional[Callable] = ...) -> None: ... - + def __init__( + self, + skipkeys: bool = ..., + ensure_ascii: bool = ..., + check_circular: bool = ..., + allow_nan: bool = ..., + sort_keys: bool = ..., + indent: Optional[int] = ..., + separators: Optional[Tuple[str, str]] = ..., + default: Optional[Callable] = ..., + ) -> None: ... def default(self, o: Any) -> Any: ... def encode(self, o: Any) -> str: ... def iterencode(self, o: Any, _one_shot: bool = ...) -> Iterator[str]: ... diff --git a/stdlib/3/lzma.pyi b/stdlib/3/lzma.pyi index 3f1dd90bd42d..b1ca027a7af7 100644 --- a/stdlib/3/lzma.pyi +++ b/stdlib/3/lzma.pyi @@ -4,6 +4,7 @@ from typing import IO, Any, Mapping, Optional, Sequence, Union if sys.version_info >= (3, 6): from os import PathLike + _PathOrFile = Union[str, bytes, IO[Any], PathLike[Any]] else: _PathOrFile = Union[str, bytes, IO[Any]] @@ -41,7 +42,9 @@ PRESET_EXTREME: int # from _lzma.c class LZMADecompressor(object): - def __init__(self, format: Optional[int] = ..., memlimit: Optional[int] = ..., filters: Optional[_FilterChain] = ...) -> None: ... + def __init__( + self, format: Optional[int] = ..., memlimit: Optional[int] = ..., filters: Optional[_FilterChain] = ... + ) -> None: ... def decompress(self, data: bytes, max_length: int = ...) -> bytes: ... @property def check(self) -> int: ... @@ -55,27 +58,25 @@ class LZMADecompressor(object): # from _lzma.c class LZMACompressor(object): - def __init__(self, - format: Optional[int] = ..., - check: int = ..., - preset: Optional[int] = ..., - filters: Optional[_FilterChain] = ...) -> None: ... + def __init__( + self, format: Optional[int] = ..., check: int = ..., preset: Optional[int] = ..., filters: Optional[_FilterChain] = ... + ) -> None: ... def compress(self, data: bytes) -> bytes: ... def flush(self) -> bytes: ... - class LZMAError(Exception): ... - class LZMAFile(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#5027 - def __init__(self, - filename: Optional[_PathOrFile] = ..., - mode: str = ..., - *, - format: Optional[int] = ..., - check: int = ..., - preset: Optional[int] = ..., - filters: Optional[_FilterChain] = ...) -> None: ... + def __init__( + self, + filename: Optional[_PathOrFile] = ..., + mode: str = ..., + *, + format: Optional[int] = ..., + check: int = ..., + preset: Optional[int] = ..., + filters: Optional[_FilterChain] = ... + ) -> None: ... def close(self) -> None: ... @property def closed(self) -> bool: ... @@ -91,17 +92,20 @@ class LZMAFile(io.BufferedIOBase, IO[bytes]): # type: ignore # python/mypy#502 def seek(self, offset: int, whence: int = ...) -> int: ... def tell(self) -> int: ... - -def open(filename: _PathOrFile, - mode: str = ..., - *, - format: Optional[int] = ..., - check: int = ..., - preset: Optional[int] = ..., - filters: Optional[_FilterChain] = ..., - encoding: Optional[str] = ..., - errors: Optional[str] = ..., - newline: Optional[str] = ...) -> IO[Any]: ... -def compress(data: bytes, format: int = ..., check: int = ..., preset: Optional[int] = ..., filters: Optional[_FilterChain] = ...) -> bytes: ... +def open( + filename: _PathOrFile, + mode: str = ..., + *, + format: Optional[int] = ..., + check: int = ..., + preset: Optional[int] = ..., + filters: Optional[_FilterChain] = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ... +) -> IO[Any]: ... +def compress( + data: bytes, format: int = ..., check: int = ..., preset: Optional[int] = ..., filters: Optional[_FilterChain] = ... +) -> bytes: ... def decompress(data: bytes, format: int = ..., memlimit: Optional[int] = ..., filters: Optional[_FilterChain] = ...) -> bytes: ... def is_check_supported(check: int) -> bool: ... diff --git a/stdlib/3/multiprocessing/__init__.pyi b/stdlib/3/multiprocessing/__init__.pyi index 7734af759b2a..90c4095b174c 100644 --- a/stdlib/3/multiprocessing/__init__.pyi +++ b/stdlib/3/multiprocessing/__init__.pyi @@ -23,24 +23,23 @@ from typing import Any, Callable, ContextManager, Dict, Iterable, List, Mapping, # Sychronization primitives _LockLike = Union[synchronize.Lock, synchronize.RLock] -def Barrier(parties: int, - action: Optional[Callable] = ..., - timeout: Optional[float] = ...) -> synchronize.Barrier: ... + +def Barrier(parties: int, action: Optional[Callable] = ..., timeout: Optional[float] = ...) -> synchronize.Barrier: ... def BoundedSemaphore(value: int = ...) -> synchronize.BoundedSemaphore: ... def Condition(lock: Optional[_LockLike] = ...) -> synchronize.Condition: ... def Event(lock: Optional[_LockLike] = ...) -> synchronize.Event: ... def Lock() -> synchronize.Lock: ... def RLock() -> synchronize.RLock: ... def Semaphore(value: int = ...) -> synchronize.Semaphore: ... - def Pipe(duplex: bool = ...) -> Tuple[connection.Connection, connection.Connection]: ... +def Pool( + processes: Optional[int] = ..., + initializer: Optional[Callable[..., Any]] = ..., + initargs: Iterable[Any] = ..., + maxtasksperchild: Optional[int] = ..., +) -> pool.Pool: ... -def Pool(processes: Optional[int] = ..., - initializer: Optional[Callable[..., Any]] = ..., - initargs: Iterable[Any] = ..., - maxtasksperchild: Optional[int] = ...) -> pool.Pool: ... - -class Process(): +class Process: name: str daemon: bool pid: Optional[int] @@ -48,14 +47,16 @@ class Process(): authkey: bytes sentinel: int # TODO: set type of group to None - def __init__(self, - group: Any = ..., - target: Optional[Callable] = ..., - name: Optional[str] = ..., - args: Iterable[Any] = ..., - kwargs: Mapping[Any, Any] = ..., - *, - daemon: Optional[bool] = ...) -> None: ... + def __init__( + self, + group: Any = ..., + target: Optional[Callable] = ..., + name: Optional[str] = ..., + args: Iterable[Any] = ..., + kwargs: Mapping[Any, Any] = ..., + *, + daemon: Optional[bool] = ... + ) -> None: ... def start(self) -> None: ... def run(self) -> None: ... def terminate(self) -> None: ... @@ -65,7 +66,7 @@ class Process(): def is_alive(self) -> bool: ... def join(self, timeout: Optional[float] = ...) -> None: ... -class Value(): +class Value: value: Any = ... def __init__(self, typecode_or_type: str, *args: Any, lock: Union[bool, _LockLike] = ...) -> None: ... def get_lock(self) -> _LockLike: ... diff --git a/stdlib/3/multiprocessing/connection.pyi b/stdlib/3/multiprocessing/connection.pyi index 9bbb830db1e2..1c4ddb5d53d3 100644 --- a/stdlib/3/multiprocessing/connection.pyi +++ b/stdlib/3/multiprocessing/connection.pyi @@ -15,10 +15,7 @@ class _ConnectionBase: def writable(self) -> bool: ... # undocumented def fileno(self) -> int: ... def close(self) -> None: ... - def send_bytes(self, - buf: bytes, - offset: int = ..., - size: Optional[int] = ...) -> None: ... + def send_bytes(self, buf: bytes, offset: int = ..., size: Optional[int] = ...) -> None: ... def send(self, obj: Any) -> None: ... def recv_bytes(self, maxlength: Optional[int] = ...) -> bytes: ... def recv_bytes_into(self, buf: Any, offset: int = ...) -> int: ... @@ -31,7 +28,9 @@ if sys.platform == "win32": class PipeConnection(_ConnectionBase): ... class Listener: - def __init__(self, address: Optional[_Address] = ..., family: Optional[str] = ..., backlog: int = ..., authkey: Optional[bytes] = ...) -> None: ... + def __init__( + self, address: Optional[_Address] = ..., family: Optional[str] = ..., backlog: int = ..., authkey: Optional[bytes] = ... + ) -> None: ... def accept(self) -> Connection: ... def close(self) -> None: ... @property @@ -39,10 +38,14 @@ class Listener: @property def last_accepted(self) -> Optional[_Address]: ... def __enter__(self) -> Listener: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], exc_tb: Optional[types.TracebackType]) -> None: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], exc_tb: Optional[types.TracebackType] + ) -> None: ... def deliver_challenge(connection: Connection, authkey: bytes) -> None: ... def answer_challenge(connection: Connection, authkey: bytes) -> None: ... -def wait(object_list: Iterable[Union[Connection, socket.socket, int]], timeout: Optional[float] = ...) -> List[Union[Connection, socket.socket, int]]: ... +def wait( + object_list: Iterable[Union[Connection, socket.socket, int]], timeout: Optional[float] = ... +) -> List[Union[Connection, socket.socket, int]]: ... def Client(address: _Address, family: Optional[str] = ..., authkey: Optional[bytes] = ...) -> Connection: ... def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ... diff --git a/stdlib/3/multiprocessing/context.pyi b/stdlib/3/multiprocessing/context.pyi index d1c1b864961d..dc053fbd323c 100644 --- a/stdlib/3/multiprocessing/context.pyi +++ b/stdlib/3/multiprocessing/context.pyi @@ -9,11 +9,8 @@ from typing import Any, Callable, Iterable, List, Mapping, Optional, Sequence, T _LockLike = Union[synchronize.Lock, synchronize.RLock] class ProcessError(Exception): ... - class BufferTooShort(ProcessError): ... - class TimeoutError(ProcessError): ... - class AuthenticationError(ProcessError): ... class BaseContext(object): @@ -24,7 +21,6 @@ class BaseContext(object): # N.B. The methods below are applied at runtime to generate # multiprocessing.*, so the signatures should be identical (modulo self). - @staticmethod def current_process() -> multiprocessing.Process: ... @staticmethod @@ -34,20 +30,13 @@ class BaseContext(object): def Manager(self) -> Any: ... # TODO: change return to Pipe once a stub exists in multiprocessing.connection def Pipe(self, duplex: bool) -> Any: ... - - def Barrier(self, - parties: int, - action: Optional[Callable] = ..., - timeout: Optional[float] = ...) -> synchronize.Barrier: ... - def BoundedSemaphore(self, - value: int = ...) -> synchronize.BoundedSemaphore: ... - def Condition(self, - lock: Optional[_LockLike] = ...) -> synchronize.Condition: ... + def Barrier(self, parties: int, action: Optional[Callable] = ..., timeout: Optional[float] = ...) -> synchronize.Barrier: ... + def BoundedSemaphore(self, value: int = ...) -> synchronize.BoundedSemaphore: ... + def Condition(self, lock: Optional[_LockLike] = ...) -> synchronize.Condition: ... def Event(self, lock: Optional[_LockLike] = ...) -> synchronize.Event: ... def Lock(self) -> synchronize.Lock: ... def RLock(self) -> synchronize.RLock: ... def Semaphore(self, value: int = ...) -> synchronize.Semaphore: ... - def Queue(self, maxsize: int = ...) -> queues.Queue: ... def JoinableQueue(self, maxsize: int = ...) -> queues.JoinableQueue: ... def SimpleQueue(self) -> queues.SimpleQueue: ... @@ -56,7 +45,7 @@ class BaseContext(object): processes: Optional[int] = ..., initializer: Optional[Callable[..., Any]] = ..., initargs: Iterable[Any] = ..., - maxtasksperchild: Optional[int] = ... + maxtasksperchild: Optional[int] = ..., ) -> multiprocessing.pool.Pool: ... def Process( self, @@ -79,22 +68,11 @@ class BaseContext(object): # TODO: typecode_or_type param is a ctype with a base class of _SimpleCData or array.typecode Need to figure out # how to handle the ctype # TODO: change return to Value once a stub exists in multiprocessing.sharedctypes - def Value( - self, - typecode_or_type: Any, - *args: Any, - lock: bool = ... - ) -> Any: ... + def Value(self, typecode_or_type: Any, *args: Any, lock: bool = ...) -> Any: ... # TODO: typecode_or_type param is a ctype with a base class of _SimpleCData or array.typecode Need to figure out # how to handle the ctype # TODO: change return to Array once a stub exists in multiprocessing.sharedctypes - def Array( - self, - typecode_or_type: Any, - size_or_initializer: Union[int, Sequence[Any]], - *, - lock: bool = ... - ) -> Any: ... + def Array(self, typecode_or_type: Any, size_or_initializer: Union[int, Sequence[Any]], *, lock: bool = ...) -> Any: ... def freeze_support(self) -> None: ... def get_logger(self) -> Logger: ... def log_to_stderr(self, level: Optional[str] = ...) -> Logger: ... @@ -118,43 +96,38 @@ class Process(object): class DefaultContext(object): Process: Type[multiprocessing.Process] - def __init__(self, context: BaseContext) -> None: ... def get_context(self, method: Optional[str] = ...) -> BaseContext: ... def set_start_method(self, method: str, force: bool = ...) -> None: ... def get_start_method(self, allow_none: bool = ...) -> str: ... def get_all_start_methods(self) -> List[str]: ... -if sys.platform != 'win32': +if sys.platform != "win32": # TODO: type should be BaseProcess once a stub in multiprocessing.process exists class ForkProcess(Any): # type: ignore _start_method: str @staticmethod def _Popen(process_obj: Any) -> Any: ... - # TODO: type should be BaseProcess once a stub in multiprocessing.process exists class SpawnProcess(Any): # type: ignore _start_method: str @staticmethod def _Popen(process_obj: Any) -> SpawnProcess: ... - # TODO: type should be BaseProcess once a stub in multiprocessing.process exists class ForkServerProcess(Any): # type: ignore _start_method: str @staticmethod def _Popen(process_obj: Any) -> Any: ... - class ForkContext(BaseContext): _name: str Process: Type[ForkProcess] - class SpawnContext(BaseContext): _name: str Process: Type[SpawnProcess] - class ForkServerContext(BaseContext): _name: str Process: Type[ForkServerProcess] + else: # TODO: type should be BaseProcess once a stub in multiprocessing.process exists class SpawnProcess(Any): # type: ignore @@ -162,14 +135,15 @@ else: @staticmethod # TODO: type should be BaseProcess once a stub in multiprocessing.process exists def _Popen(process_obj: Process) -> Any: ... - class SpawnContext(BaseContext): _name: str Process: Type[SpawnProcess] def _force_start_method(method: str) -> None: ... + # TODO: type should be BaseProcess once a stub in multiprocessing.process exists def get_spawning_popen() -> Optional[Any]: ... + # TODO: type should be BaseProcess once a stub in multiprocessing.process exists def set_spawning_popen(popen: Any) -> None: ... def assert_spawning(obj: Any) -> None: ... diff --git a/stdlib/3/multiprocessing/dummy/__init__.pyi b/stdlib/3/multiprocessing/dummy/__init__.pyi index 1bef76d4f6bc..e51e7704b4ac 100644 --- a/stdlib/3/multiprocessing/dummy/__init__.pyi +++ b/stdlib/3/multiprocessing/dummy/__init__.pyi @@ -10,7 +10,6 @@ from .connection import Pipe JoinableQueue = Queue - class DummyProcess(threading.Thread): _children: weakref.WeakKeyDictionary _parent: threading.Thread @@ -30,7 +29,6 @@ class Value(object): value: Any def __init__(self, typecode, value, lock=...) -> None: ... - def Array(typecode, sequence, lock=...) -> array.array: ... def Manager() -> Any: ... def Pool(processes=..., initializer=..., initargs=...) -> Any: ... diff --git a/stdlib/3/multiprocessing/dummy/connection.pyi b/stdlib/3/multiprocessing/dummy/connection.pyi index 3b33826ff734..17f754a43372 100644 --- a/stdlib/3/multiprocessing/dummy/connection.pyi +++ b/stdlib/3/multiprocessing/dummy/connection.pyi @@ -3,8 +3,8 @@ from typing import Any, List, Optional, Tuple, Type, TypeVar families: List[None] -_TConnection = TypeVar('_TConnection', bound=Connection) -_TListener = TypeVar('_TListener', bound=Listener) +_TConnection = TypeVar("_TConnection", bound=Connection) +_TListener = TypeVar("_TListener", bound=Listener) class Connection(object): _in: Any @@ -29,6 +29,5 @@ class Listener(object): def accept(self) -> Connection: ... def close(self) -> None: ... - def Client(address) -> Connection: ... def Pipe(duplex: bool = ...) -> Tuple[Connection, Connection]: ... diff --git a/stdlib/3/multiprocessing/managers.pyi b/stdlib/3/multiprocessing/managers.pyi index 8c9b150be600..450c8476c557 100644 --- a/stdlib/3/multiprocessing/managers.pyi +++ b/stdlib/3/multiprocessing/managers.pyi @@ -6,9 +6,9 @@ import queue import threading from typing import Any, Callable, ContextManager, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, TypeVar, Union -_T = TypeVar('_T') -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') +_T = TypeVar("_T") +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") class Namespace: ... @@ -18,14 +18,17 @@ class BaseManager(ContextManager[BaseManager]): address: Union[str, Tuple[str, int]] def connect(self) -> None: ... @classmethod - def register(cls, typeid: str, callable: Optional[Callable] = ..., - proxytype: Any = ..., - exposed: Optional[Sequence[str]] = ..., - method_to_typeid: Optional[Mapping[str, str]] = ..., - create_method: bool = ...) -> None: ... + def register( + cls, + typeid: str, + callable: Optional[Callable] = ..., + proxytype: Any = ..., + exposed: Optional[Sequence[str]] = ..., + method_to_typeid: Optional[Mapping[str, str]] = ..., + create_method: bool = ..., + ) -> None: ... def shutdown(self) -> None: ... - def start(self, initializer: Optional[Callable[..., Any]] = ..., - initargs: Iterable[Any] = ...) -> None: ... + def start(self, initializer: Optional[Callable[..., Any]] = ..., initargs: Iterable[Any] = ...) -> None: ... class SyncManager(BaseManager): def BoundedSemaphore(self, value: Any = ...) -> threading.BoundedSemaphore: ... diff --git a/stdlib/3/multiprocessing/pool.pyi b/stdlib/3/multiprocessing/pool.pyi index 07da7eadce1d..1f2b997d1d25 100644 --- a/stdlib/3/multiprocessing/pool.pyi +++ b/stdlib/3/multiprocessing/pool.pyi @@ -1,9 +1,9 @@ from types import TracebackType from typing import Any, Callable, ContextManager, Generic, Iterable, Iterator, List, Mapping, Optional, Type, TypeVar -_PT = TypeVar('_PT', bound='Pool') -_S = TypeVar('_S') -_T = TypeVar('_T') +_PT = TypeVar("_PT", bound="Pool") +_S = TypeVar("_S") +_T = TypeVar("_T") class ApplyResult(Generic[_T]): def get(self, timeout: Optional[float] = ...) -> _T: ... @@ -14,7 +14,7 @@ class ApplyResult(Generic[_T]): # alias created during issue #17805 AsyncResult = ApplyResult -_IMIT = TypeVar('_IMIT', bound=IMapIterator) +_IMIT = TypeVar("_IMIT", bound=IMapIterator) class IMapIterator(Iterator[_T]): def __iter__(self: _IMIT) -> _IMIT: ... @@ -24,59 +24,58 @@ class IMapIterator(Iterator[_T]): class IMapUnorderedIterator(IMapIterator): ... class Pool(ContextManager[Pool]): - def __init__(self, processes: Optional[int] = ..., - initializer: Optional[Callable[..., None]] = ..., - initargs: Iterable[Any] = ..., - maxtasksperchild: Optional[int] = ..., - context: Optional[Any] = ...) -> None: ... - def apply(self, - func: Callable[..., _T], - args: Iterable[Any] = ..., - kwds: Mapping[str, Any] = ...) -> _T: ... - def apply_async(self, - func: Callable[..., _T], - args: Iterable[Any] = ..., - kwds: Mapping[str, Any] = ..., - callback: Optional[Callable[[_T], None]] = ..., - error_callback: Optional[Callable[[BaseException], None]] = ...) -> AsyncResult[_T]: ... - def map(self, - func: Callable[[_S], _T], - iterable: Iterable[_S] = ..., - chunksize: Optional[int] = ...) -> List[_T]: ... - def map_async(self, func: Callable[[_S], _T], - iterable: Iterable[_S] = ..., - chunksize: Optional[int] = ..., - callback: Optional[Callable[[_T], None]] = ..., - error_callback: Optional[Callable[[BaseException], None]] = ...) -> AsyncResult[List[_T]]: ... - def imap(self, - func: Callable[[_S], _T], - iterable: Iterable[_S] = ..., - chunksize: Optional[int] = ...) -> IMapIterator[_T]: ... - def imap_unordered(self, - func: Callable[[_S], _T], - iterable: Iterable[_S] = ..., - chunksize: Optional[int] = ...) -> IMapIterator[_T]: ... - def starmap(self, - func: Callable[..., _T], - iterable: Iterable[Iterable[Any]] = ..., - chunksize: Optional[int] = ...) -> List[_T]: ... - def starmap_async(self, - func: Callable[..., _T], - iterable: Iterable[Iterable[Any]] = ..., - chunksize: Optional[int] = ..., - callback: Optional[Callable[[_T], None]] = ..., - error_callback: Optional[Callable[[BaseException], None]] = ...) -> AsyncResult[List[_T]]: ... + def __init__( + self, + processes: Optional[int] = ..., + initializer: Optional[Callable[..., None]] = ..., + initargs: Iterable[Any] = ..., + maxtasksperchild: Optional[int] = ..., + context: Optional[Any] = ..., + ) -> None: ... + def apply(self, func: Callable[..., _T], args: Iterable[Any] = ..., kwds: Mapping[str, Any] = ...) -> _T: ... + def apply_async( + self, + func: Callable[..., _T], + args: Iterable[Any] = ..., + kwds: Mapping[str, Any] = ..., + callback: Optional[Callable[[_T], None]] = ..., + error_callback: Optional[Callable[[BaseException], None]] = ..., + ) -> AsyncResult[_T]: ... + def map(self, func: Callable[[_S], _T], iterable: Iterable[_S] = ..., chunksize: Optional[int] = ...) -> List[_T]: ... + def map_async( + self, + func: Callable[[_S], _T], + iterable: Iterable[_S] = ..., + chunksize: Optional[int] = ..., + callback: Optional[Callable[[_T], None]] = ..., + error_callback: Optional[Callable[[BaseException], None]] = ..., + ) -> AsyncResult[List[_T]]: ... + def imap( + self, func: Callable[[_S], _T], iterable: Iterable[_S] = ..., chunksize: Optional[int] = ... + ) -> IMapIterator[_T]: ... + def imap_unordered( + self, func: Callable[[_S], _T], iterable: Iterable[_S] = ..., chunksize: Optional[int] = ... + ) -> IMapIterator[_T]: ... + def starmap( + self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]] = ..., chunksize: Optional[int] = ... + ) -> List[_T]: ... + def starmap_async( + self, + func: Callable[..., _T], + iterable: Iterable[Iterable[Any]] = ..., + chunksize: Optional[int] = ..., + callback: Optional[Callable[[_T], None]] = ..., + error_callback: Optional[Callable[[BaseException], None]] = ..., + ) -> AsyncResult[List[_T]]: ... def close(self) -> None: ... def terminate(self) -> None: ... def join(self) -> None: ... def __enter__(self: _PT) -> _PT: ... - class ThreadPool(Pool, ContextManager[ThreadPool]): - - def __init__(self, processes: Optional[int] = ..., - initializer: Optional[Callable[..., Any]] = ..., - initargs: Iterable[Any] = ...) -> None: ... + def __init__( + self, processes: Optional[int] = ..., initializer: Optional[Callable[..., Any]] = ..., initargs: Iterable[Any] = ... + ) -> None: ... # undocumented RUN: int diff --git a/stdlib/3/multiprocessing/queues.pyi b/stdlib/3/multiprocessing/queues.pyi index 319de3772cf1..380e840ba984 100644 --- a/stdlib/3/multiprocessing/queues.pyi +++ b/stdlib/3/multiprocessing/queues.pyi @@ -1,7 +1,7 @@ import queue from typing import Any, Generic, Optional, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") class Queue(queue.Queue[_T]): # FIXME: `ctx` is a circular dependency and it's not actually optional. diff --git a/stdlib/3/multiprocessing/spawn.pyi b/stdlib/3/multiprocessing/spawn.pyi index e40bf4435982..1cfbced9c01b 100644 --- a/stdlib/3/multiprocessing/spawn.pyi +++ b/stdlib/3/multiprocessing/spawn.pyi @@ -10,9 +10,12 @@ def is_forking(argv: Sequence[str]) -> bool: ... def freeze_support() -> None: ... def get_command_line(**kwds: Any) -> List[str]: ... def spawn_main(pipe_handle: int, parent_pid: Optional[int] = ..., tracker_fd: Optional[int] = ...) -> None: ... + # undocumented def _main(fd: int) -> Any: ... def get_preparation_data(name: str) -> Dict[str, Any]: ... + old_main_modules: List[ModuleType] = ... + def prepare(data: Mapping[str, Any]) -> None: ... def import_main_path(main_path: str) -> None: ... diff --git a/stdlib/3/multiprocessing/synchronize.pyi b/stdlib/3/multiprocessing/synchronize.pyi index 5085a2dda4bf..b4cabe1adcc8 100644 --- a/stdlib/3/multiprocessing/synchronize.pyi +++ b/stdlib/3/multiprocessing/synchronize.pyi @@ -6,40 +6,27 @@ from typing import Callable, ContextManager, Optional, Union _LockLike = Union[Lock, RLock] class Barrier(threading.Barrier): - def __init__(self, - parties: int, - action: Optional[Callable] = ..., - timeout: Optional[float] = ..., - * - ctx: BaseContext) -> None: ... + def __init__( + self, parties: int, action: Optional[Callable] = ..., timeout: Optional[float] = ..., *ctx: BaseContext + ) -> None: ... class BoundedSemaphore(Semaphore): def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ... class Condition(ContextManager[bool]): - def __init__(self, - lock: Optional[_LockLike] = ..., - *, - ctx: BaseContext) -> None: ... + def __init__(self, lock: Optional[_LockLike] = ..., *, ctx: BaseContext) -> None: ... if sys.version_info >= (3, 7): def notify(self, n: int = ...) -> None: ... else: def notify(self) -> None: ... def notify_all(self) -> None: ... def wait(self, timeout: Optional[float] = ...) -> bool: ... - def wait_for(self, - predicate: Callable[[], bool], - timeout: Optional[float] = ...) -> bool: ... - def acquire(self, - block: bool = ..., - timeout: Optional[float] = ...) -> bool: ... + def wait_for(self, predicate: Callable[[], bool], timeout: Optional[float] = ...) -> bool: ... + def acquire(self, block: bool = ..., timeout: Optional[float] = ...) -> bool: ... def release(self) -> None: ... class Event(ContextManager[bool]): - def __init__(self, - lock: Optional[_LockLike] = ..., - *, - ctx: BaseContext) -> None: ... + def __init__(self, lock: Optional[_LockLike] = ..., *, ctx: BaseContext) -> None: ... def is_set(self) -> bool: ... def set(self) -> None: ... def clear(self) -> None: ... @@ -56,7 +43,5 @@ class Semaphore(SemLock): # Not part of public API class SemLock(ContextManager[bool]): - def acquire(self, - block: bool = ..., - timeout: Optional[float] = ...) -> bool: ... + def acquire(self, block: bool = ..., timeout: Optional[float] = ...) -> bool: ... def release(self) -> None: ... diff --git a/stdlib/3/nntplib.pyi b/stdlib/3/nntplib.pyi index 3ae25d223b3b..106583b8df7d 100644 --- a/stdlib/3/nntplib.pyi +++ b/stdlib/3/nntplib.pyi @@ -5,12 +5,12 @@ import socket import ssl from typing import IO, Any, Dict, Iterable, List, NamedTuple, Optional, Tuple, TypeVar, Union -_SelfT = TypeVar('_SelfT', bound=_NNTPBase) +_SelfT = TypeVar("_SelfT", bound=_NNTPBase) _File = Union[IO[bytes], bytes, str, None] - class NNTPError(Exception): response: str + class NNTPReplyError(NNTPError): ... class NNTPTemporaryError(NNTPError): ... class NNTPPermanentError(NNTPError): ... @@ -20,17 +20,8 @@ class NNTPDataError(NNTPError): ... NNTP_PORT: int NNTP_SSL_PORT: int -GroupInfo = NamedTuple('GroupInfo', [ - ('group', str), - ('last', str), - ('first', str), - ('flag', str), -]) -ArticleInfo = NamedTuple('ArticleInfo', [ - ('number', int), - ('message_id', str), - ('lines', List[bytes]), -]) +GroupInfo = NamedTuple("GroupInfo", [("group", str), ("last", str), ("first", str), ("flag", str)]) +ArticleInfo = NamedTuple("ArticleInfo", [("number", int), ("message_id", str), ("lines", List[bytes])]) def decode_header(header_str: str) -> str: ... @@ -47,9 +38,7 @@ class _NNTPBase: authenticated: bool nntp_implementation: str nntp_version: int - - def __init__(self, file: IO[bytes], host: str, - readermode: Optional[bool] = ..., timeout: float = ...) -> None: ... + def __init__(self, file: IO[bytes], host: str, readermode: Optional[bool] = ..., timeout: float = ...) -> None: ... def __enter__(self: _SelfT) -> _SelfT: ... def __exit__(self, *args: Any) -> None: ... def getwelcome(self) -> str: ... @@ -58,7 +47,9 @@ class _NNTPBase: def debug(self, level: int) -> None: ... def capabilities(self) -> Tuple[str, Dict[str, List[str]]]: ... def newgroups(self, date: Union[datetime.date, datetime.datetime], *, file: _File = ...) -> Tuple[str, List[str]]: ... - def newnews(self, group: str, date: Union[datetime.date, datetime.datetime], *, file: _File = ...) -> Tuple[str, List[str]]: ... + def newnews( + self, group: str, date: Union[datetime.date, datetime.datetime], *, file: _File = ... + ) -> Tuple[str, List[str]]: ... def list(self, group_pattern: Optional[str] = ..., *, file: _File = ...) -> Tuple[str, List[str]]: ... def description(self, group: str) -> str: ... def descriptions(self, group_pattern: str) -> Tuple[str, Dict[str, str]]: ... @@ -73,7 +64,9 @@ class _NNTPBase: def slave(self) -> str: ... def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> Tuple[str, List[str]]: ... def xover(self, start: int, end: int, *, file: _File = ...) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ... - def over(self, message_spec: Union[None, str, List[Any], Tuple[Any, ...]], *, file: _File = ...) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ... + def over( + self, message_spec: Union[None, str, List[Any], Tuple[Any, ...]], *, file: _File = ... + ) -> Tuple[str, List[Tuple[int, Dict[str, str]]]]: ... def xgtitle(self, group: str, *, file: _File = ...) -> Tuple[str, List[Tuple[str, str]]]: ... def xpath(self, id: Any) -> Tuple[str, str]: ... def date(self) -> Tuple[str, datetime.datetime]: ... @@ -83,20 +76,30 @@ class _NNTPBase: def login(self, user: Optional[str] = ..., password: Optional[str] = ..., usenetrc: bool = ...) -> None: ... def starttls(self, ssl_context: Optional[ssl.SSLContext] = ...) -> None: ... - class NNTP(_NNTPBase): port: int sock: socket.socket - - def __init__(self, host: str, port: int = ..., user: Optional[str] = ..., password: Optional[str] = ..., - readermode: Optional[bool] = ..., usenetrc: bool = ..., - timeout: float = ...) -> None: ... - + def __init__( + self, + host: str, + port: int = ..., + user: Optional[str] = ..., + password: Optional[str] = ..., + readermode: Optional[bool] = ..., + usenetrc: bool = ..., + timeout: float = ..., + ) -> None: ... class NNTP_SSL(_NNTPBase): sock: socket.socket - - def __init__(self, host: str, port: int = ..., user: Optional[str] = ..., password: Optional[str] = ..., - ssl_context: Optional[ssl.SSLContext] = ..., - readermode: Optional[bool] = ..., usenetrc: bool = ..., - timeout: float = ...) -> None: ... + def __init__( + self, + host: str, + port: int = ..., + user: Optional[str] = ..., + password: Optional[str] = ..., + ssl_context: Optional[ssl.SSLContext] = ..., + readermode: Optional[bool] = ..., + usenetrc: bool = ..., + timeout: float = ..., + ) -> None: ... diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index f2927f4bfd19..8cf5261d48b1 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -2,6 +2,7 @@ # Ron Murawski import sys + # Re-exported names from other modules. from builtins import OSError as error from io import TextIOWrapper as _TextIOWrapper @@ -32,7 +33,7 @@ from typing import ( from . import path as path -_T = TypeVar('_T') +_T = TypeVar("_T") # ----- os variables ----- @@ -45,7 +46,7 @@ if sys.version_info >= (3, 3): supports_effective_ids: Set[Callable[..., Any]] supports_follow_symlinks: Set[Callable[..., Any]] - if sys.platform != 'win32': + if sys.platform != "win32": # Unix only PRIO_PROCESS: int PRIO_PGRP: int @@ -100,11 +101,10 @@ if sys.version_info >= (3, 3): RTLD_NOLOAD: int RTLD_DEEPBIND: int - SEEK_SET: int SEEK_CUR: int SEEK_END: int -if sys.version_info >= (3, 3) and sys.platform != 'win32': +if sys.version_info >= (3, 3) and sys.platform != "win32": SEEK_DATA: int # some flavors of Unix SEEK_HOLE: int # some flavors of Unix @@ -118,28 +118,28 @@ O_TRUNC: int # We don't use sys.platform for O_* flags to denote platform-dependent APIs because some codes, # including tests for mypy, use a more finer way than sys.platform before using these APIs # See https://github.com/python/typeshed/pull/2286 for discussions -O_DSYNC: int # Unix only -O_RSYNC: int # Unix only -O_SYNC: int # Unix only -O_NDELAY: int # Unix only +O_DSYNC: int # Unix only +O_RSYNC: int # Unix only +O_SYNC: int # Unix only +O_NDELAY: int # Unix only O_NONBLOCK: int # Unix only -O_NOCTTY: int # Unix only +O_NOCTTY: int # Unix only if sys.version_info >= (3, 3): O_CLOEXEC: int # Unix only -O_SHLOCK: int # Unix only -O_EXLOCK: int # Unix only -O_BINARY: int # Windows only +O_SHLOCK: int # Unix only +O_EXLOCK: int # Unix only +O_BINARY: int # Windows only O_NOINHERIT: int # Windows only O_SHORT_LIVED: int # Windows only O_TEMPORARY: int # Windows only -O_RANDOM: int # Windows only +O_RANDOM: int # Windows only O_SEQUENTIAL: int # Windows only -O_TEXT: int # Windows only -O_ASYNC: int # Gnu extension if in C library -O_DIRECT: int # Gnu extension if in C library +O_TEXT: int # Windows only +O_ASYNC: int # Gnu extension if in C library +O_DIRECT: int # Gnu extension if in C library O_DIRECTORY: int # Gnu extension if in C library -O_NOFOLLOW: int # Gnu extension if in C library -O_NOATIME: int # Gnu extension if in C library +O_NOFOLLOW: int # Gnu extension if in C library +O_NOATIME: int # Gnu extension if in C library if sys.version_info >= (3, 4): O_PATH: int # Gnu extension if in C library O_TMPFILE: int # Gnu extension if in C library @@ -148,7 +148,7 @@ O_LARGEFILE: int # Gnu extension if in C library curdir: str pardir: str sep: str -if sys.platform == 'win32': +if sys.platform == "win32": altsep: str else: altsep: Optional[str] @@ -176,7 +176,7 @@ environ: _Environ[str] if sys.version_info >= (3, 2): environb: _Environ[bytes] -if sys.platform != 'win32': +if sys.platform != "win32": confstr_names: Dict[str, int] pathconf_names: Dict[str, int] sysconf_names: Dict[str, int] @@ -202,12 +202,12 @@ if sys.platform != 'win32': P_NOWAIT: int P_NOWAITO: int P_WAIT: int -if sys.platform == 'win32': +if sys.platform == "win32": P_DETACH: int P_OVERLAY: int # wait()/waitpid() options -if sys.platform != 'win32': +if sys.platform != "win32": WNOHANG: int # Unix only WCONTINUED: int # some Unix systems WUNTRACED: int # Unix only @@ -235,12 +235,9 @@ class stat_result: st_atime_ns: int # time of most recent access, in nanoseconds st_mtime_ns: int # time of most recent content modification in nanoseconds st_ctime_ns: int # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) in nanoseconds - def __getitem__(self, i: int) -> int: ... - # not documented def __init__(self, tuple: Tuple[int, ...]) -> None: ... - # On some Unix systems (such as Linux), the following attributes may also # be available: st_blocks: int # number of blocks allocated for file @@ -279,8 +276,8 @@ if sys.version_info >= (3, 6): def is_file(self, *, follow_symlinks: bool = ...) -> bool: ... def is_symlink(self) -> bool: ... def stat(self, *, follow_symlinks: bool = ...) -> stat_result: ... - def __fspath__(self) -> AnyStr: ... + elif sys.version_info >= (3, 5): class DirEntry(Generic[AnyStr]): # This is what the scandir interator yields @@ -294,8 +291,7 @@ elif sys.version_info >= (3, 5): def is_symlink(self) -> bool: ... def stat(self, *, follow_symlinks: bool = ...) -> stat_result: ... - -if sys.platform != 'win32': +if sys.platform != "win32": class statvfs_result: # Unix only f_bsize: int f_frsize: int @@ -311,11 +307,13 @@ if sys.platform != 'win32': # ----- os function stubs ----- if sys.version_info >= (3, 6): def fsencode(filename: Union[str, bytes, PathLike]) -> bytes: ... + else: def fsencode(filename: Union[str, bytes]) -> bytes: ... if sys.version_info >= (3, 6): def fsdecode(filename: Union[str, bytes, PathLike]) -> str: ... + else: def fsdecode(filename: Union[str, bytes]) -> str: ... @@ -328,6 +326,7 @@ if sys.version_info >= (3, 6): def fspath(path: PathLike) -> Any: ... def get_exec_path(env: Optional[Mapping[str, str]] = ...) -> List[str]: ... + # NOTE: get_exec_path(): returns List[bytes] when env not None def getlogin() -> str: ... def getpid() -> int: ... @@ -335,7 +334,7 @@ def getppid() -> int: ... def strerror(code: int) -> str: ... def umask(mask: int) -> int: ... -if sys.platform != 'win32': +if sys.platform != "win32": # Unix only def ctermid() -> str: ... def getegid() -> int: ... @@ -381,29 +380,43 @@ def putenv(key: Union[bytes, Text], value: Union[bytes, Text]) -> None: ... def unsetenv(key: Union[bytes, Text]) -> None: ... # Return IO or TextIO -def fdopen(fd: int, mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: str = ..., newline: str = ..., closefd: bool = ...) -> Any: ... +def fdopen( + fd: int, + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + errors: str = ..., + newline: str = ..., + closefd: bool = ..., +) -> Any: ... def close(fd: int) -> None: ... def closerange(fd_low: int, fd_high: int) -> None: ... def device_encoding(fd: int) -> Optional[str]: ... def dup(fd: int) -> int: ... + if sys.version_info >= (3, 7): def dup2(fd: int, fd2: int, inheritable: bool = ...) -> int: ... + elif sys.version_info >= (3, 4): def dup2(fd: int, fd2: int, inheritable: bool = ...) -> None: ... + else: def dup2(fd: int, fd2: int) -> None: ... + def fstat(fd: int) -> stat_result: ... def fsync(fd: int) -> None: ... def lseek(fd: int, pos: int, how: int) -> int: ... + if sys.version_info >= (3, 3): def open(file: _PathType, flags: int, mode: int = ..., *, dir_fd: Optional[int] = ...) -> int: ... + else: def open(file: _PathType, flags: int, mode: int = ...) -> int: ... + def pipe() -> Tuple[int, int]: ... def read(fd: int, n: int) -> bytes: ... -if sys.platform != 'win32': +if sys.platform != "win32": # Unix only def fchmod(fd: int, mode: int) -> None: ... def fchown(fd: int, uid: int, gid: int) -> None: ... @@ -427,52 +440,78 @@ if sys.platform != 'win32': @overload def sendfile(__out_fd: int, __in_fd: int, offset: Optional[int], count: int) -> int: ... @overload - def sendfile(__out_fd: int, __in_fd: int, offset: int, count: int, - headers: Sequence[bytes] = ..., trailers: Sequence[bytes] = ..., flags: int = ...) -> int: ... # FreeBSD and Mac OS X only + def sendfile( + __out_fd: int, + __in_fd: int, + offset: int, + count: int, + headers: Sequence[bytes] = ..., + trailers: Sequence[bytes] = ..., + flags: int = ..., + ) -> int: ... # FreeBSD and Mac OS X only def readv(fd: int, buffers: Sequence[bytearray]) -> int: ... def writev(fd: int, buffers: Sequence[bytes]) -> int: ... -terminal_size = NamedTuple('terminal_size', [('columns', int), ('lines', int)]) +terminal_size = NamedTuple("terminal_size", [("columns", int), ("lines", int)]) + def get_terminal_size(fd: int = ...) -> terminal_size: ... if sys.version_info >= (3, 4): def get_inheritable(fd: int) -> bool: ... def set_inheritable(fd: int, inheritable: bool) -> None: ... -if sys.platform != 'win32': +if sys.platform != "win32": # Unix only def tcgetpgrp(fd: int) -> int: ... def tcsetpgrp(fd: int, pg: int) -> None: ... def ttyname(fd: int) -> str: ... + def write(fd: int, string: bytes) -> int: ... + if sys.version_info >= (3, 3): - def access(path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ..., - effective_ids: bool = ..., follow_symlinks: bool = ...) -> bool: ... + def access( + path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ..., effective_ids: bool = ..., follow_symlinks: bool = ... + ) -> bool: ... + else: def access(path: _PathType, mode: int) -> bool: ... + def chdir(path: _FdOrPathType) -> None: ... def fchdir(fd: int) -> None: ... def getcwd() -> str: ... def getcwdb() -> bytes: ... + if sys.version_info >= (3, 3): def chmod(path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ... - if sys.platform != 'win32': + if sys.platform != "win32": def chflags(path: _PathType, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix - def chown(path: _FdOrPathType, uid: int, gid: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ... # Unix only + def chown( + path: _FdOrPathType, uid: int, gid: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ... + ) -> None: ... # Unix only + else: def chmod(path: _PathType, mode: int) -> None: ... - if sys.platform != 'win32': + if sys.platform != "win32": def chflags(path: _PathType, flags: int) -> None: ... # Some flavors of Unix def chown(path: _PathType, uid: int, gid: int) -> None: ... # Unix only -if sys.platform != 'win32': + +if sys.platform != "win32": # Unix only def chroot(path: _PathType) -> None: ... def lchflags(path: _PathType, flags: int) -> None: ... def lchmod(path: _PathType, mode: int) -> None: ... def lchown(path: _PathType, uid: int, gid: int) -> None: ... + if sys.version_info >= (3, 3): - def link(src: _PathType, link_name: _PathType, *, src_dir_fd: Optional[int] = ..., - dst_dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ... + def link( + src: _PathType, + link_name: _PathType, + *, + src_dir_fd: Optional[int] = ..., + dst_dir_fd: Optional[int] = ..., + follow_symlinks: bool = ... + ) -> None: ... + else: def link(src: _PathType, link_name: _PathType) -> None: ... @@ -485,6 +524,7 @@ if sys.version_info >= (3, 6): def listdir(path: int) -> List[str]: ... @overload def listdir(path: PathLike[str]) -> List[str]: ... + elif sys.version_info >= (3, 3): @overload def listdir(path: Optional[str] = ...) -> List[str]: ... @@ -492,6 +532,7 @@ elif sys.version_info >= (3, 3): def listdir(path: bytes) -> List[bytes]: ... @overload def listdir(path: int) -> List[str]: ... + else: @overload def listdir(path: Optional[str] = ...) -> List[str]: ... @@ -501,56 +542,73 @@ else: if sys.version_info >= (3, 3): def lstat(path: _PathType, *, dir_fd: Optional[int] = ...) -> stat_result: ... def mkdir(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... - if sys.platform != 'win32': + if sys.platform != "win32": def mkfifo(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... # Unix only + else: def lstat(path: _PathType) -> stat_result: ... def mkdir(path: _PathType, mode: int = ...) -> None: ... - if sys.platform != 'win32': + if sys.platform != "win32": def mkfifo(path: _PathType, mode: int = ...) -> None: ... # Unix only + if sys.version_info >= (3, 4): def makedirs(name: _PathType, mode: int = ..., exist_ok: bool = ...) -> None: ... + else: def makedirs(path: _PathType, mode: int = ..., exist_ok: bool = ...) -> None: ... + if sys.version_info >= (3, 4): - def mknod(path: _PathType, mode: int = ..., device: int = ..., - *, dir_fd: Optional[int] = ...) -> None: ... + def mknod(path: _PathType, mode: int = ..., device: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... + elif sys.version_info >= (3, 3): - def mknod(filename: _PathType, mode: int = ..., device: int = ..., - *, dir_fd: Optional[int] = ...) -> None: ... + def mknod(filename: _PathType, mode: int = ..., device: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... + else: def mknod(filename: _PathType, mode: int = ..., device: int = ...) -> None: ... + def major(device: int) -> int: ... def minor(device: int) -> int: ... def makedev(major: int, minor: int) -> int: ... -if sys.platform != 'win32': + +if sys.platform != "win32": def pathconf(path: _FdOrPathType, name: Union[str, int]) -> int: ... # Unix only + if sys.version_info >= (3, 6): def readlink(path: Union[AnyStr, PathLike[AnyStr]], *, dir_fd: Optional[int] = ...) -> AnyStr: ... + elif sys.version_info >= (3, 3): def readlink(path: AnyStr, *, dir_fd: Optional[int] = ...) -> AnyStr: ... + else: def readlink(path: AnyStr) -> AnyStr: ... + if sys.version_info >= (3, 3): def remove(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ... + else: def remove(path: _PathType) -> None: ... + if sys.version_info >= (3, 4): def removedirs(name: _PathType) -> None: ... + else: def removedirs(path: _PathType) -> None: ... + if sys.version_info >= (3, 3): - def rename(src: _PathType, dst: _PathType, *, - src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ... + def rename(src: _PathType, dst: _PathType, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ... + else: def rename(src: _PathType, dst: _PathType) -> None: ... + def renames(old: _PathType, new: _PathType) -> None: ... + if sys.version_info >= (3, 3): - def replace(src: _PathType, dst: _PathType, *, - src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ... + def replace(src: _PathType, dst: _PathType, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ... def rmdir(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ... + else: def rmdir(path: _PathType) -> None: ... + if sys.version_info >= (3, 7): class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]): def __next__(self) -> DirEntry[AnyStr]: ... @@ -561,6 +619,7 @@ if sys.version_info >= (3, 7): def scandir(path: int) -> _ScandirIterator[str]: ... @overload def scandir(path: Union[AnyStr, PathLike[AnyStr]]) -> _ScandirIterator[AnyStr]: ... + elif sys.version_info >= (3, 6): class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]): def __next__(self) -> DirEntry[AnyStr]: ... @@ -569,74 +628,112 @@ elif sys.version_info >= (3, 6): def scandir() -> _ScandirIterator[str]: ... @overload def scandir(path: Union[AnyStr, PathLike[AnyStr]]) -> _ScandirIterator[AnyStr]: ... + elif sys.version_info >= (3, 5): @overload def scandir() -> Iterator[DirEntry[str]]: ... @overload def scandir(path: AnyStr) -> Iterator[DirEntry[AnyStr]]: ... + if sys.version_info >= (3, 3): - def stat(path: _FdOrPathType, *, dir_fd: Optional[int] = ..., - follow_symlinks: bool = ...) -> stat_result: ... + def stat(path: _FdOrPathType, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> stat_result: ... + else: def stat(path: _PathType) -> stat_result: ... + if sys.version_info < (3, 7): @overload def stat_float_times() -> bool: ... @overload def stat_float_times(__newvalue: bool) -> None: ... -if sys.platform != 'win32': + +if sys.platform != "win32": def statvfs(path: _FdOrPathType) -> statvfs_result: ... # Unix only + if sys.version_info >= (3, 3): - def symlink(source: _PathType, link_name: _PathType, - target_is_directory: bool = ..., *, dir_fd: Optional[int] = ...) -> None: ... - if sys.platform != 'win32': + def symlink( + source: _PathType, link_name: _PathType, target_is_directory: bool = ..., *, dir_fd: Optional[int] = ... + ) -> None: ... + if sys.platform != "win32": def sync() -> None: ... # Unix only def truncate(path: _FdOrPathType, length: int) -> None: ... # Unix only up to version 3.4 def unlink(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ... - def utime(path: _FdOrPathType, times: Optional[Union[Tuple[int, int], Tuple[float, float]]] = ..., *, - ns: Tuple[int, int] = ..., dir_fd: Optional[int] = ..., - follow_symlinks: bool = ...) -> None: ... + def utime( + path: _FdOrPathType, + times: Optional[Union[Tuple[int, int], Tuple[float, float]]] = ..., + *, + ns: Tuple[int, int] = ..., + dir_fd: Optional[int] = ..., + follow_symlinks: bool = ... + ) -> None: ... + else: - def symlink(source: _PathType, link_name: _PathType, - target_is_directory: bool = ...) -> None: - ... # final argument in Windows only + def symlink( + source: _PathType, link_name: _PathType, target_is_directory: bool = ... + ) -> None: ... # final argument in Windows only def unlink(path: _PathType) -> None: ... def utime(path: _PathType, times: Optional[Tuple[float, float]]) -> None: ... if sys.version_info >= (3, 6): - def walk(top: Union[AnyStr, PathLike[AnyStr]], topdown: bool = ..., - onerror: Optional[Callable[[OSError], Any]] = ..., - followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr], - List[AnyStr]]]: ... + def walk( + top: Union[AnyStr, PathLike[AnyStr]], + topdown: bool = ..., + onerror: Optional[Callable[[OSError], Any]] = ..., + followlinks: bool = ..., + ) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ... + else: - def walk(top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., - followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr], - List[AnyStr]]]: ... -if sys.platform != 'win32' and sys.version_info >= (3, 3): + def walk( + top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., followlinks: bool = ... + ) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ... + +if sys.platform != "win32" and sys.version_info >= (3, 3): if sys.version_info >= (3, 7): @overload - def fwalk(top: Union[str, PathLike[str]] = ..., topdown: bool = ..., - onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ..., - dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ... + def fwalk( + top: Union[str, PathLike[str]] = ..., + topdown: bool = ..., + onerror: Optional[Callable] = ..., + *, + follow_symlinks: bool = ..., + dir_fd: Optional[int] = ... + ) -> Iterator[Tuple[str, List[str], List[str], int]]: ... @overload - def fwalk(top: bytes, topdown: bool = ..., - onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ..., - dir_fd: Optional[int] = ...) -> Iterator[Tuple[bytes, List[bytes], List[bytes], int]]: ... + def fwalk( + top: bytes, + topdown: bool = ..., + onerror: Optional[Callable] = ..., + *, + follow_symlinks: bool = ..., + dir_fd: Optional[int] = ... + ) -> Iterator[Tuple[bytes, List[bytes], List[bytes], int]]: ... elif sys.version_info >= (3, 6): - def fwalk(top: Union[str, PathLike[str]] = ..., topdown: bool = ..., - onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ..., - dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ... + def fwalk( + top: Union[str, PathLike[str]] = ..., + topdown: bool = ..., + onerror: Optional[Callable] = ..., + *, + follow_symlinks: bool = ..., + dir_fd: Optional[int] = ... + ) -> Iterator[Tuple[str, List[str], List[str], int]]: ... else: - def fwalk(top: str = ..., topdown: bool = ..., - onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ..., - dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ... + def fwalk( + top: str = ..., + topdown: bool = ..., + onerror: Optional[Callable] = ..., + *, + follow_symlinks: bool = ..., + dir_fd: Optional[int] = ... + ) -> Iterator[Tuple[str, List[str], List[str], int]]: ... def getxattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> bytes: ... # Linux only def listxattr(path: _FdOrPathType, *, follow_symlinks: bool = ...) -> List[str]: ... # Linux only def removexattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> None: ... # Linux only - def setxattr(path: _FdOrPathType, attribute: _PathType, value: bytes, flags: int = ..., *, - follow_symlinks: bool = ...) -> None: ... # Linux only + def setxattr( + path: _FdOrPathType, attribute: _PathType, value: bytes, flags: int = ..., *, follow_symlinks: bool = ... + ) -> None: ... # Linux only def abort() -> NoReturn: ... + # These are defined as execl(file, *args) but the first *arg is mandatory. def execl(file: _PathType, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ... def execlp(file: _PathType, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ... @@ -648,14 +745,15 @@ def execlpe(file: _PathType, __arg0: Union[bytes, Text], *args: Any) -> NoReturn # The docs say `args: tuple or list of strings` # The implementation enforces tuple or list so we can't use Sequence. _ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]] + def execv(path: _PathType, args: _ExecVArgs) -> NoReturn: ... def execve(path: _FdOrPathType, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ... def execvp(file: _PathType, args: _ExecVArgs) -> NoReturn: ... def execvpe(file: _PathType, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ... - def _exit(n: int) -> NoReturn: ... def kill(pid: int, sig: int) -> None: ... -if sys.platform != 'win32': + +if sys.platform != "win32": # Unix only def fork() -> int: ... def forkpty() -> Tuple[int, int]: ... # some flavors of Unix @@ -667,6 +765,7 @@ if sys.version_info >= (3, 0): class _wrap_close(_TextIOWrapper): def close(self) -> Optional[int]: ... # type: ignore def popen(command: str, mode: str = ..., buffering: int = ...) -> _wrap_close: ... + else: class _wrap_close(IO[Text]): def close(self) -> Optional[int]: ... @@ -676,21 +775,23 @@ else: def popen4(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> Tuple[IO[Text], IO[Text]]: ... def spawnl(mode: int, path: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ... -def spawnle(mode: int, path: _PathType, arg0: Union[bytes, Text], - *args: Any) -> int: ... # Imprecise sig +def spawnle(mode: int, path: _PathType, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise sig def spawnv(mode: int, path: _PathType, args: List[Union[bytes, Text]]) -> int: ... -def spawnve(mode: int, path: _PathType, args: List[Union[bytes, Text]], - env: Mapping[str, str]) -> int: ... +def spawnve(mode: int, path: _PathType, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ... def system(command: _PathType) -> int: ... + if sys.version_info >= (3, 3): from posix import times_result def times() -> times_result: ... + else: def times() -> Tuple[float, float, float, float, float]: ... + def waitpid(pid: int, options: int) -> Tuple[int, int]: ... -if sys.platform == 'win32': +if sys.platform == "win32": def startfile(path: _PathType, operation: Optional[str] = ...) -> None: ... + else: # Unix only def spawnlp(mode: int, file: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ... @@ -712,7 +813,7 @@ else: def WSTOPSIG(status: int) -> int: ... def WTERMSIG(status: int) -> int: ... -if sys.platform != 'win32' and sys.version_info >= (3, 3): +if sys.platform != "win32" and sys.version_info >= (3, 3): from posix import sched_param def sched_get_priority_min(policy: int) -> int: ... # some flavors of Unix def sched_get_priority_max(policy: int) -> int: ... # some flavors of Unix @@ -727,14 +828,17 @@ if sys.platform != 'win32' and sys.version_info >= (3, 3): if sys.version_info >= (3, 4): def cpu_count() -> Optional[int]: ... -if sys.platform != 'win32': + +if sys.platform != "win32": # Unix only def confstr(name: Union[str, int]) -> Optional[str]: ... def getloadavg() -> Tuple[float, float, float]: ... def sysconf(name: Union[str, int]) -> int: ... + if sys.version_info >= (3, 6): def getrandom(size: int, flags: int = ...) -> bytes: ... def urandom(size: int) -> bytes: ... + else: def urandom(n: int) -> bytes: ... diff --git a/stdlib/3/os/path.pyi b/stdlib/3/os/path.pyi index dfd074fe7c7c..5828ac950b48 100644 --- a/stdlib/3/os/path.pyi +++ b/stdlib/3/os/path.pyi @@ -6,10 +6,11 @@ import os import sys from typing import Any, AnyStr, BinaryIO, Callable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") if sys.version_info >= (3, 6): from builtins import _PathLike + _PathType = Union[bytes, Text, _PathLike] _StrPath = Union[Text, _PathLike[Text]] _BytesPath = Union[bytes, _PathLike[bytes]] @@ -24,7 +25,7 @@ supports_unicode_filenames: bool curdir: str pardir: str sep: str -if sys.platform == 'win32': +if sys.platform == "win32": altsep: str else: altsep: Optional[str] @@ -64,7 +65,7 @@ if sys.version_info >= (3, 6): def normpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": @overload def realpath(path: _PathLike[AnyStr]) -> AnyStr: ... @overload @@ -83,7 +84,7 @@ else: def expandvars(path: AnyStr) -> AnyStr: ... def normcase(path: AnyStr) -> AnyStr: ... def normpath(path: AnyStr) -> AnyStr: ... - if sys.platform == 'win32': + if sys.platform == "win32": def realpath(path: AnyStr) -> AnyStr: ... else: def realpath(filename: AnyStr) -> AnyStr: ... @@ -92,6 +93,7 @@ if sys.version_info >= (3, 6): # In reality it returns str for sequences of _StrPath and bytes for sequences # of _BytesPath, but mypy does not accept such a signature. def commonpath(paths: Sequence[_PathType]) -> Any: ... + elif sys.version_info >= (3, 5): def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ... @@ -102,8 +104,10 @@ def commonprefix(list: Sequence[_PathType]) -> Any: ... if sys.version_info >= (3, 3): def exists(path: Union[_PathType, int]) -> bool: ... + else: def exists(path: _PathType) -> bool: ... + def lexists(path: _PathType) -> bool: ... # These return float if os.stat_float_times() == True, @@ -111,7 +115,6 @@ def lexists(path: _PathType) -> bool: ... def getatime(path: _PathType) -> float: ... def getmtime(path: _PathType) -> float: ... def getctime(path: _PathType) -> float: ... - def getsize(path: _PathType) -> int: ... def isabs(path: _PathType) -> bool: ... def isfile(path: _PathType) -> bool: ... @@ -134,12 +137,14 @@ if sys.version_info < (3, 0): def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ... @overload def join(__p1: Text, *p: _PathType) -> Text: ... + elif sys.version_info >= (3, 6): # Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway. @overload def join(path: _StrPath, *paths: _StrPath) -> Text: ... @overload def join(path: _BytesPath, *paths: _BytesPath) -> bytes: ... + else: def join(path: AnyStr, *paths: AnyStr) -> AnyStr: ... @@ -147,7 +152,6 @@ else: def relpath(path: _BytesPath, start: Optional[_BytesPath] = ...) -> bytes: ... @overload def relpath(path: _StrPath, start: Optional[_StrPath] = ...) -> Text: ... - def samefile(path1: _PathType, path2: _PathType) -> bool: ... def sameopenfile(fp1: int, fp2: int) -> bool: ... def samestat(stat1: os.stat_result, stat2: os.stat_result) -> bool: ... @@ -165,12 +169,13 @@ if sys.version_info >= (3, 6): def splitext(path: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... + else: def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -if sys.platform == 'win32': +if sys.platform == "win32": def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated if sys.version_info < (3,): diff --git a/stdlib/3/pathlib.pyi b/stdlib/3/pathlib.pyi index d16e31126adb..1e2ca1af783b 100644 --- a/stdlib/3/pathlib.pyi +++ b/stdlib/3/pathlib.pyi @@ -3,7 +3,7 @@ import sys from types import TracebackType from typing import IO, Any, Generator, List, Optional, Sequence, Tuple, Type, TypeVar, Union -_P = TypeVar('_P', bound='PurePath') +_P = TypeVar("_P", bound="PurePath") if sys.version_info >= (3, 6): _PurePathBase = os.PathLike[str] @@ -43,7 +43,6 @@ class PurePath(_PurePathBase): def with_name(self: _P, name: str) -> _P: ... def with_suffix(self: _P, suffix: str) -> _P: ... def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ... - @property def parents(self: _P) -> Sequence[_P]: ... @property @@ -54,9 +53,9 @@ class PureWindowsPath(PurePath): ... class Path(PurePath): def __enter__(self) -> Path: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_value: Optional[BaseException], - traceback: Optional[TracebackType]) -> Optional[bool]: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType] + ) -> Optional[bool]: ... @classmethod def cwd(cls: Type[_P]) -> _P: ... def stat(self) -> os.stat_result: ... @@ -75,14 +74,17 @@ class Path(PurePath): def lchmod(self, mode: int) -> None: ... def lstat(self) -> os.stat_result: ... if sys.version_info < (3, 5): - def mkdir(self, mode: int = ..., - parents: bool = ...) -> None: ... + def mkdir(self, mode: int = ..., parents: bool = ...) -> None: ... else: - def mkdir(self, mode: int = ..., parents: bool = ..., - exist_ok: bool = ...) -> None: ... - def open(self, mode: str = ..., buffering: int = ..., - encoding: Optional[str] = ..., errors: Optional[str] = ..., - newline: Optional[str] = ...) -> IO[Any]: ... + def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ... + def open( + self, + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ..., + ) -> IO[Any]: ... def owner(self) -> str: ... def rename(self, target: Union[str, PurePath]) -> None: ... def replace(self, target: Union[str, PurePath]) -> None: ... @@ -92,31 +94,23 @@ class Path(PurePath): def resolve(self: _P, strict: bool = ...) -> _P: ... def rglob(self, pattern: str) -> Generator[Path, None, None]: ... def rmdir(self) -> None: ... - def symlink_to(self, target: Union[str, Path], - target_is_directory: bool = ...) -> None: ... + def symlink_to(self, target: Union[str, Path], target_is_directory: bool = ...) -> None: ... def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ... def unlink(self) -> None: ... - if sys.version_info >= (3, 5): @classmethod def home(cls: Type[_P]) -> _P: ... if sys.version_info < (3, 6): - def __new__(cls: Type[_P], *args: Union[str, PurePath], - **kwargs: Any) -> _P: ... + def __new__(cls: Type[_P], *args: Union[str, PurePath], **kwargs: Any) -> _P: ... else: - def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]], - **kwargs: Any) -> _P: ... - + def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]], **kwargs: Any) -> _P: ... def absolute(self: _P) -> _P: ... def expanduser(self: _P) -> _P: ... def read_bytes(self) -> bytes: ... - def read_text(self, encoding: Optional[str] = ..., - errors: Optional[str] = ...) -> str: ... + def read_text(self, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> str: ... def samefile(self, other_path: Union[str, bytes, int, Path]) -> bool: ... def write_bytes(self, data: bytes) -> int: ... - def write_text(self, data: str, encoding: Optional[str] = ..., - errors: Optional[str] = ...) -> int: ... - + def write_text(self, data: str, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> int: ... class PosixPath(Path, PurePosixPath): ... class WindowsPath(Path, PureWindowsPath): ... diff --git a/stdlib/3/platform.pyi b/stdlib/3/platform.pyi index 915ae30b4eb5..690d937ae7fd 100644 --- a/stdlib/3/platform.pyi +++ b/stdlib/3/platform.pyi @@ -5,15 +5,29 @@ from os import popen from typing import NamedTuple, Tuple def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> Tuple[str, str]: ... -def linux_distribution(distname: str = ..., version: str = ..., id: str = ..., supported_dists: Tuple[str, ...] = ..., full_distribution_name: bool = ...) -> Tuple[str, str, str]: ... -def dist(distname: str = ..., version: str = ..., id: str = ..., supported_dists: Tuple[str, ...] = ...) -> Tuple[str, str, str]: ... +def linux_distribution( + distname: str = ..., + version: str = ..., + id: str = ..., + supported_dists: Tuple[str, ...] = ..., + full_distribution_name: bool = ..., +) -> Tuple[str, str, str]: ... +def dist( + distname: str = ..., version: str = ..., id: str = ..., supported_dists: Tuple[str, ...] = ... +) -> Tuple[str, str, str]: ... def win32_ver(release: str = ..., version: str = ..., csd: str = ..., ptype: str = ...) -> Tuple[str, str, str, str]: ... -def mac_ver(release: str = ..., versioninfo: Tuple[str, str, str] = ..., machine: str = ...) -> Tuple[str, Tuple[str, str, str], str]: ... -def java_ver(release: str = ..., vendor: str = ..., vminfo: Tuple[str, str, str] = ..., osinfo: Tuple[str, str, str] = ...) -> Tuple[str, str, Tuple[str, str, str], Tuple[str, str, str]]: ... +def mac_ver( + release: str = ..., versioninfo: Tuple[str, str, str] = ..., machine: str = ... +) -> Tuple[str, Tuple[str, str, str], str]: ... +def java_ver( + release: str = ..., vendor: str = ..., vminfo: Tuple[str, str, str] = ..., osinfo: Tuple[str, str, str] = ... +) -> Tuple[str, str, Tuple[str, str, str], Tuple[str, str, str]]: ... def system_alias(system: str, release: str, version: str) -> Tuple[str, str, str]: ... def architecture(executable: str = ..., bits: str = ..., linkage: str = ...) -> Tuple[str, str]: ... -uname_result = NamedTuple('uname_result', [('system', str), ('node', str), ('release', str), ('version', str), ('machine', str), ('processor', str)]) +uname_result = NamedTuple( + "uname_result", [("system", str), ("node", str), ("release", str), ("version", str), ("machine", str), ("processor", str)] +) def uname() -> uname_result: ... def system() -> str: ... @@ -22,7 +36,6 @@ def release() -> str: ... def version() -> str: ... def machine() -> str: ... def processor() -> str: ... - def python_implementation() -> str: ... def python_version() -> str: ... def python_version_tuple() -> Tuple[str, str, str]: ... @@ -30,5 +43,4 @@ def python_branch() -> str: ... def python_revision() -> str: ... def python_build() -> Tuple[str, str]: ... def python_compiler() -> str: ... - def platform(aliased: bool = ..., terse: bool = ...) -> str: ... diff --git a/stdlib/3/posix.pyi b/stdlib/3/posix.pyi index 91d621dbe4c9..b308b745e457 100644 --- a/stdlib/3/posix.pyi +++ b/stdlib/3/posix.pyi @@ -6,34 +6,19 @@ import sys from os import stat_result as stat_result from typing import NamedTuple, Tuple -uname_result = NamedTuple('uname_result', [ - ('sysname', str), - ('nodename', str), - ('release', str), - ('version', str), - ('machine', str), -]) +uname_result = NamedTuple( + "uname_result", [("sysname", str), ("nodename", str), ("release", str), ("version", str), ("machine", str)] +) -times_result = NamedTuple('times_result', [ - ('user', float), - ('system', float), - ('children_user', float), - ('children_system', float), - ('elapsed', float), -]) +times_result = NamedTuple( + "times_result", [("user", float), ("system", float), ("children_user", float), ("children_system", float), ("elapsed", float)] +) -waitid_result = NamedTuple('waitid_result', [ - ('si_pid', int), - ('si_uid', int), - ('si_signo', int), - ('si_status', int), - ('si_code', int), -]) - -sched_param = NamedTuple('sched_param', [ - ('sched_priority', int), -]) +waitid_result = NamedTuple( + "waitid_result", [("si_pid", int), ("si_uid", int), ("si_signo", int), ("si_status", int), ("si_code", int)] +) +sched_param = NamedTuple("sched_param", [("sched_priority", int)]) EX_CANTCREAT: int EX_CONFIG: int diff --git a/stdlib/3/queue.pyi b/stdlib/3/queue.pyi index 80dbc030c0b7..baab2efe22b4 100644 --- a/stdlib/3/queue.pyi +++ b/stdlib/3/queue.pyi @@ -6,7 +6,7 @@ import sys from collections import deque from typing import Any, Generic, Optional, TypeVar -_T = TypeVar('_T') +_T = TypeVar("_T") class Empty(Exception): ... class Full(Exception): ... diff --git a/stdlib/3/random.pyi b/stdlib/3/random.pyi index 3ebd1104d56b..d8926d7a2d3a 100644 --- a/stdlib/3/random.pyi +++ b/stdlib/3/random.pyi @@ -10,7 +10,7 @@ import _random import sys from typing import AbstractSet, Any, Callable, List, Optional, Sequence, TypeVar, Union -_T = TypeVar('_T') +_T = TypeVar("_T") class Random(_random.Random): def __init__(self, x: Any = ...) -> None: ... @@ -22,7 +22,14 @@ class Random(_random.Random): def randint(self, a: int, b: int) -> int: ... def choice(self, seq: Sequence[_T]) -> _T: ... if sys.version_info >= (3, 6): - def choices(self, population: Sequence[_T], weights: Optional[Sequence[float]] = ..., *, cum_weights: Optional[Sequence[float]] = ..., k: int = ...) -> List[_T]: ... + def choices( + self, + population: Sequence[_T], + weights: Optional[Sequence[float]] = ..., + *, + cum_weights: Optional[Sequence[float]] = ..., + k: int = ... + ) -> List[_T]: ... def shuffle(self, x: List[Any], random: Union[Callable[[], float], None] = ...) -> None: ... def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ... def random(self) -> float: ... @@ -39,8 +46,7 @@ class Random(_random.Random): def weibullvariate(self, alpha: float, beta: float) -> float: ... # SystemRandom is not implemented for all OS's; good on Windows & Linux -class SystemRandom(Random): - ... +class SystemRandom(Random): ... # ----- random function stubs ----- def seed(a: Any = ..., version: int = ...) -> None: ... @@ -50,14 +56,21 @@ def getrandbits(k: int) -> int: ... def randrange(start: int, stop: Union[None, int] = ..., step: int = ...) -> int: ... def randint(a: int, b: int) -> int: ... def choice(seq: Sequence[_T]) -> _T: ... + if sys.version_info >= (3, 6): - def choices(population: Sequence[_T], weights: Optional[Sequence[float]] = ..., *, cum_weights: Optional[Sequence[float]] = ..., k: int = ...) -> List[_T]: ... + def choices( + population: Sequence[_T], + weights: Optional[Sequence[float]] = ..., + *, + cum_weights: Optional[Sequence[float]] = ..., + k: int = ... + ) -> List[_T]: ... + def shuffle(x: List[Any], random: Union[Callable[[], float], None] = ...) -> None: ... def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ... def random() -> float: ... def uniform(a: float, b: float) -> float: ... -def triangular(low: float = ..., high: float = ..., - mode: float = ...) -> float: ... +def triangular(low: float = ..., high: float = ..., mode: float = ...) -> float: ... def betavariate(alpha: float, beta: float) -> float: ... def expovariate(lambd: float) -> float: ... def gammavariate(alpha: float, beta: float) -> float: ... diff --git a/stdlib/3/re.pyi b/stdlib/3/re.pyi index 66ffbf4fa185..06825b91b598 100644 --- a/stdlib/3/re.pyi +++ b/stdlib/3/re.pyi @@ -44,7 +44,6 @@ if sys.version_info >= (3, 6): UNICODE = 0 T = 0 TEMPLATE = 0 - A = RegexFlag.A ASCII = RegexFlag.ASCII DEBUG = RegexFlag.DEBUG @@ -93,12 +92,10 @@ class error(Exception): ... def compile(pattern: AnyStr, flags: _FlagsType = ...) -> Pattern[AnyStr]: ... @overload def compile(pattern: Pattern[AnyStr], flags: _FlagsType = ...) -> Pattern[AnyStr]: ... - @overload def search(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... @overload def search(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... - @overload def match(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... @overload @@ -109,14 +106,10 @@ def match(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> def fullmatch(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... @overload def fullmatch(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Optional[Match[AnyStr]]: ... - @overload -def split(pattern: AnyStr, string: AnyStr, - maxsplit: int = ..., flags: _FlagsType = ...) -> List[AnyStr]: ... +def split(pattern: AnyStr, string: AnyStr, maxsplit: int = ..., flags: _FlagsType = ...) -> List[AnyStr]: ... @overload -def split(pattern: Pattern[AnyStr], string: AnyStr, - maxsplit: int = ..., flags: _FlagsType = ...) -> List[AnyStr]: ... - +def split(pattern: Pattern[AnyStr], string: AnyStr, maxsplit: int = ..., flags: _FlagsType = ...) -> List[AnyStr]: ... @overload def findall(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> List[Any]: ... @overload @@ -127,41 +120,35 @@ def findall(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) - # matches are returned in the order found. Empty matches are included in the # result unless they touch the beginning of another match. @overload -def finditer(pattern: AnyStr, string: AnyStr, - flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ... +def finditer(pattern: AnyStr, string: AnyStr, flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ... @overload -def finditer(pattern: Pattern[AnyStr], string: AnyStr, - flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ... - +def finditer(pattern: Pattern[AnyStr], string: AnyStr, flags: _FlagsType = ...) -> Iterator[Match[AnyStr]]: ... @overload -def sub(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = ..., - flags: _FlagsType = ...) -> AnyStr: ... +def sub(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> AnyStr: ... @overload -def sub(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> AnyStr: ... +def sub( + pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: _FlagsType = ... +) -> AnyStr: ... @overload -def sub(pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int = ..., - flags: _FlagsType = ...) -> AnyStr: ... +def sub(pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> AnyStr: ... @overload -def sub(pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> AnyStr: ... - +def sub( + pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: _FlagsType = ... +) -> AnyStr: ... @overload -def subn(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = ..., - flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ... +def subn(pattern: AnyStr, repl: AnyStr, string: AnyStr, count: int = ..., flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ... @overload -def subn(pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, count: int = ..., - flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ... +def subn( + pattern: AnyStr, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: _FlagsType = ... +) -> Tuple[AnyStr, int]: ... @overload -def subn(pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int = ..., - flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ... +def subn( + pattern: Pattern[AnyStr], repl: AnyStr, string: AnyStr, count: int = ..., flags: _FlagsType = ... +) -> Tuple[AnyStr, int]: ... @overload -def subn(pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr], - string: AnyStr, count: int = ..., - flags: _FlagsType = ...) -> Tuple[AnyStr, int]: ... - +def subn( + pattern: Pattern[AnyStr], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: _FlagsType = ... +) -> Tuple[AnyStr, int]: ... def escape(string: AnyStr) -> AnyStr: ... - def purge() -> None: ... def template(pattern: Union[AnyStr, Pattern[AnyStr]], flags: _FlagsType = ...) -> Pattern[AnyStr]: ... diff --git a/stdlib/3/reprlib.pyi b/stdlib/3/reprlib.pyi index 462251875f39..157512a6d465 100644 --- a/stdlib/3/reprlib.pyi +++ b/stdlib/3/reprlib.pyi @@ -34,4 +34,5 @@ class Repr: def repr_instance(self, x: Any, level: int) -> str: ... aRepr: Repr + def repr(x: object) -> str: ... diff --git a/stdlib/3/resource.pyi b/stdlib/3/resource.pyi index c40211b11506..fc091aac37e3 100644 --- a/stdlib/3/resource.pyi +++ b/stdlib/3/resource.pyi @@ -25,12 +25,27 @@ RUSAGE_CHILDREN: int RUSAGE_SELF: int RUSAGE_THREAD: int -_RUsage = NamedTuple('_RUsage', [('ru_utime', float), ('ru_stime', float), ('ru_maxrss', int), - ('ru_ixrss', int), ('ru_idrss', int), ('ru_isrss', int), - ('ru_minflt', int), ('ru_majflt', int), ('ru_nswap', int), - ('ru_inblock', int), ('ru_oublock', int), ('ru_msgsnd', int), - ('ru_msgrcv', int), ('ru_nsignals', int), ('ru_nvcsw', int), - ('ru_nivcsw', int)]) +_RUsage = NamedTuple( + "_RUsage", + [ + ("ru_utime", float), + ("ru_stime", float), + ("ru_maxrss", int), + ("ru_ixrss", int), + ("ru_idrss", int), + ("ru_isrss", int), + ("ru_minflt", int), + ("ru_majflt", int), + ("ru_nswap", int), + ("ru_inblock", int), + ("ru_oublock", int), + ("ru_msgsnd", int), + ("ru_msgrcv", int), + ("ru_nsignals", int), + ("ru_nvcsw", int), + ("ru_nivcsw", int), + ], +) def getpagesize() -> int: ... def getrlimit(resource: int) -> Tuple[int, int]: ... diff --git a/stdlib/3/runpy.pyi b/stdlib/3/runpy.pyi index 022af115722f..c58da400fbe8 100644 --- a/stdlib/3/runpy.pyi +++ b/stdlib/3/runpy.pyi @@ -14,10 +14,7 @@ class _ModifiedArgv0: def __enter__(self): ... def __exit__(self, *args): ... -def run_module(mod_name: str, - init_globals: Optional[Dict[str, Any]] = ..., - run_name: Optional[str] = ..., - alter_sys: bool = ...): ... -def run_path(path_name: str, - init_globals: Optional[Dict[str, Any]] = ..., - run_name: str = ...): ... +def run_module( + mod_name: str, init_globals: Optional[Dict[str, Any]] = ..., run_name: Optional[str] = ..., alter_sys: bool = ... +): ... +def run_path(path_name: str, init_globals: Optional[Dict[str, Any]] = ..., run_name: str = ...): ... diff --git a/stdlib/3/selectors.pyi b/stdlib/3/selectors.pyi index 6dd864795fc7..bb901f0ad694 100644 --- a/stdlib/3/selectors.pyi +++ b/stdlib/3/selectors.pyi @@ -12,40 +12,26 @@ _FileObject = Union[int, _HasFileno] _FileDescriptor = int _EventMask = int - EVENT_READ: _EventMask EVENT_WRITE: _EventMask - -SelectorKey = NamedTuple('SelectorKey', [ - ('fileobj', _FileObject), - ('fd', _FileDescriptor), - ('events', _EventMask), - ('data', Any) -]) - +SelectorKey = NamedTuple( + "SelectorKey", [("fileobj", _FileObject), ("fd", _FileDescriptor), ("events", _EventMask), ("data", Any)] +) class BaseSelector(metaclass=ABCMeta): @abstractmethod def register(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... - @abstractmethod def unregister(self, fileobj: _FileObject) -> SelectorKey: ... - def modify(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... - @abstractmethod def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... - def close(self) -> None: ... - def get_key(self, fileobj: _FileObject) -> SelectorKey: ... - @abstractmethod def get_map(self) -> Mapping[_FileObject, SelectorKey]: ... - def __enter__(self) -> BaseSelector: ... - def __exit__(self, *args: Any) -> None: ... class SelectSelector(BaseSelector): diff --git a/stdlib/3/shelve.pyi b/stdlib/3/shelve.pyi index 51f21a8a4fdd..f10221ac30a5 100644 --- a/stdlib/3/shelve.pyi +++ b/stdlib/3/shelve.pyi @@ -2,7 +2,9 @@ import collections from typing import Any, Dict, Iterator, Optional, Tuple class Shelf(collections.MutableMapping): - def __init__(self, dict: Dict[bytes, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ... + def __init__( + self, dict: Dict[bytes, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ... + ) -> None: ... def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... def __contains__(self, key: Any) -> bool: ... # key should be str, but it would conflict with superclass's type signature @@ -17,7 +19,9 @@ class Shelf(collections.MutableMapping): def sync(self) -> None: ... class BsdDbShelf(Shelf): - def __init__(self, dict: Dict[bytes, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ... + def __init__( + self, dict: Dict[bytes, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ... + ) -> None: ... def set_location(self, key: Any) -> Tuple[str, Any]: ... def next(self) -> Tuple[str, Any]: ... def previous(self) -> Tuple[str, Any]: ... diff --git a/stdlib/3/shlex.pyi b/stdlib/3/shlex.pyi index a54b8aadee17..77c2ea803bba 100644 --- a/stdlib/3/shlex.pyi +++ b/stdlib/3/shlex.pyi @@ -5,13 +5,12 @@ import sys from typing import Any, Iterable, List, Optional, TextIO, Tuple, TypeVar, Union -def split(s: str, comments: bool = ..., - posix: bool = ...) -> List[str]: ... +def split(s: str, comments: bool = ..., posix: bool = ...) -> List[str]: ... # Added in 3.3, use (undocumented) pipes.quote in previous versions. def quote(s: str) -> str: ... -_SLT = TypeVar('_SLT', bound=shlex) +_SLT = TypeVar("_SLT", bound=shlex) class shlex(Iterable[str]): commenters: str @@ -32,11 +31,15 @@ class shlex(Iterable[str]): punctuation_chars: str if sys.version_info >= (3, 6): - def __init__(self, instream: Union[str, TextIO] = ..., infile: Optional[str] = ..., - posix: bool = ..., punctuation_chars: Union[bool, str] = ...) -> None: ... + def __init__( + self, + instream: Union[str, TextIO] = ..., + infile: Optional[str] = ..., + posix: bool = ..., + punctuation_chars: Union[bool, str] = ..., + ) -> None: ... else: - def __init__(self, instream: Union[str, TextIO] = ..., infile: Optional[str] = ..., - posix: bool = ...) -> None: ... + def __init__(self, instream: Union[str, TextIO] = ..., infile: Optional[str] = ..., posix: bool = ...) -> None: ... def get_token(self) -> str: ... def push_token(self, tok: str) -> None: ... def read_token(self) -> str: ... @@ -44,7 +47,6 @@ class shlex(Iterable[str]): # TODO argument types def push_source(self, newstream: Any, newfile: Any = ...) -> None: ... def pop_source(self) -> None: ... - def error_leader(self, infile: str = ..., - lineno: int = ...) -> None: ... + def error_leader(self, infile: str = ..., lineno: int = ...) -> None: ... def __iter__(self: _SLT) -> _SLT: ... def __next__(self) -> str: ... diff --git a/stdlib/3/signal.pyi b/stdlib/3/signal.pyi index 3b73018e8506..5e4862fee19d 100644 --- a/stdlib/3/signal.pyi +++ b/stdlib/3/signal.pyi @@ -53,19 +53,15 @@ if sys.version_info >= (3, 5): SIGWINCH = ... SIGXCPU = ... SIGXFSZ = ... - class Handlers(IntEnum): SIG_DFL = ... SIG_IGN = ... - SIG_DFL = Handlers.SIG_DFL SIG_IGN = Handlers.SIG_IGN - class Sigmasks(IntEnum): SIG_BLOCK = ... SIG_UNBLOCK = ... SIG_SETMASK = ... - SIG_BLOCK = Sigmasks.SIG_BLOCK SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK SIG_SETMASK = Sigmasks.SIG_SETMASK @@ -146,17 +142,14 @@ class struct_siginfo(Tuple[int, int, int, int, int, int, int]): def si_band(self) -> int: ... def alarm(time: int) -> int: ... - def default_int_handler(signum: int, frame: FrameType) -> None: raise KeyboardInterrupt() def getitimer(which: int) -> Tuple[float, float]: ... - def getsignal(signalnum: _SIGNUM) -> _HANDLER: raise ValueError() def pause() -> None: ... - def pthread_kill(thread_id: int, signum: int) -> None: raise OSError() @@ -164,9 +157,7 @@ def pthread_sigmask(how: int, mask: Iterable[int]) -> Set[_SIGNUM]: raise OSError() def set_wakeup_fd(fd: int) -> int: ... - def setitimer(which: int, seconds: float, interval: float = ...) -> Tuple[float, float]: ... - def siginterrupt(signalnum: int, flag: bool) -> None: raise OSError() diff --git a/stdlib/3/smtplib.pyi b/stdlib/3/smtplib.pyi index ef578feb4978..964a0f8c4de3 100644 --- a/stdlib/3/smtplib.pyi +++ b/stdlib/3/smtplib.pyi @@ -66,17 +66,21 @@ class SMTP: command_encoding: str source_address: Optional[_SourceAddress] local_hostname: str - def __init__(self, host: str = ..., port: int = ..., - local_hostname: Optional[str] = ..., timeout: float = ..., - source_address: Optional[_SourceAddress] = ...) -> None: ... + def __init__( + self, + host: str = ..., + port: int = ..., + local_hostname: Optional[str] = ..., + timeout: float = ..., + source_address: Optional[_SourceAddress] = ..., + ) -> None: ... def __enter__(self) -> SMTP: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_value: Optional[BaseException], - tb: Optional[TracebackType]) -> None: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], tb: Optional[TracebackType] + ) -> None: ... def set_debuglevel(self, debuglevel: int) -> None: ... sock: Optional[socket] - def connect(self, host: str = ..., port: int = ..., - source_address: Optional[_SourceAddress] = ...) -> _Reply: ... + def connect(self, host: str = ..., port: int = ..., source_address: Optional[_SourceAddress] = ...) -> _Reply: ... def send(self, s: Union[bytes, str]) -> None: ... def putcmd(self, cmd: str, args: str = ...) -> None: ... def getreply(self) -> _Reply: ... @@ -104,19 +108,28 @@ class SMTP: def auth_cram_md5(self, challenge: bytes) -> str: ... def auth_plain(self, challenge: Optional[bytes] = ...) -> str: ... def auth_login(self, challenge: Optional[bytes] = ...) -> str: ... - def login(self, user: str, password: str, *, - initial_response_ok: bool = ...) -> _Reply: ... + def login(self, user: str, password: str, *, initial_response_ok: bool = ...) -> _Reply: ... else: def login(self, user: str, password: str) -> _Reply: ... - def starttls(self, keyfile: Optional[str] = ..., certfile: Optional[str] = ..., - context: Optional[SSLContext] = ...) -> _Reply: ... - def sendmail(self, from_addr: str, to_addrs: Union[str, Sequence[str]], - msg: Union[bytes, str], mail_options: Sequence[str] = ..., - rcpt_options: List[str] = ...) -> _SendErrs: ... - def send_message(self, msg: _Message, from_addr: Optional[str] = ..., - to_addrs: Optional[Union[str, Sequence[str]]] = ..., - mail_options: List[str] = ..., - rcpt_options: Sequence[str] = ...) -> _SendErrs: ... + def starttls( + self, keyfile: Optional[str] = ..., certfile: Optional[str] = ..., context: Optional[SSLContext] = ... + ) -> _Reply: ... + def sendmail( + self, + from_addr: str, + to_addrs: Union[str, Sequence[str]], + msg: Union[bytes, str], + mail_options: Sequence[str] = ..., + rcpt_options: List[str] = ..., + ) -> _SendErrs: ... + def send_message( + self, + msg: _Message, + from_addr: Optional[str] = ..., + to_addrs: Optional[Union[str, Sequence[str]]] = ..., + mail_options: List[str] = ..., + rcpt_options: Sequence[str] = ..., + ) -> _SendErrs: ... def close(self) -> None: ... def quit(self) -> _Reply: ... @@ -124,16 +137,25 @@ class SMTP_SSL(SMTP): keyfile: Optional[str] certfile: Optional[str] context: SSLContext - def __init__(self, host: str = ..., port: int = ..., - local_hostname: Optional[str] = ..., - keyfile: Optional[str] = ..., certfile: Optional[str] = ..., - timeout: float = ..., - source_address: Optional[_SourceAddress] = ..., - context: Optional[SSLContext] = ...) -> None: ... + def __init__( + self, + host: str = ..., + port: int = ..., + local_hostname: Optional[str] = ..., + keyfile: Optional[str] = ..., + certfile: Optional[str] = ..., + timeout: float = ..., + source_address: Optional[_SourceAddress] = ..., + context: Optional[SSLContext] = ..., + ) -> None: ... LMTP_PORT: int class LMTP(SMTP): - def __init__(self, host: str = ..., port: int = ..., - local_hostname: Optional[str] = ..., - source_address: Optional[_SourceAddress] = ...) -> None: ... + def __init__( + self, + host: str = ..., + port: int = ..., + local_hostname: Optional[str] = ..., + source_address: Optional[_SourceAddress] = ..., + ) -> None: ... diff --git a/stdlib/3/socketserver.pyi b/stdlib/3/socketserver.pyi index b24f96c4df6e..0476758a9404 100644 --- a/stdlib/3/socketserver.pyi +++ b/stdlib/3/socketserver.pyi @@ -15,66 +15,51 @@ class BaseServer: request_queue_size: int socket_type: int timeout: Optional[float] - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type) -> None: ... def fileno(self) -> int: ... def handle_request(self) -> None: ... def serve_forever(self, poll_interval: float = ...) -> None: ... def shutdown(self) -> None: ... def server_close(self) -> None: ... - def finish_request(self, request: bytes, - client_address: Tuple[str, int]) -> None: ... + def finish_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... def get_request(self) -> None: ... - def handle_error(self, request: bytes, - client_address: Tuple[str, int]) -> None: ... + def handle_error(self, request: bytes, client_address: Tuple[str, int]) -> None: ... def handle_timeout(self) -> None: ... - def process_request(self, request: bytes, - client_address: Tuple[str, int]) -> None: ... + def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ... def server_activate(self) -> None: ... def server_bind(self) -> None: ... - def verify_request(self, request: bytes, - client_address: Tuple[str, int]) -> bool: ... + def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ... if sys.version_info >= (3, 6): def __enter__(self) -> BaseServer: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[types.TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType] + ) -> bool: ... if sys.version_info >= (3, 3): def service_actions(self) -> None: ... class TCPServer(BaseServer): - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type, - bind_and_activate: bool = ...) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type, bind_and_activate: bool = ...) -> None: ... class UDPServer(BaseServer): - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type, - bind_and_activate: bool = ...) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type, bind_and_activate: bool = ...) -> None: ... -if sys.platform != 'win32': +if sys.platform != "win32": class UnixStreamServer(BaseServer): - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type, - bind_and_activate: bool = ...) -> None: ... - + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type, bind_and_activate: bool = ...) -> None: ... class UnixDatagramServer(BaseServer): - def __init__(self, server_address: Tuple[str, int], - RequestHandlerClass: type, - bind_and_activate: bool = ...) -> None: ... + def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: type, bind_and_activate: bool = ...) -> None: ... class ForkingMixIn: ... class ThreadingMixIn: ... - class ForkingTCPServer(ForkingMixIn, TCPServer): ... class ForkingUDPServer(ForkingMixIn, UDPServer): ... class ThreadingTCPServer(ThreadingMixIn, TCPServer): ... class ThreadingUDPServer(ThreadingMixIn, UDPServer): ... -if sys.platform != 'win32': + +if sys.platform != "win32": class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): ... class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): ... - class BaseRequestHandler: # Those are technically of types, respectively: # * Union[SocketType, Tuple[bytes, SocketType]] diff --git a/stdlib/3/spwd.pyi b/stdlib/3/spwd.pyi index 0e55d74215ef..794014af0409 100644 --- a/stdlib/3/spwd.pyi +++ b/stdlib/3/spwd.pyi @@ -1,14 +1,19 @@ from typing import List, NamedTuple -struct_spwd = NamedTuple("struct_spwd", [("sp_namp", str), - ("sp_pwdp", str), - ("sp_lstchg", int), - ("sp_min", int), - ("sp_max", int), - ("sp_warn", int), - ("sp_inact", int), - ("sp_expire", int), - ("sp_flag", int)]) +struct_spwd = NamedTuple( + "struct_spwd", + [ + ("sp_namp", str), + ("sp_pwdp", str), + ("sp_lstchg", int), + ("sp_min", int), + ("sp_max", int), + ("sp_warn", int), + ("sp_inact", int), + ("sp_expire", int), + ("sp_flag", int), + ], +) def getspall() -> List[struct_spwd]: ... def getspnam(name: str) -> struct_spwd: ... diff --git a/stdlib/3/sre_constants.pyi b/stdlib/3/sre_constants.pyi index 85f50ca0c1e7..f43d13ef75c7 100644 --- a/stdlib/3/sre_constants.pyi +++ b/stdlib/3/sre_constants.pyi @@ -39,7 +39,6 @@ SRE_INFO_PREFIX: int SRE_INFO_LITERAL: int SRE_INFO_CHARSET: int - # Stubgen above; manually defined constants below (dynamic at runtime) # from OPCODES diff --git a/stdlib/3/sre_parse.pyi b/stdlib/3/sre_parse.pyi index 5100f286621b..6cf7da49d5ce 100644 --- a/stdlib/3/sre_parse.pyi +++ b/stdlib/3/sre_parse.pyi @@ -33,7 +33,6 @@ class Pattern: def checkgroup(self, gid: int) -> bool: ... def checklookbehindgroup(self, gid: int, source: Tokenizer) -> None: ... - _OpSubpatternType = Tuple[Optional[int], int, int, SubPattern] _OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern] _OpInType = List[Tuple[NIC, int]] @@ -41,7 +40,6 @@ _OpBranchType = Tuple[None, List[SubPattern]] _AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType] _CodeType = Tuple[NIC, _AvType] - class SubPattern: pattern: Pattern data: List[_CodeType] @@ -56,7 +54,6 @@ class SubPattern: def append(self, code: _CodeType) -> None: ... def getwidth(self) -> int: ... - class Tokenizer: istext: bool string: Any @@ -76,6 +73,8 @@ class Tokenizer: def fix_flags(src: Union[str, bytes], flag: int) -> int: ... def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ... + _TemplateType = Tuple[List[Tuple[int, int]], List[str]] + def parse_template(source: str, pattern: _Pattern) -> _TemplateType: ... def expand_template(template: _TemplateType, match: Match) -> str: ... diff --git a/stdlib/3/stat.pyi b/stdlib/3/stat.pyi index c45a06863e2f..563dd88fbdd4 100644 --- a/stdlib/3/stat.pyi +++ b/stdlib/3/stat.pyi @@ -12,10 +12,8 @@ def S_ISREG(mode: int) -> bool: ... def S_ISFIFO(mode: int) -> bool: ... def S_ISLNK(mode: int) -> bool: ... def S_ISSOCK(mode: int) -> bool: ... - def S_IMODE(mode: int) -> int: ... def S_IFMT(mode: int) -> int: ... - def filemode(mode: int) -> str: ... ST_MODE = 0 @@ -65,9 +63,9 @@ UF_IMMUTABLE = 0 UF_APPEND = 0 UF_OPAQUE = 0 UF_NOUNLINK = 0 -if sys.platform == 'darwin': +if sys.platform == "darwin": UF_COMPRESSED = 0 # OS X 10.6+ only - UF_HIDDEN = 0 # OX X 10.5+ only + UF_HIDDEN = 0 # OX X 10.5+ only SF_ARCHIVED = 0 SF_IMMUTABLE = 0 SF_APPEND = 0 diff --git a/stdlib/3/statistics.pyi b/stdlib/3/statistics.pyi index bc78a4a3a51e..326d2cf7f160 100644 --- a/stdlib/3/statistics.pyi +++ b/stdlib/3/statistics.pyi @@ -6,13 +6,15 @@ from fractions import Fraction from typing import Iterable, Optional, TypeVar # Most functions in this module accept homogeneous collections of one of these types -_Number = TypeVar('_Number', float, Decimal, Fraction) +_Number = TypeVar("_Number", float, Decimal, Fraction) class StatisticsError(ValueError): ... def mean(data: Iterable[_Number]) -> _Number: ... + if sys.version_info >= (3, 6): def harmonic_mean(data: Iterable[_Number]) -> _Number: ... + def median(data: Iterable[_Number]) -> _Number: ... def median_low(data: Iterable[_Number]) -> _Number: ... def median_high(data: Iterable[_Number]) -> _Number: ... diff --git a/stdlib/3/string.pyi b/stdlib/3/string.pyi index d1bde9e9841c..ac6a31c7aa4b 100644 --- a/stdlib/3/string.pyi +++ b/stdlib/3/string.pyi @@ -18,25 +18,19 @@ def capwords(s: str, sep: str = ...) -> str: ... class Template: template: str - def __init__(self, template: str) -> None: ... def substitute(self, mapping: Mapping[str, str] = ..., **kwds: str) -> str: ... - def safe_substitute(self, mapping: Mapping[str, str] = ..., - **kwds: str) -> str: ... + def safe_substitute(self, mapping: Mapping[str, str] = ..., **kwds: str) -> str: ... # TODO(MichalPokorny): This is probably badly and/or loosely typed. class Formatter: def format(self, format_string: str, *args: Any, **kwargs: Any) -> str: ... - def vformat(self, format_string: str, args: Sequence[Any], - kwargs: Mapping[str, Any]) -> str: ... + def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ... def parse(self, format_string: str) -> Iterable[Tuple[str, Optional[str], Optional[str], Optional[str]]]: ... - def get_field(self, field_name: str, args: Sequence[Any], - kwargs: Mapping[str, Any]) -> Any: ... - def get_value(self, key: Union[int, str], args: Sequence[Any], - kwargs: Mapping[str, Any]) -> Any: + def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ... + def get_value(self, key: Union[int, str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: raise IndexError() raise KeyError() - def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any], - kwargs: Mapping[str, Any]) -> None: ... + def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ... def format_field(self, value: Any, format_spec: str) -> Any: ... def convert_field(self, value: Any, conversion: str) -> Any: ... diff --git a/stdlib/3/subprocess.pyi b/stdlib/3/subprocess.pyi index ebfda9fef2d3..d4e2d7ee8115 100644 --- a/stdlib/3/subprocess.pyi +++ b/stdlib/3/subprocess.pyi @@ -21,6 +21,7 @@ _FILE = Union[None, int, IO[Any]] _TXT = Union[bytes, Text] if sys.version_info >= (3, 6): from builtins import _PathLike + _PATH = Union[bytes, Text, _PathLike] else: _PATH = Union[bytes, Text] @@ -37,202 +38,214 @@ if sys.version_info >= (3, 5): # morally: Optional[_TXT] stdout: Any stderr: Any - def __init__(self, args: _CMD, - returncode: int, - stdout: Optional[_TXT] = ..., - stderr: Optional[_TXT] = ...) -> None: ... + def __init__(self, args: _CMD, returncode: int, stdout: Optional[_TXT] = ..., stderr: Optional[_TXT] = ...) -> None: ... def check_returncode(self) -> None: ... - if sys.version_info >= (3, 7): # Nearly the same args as for 3.6, except for capture_output and text - def run(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - capture_output: bool = ..., - check: bool = ..., - encoding: Optional[str] = ..., - errors: Optional[str] = ..., - input: Optional[_TXT] = ..., - text: Optional[bool] = ..., - timeout: Optional[float] = ...) -> CompletedProcess: ... + def run( + args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + capture_output: bool = ..., + check: bool = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + input: Optional[_TXT] = ..., + text: Optional[bool] = ..., + timeout: Optional[float] = ..., + ) -> CompletedProcess: ... elif sys.version_info >= (3, 6): # Nearly same args as Popen.__init__ except for timeout, input, and check - def run(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - check: bool = ..., - encoding: Optional[str] = ..., - errors: Optional[str] = ..., - input: Optional[_TXT] = ..., - timeout: Optional[float] = ...) -> CompletedProcess: ... + def run( + args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + check: bool = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + input: Optional[_TXT] = ..., + timeout: Optional[float] = ..., + ) -> CompletedProcess: ... else: # Nearly same args as Popen.__init__ except for timeout, input, and check - def run(args: _CMD, - timeout: Optional[float] = ..., - input: Optional[_TXT] = ..., - check: bool = ..., - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ...) -> CompletedProcess: ... + def run( + args: _CMD, + timeout: Optional[float] = ..., + input: Optional[_TXT] = ..., + check: bool = ..., + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + ) -> CompletedProcess: ... # Same args as Popen.__init__ -def call(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - timeout: float = ...) -> int: ... +def call( + args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float = ..., +) -> int: ... # Same args as Popen.__init__ -def check_call(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - timeout: float = ...) -> int: ... +def check_call( + args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float = ..., +) -> int: ... if sys.version_info >= (3, 7): # 3.7 added text - def check_output(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float = ..., - input: _TXT = ..., - encoding: Optional[str] = ..., - errors: Optional[str] = ..., - text: Optional[bool] = ..., - ) -> Any: ... # morally: -> _TXT + def check_output( + args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float = ..., + input: _TXT = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + text: Optional[bool] = ..., + ) -> Any: ... # morally: -> _TXT + elif sys.version_info >= (3, 6): # 3.6 added encoding and errors - def check_output(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float = ..., - input: _TXT = ..., - encoding: Optional[str] = ..., - errors: Optional[str] = ..., - ) -> Any: ... # morally: -> _TXT -else: - def check_output(args: _CMD, - bufsize: int = ..., - executable: _PATH = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - timeout: float = ..., - input: _TXT = ..., - ) -> Any: ... # morally: -> _TXT + def check_output( + args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + timeout: float = ..., + input: _TXT = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + ) -> Any: ... # morally: -> _TXT +else: + def check_output( + args: _CMD, + bufsize: int = ..., + executable: _PATH = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + timeout: float = ..., + input: _TXT = ..., + ) -> Any: ... # morally: -> _TXT PIPE: int STDOUT: int DEVNULL: int + class SubprocessError(Exception): ... + class TimeoutExpired(SubprocessError): def __init__(self, cmd: _CMD, timeout: float, output: Optional[_TXT] = ..., stderr: Optional[_TXT] = ...) -> None: ... # morally: _CMD @@ -243,7 +256,6 @@ class TimeoutExpired(SubprocessError): stdout: Any stderr: Any - class CalledProcessError(Exception): returncode = 0 # morally: _CMD @@ -255,12 +267,7 @@ class CalledProcessError(Exception): # morally: Optional[_TXT] stdout: Any stderr: Any - - def __init__(self, - returncode: int, - cmd: _CMD, - output: Optional[_TXT] = ..., - stderr: Optional[_TXT] = ...) -> None: ... + def __init__(self, returncode: int, cmd: _CMD, output: Optional[_TXT] = ..., stderr: Optional[_TXT] = ...) -> None: ... class Popen: args: _CMD @@ -271,71 +278,85 @@ class Popen: returncode = 0 if sys.version_info >= (3, 6): - def __init__(self, - args: _CMD, - bufsize: int = ..., - executable: Optional[_PATH] = ..., - stdin: Optional[_FILE] = ..., - stdout: Optional[_FILE] = ..., - stderr: Optional[_FILE] = ..., - preexec_fn: Optional[Callable[[], Any]] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Optional[Any] = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - encoding: Optional[str] = ..., - errors: Optional[str] = ...) -> None: ... + def __init__( + self, + args: _CMD, + bufsize: int = ..., + executable: Optional[_PATH] = ..., + stdin: Optional[_FILE] = ..., + stdout: Optional[_FILE] = ..., + stderr: Optional[_FILE] = ..., + preexec_fn: Optional[Callable[[], Any]] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Optional[Any] = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + *, + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + ) -> None: ... else: - def __init__(self, - args: _CMD, - bufsize: int = ..., - executable: Optional[_PATH] = ..., - stdin: Optional[_FILE] = ..., - stdout: Optional[_FILE] = ..., - stderr: Optional[_FILE] = ..., - preexec_fn: Optional[Callable[[], Any]] = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: Optional[_PATH] = ..., - env: Optional[_ENV] = ..., - universal_newlines: bool = ..., - startupinfo: Optional[Any] = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ...) -> None: ... - + def __init__( + self, + args: _CMD, + bufsize: int = ..., + executable: Optional[_PATH] = ..., + stdin: Optional[_FILE] = ..., + stdout: Optional[_FILE] = ..., + stderr: Optional[_FILE] = ..., + preexec_fn: Optional[Callable[[], Any]] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: Optional[_PATH] = ..., + env: Optional[_ENV] = ..., + universal_newlines: bool = ..., + startupinfo: Optional[Any] = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ..., + ) -> None: ... def poll(self) -> int: ... def wait(self, timeout: Optional[float] = ...) -> int: ... # Return str/bytes - def communicate(self, - input: Optional[_TXT] = ..., - timeout: Optional[float] = ..., - # morally: -> Tuple[Optional[_TXT], Optional[_TXT]] - ) -> Tuple[Any, Any]: ... + def communicate( + self, + input: Optional[_TXT] = ..., + timeout: Optional[float] = ..., + # morally: -> Tuple[Optional[_TXT], Optional[_TXT]] + ) -> Tuple[Any, Any]: ... def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... def __enter__(self) -> Popen: ... - def __exit__(self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]) -> bool: ... + def __exit__( + self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType] + ) -> bool: ... # The result really is always a str. def getstatusoutput(cmd: _TXT) -> Tuple[int, str]: ... def getoutput(cmd: _TXT) -> str: ... - def list2cmdline(seq: Sequence[str]) -> str: ... # undocumented -if sys.platform == 'win32': +if sys.platform == "win32": class STARTUPINFO: if sys.version_info >= (3, 7): - def __init__(self, *, dwFlags: int = ..., hStdInput: Optional[Any] = ..., hStdOutput: Optional[Any] = ..., hStdError: Optional[Any] = ..., wShowWindow: int = ..., lpAttributeList: Optional[Mapping[str, Any]] = ...) -> None: ... + def __init__( + self, + *, + dwFlags: int = ..., + hStdInput: Optional[Any] = ..., + hStdOutput: Optional[Any] = ..., + hStdError: Optional[Any] = ..., + wShowWindow: int = ..., + lpAttributeList: Optional[Mapping[str, Any]] = ..., + ) -> None: ... dwFlags: int hStdInput: Optional[Any] hStdOutput: Optional[Any] @@ -343,7 +364,6 @@ if sys.platform == 'win32': wShowWindow: int if sys.version_info >= (3, 7): lpAttributeList: Mapping[str, Any] - STD_INPUT_HANDLE: Any STD_OUTPUT_HANDLE: Any STD_ERROR_HANDLE: Any diff --git a/stdlib/3/sys.pyi b/stdlib/3/sys.pyi index 44c974c1f195..57a0c7dceffb 100644 --- a/stdlib/3/sys.pyi +++ b/stdlib/3/sys.pyi @@ -8,7 +8,7 @@ from importlib.abc import MetaPathFinder from types import FrameType, ModuleType, TracebackType from typing import Any, Callable, Dict, List, NoReturn, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") # The following type alias are stub-only and do not exist during runtime _ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] @@ -61,8 +61,8 @@ warnoptions: Any # winver = '' # Windows only _xoptions: Dict[Any, Any] - flags: _flags + class _flags: debug: int division_warning: int @@ -81,20 +81,22 @@ class _flags: dev_mode: int float_info: _float_info + class _float_info: - epsilon: float # DBL_EPSILON - dig: int # DBL_DIG - mant_dig: int # DBL_MANT_DIG - max: float # DBL_MAX - max_exp: int # DBL_MAX_EXP + epsilon: float # DBL_EPSILON + dig: int # DBL_DIG + mant_dig: int # DBL_MANT_DIG + max: float # DBL_MAX + max_exp: int # DBL_MAX_EXP max_10_exp: int # DBL_MAX_10_EXP - min: float # DBL_MIN - min_exp: int # DBL_MIN_EXP + min: float # DBL_MIN + min_exp: int # DBL_MIN_EXP min_10_exp: int # DBL_MIN_10_EXP - radix: int # FLT_RADIX - rounds: int # FLT_ROUNDS + radix: int # FLT_RADIX + rounds: int # FLT_ROUNDS hash_info: _hash_info + class _hash_info: width: int modulus: int @@ -103,6 +105,7 @@ class _hash_info: imag: int implementation: _implementation + class _implementation: name: str version: _version_info @@ -110,6 +113,7 @@ class _implementation: cache_tag: str int_info: _int_info + class _int_info: bits_per_digit: int sizeof_digit: int @@ -120,51 +124,51 @@ class _version_info(Tuple[int, int, int, str, int]): micro: int releaselevel: str serial: int + version_info: _version_info def call_tracing(fn: Callable[..., _T], args: Any) -> _T: ... def _clear_type_cache() -> None: ... def _current_frames() -> Dict[int, Any]: ... def displayhook(value: Optional[int]) -> None: ... -def excepthook(type_: Type[BaseException], value: BaseException, - traceback: TracebackType) -> None: ... +def excepthook(type_: Type[BaseException], value: BaseException, traceback: TracebackType) -> None: ... def exc_info() -> _OptExcInfo: ... + # sys.exit() accepts an optional argument of anything printable def exit(arg: object = ...) -> NoReturn: raise SystemExit() + def getcheckinterval() -> int: ... # deprecated def getdefaultencoding() -> str: ... -if sys.platform != 'win32': + +if sys.platform != "win32": # Unix only def getdlopenflags() -> int: ... + def getfilesystemencoding() -> str: ... def getrefcount(arg: Any) -> int: ... def getrecursionlimit() -> int: ... - @overload def getsizeof(obj: object) -> int: ... @overload def getsizeof(obj: object, default: int) -> int: ... - def getswitchinterval() -> float: ... - @overload def _getframe() -> FrameType: ... @overload def _getframe(depth: int) -> FrameType: ... _ProfileFunc = Callable[[FrameType, str, Any], Any] + def getprofile() -> Optional[_ProfileFunc]: ... def setprofile(profilefunc: Optional[_ProfileFunc]) -> None: ... _TraceFunc = Callable[[FrameType, str, Any], Optional[Callable[[FrameType, str, Any], Any]]] + def gettrace() -> Optional[_TraceFunc]: ... def settrace(tracefunc: Optional[_TraceFunc]) -> None: ... - -class _WinVersion(Tuple[int, int, int, int, - str, int, int, int, int, - Tuple[int, int, int]]): +class _WinVersion(Tuple[int, int, int, int, str, int, int, int, int, Tuple[int, int, int]]): major: int minor: int build: int @@ -176,9 +180,7 @@ class _WinVersion(Tuple[int, int, int, int, product_type: int platform_version: Tuple[int, int, int] - def getwindowsversion() -> _WinVersion: ... # Windows only - def intern(string: str) -> str: ... if sys.version_info >= (3, 5): @@ -193,5 +195,4 @@ def setdlopenflags(n: int) -> None: ... # Linux only def setrecursionlimit(limit: int) -> None: ... def setswitchinterval(interval: float) -> None: ... def settscdump(on_flag: bool) -> None: ... - def gettotalrefcount() -> int: ... # Debug builds only diff --git a/stdlib/3/tempfile.pyi b/stdlib/3/tempfile.pyi index d81704527eb7..df4f2e5a9ec6 100644 --- a/stdlib/3/tempfile.pyi +++ b/stdlib/3/tempfile.pyi @@ -12,35 +12,45 @@ TMP_MAX: int tempdir: Optional[str] template: str - if sys.version_info >= (3, 5): def TemporaryFile( - mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - newline: Optional[str] = ..., suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., - dir: Optional[AnyStr] = ... - ) -> IO[Any]: - ... + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + newline: Optional[str] = ..., + suffix: Optional[AnyStr] = ..., + prefix: Optional[AnyStr] = ..., + dir: Optional[AnyStr] = ..., + ) -> IO[Any]: ... def NamedTemporaryFile( - mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - newline: Optional[str] = ..., suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., - dir: Optional[AnyStr] = ..., delete: bool = ... - ) -> IO[Any]: - ... - + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + newline: Optional[str] = ..., + suffix: Optional[AnyStr] = ..., + prefix: Optional[AnyStr] = ..., + dir: Optional[AnyStr] = ..., + delete: bool = ..., + ) -> IO[Any]: ... # It does not actually derive from IO[AnyStr], but it does implement the # protocol. class SpooledTemporaryFile(IO[AnyStr]): - def __init__(self, max_size: int = ..., mode: str = ..., - buffering: int = ..., encoding: Optional[str] = ..., - newline: Optional[str] = ..., suffix: Optional[str] = ..., - prefix: Optional[str] = ..., dir: Optional[str] = ... - ) -> None: ... + def __init__( + self, + max_size: int = ..., + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + newline: Optional[str] = ..., + suffix: Optional[str] = ..., + prefix: Optional[str] = ..., + dir: Optional[str] = ..., + ) -> None: ... def rollover(self) -> None: ... def __enter__(self) -> SpooledTemporaryFile: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... - + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... # These methods are copied from the abstract methods of IO, because # SpooledTemporaryFile implements IO. # See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918. @@ -61,62 +71,67 @@ if sys.version_info >= (3, 5): def writelines(self, lines: Iterable[AnyStr]) -> None: ... def __next__(self) -> AnyStr: ... def __iter__(self) -> Iterator[AnyStr]: ... - class TemporaryDirectory(Generic[AnyStr]): name: str - def __init__(self, suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., - dir: Optional[AnyStr] = ...) -> None: ... + def __init__( + self, suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., dir: Optional[AnyStr] = ... + ) -> None: ... def cleanup(self) -> None: ... def __enter__(self) -> AnyStr: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... - - def mkstemp(suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., dir: Optional[AnyStr] = ..., - text: bool = ...) -> Tuple[int, AnyStr]: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... + def mkstemp( + suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., dir: Optional[AnyStr] = ..., text: bool = ... + ) -> Tuple[int, AnyStr]: ... @overload def mkdtemp() -> str: ... @overload - def mkdtemp(suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., - dir: Optional[AnyStr] = ...) -> AnyStr: ... + def mkdtemp(suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., dir: Optional[AnyStr] = ...) -> AnyStr: ... def mktemp(suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., dir: Optional[AnyStr] = ...) -> AnyStr: ... - def gettempdirb() -> bytes: ... def gettempprefixb() -> bytes: ... + else: def TemporaryFile( - mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - newline: Optional[str] = ..., suffix: str = ..., prefix: str = ..., - dir: Optional[str] = ... - ) -> IO[Any]: - ... + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + newline: Optional[str] = ..., + suffix: str = ..., + prefix: str = ..., + dir: Optional[str] = ..., + ) -> IO[Any]: ... def NamedTemporaryFile( - mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - newline: Optional[str] = ..., suffix: str = ..., prefix: str = ..., - dir: Optional[str] = ..., delete: bool = ... - ) -> IO[Any]: - ... + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + newline: Optional[str] = ..., + suffix: str = ..., + prefix: str = ..., + dir: Optional[str] = ..., + delete: bool = ..., + ) -> IO[Any]: ... def SpooledTemporaryFile( - max_size: int = ..., mode: str = ..., buffering: int = ..., - encoding: str = ..., newline: str = ..., suffix: str = ..., - prefix: str = ..., dir: Optional[str] = ... - ) -> IO[Any]: - ... - + max_size: int = ..., + mode: str = ..., + buffering: int = ..., + encoding: str = ..., + newline: str = ..., + suffix: str = ..., + prefix: str = ..., + dir: Optional[str] = ..., + ) -> IO[Any]: ... class TemporaryDirectory: name: str - def __init__(self, suffix: str = ..., prefix: str = ..., - dir: Optional[str] = ...) -> None: ... + def __init__(self, suffix: str = ..., prefix: str = ..., dir: Optional[str] = ...) -> None: ... def cleanup(self) -> None: ... def __enter__(self) -> str: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... - - def mkstemp(suffix: str = ..., prefix: str = ..., dir: Optional[str] = ..., - text: bool = ...) -> Tuple[int, str]: ... - def mkdtemp(suffix: str = ..., prefix: str = ..., - dir: Optional[str] = ...) -> str: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... + def mkstemp(suffix: str = ..., prefix: str = ..., dir: Optional[str] = ..., text: bool = ...) -> Tuple[int, str]: ... + def mkdtemp(suffix: str = ..., prefix: str = ..., dir: Optional[str] = ...) -> str: ... def mktemp(suffix: str = ..., prefix: str = ..., dir: Optional[str] = ...) -> str: ... def gettempdir() -> str: ... diff --git a/stdlib/3/textwrap.pyi b/stdlib/3/textwrap.pyi index c9c6a0d1bc6f..f930c5fbc3c1 100644 --- a/stdlib/3/textwrap.pyi +++ b/stdlib/3/textwrap.pyi @@ -22,24 +22,22 @@ class TextWrapper: unicode_whitespace_trans: Dict[int, int] = ... uspace: int = ... x: int = ... - def __init__( - self, - width: int = ..., - initial_indent: str = ..., - subsequent_indent: str = ..., - expand_tabs: bool = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - drop_whitespace: bool = ..., - break_on_hyphens: bool = ..., - tabsize: int = ..., - *, - max_lines: Optional[int] = ..., - placeholder: str = ...) -> None: - ... - + self, + width: int = ..., + initial_indent: str = ..., + subsequent_indent: str = ..., + expand_tabs: bool = ..., + replace_whitespace: bool = ..., + fix_sentence_endings: bool = ..., + break_long_words: bool = ..., + drop_whitespace: bool = ..., + break_on_hyphens: bool = ..., + tabsize: int = ..., + *, + max_lines: Optional[int] = ..., + placeholder: str = ... + ) -> None: ... # Private methods *are* part of the documented API for subclasses. def _munge_whitespace(self, text: str) -> str: ... def _split(self, text: str) -> List[str]: ... @@ -47,67 +45,56 @@ class TextWrapper: def _handle_long_word(self, reversed_chunks: List[str], cur_line: List[str], cur_len: int, width: int) -> None: ... def _wrap_chunks(self, chunks: List[str]) -> List[str]: ... def _split_chunks(self, text: str) -> List[str]: ... - def wrap(self, text: str) -> List[str]: ... def fill(self, text: str) -> str: ... - def wrap( - text: str = ..., - width: int = ..., - *, - initial_indent: str = ..., - subsequent_indent: str = ..., - expand_tabs: bool = ..., - tabsize: int = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - break_on_hyphens: bool = ..., - drop_whitespace: bool = ..., - max_lines: int = ..., - placeholder: str = ... -) -> List[str]: - ... - + text: str = ..., + width: int = ..., + *, + initial_indent: str = ..., + subsequent_indent: str = ..., + expand_tabs: bool = ..., + tabsize: int = ..., + replace_whitespace: bool = ..., + fix_sentence_endings: bool = ..., + break_long_words: bool = ..., + break_on_hyphens: bool = ..., + drop_whitespace: bool = ..., + max_lines: int = ..., + placeholder: str = ... +) -> List[str]: ... def fill( - text: str, - width: int = ..., - *, - initial_indent: str = ..., - subsequent_indent: str = ..., - expand_tabs: bool = ..., - tabsize: int = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - break_on_hyphens: bool = ..., - drop_whitespace: bool = ..., - max_lines: int = ..., - placeholder: str = ... -) -> str: - ... - + text: str, + width: int = ..., + *, + initial_indent: str = ..., + subsequent_indent: str = ..., + expand_tabs: bool = ..., + tabsize: int = ..., + replace_whitespace: bool = ..., + fix_sentence_endings: bool = ..., + break_long_words: bool = ..., + break_on_hyphens: bool = ..., + drop_whitespace: bool = ..., + max_lines: int = ..., + placeholder: str = ... +) -> str: ... def shorten( - text: str, - width: int, - *, - initial_indent: str = ..., - subsequent_indent: str = ..., - expand_tabs: bool = ..., - tabsize: int = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - break_on_hyphens: bool = ..., - drop_whitespace: bool = ..., - # Omit `max_lines: int = None`, it is forced to 1 here. - placeholder: str = ... -) -> str: - ... - -def dedent(text: str) -> str: - ... - -def indent(text: str, prefix: str, predicate: Callable[[str], bool] = ...) -> str: - ... + text: str, + width: int, + *, + initial_indent: str = ..., + subsequent_indent: str = ..., + expand_tabs: bool = ..., + tabsize: int = ..., + replace_whitespace: bool = ..., + fix_sentence_endings: bool = ..., + break_long_words: bool = ..., + break_on_hyphens: bool = ..., + drop_whitespace: bool = ..., + # Omit `max_lines: int = None`, it is forced to 1 here. + placeholder: str = ... +) -> str: ... +def dedent(text: str) -> str: ... +def indent(text: str, prefix: str, predicate: Callable[[str], bool] = ...) -> str: ... diff --git a/stdlib/3/tkinter/__init__.pyi b/stdlib/3/tkinter/__init__.pyi index b4818d391c8c..207e3317fbd0 100644 --- a/stdlib/3/tkinter/__init__.pyi +++ b/stdlib/3/tkinter/__init__.pyi @@ -176,8 +176,9 @@ class Misc: def place_slaves(self): ... def grid_anchor(self, anchor: Optional[Any] = ...): ... anchor: Any - def grid_bbox(self, column: Optional[Any] = ..., row: Optional[Any] = ..., col2: Optional[Any] = ..., - row2: Optional[Any] = ...): ... + def grid_bbox( + self, column: Optional[Any] = ..., row: Optional[Any] = ..., col2: Optional[Any] = ..., row2: Optional[Any] = ... + ): ... bbox: Any def grid_columnconfigure(self, index, cnf=..., **kw): ... columnconfigure: Any @@ -213,8 +214,13 @@ class YView: def yview_scroll(self, number, what): ... class Wm: - def wm_aspect(self, minNumer: Optional[Any] = ..., minDenom: Optional[Any] = ..., maxNumer: Optional[Any] = ..., - maxDenom: Optional[Any] = ...): ... + def wm_aspect( + self, + minNumer: Optional[Any] = ..., + minDenom: Optional[Any] = ..., + maxNumer: Optional[Any] = ..., + maxDenom: Optional[Any] = ..., + ): ... aspect: Any def wm_attributes(self, *args): ... attributes: Any @@ -234,8 +240,13 @@ class Wm: frame: Any def wm_geometry(self, newGeometry: Optional[Any] = ...): ... geometry: Any - def wm_grid(self, baseWidth: Optional[Any] = ..., baseHeight: Optional[Any] = ..., widthInc: Optional[Any] = ..., - heightInc: Optional[Any] = ...): ... + def wm_grid( + self, + baseWidth: Optional[Any] = ..., + baseHeight: Optional[Any] = ..., + widthInc: Optional[Any] = ..., + heightInc: Optional[Any] = ..., + ): ... grid: Any def wm_group(self, pathName: Optional[Any] = ...): ... group: Any @@ -282,8 +293,15 @@ class Tk(Misc, Wm): master: Optional[Any] children: Dict[str, Any] tk: Any - def __init__(self, screenName: Optional[str] = ..., baseName: Optional[str] = ..., className: str = ..., useTk: bool = ..., - sync: bool = ..., use: Optional[str] = ...) -> None: ... + def __init__( + self, + screenName: Optional[str] = ..., + baseName: Optional[str] = ..., + className: str = ..., + useTk: bool = ..., + sync: bool = ..., + use: Optional[str] = ..., + ) -> None: ... def loadtk(self) -> None: ... def destroy(self) -> None: ... def readprofile(self, baseName: str, className: str) -> None: ... @@ -555,9 +573,19 @@ class Text(Widget, XView, YView): def replace(self, index1, index2, chars, *args): ... def scan_mark(self, x, y): ... def scan_dragto(self, x, y): ... - def search(self, pattern, index, stopindex: Optional[Any] = ..., forwards: Optional[Any] = ..., - backwards: Optional[Any] = ..., exact: Optional[Any] = ..., regexp: Optional[Any] = ..., - nocase: Optional[Any] = ..., count: Optional[Any] = ..., elide: Optional[Any] = ...): ... + def search( + self, + pattern, + index, + stopindex: Optional[Any] = ..., + forwards: Optional[Any] = ..., + backwards: Optional[Any] = ..., + exact: Optional[Any] = ..., + regexp: Optional[Any] = ..., + nocase: Optional[Any] = ..., + count: Optional[Any] = ..., + elide: Optional[Any] = ..., + ): ... def see(self, index): ... def tag_add(self, tagName, index1, *args): ... def tag_unbind(self, tagName, sequence, funcid: Optional[Any] = ...): ... diff --git a/stdlib/3/tkinter/filedialog.pyi b/stdlib/3/tkinter/filedialog.pyi index 4fa850ec5942..8c281c6bdbad 100644 --- a/stdlib/3/tkinter/filedialog.pyi +++ b/stdlib/3/tkinter/filedialog.pyi @@ -19,7 +19,9 @@ class FileDialog: ok_button: Button = ... filter_button: Button = ... cancel_button: Button = ... - def __init__(self, master, title: Optional[Any] = ...) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either + def __init__( + self, master, title: Optional[Any] = ... + ) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either how: Optional[Any] = ... def go(self, dir_or_file: Any = ..., pattern: str = ..., default: str = ..., key: Optional[Any] = ...): ... def quit(self, how: Optional[Any] = ...) -> None: ... diff --git a/stdlib/3/tokenize.pyi b/stdlib/3/tokenize.pyi index 3ee9f8b67ad0..54aef368ef68 100644 --- a/stdlib/3/tokenize.pyi +++ b/stdlib/3/tokenize.pyi @@ -9,13 +9,7 @@ ENCODING: int _Position = Tuple[int, int] -_TokenInfo = NamedTuple('TokenInfo', [ - ('type', int), - ('string', str), - ('start', _Position), - ('end', _Position), - ('line', str) -]) +_TokenInfo = NamedTuple("TokenInfo", [("type", int), ("string", str), ("start", _Position), ("end", _Position), ("line", str)]) class TokenInfo(_TokenInfo): @property @@ -45,6 +39,7 @@ def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, N if sys.version_info >= (3, 6): from os import PathLike def open(filename: Union[str, bytes, int, PathLike]) -> TextIO: ... + else: def open(filename: Union[str, bytes, int]) -> TextIO: ... diff --git a/stdlib/3/tracemalloc.pyi b/stdlib/3/tracemalloc.pyi index 8758cc670112..27f9ad14ef99 100644 --- a/stdlib/3/tracemalloc.pyi +++ b/stdlib/3/tracemalloc.pyi @@ -26,7 +26,14 @@ class Filter: lineno: Optional[int] filename_pattern: str all_frames: bool - def __init__(self, inclusive: bool, filename_pattern: str, lineno: Optional[int] = ..., all_frames: bool = ..., domain: Optional[int] = ...) -> None: ... + def __init__( + self, + inclusive: bool, + filename_pattern: str, + lineno: Optional[int] = ..., + all_frames: bool = ..., + domain: Optional[int] = ..., + ) -> None: ... class Frame: filename: str diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 0c040a6b4f5e..08e86e66c988 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -10,11 +10,11 @@ from typing import Any, Awaitable, Callable, Dict, Generic, Iterator, Mapping, O # reasons exists in its own stub file (with ModuleSpec and Loader). from _importlib_modulespec import ModuleType as ModuleType # Exported -_T = TypeVar('_T') -_T_co = TypeVar('_T_co', covariant=True) -_T_contra = TypeVar('_T_contra', contravariant=True) -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') +_T = TypeVar("_T") +_T_co = TypeVar("_T_co", covariant=True) +_T_contra = TypeVar("_T_contra", contravariant=True) +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") class _Cell: cell_contents: Any @@ -29,13 +29,22 @@ class FunctionType: __qualname__: str __annotations__: Dict[str, Any] __kwdefaults__: Dict[str, Any] - def __init__(self, code: CodeType, globals: Dict[str, Any], name: Optional[str] = ..., argdefs: Optional[Tuple[object, ...]] = ..., closure: Optional[Tuple[_Cell, ...]] = ...) -> None: ... + def __init__( + self, + code: CodeType, + globals: Dict[str, Any], + name: Optional[str] = ..., + argdefs: Optional[Tuple[object, ...]] = ..., + closure: Optional[Tuple[_Cell, ...]] = ..., + ) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def __get__(self, obj: Optional[object], type: Optional[type]) -> MethodType: ... + LambdaType = FunctionType class CodeType: """Create a code object. Not for the faint of heart.""" + co_argcount: int co_kwonlyargcount: int co_nlocals: int @@ -137,6 +146,7 @@ class _StaticFunctionType: similar to wrapping a function in staticmethod() at runtime to prevent it being bound as a method. """ + def __get__(self, obj: Optional[object], type: Optional[type]) -> FunctionType: ... class MethodType: @@ -146,11 +156,13 @@ class MethodType: __qualname__: str def __init__(self, func: Callable, obj: object) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + class BuiltinFunctionType: __self__: Union[object, ModuleType] __name__: str __qualname__: str def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + BuiltinMethodType = BuiltinFunctionType class TracebackType: @@ -180,7 +192,6 @@ class FrameType: if sys.version_info >= (3, 7): f_trace_lines: bool f_trace_opcodes: bool - def clear(self) -> None: ... class GetSetDescriptorType: @@ -189,6 +200,7 @@ class GetSetDescriptorType: def __get__(self, obj: Any, type: type = ...) -> Any: ... def __set__(self, obj: Any) -> None: ... def __delete__(self, obj: Any) -> None: ... + class MemberDescriptorType: __name__: str __objclass__: type @@ -196,8 +208,12 @@ class MemberDescriptorType: def __set__(self, obj: Any) -> None: ... def __delete__(self, obj: Any) -> None: ... -def new_class(name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any] = ..., exec_body: Callable[[Dict[str, Any]], None] = ...) -> type: ... -def prepare_class(name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any] = ...) -> Tuple[type, Dict[str, Any], Dict[str, Any]]: ... +def new_class( + name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any] = ..., exec_body: Callable[[Dict[str, Any]], None] = ... +) -> type: ... +def prepare_class( + name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any] = ... +) -> Tuple[type, Dict[str, Any], Dict[str, Any]]: ... # Actually a different type, but `property` is special and we want that too. DynamicClassAttribute = property diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index deebf1471c8e..f98056ae2f94 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -50,25 +50,24 @@ Deque = TypeAlias(object) ChainMap = TypeAlias(object) # Predefined type variables. -AnyStr = TypeVar('AnyStr', str, bytes) +AnyStr = TypeVar("AnyStr", str, bytes) # Abstract base classes. # These type variables are used by the container types. -_T = TypeVar('_T') -_S = TypeVar('_S') -_KT = TypeVar('_KT') # Key type. -_VT = TypeVar('_VT') # Value type. -_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers. -_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers. -_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers. -_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers. -_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant. -_TC = TypeVar('_TC', bound=Type[object]) +_T = TypeVar("_T") +_S = TypeVar("_S") +_KT = TypeVar("_KT") # Key type. +_VT = TypeVar("_VT") # Value type. +_T_co = TypeVar("_T_co", covariant=True) # Any type covariant containers. +_V_co = TypeVar("_V_co", covariant=True) # Any type covariant containers. +_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers. +_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. +_T_contra = TypeVar("_T_contra", contravariant=True) # Ditto contravariant. +_TC = TypeVar("_TC", bound=Type[object]) _C = TypeVar("_C", bound=Callable) def runtime(cls: _TC) -> _TC: ... - @runtime class SupportsInt(Protocol, metaclass=ABCMeta): @abstractmethod @@ -135,20 +134,14 @@ class Iterator(Iterable[_T_co], Protocol[_T_co]): class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]): @abstractmethod def __next__(self) -> _T_co: ... - @abstractmethod def send(self, value: _T_contra) -> _T_co: ... - @abstractmethod - def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ..., - tb: Optional[TracebackType] = ...) -> _T_co: ... - + def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ..., tb: Optional[TracebackType] = ...) -> _T_co: ... @abstractmethod def close(self) -> None: ... - @abstractmethod def __iter__(self) -> Generator[_T_co, _T_contra, _V_co]: ... - @property def gi_code(self) -> CodeType: ... @property @@ -161,7 +154,6 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]): # TODO: Several types should only be defined if sys.python_version >= (3, 5): # Awaitable, AsyncIterator, AsyncIterable, Coroutine, Collection. # See https: //github.com/python/typeshed/issues/655 for why this is not easy. - @runtime class Awaitable(Protocol[_T_co]): @abstractmethod @@ -176,22 +168,18 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]): def cr_frame(self) -> FrameType: ... @property def cr_running(self) -> bool: ... - @abstractmethod def send(self, value: _T_contra) -> _T_co: ... - @abstractmethod - def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ..., - tb: Optional[TracebackType] = ...) -> _T_co: ... - + def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ..., tb: Optional[TracebackType] = ...) -> _T_co: ... @abstractmethod def close(self) -> None: ... - # NOTE: This type does not exist in typing.py or PEP 484. # The parameters correspond to Generator, but the 4th is the original type. -class AwaitableGenerator(Awaitable[_V_co], Generator[_T_co, _T_contra, _V_co], - Generic[_T_co, _T_contra, _V_co, _S], metaclass=ABCMeta): ... +class AwaitableGenerator( + Awaitable[_V_co], Generator[_T_co, _T_contra, _V_co], Generic[_T_co, _T_contra, _V_co, _S], metaclass=ABCMeta +): ... @runtime class AsyncIterable(Protocol[_T_co]): @@ -199,8 +187,7 @@ class AsyncIterable(Protocol[_T_co]): def __aiter__(self) -> AsyncIterator[_T_co]: ... @runtime -class AsyncIterator(AsyncIterable[_T_co], - Protocol[_T_co]): +class AsyncIterator(AsyncIterable[_T_co], Protocol[_T_co]): @abstractmethod def __anext__(self) -> Awaitable[_T_co]: ... def __aiter__(self) -> AsyncIterator[_T_co]: ... @@ -209,20 +196,14 @@ if sys.version_info >= (3, 6): class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]): @abstractmethod def __anext__(self) -> Awaitable[_T_co]: ... - @abstractmethod def asend(self, value: _T_contra) -> Awaitable[_T_co]: ... - @abstractmethod - def athrow(self, typ: Type[BaseException], val: Optional[BaseException] = ..., - tb: Any = ...) -> Awaitable[_T_co]: ... - + def athrow(self, typ: Type[BaseException], val: Optional[BaseException] = ..., tb: Any = ...) -> Awaitable[_T_co]: ... @abstractmethod def aclose(self) -> Awaitable[None]: ... - @abstractmethod def __aiter__(self) -> AsyncGenerator[_T_co, _T_contra]: ... - @property def ag_await(self) -> Any: ... @property @@ -237,14 +218,12 @@ class Container(Protocol[_T_co]): @abstractmethod def __contains__(self, __x: object) -> bool: ... - if sys.version_info >= (3, 6): @runtime class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]): # Implement Sized (but don't have it as a base class). @abstractmethod def __len__(self) -> int: ... - _Collection = Collection else: @runtime @@ -362,24 +341,26 @@ class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]): @runtime class ContextManager(Protocol[_T_co]): def __enter__(self) -> _T_co: ... - def __exit__(self, __exc_type: Optional[Type[BaseException]], - __exc_value: Optional[BaseException], - __traceback: Optional[TracebackType]) -> Optional[bool]: ... + def __exit__( + self, + __exc_type: Optional[Type[BaseException]], + __exc_value: Optional[BaseException], + __traceback: Optional[TracebackType], + ) -> Optional[bool]: ... if sys.version_info >= (3, 5): @runtime class AsyncContextManager(Protocol[_T_co]): def __aenter__(self) -> Awaitable[_T_co]: ... - def __aexit__(self, exc_type: Optional[Type[BaseException]], - exc_value: Optional[BaseException], - traceback: Optional[TracebackType]) -> Awaitable[Optional[bool]]: ... + def __aexit__( + self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType] + ) -> Awaitable[Optional[bool]]: ... class Mapping(_Collection[_KT], Generic[_KT, _VT_co]): # TODO: We wish the key type could also be covariant, but that doesn't work, # see discussion in https: //github.com/python/typing/pull/273. @abstractmethod - def __getitem__(self, k: _KT) -> _VT_co: - ... + def __getitem__(self, k: _KT) -> _VT_co: ... # Mixin methods @overload def get(self, k: _KT) -> Optional[_VT_co]: ... @@ -395,7 +376,6 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): def __setitem__(self, k: _KT, v: _VT) -> None: ... @abstractmethod def __delitem__(self, v: _KT) -> None: ... - def clear(self) -> None: ... @overload def pop(self, k: _KT) -> _VT: ... @@ -465,7 +445,6 @@ class IO(Iterator[AnyStr], Generic[AnyStr]): def write(self, s: AnyStr) -> int: ... @abstractmethod def writelines(self, lines: Iterable[AnyStr]) -> None: ... - @abstractmethod def __next__(self) -> AnyStr: ... @abstractmethod @@ -473,8 +452,9 @@ class IO(Iterator[AnyStr], Generic[AnyStr]): @abstractmethod def __enter__(self) -> IO[AnyStr]: ... @abstractmethod - def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], - traceback: Optional[TracebackType]) -> bool: ... + def __exit__( + self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType] + ) -> bool: ... class BinaryIO(IO[bytes]): # TODO readinto @@ -486,7 +466,6 @@ class BinaryIO(IO[bytes]): @overload @abstractmethod def write(self, s: bytes) -> int: ... - @abstractmethod def __enter__(self) -> BinaryIO: ... @@ -517,20 +496,15 @@ class Match(Generic[AnyStr]): # The regular expression object whose match() or search() method produced # this match instance. re: Pattern[AnyStr] - def expand(self, template: AnyStr) -> AnyStr: ... - @overload def group(self, group1: int = ...) -> AnyStr: ... @overload def group(self, group1: str) -> AnyStr: ... @overload - def group(self, group1: int, group2: int, - *groups: int) -> Sequence[AnyStr]: ... + def group(self, group1: int, group2: int, *groups: int) -> Sequence[AnyStr]: ... @overload - def group(self, group1: str, group2: str, - *groups: str) -> Sequence[AnyStr]: ... - + def group(self, group1: str, group2: str, *groups: str) -> Sequence[AnyStr]: ... def groups(self, default: AnyStr = ...) -> Sequence[AnyStr]: ... def groupdict(self, default: AnyStr = ...) -> dict[str, AnyStr]: ... def start(self, group: Union[int, str] = ...) -> int: ... @@ -544,39 +518,27 @@ class Pattern(Generic[AnyStr]): groupindex: Mapping[str, int] groups = 0 pattern: AnyStr - - def search(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> Optional[Match[AnyStr]]: ... - def match(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> Optional[Match[AnyStr]]: ... + def search(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Optional[Match[AnyStr]]: ... + def match(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Optional[Match[AnyStr]]: ... # New in Python 3.4 - def fullmatch(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> Optional[Match[AnyStr]]: ... + def fullmatch(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Optional[Match[AnyStr]]: ... def split(self, string: AnyStr, maxsplit: int = ...) -> list[AnyStr]: ... - def findall(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> list[Any]: ... - def finditer(self, string: AnyStr, pos: int = ..., - endpos: int = ...) -> Iterator[Match[AnyStr]]: ... - + def findall(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> list[Any]: ... + def finditer(self, string: AnyStr, pos: int = ..., endpos: int = ...) -> Iterator[Match[AnyStr]]: ... @overload - def sub(self, repl: AnyStr, string: AnyStr, - count: int = ...) -> AnyStr: ... + def sub(self, repl: AnyStr, string: AnyStr, count: int = ...) -> AnyStr: ... @overload - def sub(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, - count: int = ...) -> AnyStr: ... - + def sub(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ...) -> AnyStr: ... @overload - def subn(self, repl: AnyStr, string: AnyStr, - count: int = ...) -> Tuple[AnyStr, int]: ... + def subn(self, repl: AnyStr, string: AnyStr, count: int = ...) -> Tuple[AnyStr, int]: ... @overload - def subn(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, - count: int = ...) -> Tuple[AnyStr, int]: ... + def subn(self, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ...) -> Tuple[AnyStr, int]: ... # Functions -def get_type_hints(obj: Callable, globalns: Optional[dict[str, Any]] = ..., - localns: Optional[dict[str, Any]] = ...) -> dict[str, Any]: ... - +def get_type_hints( + obj: Callable, globalns: Optional[dict[str, Any]] = ..., localns: Optional[dict[str, Any]] = ... +) -> dict[str, Any]: ... @overload def cast(tp: Type[_T], obj: Any) -> _T: ... @overload @@ -590,13 +552,11 @@ class NamedTuple(tuple): _field_defaults: Dict[str, Any] = ... _fields: Tuple[str, ...] _source: str - - def __init__(self, typename: str, fields: Iterable[Tuple[str, Any]] = ..., *, - verbose: bool = ..., rename: bool = ..., **kwargs: Any) -> None: ... - + def __init__( + self, typename: str, fields: Iterable[Tuple[str, Any]] = ..., *, verbose: bool = ..., rename: bool = ..., **kwargs: Any + ) -> None: ... @classmethod def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ... - def _asdict(self) -> collections.OrderedDict[str, Any]: ... def _replace(self: _T, **kwargs: Any) -> _T: ... diff --git a/stdlib/3/unittest/__init__.pyi b/stdlib/3/unittest/__init__.pyi index 6c1737f8279b..5d308d1f6754 100644 --- a/stdlib/3/unittest/__init__.pyi +++ b/stdlib/3/unittest/__init__.pyi @@ -14,16 +14,17 @@ class TestProgram: result: TestResult def runTests(self) -> None: ... # undocumented - -def main(module: Union[None, str, ModuleType] = ..., - defaultTest: Union[str, Iterable[str], None] = ..., - argv: Optional[List[str]] = ..., - testRunner: Union[Type[TestRunner], TestRunner, None] = ..., - testLoader: TestLoader = ..., exit: bool = ..., verbosity: int = ..., - failfast: Optional[bool] = ..., catchbreak: Optional[bool] = ..., - buffer: Optional[bool] = ..., - warnings: Optional[str] = ...) -> TestProgram: ... - - -def load_tests(loader: TestLoader, tests: TestSuite, - pattern: Optional[str]) -> TestSuite: ... +def main( + module: Union[None, str, ModuleType] = ..., + defaultTest: Union[str, Iterable[str], None] = ..., + argv: Optional[List[str]] = ..., + testRunner: Union[Type[TestRunner], TestRunner, None] = ..., + testLoader: TestLoader = ..., + exit: bool = ..., + verbosity: int = ..., + failfast: Optional[bool] = ..., + catchbreak: Optional[bool] = ..., + buffer: Optional[bool] = ..., + warnings: Optional[str] = ..., +) -> TestProgram: ... +def load_tests(loader: TestLoader, tests: TestSuite, pattern: Optional[str]) -> TestSuite: ... diff --git a/stdlib/3/unittest/case.pyi b/stdlib/3/unittest/case.pyi index 6ded9cdd08f9..af0c79124e9e 100644 --- a/stdlib/3/unittest/case.pyi +++ b/stdlib/3/unittest/case.pyi @@ -24,20 +24,17 @@ from typing import ( overload, ) -_E = TypeVar('_E', bound=BaseException) -_FT = TypeVar('_FT', bound=Callable[..., Any]) - +_E = TypeVar("_E", bound=BaseException) +_FT = TypeVar("_FT", bound=Callable[..., Any]) def expectedFailure(func: _FT) -> _FT: ... def skip(reason: str) -> Callable[[_FT], _FT]: ... def skipIf(condition: object, reason: str) -> Callable[[_FT], _FT]: ... def skipUnless(condition: object, reason: str) -> Callable[[_FT], _FT]: ... - class SkipTest(Exception): def __init__(self, reason: str) -> None: ... - class TestCase: failureException: Type[BaseException] longMessage: bool @@ -58,183 +55,177 @@ class TestCase: def skipTest(self, reason: Any) -> None: ... def subTest(self, msg: Any = ..., **params: Any) -> ContextManager[None]: ... def debug(self) -> None: ... - def _addSkip( - self, result: unittest.result.TestResult, test_case: unittest.case.TestCase, reason: str - ) -> None: ... + def _addSkip(self, result: unittest.result.TestResult, test_case: unittest.case.TestCase, reason: str) -> None: ... def assertEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... - def assertNotEqual(self, first: Any, second: Any, - msg: Any = ...) -> None: ... + def assertNotEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... def assertTrue(self, expr: Any, msg: Any = ...) -> None: ... def assertFalse(self, expr: Any, msg: Any = ...) -> None: ... def assertIs(self, expr1: Any, expr2: Any, msg: Any = ...) -> None: ... def assertIsNot(self, expr1: Any, expr2: Any, msg: Any = ...) -> None: ... def assertIsNone(self, obj: Any, msg: Any = ...) -> None: ... def assertIsNotNone(self, obj: Any, msg: Any = ...) -> None: ... - def assertIn(self, member: Any, - container: Union[Iterable[Any], Container[Any]], - msg: Any = ...) -> None: ... - def assertNotIn(self, member: Any, - container: Union[Iterable[Any], Container[Any]], - msg: Any = ...) -> None: ... - def assertIsInstance(self, obj: Any, - cls: Union[type, Tuple[type, ...]], - msg: Any = ...) -> None: ... - def assertNotIsInstance(self, obj: Any, - cls: Union[type, Tuple[type, ...]], - msg: Any = ...) -> None: ... + def assertIn(self, member: Any, container: Union[Iterable[Any], Container[Any]], msg: Any = ...) -> None: ... + def assertNotIn(self, member: Any, container: Union[Iterable[Any], Container[Any]], msg: Any = ...) -> None: ... + def assertIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], msg: Any = ...) -> None: ... + def assertNotIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], msg: Any = ...) -> None: ... def assertGreater(self, a: Any, b: Any, msg: Any = ...) -> None: ... def assertGreaterEqual(self, a: Any, b: Any, msg: Any = ...) -> None: ... def assertLess(self, a: Any, b: Any, msg: Any = ...) -> None: ... def assertLessEqual(self, a: Any, b: Any, msg: Any = ...) -> None: ... @overload - def assertRaises(self, # type: ignore - expected_exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], - callable: Callable[..., Any], - *args: Any, **kwargs: Any) -> None: ... + def assertRaises( + self, # type: ignore + expected_exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], + callable: Callable[..., Any], + *args: Any, + **kwargs: Any + ) -> None: ... @overload - def assertRaises(self, - expected_exception: Union[Type[_E], Tuple[Type[_E], ...]], - msg: Any = ...) -> _AssertRaisesContext[_E]: ... + def assertRaises( + self, expected_exception: Union[Type[_E], Tuple[Type[_E], ...]], msg: Any = ... + ) -> _AssertRaisesContext[_E]: ... @overload - def assertRaisesRegex(self, # type: ignore - expected_exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], - expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], - callable: Callable[..., Any], - *args: Any, **kwargs: Any) -> None: ... + def assertRaisesRegex( + self, # type: ignore + expected_exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], + expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], + callable: Callable[..., Any], + *args: Any, + **kwargs: Any + ) -> None: ... @overload - def assertRaisesRegex(self, - expected_exception: Union[Type[_E], Tuple[Type[_E], ...]], - expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], - msg: Any = ...) -> _AssertRaisesContext[_E]: ... + def assertRaisesRegex( + self, + expected_exception: Union[Type[_E], Tuple[Type[_E], ...]], + expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], + msg: Any = ..., + ) -> _AssertRaisesContext[_E]: ... @overload - def assertWarns(self, # type: ignore - expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], - callable: Callable[..., Any], - *args: Any, **kwargs: Any) -> None: ... + def assertWarns( + self, # type: ignore + expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], + callable: Callable[..., Any], + *args: Any, + **kwargs: Any + ) -> None: ... @overload - def assertWarns(self, - expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], - msg: Any = ...) -> _AssertWarnsContext: ... + def assertWarns( + self, expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], msg: Any = ... + ) -> _AssertWarnsContext: ... @overload - def assertWarnsRegex(self, # type: ignore - expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], - expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], - callable: Callable[..., Any], - *args: Any, **kwargs: Any) -> None: ... + def assertWarnsRegex( + self, # type: ignore + expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], + expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], + callable: Callable[..., Any], + *args: Any, + **kwargs: Any + ) -> None: ... @overload - def assertWarnsRegex(self, - expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], - expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], - msg: Any = ...) -> _AssertWarnsContext: ... - def assertLogs( - self, logger: Optional[logging.Logger] = ..., - level: Union[int, str, None] = ... - ) -> _AssertLogsContext: ... - def assertAlmostEqual(self, first: float, second: float, places: int = ..., - msg: Any = ..., delta: float = ...) -> None: ... + def assertWarnsRegex( + self, + expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], + expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], + msg: Any = ..., + ) -> _AssertWarnsContext: ... + def assertLogs(self, logger: Optional[logging.Logger] = ..., level: Union[int, str, None] = ...) -> _AssertLogsContext: ... + def assertAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ..., delta: float = ...) -> None: ... @overload - def assertNotAlmostEqual(self, first: float, second: float, *, - msg: Any = ...) -> None: ... + def assertNotAlmostEqual(self, first: float, second: float, *, msg: Any = ...) -> None: ... @overload - def assertNotAlmostEqual(self, first: float, second: float, - places: int = ..., msg: Any = ...) -> None: ... + def assertNotAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... @overload - def assertNotAlmostEqual(self, first: float, second: float, *, - msg: Any = ..., delta: float = ...) -> None: ... - def assertRegex(self, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], - msg: Any = ...) -> None: ... - def assertNotRegex(self, text: AnyStr, unexpected_regex: Union[AnyStr, Pattern[AnyStr]], - msg: Any = ...) -> None: ... - def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any], - msg: Any = ...) -> None: ... - def addTypeEqualityFunc(self, typeobj: Type[Any], - function: Callable[..., None]) -> None: ... - def assertMultiLineEqual(self, first: str, second: str, - msg: Any = ...) -> None: ... - def assertSequenceEqual(self, seq1: Sequence[Any], seq2: Sequence[Any], - msg: Any = ..., - seq_type: Type[Sequence[Any]] = ...) -> None: ... - def assertListEqual(self, list1: List[Any], list2: List[Any], - msg: Any = ...) -> None: ... - def assertTupleEqual(self, tuple1: Tuple[Any, ...], tuple2: Tuple[Any, ...], - msg: Any = ...) -> None: ... - def assertSetEqual(self, set1: Union[Set[Any], FrozenSet[Any]], - set2: Union[Set[Any], FrozenSet[Any]], msg: Any = ...) -> None: ... - def assertDictEqual(self, d1: Dict[Any, Any], d2: Dict[Any, Any], - msg: Any = ...) -> None: ... + def assertNotAlmostEqual(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ... + def assertRegex(self, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: Any = ...) -> None: ... + def assertNotRegex(self, text: AnyStr, unexpected_regex: Union[AnyStr, Pattern[AnyStr]], msg: Any = ...) -> None: ... + def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any], msg: Any = ...) -> None: ... + def addTypeEqualityFunc(self, typeobj: Type[Any], function: Callable[..., None]) -> None: ... + def assertMultiLineEqual(self, first: str, second: str, msg: Any = ...) -> None: ... + def assertSequenceEqual( + self, seq1: Sequence[Any], seq2: Sequence[Any], msg: Any = ..., seq_type: Type[Sequence[Any]] = ... + ) -> None: ... + def assertListEqual(self, list1: List[Any], list2: List[Any], msg: Any = ...) -> None: ... + def assertTupleEqual(self, tuple1: Tuple[Any, ...], tuple2: Tuple[Any, ...], msg: Any = ...) -> None: ... + def assertSetEqual( + self, set1: Union[Set[Any], FrozenSet[Any]], set2: Union[Set[Any], FrozenSet[Any]], msg: Any = ... + ) -> None: ... + def assertDictEqual(self, d1: Dict[Any, Any], d2: Dict[Any, Any], msg: Any = ...) -> None: ... def fail(self, msg: Any = ...) -> NoReturn: ... def countTestCases(self) -> int: ... def defaultTestResult(self) -> unittest.result.TestResult: ... def id(self) -> str: ... def shortDescription(self) -> Optional[str]: ... - def addCleanup(self, function: Callable[..., Any], *args: Any, - **kwargs: Any) -> None: ... + def addCleanup(self, function: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... def doCleanups(self) -> None: ... def _formatMessage(self, msg: Optional[str], standardMsg: str) -> str: ... # undocumented def _getAssertEqualityFunc(self, first: Any, second: Any) -> Callable[..., None]: ... # undocumented # below is deprecated - def failUnlessEqual(self, first: Any, second: Any, - msg: Any = ...) -> None: ... + def failUnlessEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... def assertEquals(self, first: Any, second: Any, msg: Any = ...) -> None: ... def failIfEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... - def assertNotEquals(self, first: Any, second: Any, - msg: Any = ...) -> None: ... + def assertNotEquals(self, first: Any, second: Any, msg: Any = ...) -> None: ... def failUnless(self, expr: bool, msg: Any = ...) -> None: ... def assert_(self, expr: bool, msg: Any = ...) -> None: ... def failIf(self, expr: bool, msg: Any = ...) -> None: ... @overload - def failUnlessRaises(self, # type: ignore - exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], - callable: Callable[..., Any] = ..., - *args: Any, **kwargs: Any) -> None: ... + def failUnlessRaises( + self, # type: ignore + exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], + callable: Callable[..., Any] = ..., + *args: Any, + **kwargs: Any + ) -> None: ... @overload - def failUnlessRaises(self, - exception: Union[Type[_E], Tuple[Type[_E], ...]], - msg: Any = ...) -> _AssertRaisesContext[_E]: ... - def failUnlessAlmostEqual(self, first: float, second: float, - places: int = ..., msg: Any = ...) -> None: ... - def assertAlmostEquals(self, first: float, second: float, places: int = ..., - msg: Any = ..., delta: float = ...) -> None: ... - def failIfAlmostEqual(self, first: float, second: float, places: int = ..., - msg: Any = ...) -> None: ... - def assertNotAlmostEquals(self, first: float, second: float, - places: int = ..., msg: Any = ..., - delta: float = ...) -> None: ... - def assertRegexpMatches(self, text: AnyStr, regex: Union[AnyStr, Pattern[AnyStr]], - msg: Any = ...) -> None: ... + def failUnlessRaises(self, exception: Union[Type[_E], Tuple[Type[_E], ...]], msg: Any = ...) -> _AssertRaisesContext[_E]: ... + def failUnlessAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... + def assertAlmostEquals(self, first: float, second: float, places: int = ..., msg: Any = ..., delta: float = ...) -> None: ... + def failIfAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ... + def assertNotAlmostEquals( + self, first: float, second: float, places: int = ..., msg: Any = ..., delta: float = ... + ) -> None: ... + def assertRegexpMatches(self, text: AnyStr, regex: Union[AnyStr, Pattern[AnyStr]], msg: Any = ...) -> None: ... @overload - def assertRaisesRegexp(self, # type: ignore - exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], - callable: Callable[..., Any] = ..., - *args: Any, **kwargs: Any) -> None: ... + def assertRaisesRegexp( + self, # type: ignore + exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], + callable: Callable[..., Any] = ..., + *args: Any, + **kwargs: Any + ) -> None: ... @overload - def assertRaisesRegexp(self, - exception: Union[Type[_E], Tuple[Type[_E], ...]], - msg: Any = ...) -> _AssertRaisesContext[_E]: ... + def assertRaisesRegexp( + self, exception: Union[Type[_E], Tuple[Type[_E], ...]], msg: Any = ... + ) -> _AssertRaisesContext[_E]: ... class FunctionTestCase(TestCase): - def __init__(self, testFunc: Callable[[], None], - setUp: Optional[Callable[[], None]] = ..., - tearDown: Optional[Callable[[], None]] = ..., - description: Optional[str] = ...) -> None: ... + def __init__( + self, + testFunc: Callable[[], None], + setUp: Optional[Callable[[], None]] = ..., + tearDown: Optional[Callable[[], None]] = ..., + description: Optional[str] = ..., + ) -> None: ... class _AssertRaisesContext(Generic[_E]): exception: _E def __enter__(self) -> _AssertRaisesContext[_E]: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... class _AssertWarnsContext: warning: Warning filename: str lineno: int def __enter__(self) -> _AssertWarnsContext: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... class _AssertLogsContext: records: List[logging.LogRecord] output: List[str] def __enter__(self) -> _AssertLogsContext: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + ) -> bool: ... diff --git a/stdlib/3/unittest/loader.pyi b/stdlib/3/unittest/loader.pyi index 10de922e17b5..225f6e4ced23 100644 --- a/stdlib/3/unittest/loader.pyi +++ b/stdlib/3/unittest/loader.pyi @@ -11,21 +11,14 @@ class TestLoader: testMethodPrefix: str sortTestMethodsUsing: Callable[[str, str], bool] suiteClass: Callable[[List[unittest.case.TestCase]], unittest.suite.TestSuite] - def loadTestsFromTestCase(self, - testCaseClass: Type[unittest.case.TestCase]) -> unittest.suite.TestSuite: ... + def loadTestsFromTestCase(self, testCaseClass: Type[unittest.case.TestCase]) -> unittest.suite.TestSuite: ... if sys.version_info >= (3, 5): - def loadTestsFromModule(self, module: ModuleType, - *, pattern: Any = ...) -> unittest.suite.TestSuite: ... + def loadTestsFromModule(self, module: ModuleType, *, pattern: Any = ...) -> unittest.suite.TestSuite: ... else: - def loadTestsFromModule(self, - module: ModuleType) -> unittest.suite.TestSuite: ... - def loadTestsFromName(self, name: str, - module: Optional[ModuleType] = ...) -> unittest.suite.TestSuite: ... - def loadTestsFromNames(self, names: Sequence[str], - module: Optional[ModuleType] = ...) -> unittest.suite.TestSuite: ... - def getTestCaseNames(self, - testCaseClass: Type[unittest.case.TestCase]) -> Sequence[str]: ... - def discover(self, start_dir: str, pattern: str = ..., - top_level_dir: Optional[str] = ...) -> unittest.suite.TestSuite: ... + def loadTestsFromModule(self, module: ModuleType) -> unittest.suite.TestSuite: ... + def loadTestsFromName(self, name: str, module: Optional[ModuleType] = ...) -> unittest.suite.TestSuite: ... + def loadTestsFromNames(self, names: Sequence[str], module: Optional[ModuleType] = ...) -> unittest.suite.TestSuite: ... + def getTestCaseNames(self, testCaseClass: Type[unittest.case.TestCase]) -> Sequence[str]: ... + def discover(self, start_dir: str, pattern: str = ..., top_level_dir: Optional[str] = ...) -> unittest.suite.TestSuite: ... defaultTestLoader: TestLoader diff --git a/stdlib/3/unittest/mock.pyi b/stdlib/3/unittest/mock.pyi index cb3db6198b41..58cdf3c6dd51 100644 --- a/stdlib/3/unittest/mock.pyi +++ b/stdlib/3/unittest/mock.pyi @@ -37,7 +37,20 @@ NonCallableMock: Any class CallableMixin(Base): side_effect: Any - def __init__(self, spec: Optional[Any] = ..., side_effect: Optional[Any] = ..., return_value: Any = ..., wraps: Optional[Any] = ..., name: Optional[Any] = ..., spec_set: Optional[Any] = ..., parent: Optional[Any] = ..., _spec_state: Optional[Any] = ..., _new_name: Any = ..., _new_parent: Optional[Any] = ..., **kwargs: Any) -> None: ... + def __init__( + self, + spec: Optional[Any] = ..., + side_effect: Optional[Any] = ..., + return_value: Any = ..., + wraps: Optional[Any] = ..., + name: Optional[Any] = ..., + spec_set: Optional[Any] = ..., + parent: Optional[Any] = ..., + _spec_state: Optional[Any] = ..., + _new_name: Any = ..., + _new_parent: Optional[Any] = ..., + **kwargs: Any + ) -> None: ... def __call__(_mock_self, *args: Any, **kwargs: Any) -> Any: ... Mock: Any @@ -55,7 +68,18 @@ class _patch: autospec: Any kwargs: Any additional_patchers: Any - def __init__(self, getter: Any, attribute: Any, new: Any, spec: Any, create: Any, spec_set: Any, autospec: Any, new_callable: Any, kwargs: Any) -> None: ... + def __init__( + self, + getter: Any, + attribute: Any, + new: Any, + spec: Any, + create: Any, + spec_set: Any, + autospec: Any, + new_callable: Any, + kwargs: Any, + ) -> None: ... def copy(self) -> Any: ... def __call__(self, func: Any) -> Any: ... def decorate_class(self, klass: Any) -> Any: ... @@ -84,9 +108,39 @@ class _patch_dict: class _patcher: TEST_PREFIX: str dict: Type[_patch_dict] - def __call__(self, target: Any, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ... - def object(self, target: Any, attribute: Text, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ... - def multiple(self, target: Any, spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ... + def __call__( + self, + target: Any, + new: Optional[Any] = ..., + spec: Optional[Any] = ..., + create: bool = ..., + spec_set: Optional[Any] = ..., + autospec: Optional[Any] = ..., + new_callable: Optional[Any] = ..., + **kwargs: Any + ) -> _patch: ... + def object( + self, + target: Any, + attribute: Text, + new: Optional[Any] = ..., + spec: Optional[Any] = ..., + create: bool = ..., + spec_set: Optional[Any] = ..., + autospec: Optional[Any] = ..., + new_callable: Optional[Any] = ..., + **kwargs: Any + ) -> _patch: ... + def multiple( + self, + target: Any, + spec: Optional[Any] = ..., + create: bool = ..., + spec_set: Optional[Any] = ..., + autospec: Optional[Any] = ..., + new_callable: Optional[Any] = ..., + **kwargs: Any + ) -> _patch: ... def stopall(self) -> None: ... patch: _patcher @@ -112,11 +166,15 @@ class _ANY: ANY: Any class _Call(tuple): - def __new__(cls, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ...) -> Any: ... + def __new__( + cls, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ... + ) -> Any: ... name: Any parent: Any from_kall: Any - def __init__(self, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ...) -> None: ... + def __init__( + self, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ... + ) -> None: ... def __eq__(self, other: Any) -> bool: ... __ne__: Any def __call__(self, *args: Any, **kwargs: Any) -> Any: ... @@ -127,7 +185,9 @@ class _Call(tuple): call: Any -def create_autospec(spec: Any, spec_set: Any = ..., instance: Any = ..., _parent: Optional[Any] = ..., _name: Optional[Any] = ..., **kwargs: Any) -> Any: ... +def create_autospec( + spec: Any, spec_set: Any = ..., instance: Any = ..., _parent: Optional[Any] = ..., _name: Optional[Any] = ..., **kwargs: Any +) -> Any: ... class _SpecState: spec: Any @@ -136,7 +196,15 @@ class _SpecState: parent: Any instance: Any name: Any - def __init__(self, spec: Any, spec_set: Any = ..., parent: Optional[Any] = ..., name: Optional[Any] = ..., ids: Optional[Any] = ..., instance: Any = ...) -> None: ... + def __init__( + self, + spec: Any, + spec_set: Any = ..., + parent: Optional[Any] = ..., + name: Optional[Any] = ..., + ids: Optional[Any] = ..., + instance: Any = ..., + ) -> None: ... def mock_open(mock: Optional[Any] = ..., read_data: Any = ...) -> Any: ... diff --git a/stdlib/3/unittest/result.pyi b/stdlib/3/unittest/result.pyi index bc51158172c8..0cf90692e0e6 100644 --- a/stdlib/3/unittest/result.pyi +++ b/stdlib/3/unittest/result.pyi @@ -2,10 +2,7 @@ import unittest.case from types import TracebackType from typing import Any, List, Optional, Tuple, Type -_SysExcInfoType = Tuple[Optional[Type[BaseException]], - Optional[BaseException], - Optional[TracebackType]] - +_SysExcInfoType = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] class TestResult: errors: List[Tuple[unittest.case.TestCase, str]] @@ -28,8 +25,8 @@ class TestResult: def addFailure(self, test: unittest.case.TestCase, err: _SysExcInfoType) -> None: ... def addSuccess(self, test: unittest.case.TestCase) -> None: ... def addSkip(self, test: unittest.case.TestCase, reason: str) -> None: ... - def addExpectedFailure(self, test: unittest.case.TestCase, - err: _SysExcInfoType) -> None: ... + def addExpectedFailure(self, test: unittest.case.TestCase, err: _SysExcInfoType) -> None: ... def addUnexpectedSuccess(self, test: unittest.case.TestCase) -> None: ... - def addSubTest(self, test: unittest.case.TestCase, subtest: unittest.case.TestCase, - outcome: Optional[_SysExcInfoType]) -> None: ... + def addSubTest( + self, test: unittest.case.TestCase, subtest: unittest.case.TestCase, outcome: Optional[_SysExcInfoType] + ) -> None: ... diff --git a/stdlib/3/unittest/runner.pyi b/stdlib/3/unittest/runner.pyi index ef3693fa7943..0255051c2115 100644 --- a/stdlib/3/unittest/runner.pyi +++ b/stdlib/3/unittest/runner.pyi @@ -6,34 +6,40 @@ from typing import Callable, Optional, TextIO, Tuple, Type, Union _ResultClassType = Callable[[TextIO, bool, int], unittest.result.TestResult] - class TextTestResult(unittest.result.TestResult): separator1: str separator2: str - def __init__(self, stream: TextIO, descriptions: bool, - verbosity: int) -> None: ... + def __init__(self, stream: TextIO, descriptions: bool, verbosity: int) -> None: ... def getDescription(self, test: unittest.case.TestCase) -> str: ... def printErrors(self) -> None: ... def printErrorList(self, flavour: str, errors: Tuple[unittest.case.TestCase, str]) -> None: ... - class TestRunner: def run(self, test: Union[unittest.suite.TestSuite, unittest.case.TestCase]) -> unittest.result.TestResult: ... - class TextTestRunner(TestRunner): if sys.version_info >= (3, 5): - def __init__(self, stream: Optional[TextIO] = ..., - descriptions: bool = ..., verbosity: int = ..., - failfast: bool = ..., buffer: bool = ..., - resultclass: Optional[_ResultClassType] = ..., - warnings: Optional[Type[Warning]] = ..., - *, tb_locals: bool = ...) -> None: ... + def __init__( + self, + stream: Optional[TextIO] = ..., + descriptions: bool = ..., + verbosity: int = ..., + failfast: bool = ..., + buffer: bool = ..., + resultclass: Optional[_ResultClassType] = ..., + warnings: Optional[Type[Warning]] = ..., + *, + tb_locals: bool = ... + ) -> None: ... else: - def __init__(self, - stream: Optional[TextIO] = ..., - descriptions: bool = ..., verbosity: int = ..., - failfast: bool = ..., buffer: bool = ..., - resultclass: Optional[_ResultClassType] = ..., - warnings: Optional[Type[Warning]] = ...) -> None: ... + def __init__( + self, + stream: Optional[TextIO] = ..., + descriptions: bool = ..., + verbosity: int = ..., + failfast: bool = ..., + buffer: bool = ..., + resultclass: Optional[_ResultClassType] = ..., + warnings: Optional[Type[Warning]] = ..., + ) -> None: ... def _makeResult(self) -> unittest.result.TestResult: ... diff --git a/stdlib/3/unittest/signals.pyi b/stdlib/3/unittest/signals.pyi index c5d12b335adc..24f82edfa978 100644 --- a/stdlib/3/unittest/signals.pyi +++ b/stdlib/3/unittest/signals.pyi @@ -1,8 +1,7 @@ import unittest.result from typing import Any, Callable, TypeVar, overload -_F = TypeVar('_F', bound=Callable[..., Any]) - +_F = TypeVar("_F", bound=Callable[..., Any]) def installHandler() -> None: ... def registerResult(result: unittest.result.TestResult) -> None: ... diff --git a/stdlib/3/unittest/suite.pyi b/stdlib/3/unittest/suite.pyi index 1d2d1482f570..3c318d81d605 100644 --- a/stdlib/3/unittest/suite.pyi +++ b/stdlib/3/unittest/suite.pyi @@ -4,7 +4,6 @@ from typing import Iterable, Iterator, List, Union _TestType = Union[unittest.case.TestCase, TestSuite] - class BaseTestSuite(Iterable[_TestType]): _tests: List[unittest.case.TestCase] _removed_tests: int @@ -17,5 +16,4 @@ class BaseTestSuite(Iterable[_TestType]): def countTestCases(self) -> int: ... def __iter__(self) -> Iterator[_TestType]: ... - class TestSuite(BaseTestSuite): ... diff --git a/stdlib/3/urllib/error.pyi b/stdlib/3/urllib/error.pyi index 191c765edb88..2e5ad4e8ae6d 100644 --- a/stdlib/3/urllib/error.pyi +++ b/stdlib/3/urllib/error.pyi @@ -5,8 +5,10 @@ from urllib.response import addinfourl class URLError(IOError): reason: Union[str, BaseException] + class HTTPError(URLError, addinfourl): code: int headers: Dict[str, str] def __init__(self, url, code, msg, hdrs, fp) -> None: ... + class ContentTooShortError(URLError): ... diff --git a/stdlib/3/urllib/parse.pyi b/stdlib/3/urllib/parse.pyi index f533cfeeb823..ddd36126c32f 100644 --- a/stdlib/3/urllib/parse.pyi +++ b/stdlib/3/urllib/parse.pyi @@ -4,7 +4,6 @@ from typing import Any, AnyStr, Callable, Dict, Generic, List, Mapping, NamedTup _Str = Union[bytes, str] - uses_relative: List[str] uses_netloc: List[str] uses_params: List[str] @@ -20,11 +19,9 @@ class _ResultMixinBase(Generic[AnyStr]): class _ResultMixinStr(_ResultMixinBase[str]): def encode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinBytes: ... - class _ResultMixinBytes(_ResultMixinBase[str]): def decode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinStr: ... - class _NetlocResultMixinBase(Generic[AnyStr]): username: AnyStr password: AnyStr @@ -32,114 +29,96 @@ class _NetlocResultMixinBase(Generic[AnyStr]): port: int class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ... - class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ... class _DefragResultBase(tuple, Generic[AnyStr]): url: AnyStr fragment: AnyStr - _SplitResultBase = NamedTuple( - '_SplitResultBase', - [ - ('scheme', str), ('netloc', str), ('path', str), ('query', str), ('fragment', str) - ] + "_SplitResultBase", [("scheme", str), ("netloc", str), ("path", str), ("query", str), ("fragment", str)] ) _SplitResultBytesBase = NamedTuple( - '_SplitResultBytesBase', - [ - ('scheme', bytes), ('netloc', bytes), ('path', bytes), ('query', bytes), ('fragment', bytes) - ] + "_SplitResultBytesBase", [("scheme", bytes), ("netloc", bytes), ("path", bytes), ("query", bytes), ("fragment", bytes)] ) _ParseResultBase = NamedTuple( - '_ParseResultBase', - [ - ('scheme', str), ('netloc', str), ('path', str), ('params', str), ('query', str), ('fragment', str) - ] + "_ParseResultBase", [("scheme", str), ("netloc", str), ("path", str), ("params", str), ("query", str), ("fragment", str)] ) _ParseResultBytesBase = NamedTuple( - '_ParseResultBytesBase', - [ - ('scheme', bytes), ('netloc', bytes), ('path', bytes), ('params', bytes), ('query', bytes), ('fragment', bytes) - ] + "_ParseResultBytesBase", + [("scheme", bytes), ("netloc", bytes), ("path", bytes), ("params", bytes), ("query", bytes), ("fragment", bytes)], ) # Structured result objects for string data class DefragResult(_DefragResultBase[str], _ResultMixinStr): ... - class SplitResult(_SplitResultBase, _NetlocResultMixinStr): ... - class ParseResult(_ParseResultBase, _NetlocResultMixinStr): ... # Structured result objects for bytes data class DefragResultBytes(_DefragResultBase[bytes], _ResultMixinBytes): ... - class SplitResultBytes(_SplitResultBytesBase, _NetlocResultMixinBytes): ... - class ParseResultBytes(_ParseResultBytesBase, _NetlocResultMixinBytes): ... - -def parse_qs(qs: AnyStr, keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ...) -> Dict[AnyStr, List[AnyStr]]: ... - -def parse_qsl(qs: AnyStr, keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ...) -> List[Tuple[AnyStr, AnyStr]]: ... - - +def parse_qs( + qs: AnyStr, keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ... +) -> Dict[AnyStr, List[AnyStr]]: ... +def parse_qsl( + qs: AnyStr, keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ... +) -> List[Tuple[AnyStr, AnyStr]]: ... @overload def quote(string: str, safe: _Str = ..., encoding: str = ..., errors: str = ...) -> str: ... @overload def quote(string: bytes, safe: _Str = ...) -> str: ... - def quote_from_bytes(bs: bytes, safe: _Str = ...) -> str: ... - @overload def quote_plus(string: str, safe: _Str = ..., encoding: str = ..., errors: str = ...) -> str: ... @overload def quote_plus(string: bytes, safe: _Str = ...) -> str: ... - def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ... - def unquote_to_bytes(string: _Str) -> bytes: ... - def unquote_plus(string: str, encoding: str = ..., errors: str = ...) -> str: ... - @overload def urldefrag(url: str) -> DefragResult: ... @overload def urldefrag(url: bytes) -> DefragResultBytes: ... if sys.version_info >= (3, 5): - def urlencode(query: Union[Mapping[Any, Any], - Mapping[Any, Sequence[Any]], - Sequence[Tuple[Any, Any]], - Sequence[Tuple[Any, Sequence[Any]]]], - doseq: bool = ..., safe: AnyStr = ..., encoding: str = ..., errors: str = ..., - quote_via: Callable[[str, AnyStr, str, str], str] = ...) -> str: ... + def urlencode( + query: Union[ + Mapping[Any, Any], Mapping[Any, Sequence[Any]], Sequence[Tuple[Any, Any]], Sequence[Tuple[Any, Sequence[Any]]] + ], + doseq: bool = ..., + safe: AnyStr = ..., + encoding: str = ..., + errors: str = ..., + quote_via: Callable[[str, AnyStr, str, str], str] = ..., + ) -> str: ... + else: - def urlencode(query: Union[Mapping[Any, Any], - Mapping[Any, Sequence[Any]], - Sequence[Tuple[Any, Any]], - Sequence[Tuple[Any, Sequence[Any]]]], - doseq: bool = ..., safe: AnyStr = ..., encoding: str = ..., errors: str = ...) -> str: ... + def urlencode( + query: Union[ + Mapping[Any, Any], Mapping[Any, Sequence[Any]], Sequence[Tuple[Any, Any]], Sequence[Tuple[Any, Sequence[Any]]] + ], + doseq: bool = ..., + safe: AnyStr = ..., + encoding: str = ..., + errors: str = ..., + ) -> str: ... def urljoin(base: AnyStr, url: Optional[AnyStr], allow_fragments: bool = ...) -> AnyStr: ... - @overload def urlparse(url: str, scheme: str = ..., allow_fragments: bool = ...) -> ParseResult: ... @overload def urlparse(url: bytes, scheme: bytes = ..., allow_fragments: bool = ...) -> ParseResultBytes: ... - @overload def urlsplit(url: str, scheme: str = ..., allow_fragments: bool = ...) -> SplitResult: ... @overload def urlsplit(url: bytes, scheme: bytes = ..., allow_fragments: bool = ...) -> SplitResultBytes: ... - @overload def urlunparse(components: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... @overload def urlunparse(components: Sequence[AnyStr]) -> AnyStr: ... - @overload def urlunsplit(components: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... @overload diff --git a/stdlib/3/urllib/request.pyi b/stdlib/3/urllib/request.pyi index 6d2d48e29fd7..230bdfc091d7 100644 --- a/stdlib/3/urllib/request.pyi +++ b/stdlib/3/urllib/request.pyi @@ -9,7 +9,7 @@ from http.cookiejar import CookieJar from typing import IO, Any, Callable, ClassVar, Dict, List, Mapping, NoReturn, Optional, Sequence, Tuple, TypeVar, Union, overload from urllib.response import addinfourl -_T = TypeVar('_T') +_T = TypeVar("_T") _UrlopenRet = Any class _HTTPResponse(HTTPResponse): @@ -17,15 +17,17 @@ class _HTTPResponse(HTTPResponse): msg: str # type: ignore def urlopen( - url: Union[str, Request], data: Optional[bytes] = ..., - timeout: float = ..., *, cafile: Optional[str] = ..., - capath: Optional[str] = ..., cadefault: bool = ..., + url: Union[str, Request], + data: Optional[bytes] = ..., + timeout: float = ..., + *, + cafile: Optional[str] = ..., + capath: Optional[str] = ..., + cadefault: bool = ..., context: Optional[ssl.SSLContext] = ... ) -> _UrlopenRet: ... def install_opener(opener: OpenerDirector) -> None: ... -def build_opener( - *handlers: Union[BaseHandler, Callable[[], BaseHandler]] -) -> OpenerDirector: ... +def build_opener(*handlers: Union[BaseHandler, Callable[[], BaseHandler]]) -> OpenerDirector: ... def url2pathname(path: str) -> str: ... def pathname2url(path: str) -> str: ... def getproxies() -> Dict[str, str]: ... @@ -47,9 +49,15 @@ class Request: headers: Dict[str, str] unverifiable: bool method: Optional[str] - def __init__(self, url: str, data: Optional[bytes] = ..., - headers: Dict[str, str] = ..., origin_req_host: Optional[str] = ..., - unverifiable: bool = ..., method: Optional[str] = ...) -> None: ... + def __init__( + self, + url: str, + data: Optional[bytes] = ..., + headers: Dict[str, str] = ..., + origin_req_host: Optional[str] = ..., + unverifiable: bool = ..., + method: Optional[str] = ..., + ) -> None: ... def get_method(self) -> str: ... def add_header(self, key: str, val: str) -> None: ... def add_unredirected_header(self, key: str, val: str) -> None: ... @@ -66,33 +74,34 @@ class Request: class OpenerDirector: addheaders: List[Tuple[str, str]] def add_handler(self, handler: BaseHandler) -> None: ... - def open(self, url: Union[str, Request], data: Optional[bytes] = ..., - timeout: float = ...) -> _UrlopenRet: ... + def open(self, url: Union[str, Request], data: Optional[bytes] = ..., timeout: float = ...) -> _UrlopenRet: ... def error(self, proto: str, *args: Any) -> _UrlopenRet: ... - class BaseHandler: handler_order: ClassVar[int] parent: OpenerDirector def add_parent(self, parent: OpenerDirector) -> None: ... def close(self) -> None: ... - def http_error_nnn(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> _UrlopenRet: ... + def http_error_nnn(self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str]) -> _UrlopenRet: ... class HTTPDefaultErrorHandler(BaseHandler): ... class HTTPRedirectHandler(BaseHandler): - def redirect_request(self, req: Request, fp: IO[str], code: int, msg: str, - hdrs: Mapping[str, str], - newurl: str) -> Optional[Request]: ... - def http_error_301(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ... - def http_error_302(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ... - def http_error_303(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ... - def http_error_307(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ... + def redirect_request( + self, req: Request, fp: IO[str], code: int, msg: str, hdrs: Mapping[str, str], newurl: str + ) -> Optional[Request]: ... + def http_error_301( + self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str] + ) -> Optional[_UrlopenRet]: ... + def http_error_302( + self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str] + ) -> Optional[_UrlopenRet]: ... + def http_error_303( + self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str] + ) -> Optional[_UrlopenRet]: ... + def http_error_307( + self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str] + ) -> Optional[_UrlopenRet]: ... class HTTPCookieProcessor(BaseHandler): cookiejar: CookieJar @@ -103,43 +112,39 @@ class ProxyHandler(BaseHandler): # TODO add a method for every (common) proxy protocol class HTTPPasswordMgr: - def add_password(self, realm: str, uri: Union[str, Sequence[str]], - user: str, passwd: str) -> None: ... + def add_password(self, realm: str, uri: Union[str, Sequence[str]], user: str, passwd: str) -> None: ... def find_user_password(self, realm: str, authuri: str) -> Tuple[Optional[str], Optional[str]]: ... class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): - def add_password(self, realm: str, uri: Union[str, Sequence[str]], - user: str, passwd: str) -> None: ... + def add_password(self, realm: str, uri: Union[str, Sequence[str]], user: str, passwd: str) -> None: ... def find_user_password(self, realm: str, authuri: str) -> Tuple[Optional[str], Optional[str]]: ... if sys.version_info >= (3, 5): class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm): - def add_password(self, realm: str, uri: Union[str, Sequence[str]], - user: str, passwd: str, - is_authenticated: bool = ...) -> None: ... - def update_authenticated(self, uri: Union[str, Sequence[str]], - is_authenticated: bool = ...) -> None: ... + def add_password( + self, realm: str, uri: Union[str, Sequence[str]], user: str, passwd: str, is_authenticated: bool = ... + ) -> None: ... + def update_authenticated(self, uri: Union[str, Sequence[str]], is_authenticated: bool = ...) -> None: ... def is_authenticated(self, authuri: str) -> bool: ... class AbstractBasicAuthHandler: - def __init__(self, - password_mgr: Optional[HTTPPasswordMgr] = ...) -> None: ... - def http_error_auth_reqed(self, authreq: str, host: str, req: Request, - headers: Mapping[str, str]) -> None: ... + def __init__(self, password_mgr: Optional[HTTPPasswordMgr] = ...) -> None: ... + def http_error_auth_reqed(self, authreq: str, host: str, req: Request, headers: Mapping[str, str]) -> None: ... class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): - def http_error_401(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ... + def http_error_401( + self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str] + ) -> Optional[_UrlopenRet]: ... class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): - def http_error_407(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ... + def http_error_407( + self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str] + ) -> Optional[_UrlopenRet]: ... class AbstractDigestAuthHandler: def __init__(self, passwd: Optional[HTTPPasswordMgr] = ...) -> None: ... def reset_retry_count(self) -> None: ... - def http_error_auth_reqed(self, auth_header: str, host: str, req: Request, - headers: Mapping[str, str]) -> None: ... + def http_error_auth_reqed(self, auth_header: str, host: str, req: Request, headers: Mapping[str, str]) -> None: ... def retry_http_digest_auth(self, req: Request, auth: str) -> Optional[_UrlopenRet]: ... def get_cnonce(self, nonce: str) -> str: ... def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ... @@ -147,30 +152,29 @@ class AbstractDigestAuthHandler: def get_entity_digest(self, data: Optional[bytes], chal: Mapping[str, str]) -> Optional[str]: ... class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): - def http_error_401(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ... + def http_error_401( + self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str] + ) -> Optional[_UrlopenRet]: ... class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): - def http_error_407(self, req: Request, fp: IO[str], code: int, msg: int, - hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ... + def http_error_407( + self, req: Request, fp: IO[str], code: int, msg: int, hdrs: Mapping[str, str] + ) -> Optional[_UrlopenRet]: ... class AbstractHTTPHandler(BaseHandler): # undocumented def __init__(self, debuglevel: int = ...) -> None: ... def set_http_debuglevel(self, level: int) -> None: ... def do_request_(self, request: Request) -> Request: ... - def do_open(self, - http_class: HTTPConnectionProtocol, - req: Request, - **http_conn_args: Any) -> HTTPResponse: ... + def do_open(self, http_class: HTTPConnectionProtocol, req: Request, **http_conn_args: Any) -> HTTPResponse: ... class HTTPHandler(AbstractHTTPHandler): def http_open(self, req: Request) -> HTTPResponse: ... def http_request(self, request: Request) -> Request: ... # undocumented class HTTPSHandler(AbstractHTTPHandler): - def __init__(self, debuglevel: int = ..., - context: Optional[ssl.SSLContext] = ..., - check_hostname: Optional[bool] = ...) -> None: ... + def __init__( + self, debuglevel: int = ..., context: Optional[ssl.SSLContext] = ..., check_hostname: Optional[bool] = ... + ) -> None: ... def https_open(self, req: Request) -> HTTPResponse: ... def https_request(self, request: Request) -> Request: ... # undocumented @@ -195,25 +199,35 @@ class HTTPErrorProcessor(BaseHandler): def https_response(self, request, response) -> _UrlopenRet: ... if sys.version_info >= (3, 6): - def urlretrieve(url: str, filename: Optional[Union[str, os.PathLike]] = ..., - reporthook: Optional[Callable[[int, int, int], None]] = ..., - data: Optional[bytes] = ...) -> Tuple[str, HTTPMessage]: ... + def urlretrieve( + url: str, + filename: Optional[Union[str, os.PathLike]] = ..., + reporthook: Optional[Callable[[int, int, int], None]] = ..., + data: Optional[bytes] = ..., + ) -> Tuple[str, HTTPMessage]: ... + else: - def urlretrieve(url: str, filename: Optional[str] = ..., - reporthook: Optional[Callable[[int, int, int], None]] = ..., - data: Optional[bytes] = ...) -> Tuple[str, HTTPMessage]: ... + def urlretrieve( + url: str, + filename: Optional[str] = ..., + reporthook: Optional[Callable[[int, int, int], None]] = ..., + data: Optional[bytes] = ..., + ) -> Tuple[str, HTTPMessage]: ... + def urlcleanup() -> None: ... class URLopener: version: ClassVar[str] - def __init__(self, proxies: Optional[Dict[str, str]] = ..., - **x509: str) -> None: ... + def __init__(self, proxies: Optional[Dict[str, str]] = ..., **x509: str) -> None: ... def open(self, fullurl: str, data: Optional[bytes] = ...) -> _UrlopenRet: ... - def open_unknown(self, fullurl: str, - data: Optional[bytes] = ...) -> _UrlopenRet: ... - def retrieve(self, url: str, filename: Optional[str] = ..., - reporthook: Optional[Callable[[int, int, int], None]] = ..., - data: Optional[bytes] = ...) -> Tuple[str, Optional[Message]]: ... + def open_unknown(self, fullurl: str, data: Optional[bytes] = ...) -> _UrlopenRet: ... + def retrieve( + self, + url: str, + filename: Optional[str] = ..., + reporthook: Optional[Callable[[int, int, int], None]] = ..., + data: Optional[bytes] = ..., + ) -> Tuple[str, Optional[Message]]: ... class FancyURLopener(URLopener): def prompt_user_passwd(self, host: str, realm: str) -> Tuple[str, str]: ... diff --git a/stdlib/3/urllib/response.pyi b/stdlib/3/urllib/response.pyi index c48d0b71fce2..5b0752009224 100644 --- a/stdlib/3/urllib/response.pyi +++ b/stdlib/3/urllib/response.pyi @@ -7,7 +7,9 @@ _AIUT = TypeVar("_AIUT", bound=addbase) class addbase(BinaryIO): def __enter__(self: _AIUT) -> _AIUT: ... - def __exit__(self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]) -> bool: ... + def __exit__( + self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType] + ) -> bool: ... def __iter__(self: _AIUT) -> _AIUT: ... def __next__(self) -> bytes: ... def close(self) -> None: ... diff --git a/stdlib/3/urllib/robotparser.pyi b/stdlib/3/urllib/robotparser.pyi index 34fc44b59d7e..765605a44eb3 100644 --- a/stdlib/3/urllib/robotparser.pyi +++ b/stdlib/3/urllib/robotparser.pyi @@ -3,7 +3,7 @@ import sys from typing import Iterable, NamedTuple, Optional -_RequestRate = NamedTuple('_RequestRate', [('requests', int), ('seconds', int)]) +_RequestRate = NamedTuple("_RequestRate", [("requests", int), ("seconds", int)]) class RobotFileParser: def __init__(self, url: str = ...) -> None: ... diff --git a/tests/check_consistent.py b/tests/check_consistent.py index bccdf2b994cb..21a93df4ab8f 100755 --- a/tests/check_consistent.py +++ b/tests/check_consistent.py @@ -7,37 +7,44 @@ import os consistent_files = [ - {'stdlib/2and3/builtins.pyi', 'stdlib/2/__builtin__.pyi'}, - {'stdlib/2/SocketServer.pyi', 'stdlib/3/socketserver.pyi'}, - {'stdlib/2/os2emxpath.pyi', 'stdlib/2and3/posixpath.pyi', - 'stdlib/2and3/ntpath.pyi', 'stdlib/2and3/macpath.pyi', - 'stdlib/2/os/path.pyi', 'stdlib/3/os/path.pyi'}, - {'stdlib/3/enum.pyi', 'third_party/2/enum.pyi'}, - {'stdlib/2/os/path.pyi', 'stdlib/3/os/path.pyi'}, - {'stdlib/3/unittest/mock.pyi', 'third_party/2and3/mock.pyi'}, - {'stdlib/3/concurrent/__init__.pyi', 'third_party/2/concurrent/__init__.pyi'}, - {'stdlib/3/concurrent/futures/__init__.pyi', 'third_party/2/concurrent/futures/__init__.pyi'}, - {'stdlib/3/concurrent/futures/_base.pyi', 'third_party/2/concurrent/futures/_base.pyi'}, - {'stdlib/3/concurrent/futures/thread.pyi', 'third_party/2/concurrent/futures/thread.pyi'}, - {'stdlib/3/concurrent/futures/process.pyi', 'third_party/2/concurrent/futures/process.pyi'}, - {'stdlib/3.7/dataclasses.pyi', 'third_party/3/dataclasses.pyi'}, - {'stdlib/3/pathlib.pyi', 'third_party/2/pathlib2.pyi'}, - {'stdlib/3.7/contextvars.pyi', 'third_party/3.5/contextvars.pyi'}, + {"stdlib/2and3/builtins.pyi", "stdlib/2/__builtin__.pyi"}, + {"stdlib/2/SocketServer.pyi", "stdlib/3/socketserver.pyi"}, + { + "stdlib/2/os2emxpath.pyi", + "stdlib/2and3/posixpath.pyi", + "stdlib/2and3/ntpath.pyi", + "stdlib/2and3/macpath.pyi", + "stdlib/2/os/path.pyi", + "stdlib/3/os/path.pyi", + }, + {"stdlib/3/enum.pyi", "third_party/2/enum.pyi"}, + {"stdlib/2/os/path.pyi", "stdlib/3/os/path.pyi"}, + {"stdlib/3/unittest/mock.pyi", "third_party/2and3/mock.pyi"}, + {"stdlib/3/concurrent/__init__.pyi", "third_party/2/concurrent/__init__.pyi"}, + {"stdlib/3/concurrent/futures/__init__.pyi", "third_party/2/concurrent/futures/__init__.pyi"}, + {"stdlib/3/concurrent/futures/_base.pyi", "third_party/2/concurrent/futures/_base.pyi"}, + {"stdlib/3/concurrent/futures/thread.pyi", "third_party/2/concurrent/futures/thread.pyi"}, + {"stdlib/3/concurrent/futures/process.pyi", "third_party/2/concurrent/futures/process.pyi"}, + {"stdlib/3.7/dataclasses.pyi", "third_party/3/dataclasses.pyi"}, + {"stdlib/3/pathlib.pyi", "third_party/2/pathlib2.pyi"}, + {"stdlib/3.7/contextvars.pyi", "third_party/3.5/contextvars.pyi"}, ] + def main(): - files = [os.path.join(root, file) for root, dir, files in os.walk('.') for file in files] - no_symlink = 'You cannot use symlinks in typeshed, please copy {} to its link.' + files = [os.path.join(root, file) for root, dir, files in os.walk(".") for file in files] + no_symlink = "You cannot use symlinks in typeshed, please copy {} to its link." for file in files: _, ext = os.path.splitext(file) - if ext == '.pyi' and os.path.islink(file): + if ext == ".pyi" and os.path.islink(file): raise ValueError(no_symlink.format(file)) for file1, *others in consistent_files: f1 = os.path.join(os.getcwd(), file1) for file2 in others: f2 = os.path.join(os.getcwd(), file2) if not filecmp.cmp(f1, f2): - raise ValueError('File {f1} does not match file {f2}. Please copy it to {f2}'.format(f1=file1, f2=file2)) + raise ValueError("File {f1} does not match file {f2}. Please copy it to {f2}".format(f1=file1, f2=file2)) + -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/tests/mypy_selftest.py b/tests/mypy_selftest.py index c2d879ca4b76..f69ebdbf827d 100755 --- a/tests/mypy_selftest.py +++ b/tests/mypy_selftest.py @@ -7,21 +7,21 @@ import tempfile from pathlib import Path -if __name__ == '__main__': +if __name__ == "__main__": with tempfile.TemporaryDirectory() as tempdir: dirpath = Path(tempdir) - subprocess.run(['python2.7', '-m', 'pip', 'install', '--user', 'typing'], check=True) - subprocess.run(['git', 'clone', '--depth', '1', 'git://github.com/python/mypy', - str(dirpath / 'mypy')], check=True) - subprocess.run([sys.executable, '-m', 'pip', 'install', '-U', '-r', - str(dirpath / 'mypy/test-requirements.txt')], check=True) - shutil.copytree('stdlib', str(dirpath / 'mypy/mypy/typeshed/stdlib')) - shutil.copytree('third_party', str(dirpath / 'mypy/mypy/typeshed/third_party')) + subprocess.run(["python2.7", "-m", "pip", "install", "--user", "typing"], check=True) + subprocess.run(["git", "clone", "--depth", "1", "git://github.com/python/mypy", str(dirpath / "mypy")], check=True) + subprocess.run( + [sys.executable, "-m", "pip", "install", "-U", "-r", str(dirpath / "mypy/test-requirements.txt")], check=True + ) + shutil.copytree("stdlib", str(dirpath / "mypy/mypy/typeshed/stdlib")) + shutil.copytree("third_party", str(dirpath / "mypy/mypy/typeshed/third_party")) try: - subprocess.run(['pytest', '-n12'], cwd=str(dirpath / 'mypy'), check=True) + subprocess.run(["pytest", "-n12"], cwd=str(dirpath / "mypy"), check=True) except subprocess.CalledProcessError as e: - print('mypy tests failed', file=sys.stderr) + print("mypy tests failed", file=sys.stderr) sys.exit(e.returncode) else: - print('mypy tests succeeded', file=sys.stderr) + print("mypy tests succeeded", file=sys.stderr) sys.exit(0) diff --git a/tests/mypy_test.py b/tests/mypy_test.py index a800a91d620a..2e66dee5a269 100755 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -17,20 +17,21 @@ import re import sys -parser = argparse.ArgumentParser(description="Test runner for typeshed. " - "Patterns are unanchored regexps on the full path.") -parser.add_argument('-v', '--verbose', action='count', default=0, help="More output") -parser.add_argument('-n', '--dry-run', action='store_true', help="Don't actually run mypy") -parser.add_argument('-a', '--new-analyzer', action='store_true', help="Use new mypy semantic analyzer") -parser.add_argument('-x', '--exclude', type=str, nargs='*', help="Exclude pattern") -parser.add_argument('-p', '--python-version', type=str, nargs='*', - help="These versions only (major[.minor])") -parser.add_argument('--warn-unused-ignores', action='store_true', - help="Run mypy with --warn-unused-ignores " - "(hint: only get rid of warnings that are " - "unused for all platforms and Python versions)") - -parser.add_argument('filter', type=str, nargs='*', help="Include pattern (default all)") +parser = argparse.ArgumentParser(description="Test runner for typeshed. " "Patterns are unanchored regexps on the full path.") +parser.add_argument("-v", "--verbose", action="count", default=0, help="More output") +parser.add_argument("-n", "--dry-run", action="store_true", help="Don't actually run mypy") +parser.add_argument("-a", "--new-analyzer", action="store_true", help="Use new mypy semantic analyzer") +parser.add_argument("-x", "--exclude", type=str, nargs="*", help="Exclude pattern") +parser.add_argument("-p", "--python-version", type=str, nargs="*", help="These versions only (major[.minor])") +parser.add_argument( + "--warn-unused-ignores", + action="store_true", + help="Run mypy with --warn-unused-ignores " + "(hint: only get rid of warnings that are " + "unused for all platforms and Python versions)", +) + +parser.add_argument("filter", type=str, nargs="*", help="Include pattern (default all)") def log(args, *varargs): @@ -40,36 +41,35 @@ def log(args, *varargs): def match(fn, args, blacklist): if blacklist.match(fn): - log(args, fn, 'exluded by blacklist') + log(args, fn, "exluded by blacklist") return False if not args.filter and not args.exclude: - log(args, fn, 'accept by default') + log(args, fn, "accept by default") return True if args.exclude: for f in args.exclude: if re.search(f, fn): - log(args, fn, 'excluded by pattern', f) + log(args, fn, "excluded by pattern", f) return False if args.filter: for f in args.filter: if re.search(f, fn): - log(args, fn, 'accepted by pattern', f) + log(args, fn, "accepted by pattern", f) return True if args.filter: - log(args, fn, 'rejected (no pattern matches)') + log(args, fn, "rejected (no pattern matches)") return False - log(args, fn, 'accepted (no exclude pattern matches)') + log(args, fn, "accepted (no exclude pattern matches)") return True def libpath(major, minor): - versions = ['%d.%d' % (major, minor) - for minor in reversed(range(minor + 1))] + versions = ["%d.%d" % (major, minor) for minor in reversed(range(minor + 1))] versions.append(str(major)) - versions.append('2and3') + versions.append("2and3") paths = [] for v in versions: - for top in ['stdlib', 'third_party']: + for top in ["stdlib", "third_party"]: p = os.path.join(top, v) if os.path.isdir(p): paths.append(p) @@ -80,8 +80,7 @@ def main(): args = parser.parse_args() with open(os.path.join(os.path.dirname(__file__), "mypy_blacklist.txt")) as f: - blacklist = re.compile("(%s)$" % "|".join( - re.findall(r"^\s*([^\s#]+)\s*(?:#.*)?$", f.read(), flags=re.M))) + blacklist = re.compile("(%s)$" % "|".join(re.findall(r"^\s*([^\s#]+)\s*(?:#.*)?$", f.read(), flags=re.M))) try: from mypy.main import main as mypy_main @@ -91,8 +90,7 @@ def main(): versions = [(3, 7), (3, 6), (3, 5), (3, 4), (2, 7)] if args.python_version: - versions = [v for v in versions - if any(('%d.%d' % v).startswith(av) for av in args.python_version)] + versions = [v for v in versions if any(("%d.%d" % v).startswith(av) for av in args.python_version)] if not versions: print("--- no versions selected ---") sys.exit(1) @@ -102,49 +100,48 @@ def main(): for major, minor in versions: roots = libpath(major, minor) files = [] - seen = {'__builtin__', 'builtins', 'typing'} # Always ignore these. + seen = {"__builtin__", "builtins", "typing"} # Always ignore these. for root in roots: names = os.listdir(root) for name in names: full = os.path.join(root, name) mod, ext = os.path.splitext(name) - if mod in seen or mod.startswith('.'): + if mod in seen or mod.startswith("."): continue - if ext in ['.pyi', '.py']: + if ext in [".pyi", ".py"]: if match(full, args, blacklist): seen.add(mod) files.append(full) - elif (os.path.isfile(os.path.join(full, '__init__.pyi')) or - os.path.isfile(os.path.join(full, '__init__.py'))): + elif os.path.isfile(os.path.join(full, "__init__.pyi")) or os.path.isfile(os.path.join(full, "__init__.py")): for r, ds, fs in os.walk(full): ds.sort() fs.sort() for f in fs: m, x = os.path.splitext(f) - if x in ['.pyi', '.py']: + if x in [".pyi", ".py"]: fn = os.path.join(r, f) if match(fn, args, blacklist): seen.add(mod) files.append(fn) if files: runs += 1 - flags = ['--python-version', '%d.%d' % (major, minor)] - flags.append('--strict-optional') - flags.append('--no-site-packages') - flags.append('--show-traceback') - flags.append('--no-implicit-optional') + flags = ["--python-version", "%d.%d" % (major, minor)] + flags.append("--strict-optional") + flags.append("--no-site-packages") + flags.append("--show-traceback") + flags.append("--no-implicit-optional") if args.new_analyzer: - flags.append('--new-semantic-analyzer') + flags.append("--new-semantic-analyzer") if args.warn_unused_ignores: - flags.append('--warn-unused-ignores') - sys.argv = ['mypy'] + flags + files + flags.append("--warn-unused-ignores") + sys.argv = ["mypy"] + flags + files if args.verbose: - print("running", ' '.join(sys.argv)) + print("running", " ".join(sys.argv)) else: - print("running mypy", ' '.join(flags), "# with", len(files), "files") + print("running mypy", " ".join(flags), "# with", len(files), "files") try: if not args.dry_run: - mypy_main('', sys.stdout, sys.stderr) + mypy_main("", sys.stdout, sys.stderr) except SystemExit as err: code = max(code, err.code) if code: @@ -155,5 +152,5 @@ def main(): sys.exit(1) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/tests/pytype_test.py b/tests/pytype_test.py index 1b7a8c7b2194..3922eaa9128d 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -21,26 +21,21 @@ from pytype import config, io -parser = argparse.ArgumentParser(description='Pytype/typeshed tests.') -parser.add_argument('-n', '--dry-run', action='store_true', default=False, - help='Don\'t actually run tests') +parser = argparse.ArgumentParser(description="Pytype/typeshed tests.") +parser.add_argument("-n", "--dry-run", action="store_true", default=False, help="Don't actually run tests") # Default to '' so that symlinking typeshed subdirs in cwd will work. -parser.add_argument('--typeshed-location', type=str, default='', - help='Path to typeshed installation.') +parser.add_argument("--typeshed-location", type=str, default="", help="Path to typeshed installation.") # Set to true to print a stack trace every time an exception is thrown. -parser.add_argument('--print-stderr', action='store_true', default=False, - help='Print stderr every time an error is encountered.') +parser.add_argument("--print-stderr", action="store_true", default=False, help="Print stderr every time an error is encountered.") # We need to invoke python2.7 and 3.6. -parser.add_argument('--python27-exe', type=str, default='python2.7', - help='Path to a python 2.7 interpreter.') -parser.add_argument('--python36-exe', type=str, default='python3.6', - help='Path to a python 3.6 interpreter.') +parser.add_argument("--python27-exe", type=str, default="python2.7", help="Path to a python 2.7 interpreter.") +parser.add_argument("--python36-exe", type=str, default="python3.6", help="Path to a python 3.6 interpreter.") -TYPESHED_SUBDIRS = ['stdlib', 'third_party'] +TYPESHED_SUBDIRS = ["stdlib", "third_party"] -TYPESHED_HOME = 'TYPESHED_HOME' +TYPESHED_HOME = "TYPESHED_HOME" UNSET = object() # marker for tracking the TYPESHED_HOME environment variable @@ -53,7 +48,7 @@ def main(): class PathMatcher(object): def __init__(self, patterns): if patterns: - self.matcher = re.compile('(%s)$' % '|'.join(patterns)) + self.matcher = re.compile("(%s)$" % "|".join(patterns)) else: self.matcher = None @@ -64,8 +59,8 @@ def search(self, path): def load_blacklist(typeshed_location): - filename = os.path.join(typeshed_location, 'tests', 'pytype_blacklist.txt') - skip_re = re.compile(r'^\s*([^\s#]+)\s*(?:#.*)?$') + filename = os.path.join(typeshed_location, "tests", "pytype_blacklist.txt") + skip_re = re.compile(r"^\s*([^\s#]+)\s*(?:#.*)?$") skip = [] with open(filename) as f: @@ -110,23 +105,20 @@ def _get_relative(filename): def _get_module_name(filename): """Converts a filename {subdir}/m.n/module/foo to module.foo.""" - return '.'.join(_get_relative(filename).split(os.path.sep)[2:]).replace( - '.pyi', '').replace('.__init__', '') + return ".".join(_get_relative(filename).split(os.path.sep)[2:]).replace(".pyi", "").replace(".__init__", "") def can_run(path, exe, *args): exe = os.path.join(path, exe) try: - subprocess.Popen( - [exe] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE - ).communicate() + subprocess.Popen([exe] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() return True except OSError: return False def _is_version(path, version): - return any('%s/%s' % (d, version) in path for d in TYPESHED_SUBDIRS) + return any("%s/%s" % (d, version) in path for d in TYPESHED_SUBDIRS) def pytype_test(args): @@ -136,17 +128,15 @@ def pytype_test(args): for p in paths: if not os.path.isdir(p): - print('Cannot find typeshed subdir at %s ' - '(specify parent dir via --typeshed-location)' % p) + print("Cannot find typeshed subdir at %s " "(specify parent dir via --typeshed-location)" % p) return 1 - for python_version_str in ('27', '36'): - dest = 'python%s_exe' % python_version_str - version = '.'.join(list(python_version_str)) - arg = '--python%s-exe' % python_version_str - if not can_run('', getattr(args, dest), '--version'): - print('Cannot run Python {version}. (point to a valid executable ' - 'via {arg})'.format(version=version, arg=arg)) + for python_version_str in ("27", "36"): + dest = "python%s_exe" % python_version_str + version = ".".join(list(python_version_str)) + arg = "--python%s-exe" % python_version_str + if not can_run("", getattr(args, dest), "--version"): + print("Cannot run Python {version}. (point to a valid executable " "via {arg})".format(version=version, arg=arg)) return 1 skipped = PathMatcher(load_blacklist(typeshed_location)) @@ -155,40 +145,32 @@ def pytype_test(args): def _parse(filename, major_version): if major_version == 3: - version = '3.6' + version = "3.6" exe = args.python36_exe else: - version = '2.7' + version = "2.7" exe = args.python27_exe - options = [ - '--module-name=%s' % _get_module_name(filename), - '--parse-pyi', - '-V %s' % version, - '--python_exe=%s' % exe, - ] - return run_pytype(options + [filename], - dry_run=args.dry_run, - typeshed_location=typeshed_location) - - for root, _, filenames in itertools.chain.from_iterable( - os.walk(p) for p in paths): - for f in sorted(f for f in filenames if f.endswith('.pyi')): + options = ["--module-name=%s" % _get_module_name(filename), "--parse-pyi", "-V %s" % version, "--python_exe=%s" % exe] + return run_pytype(options + [filename], dry_run=args.dry_run, typeshed_location=typeshed_location) + + for root, _, filenames in itertools.chain.from_iterable(os.walk(p) for p in paths): + for f in sorted(f for f in filenames if f.endswith(".pyi")): f = os.path.join(root, f) rel = _get_relative(f) if not skipped.search(rel): - if _is_version(f, '2and3'): + if _is_version(f, "2and3"): files.append((f, 2)) files.append((f, 3)) - elif _is_version(f, '2'): + elif _is_version(f, "2"): files.append((f, 2)) - elif _is_version(f, '3'): + elif _is_version(f, "3"): files.append((f, 3)) else: - print('Unrecognized path: %s' % f) + print("Unrecognized path: %s" % f) errors = 0 total_tests = len(files) - print('Testing files with pytype...') + print("Testing files with pytype...") for i, (f, version) in enumerate(files): stderr = _parse(f, version) if stderr: @@ -197,17 +179,17 @@ def _parse(filename, major_version): errors += 1 # We strip off the stack trace and just leave the last line with the # actual error; to see the stack traces use --print_stderr. - bad.append((_get_relative(f), stderr.rstrip().rsplit('\n', 1)[-1])) + bad.append((_get_relative(f), stderr.rstrip().rsplit("\n", 1)[-1])) runs = i + 1 if runs % 25 == 0: - print(' %3d/%d with %3d errors' % (runs, total_tests, errors)) + print(" %3d/%d with %3d errors" % (runs, total_tests, errors)) - print('Ran pytype with %d pyis, got %d errors.' % (total_tests, errors)) + print("Ran pytype with %d pyis, got %d errors." % (total_tests, errors)) for f, err in bad: - print('%s: %s' % (f, err)) + print("%s: %s" % (f, err)) return int(bool(errors)) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/third_party/2/OpenSSL/crypto.pyi b/third_party/2/OpenSSL/crypto.pyi index daf6ae7b251f..4a8389ce7bb1 100644 --- a/third_party/2/OpenSSL/crypto.pyi +++ b/third_party/2/OpenSSL/crypto.pyi @@ -51,8 +51,9 @@ class X509Name: def get_components(self) -> List[Tuple[str, str]]: ... class X509Extension: - def __init__(self, type_name: bytes, critical: bool, value: bytes, subject: Optional[X509] = ..., - issuer: Optional[X509] = ...) -> None: ... + def __init__( + self, type_name: bytes, critical: bool, value: bytes, subject: Optional[X509] = ..., issuer: Optional[X509] = ... + ) -> None: ... def get_critical(self) -> bool: ... def get_short_name(self) -> str: ... def get_data(self) -> str: ... @@ -128,8 +129,9 @@ class X509StoreContext: def load_certificate(type: int, buffer: Union[str, unicode]) -> X509: ... def dump_certificate(type: int, cert: X509) -> bytes: ... def dump_publickey(type: int, pkey: PKey) -> bytes: ... -def dump_privatekey(type: int, pkey: PKey, cipher: Optional[str] = ..., - passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> bytes: ... +def dump_privatekey( + type: int, pkey: PKey, cipher: Optional[str] = ..., passphrase: Optional[Union[str, Callable[[int], int]]] = ... +) -> bytes: ... class Revoked: def __init__(self) -> None: ... diff --git a/third_party/2/concurrent/futures/_base.pyi b/third_party/2/concurrent/futures/_base.pyi index 1c1695784387..51cd67d45e3d 100644 --- a/third_party/2/concurrent/futures/_base.pyi +++ b/third_party/2/concurrent/futures/_base.pyi @@ -16,7 +16,7 @@ class Error(Exception): ... class CancelledError(Error): ... class TimeoutError(Error): ... -_T = TypeVar('_T') +_T = TypeVar("_T") class Future(Generic[_T]): def __init__(self) -> None: ... @@ -28,7 +28,6 @@ class Future(Generic[_T]): def result(self, timeout: Optional[float] = ...) -> _T: ... def set_running_or_notify_cancel(self) -> bool: ... def set_result(self, result: _T) -> None: ... - if sys.version_info >= (3,): def exception(self, timeout: Optional[float] = ...) -> Optional[BaseException]: ... def set_exception(self, exception: Optional[BaseException]) -> None: ... @@ -38,19 +37,19 @@ class Future(Generic[_T]): def set_exception(self, exception: Any) -> None: ... def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ... - class Executor: def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... if sys.version_info >= (3, 5): - def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., - chunksize: int = ...) -> Iterator[_T]: ... + def map( + self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ... + ) -> Iterator[_T]: ... else: - def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...,) -> Iterator[_T]: ... + def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ... def shutdown(self, wait: bool = ...) -> None: ... def __enter__(self: _T) -> _T: ... def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool: ... def as_completed(fs: Iterable[Future[_T]], timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ... - -def wait(fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ...) -> Tuple[Set[Future[_T]], - Set[Future[_T]]]: ... +def wait( + fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ... +) -> Tuple[Set[Future[_T]], Set[Future[_T]]]: ... diff --git a/third_party/2/concurrent/futures/process.pyi b/third_party/2/concurrent/futures/process.pyi index f5d3e0f4b479..37da1e11cf42 100644 --- a/third_party/2/concurrent/futures/process.pyi +++ b/third_party/2/concurrent/futures/process.pyi @@ -10,9 +10,13 @@ if sys.version_info >= (3,): if sys.version_info >= (3, 7): class ProcessPoolExecutor(Executor): - def __init__(self, max_workers: Optional[int] = ..., - initializer: Optional[Callable[..., None]] = ..., - initargs: Tuple[Any, ...] = ...) -> None: ... + def __init__( + self, + max_workers: Optional[int] = ..., + initializer: Optional[Callable[..., None]] = ..., + initargs: Tuple[Any, ...] = ..., + ) -> None: ... + else: class ProcessPoolExecutor(Executor): def __init__(self, max_workers: Optional[int] = ...) -> None: ... diff --git a/third_party/2/concurrent/futures/thread.pyi b/third_party/2/concurrent/futures/thread.pyi index 44dac203675b..e37cbc5b97e7 100644 --- a/third_party/2/concurrent/futures/thread.pyi +++ b/third_party/2/concurrent/futures/thread.pyi @@ -5,12 +5,14 @@ from ._base import Executor, Future class ThreadPoolExecutor(Executor): if sys.version_info >= (3, 7): - def __init__(self, max_workers: Optional[int] = ..., - thread_name_prefix: str = ..., - initializer: Optional[Callable[..., None]] = ..., - initargs: Tuple[Any, ...] = ...) -> None: ... + def __init__( + self, + max_workers: Optional[int] = ..., + thread_name_prefix: str = ..., + initializer: Optional[Callable[..., None]] = ..., + initargs: Tuple[Any, ...] = ..., + ) -> None: ... elif sys.version_info >= (3, 6) or sys.version_info < (3,): - def __init__(self, max_workers: Optional[int] = ..., - thread_name_prefix: str = ...) -> None: ... + def __init__(self, max_workers: Optional[int] = ..., thread_name_prefix: str = ...) -> None: ... else: def __init__(self, max_workers: Optional[int] = ...) -> None: ... diff --git a/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi b/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi index d6ef3d504b12..4aebc6cf8c41 100644 --- a/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi +++ b/third_party/2/cryptography/hazmat/primitives/asymmetric/rsa.pyi @@ -12,8 +12,9 @@ class RSAPrivateKey: class RSAPrivateKeyWithSerialization(RSAPrivateKey): def private_numbers(self) -> RSAPrivateNumbers: ... - def private_bytes(self, encoding: Encoding, format: PrivateFormat, - encryption_algorithm: KeySerializationEncryption) -> bytes: ... + def private_bytes( + self, encoding: Encoding, format: PrivateFormat, encryption_algorithm: KeySerializationEncryption + ) -> bytes: ... class RSAPublicKey: def verifier(self, signature: bytes, padding, algorithm): ... diff --git a/third_party/2/enum.pyi b/third_party/2/enum.pyi index b472bfa3ce39..946551f2e442 100644 --- a/third_party/2/enum.pyi +++ b/third_party/2/enum.pyi @@ -3,8 +3,8 @@ import sys from abc import ABCMeta from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union -_T = TypeVar('_T') -_S = TypeVar('_S', bound=Type[Enum]) +_T = TypeVar("_T") +_S = TypeVar("_S", bound=Type[Enum]) # Note: EnumMeta actually subclasses type directly, not ABCMeta. # This is a temporary workaround to allow multiple creation of enums with builtins @@ -55,7 +55,6 @@ if sys.version_info >= (3, 6): # subclassing IntFlag so it picks up all implemented base functions, best modeling behavior of enum.auto() class auto(IntFlag): value: Any - class Flag(Enum): def __contains__(self: _T, other: _T) -> bool: ... def __repr__(self) -> str: ... @@ -65,7 +64,6 @@ if sys.version_info >= (3, 6): def __and__(self: _T, other: _T) -> _T: ... def __xor__(self: _T, other: _T) -> _T: ... def __invert__(self: _T) -> _T: ... - # The `type: ignore` comment is needed because mypy considers the type # signatures of several methods defined in int and Flag to be incompatible. class IntFlag(int, Flag): # type: ignore diff --git a/third_party/2/gflags.pyi b/third_party/2/gflags.pyi index 082b56a1f7b5..db3b43d7fec5 100644 --- a/third_party/2/gflags.pyi +++ b/third_party/2/gflags.pyi @@ -2,18 +2,18 @@ from types import ModuleType from typing import IO, Any, Callable, Dict, Iterable, List, Optional, Sequence, Union class Error(Exception): ... + FlagsError = Error class DuplicateFlag(FlagsError): ... - class CantOpenFlagFileError(FlagsError): ... - class DuplicateFlagCannotPropagateNoneToSwig(DuplicateFlag): ... class DuplicateFlagError(DuplicateFlag): def __init__(self, flagname: str, flag_values: FlagValues, other_flag_values: FlagValues = ...) -> None: ... class IllegalFlagValueError(FlagsError): ... + IllegalFlagValue = IllegalFlagValueError class UnrecognizedFlag(FlagsError): ... @@ -22,11 +22,16 @@ class UnrecognizedFlagError(UnrecognizedFlag): def __init__(self, flagname: str, flagvalue: str = ...) -> None: ... def get_help_width() -> int: ... + GetHelpWidth = get_help_width + def CutCommonSpacePrefix(text) -> str: ... def text_wrap(text: str, length: int = ..., indent: str = ..., firstline_indent: str = ..., tabs: str = ...) -> str: ... + TextWrap = text_wrap + def doc_to_help(doc: str) -> str: ... + DocToHelp = doc_to_help class FlagValues: @@ -100,10 +105,17 @@ class Flag: parser: ArgumentParser serializer: ArgumentSerializer allow_override = False - - def __init__(self, parser: ArgumentParser, serializer: ArgumentSerializer, name: str, - default: Optional[str], help_string: str, short_name: str = ..., boolean: bool = ..., - allow_override: bool = ...) -> None: ... + def __init__( + self, + parser: ArgumentParser, + serializer: ArgumentSerializer, + name: str, + default: Optional[str], + help_string: str, + short_name: str = ..., + boolean: bool = ..., + allow_override: bool = ..., + ) -> None: ... def Parse(self, argument: Any) -> Any: ... def Unparse(self) -> None: ... def Serialize(self) -> str: ... @@ -127,21 +139,34 @@ class ListSerializer(ArgumentSerializer): def __init__(self, list_sep: str) -> None: ... def Serialize(self, value: List[Any]) -> str: ... -def register_validator(flag_name: str, - checker: Callable[[Any], bool], - message: str = ..., - flag_values: FlagValues = ...) -> None: ... +def register_validator( + flag_name: str, checker: Callable[[Any], bool], message: str = ..., flag_values: FlagValues = ... +) -> None: ... + RegisterValidator = register_validator + def mark_flag_as_required(flag_name: str, flag_values: FlagValues = ...) -> None: ... + MarkFlagAsRequired = mark_flag_as_required -def DEFINE(parser: ArgumentParser, name: str, default: Any, help: str, - flag_values: FlagValues = ..., serializer: ArgumentSerializer = ..., **args: Any) -> None: ... +def DEFINE( + parser: ArgumentParser, + name: str, + default: Any, + help: str, + flag_values: FlagValues = ..., + serializer: ArgumentSerializer = ..., + **args: Any +) -> None: ... def DEFINE_flag(flag: Flag, flag_values: FlagValues = ...) -> None: ... def declare_key_flag(flag_name: str, flag_values: FlagValues = ...) -> None: ... + DECLARE_key_flag = declare_key_flag + def adopt_module_key_flags(module: ModuleType, flag_values: FlagValues = ...) -> None: ... + ADOPT_module_key_flags = adopt_module_key_flags + def DEFINE_string(name: str, default: Optional[str], help: str, flag_values: FlagValues = ..., **args: Any): ... class BooleanParser(ArgumentParser): @@ -180,8 +205,15 @@ class FloatParser(NumericParser): def __init__(self, lower_bound: float = ..., upper_bound: float = ...) -> None: ... def Convert(self, argument: Any) -> float: ... -def DEFINE_float(name: str, default: Optional[float], help: str, lower_bound: float = ..., - upper_bound: float = ..., flag_values: FlagValues = ..., **args: Any) -> None: ... +def DEFINE_float( + name: str, + default: Optional[float], + help: str, + lower_bound: float = ..., + upper_bound: float = ..., + flag_values: FlagValues = ..., + **args: Any +) -> None: ... class IntegerParser(NumericParser): number_article: str @@ -190,19 +222,28 @@ class IntegerParser(NumericParser): def __init__(self, lower_bound: int = ..., upper_bound: int = ...) -> None: ... def Convert(self, argument: Any) -> int: ... -def DEFINE_integer(name: str, default: Optional[int], help: str, lower_bound: int = ..., - upper_bound: int = ..., flag_values: FlagValues = ..., **args: Any) -> None: ... +def DEFINE_integer( + name: str, + default: Optional[int], + help: str, + lower_bound: int = ..., + upper_bound: int = ..., + flag_values: FlagValues = ..., + **args: Any +) -> None: ... class EnumParser(ArgumentParser): def __init__(self, enum_values: List[str]) -> None: ... def Parse(self, argument: Any) -> Any: ... class EnumFlag(Flag): - def __init__(self, name: str, default: Optional[str], help: str, enum_values: List[str], - short_name: str, **args: Any) -> None: ... + def __init__( + self, name: str, default: Optional[str], help: str, enum_values: List[str], short_name: str, **args: Any + ) -> None: ... -def DEFINE_enum(name: str, default: Optional[str], enum_values: List[str], help: str, - flag_values: FlagValues = ..., **args: Any) -> None: ... +def DEFINE_enum( + name: str, default: Optional[str], enum_values: List[str], help: str, flag_values: FlagValues = ..., **args: Any +) -> None: ... class BaseListParser(ArgumentParser): def __init__(self, token: str = ..., name: str = ...) -> None: ... @@ -217,26 +258,48 @@ class WhitespaceSeparatedListParser(BaseListParser): def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str): ... def DEFINE_list(name: str, default: Optional[List[str]], help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... -def DEFINE_spaceseplist(name: str, default: Optional[List[str]], help: str, flag_values: FlagValues = ..., - **args: Any) -> None: ... +def DEFINE_spaceseplist( + name: str, default: Optional[List[str]], help: str, flag_values: FlagValues = ..., **args: Any +) -> None: ... class MultiFlag(Flag): def __init__(self, *args: Any, **kwargs: Any) -> None: ... def Parse(self, arguments: Any) -> None: ... def Serialize(self) -> str: ... -def DEFINE_multi_string(name: str, default: Optional[Union[str, List[str]]], help: str, - flag_values: FlagValues = ..., **args: Any) -> None: ... +def DEFINE_multi_string( + name: str, default: Optional[Union[str, List[str]]], help: str, flag_values: FlagValues = ..., **args: Any +) -> None: ... + DEFINE_multistring = DEFINE_multi_string -def DEFINE_multi_integer(name: str, default: Optional[Union[int, List[int]]], help: str, lower_bound: int = ..., - upper_bound: int = ..., flag_values: FlagValues = ..., **args: Any) -> None: ... -DEFINE_multi_int = DEFINE_multi_integer +def DEFINE_multi_integer( + name: str, + default: Optional[Union[int, List[int]]], + help: str, + lower_bound: int = ..., + upper_bound: int = ..., + flag_values: FlagValues = ..., + **args: Any +) -> None: ... -def DEFINE_multi_float(name: str, default: Optional[Union[float, List[float]]], help: str, - lower_bound: float = ..., upper_bound: float = ..., - flag_values: FlagValues = ..., **args: Any) -> None: ... +DEFINE_multi_int = DEFINE_multi_integer -def DEFINE_multi_enum(name: str, default: Optional[Union[Sequence[str], str]], - enum_values: Sequence[str], help: str, - flag_values: FlagValues = ..., case_sensitive: bool = ..., **args: Any): ... +def DEFINE_multi_float( + name: str, + default: Optional[Union[float, List[float]]], + help: str, + lower_bound: float = ..., + upper_bound: float = ..., + flag_values: FlagValues = ..., + **args: Any +) -> None: ... +def DEFINE_multi_enum( + name: str, + default: Optional[Union[Sequence[str], str]], + enum_values: Sequence[str], + help: str, + flag_values: FlagValues = ..., + case_sensitive: bool = ..., + **args: Any +): ... diff --git a/third_party/2/kazoo/client.pyi b/third_party/2/kazoo/client.pyi index 0d3fc0086de9..ebdb418195aa 100644 --- a/third_party/2/kazoo/client.pyi +++ b/third_party/2/kazoo/client.pyi @@ -34,8 +34,21 @@ class KazooClient: SetPartitioner: Any Semaphore: Any ShallowParty: Any - def __init__(self, hosts=..., timeout=..., client_id=..., handler=..., default_acl=..., auth_data=..., read_only=..., - randomize_hosts=..., connection_retry=..., command_retry=..., logger=..., **kwargs) -> None: ... + def __init__( + self, + hosts=..., + timeout=..., + client_id=..., + handler=..., + default_acl=..., + auth_data=..., + read_only=..., + randomize_hosts=..., + connection_retry=..., + command_retry=..., + logger=..., + **kwargs + ) -> None: ... @property def client_state(self): ... @property @@ -93,5 +106,4 @@ class TransactionRequest: def __enter__(self): ... def __exit__(self, exc_type, exc_value, exc_tb): ... -class KazooState: - ... +class KazooState: ... diff --git a/third_party/2/pathlib2.pyi b/third_party/2/pathlib2.pyi index d16e31126adb..1e2ca1af783b 100644 --- a/third_party/2/pathlib2.pyi +++ b/third_party/2/pathlib2.pyi @@ -3,7 +3,7 @@ import sys from types import TracebackType from typing import IO, Any, Generator, List, Optional, Sequence, Tuple, Type, TypeVar, Union -_P = TypeVar('_P', bound='PurePath') +_P = TypeVar("_P", bound="PurePath") if sys.version_info >= (3, 6): _PurePathBase = os.PathLike[str] @@ -43,7 +43,6 @@ class PurePath(_PurePathBase): def with_name(self: _P, name: str) -> _P: ... def with_suffix(self: _P, suffix: str) -> _P: ... def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ... - @property def parents(self: _P) -> Sequence[_P]: ... @property @@ -54,9 +53,9 @@ class PureWindowsPath(PurePath): ... class Path(PurePath): def __enter__(self) -> Path: ... - def __exit__(self, exc_type: Optional[Type[BaseException]], - exc_value: Optional[BaseException], - traceback: Optional[TracebackType]) -> Optional[bool]: ... + def __exit__( + self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType] + ) -> Optional[bool]: ... @classmethod def cwd(cls: Type[_P]) -> _P: ... def stat(self) -> os.stat_result: ... @@ -75,14 +74,17 @@ class Path(PurePath): def lchmod(self, mode: int) -> None: ... def lstat(self) -> os.stat_result: ... if sys.version_info < (3, 5): - def mkdir(self, mode: int = ..., - parents: bool = ...) -> None: ... + def mkdir(self, mode: int = ..., parents: bool = ...) -> None: ... else: - def mkdir(self, mode: int = ..., parents: bool = ..., - exist_ok: bool = ...) -> None: ... - def open(self, mode: str = ..., buffering: int = ..., - encoding: Optional[str] = ..., errors: Optional[str] = ..., - newline: Optional[str] = ...) -> IO[Any]: ... + def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ... + def open( + self, + mode: str = ..., + buffering: int = ..., + encoding: Optional[str] = ..., + errors: Optional[str] = ..., + newline: Optional[str] = ..., + ) -> IO[Any]: ... def owner(self) -> str: ... def rename(self, target: Union[str, PurePath]) -> None: ... def replace(self, target: Union[str, PurePath]) -> None: ... @@ -92,31 +94,23 @@ class Path(PurePath): def resolve(self: _P, strict: bool = ...) -> _P: ... def rglob(self, pattern: str) -> Generator[Path, None, None]: ... def rmdir(self) -> None: ... - def symlink_to(self, target: Union[str, Path], - target_is_directory: bool = ...) -> None: ... + def symlink_to(self, target: Union[str, Path], target_is_directory: bool = ...) -> None: ... def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ... def unlink(self) -> None: ... - if sys.version_info >= (3, 5): @classmethod def home(cls: Type[_P]) -> _P: ... if sys.version_info < (3, 6): - def __new__(cls: Type[_P], *args: Union[str, PurePath], - **kwargs: Any) -> _P: ... + def __new__(cls: Type[_P], *args: Union[str, PurePath], **kwargs: Any) -> _P: ... else: - def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]], - **kwargs: Any) -> _P: ... - + def __new__(cls: Type[_P], *args: Union[str, os.PathLike[str]], **kwargs: Any) -> _P: ... def absolute(self: _P) -> _P: ... def expanduser(self: _P) -> _P: ... def read_bytes(self) -> bytes: ... - def read_text(self, encoding: Optional[str] = ..., - errors: Optional[str] = ...) -> str: ... + def read_text(self, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> str: ... def samefile(self, other_path: Union[str, bytes, int, Path]) -> bool: ... def write_bytes(self, data: bytes) -> int: ... - def write_text(self, data: str, encoding: Optional[str] = ..., - errors: Optional[str] = ...) -> int: ... - + def write_text(self, data: str, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> int: ... class PosixPath(Path, PurePosixPath): ... class WindowsPath(Path, PureWindowsPath): ... diff --git a/third_party/2/pymssql.pyi b/third_party/2/pymssql.pyi index 7fa18ddf4618..4f625626f6c7 100644 --- a/third_party/2/pymssql.pyi +++ b/third_party/2/pymssql.pyi @@ -5,8 +5,7 @@ Scalar = Union[int, float, str, datetime, date, time] Result = Union[Tuple[Scalar, ...], Dict[str, Scalar]] class Connection(object): - def __init__(self, user, password, host, database, timeout, - login_timeout, charset, as_dict) -> None: ... + def __init__(self, user, password, host, database, timeout, login_timeout, charset, as_dict) -> None: ... def autocommit(self, status: bool) -> None: ... def close(self) -> None: ... def commit(self) -> None: ... @@ -19,29 +18,27 @@ class Cursor(object): def __next__(self) -> Any: ... def callproc(self, procname: str, **kwargs) -> None: ... def close(self) -> None: ... - def execute(self, stmt: str, - params: Optional[Union[Scalar, Tuple[Scalar, ...], - Dict[str, Scalar]]]) -> None: ... - def executemany(self, stmt: str, - params: Optional[Sequence[Tuple[Scalar, ...]]]) -> None: ... + def execute(self, stmt: str, params: Optional[Union[Scalar, Tuple[Scalar, ...], Dict[str, Scalar]]]) -> None: ... + def executemany(self, stmt: str, params: Optional[Sequence[Tuple[Scalar, ...]]]) -> None: ... def fetchall(self) -> List[Result]: ... def fetchmany(self, size: Optional[int]) -> List[Result]: ... def fetchone(self) -> Result: ... -def connect(server: Optional[str], - user: Optional[str], - password: Optional[str], - database: Optional[str], - timeout: Optional[int], - login_timeout: Optional[int], - charset: Optional[str], - as_dict: Optional[bool], - host: Optional[str], - appname: Optional[str], - port: Optional[str], - - conn_properties: Optional[Union[str, Sequence[str]]], - autocommit: Optional[bool], - tds_version: Optional[str]) -> Connection: ... +def connect( + server: Optional[str], + user: Optional[str], + password: Optional[str], + database: Optional[str], + timeout: Optional[int], + login_timeout: Optional[int], + charset: Optional[str], + as_dict: Optional[bool], + host: Optional[str], + appname: Optional[str], + port: Optional[str], + conn_properties: Optional[Union[str, Sequence[str]]], + autocommit: Optional[bool], + tds_version: Optional[str], +) -> Connection: ... def get_max_connections() -> int: ... def set_max_connections(n: int) -> None: ... diff --git a/third_party/2/routes/mapper.pyi b/third_party/2/routes/mapper.pyi index f834d08471fa..055a6e017ca9 100644 --- a/third_party/2/routes/mapper.pyi +++ b/third_party/2/routes/mapper.pyi @@ -7,8 +7,18 @@ def strip_slashes(name): ... class SubMapperParent: def submapper(self, **kargs): ... - def collection(self, collection_name, resource_name, path_prefix=..., member_prefix=..., controller=..., - collection_actions=..., member_actions=..., member_options=..., **kwargs): ... + def collection( + self, + collection_name, + resource_name, + path_prefix=..., + member_prefix=..., + controller=..., + collection_actions=..., + member_actions=..., + member_options=..., + **kwargs + ): ... class SubMapper(SubMapperParent): kwargs: Any diff --git a/third_party/2/six/__init__.pyi b/third_party/2/six/__init__.pyi index eaacba4d3f5d..59f4e3c60fc8 100644 --- a/third_party/2/six/__init__.pyi +++ b/third_party/2/six/__init__.pyi @@ -5,6 +5,7 @@ from __future__ import print_function import types import typing import unittest + # Exports from __builtin__ import unichr as unichr from functools import wraps as wraps @@ -32,9 +33,9 @@ from typing import ( from . import moves -_T = TypeVar('_T') -_K = TypeVar('_K') -_V = TypeVar('_V') +_T = TypeVar("_T") +_K = TypeVar("_K") +_V = TypeVar("_V") # TODO make constant, then move this stub to 2and3 # https://github.com/python/typeshed/issues/17 @@ -54,10 +55,10 @@ MAXSIZE: int # def remove_move def advance_iterator(it: typing.Iterator[_T]) -> _T: ... + next = advance_iterator def callable(obj: object) -> bool: ... - def get_unbound_function(unbound: types.MethodType) -> types.FunctionType: ... def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ... def create_unbound_method(func: types.FunctionType, cls: Union[type, types.ClassType]) -> types.MethodType: ... @@ -71,33 +72,34 @@ def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, def get_function_code(fun: types.FunctionType) -> types.CodeType: ... def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ... def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ... - def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ... def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ... def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ... + # def iterlists def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ... def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ... def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ... - def b(s: str) -> binary_type: ... def u(s: str) -> text_type: ... + int2byte = chr + def byte2int(bs: binary_type) -> int: ... def indexbytes(buf: binary_type, i: int) -> int: ... def iterbytes(buf: binary_type) -> typing.Iterator[int]: ... - def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = ...) -> None: ... @overload def assertRaisesRegex(self: unittest.TestCase, msg: str = ...) -> Any: ... @overload def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ... -def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], - msg: str = ...) -> None: ... - -def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException], - tb: Optional[types.TracebackType] = ...) -> NoReturn: ... +def assertRegex( + self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: str = ... +) -> None: ... +def reraise( + tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ... +) -> NoReturn: ... def exec_(_code_: Union[unicode, types.CodeType], _globs_: Dict[str, Any] = ..., _locs_: Dict[str, Any] = ...): ... def raise_from(value: Union[BaseException, Type[BaseException]], from_value: Optional[BaseException]) -> NoReturn: ... diff --git a/third_party/2/tornado/gen.pyi b/third_party/2/tornado/gen.pyi index 809e7eaf09a3..2e1741b86941 100644 --- a/third_party/2/tornado/gen.pyi +++ b/third_party/2/tornado/gen.pyi @@ -104,6 +104,6 @@ class Runner: def result_callback(self, key): ... def handle_exception(self, typ, value, tb): ... -Arguments = namedtuple('Arguments', ['args', 'kwargs']) +Arguments = namedtuple("Arguments", ["args", "kwargs"]) def convert_yielded(yielded): ... diff --git a/third_party/2/tornado/httpclient.pyi b/third_party/2/tornado/httpclient.pyi index abc6e81c1715..f5f3d4d364fd 100644 --- a/third_party/2/tornado/httpclient.pyi +++ b/third_party/2/tornado/httpclient.pyi @@ -53,12 +53,41 @@ class HTTPRequest: ssl_options: Any expect_100_continue: Any start_time: Any - def __init__(self, url, method=..., headers=..., body=..., auth_username=..., auth_password=..., auth_mode=..., - connect_timeout=..., request_timeout=..., if_modified_since=..., follow_redirects=..., max_redirects=..., - user_agent=..., use_gzip=..., network_interface=..., streaming_callback=..., header_callback=..., - prepare_curl_callback=..., proxy_host=..., proxy_port=..., proxy_username=..., proxy_password=..., - allow_nonstandard_methods=..., validate_cert=..., ca_certs=..., allow_ipv6=..., client_key=..., client_cert=..., - body_producer=..., expect_100_continue=..., decompress_response=..., ssl_options=...) -> None: ... + def __init__( + self, + url, + method=..., + headers=..., + body=..., + auth_username=..., + auth_password=..., + auth_mode=..., + connect_timeout=..., + request_timeout=..., + if_modified_since=..., + follow_redirects=..., + max_redirects=..., + user_agent=..., + use_gzip=..., + network_interface=..., + streaming_callback=..., + header_callback=..., + prepare_curl_callback=..., + proxy_host=..., + proxy_port=..., + proxy_username=..., + proxy_password=..., + allow_nonstandard_methods=..., + validate_cert=..., + ca_certs=..., + allow_ipv6=..., + client_key=..., + client_cert=..., + body_producer=..., + expect_100_continue=..., + decompress_response=..., + ssl_options=..., + ) -> None: ... @property def headers(self): ... @headers.setter @@ -78,8 +107,9 @@ class HTTPResponse: error: Any request_time: Any time_info: Any - def __init__(self, request, code, headers=..., buffer=..., effective_url=..., error=..., request_time=..., time_info=..., - reason=...) -> None: ... + def __init__( + self, request, code, headers=..., buffer=..., effective_url=..., error=..., request_time=..., time_info=..., reason=... + ) -> None: ... body: Any def rethrow(self): ... diff --git a/third_party/2/tornado/httpserver.pyi b/third_party/2/tornado/httpserver.pyi index ad3c40952ddf..60806f1df3a5 100644 --- a/third_party/2/tornado/httpserver.pyi +++ b/third_party/2/tornado/httpserver.pyi @@ -11,9 +11,22 @@ class HTTPServer(TCPServer, Configurable, httputil.HTTPServerConnectionDelegate) xheaders: Any protocol: Any conn_params: Any - def initialize(self, request_callback, no_keep_alive=..., io_loop=..., xheaders=..., ssl_options=..., protocol=..., - decompress_request=..., chunk_size=..., max_header_size=..., idle_connection_timeout=..., body_timeout=..., - max_body_size=..., max_buffer_size=...): ... + def initialize( + self, + request_callback, + no_keep_alive=..., + io_loop=..., + xheaders=..., + ssl_options=..., + protocol=..., + decompress_request=..., + chunk_size=..., + max_header_size=..., + idle_connection_timeout=..., + body_timeout=..., + max_body_size=..., + max_buffer_size=..., + ): ... @classmethod def configurable_base(cls): ... @classmethod diff --git a/third_party/2/tornado/httputil.pyi b/third_party/2/tornado/httputil.pyi index a916eb4e52cd..48b29d8412f1 100644 --- a/third_party/2/tornado/httputil.pyi +++ b/third_party/2/tornado/httputil.pyi @@ -43,8 +43,9 @@ class HTTPServerRequest: arguments: Any query_arguments: Any body_arguments: Any - def __init__(self, method=..., uri=..., version=..., headers=..., body=..., host=..., files=..., connection=..., - start_line=...) -> None: ... + def __init__( + self, method=..., uri=..., version=..., headers=..., body=..., host=..., files=..., connection=..., start_line=... + ) -> None: ... def supports_http_1_1(self): ... @property def cookies(self): ... @@ -80,11 +81,11 @@ def parse_body_arguments(content_type, body, arguments, files, headers=...): ... def parse_multipart_form_data(boundary, data, arguments, files): ... def format_timestamp(ts): ... -RequestStartLine = namedtuple('RequestStartLine', ['method', 'path', 'version']) +RequestStartLine = namedtuple("RequestStartLine", ["method", "path", "version"]) def parse_request_start_line(line): ... -ResponseStartLine = namedtuple('ResponseStartLine', ['version', 'code', 'reason']) +ResponseStartLine = namedtuple("ResponseStartLine", ["version", "code", "reason"]) def parse_response_start_line(line): ... def doctests(): ... diff --git a/third_party/2and3/Crypto/Cipher/PKCS1_OAEP.pyi b/third_party/2and3/Crypto/Cipher/PKCS1_OAEP.pyi index 239d237694b3..6762f1ecaad9 100644 --- a/third_party/2and3/Crypto/Cipher/PKCS1_OAEP.pyi +++ b/third_party/2and3/Crypto/Cipher/PKCS1_OAEP.pyi @@ -9,5 +9,4 @@ class PKCS1OAEP_Cipher: def encrypt(self, message: Union[bytes, Text]) -> bytes: ... def decrypt(self, ct: bytes) -> bytes: ... - def new(key: _RSAobj, hashAlgo: Optional[Any] = ..., mgfunc: Optional[Any] = ..., label: Any = ...) -> PKCS1OAEP_Cipher: ... diff --git a/third_party/2and3/Crypto/Cipher/XOR.pyi b/third_party/2and3/Crypto/Cipher/XOR.pyi index e2f0dc449856..cd907ffbd434 100644 --- a/third_party/2and3/Crypto/Cipher/XOR.pyi +++ b/third_party/2and3/Crypto/Cipher/XOR.pyi @@ -9,7 +9,6 @@ class XORCipher: def encrypt(self, plaintext: Union[bytes, Text]) -> bytes: ... def decrypt(self, ciphertext: bytes) -> bytes: ... - def new(key: Union[bytes, Text], *args, **kwargs) -> XORCipher: ... block_size: int diff --git a/third_party/2and3/Crypto/Util/Counter.pyi b/third_party/2and3/Crypto/Util/Counter.pyi index 4aae7f269ff8..a1f13eead7a2 100644 --- a/third_party/2and3/Crypto/Util/Counter.pyi +++ b/third_party/2and3/Crypto/Util/Counter.pyi @@ -1,3 +1,12 @@ from typing import Any -def new(nbits, prefix: Any = ..., suffix: Any = ..., initial_value: int = ..., overflow: int = ..., little_endian: bool = ..., allow_wraparound: bool = ..., disable_shortcut: bool = ...): ... +def new( + nbits, + prefix: Any = ..., + suffix: Any = ..., + initial_value: int = ..., + overflow: int = ..., + little_endian: bool = ..., + allow_wraparound: bool = ..., + disable_shortcut: bool = ..., +): ... diff --git a/third_party/2and3/Crypto/Util/randpool.pyi b/third_party/2and3/Crypto/Util/randpool.pyi index 4d90f92090b9..3ee98d74b49e 100644 --- a/third_party/2and3/Crypto/Util/randpool.pyi +++ b/third_party/2and3/Crypto/Util/randpool.pyi @@ -6,7 +6,9 @@ class RandomPool: bytes: Any bits: Any entropy: Any - def __init__(self, numbytes: int = ..., cipher: Optional[Any] = ..., hash: Optional[Any] = ..., file: Optional[Any] = ...) -> None: ... + def __init__( + self, numbytes: int = ..., cipher: Optional[Any] = ..., hash: Optional[Any] = ..., file: Optional[Any] = ... + ) -> None: ... def get_bytes(self, N): ... def randomize(self, N: int = ...): ... def stir(self, s: str = ...): ... diff --git a/third_party/2and3/atomicwrites/__init__.pyi b/third_party/2and3/atomicwrites/__init__.pyi index 45a01544808d..8e97214fe275 100644 --- a/third_party/2and3/atomicwrites/__init__.pyi +++ b/third_party/2and3/atomicwrites/__init__.pyi @@ -2,6 +2,7 @@ from typing import IO, AnyStr, Callable, ContextManager, Optional, Text, Type def replace_atomic(src: AnyStr, dst: AnyStr) -> None: ... def move_atomic(src: AnyStr, dst: AnyStr) -> None: ... + class AtomicWriter(object): def __init__(self, path: AnyStr, mode: Text = ..., overwrite: bool = ...) -> None: ... def open(self) -> ContextManager[IO]: ... @@ -10,4 +11,5 @@ class AtomicWriter(object): def sync(self, f: IO) -> None: ... def commit(self, f: IO) -> None: ... def rollback(self, f: IO) -> None: ... + def atomic_write(path: AnyStr, writer_cls: Type[AtomicWriter] = ..., **cls_kwargs: object) -> ContextManager[IO]: ... diff --git a/third_party/2and3/attr/__init__.pyi b/third_party/2and3/attr/__init__.pyi index 4cc73c5a848f..08dc615fa727 100644 --- a/third_party/2and3/attr/__init__.pyi +++ b/third_party/2and3/attr/__init__.pyi @@ -26,10 +26,7 @@ NOTHING: object @overload def Factory(factory: Callable[[], _T]) -> _T: ... @overload -def Factory( - factory: Union[Callable[[Any], _T], Callable[[], _T]], - takes_self: bool = ..., -) -> _T: ... +def Factory(factory: Union[Callable[[Any], _T], Callable[[], _T]], takes_self: bool = ...) -> _T: ... class Attribute(Generic[_T]): name: str diff --git a/third_party/2and3/attr/converters.pyi b/third_party/2and3/attr/converters.pyi index 011a3a469bfb..70cb260642ba 100644 --- a/third_party/2and3/attr/converters.pyi +++ b/third_party/2and3/attr/converters.pyi @@ -4,9 +4,7 @@ from . import _ConverterType _T = TypeVar("_T") -def optional( - converter: _ConverterType[_T] -) -> _ConverterType[Optional[_T]]: ... +def optional(converter: _ConverterType[_T]) -> _ConverterType[Optional[_T]]: ... @overload def default_if_none(default: _T) -> _ConverterType[_T]: ... @overload diff --git a/third_party/2and3/attr/validators.pyi b/third_party/2and3/attr/validators.pyi index b7bd25c14985..62e150afdce8 100644 --- a/third_party/2and3/attr/validators.pyi +++ b/third_party/2and3/attr/validators.pyi @@ -4,22 +4,15 @@ from . import _ValidatorType _T = TypeVar("_T") -def instance_of( - type: Union[Tuple[Type[_T], ...], Type[_T]] -) -> _ValidatorType[_T]: ... +def instance_of(type: Union[Tuple[Type[_T], ...], Type[_T]]) -> _ValidatorType[_T]: ... def provides(interface: Any) -> _ValidatorType[Any]: ... -def optional( - validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]] -) -> _ValidatorType[Optional[_T]]: ... +def optional(validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]]) -> _ValidatorType[Optional[_T]]: ... def in_(options: Container[_T]) -> _ValidatorType[_T]: ... def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ... def deep_iterable( - member_validator: _ValidatorType[_T], - iterable_validator: Optional[_ValidatorType[_T]], + member_validator: _ValidatorType[_T], iterable_validator: Optional[_ValidatorType[_T]] ) -> _ValidatorType[_T]: ... def deep_mapping( - key_validator: _ValidatorType[_T], - value_validator: _ValidatorType[_T], - mapping_validator: Optional[_ValidatorType[_T]], + key_validator: _ValidatorType[_T], value_validator: _ValidatorType[_T], mapping_validator: Optional[_ValidatorType[_T]] ) -> _ValidatorType[_T]: ... def is_callable() -> _ValidatorType[_T]: ... diff --git a/third_party/2and3/bleach/__init__.pyi b/third_party/2and3/bleach/__init__.pyi index a78854593e77..7c2c6dfc917d 100644 --- a/third_party/2and3/bleach/__init__.pyi +++ b/third_party/2and3/bleach/__init__.pyi @@ -24,8 +24,5 @@ def clean( strip_comments: bool = ..., ) -> Text: ... def linkify( - text: Text, - callbacks: Iterable[_Callback] = ..., - skip_tags: Optional[Container[Text]] = ..., - parse_email: bool = ..., + text: Text, callbacks: Iterable[_Callback] = ..., skip_tags: Optional[Container[Text]] = ..., parse_email: bool = ... ) -> Text: ... diff --git a/third_party/2and3/bleach/utils.pyi b/third_party/2and3/bleach/utils.pyi index e4edcfbd8abe..2e0daaf47978 100644 --- a/third_party/2and3/bleach/utils.pyi +++ b/third_party/2and3/bleach/utils.pyi @@ -1,6 +1,5 @@ from collections import OrderedDict from typing import Any, Mapping, Text, overload - @overload def alphabetize_attributes(attrs: None) -> None: ... @overload diff --git a/third_party/2and3/boto/__init__.pyi b/third_party/2and3/boto/__init__.pyi index 3f4c9fbcf0e1..fca83ee87abe 100644 --- a/third_party/2and3/boto/__init__.pyi +++ b/third_party/2and3/boto/__init__.pyi @@ -23,7 +23,9 @@ perflog: Any def set_file_logger(name, filepath, level: Any = ..., format_string: Optional[Any] = ...): ... def set_stream_logger(name, level: Any = ..., format_string: Optional[Any] = ...): ... def connect_sqs(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... -def connect_s3(aws_access_key_id: Optional[Text] = ..., aws_secret_access_key: Optional[Text] = ..., **kwargs) -> S3Connection: ... +def connect_s3( + aws_access_key_id: Optional[Text] = ..., aws_secret_access_key: Optional[Text] = ..., **kwargs +) -> S3Connection: ... def connect_gs(gs_access_key_id: Optional[Any] = ..., gs_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_ec2(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_elb(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... @@ -41,17 +43,37 @@ def connect_sns(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: O def connect_iam(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_route53(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_cloudformation(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... -def connect_euca(host: Optional[Any] = ..., aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., port: int = ..., path: str = ..., is_secure: bool = ..., **kwargs): ... +def connect_euca( + host: Optional[Any] = ..., + aws_access_key_id: Optional[Any] = ..., + aws_secret_access_key: Optional[Any] = ..., + port: int = ..., + path: str = ..., + is_secure: bool = ..., + **kwargs +): ... def connect_glacier(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_ec2_endpoint(url, aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... -def connect_walrus(host: Optional[Any] = ..., aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., port: int = ..., path: str = ..., is_secure: bool = ..., **kwargs): ... +def connect_walrus( + host: Optional[Any] = ..., + aws_access_key_id: Optional[Any] = ..., + aws_secret_access_key: Optional[Any] = ..., + port: int = ..., + path: str = ..., + is_secure: bool = ..., + **kwargs +): ... def connect_ses(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_sts(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... -def connect_ia(ia_access_key_id: Optional[Any] = ..., ia_secret_access_key: Optional[Any] = ..., is_secure: bool = ..., **kwargs): ... +def connect_ia( + ia_access_key_id: Optional[Any] = ..., ia_secret_access_key: Optional[Any] = ..., is_secure: bool = ..., **kwargs +): ... def connect_dynamodb(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_swf(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_cloudsearch(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... -def connect_cloudsearch2(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., sign_request: bool = ..., **kwargs): ... +def connect_cloudsearch2( + aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., sign_request: bool = ..., **kwargs +): ... def connect_cloudsearchdomain(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_beanstalk(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_elastictranscoder(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... @@ -72,5 +94,13 @@ def connect_configservice(aws_access_key_id: Optional[Any] = ..., aws_secret_acc def connect_cloudhsm(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_ec2containerservice(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... def connect_machinelearning(aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., **kwargs): ... -def storage_uri(uri_str, default_scheme: str = ..., debug: int = ..., validate: bool = ..., bucket_storage_uri_class: Any = ..., suppress_consec_slashes: bool = ..., is_latest: bool = ...): ... +def storage_uri( + uri_str, + default_scheme: str = ..., + debug: int = ..., + validate: bool = ..., + bucket_storage_uri_class: Any = ..., + suppress_consec_slashes: bool = ..., + is_latest: bool = ..., +): ... def storage_uri_for_key(key): ... diff --git a/third_party/2and3/boto/connection.pyi b/third_party/2and3/boto/connection.pyi index a588eabeb7bf..a16d6c999570 100644 --- a/third_party/2and3/boto/connection.pyi +++ b/third_party/2and3/boto/connection.pyi @@ -64,7 +64,26 @@ class AWSAuthConnection: provider: Any auth_service_name: Any request_hook: Any - def __init__(self, host, aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., is_secure: bool = ..., port: Optional[Any] = ..., proxy: Optional[Any] = ..., proxy_port: Optional[Any] = ..., proxy_user: Optional[Any] = ..., proxy_pass: Optional[Any] = ..., debug: int = ..., https_connection_factory: Optional[Any] = ..., path: str = ..., provider: str = ..., security_token: Optional[Any] = ..., suppress_consec_slashes: bool = ..., validate_certs: bool = ..., profile_name: Optional[Any] = ...) -> None: ... + def __init__( + self, + host, + aws_access_key_id: Optional[Any] = ..., + aws_secret_access_key: Optional[Any] = ..., + is_secure: bool = ..., + port: Optional[Any] = ..., + proxy: Optional[Any] = ..., + proxy_port: Optional[Any] = ..., + proxy_user: Optional[Any] = ..., + proxy_pass: Optional[Any] = ..., + debug: int = ..., + https_connection_factory: Optional[Any] = ..., + path: str = ..., + provider: str = ..., + security_token: Optional[Any] = ..., + suppress_consec_slashes: bool = ..., + validate_certs: bool = ..., + profile_name: Optional[Any] = ..., + ) -> None: ... auth_region_name: Any @property def connection(self): ... @@ -99,16 +118,57 @@ class AWSAuthConnection: def get_proxy_url_with_auth(self): ... def set_host_header(self, request): ... def set_request_hook(self, hook): ... - def build_base_http_request(self, method, path, auth_path, params: Optional[Any] = ..., headers: Optional[Any] = ..., data: str = ..., host: Optional[Any] = ...): ... - def make_request(self, method, path, headers: Optional[Any] = ..., data: str = ..., host: Optional[Any] = ..., auth_path: Optional[Any] = ..., sender: Optional[Any] = ..., override_num_retries: Optional[Any] = ..., params: Optional[Any] = ..., retry_handler: Optional[Any] = ...): ... + def build_base_http_request( + self, + method, + path, + auth_path, + params: Optional[Any] = ..., + headers: Optional[Any] = ..., + data: str = ..., + host: Optional[Any] = ..., + ): ... + def make_request( + self, + method, + path, + headers: Optional[Any] = ..., + data: str = ..., + host: Optional[Any] = ..., + auth_path: Optional[Any] = ..., + sender: Optional[Any] = ..., + override_num_retries: Optional[Any] = ..., + params: Optional[Any] = ..., + retry_handler: Optional[Any] = ..., + ): ... def close(self): ... class AWSQueryConnection(AWSAuthConnection): APIVersion: str ResponseError: Any - def __init__(self, aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., is_secure: bool = ..., port: Optional[Any] = ..., proxy: Optional[Any] = ..., proxy_port: Optional[Any] = ..., proxy_user: Optional[Any] = ..., proxy_pass: Optional[Any] = ..., host: Optional[Any] = ..., debug: int = ..., https_connection_factory: Optional[Any] = ..., path: str = ..., security_token: Optional[Any] = ..., validate_certs: bool = ..., profile_name: Optional[Any] = ..., provider: str = ...) -> None: ... + def __init__( + self, + aws_access_key_id: Optional[Any] = ..., + aws_secret_access_key: Optional[Any] = ..., + is_secure: bool = ..., + port: Optional[Any] = ..., + proxy: Optional[Any] = ..., + proxy_port: Optional[Any] = ..., + proxy_user: Optional[Any] = ..., + proxy_pass: Optional[Any] = ..., + host: Optional[Any] = ..., + debug: int = ..., + https_connection_factory: Optional[Any] = ..., + path: str = ..., + security_token: Optional[Any] = ..., + validate_certs: bool = ..., + profile_name: Optional[Any] = ..., + provider: str = ..., + ) -> None: ... def get_utf8_value(self, value): ... - def make_request(self, action, params: Optional[Any] = ..., path: str = ..., verb: str = ..., *args, **kwargs): ... # type: ignore # https://github.com/python/mypy/issues/1237 + def make_request( + self, action, params: Optional[Any] = ..., path: str = ..., verb: str = ..., *args, **kwargs + ): ... # type: ignore # https://github.com/python/mypy/issues/1237 def build_list_params(self, params, items, label): ... def build_complex_list_params(self, params, items, label, names): ... def get_list(self, action, params, markers, path: str = ..., parent: Optional[Any] = ..., verb: str = ...): ... diff --git a/third_party/2and3/boto/elb/__init__.pyi b/third_party/2and3/boto/elb/__init__.pyi index 2d51f10e93e2..d2a79d5f0b46 100644 --- a/third_party/2and3/boto/elb/__init__.pyi +++ b/third_party/2and3/boto/elb/__init__.pyi @@ -12,10 +12,29 @@ class ELBConnection(AWSQueryConnection): DefaultRegionName: Any DefaultRegionEndpoint: Any region: Any - def __init__(self, aws_access_key_id=..., aws_secret_access_key=..., is_secure=..., port=..., proxy=..., proxy_port=..., proxy_user=..., proxy_pass=..., debug=..., https_connection_factory=..., region=..., path=..., security_token=..., validate_certs=..., profile_name=...) -> None: ... + def __init__( + self, + aws_access_key_id=..., + aws_secret_access_key=..., + is_secure=..., + port=..., + proxy=..., + proxy_port=..., + proxy_user=..., + proxy_pass=..., + debug=..., + https_connection_factory=..., + region=..., + path=..., + security_token=..., + validate_certs=..., + profile_name=..., + ) -> None: ... def build_list_params(self, params, items, label): ... def get_all_load_balancers(self, load_balancer_names=..., marker=...): ... - def create_load_balancer(self, name, zones, listeners=..., subnets=..., security_groups=..., scheme=..., complex_listeners=...): ... + def create_load_balancer( + self, name, zones, listeners=..., subnets=..., security_groups=..., scheme=..., complex_listeners=... + ): ... def create_load_balancer_listeners(self, name, listeners=..., complex_listeners=...): ... def delete_load_balancer(self, name): ... def delete_load_balancer_listeners(self, name, ports): ... diff --git a/third_party/2and3/boto/kms/layer1.pyi b/third_party/2and3/boto/kms/layer1.pyi index 76cca6b46a97..86c5724533b8 100644 --- a/third_party/2and3/boto/kms/layer1.pyi +++ b/third_party/2and3/boto/kms/layer1.pyi @@ -12,27 +12,71 @@ class KMSConnection(AWSQueryConnection): region: Any def __init__(self, **kwargs) -> None: ... def create_alias(self, alias_name: str, target_key_id: str) -> Optional[Dict[str, Any]]: ... - def create_grant(self, key_id: str, grantee_principal: str, retiring_principal: Optional[str] = ..., operations: Optional[List[str]] = ..., constraints: Optional[Dict[str, Dict[str, str]]] = ..., grant_tokens: Optional[List[str]] = ...) -> Optional[Dict[str, Any]]: ... - def create_key(self, policy: Optional[str] = ..., description: Optional[str] = ..., key_usage: Optional[str] = ...) -> Optional[Dict[str, Any]]: ... - def decrypt(self, ciphertext_blob: bytes, encryption_context: Optional[Mapping[str, Any]] = ..., grant_tokens: Optional[List[str]] = ...) -> Optional[Dict[str, Any]]: ... + def create_grant( + self, + key_id: str, + grantee_principal: str, + retiring_principal: Optional[str] = ..., + operations: Optional[List[str]] = ..., + constraints: Optional[Dict[str, Dict[str, str]]] = ..., + grant_tokens: Optional[List[str]] = ..., + ) -> Optional[Dict[str, Any]]: ... + def create_key( + self, policy: Optional[str] = ..., description: Optional[str] = ..., key_usage: Optional[str] = ... + ) -> Optional[Dict[str, Any]]: ... + def decrypt( + self, + ciphertext_blob: bytes, + encryption_context: Optional[Mapping[str, Any]] = ..., + grant_tokens: Optional[List[str]] = ..., + ) -> Optional[Dict[str, Any]]: ... def delete_alias(self, alias_name: str) -> Optional[Dict[str, Any]]: ... def describe_key(self, key_id: str) -> Optional[Dict[str, Any]]: ... def disable_key(self, key_id: str) -> Optional[Dict[str, Any]]: ... def disable_key_rotation(self, key_id: str) -> Optional[Dict[str, Any]]: ... def enable_key(self, key_id: str) -> Optional[Dict[str, Any]]: ... def enable_key_rotation(self, key_id: str) -> Optional[Dict[str, Any]]: ... - def encrypt(self, key_id: str, plaintext: bytes, encryption_context: Optional[Mapping[str, Any]] = ..., grant_tokens: Optional[List[str]] = ...) -> Optional[Dict[str, Any]]: ... - def generate_data_key(self, key_id: str, encryption_context: Optional[Mapping[str, Any]] = ..., number_of_bytes: Optional[int] = ..., key_spec: Optional[str] = ..., grant_tokens: Optional[List[str]] = ...) -> Optional[Dict[str, Any]]: ... - def generate_data_key_without_plaintext(self, key_id: str, encryption_context: Optional[Mapping[str, Any]] = ..., key_spec: Optional[str] = ..., number_of_bytes: Optional[int] = ..., grant_tokens: Optional[List[str]] = ...) -> Optional[Dict[str, Any]]: ... + def encrypt( + self, + key_id: str, + plaintext: bytes, + encryption_context: Optional[Mapping[str, Any]] = ..., + grant_tokens: Optional[List[str]] = ..., + ) -> Optional[Dict[str, Any]]: ... + def generate_data_key( + self, + key_id: str, + encryption_context: Optional[Mapping[str, Any]] = ..., + number_of_bytes: Optional[int] = ..., + key_spec: Optional[str] = ..., + grant_tokens: Optional[List[str]] = ..., + ) -> Optional[Dict[str, Any]]: ... + def generate_data_key_without_plaintext( + self, + key_id: str, + encryption_context: Optional[Mapping[str, Any]] = ..., + key_spec: Optional[str] = ..., + number_of_bytes: Optional[int] = ..., + grant_tokens: Optional[List[str]] = ..., + ) -> Optional[Dict[str, Any]]: ... def generate_random(self, number_of_bytes: Optional[int] = ...) -> Optional[Dict[str, Any]]: ... def get_key_policy(self, key_id: str, policy_name: str) -> Optional[Dict[str, Any]]: ... def get_key_rotation_status(self, key_id: str) -> Optional[Dict[str, Any]]: ... def list_aliases(self, limit: Optional[int] = ..., marker: Optional[str] = ...) -> Optional[Dict[str, Any]]: ... def list_grants(self, key_id: str, limit: Optional[int] = ..., marker: Optional[str] = ...) -> Optional[Dict[str, Any]]: ... - def list_key_policies(self, key_id: str, limit: Optional[int] = ..., marker: Optional[str] = ...) -> Optional[Dict[str, Any]]: ... + def list_key_policies( + self, key_id: str, limit: Optional[int] = ..., marker: Optional[str] = ... + ) -> Optional[Dict[str, Any]]: ... def list_keys(self, limit: Optional[int] = ..., marker: Optional[str] = ...) -> Optional[Dict[str, Any]]: ... def put_key_policy(self, key_id: str, policy_name: str, policy: str) -> Optional[Dict[str, Any]]: ... - def re_encrypt(self, ciphertext_blob: bytes, destination_key_id: str, source_encryption_context: Optional[Mapping[str, Any]] = ..., destination_encryption_context: Optional[Mapping[str, Any]] = ..., grant_tokens: Optional[List[str]] = ...) -> Optional[Dict[str, Any]]: ... + def re_encrypt( + self, + ciphertext_blob: bytes, + destination_key_id: str, + source_encryption_context: Optional[Mapping[str, Any]] = ..., + destination_encryption_context: Optional[Mapping[str, Any]] = ..., + grant_tokens: Optional[List[str]] = ..., + ) -> Optional[Dict[str, Any]]: ... def retire_grant(self, grant_token: str) -> Optional[Dict[str, Any]]: ... def revoke_grant(self, key_id: str, grant_id: str) -> Optional[Dict[str, Any]]: ... def update_key_description(self, key_id: str, description: str) -> Optional[Dict[str, Any]]: ... diff --git a/third_party/2and3/boto/regioninfo.pyi b/third_party/2and3/boto/regioninfo.pyi index 525b5655f761..20322edbc8f1 100644 --- a/third_party/2and3/boto/regioninfo.pyi +++ b/third_party/2and3/boto/regioninfo.pyi @@ -10,7 +10,13 @@ class RegionInfo: name: Any endpoint: Any connection_cls: Any - def __init__(self, connection: Optional[Any] = ..., name: Optional[Any] = ..., endpoint: Optional[Any] = ..., connection_cls: Optional[Any] = ...) -> None: ... + def __init__( + self, + connection: Optional[Any] = ..., + name: Optional[Any] = ..., + endpoint: Optional[Any] = ..., + connection_cls: Optional[Any] = ..., + ) -> None: ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def connect(self, **kw_params): ... diff --git a/third_party/2and3/boto/s3/__init__.pyi b/third_party/2and3/boto/s3/__init__.pyi index 9f002bbf80c0..664b71aa2221 100644 --- a/third_party/2and3/boto/s3/__init__.pyi +++ b/third_party/2and3/boto/s3/__init__.pyi @@ -6,7 +6,13 @@ from boto.regioninfo import RegionInfo from .connection import S3Connection class S3RegionInfo(RegionInfo): - def connect(self, name: Optional[Text] = ..., endpoint: Optional[str] = ..., connection_cls: Optional[Type[AWSAuthConnection]] = ..., **kw_params) -> S3Connection: ... + def connect( + self, + name: Optional[Text] = ..., + endpoint: Optional[str] = ..., + connection_cls: Optional[Type[AWSAuthConnection]] = ..., + **kw_params + ) -> S3Connection: ... def regions() -> List[S3RegionInfo]: ... def connect_to_region(region_name: Text, **kw_params): ... diff --git a/third_party/2and3/boto/s3/acl.pyi b/third_party/2and3/boto/s3/acl.pyi index a8fe6119baa0..2afabb751bf1 100644 --- a/third_party/2and3/boto/s3/acl.pyi +++ b/third_party/2and3/boto/s3/acl.pyi @@ -34,7 +34,15 @@ class Grant: uri: Text email_address: Text type: Text - def __init__(self, permission: Optional[Text] = ..., type: Optional[Text] = ..., id: Optional[Text] = ..., display_name: Optional[Text] = ..., uri: Optional[Text] = ..., email_address: Optional[Text] = ...) -> None: ... + def __init__( + self, + permission: Optional[Text] = ..., + type: Optional[Text] = ..., + id: Optional[Text] = ..., + display_name: Optional[Text] = ..., + uri: Optional[Text] = ..., + email_address: Optional[Text] = ..., + ) -> None: ... def startElement(self, name, attrs, connection): ... def endElement(self, name: Text, value: Any, connection: S3Connection) -> None: ... def to_xml(self) -> str: ... diff --git a/third_party/2and3/boto/s3/bucket.pyi b/third_party/2and3/boto/s3/bucket.pyi index a59a6c5f341a..f92818ff6e3a 100644 --- a/third_party/2and3/boto/s3/bucket.pyi +++ b/third_party/2and3/boto/s3/bucket.pyi @@ -20,7 +20,9 @@ class Bucket: name: Text connection: S3Connection key_class: Type[Key] - def __init__(self, connection: Optional[S3Connection] = ..., name: Optional[Text] = ..., key_class: Type[Key] = ...) -> None: ... + def __init__( + self, connection: Optional[S3Connection] = ..., name: Optional[Text] = ..., key_class: Type[Key] = ... + ) -> None: ... def __iter__(self): ... def __contains__(self, key_name) -> bool: ... def startElement(self, name, attrs, connection): ... @@ -28,45 +30,128 @@ class Bucket: def endElement(self, name, value, connection): ... def set_key_class(self, key_class): ... def lookup(self, key_name, headers: Optional[Dict[Text, Text]] = ...): ... - def get_key(self, key_name, headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ..., response_headers: Optional[Dict[Text, Text]] = ..., validate: bool = ...) -> Key: ... - def list(self, prefix: Text = ..., delimiter: Text = ..., marker: Text = ..., headers: Optional[Dict[Text, Text]] = ..., encoding_type: Optional[Any] = ...) -> BucketListResultSet: ... - def list_versions(self, prefix: str = ..., delimiter: str = ..., key_marker: str = ..., version_id_marker: str = ..., headers: Optional[Dict[Text, Text]] = ..., encoding_type: Optional[Text] = ...) -> BucketListResultSet: ... - def list_multipart_uploads(self, key_marker: str = ..., upload_id_marker: str = ..., headers: Optional[Dict[Text, Text]] = ..., encoding_type: Optional[Any] = ...): ... + def get_key( + self, + key_name, + headers: Optional[Dict[Text, Text]] = ..., + version_id: Optional[Any] = ..., + response_headers: Optional[Dict[Text, Text]] = ..., + validate: bool = ..., + ) -> Key: ... + def list( + self, + prefix: Text = ..., + delimiter: Text = ..., + marker: Text = ..., + headers: Optional[Dict[Text, Text]] = ..., + encoding_type: Optional[Any] = ..., + ) -> BucketListResultSet: ... + def list_versions( + self, + prefix: str = ..., + delimiter: str = ..., + key_marker: str = ..., + version_id_marker: str = ..., + headers: Optional[Dict[Text, Text]] = ..., + encoding_type: Optional[Text] = ..., + ) -> BucketListResultSet: ... + def list_multipart_uploads( + self, + key_marker: str = ..., + upload_id_marker: str = ..., + headers: Optional[Dict[Text, Text]] = ..., + encoding_type: Optional[Any] = ..., + ): ... def validate_kwarg_names(self, kwargs, names): ... def get_all_keys(self, headers: Optional[Dict[Text, Text]] = ..., **params): ... def get_all_versions(self, headers: Optional[Dict[Text, Text]] = ..., **params): ... def validate_get_all_versions_params(self, params): ... def get_all_multipart_uploads(self, headers: Optional[Dict[Text, Text]] = ..., **params): ... def new_key(self, key_name: Optional[Any] = ...): ... - def generate_url(self, expires_in, method: str = ..., headers: Optional[Dict[Text, Text]] = ..., force_http: bool = ..., response_headers: Optional[Dict[Text, Text]] = ..., expires_in_absolute: bool = ...): ... + def generate_url( + self, + expires_in, + method: str = ..., + headers: Optional[Dict[Text, Text]] = ..., + force_http: bool = ..., + response_headers: Optional[Dict[Text, Text]] = ..., + expires_in_absolute: bool = ..., + ): ... def delete_keys(self, keys, quiet: bool = ..., mfa_token: Optional[Any] = ..., headers: Optional[Dict[Text, Text]] = ...): ... - def delete_key(self, key_name, headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ..., mfa_token: Optional[Any] = ...): ... - def copy_key(self, new_key_name, src_bucket_name, src_key_name, metadata: Optional[Any] = ..., src_version_id: Optional[Any] = ..., storage_class: str = ..., preserve_acl: bool = ..., encrypt_key: bool = ..., headers: Optional[Dict[Text, Text]] = ..., query_args: Optional[Any] = ...): ... - def set_canned_acl(self, acl_str, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ...): ... + def delete_key( + self, key_name, headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ..., mfa_token: Optional[Any] = ... + ): ... + def copy_key( + self, + new_key_name, + src_bucket_name, + src_key_name, + metadata: Optional[Any] = ..., + src_version_id: Optional[Any] = ..., + storage_class: str = ..., + preserve_acl: bool = ..., + encrypt_key: bool = ..., + headers: Optional[Dict[Text, Text]] = ..., + query_args: Optional[Any] = ..., + ): ... + def set_canned_acl( + self, acl_str, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ... + ): ... def get_xml_acl(self, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ...): ... - def set_xml_acl(self, acl_str, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ..., query_args: str = ...): ... - def set_acl(self, acl_or_str, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ...): ... + def set_xml_acl( + self, + acl_str, + key_name: str = ..., + headers: Optional[Dict[Text, Text]] = ..., + version_id: Optional[Any] = ..., + query_args: str = ..., + ): ... + def set_acl( + self, acl_or_str, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ... + ): ... def get_acl(self, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ...): ... - def set_subresource(self, subresource, value, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ...): ... - def get_subresource(self, subresource, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ...): ... + def set_subresource( + self, subresource, value, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ... + ): ... + def get_subresource( + self, subresource, key_name: str = ..., headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ... + ): ... def make_public(self, recursive: bool = ..., headers: Optional[Dict[Text, Text]] = ...): ... def add_email_grant(self, permission, email_address, recursive: bool = ..., headers: Optional[Dict[Text, Text]] = ...): ... - def add_user_grant(self, permission, user_id, recursive: bool = ..., headers: Optional[Dict[Text, Text]] = ..., display_name: Optional[Any] = ...): ... + def add_user_grant( + self, + permission, + user_id, + recursive: bool = ..., + headers: Optional[Dict[Text, Text]] = ..., + display_name: Optional[Any] = ..., + ): ... def list_grants(self, headers: Optional[Dict[Text, Text]] = ...): ... def get_location(self): ... def set_xml_logging(self, logging_str, headers: Optional[Dict[Text, Text]] = ...): ... - def enable_logging(self, target_bucket, target_prefix: str = ..., grants: Optional[Any] = ..., headers: Optional[Dict[Text, Text]] = ...): ... + def enable_logging( + self, target_bucket, target_prefix: str = ..., grants: Optional[Any] = ..., headers: Optional[Dict[Text, Text]] = ... + ): ... def disable_logging(self, headers: Optional[Dict[Text, Text]] = ...): ... def get_logging_status(self, headers: Optional[Dict[Text, Text]] = ...): ... def set_as_logging_target(self, headers: Optional[Dict[Text, Text]] = ...): ... def get_request_payment(self, headers: Optional[Dict[Text, Text]] = ...): ... def set_request_payment(self, payer: str = ..., headers: Optional[Dict[Text, Text]] = ...): ... - def configure_versioning(self, versioning, mfa_delete: bool = ..., mfa_token: Optional[Any] = ..., headers: Optional[Dict[Text, Text]] = ...): ... + def configure_versioning( + self, versioning, mfa_delete: bool = ..., mfa_token: Optional[Any] = ..., headers: Optional[Dict[Text, Text]] = ... + ): ... def get_versioning_status(self, headers: Optional[Dict[Text, Text]] = ...): ... def configure_lifecycle(self, lifecycle_config, headers: Optional[Dict[Text, Text]] = ...): ... def get_lifecycle_config(self, headers: Optional[Dict[Text, Text]] = ...): ... def delete_lifecycle_configuration(self, headers: Optional[Dict[Text, Text]] = ...): ... - def configure_website(self, suffix: Optional[Any] = ..., error_key: Optional[Any] = ..., redirect_all_requests_to: Optional[Any] = ..., routing_rules: Optional[Any] = ..., headers: Optional[Dict[Text, Text]] = ...): ... + def configure_website( + self, + suffix: Optional[Any] = ..., + error_key: Optional[Any] = ..., + redirect_all_requests_to: Optional[Any] = ..., + routing_rules: Optional[Any] = ..., + headers: Optional[Dict[Text, Text]] = ..., + ): ... def set_website_configuration(self, config, headers: Optional[Dict[Text, Text]] = ...): ... def set_website_configuration_xml(self, xml, headers: Optional[Dict[Text, Text]] = ...): ... def get_website_configuration(self, headers: Optional[Dict[Text, Text]] = ...): ... @@ -83,7 +168,15 @@ class Bucket: def get_cors_xml(self, headers: Optional[Dict[Text, Text]] = ...): ... def get_cors(self, headers: Optional[Dict[Text, Text]] = ...): ... def delete_cors(self, headers: Optional[Dict[Text, Text]] = ...): ... - def initiate_multipart_upload(self, key_name, headers: Optional[Dict[Text, Text]] = ..., reduced_redundancy: bool = ..., metadata: Optional[Any] = ..., encrypt_key: bool = ..., policy: Optional[Any] = ...): ... + def initiate_multipart_upload( + self, + key_name, + headers: Optional[Dict[Text, Text]] = ..., + reduced_redundancy: bool = ..., + metadata: Optional[Any] = ..., + encrypt_key: bool = ..., + policy: Optional[Any] = ..., + ): ... def complete_multipart_upload(self, key_name, upload_id, xml_body, headers: Optional[Dict[Text, Text]] = ...): ... def cancel_multipart_upload(self, key_name, upload_id, headers: Optional[Dict[Text, Text]] = ...): ... def delete(self, headers: Optional[Dict[Text, Text]] = ...): ... diff --git a/third_party/2and3/boto/s3/bucketlistresultset.pyi b/third_party/2and3/boto/s3/bucketlistresultset.pyi index 8cef08317b2d..40a33d8af078 100644 --- a/third_party/2and3/boto/s3/bucketlistresultset.pyi +++ b/third_party/2and3/boto/s3/bucketlistresultset.pyi @@ -3,7 +3,14 @@ from typing import Any, Iterable, Iterator, Optional from .bucket import Bucket from .key import Key -def bucket_lister(bucket, prefix: str = ..., delimiter: str = ..., marker: str = ..., headers: Optional[Any] = ..., encoding_type: Optional[Any] = ...): ... +def bucket_lister( + bucket, + prefix: str = ..., + delimiter: str = ..., + marker: str = ..., + headers: Optional[Any] = ..., + encoding_type: Optional[Any] = ..., +): ... class BucketListResultSet(Iterable[Key]): bucket: Any @@ -12,10 +19,26 @@ class BucketListResultSet(Iterable[Key]): marker: Any headers: Any encoding_type: Any - def __init__(self, bucket: Optional[Any] = ..., prefix: str = ..., delimiter: str = ..., marker: str = ..., headers: Optional[Any] = ..., encoding_type: Optional[Any] = ...) -> None: ... + def __init__( + self, + bucket: Optional[Any] = ..., + prefix: str = ..., + delimiter: str = ..., + marker: str = ..., + headers: Optional[Any] = ..., + encoding_type: Optional[Any] = ..., + ) -> None: ... def __iter__(self) -> Iterator[Key]: ... -def versioned_bucket_lister(bucket, prefix: str = ..., delimiter: str = ..., key_marker: str = ..., version_id_marker: str = ..., headers: Optional[Any] = ..., encoding_type: Optional[Any] = ...): ... +def versioned_bucket_lister( + bucket, + prefix: str = ..., + delimiter: str = ..., + key_marker: str = ..., + version_id_marker: str = ..., + headers: Optional[Any] = ..., + encoding_type: Optional[Any] = ..., +): ... class VersionedBucketListResultSet: bucket: Any @@ -25,10 +48,21 @@ class VersionedBucketListResultSet: version_id_marker: Any headers: Any encoding_type: Any - def __init__(self, bucket: Optional[Any] = ..., prefix: str = ..., delimiter: str = ..., key_marker: str = ..., version_id_marker: str = ..., headers: Optional[Any] = ..., encoding_type: Optional[Any] = ...) -> None: ... + def __init__( + self, + bucket: Optional[Any] = ..., + prefix: str = ..., + delimiter: str = ..., + key_marker: str = ..., + version_id_marker: str = ..., + headers: Optional[Any] = ..., + encoding_type: Optional[Any] = ..., + ) -> None: ... def __iter__(self) -> Iterator[Key]: ... -def multipart_upload_lister(bucket, key_marker: str = ..., upload_id_marker: str = ..., headers: Optional[Any] = ..., encoding_type: Optional[Any] = ...): ... +def multipart_upload_lister( + bucket, key_marker: str = ..., upload_id_marker: str = ..., headers: Optional[Any] = ..., encoding_type: Optional[Any] = ... +): ... class MultiPartUploadListResultSet: bucket: Any @@ -36,5 +70,12 @@ class MultiPartUploadListResultSet: upload_id_marker: Any headers: Any encoding_type: Any - def __init__(self, bucket: Optional[Any] = ..., key_marker: str = ..., upload_id_marker: str = ..., headers: Optional[Any] = ..., encoding_type: Optional[Any] = ...) -> None: ... + def __init__( + self, + bucket: Optional[Any] = ..., + key_marker: str = ..., + upload_id_marker: str = ..., + headers: Optional[Any] = ..., + encoding_type: Optional[Any] = ..., + ) -> None: ... def __iter__(self): ... diff --git a/third_party/2and3/boto/s3/connection.pyi b/third_party/2and3/boto/s3/connection.pyi index f3de639020c6..c24b782bd0dd 100644 --- a/third_party/2and3/boto/s3/connection.pyi +++ b/third_party/2and3/boto/s3/connection.pyi @@ -50,19 +50,92 @@ class S3Connection(AWSAuthConnection): calling_format: Any bucket_class: Type[Bucket] anon: Any - def __init__(self, aws_access_key_id: Optional[Any] = ..., aws_secret_access_key: Optional[Any] = ..., is_secure: bool = ..., port: Optional[Any] = ..., proxy: Optional[Any] = ..., proxy_port: Optional[Any] = ..., proxy_user: Optional[Any] = ..., proxy_pass: Optional[Any] = ..., host: Any = ..., debug: int = ..., https_connection_factory: Optional[Any] = ..., calling_format: Any = ..., path: str = ..., provider: str = ..., bucket_class: Type[Bucket] = ..., security_token: Optional[Any] = ..., suppress_consec_slashes: bool = ..., anon: bool = ..., validate_certs: Optional[Any] = ..., profile_name: Optional[Any] = ...) -> None: ... + def __init__( + self, + aws_access_key_id: Optional[Any] = ..., + aws_secret_access_key: Optional[Any] = ..., + is_secure: bool = ..., + port: Optional[Any] = ..., + proxy: Optional[Any] = ..., + proxy_port: Optional[Any] = ..., + proxy_user: Optional[Any] = ..., + proxy_pass: Optional[Any] = ..., + host: Any = ..., + debug: int = ..., + https_connection_factory: Optional[Any] = ..., + calling_format: Any = ..., + path: str = ..., + provider: str = ..., + bucket_class: Type[Bucket] = ..., + security_token: Optional[Any] = ..., + suppress_consec_slashes: bool = ..., + anon: bool = ..., + validate_certs: Optional[Any] = ..., + profile_name: Optional[Any] = ..., + ) -> None: ... def __iter__(self): ... def __contains__(self, bucket_name): ... def set_bucket_class(self, bucket_class: Type[Bucket]) -> None: ... def build_post_policy(self, expiration_time, conditions): ... - def build_post_form_args(self, bucket_name, key, expires_in: int = ..., acl: Optional[Any] = ..., success_action_redirect: Optional[Any] = ..., max_content_length: Optional[Any] = ..., http_method: str = ..., fields: Optional[Any] = ..., conditions: Optional[Any] = ..., storage_class: str = ..., server_side_encryption: Optional[Any] = ...): ... - def generate_url_sigv4(self, expires_in, method, bucket: str = ..., key: str = ..., headers: Optional[Dict[Text, Text]] = ..., force_http: bool = ..., response_headers: Optional[Dict[Text, Text]] = ..., version_id: Optional[Any] = ..., iso_date: Optional[Any] = ...): ... - def generate_url(self, expires_in, method, bucket: str = ..., key: str = ..., headers: Optional[Dict[Text, Text]] = ..., query_auth: bool = ..., force_http: bool = ..., response_headers: Optional[Dict[Text, Text]] = ..., expires_in_absolute: bool = ..., version_id: Optional[Any] = ...): ... + def build_post_form_args( + self, + bucket_name, + key, + expires_in: int = ..., + acl: Optional[Any] = ..., + success_action_redirect: Optional[Any] = ..., + max_content_length: Optional[Any] = ..., + http_method: str = ..., + fields: Optional[Any] = ..., + conditions: Optional[Any] = ..., + storage_class: str = ..., + server_side_encryption: Optional[Any] = ..., + ): ... + def generate_url_sigv4( + self, + expires_in, + method, + bucket: str = ..., + key: str = ..., + headers: Optional[Dict[Text, Text]] = ..., + force_http: bool = ..., + response_headers: Optional[Dict[Text, Text]] = ..., + version_id: Optional[Any] = ..., + iso_date: Optional[Any] = ..., + ): ... + def generate_url( + self, + expires_in, + method, + bucket: str = ..., + key: str = ..., + headers: Optional[Dict[Text, Text]] = ..., + query_auth: bool = ..., + force_http: bool = ..., + response_headers: Optional[Dict[Text, Text]] = ..., + expires_in_absolute: bool = ..., + version_id: Optional[Any] = ..., + ): ... def get_all_buckets(self, headers: Optional[Dict[Text, Text]] = ...): ... def get_canonical_user_id(self, headers: Optional[Dict[Text, Text]] = ...): ... def get_bucket(self, bucket_name: Text, validate: bool = ..., headers: Optional[Dict[Text, Text]] = ...) -> Bucket: ... def head_bucket(self, bucket_name, headers: Optional[Dict[Text, Text]] = ...): ... def lookup(self, bucket_name, validate: bool = ..., headers: Optional[Dict[Text, Text]] = ...): ... - def create_bucket(self, bucket_name, headers: Optional[Dict[Text, Text]] = ..., location: Any = ..., policy: Optional[Any] = ...): ... + def create_bucket( + self, bucket_name, headers: Optional[Dict[Text, Text]] = ..., location: Any = ..., policy: Optional[Any] = ... + ): ... def delete_bucket(self, bucket, headers: Optional[Dict[Text, Text]] = ...): ... - def make_request(self, method, bucket: str = ..., key: str = ..., headers: Optional[Any] = ..., data: str = ..., query_args: Optional[Any] = ..., sender: Optional[Any] = ..., override_num_retries: Optional[Any] = ..., retry_handler: Optional[Any] = ..., *args, **kwargs): ... # type: ignore # https://github.com/python/mypy/issues/1237 + def make_request( + self, + method, + bucket: str = ..., + key: str = ..., + headers: Optional[Any] = ..., + data: str = ..., + query_args: Optional[Any] = ..., + sender: Optional[Any] = ..., + override_num_retries: Optional[Any] = ..., + retry_handler: Optional[Any] = ..., + *args, + **kwargs + ): ... # type: ignore # https://github.com/python/mypy/issues/1237 diff --git a/third_party/2and3/boto/s3/cors.pyi b/third_party/2and3/boto/s3/cors.pyi index 6ffe8ee6d9d7..d960536d7ef8 100644 --- a/third_party/2and3/boto/s3/cors.pyi +++ b/third_party/2and3/boto/s3/cors.pyi @@ -7,7 +7,15 @@ class CORSRule: allowed_header: Any max_age_seconds: Any expose_header: Any - def __init__(self, allowed_method: Optional[Any] = ..., allowed_origin: Optional[Any] = ..., id: Optional[Any] = ..., allowed_header: Optional[Any] = ..., max_age_seconds: Optional[Any] = ..., expose_header: Optional[Any] = ...) -> None: ... + def __init__( + self, + allowed_method: Optional[Any] = ..., + allowed_origin: Optional[Any] = ..., + id: Optional[Any] = ..., + allowed_header: Optional[Any] = ..., + max_age_seconds: Optional[Any] = ..., + expose_header: Optional[Any] = ..., + ) -> None: ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def to_xml(self) -> str: ... @@ -16,4 +24,12 @@ class CORSConfiguration(list): def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def to_xml(self) -> str: ... - def add_rule(self, allowed_method, allowed_origin, id: Optional[Any] = ..., allowed_header: Optional[Any] = ..., max_age_seconds: Optional[Any] = ..., expose_header: Optional[Any] = ...): ... + def add_rule( + self, + allowed_method, + allowed_origin, + id: Optional[Any] = ..., + allowed_header: Optional[Any] = ..., + max_age_seconds: Optional[Any] = ..., + expose_header: Optional[Any] = ..., + ): ... diff --git a/third_party/2and3/boto/s3/key.pyi b/third_party/2and3/boto/s3/key.pyi index 4200e7abd9d3..179b49479293 100644 --- a/third_party/2and3/boto/s3/key.pyi +++ b/third_party/2and3/boto/s3/key.pyi @@ -222,7 +222,8 @@ class Key: torrent: bool = ..., version_id: Optional[Any] = ..., response_headers: Optional[Dict[Text, Text]] = ..., - *, encoding: Text, + *, + encoding: Text, ) -> Text: ... def add_email_grant(self, permission, email_address, headers: Optional[Dict[Text, Text]] = ...): ... def add_user_grant( diff --git a/third_party/2and3/boto/s3/lifecycle.pyi b/third_party/2and3/boto/s3/lifecycle.pyi index 0b775efc03f6..5c6e37507087 100644 --- a/third_party/2and3/boto/s3/lifecycle.pyi +++ b/third_party/2and3/boto/s3/lifecycle.pyi @@ -6,7 +6,14 @@ class Rule: status: Any expiration: Any transition: Any - def __init__(self, id: Optional[Any] = ..., prefix: Optional[Any] = ..., status: Optional[Any] = ..., expiration: Optional[Any] = ..., transition: Optional[Any] = ...) -> None: ... + def __init__( + self, + id: Optional[Any] = ..., + prefix: Optional[Any] = ..., + status: Optional[Any] = ..., + expiration: Optional[Any] = ..., + transition: Optional[Any] = ..., + ) -> None: ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def to_xml(self): ... @@ -48,4 +55,11 @@ class Lifecycle(list): def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def to_xml(self): ... - def add_rule(self, id: Optional[Any] = ..., prefix: str = ..., status: str = ..., expiration: Optional[Any] = ..., transition: Optional[Any] = ...): ... + def add_rule( + self, + id: Optional[Any] = ..., + prefix: str = ..., + status: str = ..., + expiration: Optional[Any] = ..., + transition: Optional[Any] = ..., + ): ... diff --git a/third_party/2and3/boto/s3/multidelete.pyi b/third_party/2and3/boto/s3/multidelete.pyi index fa0c8dd30f0f..b7f91651b0da 100644 --- a/third_party/2and3/boto/s3/multidelete.pyi +++ b/third_party/2and3/boto/s3/multidelete.pyi @@ -5,7 +5,13 @@ class Deleted: version_id: Any delete_marker: Any delete_marker_version_id: Any - def __init__(self, key: Optional[Any] = ..., version_id: Optional[Any] = ..., delete_marker: bool = ..., delete_marker_version_id: Optional[Any] = ...) -> None: ... + def __init__( + self, + key: Optional[Any] = ..., + version_id: Optional[Any] = ..., + delete_marker: bool = ..., + delete_marker_version_id: Optional[Any] = ..., + ) -> None: ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... @@ -14,7 +20,9 @@ class Error: version_id: Any code: Any message: Any - def __init__(self, key: Optional[Any] = ..., version_id: Optional[Any] = ..., code: Optional[Any] = ..., message: Optional[Any] = ...) -> None: ... + def __init__( + self, key: Optional[Any] = ..., version_id: Optional[Any] = ..., code: Optional[Any] = ..., message: Optional[Any] = ... + ) -> None: ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... diff --git a/third_party/2and3/boto/s3/multipart.pyi b/third_party/2and3/boto/s3/multipart.pyi index 8463c4ddbc32..f7dd85d43b61 100644 --- a/third_party/2and3/boto/s3/multipart.pyi +++ b/third_party/2and3/boto/s3/multipart.pyi @@ -42,8 +42,29 @@ class MultiPartUpload: def to_xml(self): ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... - def get_all_parts(self, max_parts: Optional[Any] = ..., part_number_marker: Optional[Any] = ..., encoding_type: Optional[Any] = ...): ... - def upload_part_from_file(self, fp, part_num, headers: Optional[Any] = ..., replace: bool = ..., cb: Optional[Any] = ..., num_cb: int = ..., md5: Optional[Any] = ..., size: Optional[Any] = ...): ... - def copy_part_from_key(self, src_bucket_name, src_key_name, part_num, start: Optional[Any] = ..., end: Optional[Any] = ..., src_version_id: Optional[Any] = ..., headers: Optional[Any] = ...): ... + def get_all_parts( + self, max_parts: Optional[Any] = ..., part_number_marker: Optional[Any] = ..., encoding_type: Optional[Any] = ... + ): ... + def upload_part_from_file( + self, + fp, + part_num, + headers: Optional[Any] = ..., + replace: bool = ..., + cb: Optional[Any] = ..., + num_cb: int = ..., + md5: Optional[Any] = ..., + size: Optional[Any] = ..., + ): ... + def copy_part_from_key( + self, + src_bucket_name, + src_key_name, + part_num, + start: Optional[Any] = ..., + end: Optional[Any] = ..., + src_version_id: Optional[Any] = ..., + headers: Optional[Any] = ..., + ): ... def complete_upload(self): ... def cancel_upload(self): ... diff --git a/third_party/2and3/boto/s3/website.pyi b/third_party/2and3/boto/s3/website.pyi index 2a92866307ea..9e8376994bdc 100644 --- a/third_party/2and3/boto/s3/website.pyi +++ b/third_party/2and3/boto/s3/website.pyi @@ -7,7 +7,13 @@ class WebsiteConfiguration: error_key: Any redirect_all_requests_to: Any routing_rules: Any - def __init__(self, suffix: Optional[Any] = ..., error_key: Optional[Any] = ..., redirect_all_requests_to: Optional[Any] = ..., routing_rules: Optional[Any] = ...) -> None: ... + def __init__( + self, + suffix: Optional[Any] = ..., + error_key: Optional[Any] = ..., + redirect_all_requests_to: Optional[Any] = ..., + routing_rules: Optional[Any] = ..., + ) -> None: ... def startElement(self, name, attrs, connection): ... def endElement(self, name, value, connection): ... def to_xml(self): ... @@ -42,7 +48,14 @@ class RoutingRule: def to_xml(self): ... @classmethod def when(cls, key_prefix: Optional[Any] = ..., http_error_code: Optional[Any] = ...): ... - def then_redirect(self, hostname: Optional[Any] = ..., protocol: Optional[Any] = ..., replace_key: Optional[Any] = ..., replace_key_prefix: Optional[Any] = ..., http_redirect_code: Optional[Any] = ...): ... + def then_redirect( + self, + hostname: Optional[Any] = ..., + protocol: Optional[Any] = ..., + replace_key: Optional[Any] = ..., + replace_key_prefix: Optional[Any] = ..., + http_redirect_code: Optional[Any] = ..., + ): ... class Condition(_XMLKeyValue): TRANSLATOR: Any @@ -58,5 +71,12 @@ class Redirect(_XMLKeyValue): replace_key: Any replace_key_prefix: Any http_redirect_code: Any - def __init__(self, hostname: Optional[Any] = ..., protocol: Optional[Any] = ..., replace_key: Optional[Any] = ..., replace_key_prefix: Optional[Any] = ..., http_redirect_code: Optional[Any] = ...) -> None: ... + def __init__( + self, + hostname: Optional[Any] = ..., + protocol: Optional[Any] = ..., + replace_key: Optional[Any] = ..., + replace_key_prefix: Optional[Any] = ..., + http_redirect_code: Optional[Any] = ..., + ) -> None: ... def to_xml(self): ... diff --git a/third_party/2and3/boto/utils.pyi b/third_party/2and3/boto/utils.pyi index 84caa60dfc4d..3ece865d9926 100644 --- a/third_party/2and3/boto/utils.pyi +++ b/third_party/2and3/boto/utils.pyi @@ -22,24 +22,28 @@ from typing import ( import boto.connection -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") if sys.version_info[0] >= 3: # TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO import io + _StringIO = io.StringIO from hashlib import _Hash + _HashType = _Hash from email.message import Message as _Message else: # TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO import StringIO + _StringIO = StringIO.StringIO from hashlib import _hash + _HashType = _hash # TODO use email.message.Message once stubs exist @@ -48,11 +52,9 @@ else: _Provider = Any # TODO replace this with boto.provider.Provider once stubs exist _LockType = Any # TODO replace this with _thread.LockType once stubs exist - JSONDecodeError: Type[ValueError] qsa_of_interest: List[str] - def unquote_v(nv: str) -> Union[str, Tuple[str, str]]: ... def canonical_string( method: str, @@ -62,48 +64,22 @@ def canonical_string( provider: Optional[_Provider] = ..., ) -> str: ... def merge_meta( - headers: Mapping[str, str], - metadata: Mapping[str, str], - provider: Optional[_Provider] = ..., + headers: Mapping[str, str], metadata: Mapping[str, str], provider: Optional[_Provider] = ... ) -> Mapping[str, str]: ... -def get_aws_metadata( - headers: Mapping[str, str], - provider: Optional[_Provider] = ..., -) -> Mapping[str, str]: ... -def retry_url( - url: str, - retry_on_404: bool = ..., - num_retries: int = ..., - timeout: Optional[int] = ..., -) -> str: ... +def get_aws_metadata(headers: Mapping[str, str], provider: Optional[_Provider] = ...) -> Mapping[str, str]: ... +def retry_url(url: str, retry_on_404: bool = ..., num_retries: int = ..., timeout: Optional[int] = ...) -> str: ... class LazyLoadMetadata(Dict[_KT, _VT]): - def __init__( - self, - url: str, - num_retries: int, - timeout: Optional[int] = ..., - ) -> None: ... + def __init__(self, url: str, num_retries: int, timeout: Optional[int] = ...) -> None: ... def get_instance_metadata( - version: str = ..., - url: str = ..., - data: str = ..., - timeout: Optional[int] = ..., - num_retries: int = ..., + version: str = ..., url: str = ..., data: str = ..., timeout: Optional[int] = ..., num_retries: int = ... ) -> Optional[LazyLoadMetadata]: ... def get_instance_identity( - version: str = ..., - url: str = ..., - timeout: Optional[int] = ..., - num_retries: int = ..., + version: str = ..., url: str = ..., timeout: Optional[int] = ..., num_retries: int = ... ) -> Optional[Mapping[str, Any]]: ... def get_instance_userdata( - version: str = ..., - sep: Optional[str] = ..., - url: str = ..., - timeout: Optional[int] = ..., - num_retries: int = ..., + version: str = ..., sep: Optional[str] = ..., url: str = ..., timeout: Optional[int] = ..., num_retries: int = ... ) -> Mapping[str, str]: ... ISO8601: str @@ -117,10 +93,7 @@ def parse_ts(ts: str) -> datetime.datetime: ... def find_class(module_name: str, class_name: Optional[str] = ...) -> Optional[Type[Any]]: ... def update_dme(username: str, password: str, dme_id: str, ip_address: str) -> str: ... def fetch_file( - uri: str, - file: Optional[IO[str]] = ..., - username: Optional[str] = ..., - password: Optional[str] = ..., + uri: str, file: Optional[IO[str]] = ..., username: Optional[str] = ..., password: Optional[str] = ... ) -> Optional[IO[str]]: ... class ShellCommand: @@ -129,38 +102,22 @@ class ShellCommand: log_fp: _StringIO wait: bool fail_fast: bool - def __init__( - self, - command: subprocess._CMD, - wait: bool = ..., - fail_fast: bool = ..., - cwd: Optional[subprocess._TXT] = ..., + self, command: subprocess._CMD, wait: bool = ..., fail_fast: bool = ..., cwd: Optional[subprocess._TXT] = ... ) -> None: ... - process: subprocess.Popen - def run(self, cwd: Optional[subprocess._CMD] = ...) -> Optional[int]: ... def setReadOnly(self, value) -> None: ... def getStatus(self) -> Optional[int]: ... - status: Optional[int] - def getOutput(self) -> str: ... - output: str class AuthSMTPHandler(logging.handlers.SMTPHandler): username: str password: str def __init__( - self, - mailhost: str, - username: str, - password: str, - fromaddr: str, - toaddrs: Sequence[str], - subject: str, + self, mailhost: str, username: str, password: str, fromaddr: str, toaddrs: Sequence[str], subject: str ) -> None: ... class LRUCache(Dict[_KT, _VT]): @@ -170,27 +127,19 @@ class LRUCache(Dict[_KT, _VT]): key = ... value = ... def __init__(self, key, value) -> None: ... - _dict: Dict[_KT, LRUCache._Item] capacity: int head: Optional[LRUCache._Item] tail: Optional[LRUCache._Item] - def __init__(self, capacity: int) -> None: ... - # This exists to work around Password.str's name shadowing the str type _str = str class Password: hashfunc: Callable[[bytes], _HashType] str: Optional[_str] - - def __init__( - self, - str: Optional[_str] = ..., - hashfunc: Optional[Callable[[bytes], _HashType]] = ..., - ) -> None: ... + def __init__(self, str: Optional[_str] = ..., hashfunc: Optional[Callable[[bytes], _HashType]] = ...) -> None: ... def set(self, value: Union[bytes, _str]) -> None: ... def __eq__(self, other: Any) -> bool: ... def __len__(self) -> int: ... @@ -207,32 +156,19 @@ def get_utf8_value(value: str) -> bytes: ... def mklist(value: Any) -> List: ... def pythonize_name(name: str) -> str: ... def write_mime_multipart( - content: List[Tuple[str, str]], - compress: bool = ..., - deftype: str = ..., - delimiter: str = ..., + content: List[Tuple[str, str]], compress: bool = ..., deftype: str = ..., delimiter: str = ... ) -> str: ... def guess_mime_type(content: str, deftype: str) -> str: ... -def compute_md5( - fp: IO[Any], - buf_size: int = ..., - size: Optional[int] = ..., -) -> Tuple[str, str, int]: ... +def compute_md5(fp: IO[Any], buf_size: int = ..., size: Optional[int] = ...) -> Tuple[str, str, int]: ... def compute_hash( - fp: IO[Any], - buf_size: int = ..., - size: Optional[int] = ..., - hash_algorithm: Any = ..., + fp: IO[Any], buf_size: int = ..., size: Optional[int] = ..., hash_algorithm: Any = ... ) -> Tuple[str, str, int]: ... def find_matching_headers(name: str, headers: Mapping[str, Optional[str]]) -> List[str]: ... def merge_headers_by_name(name: str, headers: Mapping[str, Optional[str]]) -> str: ... class RequestHook: def handle_request_data( - self, - request: boto.connection.HTTPRequest, - response: boto.connection.HTTPResponse, - error: bool = ..., + self, request: boto.connection.HTTPRequest, response: boto.connection.HTTPResponse, error: bool = ... ) -> Any: ... def host_is_ipv6(hostname: str) -> bool: ... diff --git a/third_party/2and3/characteristic/__init__.pyi b/third_party/2and3/characteristic/__init__.pyi index 4a7bd639c78e..60b346a77662 100644 --- a/third_party/2and3/characteristic/__init__.pyi +++ b/third_party/2and3/characteristic/__init__.pyi @@ -4,12 +4,11 @@ def with_repr(attrs: Sequence[Union[AnyStr, Attribute]]) -> Callable[..., Any]: def with_cmp(attrs: Sequence[Union[AnyStr, Attribute]]) -> Callable[..., Any]: ... def with_init(attrs: Sequence[Union[AnyStr, Attribute]]) -> Callable[..., Any]: ... def immutable(attrs: Sequence[Union[AnyStr, Attribute]]) -> Callable[..., Any]: ... - def strip_leading_underscores(attribute_name: AnyStr) -> AnyStr: ... NOTHING = Any -_T = TypeVar('_T') +_T = TypeVar("_T") def attributes( attrs: Sequence[Union[AnyStr, Attribute]], @@ -18,7 +17,8 @@ def attributes( apply_with_repr: bool = ..., apply_immutable: bool = ..., store_attributes: Optional[Callable[[type, Attribute], Any]] = ..., - **kw: Optional[dict]) -> Callable[[Type[_T]], Type[_T]]: ... + **kw: Optional[dict] +) -> Callable[[Type[_T]], Type[_T]]: ... class Attribute: def __init__( @@ -31,4 +31,5 @@ class Attribute: default_value: Any = ..., default_factory: Optional[Callable[[None], Any]] = ..., instance_of: Optional[Any] = ..., - init_aliaser: Optional[Callable[[AnyStr], AnyStr]] = ...) -> None: ... + init_aliaser: Optional[Callable[[AnyStr], AnyStr]] = ..., + ) -> None: ... diff --git a/third_party/2and3/click/__init__.pyi b/third_party/2and3/click/__init__.pyi index 62124a59da77..bd04f4a99a57 100644 --- a/third_party/2and3/click/__init__.pyi +++ b/third_party/2and3/click/__init__.pyi @@ -24,6 +24,7 @@ from .core import Group as Group from .core import MultiCommand as MultiCommand from .core import Option as Option from .core import Parameter as Parameter + # Decorators from .decorators import argument as argument from .decorators import command as command @@ -36,6 +37,7 @@ from .decorators import pass_context as pass_context from .decorators import pass_obj as pass_obj from .decorators import password_option as password_option from .decorators import version_option as version_option + # Exceptions from .exceptions import Abort as Abort from .exceptions import BadArgumentUsage as BadArgumentUsage @@ -46,13 +48,17 @@ from .exceptions import FileError as FileError from .exceptions import MissingParameter as MissingParameter from .exceptions import NoSuchOption as NoSuchOption from .exceptions import UsageError as UsageError + # Formatting from .formatting import HelpFormatter as HelpFormatter from .formatting import wrap_text as wrap_text + # Globals from .globals import get_current_context as get_current_context + # Parsing from .parser import OptionParser as OptionParser + # Terminal functions from .termui import clear as clear from .termui import confirm as confirm @@ -67,6 +73,7 @@ from .termui import prompt as prompt from .termui import secho as secho from .termui import style as style from .termui import unstyle as unstyle + # Types from .types import BOOL as BOOL from .types import FLOAT as FLOAT @@ -80,6 +87,7 @@ from .types import IntRange as IntRange from .types import ParamType as ParamType from .types import Path as Path from .types import Tuple as Tuple + # Utilities from .utils import echo as echo from .utils import format_filename as format_filename @@ -93,5 +101,4 @@ from .utils import open_file as open_file # literals. disable_unicode_literals_warning: bool - __version__: str diff --git a/third_party/2and3/click/core.pyi b/third_party/2and3/click/core.pyi index fa2413d69e3e..c7a6568a194c 100644 --- a/third_party/2and3/click/core.pyi +++ b/third_party/2and3/click/core.pyi @@ -20,26 +20,12 @@ from click.formatting import HelpFormatter from click.parser import OptionParser def invoke_param_callback( - callback: Callable[[Context, Parameter, Optional[str]], Any], - ctx: Context, - param: Parameter, - value: Optional[str] -) -> Any: - ... - - -def augment_usage_errors( - ctx: Context, param: Optional[Parameter] = ... -) -> ContextManager[None]: - ... - - + callback: Callable[[Context, Parameter, Optional[str]], Any], ctx: Context, param: Parameter, value: Optional[str] +) -> Any: ... +def augment_usage_errors(ctx: Context, param: Optional[Parameter] = ...) -> ContextManager[None]: ... def iter_params_for_processing( - invocation_order: Sequence[Parameter], - declaration_order: Iterable[Parameter], -) -> Iterable[Parameter]: - ... - + invocation_order: Sequence[Parameter], declaration_order: Iterable[Parameter] +) -> Iterable[Parameter]: ... class Context: parent: Optional[Context] @@ -64,7 +50,6 @@ class Context: _meta: Dict[str, Any] _close_callbacks: List _depth: int - def __init__( self, command: Command, @@ -81,66 +66,27 @@ class Context: ignore_unknown_options: Optional[bool] = ..., help_option_names: Optional[List[str]] = ..., token_normalize_func: Optional[Callable[[str], str]] = ..., - color: Optional[bool] = ... - ) -> None: - ... - + color: Optional[bool] = ..., + ) -> None: ... @property - def meta(self) -> Dict[str, Any]: - ... - + def meta(self) -> Dict[str, Any]: ... @property - def command_path(self) -> str: - ... - - def scope(self, cleanup: bool = ...) -> ContextManager[Context]: - ... - - def make_formatter(self) -> HelpFormatter: - ... - - def call_on_close(self, f: Callable) -> Callable: - ... - - def close(self) -> None: - ... - - def find_root(self) -> Context: - ... - - def find_object(self, object_type: type) -> Any: - ... - - def ensure_object(self, object_type: type) -> Any: - ... - - def lookup_default(self, name: str) -> Any: - ... - - def fail(self, message: str) -> NoReturn: - ... - - def abort(self) -> NoReturn: - ... - - def exit(self, code: Union[int, str] = ...) -> NoReturn: - ... - - def get_usage(self) -> str: - ... - - def get_help(self) -> str: - ... - - def invoke( - self, callback: Union[Command, Callable], *args, **kwargs - ) -> Any: - ... - - def forward( - self, callback: Union[Command, Callable], *args, **kwargs - ) -> Any: - ... + def command_path(self) -> str: ... + def scope(self, cleanup: bool = ...) -> ContextManager[Context]: ... + def make_formatter(self) -> HelpFormatter: ... + def call_on_close(self, f: Callable) -> Callable: ... + def close(self) -> None: ... + def find_root(self) -> Context: ... + def find_object(self, object_type: type) -> Any: ... + def ensure_object(self, object_type: type) -> Any: ... + def lookup_default(self, name: str) -> Any: ... + def fail(self, message: str) -> NoReturn: ... + def abort(self) -> NoReturn: ... + def exit(self, code: Union[int, str] = ...) -> NoReturn: ... + def get_usage(self) -> str: ... + def get_help(self) -> str: ... + def invoke(self, callback: Union[Command, Callable], *args, **kwargs) -> Any: ... + def forward(self, callback: Union[Command, Callable], *args, **kwargs) -> Any: ... class BaseCommand: allow_extra_args: bool @@ -148,27 +94,12 @@ class BaseCommand: ignore_unknown_options: bool name: str context_settings: Dict - - def __init__(self, name: str, context_settings: Optional[Dict] = ...) -> None: - ... - - def get_usage(self, ctx: Context) -> str: - ... - - def get_help(self, ctx: Context) -> str: - ... - - def make_context( - self, info_name: str, args: List[str], parent: Optional[Context] = ..., **extra - ) -> Context: - ... - - def parse_args(self, ctx: Context, args: List[str]) -> List[str]: - ... - - def invoke(self, ctx: Context) -> Any: - ... - + def __init__(self, name: str, context_settings: Optional[Dict] = ...) -> None: ... + def get_usage(self, ctx: Context) -> str: ... + def get_help(self, ctx: Context) -> str: ... + def make_context(self, info_name: str, args: List[str], parent: Optional[Context] = ..., **extra) -> Context: ... + def parse_args(self, ctx: Context, args: List[str]) -> List[str]: ... + def invoke(self, ctx: Context) -> Any: ... def main( self, args: Optional[List[str]] = ..., @@ -176,12 +107,8 @@ class BaseCommand: complete_var: Optional[str] = ..., standalone_mode: bool = ..., **extra - ) -> Any: - ... - - def __call__(self, *args, **kwargs) -> Any: - ... - + ) -> Any: ... + def __call__(self, *args, **kwargs) -> Any: ... class Command(BaseCommand): callback: Optional[Callable] @@ -193,7 +120,6 @@ class Command(BaseCommand): add_help_option: bool hidden: bool deprecated: bool - def __init__( self, name: str, @@ -207,50 +133,21 @@ class Command(BaseCommand): add_help_option: bool = ..., hidden: bool = ..., deprecated: bool = ..., - ) -> None: - ... - - def get_params(self, ctx: Context) -> List[Parameter]: - ... - - def format_usage( - self, - ctx: Context, - formatter: HelpFormatter - ) -> None: - ... - - def collect_usage_pieces(self, ctx: Context) -> List[str]: - ... - - def get_help_option_names(self, ctx: Context) -> Set[str]: - ... - - def get_help_option(self, ctx: Context) -> Optional[Option]: - ... - - def make_parser(self, ctx: Context) -> OptionParser: - ... - - def get_short_help_str(self, limit: int = ...) -> str: - ... - - def format_help(self, ctx: Context, formatter: HelpFormatter) -> None: - ... - - def format_help_text(self, ctx: Context, formatter: HelpFormatter) -> None: - ... - - def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: - ... - - def format_epilog(self, ctx: Context, formatter: HelpFormatter) -> None: - ... - - -_T = TypeVar('_T') -_F = TypeVar('_F', bound=Callable[..., Any]) - + ) -> None: ... + def get_params(self, ctx: Context) -> List[Parameter]: ... + def format_usage(self, ctx: Context, formatter: HelpFormatter) -> None: ... + def collect_usage_pieces(self, ctx: Context) -> List[str]: ... + def get_help_option_names(self, ctx: Context) -> Set[str]: ... + def get_help_option(self, ctx: Context) -> Optional[Option]: ... + def make_parser(self, ctx: Context) -> OptionParser: ... + def get_short_help_str(self, limit: int = ...) -> str: ... + def format_help(self, ctx: Context, formatter: HelpFormatter) -> None: ... + def format_help_text(self, ctx: Context, formatter: HelpFormatter) -> None: ... + def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: ... + def format_epilog(self, ctx: Context, formatter: HelpFormatter) -> None: ... + +_T = TypeVar("_T") +_F = TypeVar("_F", bound=Callable[..., Any]) class MultiCommand(Command): no_args_is_help: bool @@ -258,7 +155,6 @@ class MultiCommand(Command): subcommand_metavar: str chain: bool result_callback: Callable - def __init__( self, name: Optional[str] = ..., @@ -268,97 +164,39 @@ class MultiCommand(Command): chain: bool = ..., result_callback: Optional[Callable] = ..., **attrs - ) -> None: - ... - - def resultcallback( - self, replace: bool = ... - ) -> Callable[[_F], _F]: - ... - - def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: - ... - - def resolve_command( - self, ctx: Context, args: List[str] - ) -> Tuple[str, Command, List[str]]: - ... - - def get_command(self, ctx: Context, cmd_name: str) -> Optional[Command]: - ... - - def list_commands(self, ctx: Context) -> Iterable[str]: - ... - + ) -> None: ... + def resultcallback(self, replace: bool = ...) -> Callable[[_F], _F]: ... + def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: ... + def resolve_command(self, ctx: Context, args: List[str]) -> Tuple[str, Command, List[str]]: ... + def get_command(self, ctx: Context, cmd_name: str) -> Optional[Command]: ... + def list_commands(self, ctx: Context) -> Iterable[str]: ... class Group(MultiCommand): commands: Dict[str, Command] - - def __init__( - self, name: Optional[str] = ..., commands: Optional[Dict[str, Command]] = ..., **attrs - ) -> None: - ... - - def add_command(self, cmd: Command, name: Optional[str] = ...): - ... - - def command(self, *args, **kwargs) -> Callable[[Callable], Command]: - ... - - def group(self, *args, **kwargs) -> Callable[[Callable], Group]: - ... - + def __init__(self, name: Optional[str] = ..., commands: Optional[Dict[str, Command]] = ..., **attrs) -> None: ... + def add_command(self, cmd: Command, name: Optional[str] = ...): ... + def command(self, *args, **kwargs) -> Callable[[Callable], Command]: ... + def group(self, *args, **kwargs) -> Callable[[Callable], Group]: ... class CommandCollection(MultiCommand): sources: List[MultiCommand] - - def __init__( - self, name: Optional[str] = ..., sources: Optional[List[MultiCommand]] = ..., **attrs - ) -> None: - ... - - def add_source(self, multi_cmd: MultiCommand) -> None: - ... - + def __init__(self, name: Optional[str] = ..., sources: Optional[List[MultiCommand]] = ..., **attrs) -> None: ... + def add_source(self, multi_cmd: MultiCommand) -> None: ... class _ParamType: name: str is_composite: bool envvar_list_splitter: Optional[str] - - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> Any: - ... - - def get_metavar(self, param: Parameter) -> str: - ... - - def get_missing_message(self, param: Parameter) -> str: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> Any: - ... - - def split_envvar_value(self, rv: str) -> List[str]: - ... - - def fail(self, message: str, param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> None: - ... - + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> Any: ... + def get_metavar(self, param: Parameter) -> str: ... + def get_missing_message(self, param: Parameter) -> str: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> Any: ... + def split_envvar_value(self, rv: str) -> List[str]: ... + def fail(self, message: str, param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> None: ... # This type is here to resolve https://github.com/python/mypy/issues/5275 _ConvertibleType = Union[type, _ParamType, Tuple[type, ...], Callable[[str], Any], Callable[[Optional[str]], Any]] - class Parameter: param_type_name: str name: str @@ -374,7 +212,6 @@ class Parameter: is_eager: bool metavar: Optional[str] envvar: Union[str, List[str], None] - def __init__( self, param_decls: Optional[List[str]] = ..., @@ -386,58 +223,24 @@ class Parameter: metavar: Optional[str] = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: Optional[Union[str, List[str]]] = ... - ) -> None: - ... - + envvar: Optional[Union[str, List[str]]] = ..., + ) -> None: ... @property - def human_readable_name(self) -> str: - ... - - def make_metavar(self) -> str: - ... - - def get_default(self, ctx: Context) -> Any: - ... - - def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: - ... - - def consume_value(self, ctx: Context, opts: Dict[str, Any]) -> Any: - ... - - def type_cast_value(self, ctx: Context, value: Any) -> Any: - ... - - def process_value(self, ctx: Context, value: Any) -> Any: - ... - - def value_is_missing(self, value: Any) -> bool: - ... - - def full_process_value(self, ctx: Context, value: Any) -> Any: - ... - - def resolve_envvar_value(self, ctx: Context) -> str: - ... - - def value_from_envvar(self, ctx: Context) -> Union[str, List[str]]: - ... - - def handle_parse_result( - self, ctx: Context, opts: Dict[str, Any], args: List[str] - ) -> Tuple[Any, List[str]]: - ... - - def get_help_record(self, ctx: Context) -> Tuple[str, str]: - ... - - def get_usage_pieces(self, ctx: Context) -> List[str]: - ... - - def get_error_hint(self, ctx: Context) -> str: - ... - + def human_readable_name(self) -> str: ... + def make_metavar(self) -> str: ... + def get_default(self, ctx: Context) -> Any: ... + def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: ... + def consume_value(self, ctx: Context, opts: Dict[str, Any]) -> Any: ... + def type_cast_value(self, ctx: Context, value: Any) -> Any: ... + def process_value(self, ctx: Context, value: Any) -> Any: ... + def value_is_missing(self, value: Any) -> bool: ... + def full_process_value(self, ctx: Context, value: Any) -> Any: ... + def resolve_envvar_value(self, ctx: Context) -> str: ... + def value_from_envvar(self, ctx: Context) -> Union[str, List[str]]: ... + def handle_parse_result(self, ctx: Context, opts: Dict[str, Any], args: List[str]) -> Tuple[Any, List[str]]: ... + def get_help_record(self, ctx: Context) -> Tuple[str, str]: ... + def get_usage_pieces(self, ctx: Context) -> List[str]: ... + def get_error_hint(self, ctx: Context) -> str: ... class Option(Parameter): prompt: str # sic @@ -454,7 +257,6 @@ class Option(Parameter): show_default: bool show_choices: bool show_envvar: bool - def __init__( self, param_decls: Optional[List[str]] = ..., @@ -473,18 +275,8 @@ class Option(Parameter): show_choices: bool = ..., show_envvar: bool = ..., **attrs - ) -> None: - ... - - def prompt_for_value(self, ctx: Context) -> Any: - ... - + ) -> None: ... + def prompt_for_value(self, ctx: Context) -> Any: ... class Argument(Parameter): - def __init__( - self, - param_decls: Optional[List[str]] = ..., - required: Optional[bool] = ..., - **attrs - ) -> None: - ... + def __init__(self, param_decls: Optional[List[str]] = ..., required: Optional[bool] = ..., **attrs) -> None: ... diff --git a/third_party/2and3/click/decorators.pyi b/third_party/2and3/click/decorators.pyi index 22475da92745..ec8d7b04fc91 100644 --- a/third_party/2and3/click/decorators.pyi +++ b/third_party/2and3/click/decorators.pyi @@ -3,30 +3,17 @@ from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Type, TypeV from click.core import Argument, Command, Context, Group, Option, Parameter, _ConvertibleType -_T = TypeVar('_T') -_F = TypeVar('_F', bound=Callable[..., Any]) +_T = TypeVar("_T") +_F = TypeVar("_F", bound=Callable[..., Any]) # Until https://github.com/python/mypy/issues/3924 is fixed you can't do the following: # _Decorator = Callable[[_F], _F] -_Callback = Callable[ - [Context, Union[Option, Parameter], Any], - Any -] - -def pass_context(_T) -> _T: - ... - - -def pass_obj(_T) -> _T: - ... - - -def make_pass_decorator( - object_type: type, ensure: bool = ... -) -> Callable[[_T], _T]: - ... +_Callback = Callable[[Context, Union[Option, Parameter], Any], Any] +def pass_context(_T) -> _T: ... +def pass_obj(_T) -> _T: ... +def make_pass_decorator(object_type: type, ensure: bool = ...) -> Callable[[_T], _T]: ... # NOTE: Decorators below have **attrs converted to concrete constructor # arguments from core.pyi to help with type checking. @@ -43,9 +30,7 @@ def command( add_help_option: bool = ..., hidden: bool = ..., deprecated: bool = ..., -) -> Callable[[Callable], Command]: - ... - +) -> Callable[[Callable], Command]: ... # This inherits attrs from Group, MultiCommand and Command. @@ -70,10 +55,7 @@ def group( deprecated: bool = ..., # User-defined **kwargs: Any, -) -> Callable[[Callable], Group]: - ... - - +) -> Callable[[Callable], Group]: ... def argument( *param_decls: str, cls: Type[Argument] = ..., @@ -89,10 +71,7 @@ def argument( is_eager: bool = ..., envvar: Optional[Union[str, List[str]]] = ..., autocompletion: Optional[Callable[[Any, List[str], str], List[Union[str, Tuple[str, str]]]]] = ..., -) -> Callable[[_F], _F]: - ... - - +) -> Callable[[_F], _F]: ... @overload def option( *param_decls: str, @@ -121,10 +100,7 @@ def option( envvar: Optional[Union[str, List[str]]] = ..., # User-defined **kwargs: Any, -) -> Callable[[_F], _F]: - ... - - +) -> Callable[[_F], _F]: ... @overload def option( *param_decls: str, @@ -153,10 +129,7 @@ def option( envvar: Optional[Union[str, List[str]]] = ..., # User-defined **kwargs: Any, -) -> Callable[[_F], _F]: - ... - - +) -> Callable[[_F], _F]: ... @overload def option( *param_decls: str, @@ -185,10 +158,7 @@ def option( envvar: Optional[Union[str, List[str]]] = ..., # User-defined **kwargs: Any, -) -> Callable[[_F], _F]: - ... - - +) -> Callable[[_F], _F]: ... @overload def option( *param_decls: str, @@ -217,10 +187,7 @@ def option( envvar: Optional[Union[str, List[str]]] = ..., # User-defined **kwargs: Any, -) -> Callable[[_F], _F]: - ... - - +) -> Callable[[_F], _F]: ... def confirmation_option( *param_decls: str, cls: Type[Option] = ..., @@ -244,11 +211,8 @@ def confirmation_option( metavar: Optional[str] = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: Optional[Union[str, List[str]]] = ... -) -> Callable[[_F], _F]: - ... - - + envvar: Optional[Union[str, List[str]]] = ..., +) -> Callable[[_F], _F]: ... def password_option( *param_decls: str, cls: Type[Option] = ..., @@ -272,11 +236,8 @@ def password_option( metavar: Optional[str] = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: Optional[Union[str, List[str]]] = ... -) -> Callable[[_F], _F]: - ... - - + envvar: Optional[Union[str, List[str]]] = ..., +) -> Callable[[_F], _F]: ... def version_option( version: Optional[Union[str, Version]] = ..., *param_decls: str, @@ -303,11 +264,8 @@ def version_option( metavar: Optional[str] = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: Optional[Union[str, List[str]]] = ... -) -> Callable[[_F], _F]: - ... - - + envvar: Optional[Union[str, List[str]]] = ..., +) -> Callable[[_F], _F]: ... def help_option( *param_decls: str, cls: Type[Option] = ..., @@ -331,6 +289,5 @@ def help_option( metavar: Optional[str] = ..., expose_value: bool = ..., is_eager: bool = ..., - envvar: Optional[Union[str, List[str]]] = ... -) -> Callable[[_F], _F]: - ... + envvar: Optional[Union[str, List[str]]] = ..., +) -> Callable[[_F], _F]: ... diff --git a/third_party/2and3/click/exceptions.pyi b/third_party/2and3/click/exceptions.pyi index 7884a08ff3af..8e25cdea4b25 100644 --- a/third_party/2and3/click/exceptions.pyi +++ b/third_party/2and3/click/exceptions.pyi @@ -5,91 +5,56 @@ from click.core import Context, Parameter class ClickException(Exception): exit_code: int message: str - - def __init__(self, message: str) -> None: - ... - - def format_message(self) -> str: - ... - - def show(self, file: Optional[Any] = ...) -> None: - ... - + def __init__(self, message: str) -> None: ... + def format_message(self) -> str: ... + def show(self, file: Optional[Any] = ...) -> None: ... class UsageError(ClickException): ctx: Optional[Context] - - def __init__(self, message: str, ctx: Optional[Context] = ...) -> None: - ... - - def show(self, file: Optional[IO] = ...) -> None: - ... - + def __init__(self, message: str, ctx: Optional[Context] = ...) -> None: ... + def show(self, file: Optional[IO] = ...) -> None: ... class BadParameter(UsageError): param: Optional[Parameter] param_hint: Optional[str] - def __init__( - self, - message: str, - ctx: Optional[Context] = ..., - param: Optional[Parameter] = ..., - param_hint: Optional[str] = ... - ) -> None: - ... - + self, message: str, ctx: Optional[Context] = ..., param: Optional[Parameter] = ..., param_hint: Optional[str] = ... + ) -> None: ... class MissingParameter(BadParameter): param_type: str # valid values: 'parameter', 'option', 'argument' - def __init__( self, message: Optional[str] = ..., ctx: Optional[Context] = ..., param: Optional[Parameter] = ..., param_hint: Optional[str] = ..., - param_type: Optional[str] = ... - ) -> None: - ... - + param_type: Optional[str] = ..., + ) -> None: ... class NoSuchOption(UsageError): option_name: str possibilities: Optional[List[str]] - def __init__( self, option_name: str, message: Optional[str] = ..., possibilities: Optional[List[str]] = ..., - ctx: Optional[Context] = ... - ) -> None: - ... - + ctx: Optional[Context] = ..., + ) -> None: ... class BadOptionUsage(UsageError): - def __init__(self, option_name: str, message: str, ctx: Optional[Context] = ...) -> None: - ... - + def __init__(self, option_name: str, message: str, ctx: Optional[Context] = ...) -> None: ... class BadArgumentUsage(UsageError): - def __init__(self, message: str, ctx: Optional[Context] = ...) -> None: - ... - + def __init__(self, message: str, ctx: Optional[Context] = ...) -> None: ... class FileError(ClickException): ui_filename: str filename: str + def __init__(self, filename: str, hint: Optional[str] = ...) -> None: ... - def __init__(self, filename: str, hint: Optional[str] = ...) -> None: - ... - - -class Abort(RuntimeError): - ... - +class Abort(RuntimeError): ... class Exit(RuntimeError): - def __init__(self, code: int = ...) -> None: - ... + def __init__(self, code: int = ...) -> None: ... diff --git a/third_party/2and3/click/formatting.pyi b/third_party/2and3/click/formatting.pyi index 80225ab60154..1b2a52e85e39 100644 --- a/third_party/2and3/click/formatting.pyi +++ b/third_party/2and3/click/formatting.pyi @@ -2,84 +2,28 @@ from typing import ContextManager, Generator, Iterable, List, Optional, Tuple FORCED_WIDTH: Optional[int] - -def measure_table(rows: Iterable[Iterable[str]]) -> Tuple[int, ...]: - ... - - -def iter_rows( - rows: Iterable[Iterable[str]], col_count: int -) -> Generator[Tuple[str, ...], None, None]: - ... - - +def measure_table(rows: Iterable[Iterable[str]]) -> Tuple[int, ...]: ... +def iter_rows(rows: Iterable[Iterable[str]], col_count: int) -> Generator[Tuple[str, ...], None, None]: ... def wrap_text( - text: str, - width: int = ..., - initial_indent: str = ..., - subsequent_indent: str = ..., - preserve_paragraphs: bool = ... -) -> str: - ... - + text: str, width: int = ..., initial_indent: str = ..., subsequent_indent: str = ..., preserve_paragraphs: bool = ... +) -> str: ... class HelpFormatter: indent_increment: int width: Optional[int] current_indent: int buffer: List[str] - - def __init__( - self, - indent_increment: int = ..., - width: Optional[int] = ..., - max_width: Optional[int] = ..., - ) -> None: - ... - - def write(self, string: str) -> None: - ... - - def indent(self) -> None: - ... - - def dedent(self) -> None: - ... - - def write_usage( - self, - prog: str, - args: str = ..., - prefix: str = ..., - ): - ... - - def write_heading(self, heading: str) -> None: - ... - - def write_paragraph(self) -> None: - ... - - def write_text(self, text: str) -> None: - ... - - def write_dl( - self, - rows: Iterable[Iterable[str]], - col_max: int = ..., - col_spacing: int = ..., - ) -> None: - ... - - def section(self, name) -> ContextManager[None]: - ... - - def indentation(self) -> ContextManager[None]: - ... - - def getvalue(self) -> str: - ... - - -def join_options(options: List[str]) -> Tuple[str, bool]: - ... + def __init__(self, indent_increment: int = ..., width: Optional[int] = ..., max_width: Optional[int] = ...) -> None: ... + def write(self, string: str) -> None: ... + def indent(self) -> None: ... + def dedent(self) -> None: ... + def write_usage(self, prog: str, args: str = ..., prefix: str = ...): ... + def write_heading(self, heading: str) -> None: ... + def write_paragraph(self) -> None: ... + def write_text(self, text: str) -> None: ... + def write_dl(self, rows: Iterable[Iterable[str]], col_max: int = ..., col_spacing: int = ...) -> None: ... + def section(self, name) -> ContextManager[None]: ... + def indentation(self) -> ContextManager[None]: ... + def getvalue(self) -> str: ... + +def join_options(options: List[str]) -> Tuple[str, bool]: ... diff --git a/third_party/2and3/click/globals.pyi b/third_party/2and3/click/globals.pyi index 04addb581bc5..64b399d481be 100644 --- a/third_party/2and3/click/globals.pyi +++ b/third_party/2and3/click/globals.pyi @@ -2,17 +2,7 @@ from typing import Optional from click.core import Context -def get_current_context(silent: bool = ...) -> Context: - ... - - -def push_context(ctx: Context) -> None: - ... - - -def pop_context() -> None: - ... - - -def resolve_color_default(color: Optional[bool] = ...) -> Optional[bool]: - ... +def get_current_context(silent: bool = ...) -> Context: ... +def push_context(ctx: Context) -> None: ... +def pop_context() -> None: ... +def resolve_color_default(color: Optional[bool] = ...) -> Optional[bool]: ... diff --git a/third_party/2and3/click/parser.pyi b/third_party/2and3/click/parser.pyi index da3fe83089fa..fdcc2eaf7ccf 100644 --- a/third_party/2and3/click/parser.pyi +++ b/third_party/2and3/click/parser.pyi @@ -2,23 +2,10 @@ from typing import Any, Dict, Iterable, List, Optional, Set, Tuple from click.core import Context -def _unpack_args( - args: Iterable[str], nargs_spec: Iterable[int] -) -> Tuple[Tuple[Optional[Tuple[str, ...]], ...], List[str]]: - ... - - -def split_opt(opt: str) -> Tuple[str, str]: - ... - - -def normalize_opt(opt: str, ctx: Context) -> str: - ... - - -def split_arg_string(string: str) -> List[str]: - ... - +def _unpack_args(args: Iterable[str], nargs_spec: Iterable[int]) -> Tuple[Tuple[Optional[Tuple[str, ...]], ...], List[str]]: ... +def split_opt(opt: str) -> Tuple[str, str]: ... +def normalize_opt(opt: str, ctx: Context) -> str: ... +def split_arg_string(string: str) -> List[str]: ... class Option: dest: str @@ -29,7 +16,6 @@ class Option: prefixes: Set[str] _short_opts: List[str] _long_opts: List[str] - def __init__( self, opts: Iterable[str], @@ -37,39 +23,25 @@ class Option: action: Optional[str] = ..., nargs: int = ..., const: Optional[Any] = ..., - obj: Optional[Any] = ... - ) -> None: - ... - + obj: Optional[Any] = ..., + ) -> None: ... @property - def takes_value(self) -> bool: - ... - - def process(self, value: Any, state: ParsingState) -> None: - ... - + def takes_value(self) -> bool: ... + def process(self, value: Any, state: ParsingState) -> None: ... class Argument: dest: str nargs: int obj: Any - - def __init__(self, dest: str, nargs: int = ..., obj: Optional[Any] = ...) -> None: - ... - - def process(self, value: Any, state: ParsingState) -> None: - ... - + def __init__(self, dest: str, nargs: int = ..., obj: Optional[Any] = ...) -> None: ... + def process(self, value: Any, state: ParsingState) -> None: ... class ParsingState: opts: Dict[str, Any] largs: List[str] rargs: List[str] order: List[Any] - - def __init__(self, rargs: List[str]) -> None: - ... - + def __init__(self, rargs: List[str]) -> None: ... class OptionParser: ctx: Optional[Context] @@ -79,10 +51,7 @@ class OptionParser: _long_opt: Dict[str, Option] _opt_prefixes: Set[str] _args: List[Argument] - - def __init__(self, ctx: Optional[Context] = ...) -> None: - ... - + def __init__(self, ctx: Optional[Context] = ...) -> None: ... def add_option( self, opts: Iterable[str], @@ -90,14 +59,7 @@ class OptionParser: action: Optional[str] = ..., nargs: int = ..., const: Optional[Any] = ..., - obj: Optional[Any] = ... - ) -> None: - ... - - def add_argument(self, dest: str, nargs: int = ..., obj: Optional[Any] = ...) -> None: - ... - - def parse_args( - self, args: List[str] - ) -> Tuple[Dict[str, Any], List[str], List[Any]]: - ... + obj: Optional[Any] = ..., + ) -> None: ... + def add_argument(self, dest: str, nargs: int = ..., obj: Optional[Any] = ...) -> None: ... + def parse_args(self, args: List[str]) -> Tuple[Dict[str, Any], List[str], List[Any]]: ... diff --git a/third_party/2and3/click/termui.pyi b/third_party/2and3/click/termui.pyi index 3a52973ba9bc..24058d171e3b 100644 --- a/third_party/2and3/click/termui.pyi +++ b/third_party/2and3/click/termui.pyi @@ -3,19 +3,8 @@ from typing import IO, Any, Callable, Generator, Iterable, List, Optional, Text, from click._termui_impl import ProgressBar as _ProgressBar from click.core import _ConvertibleType -def hidden_prompt_func(prompt: str) -> str: - ... - - -def _build_prompt( - text: str, - suffix: str, - show_default: bool = ..., - default: Optional[str] = ..., -) -> str: - ... - - +def hidden_prompt_func(prompt: str) -> str: ... +def _build_prompt(text: str, suffix: str, show_default: bool = ..., default: Optional[str] = ...) -> str: ... def prompt( text: str, default: Optional[str] = ..., @@ -27,34 +16,16 @@ def prompt( show_default: bool = ..., err: bool = ..., show_choices: bool = ..., -) -> Any: - ... - - +) -> Any: ... def confirm( - text: str, - default: bool = ..., - abort: bool = ..., - prompt_suffix: str = ..., - show_default: bool = ..., - err: bool = ..., -) -> bool: - ... - - -def get_terminal_size() -> Tuple[int, int]: - ... - - + text: str, default: bool = ..., abort: bool = ..., prompt_suffix: str = ..., show_default: bool = ..., err: bool = ... +) -> bool: ... +def get_terminal_size() -> Tuple[int, int]: ... def echo_via_pager( - text_or_generator: Union[str, Iterable[str], Callable[[], Generator[str, None, None]]], - color: Optional[bool] -) -> None: - ... - - -_T = TypeVar('_T') + text_or_generator: Union[str, Iterable[str], Callable[[], Generator[str, None, None]]], color: Optional[bool] +) -> None: ... +_T = TypeVar("_T") @overload def progressbar( iterable: Iterable[_T], @@ -71,9 +42,7 @@ def progressbar( width: int = ..., file: Optional[IO] = ..., color: Optional[bool] = ..., -) -> _ProgressBar[_T]: - ... - +) -> _ProgressBar[_T]: ... @overload def progressbar( iterable: None = ..., @@ -90,13 +59,8 @@ def progressbar( width: int = ..., file: Optional[IO] = ..., color: Optional[bool] = ..., -) -> _ProgressBar[int]: - ... - -def clear() -> None: - ... - - +) -> _ProgressBar[int]: ... +def clear() -> None: ... def style( text: str, fg: Optional[str] = ..., @@ -107,13 +71,8 @@ def style( blink: Optional[bool] = ..., reverse: Optional[bool] = ..., reset: bool = ..., -) -> str: - ... - - -def unstyle(text: str) -> str: - ... - +) -> str: ... +def unstyle(text: str) -> str: ... # Styling options copied from style() for nicer type checking. def secho( @@ -130,10 +89,7 @@ def secho( blink: Optional[bool] = ..., reverse: Optional[bool] = ..., reset: bool = ..., -): - ... - - +): ... def edit( text: Optional[str] = ..., editor: Optional[str] = ..., @@ -141,19 +97,7 @@ def edit( require_save: bool = ..., extension: str = ..., filename: Optional[str] = ..., -) -> str: - ... - - -def launch(url: str, wait: bool = ..., locate: bool = ...) -> int: - ... - - -def getchar(echo: bool = ...) -> Text: - ... - - -def pause( - info: str = ..., err: bool = ... -) -> None: - ... +) -> str: ... +def launch(url: str, wait: bool = ..., locate: bool = ...) -> int: ... +def getchar(echo: bool = ...) -> Text: ... +def pause(info: str = ..., err: bool = ...) -> None: ... diff --git a/third_party/2and3/click/testing.pyi b/third_party/2and3/click/testing.pyi index 1f3315970017..3507aac5299d 100644 --- a/third_party/2and3/click/testing.pyi +++ b/third_party/2and3/click/testing.pyi @@ -42,22 +42,17 @@ class CliRunner: env: Mapping[str, str] echo_stdin: bool mix_stderr: bool - def __init__( self, charset: Optional[Text] = ..., env: Optional[Mapping[str, str]] = ..., echo_stdin: bool = ..., mix_stderr: bool = ..., - ) -> None: - ... + ) -> None: ... def get_default_prog_name(self, cli: BaseCommand) -> str: ... def make_env(self, overrides: Optional[Mapping[str, str]] = ...) -> Dict[str, str]: ... def isolation( - self, - input: Optional[IO] = ..., - env: Optional[Mapping[str, str]] = ..., - color: bool = ..., + self, input: Optional[IO] = ..., env: Optional[Mapping[str, str]] = ..., color: bool = ... ) -> ContextManager[BinaryIO]: ... def invoke( self, @@ -68,6 +63,5 @@ class CliRunner: catch_exceptions: bool = ..., color: bool = ..., **extra: Any, - ) -> Result: - ... + ) -> Result: ... def isolated_filesystem(self) -> ContextManager[str]: ... diff --git a/third_party/2and3/click/types.pyi b/third_party/2and3/click/types.pyi index 50febcdb86ad..79d81e56105f 100644 --- a/third_party/2and3/click/types.pyi +++ b/third_party/2and3/click/types.pyi @@ -8,74 +8,25 @@ from click.core import Context, Parameter, _ConvertibleType from click.core import _ParamType as ParamType class BoolParamType(ParamType): - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> bool: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> bool: - ... - + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> bool: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> bool: ... class CompositeParamType(ParamType): arity: int - class Choice(ParamType): choices: Iterable[str] - def __init__( - self, - choices: Iterable[str], - case_sensitive: bool = ..., - ) -> None: - ... - + def __init__(self, choices: Iterable[str], case_sensitive: bool = ...) -> None: ... class DateTime(ParamType): - def __init__( - self, - formats: Optional[List[str]] = ..., - ) -> None: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> datetime.datetime: - ... - + def __init__(self, formats: Optional[List[str]] = ...) -> None: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> datetime.datetime: ... class FloatParamType(ParamType): - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> float: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> float: - ... - - -class FloatRange(FloatParamType): - ... + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> float: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> float: ... +class FloatRange(FloatParamType): ... class File(ParamType): def __init__( @@ -85,83 +36,28 @@ class File(ParamType): errors: Optional[str] = ..., lazy: Optional[bool] = ..., atomic: Optional[bool] = ..., - ) -> None: - ... - - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> IO: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> IO: - ... + ) -> None: ... + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> IO: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> IO: ... + def resolve_lazy_flag(self, value: str) -> bool: ... - def resolve_lazy_flag(self, value: str) -> bool: - ... - - -_F = TypeVar('_F') # result of the function +_F = TypeVar("_F") # result of the function _Func = Callable[[Optional[str]], _F] - class FuncParamType(ParamType): func: _Func - - def __init__(self, func: _Func) -> None: - ... - - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> _F: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> _F: - ... - + def __init__(self, func: _Func) -> None: ... + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> _F: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> _F: ... class IntParamType(ParamType): - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> int: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> int: - ... - + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> int: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> int: ... class IntRange(IntParamType): - def __init__( - self, min: Optional[int] = ..., max: Optional[int] = ..., clamp: bool = ... - ) -> None: - ... - - -_PathType = TypeVar('_PathType', str, bytes) + def __init__(self, min: Optional[int] = ..., max: Optional[int] = ..., clamp: bool = ...) -> None: ... +_PathType = TypeVar("_PathType", str, bytes) class Path(ParamType): def __init__( @@ -174,93 +70,28 @@ class Path(ParamType): resolve_path: bool = ..., allow_dash: bool = ..., path_type: Optional[Type[_PathType]] = ..., - ) -> None: - ... - - def coerce_path_result(self, rv: Union[str, bytes]) -> _PathType: - ... - - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> _PathType: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> _PathType: - ... + ) -> None: ... + def coerce_path_result(self, rv: Union[str, bytes]) -> _PathType: ... + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> _PathType: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> _PathType: ... class StringParamType(ParamType): - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> str: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> str: - ... - + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> str: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> str: ... class Tuple(CompositeParamType): types: List[ParamType] + def __init__(self, types: Iterable[Any]) -> None: ... + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> Tuple: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> Tuple: ... - def __init__(self, types: Iterable[Any]) -> None: - ... - - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> Tuple: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> Tuple: - ... - - -class UnprocessedParamType(ParamType): - ... - +class UnprocessedParamType(ParamType): ... class UUIDParameterType(ParamType): - def __call__( - self, - value: Optional[str], - param: Optional[Parameter] = ..., - ctx: Optional[Context] = ..., - ) -> uuid.UUID: - ... - - def convert( - self, - value: str, - param: Optional[Parameter], - ctx: Optional[Context], - ) -> uuid.UUID: - ... - + def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> uuid.UUID: ... + def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> uuid.UUID: ... -def convert_type(ty: Optional[_ConvertibleType], default: Optional[Any] = ...) -> ParamType: - ... +def convert_type(ty: Optional[_ConvertibleType], default: Optional[Any] = ...) -> ParamType: ... # parameter type shortcuts diff --git a/third_party/2and3/click/utils.pyi b/third_party/2and3/click/utils.pyi index d47738f2795c..79664439198d 100644 --- a/third_party/2and3/click/utils.pyi +++ b/third_party/2and3/click/utils.pyi @@ -1,23 +1,11 @@ from typing import IO, Any, Callable, Iterator, List, Optional, Text, TypeVar, Union -_T = TypeVar('_T') - - -def _posixify(name: str) -> str: - ... - - -def safecall(func: _T) -> _T: - ... - - -def make_str(value: Any) -> str: - ... - - -def make_default_short_help(help: str, max_length: int = ...): - ... +_T = TypeVar("_T") +def _posixify(name: str) -> str: ... +def safecall(func: _T) -> _T: ... +def make_str(value: Any) -> str: ... +def make_default_short_help(help: str, max_length: int = ...): ... class LazyFile: name: str @@ -25,92 +13,31 @@ class LazyFile: encoding: Optional[str] errors: str atomic: bool - def __init__( - self, - filename: str, - mode: str = ..., - encoding: Optional[str] = ..., - errors: str = ..., - atomic: bool = ... - ) -> None: - ... - - def open(self) -> IO: - ... - - def close(self) -> None: - ... - - def close_intelligently(self) -> None: - ... - - def __enter__(self) -> LazyFile: - ... - - def __exit__(self, exc_type, exc_value, tb): - ... - - def __iter__(self) -> Iterator: - ... - + self, filename: str, mode: str = ..., encoding: Optional[str] = ..., errors: str = ..., atomic: bool = ... + ) -> None: ... + def open(self) -> IO: ... + def close(self) -> None: ... + def close_intelligently(self) -> None: ... + def __enter__(self) -> LazyFile: ... + def __exit__(self, exc_type, exc_value, tb): ... + def __iter__(self) -> Iterator: ... class KeepOpenFile: _file: IO - - def __init__(self, file: IO) -> None: - ... - - def __enter__(self) -> KeepOpenFile: - ... - - def __exit__(self, exc_type, exc_value, tb): - ... - - def __iter__(self) -> Iterator: - ... - + def __init__(self, file: IO) -> None: ... + def __enter__(self) -> KeepOpenFile: ... + def __exit__(self, exc_type, exc_value, tb): ... + def __iter__(self) -> Iterator: ... def echo( - message: object = ..., - file: Optional[IO] = ..., - nl: bool = ..., - err: bool = ..., - color: Optional[bool] = ..., -) -> None: - ... - - -def get_binary_stream(name: str) -> IO[bytes]: - ... - - -def get_text_stream( - name: str, encoding: Optional[str] = ..., errors: str = ... -) -> IO[str]: - ... - - + message: object = ..., file: Optional[IO] = ..., nl: bool = ..., err: bool = ..., color: Optional[bool] = ... +) -> None: ... +def get_binary_stream(name: str) -> IO[bytes]: ... +def get_text_stream(name: str, encoding: Optional[str] = ..., errors: str = ...) -> IO[str]: ... def open_file( - filename: str, - mode: str = ..., - encoding: Optional[str] = ..., - errors: str = ..., - lazy: bool = ..., - atomic: bool = ... -) -> Union[IO, LazyFile, KeepOpenFile]: - ... - - -def get_os_args() -> List[str]: - ... - - -def format_filename(filename: str, shorten: bool = ...) -> str: - ... - - -def get_app_dir( - app_name: str, roaming: bool = ..., force_posix: bool = ... -) -> str: - ... + filename: str, mode: str = ..., encoding: Optional[str] = ..., errors: str = ..., lazy: bool = ..., atomic: bool = ... +) -> Union[IO, LazyFile, KeepOpenFile]: ... +def get_os_args() -> List[str]: ... +def format_filename(filename: str, shorten: bool = ...) -> str: ... +def get_app_dir(app_name: str, roaming: bool = ..., force_posix: bool = ...) -> str: ... diff --git a/third_party/2and3/croniter.pyi b/third_party/2and3/croniter.pyi index 0d01b7e0534d..293825e01e2b 100644 --- a/third_party/2and3/croniter.pyi +++ b/third_party/2and3/croniter.pyi @@ -2,7 +2,7 @@ import datetime from typing import Any, Dict, Iterator, List, Optional, Text, Tuple, Type, TypeVar, Union _RetType = Union[Type[float], Type[datetime.datetime]] -_SelfT = TypeVar('_SelfT', bound=croniter) +_SelfT = TypeVar("_SelfT", bound=croniter) class CroniterError(ValueError): ... class CroniterBadCronError(CroniterError): ... @@ -22,7 +22,9 @@ class croniter(Iterator[Any]): start_time: float dst_start_time: float nth_weekday_of_month: Dict[str, Any] - def __init__(self, expr_format: Text, start_time: Optional[Union[float, datetime.datetime]] = ..., ret_type: Optional[_RetType] = ...) -> None: ... + def __init__( + self, expr_format: Text, start_time: Optional[Union[float, datetime.datetime]] = ..., ret_type: Optional[_RetType] = ... + ) -> None: ... # Most return value depend on ret_type, which can be passed in both as a method argument and as # a constructor argument. def get_next(self, ret_type: Optional[_RetType] = ...) -> Any: ... diff --git a/third_party/2and3/dateutil/_common.pyi b/third_party/2and3/dateutil/_common.pyi index 1311a175e1ba..0b088768c011 100644 --- a/third_party/2and3/dateutil/_common.pyi +++ b/third_party/2and3/dateutil/_common.pyi @@ -2,14 +2,9 @@ from typing import Optional class weekday(object): def __init__(self, weekday: int, n: Optional[int] = ...) -> None: ... - def __call__(self, n: int) -> weekday: ... - def __eq__(self, other) -> bool: ... - def __repr__(self) -> str: ... - def __hash__(self) -> int: ... - weekday: int n: int diff --git a/third_party/2and3/dateutil/parser.pyi b/third_party/2and3/dateutil/parser.pyi index 551bf50a290e..d1b24248e47e 100644 --- a/third_party/2and3/dateutil/parser.pyi +++ b/third_party/2and3/dateutil/parser.pyi @@ -3,7 +3,6 @@ from typing import IO, Any, Callable, Dict, List, Mapping, Optional, Text, Tuple _FileOrStr = Union[bytes, Text, IO[str], IO[Any]] - class parserinfo(object): JUMP: List[str] WEEKDAYS: List[Tuple[str, str]] @@ -13,7 +12,6 @@ class parserinfo(object): UTCZONE: List[str] PERTAIN: List[str] TZOFFSET: Dict[str, int] - def __init__(self, dayfirst: bool = ..., yearfirst: bool = ...) -> None: ... def jump(self, name: Text) -> bool: ... def weekday(self, name: Text) -> Optional[int]: ... @@ -28,15 +26,21 @@ class parserinfo(object): class parser(object): def __init__(self, info: Optional[parserinfo] = ...) -> None: ... - def parse(self, timestr: _FileOrStr, - default: Optional[datetime] = ..., - ignoretz: bool = ..., tzinfos: Optional[Mapping[Text, tzinfo]] = ..., - **kwargs: Any) -> datetime: ... + def parse( + self, + timestr: _FileOrStr, + default: Optional[datetime] = ..., + ignoretz: bool = ..., + tzinfos: Optional[Mapping[Text, tzinfo]] = ..., + **kwargs: Any + ) -> datetime: ... def isoparse(dt_str: Union[str, bytes, IO[str], IO[bytes]]) -> datetime: ... DEFAULTPARSER: parser + def parse(timestr: _FileOrStr, parserinfo: Optional[parserinfo] = ..., **kwargs: Any) -> datetime: ... + class _tzparser: ... DEFAULTTZPARSER: _tzparser diff --git a/third_party/2and3/dateutil/relativedelta.pyi b/third_party/2and3/dateutil/relativedelta.pyi index 03f096c179ef..630ca187b085 100644 --- a/third_party/2and3/dateutil/relativedelta.pyi +++ b/third_party/2and3/dateutil/relativedelta.pyi @@ -3,8 +3,8 @@ from typing import Any, List, Optional, SupportsFloat, TypeVar, Union, overload from ._common import weekday -_SelfT = TypeVar('_SelfT', bound=relativedelta) -_DateT = TypeVar('_DateT', date, datetime) +_SelfT = TypeVar("_SelfT", bound=relativedelta) +_DateT = TypeVar("_DateT", date, datetime) # Work around attribute and type having the same name. _weekday = weekday @@ -16,7 +16,6 @@ FR: weekday SA: weekday SU: weekday - class relativedelta(object): years: int months: int @@ -34,22 +33,30 @@ class relativedelta(object): minute: Optional[int] second: Optional[int] microsecond: Optional[int] - def __init__(self, - dt1: Optional[date] = ..., - dt2: Optional[date] = ..., - years: Optional[int] = ..., months: Optional[int] = ..., - days: Optional[int] = ..., leapdays: Optional[int] = ..., - weeks: Optional[int] = ..., - hours: Optional[int] = ..., minutes: Optional[int] = ..., - seconds: Optional[int] = ..., microseconds: Optional[int] = ..., - year: Optional[int] = ..., month: Optional[int] = ..., - day: Optional[int] = ..., - weekday: Optional[Union[int, _weekday]] = ..., - yearday: Optional[int] = ..., - nlyearday: Optional[int] = ..., - hour: Optional[int] = ..., minute: Optional[int] = ..., - second: Optional[int] = ..., - microsecond: Optional[int] = ...) -> None: ... + def __init__( + self, + dt1: Optional[date] = ..., + dt2: Optional[date] = ..., + years: Optional[int] = ..., + months: Optional[int] = ..., + days: Optional[int] = ..., + leapdays: Optional[int] = ..., + weeks: Optional[int] = ..., + hours: Optional[int] = ..., + minutes: Optional[int] = ..., + seconds: Optional[int] = ..., + microseconds: Optional[int] = ..., + year: Optional[int] = ..., + month: Optional[int] = ..., + day: Optional[int] = ..., + weekday: Optional[Union[int, _weekday]] = ..., + yearday: Optional[int] = ..., + nlyearday: Optional[int] = ..., + hour: Optional[int] = ..., + minute: Optional[int] = ..., + second: Optional[int] = ..., + microsecond: Optional[int] = ..., + ) -> None: ... @property def weeks(self) -> int: ... @weeks.setter diff --git a/third_party/2and3/dateutil/rrule.pyi b/third_party/2and3/dateutil/rrule.pyi index 22a0d4ca5620..9f380e7d6aa3 100644 --- a/third_party/2and3/dateutil/rrule.pyi +++ b/third_party/2and3/dateutil/rrule.pyi @@ -11,8 +11,7 @@ HOURLY: int MINUTELY: int SECONDLY: int -class weekday(weekdaybase): - ... +class weekday(weekdaybase): ... MO: weekday TU: weekday @@ -34,24 +33,26 @@ class rrulebase: def between(self, after, before, inc: bool = ..., count: int = ...): ... class rrule(rrulebase): - def __init__(self, - freq, - dtstart: Optional[datetime.datetime] = ..., - interval: int = ..., - wkst: Optional[Union[weekday, int]] = ..., - count: Optional[int] = ..., - until: Optional[Union[datetime.datetime, int]] = ..., - bysetpos: Optional[Union[int, Iterable[int]]] = ..., - bymonth: Optional[Union[int, Iterable[int]]] = ..., - bymonthday: Optional[Union[int, Iterable[int]]] = ..., - byyearday: Optional[Union[int, Iterable[int]]] = ..., - byeaster: Optional[Union[int, Iterable[int]]] = ..., - byweekno: Optional[Union[int, Iterable[int]]] = ..., - byweekday: Optional[Union[int, weekday, Iterable[int], Iterable[weekday]]] = ..., - byhour: Optional[Union[int, Iterable[int]]] = ..., - byminute: Optional[Union[int, Iterable[int]]] = ..., - bysecond: Optional[Union[int, Iterable[int]]] = ..., - cache: bool = ...) -> None: ... + def __init__( + self, + freq, + dtstart: Optional[datetime.datetime] = ..., + interval: int = ..., + wkst: Optional[Union[weekday, int]] = ..., + count: Optional[int] = ..., + until: Optional[Union[datetime.datetime, int]] = ..., + bysetpos: Optional[Union[int, Iterable[int]]] = ..., + bymonth: Optional[Union[int, Iterable[int]]] = ..., + bymonthday: Optional[Union[int, Iterable[int]]] = ..., + byyearday: Optional[Union[int, Iterable[int]]] = ..., + byeaster: Optional[Union[int, Iterable[int]]] = ..., + byweekno: Optional[Union[int, Iterable[int]]] = ..., + byweekday: Optional[Union[int, weekday, Iterable[int], Iterable[weekday]]] = ..., + byhour: Optional[Union[int, Iterable[int]]] = ..., + byminute: Optional[Union[int, Iterable[int]]] = ..., + bysecond: Optional[Union[int, Iterable[int]]] = ..., + cache: bool = ..., + ) -> None: ... def replace(self, **kwargs): ... class _iterinfo: diff --git a/third_party/2and3/dateutil/tz/tz.pyi b/third_party/2and3/dateutil/tz/tz.pyi index 97c3cac7ad60..c41397bdb516 100644 --- a/third_party/2and3/dateutil/tz/tz.pyi +++ b/third_party/2and3/dateutil/tz/tz.pyi @@ -33,7 +33,6 @@ class tzoffset(datetime.tzinfo): __hash__: Any def __ne__(self, other): ... __reduce__: Any - @classmethod def instance(cls, name, offset) -> tzoffset: ... @@ -68,14 +67,21 @@ class tzfile(_tzinfo): class tzrange(tzrangebase): hasdst: bool - def __init__(self, stdabbr: Text, stdoffset: Union[int, datetime.timedelta, None] = ..., dstabbr: Optional[Text] = ..., dstoffset: Union[int, datetime.timedelta, None] = ..., start: Optional[relativedelta] = ..., end: Optional[relativedelta] = ...) -> None: ... + def __init__( + self, + stdabbr: Text, + stdoffset: Union[int, datetime.timedelta, None] = ..., + dstabbr: Optional[Text] = ..., + dstoffset: Union[int, datetime.timedelta, None] = ..., + start: Optional[relativedelta] = ..., + end: Optional[relativedelta] = ..., + ) -> None: ... def transitions(self, year: int) -> Tuple[datetime.datetime, datetime.datetime]: ... def __eq__(self, other): ... class tzstr(tzrange): hasdst: bool def __init__(self, s: Union[bytes, _FileObj], posix_offset: bool = ...) -> None: ... - @classmethod def instance(cls, name, offset) -> tzoffset: ... @@ -91,7 +97,6 @@ def datetime_exists(dt: datetime.datetime, tz: Optional[datetime.tzinfo] = ...) def datetime_ambiguous(dt: datetime.datetime, tz: Optional[datetime.tzinfo] = ...) -> bool: ... def resolve_imaginary(dt: datetime.datetime) -> datetime.datetime: ... - class _GetTZ: def __call__(self, name: Optional[Text] = ...) -> Optional[datetime.tzinfo]: ... def nocache(self, name: Optional[Text]) -> Optional[datetime.tzinfo]: ... diff --git a/third_party/2and3/emoji.pyi b/third_party/2and3/emoji.pyi index 81a1f05ce033..c612cd571453 100644 --- a/third_party/2and3/emoji.pyi +++ b/third_party/2and3/emoji.pyi @@ -2,17 +2,7 @@ from typing import Dict, List, Pattern, Tuple, Union _DEFAULT_DELIMITER: str -def emojize( - string: str, - use_aliases: bool = ..., - delimiters: Tuple[str, str] = ... -) -> str: ... - -def demojize( - string: str, - delimiters: Tuple[str, str] = ... -) -> str: ... - +def emojize(string: str, use_aliases: bool = ..., delimiters: Tuple[str, str] = ...) -> str: ... +def demojize(string: str, delimiters: Tuple[str, str] = ...) -> str: ... def get_emoji_regexp() -> Pattern: ... - def emoji_lis(string: str) -> List[Dict[str, Union[int, str]]]: ... diff --git a/third_party/2and3/first.pyi b/third_party/2and3/first.pyi index a6eb5be0afe9..32f4736bc589 100644 --- a/third_party/2and3/first.pyi +++ b/third_party/2and3/first.pyi @@ -1,8 +1,7 @@ from typing import Any, Callable, Iterable, Optional, TypeVar, Union, overload -_T = TypeVar('_T') -_S = TypeVar('_S') - +_T = TypeVar("_T") +_S = TypeVar("_S") @overload def first(iterable: Iterable[_T]) -> Optional[_T]: ... @overload diff --git a/third_party/2and3/flask/app.pyi b/third_party/2and3/flask/app.pyi index eb34e60cbb8b..8e11826b956f 100644 --- a/third_party/2and3/flask/app.pyi +++ b/third_party/2and3/flask/app.pyi @@ -28,7 +28,7 @@ from .wrappers import Request, Response def setupmethod(f: Any): ... -_T = TypeVar('_T') +_T = TypeVar("_T") class Flask(_PackageBoundObject): request_class: type = ... @@ -74,7 +74,19 @@ class Flask(_PackageBoundObject): url_map: Any = ... subdomain_matching: Any = ... cli: Any = ... - def __init__(self, import_name: str, static_url_path: Optional[str] = ..., static_folder: Optional[str] = ..., static_host: Optional[str] = ..., host_matching: bool = ..., subdomain_matching: bool = ..., template_folder: str = ..., instance_path: Optional[str] = ..., instance_relative_config: bool = ..., root_path: Optional[str] = ...) -> None: ... + def __init__( + self, + import_name: str, + static_url_path: Optional[str] = ..., + static_folder: Optional[str] = ..., + static_host: Optional[str] = ..., + host_matching: bool = ..., + subdomain_matching: bool = ..., + template_folder: str = ..., + instance_path: Optional[str] = ..., + instance_relative_config: bool = ..., + root_path: Optional[str] = ..., + ) -> None: ... @property def name(self) -> str: ... @property @@ -98,7 +110,14 @@ class Flask(_PackageBoundObject): def make_shell_context(self): ... env: Optional[str] = ... debug: bool = ... - def run(self, host: Optional[str] = ..., port: Optional[Union[int, str]] = ..., debug: Optional[bool] = ..., load_dotenv: bool = ..., **options: Any) -> None: ... + def run( + self, + host: Optional[str] = ..., + port: Optional[Union[int, str]] = ..., + debug: Optional[bool] = ..., + load_dotenv: bool = ..., + **options: Any + ) -> None: ... def test_client(self, use_cookies: bool = ..., **kwargs: Any) -> FlaskClient: ... def test_cli_runner(self, **kwargs: Any): ... def open_session(self, request: Any): ... @@ -106,10 +125,19 @@ class Flask(_PackageBoundObject): def make_null_session(self): ... def register_blueprint(self, blueprint: Blueprint, **options: Any) -> None: ... def iter_blueprints(self): ... - def add_url_rule(self, rule: str, endpoint: Optional[str] = ..., view_func: Callable[..., Any] = ..., provide_automatic_options: Optional[bool] = ..., **options: Any) -> None: ... + def add_url_rule( + self, + rule: str, + endpoint: Optional[str] = ..., + view_func: Callable[..., Any] = ..., + provide_automatic_options: Optional[bool] = ..., + **options: Any + ) -> None: ... def route(self, rule: str, **options: Any) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... def endpoint(self, endpoint: str) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... - def errorhandler(self, code_or_exception: Union[int, Type[Exception]]) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + def errorhandler( + self, code_or_exception: Union[int, Type[Exception]] + ) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... def register_error_handler(self, code_or_exception: Union[int, Type[Exception]], f: Callable[..., Any]) -> None: ... def template_filter(self, name: Optional[Any] = ...): ... def add_template_filter(self, f: Any, name: Optional[Any] = ...) -> None: ... @@ -151,7 +179,6 @@ class Flask(_PackageBoundObject): def test_request_context(self, *args: Any, **kwargs: Any) -> ContextManager[RequestContext]: ... def wsgi_app(self, environ: Any, start_response: Any): ... def __call__(self, environ: Any, start_response: Any): ... - # These are not preset at runtime but we add them since monkeypatching this # class is quite common. def __setattr__(self, name: str, value: Any): ... diff --git a/third_party/2and3/flask/blueprints.pyi b/third_party/2and3/flask/blueprints.pyi index 3c0d6b151252..e3b8abaeacd5 100644 --- a/third_party/2and3/flask/blueprints.pyi +++ b/third_party/2and3/flask/blueprints.pyi @@ -6,7 +6,7 @@ from typing import Any, Callable, Optional, Type, TypeVar, Union from .helpers import _PackageBoundObject -_T = TypeVar('_T') +_T = TypeVar("_T") class BlueprintSetupState: app: Any = ... @@ -17,7 +17,9 @@ class BlueprintSetupState: url_prefix: Any = ... url_defaults: Any = ... def __init__(self, blueprint: Any, app: Any, options: Any, first_registration: Any) -> None: ... - def add_url_rule(self, rule: str, endpoint: Optional[str] = ..., view_func: Callable[..., Any] = ..., **options: Any) -> None: ... + def add_url_rule( + self, rule: str, endpoint: Optional[str] = ..., view_func: Callable[..., Any] = ..., **options: Any + ) -> None: ... class Blueprint(_PackageBoundObject): warn_on_modifications: bool = ... @@ -33,13 +35,26 @@ class Blueprint(_PackageBoundObject): static_url_path: Optional[str] = ... deferred_functions: Any = ... url_values_defaults: Any = ... - def __init__(self, name: str, import_name: str, static_folder: Optional[str] = ..., static_url_path: Optional[str] = ..., template_folder: Optional[str] = ..., url_prefix: Optional[str] = ..., subdomain: Optional[str] = ..., url_defaults: Optional[Any] = ..., root_path: Optional[str] = ...) -> None: ... + def __init__( + self, + name: str, + import_name: str, + static_folder: Optional[str] = ..., + static_url_path: Optional[str] = ..., + template_folder: Optional[str] = ..., + url_prefix: Optional[str] = ..., + subdomain: Optional[str] = ..., + url_defaults: Optional[Any] = ..., + root_path: Optional[str] = ..., + ) -> None: ... def record(self, func: Any) -> None: ... def record_once(self, func: Any): ... def make_setup_state(self, app: Any, options: Any, first_registration: bool = ...): ... def register(self, app: Any, options: Any, first_registration: bool = ...) -> None: ... def route(self, rule: str, **options: Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ... - def add_url_rule(self, rule: str, endpoint: Optional[str] = ..., view_func: Callable[..., Any] = ..., **options: Any) -> None: ... + def add_url_rule( + self, rule: str, endpoint: Optional[str] = ..., view_func: Callable[..., Any] = ..., **options: Any + ) -> None: ... def endpoint(self, endpoint: str) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... def app_template_filter(self, name: Optional[Any] = ...): ... def add_app_template_filter(self, f: Any, name: Optional[Any] = ...) -> None: ... @@ -61,5 +76,7 @@ class Blueprint(_PackageBoundObject): def url_defaults(self, f: Any): ... def app_url_value_preprocessor(self, f: Any): ... def app_url_defaults(self, f: Any): ... - def errorhandler(self, code_or_exception: Union[int, Type[Exception]]) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + def errorhandler( + self, code_or_exception: Union[int, Type[Exception]] + ) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... def register_error_handler(self, code_or_exception: Union[int, Type[Exception]], f: Callable[..., Any]) -> None: ... diff --git a/third_party/2and3/flask/cli.pyi b/third_party/2and3/flask/cli.pyi index 405a15186dab..757499041d1c 100644 --- a/third_party/2and3/flask/cli.pyi +++ b/third_party/2and3/flask/cli.pyi @@ -43,7 +43,14 @@ class AppGroup(click.Group): class FlaskGroup(AppGroup): create_app: Any = ... load_dotenv: Any = ... - def __init__(self, add_default_commands: bool = ..., create_app: Optional[Any] = ..., add_version_option: bool = ..., load_dotenv: bool = ..., **extra: Any) -> None: ... + def __init__( + self, + add_default_commands: bool = ..., + create_app: Optional[Any] = ..., + add_version_option: bool = ..., + load_dotenv: bool = ..., + **extra: Any + ) -> None: ... def get_command(self, ctx: Any, name: Any): ... def list_commands(self, ctx: Any): ... def main(self, *args: Any, **kwargs: Any): ... @@ -57,7 +64,9 @@ class CertParamType(click.ParamType): def __init__(self) -> None: ... def convert(self, value: Any, param: Any, ctx: Any): ... -def run_command(info: Any, host: Any, port: Any, reload: Any, debugger: Any, eager_loading: Any, with_threads: Any, cert: Any) -> None: ... +def run_command( + info: Any, host: Any, port: Any, reload: Any, debugger: Any, eager_loading: Any, with_threads: Any, cert: Any +) -> None: ... def shell_command() -> None: ... def routes_command(sort: Any, all_methods: Any): ... diff --git a/third_party/2and3/flask/helpers.pyi b/third_party/2and3/flask/helpers.pyi index 0f828e6bdf9d..07ee9fd68241 100644 --- a/third_party/2and3/flask/helpers.pyi +++ b/third_party/2and3/flask/helpers.pyi @@ -16,7 +16,16 @@ def url_for(endpoint: Any, **values: Any): ... def get_template_attribute(template_name: Any, attribute: Any): ... def flash(message: Any, category: str = ...) -> None: ... def get_flashed_messages(with_categories: bool = ..., category_filter: Any = ...): ... -def send_file(filename_or_fp: Any, mimetype: Optional[Any] = ..., as_attachment: bool = ..., attachment_filename: Optional[Any] = ..., add_etags: bool = ..., cache_timeout: Optional[Any] = ..., conditional: bool = ..., last_modified: Optional[Any] = ...): ... +def send_file( + filename_or_fp: Any, + mimetype: Optional[Any] = ..., + as_attachment: bool = ..., + attachment_filename: Optional[Any] = ..., + add_etags: bool = ..., + cache_timeout: Optional[Any] = ..., + conditional: bool = ..., + last_modified: Optional[Any] = ..., +): ... def safe_join(directory: Any, *pathnames: Any): ... def send_from_directory(directory: Any, filename: Any, **options: Any): ... def get_root_path(import_name: Any): ... diff --git a/third_party/2and3/flask/testing.pyi b/third_party/2and3/flask/testing.pyi index 7b9c273ba046..33aaa76f10df 100644 --- a/third_party/2and3/flask/testing.pyi +++ b/third_party/2and3/flask/testing.pyi @@ -9,7 +9,15 @@ from click.testing import CliRunner, Result from werkzeug.test import Client -def make_test_environ_builder(app: Any, path: str = ..., base_url: Optional[Any] = ..., subdomain: Optional[Any] = ..., url_scheme: Optional[Any] = ..., *args: Any, **kwargs: Any): ... +def make_test_environ_builder( + app: Any, + path: str = ..., + base_url: Optional[Any] = ..., + subdomain: Optional[Any] = ..., + url_scheme: Optional[Any] = ..., + *args: Any, + **kwargs: Any, +): ... class FlaskClient(Client): preserve_context: bool = ... @@ -32,5 +40,4 @@ class FlaskCliRunner(CliRunner): catch_exceptions: bool = ..., color: bool = ..., **extra: Any, - ) -> Result: - ... + ) -> Result: ... diff --git a/third_party/2and3/google/protobuf/any_pb2.pyi b/third_party/2and3/google/protobuf/any_pb2.pyi index 234d7452123c..c25e0ccb82ae 100644 --- a/third_party/2and3/google/protobuf/any_pb2.pyi +++ b/third_party/2and3/google/protobuf/any_pb2.pyi @@ -6,11 +6,6 @@ from google.protobuf.message import Message class Any(Message, well_known_types.Any_): type_url: Text value: bytes - - def __init__(self, - type_url: Optional[Text] = ..., - value: Optional[bytes] = ..., - ) -> None: ... - + def __init__(self, type_url: Optional[Text] = ..., value: Optional[bytes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Any: ... diff --git a/third_party/2and3/google/protobuf/any_test_pb2.pyi b/third_party/2and3/google/protobuf/any_test_pb2.pyi index bfd73816b56a..b0150557b7c7 100644 --- a/third_party/2and3/google/protobuf/any_test_pb2.pyi +++ b/third_party/2and3/google/protobuf/any_test_pb2.pyi @@ -6,18 +6,12 @@ from google.protobuf.message import Message class TestAny(Message): int32_value: int - @property def any_value(self) -> Any: ... - @property def repeated_any_value(self) -> RepeatedCompositeFieldContainer[Any]: ... - - def __init__(self, - int32_value: Optional[int] = ..., - any_value: Optional[Any] = ..., - repeated_any_value: Optional[Iterable[Any]] = ..., - ) -> None: ... - + def __init__( + self, int32_value: Optional[int] = ..., any_value: Optional[Any] = ..., repeated_any_value: Optional[Iterable[Any]] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAny: ... diff --git a/third_party/2and3/google/protobuf/api_pb2.pyi b/third_party/2and3/google/protobuf/api_pb2.pyi index 6c0ddb63870d..8218d68f5e1a 100644 --- a/third_party/2and3/google/protobuf/api_pb2.pyi +++ b/third_party/2and3/google/protobuf/api_pb2.pyi @@ -9,33 +9,27 @@ class Api(Message): name: Text version: Text syntax: Syntax - @property def methods(self) -> RepeatedCompositeFieldContainer[Method]: ... - @property def options(self) -> RepeatedCompositeFieldContainer[Option]: ... - @property def source_context(self) -> SourceContext: ... - @property def mixins(self) -> RepeatedCompositeFieldContainer[Mixin]: ... - - def __init__(self, - name: Optional[Text] = ..., - methods: Optional[Iterable[Method]] = ..., - options: Optional[Iterable[Option]] = ..., - version: Optional[Text] = ..., - source_context: Optional[SourceContext] = ..., - mixins: Optional[Iterable[Mixin]] = ..., - syntax: Optional[Syntax] = ..., - ) -> None: ... - + def __init__( + self, + name: Optional[Text] = ..., + methods: Optional[Iterable[Method]] = ..., + options: Optional[Iterable[Option]] = ..., + version: Optional[Text] = ..., + source_context: Optional[SourceContext] = ..., + mixins: Optional[Iterable[Mixin]] = ..., + syntax: Optional[Syntax] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> Api: ... - class Method(Message): name: Text request_type_url: Text @@ -43,32 +37,24 @@ class Method(Message): response_type_url: Text response_streaming: bool syntax: Syntax - @property def options(self) -> RepeatedCompositeFieldContainer[Option]: ... - - def __init__(self, - name: Optional[Text] = ..., - request_type_url: Optional[Text] = ..., - request_streaming: Optional[bool] = ..., - response_type_url: Optional[Text] = ..., - response_streaming: Optional[bool] = ..., - options: Optional[Iterable[Option]] = ..., - syntax: Optional[Syntax] = ..., - ) -> None: ... - + def __init__( + self, + name: Optional[Text] = ..., + request_type_url: Optional[Text] = ..., + request_streaming: Optional[bool] = ..., + response_type_url: Optional[Text] = ..., + response_streaming: Optional[bool] = ..., + options: Optional[Iterable[Option]] = ..., + syntax: Optional[Syntax] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> Method: ... - class Mixin(Message): name: Text root: Text - - def __init__(self, - name: Optional[Text] = ..., - root: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, name: Optional[Text] = ..., root: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Mixin: ... diff --git a/third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi b/third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi index 98190a30249a..9588f452ddf0 100644 --- a/third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi +++ b/third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi @@ -9,63 +9,42 @@ class Version(Message): minor: int patch: int suffix: Text - - def __init__(self, - major: Optional[int] = ..., - minor: Optional[int] = ..., - patch: Optional[int] = ..., - suffix: Optional[Text] = ..., - ) -> None: ... - + def __init__( + self, major: Optional[int] = ..., minor: Optional[int] = ..., patch: Optional[int] = ..., suffix: Optional[Text] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> Version: ... - class CodeGeneratorRequest(Message): file_to_generate: RepeatedScalarFieldContainer[Text] parameter: Text - @property def proto_file(self) -> RepeatedCompositeFieldContainer[FileDescriptorProto]: ... - @property def compiler_version(self) -> Version: ... - - def __init__(self, - file_to_generate: Optional[Iterable[Text]] = ..., - parameter: Optional[Text] = ..., - proto_file: Optional[Iterable[FileDescriptorProto]] = ..., - compiler_version: Optional[Version] = ..., - ) -> None: ... - + def __init__( + self, + file_to_generate: Optional[Iterable[Text]] = ..., + parameter: Optional[Text] = ..., + proto_file: Optional[Iterable[FileDescriptorProto]] = ..., + compiler_version: Optional[Version] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> CodeGeneratorRequest: ... - class CodeGeneratorResponse(Message): - class File(Message): name: Text insertion_point: Text content: Text - - def __init__(self, - name: Optional[Text] = ..., - insertion_point: Optional[Text] = ..., - content: Optional[Text] = ..., - ) -> None: ... - + def __init__( + self, name: Optional[Text] = ..., insertion_point: Optional[Text] = ..., content: Optional[Text] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> CodeGeneratorResponse.File: ... error: Text - @property def file(self) -> RepeatedCompositeFieldContainer[CodeGeneratorResponse.File]: ... - - def __init__(self, - error: Optional[Text] = ..., - file: Optional[Iterable[CodeGeneratorResponse.File]] = ..., - ) -> None: ... - + def __init__(self, error: Optional[Text] = ..., file: Optional[Iterable[CodeGeneratorResponse.File]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> CodeGeneratorResponse: ... diff --git a/third_party/2and3/google/protobuf/descriptor.pyi b/third_party/2and3/google/protobuf/descriptor.pyi index 69922c407f2e..876741595310 100644 --- a/third_party/2and3/google/protobuf/descriptor.pyi +++ b/third_party/2and3/google/protobuf/descriptor.pyi @@ -28,12 +28,32 @@ class _NestedDescriptorBase(DescriptorBase): full_name: Any file: Any containing_type: Any - def __init__(self, options, options_class_name, name, full_name, file, containing_type, serialized_start=..., serialized_end=...) -> None: ... + def __init__( + self, options, options_class_name, name, full_name, file, containing_type, serialized_start=..., serialized_end=... + ) -> None: ... def GetTopLevelContainingType(self): ... def CopyToProto(self, proto): ... class Descriptor(_NestedDescriptorBase): - def __new__(cls, name, full_name, filename, containing_type, fields, nested_types, enum_types, extensions, options=..., is_extendable=..., extension_ranges=..., oneofs=..., file=..., serialized_start=..., serialized_end=..., syntax=...): ... + def __new__( + cls, + name, + full_name, + filename, + containing_type, + fields, + nested_types, + enum_types, + extensions, + options=..., + is_extendable=..., + extension_ranges=..., + oneofs=..., + file=..., + serialized_start=..., + serialized_end=..., + syntax=..., + ): ... fields: Any fields_by_number: Any fields_by_name: Any @@ -49,7 +69,25 @@ class Descriptor(_NestedDescriptorBase): oneofs: Any oneofs_by_name: Any syntax: Any - def __init__(self, name, full_name, filename, containing_type, fields, nested_types, enum_types, extensions, options=..., is_extendable=..., extension_ranges=..., oneofs=..., file=..., serialized_start=..., serialized_end=..., syntax=...) -> None: ... + def __init__( + self, + name, + full_name, + filename, + containing_type, + fields, + nested_types, + enum_types, + extensions, + options=..., + is_extendable=..., + extension_ranges=..., + oneofs=..., + file=..., + serialized_start=..., + serialized_end=..., + syntax=..., + ) -> None: ... def EnumValueName(self, enum, value): ... def CopyToProto(self, proto): ... def GetOptions(self) -> MessageOptions: ... @@ -92,7 +130,26 @@ class FieldDescriptor(DescriptorBase): MAX_FIELD_NUMBER: Any FIRST_RESERVED_FIELD_NUMBER: Any LAST_RESERVED_FIELD_NUMBER: Any - def __new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options=..., file=..., has_default_value=..., containing_oneof=...): ... + def __new__( + cls, + name, + full_name, + index, + number, + type, + cpp_type, + label, + default_value, + message_type, + enum_type, + containing_type, + is_extension, + extension_scope, + options=..., + file=..., + has_default_value=..., + containing_oneof=..., + ): ... name: Any full_name: Any index: Any @@ -108,17 +165,58 @@ class FieldDescriptor(DescriptorBase): is_extension: Any extension_scope: Any containing_oneof: Any - def __init__(self, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options=..., file=..., has_default_value=..., containing_oneof=...) -> None: ... + def __init__( + self, + name, + full_name, + index, + number, + type, + cpp_type, + label, + default_value, + message_type, + enum_type, + containing_type, + is_extension, + extension_scope, + options=..., + file=..., + has_default_value=..., + containing_oneof=..., + ) -> None: ... @staticmethod def ProtoTypeToCppProtoType(proto_type): ... def GetOptions(self) -> FieldOptions: ... class EnumDescriptor(_NestedDescriptorBase): - def __new__(cls, name, full_name, filename, values, containing_type=..., options=..., file=..., serialized_start=..., serialized_end=...): ... + def __new__( + cls, + name, + full_name, + filename, + values, + containing_type=..., + options=..., + file=..., + serialized_start=..., + serialized_end=..., + ): ... values: Any values_by_name: Any values_by_number: Any - def __init__(self, name, full_name, filename, values, containing_type=..., options=..., file=..., serialized_start=..., serialized_end=...) -> None: ... + def __init__( + self, + name, + full_name, + filename, + values, + containing_type=..., + options=..., + file=..., + serialized_start=..., + serialized_end=..., + ) -> None: ... def CopyToProto(self, proto): ... def GetOptions(self) -> EnumOptions: ... @@ -145,7 +243,9 @@ class ServiceDescriptor(_NestedDescriptorBase): index: Any methods: Any methods_by_name: Any - def __init__(self, name, full_name, index, methods, options=..., file=..., serialized_start=..., serialized_end=...) -> None: ... + def __init__( + self, name, full_name, index, methods, options=..., file=..., serialized_start=..., serialized_end=... + ) -> None: ... def FindMethodByName(self, name): ... def CopyToProto(self, proto): ... def GetOptions(self) -> ServiceOptions: ... @@ -161,7 +261,9 @@ class MethodDescriptor(DescriptorBase): def GetOptions(self) -> MethodOptions: ... class FileDescriptor(DescriptorBase): - def __new__(cls, name, package, options=..., serialized_pb=..., dependencies=..., public_dependencies=..., syntax=..., pool=...): ... + def __new__( + cls, name, package, options=..., serialized_pb=..., dependencies=..., public_dependencies=..., syntax=..., pool=... + ): ... _options: Any pool: Any message_types_by_name: Any @@ -174,7 +276,9 @@ class FileDescriptor(DescriptorBase): services_by_name: Any dependencies: Any public_dependencies: Any - def __init__(self, name, package, options=..., serialized_pb=..., dependencies=..., public_dependencies=..., syntax=..., pool=...) -> None: ... + def __init__( + self, name, package, options=..., serialized_pb=..., dependencies=..., public_dependencies=..., syntax=..., pool=... + ) -> None: ... def CopyToProto(self, proto): ... def GetOptions(self) -> FileOptions: ... diff --git a/third_party/2and3/google/protobuf/descriptor_pb2.pyi b/third_party/2and3/google/protobuf/descriptor_pb2.pyi index e4f238df5956..0d564f39d232 100644 --- a/third_party/2and3/google/protobuf/descriptor_pb2.pyi +++ b/third_party/2and3/google/protobuf/descriptor_pb2.pyi @@ -4,18 +4,12 @@ from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, from google.protobuf.message import Message class FileDescriptorSet(Message): - @property def file(self) -> RepeatedCompositeFieldContainer[FileDescriptorProto]: ... - - def __init__(self, - file: Optional[Iterable[FileDescriptorProto]] = ..., - ) -> None: ... - + def __init__(self, file: Optional[Iterable[FileDescriptorProto]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> FileDescriptorSet: ... - class FileDescriptorProto(Message): name: Text package: Text @@ -23,158 +17,104 @@ class FileDescriptorProto(Message): public_dependency: RepeatedScalarFieldContainer[int] weak_dependency: RepeatedScalarFieldContainer[int] syntax: Text - @property - def message_type( - self) -> RepeatedCompositeFieldContainer[DescriptorProto]: ... - + def message_type(self) -> RepeatedCompositeFieldContainer[DescriptorProto]: ... @property - def enum_type( - self) -> RepeatedCompositeFieldContainer[EnumDescriptorProto]: ... - + def enum_type(self) -> RepeatedCompositeFieldContainer[EnumDescriptorProto]: ... @property - def service( - self) -> RepeatedCompositeFieldContainer[ServiceDescriptorProto]: ... - + def service(self) -> RepeatedCompositeFieldContainer[ServiceDescriptorProto]: ... @property - def extension( - self) -> RepeatedCompositeFieldContainer[FieldDescriptorProto]: ... - + def extension(self) -> RepeatedCompositeFieldContainer[FieldDescriptorProto]: ... @property def options(self) -> FileOptions: ... - @property def source_code_info(self) -> SourceCodeInfo: ... - - def __init__(self, - name: Optional[Text] = ..., - package: Optional[Text] = ..., - dependency: Optional[Iterable[Text]] = ..., - public_dependency: Optional[Iterable[int]] = ..., - weak_dependency: Optional[Iterable[int]] = ..., - message_type: Optional[Iterable[DescriptorProto]] = ..., - enum_type: Optional[Iterable[EnumDescriptorProto]] = ..., - service: Optional[Iterable[ServiceDescriptorProto]] = ..., - extension: Optional[Iterable[FieldDescriptorProto]] = ..., - options: Optional[FileOptions] = ..., - source_code_info: Optional[SourceCodeInfo] = ..., - syntax: Optional[Text] = ..., - ) -> None: ... - + def __init__( + self, + name: Optional[Text] = ..., + package: Optional[Text] = ..., + dependency: Optional[Iterable[Text]] = ..., + public_dependency: Optional[Iterable[int]] = ..., + weak_dependency: Optional[Iterable[int]] = ..., + message_type: Optional[Iterable[DescriptorProto]] = ..., + enum_type: Optional[Iterable[EnumDescriptorProto]] = ..., + service: Optional[Iterable[ServiceDescriptorProto]] = ..., + extension: Optional[Iterable[FieldDescriptorProto]] = ..., + options: Optional[FileOptions] = ..., + source_code_info: Optional[SourceCodeInfo] = ..., + syntax: Optional[Text] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> FileDescriptorProto: ... - class DescriptorProto(Message): - class ExtensionRange(Message): start: int end: int - @property def options(self) -> ExtensionRangeOptions: ... - - def __init__(self, - start: Optional[int] = ..., - end: Optional[int] = ..., - options: Optional[ExtensionRangeOptions] = ..., - ) -> None: ... - + def __init__( + self, start: Optional[int] = ..., end: Optional[int] = ..., options: Optional[ExtensionRangeOptions] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> DescriptorProto.ExtensionRange: ... - class ReservedRange(Message): start: int end: int - - def __init__(self, - start: Optional[int] = ..., - end: Optional[int] = ..., - ) -> None: ... - + def __init__(self, start: Optional[int] = ..., end: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> DescriptorProto.ReservedRange: ... name: Text reserved_name: RepeatedScalarFieldContainer[Text] - @property - def field( - self) -> RepeatedCompositeFieldContainer[FieldDescriptorProto]: ... - + def field(self) -> RepeatedCompositeFieldContainer[FieldDescriptorProto]: ... @property - def extension( - self) -> RepeatedCompositeFieldContainer[FieldDescriptorProto]: ... - + def extension(self) -> RepeatedCompositeFieldContainer[FieldDescriptorProto]: ... @property - def nested_type( - self) -> RepeatedCompositeFieldContainer[DescriptorProto]: ... - + def nested_type(self) -> RepeatedCompositeFieldContainer[DescriptorProto]: ... @property - def enum_type( - self) -> RepeatedCompositeFieldContainer[EnumDescriptorProto]: ... - + def enum_type(self) -> RepeatedCompositeFieldContainer[EnumDescriptorProto]: ... @property - def extension_range( - self) -> RepeatedCompositeFieldContainer[DescriptorProto.ExtensionRange]: ... - + def extension_range(self) -> RepeatedCompositeFieldContainer[DescriptorProto.ExtensionRange]: ... @property - def oneof_decl( - self) -> RepeatedCompositeFieldContainer[OneofDescriptorProto]: ... - + def oneof_decl(self) -> RepeatedCompositeFieldContainer[OneofDescriptorProto]: ... @property def options(self) -> MessageOptions: ... - @property - def reserved_range( - self) -> RepeatedCompositeFieldContainer[DescriptorProto.ReservedRange]: ... - - def __init__(self, - name: Optional[Text] = ..., - field: Optional[Iterable[FieldDescriptorProto]] = ..., - extension: Optional[Iterable[FieldDescriptorProto]] = ..., - nested_type: Optional[Iterable[DescriptorProto]] = ..., - enum_type: Optional[Iterable[EnumDescriptorProto]] = ..., - extension_range: Optional[Iterable[DescriptorProto.ExtensionRange]] = ..., - oneof_decl: Optional[Iterable[OneofDescriptorProto]] = ..., - options: Optional[MessageOptions] = ..., - reserved_range: Optional[Iterable[DescriptorProto.ReservedRange]] = ..., - reserved_name: Optional[Iterable[Text]] = ..., - ) -> None: ... - + def reserved_range(self) -> RepeatedCompositeFieldContainer[DescriptorProto.ReservedRange]: ... + def __init__( + self, + name: Optional[Text] = ..., + field: Optional[Iterable[FieldDescriptorProto]] = ..., + extension: Optional[Iterable[FieldDescriptorProto]] = ..., + nested_type: Optional[Iterable[DescriptorProto]] = ..., + enum_type: Optional[Iterable[EnumDescriptorProto]] = ..., + extension_range: Optional[Iterable[DescriptorProto.ExtensionRange]] = ..., + oneof_decl: Optional[Iterable[OneofDescriptorProto]] = ..., + options: Optional[MessageOptions] = ..., + reserved_range: Optional[Iterable[DescriptorProto.ReservedRange]] = ..., + reserved_name: Optional[Iterable[Text]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> DescriptorProto: ... - class ExtensionRangeOptions(Message): - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__(self, uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ExtensionRangeOptions: ... - class FieldDescriptorProto(Message): - class Type(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> FieldDescriptorProto.Type: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[FieldDescriptorProto.Type]: ... - @classmethod def items(cls) -> List[Tuple[bytes, FieldDescriptorProto.Type]]: ... TYPE_DOUBLE: FieldDescriptorProto.Type @@ -195,21 +135,15 @@ class FieldDescriptorProto(Message): TYPE_SFIXED64: FieldDescriptorProto.Type TYPE_SINT32: FieldDescriptorProto.Type TYPE_SINT64: FieldDescriptorProto.Type - class Label(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> FieldDescriptorProto.Label: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[FieldDescriptorProto.Label]: ... - @classmethod def items(cls) -> List[Tuple[bytes, FieldDescriptorProto.Label]]: ... LABEL_OPTIONAL: FieldDescriptorProto.Label @@ -224,158 +158,114 @@ class FieldDescriptorProto(Message): default_value: Text oneof_index: int json_name: Text - @property def options(self) -> FieldOptions: ... - - def __init__(self, - name: Optional[Text] = ..., - number: Optional[int] = ..., - label: Optional[FieldDescriptorProto.Label] = ..., - type: Optional[FieldDescriptorProto.Type] = ..., - type_name: Optional[Text] = ..., - extendee: Optional[Text] = ..., - default_value: Optional[Text] = ..., - oneof_index: Optional[int] = ..., - json_name: Optional[Text] = ..., - options: Optional[FieldOptions] = ..., - ) -> None: ... - + def __init__( + self, + name: Optional[Text] = ..., + number: Optional[int] = ..., + label: Optional[FieldDescriptorProto.Label] = ..., + type: Optional[FieldDescriptorProto.Type] = ..., + type_name: Optional[Text] = ..., + extendee: Optional[Text] = ..., + default_value: Optional[Text] = ..., + oneof_index: Optional[int] = ..., + json_name: Optional[Text] = ..., + options: Optional[FieldOptions] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> FieldDescriptorProto: ... - class OneofDescriptorProto(Message): name: Text - @property def options(self) -> OneofOptions: ... - - def __init__(self, - name: Optional[Text] = ..., - options: Optional[OneofOptions] = ..., - ) -> None: ... - + def __init__(self, name: Optional[Text] = ..., options: Optional[OneofOptions] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> OneofDescriptorProto: ... - class EnumDescriptorProto(Message): - class EnumReservedRange(Message): start: int end: int - - def __init__(self, - start: Optional[int] = ..., - end: Optional[int] = ..., - ) -> None: ... - + def __init__(self, start: Optional[int] = ..., end: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> EnumDescriptorProto.EnumReservedRange: ... + def FromString(cls, s: bytes) -> EnumDescriptorProto.EnumReservedRange: ... name: Text reserved_name: RepeatedScalarFieldContainer[Text] - @property - def value( - self) -> RepeatedCompositeFieldContainer[EnumValueDescriptorProto]: ... - + def value(self) -> RepeatedCompositeFieldContainer[EnumValueDescriptorProto]: ... @property def options(self) -> EnumOptions: ... - @property - def reserved_range( - self) -> RepeatedCompositeFieldContainer[EnumDescriptorProto.EnumReservedRange]: ... - - def __init__(self, - name: Optional[Text] = ..., - value: Optional[Iterable[EnumValueDescriptorProto]] = ..., - options: Optional[EnumOptions] = ..., - reserved_range: Optional[Iterable[EnumDescriptorProto.EnumReservedRange]] = ..., - reserved_name: Optional[Iterable[Text]] = ..., - ) -> None: ... - + def reserved_range(self) -> RepeatedCompositeFieldContainer[EnumDescriptorProto.EnumReservedRange]: ... + def __init__( + self, + name: Optional[Text] = ..., + value: Optional[Iterable[EnumValueDescriptorProto]] = ..., + options: Optional[EnumOptions] = ..., + reserved_range: Optional[Iterable[EnumDescriptorProto.EnumReservedRange]] = ..., + reserved_name: Optional[Iterable[Text]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> EnumDescriptorProto: ... - class EnumValueDescriptorProto(Message): name: Text number: int - @property def options(self) -> EnumValueOptions: ... - - def __init__(self, - name: Optional[Text] = ..., - number: Optional[int] = ..., - options: Optional[EnumValueOptions] = ..., - ) -> None: ... - + def __init__( + self, name: Optional[Text] = ..., number: Optional[int] = ..., options: Optional[EnumValueOptions] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> EnumValueDescriptorProto: ... - class ServiceDescriptorProto(Message): name: Text - @property - def method( - self) -> RepeatedCompositeFieldContainer[MethodDescriptorProto]: ... - + def method(self) -> RepeatedCompositeFieldContainer[MethodDescriptorProto]: ... @property def options(self) -> ServiceOptions: ... - - def __init__(self, - name: Optional[Text] = ..., - method: Optional[Iterable[MethodDescriptorProto]] = ..., - options: Optional[ServiceOptions] = ..., - ) -> None: ... - + def __init__( + self, + name: Optional[Text] = ..., + method: Optional[Iterable[MethodDescriptorProto]] = ..., + options: Optional[ServiceOptions] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> ServiceDescriptorProto: ... - class MethodDescriptorProto(Message): name: Text input_type: Text output_type: Text client_streaming: bool server_streaming: bool - @property def options(self) -> MethodOptions: ... - - def __init__(self, - name: Optional[Text] = ..., - input_type: Optional[Text] = ..., - output_type: Optional[Text] = ..., - options: Optional[MethodOptions] = ..., - client_streaming: Optional[bool] = ..., - server_streaming: Optional[bool] = ..., - ) -> None: ... - + def __init__( + self, + name: Optional[Text] = ..., + input_type: Optional[Text] = ..., + output_type: Optional[Text] = ..., + options: Optional[MethodOptions] = ..., + client_streaming: Optional[bool] = ..., + server_streaming: Optional[bool] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> MethodDescriptorProto: ... - class FileOptions(Message): - class OptimizeMode(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> FileOptions.OptimizeMode: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[FileOptions.OptimizeMode]: ... - @classmethod def items(cls) -> List[Tuple[bytes, FileOptions.OptimizeMode]]: ... SPEED: FileOptions.OptimizeMode @@ -399,95 +289,75 @@ class FileOptions(Message): swift_prefix: Text php_class_prefix: Text php_namespace: Text - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - java_package: Optional[Text] = ..., - java_outer_classname: Optional[Text] = ..., - java_multiple_files: Optional[bool] = ..., - java_generate_equals_and_hash: Optional[bool] = ..., - java_string_check_utf8: Optional[bool] = ..., - optimize_for: Optional[FileOptions.OptimizeMode] = ..., - go_package: Optional[Text] = ..., - cc_generic_services: Optional[bool] = ..., - java_generic_services: Optional[bool] = ..., - py_generic_services: Optional[bool] = ..., - php_generic_services: Optional[bool] = ..., - deprecated: Optional[bool] = ..., - cc_enable_arenas: Optional[bool] = ..., - objc_class_prefix: Optional[Text] = ..., - csharp_namespace: Optional[Text] = ..., - swift_prefix: Optional[Text] = ..., - php_class_prefix: Optional[Text] = ..., - php_namespace: Optional[Text] = ..., - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__( + self, + java_package: Optional[Text] = ..., + java_outer_classname: Optional[Text] = ..., + java_multiple_files: Optional[bool] = ..., + java_generate_equals_and_hash: Optional[bool] = ..., + java_string_check_utf8: Optional[bool] = ..., + optimize_for: Optional[FileOptions.OptimizeMode] = ..., + go_package: Optional[Text] = ..., + cc_generic_services: Optional[bool] = ..., + java_generic_services: Optional[bool] = ..., + py_generic_services: Optional[bool] = ..., + php_generic_services: Optional[bool] = ..., + deprecated: Optional[bool] = ..., + cc_enable_arenas: Optional[bool] = ..., + objc_class_prefix: Optional[Text] = ..., + csharp_namespace: Optional[Text] = ..., + swift_prefix: Optional[Text] = ..., + php_class_prefix: Optional[Text] = ..., + php_namespace: Optional[Text] = ..., + uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> FileOptions: ... - class MessageOptions(Message): message_set_wire_format: bool no_standard_descriptor_accessor: bool deprecated: bool map_entry: bool - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - message_set_wire_format: Optional[bool] = ..., - no_standard_descriptor_accessor: Optional[bool] = ..., - deprecated: Optional[bool] = ..., - map_entry: Optional[bool] = ..., - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__( + self, + message_set_wire_format: Optional[bool] = ..., + no_standard_descriptor_accessor: Optional[bool] = ..., + deprecated: Optional[bool] = ..., + map_entry: Optional[bool] = ..., + uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> MessageOptions: ... - class FieldOptions(Message): - class CType(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> FieldOptions.CType: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[FieldOptions.CType]: ... - @classmethod def items(cls) -> List[Tuple[bytes, FieldOptions.CType]]: ... STRING: FieldOptions.CType CORD: FieldOptions.CType STRING_PIECE: FieldOptions.CType - class JSType(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> FieldOptions.JSType: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[FieldOptions.JSType]: ... - @classmethod def items(cls) -> List[Tuple[bytes, FieldOptions.JSType]]: ... JS_NORMAL: FieldOptions.JSType @@ -499,105 +369,72 @@ class FieldOptions(Message): lazy: bool deprecated: bool weak: bool - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - ctype: Optional[FieldOptions.CType] = ..., - packed: Optional[bool] = ..., - jstype: Optional[FieldOptions.JSType] = ..., - lazy: Optional[bool] = ..., - deprecated: Optional[bool] = ..., - weak: Optional[bool] = ..., - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__( + self, + ctype: Optional[FieldOptions.CType] = ..., + packed: Optional[bool] = ..., + jstype: Optional[FieldOptions.JSType] = ..., + lazy: Optional[bool] = ..., + deprecated: Optional[bool] = ..., + weak: Optional[bool] = ..., + uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> FieldOptions: ... - class OneofOptions(Message): - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__(self, uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> OneofOptions: ... - class EnumOptions(Message): allow_alias: bool deprecated: bool - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - allow_alias: Optional[bool] = ..., - deprecated: Optional[bool] = ..., - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__( + self, + allow_alias: Optional[bool] = ..., + deprecated: Optional[bool] = ..., + uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> EnumOptions: ... - class EnumValueOptions(Message): deprecated: bool - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - deprecated: Optional[bool] = ..., - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__( + self, deprecated: Optional[bool] = ..., uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> EnumValueOptions: ... - class ServiceOptions(Message): deprecated: bool - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - deprecated: Optional[bool] = ..., - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__( + self, deprecated: Optional[bool] = ..., uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> ServiceOptions: ... - class MethodOptions(Message): - class IdempotencyLevel(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> MethodOptions.IdempotencyLevel: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[MethodOptions.IdempotencyLevel]: ... - @classmethod def items(cls) -> List[Tuple[bytes, MethodOptions.IdempotencyLevel]]: ... IDEMPOTENCY_UNKNOWN: MethodOptions.IdempotencyLevel @@ -605,32 +442,22 @@ class MethodOptions(Message): IDEMPOTENT: MethodOptions.IdempotencyLevel deprecated: bool idempotency_level: MethodOptions.IdempotencyLevel - @property - def uninterpreted_option( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... - - def __init__(self, - deprecated: Optional[bool] = ..., - idempotency_level: Optional[MethodOptions.IdempotencyLevel] = ..., - uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., - ) -> None: ... - + def uninterpreted_option(self) -> RepeatedCompositeFieldContainer[UninterpretedOption]: ... + def __init__( + self, + deprecated: Optional[bool] = ..., + idempotency_level: Optional[MethodOptions.IdempotencyLevel] = ..., + uninterpreted_option: Optional[Iterable[UninterpretedOption]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> MethodOptions: ... - class UninterpretedOption(Message): - class NamePart(Message): name_part: Text is_extension: bool - - def __init__(self, - name_part: Text, - is_extension: bool, - ) -> None: ... - + def __init__(self, name_part: Text, is_extension: bool) -> None: ... @classmethod def FromString(cls, s: bytes) -> UninterpretedOption.NamePart: ... identifier_value: Text @@ -639,82 +466,61 @@ class UninterpretedOption(Message): double_value: float string_value: bytes aggregate_value: Text - @property - def name( - self) -> RepeatedCompositeFieldContainer[UninterpretedOption.NamePart]: ... - - def __init__(self, - name: Optional[Iterable[UninterpretedOption.NamePart]] = ..., - identifier_value: Optional[Text] = ..., - positive_int_value: Optional[int] = ..., - negative_int_value: Optional[int] = ..., - double_value: Optional[float] = ..., - string_value: Optional[bytes] = ..., - aggregate_value: Optional[Text] = ..., - ) -> None: ... - + def name(self) -> RepeatedCompositeFieldContainer[UninterpretedOption.NamePart]: ... + def __init__( + self, + name: Optional[Iterable[UninterpretedOption.NamePart]] = ..., + identifier_value: Optional[Text] = ..., + positive_int_value: Optional[int] = ..., + negative_int_value: Optional[int] = ..., + double_value: Optional[float] = ..., + string_value: Optional[bytes] = ..., + aggregate_value: Optional[Text] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> UninterpretedOption: ... - class SourceCodeInfo(Message): - class Location(Message): path: RepeatedScalarFieldContainer[int] span: RepeatedScalarFieldContainer[int] leading_comments: Text trailing_comments: Text leading_detached_comments: RepeatedScalarFieldContainer[Text] - - def __init__(self, - path: Optional[Iterable[int]] = ..., - span: Optional[Iterable[int]] = ..., - leading_comments: Optional[Text] = ..., - trailing_comments: Optional[Text] = ..., - leading_detached_comments: Optional[Iterable[Text]] = ..., - ) -> None: ... - + def __init__( + self, + path: Optional[Iterable[int]] = ..., + span: Optional[Iterable[int]] = ..., + leading_comments: Optional[Text] = ..., + trailing_comments: Optional[Text] = ..., + leading_detached_comments: Optional[Iterable[Text]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> SourceCodeInfo.Location: ... - @property - def location( - self) -> RepeatedCompositeFieldContainer[SourceCodeInfo.Location]: ... - - def __init__(self, - location: Optional[Iterable[SourceCodeInfo.Location]] = ..., - ) -> None: ... - + def location(self) -> RepeatedCompositeFieldContainer[SourceCodeInfo.Location]: ... + def __init__(self, location: Optional[Iterable[SourceCodeInfo.Location]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> SourceCodeInfo: ... - class GeneratedCodeInfo(Message): - class Annotation(Message): path: RepeatedScalarFieldContainer[int] source_file: Text begin: int end: int - - def __init__(self, - path: Optional[Iterable[int]] = ..., - source_file: Optional[Text] = ..., - begin: Optional[int] = ..., - end: Optional[int] = ..., - ) -> None: ... - + def __init__( + self, + path: Optional[Iterable[int]] = ..., + source_file: Optional[Text] = ..., + begin: Optional[int] = ..., + end: Optional[int] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> GeneratedCodeInfo.Annotation: ... - @property - def annotation( - self) -> RepeatedCompositeFieldContainer[GeneratedCodeInfo.Annotation]: ... - - def __init__(self, - annotation: Optional[Iterable[GeneratedCodeInfo.Annotation]] = ..., - ) -> None: ... - + def annotation(self) -> RepeatedCompositeFieldContainer[GeneratedCodeInfo.Annotation]: ... + def __init__(self, annotation: Optional[Iterable[GeneratedCodeInfo.Annotation]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> GeneratedCodeInfo: ... diff --git a/third_party/2and3/google/protobuf/duration_pb2.pyi b/third_party/2and3/google/protobuf/duration_pb2.pyi index e08b124b3bdf..0785d7ec40db 100644 --- a/third_party/2and3/google/protobuf/duration_pb2.pyi +++ b/third_party/2and3/google/protobuf/duration_pb2.pyi @@ -6,11 +6,6 @@ from google.protobuf.message import Message class Duration(Message, well_known_types.Duration): seconds: int nanos: int - - def __init__(self, - seconds: Optional[int] = ..., - nanos: Optional[int] = ..., - ) -> None: ... - + def __init__(self, seconds: Optional[int] = ..., nanos: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Duration: ... diff --git a/third_party/2and3/google/protobuf/empty_pb2.pyi b/third_party/2and3/google/protobuf/empty_pb2.pyi index 5f220c4b2a8d..213c795fae51 100644 --- a/third_party/2and3/google/protobuf/empty_pb2.pyi +++ b/third_party/2and3/google/protobuf/empty_pb2.pyi @@ -1,9 +1,6 @@ from google.protobuf.message import Message class Empty(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> Empty: ... diff --git a/third_party/2and3/google/protobuf/field_mask_pb2.pyi b/third_party/2and3/google/protobuf/field_mask_pb2.pyi index 26c3a08c29a6..805e34d5210f 100644 --- a/third_party/2and3/google/protobuf/field_mask_pb2.pyi +++ b/third_party/2and3/google/protobuf/field_mask_pb2.pyi @@ -6,10 +6,6 @@ from google.protobuf.message import Message class FieldMask(Message, well_known_types.FieldMask): paths: RepeatedScalarFieldContainer[Text] - - def __init__(self, - paths: Optional[Iterable[Text]] = ..., - ) -> None: ... - + def __init__(self, paths: Optional[Iterable[Text]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> FieldMask: ... diff --git a/third_party/2and3/google/protobuf/internal/containers.pyi b/third_party/2and3/google/protobuf/internal/containers.pyi index 576809c4b6c4..9aea785083de 100644 --- a/third_party/2and3/google/protobuf/internal/containers.pyi +++ b/third_party/2and3/google/protobuf/internal/containers.pyi @@ -4,7 +4,8 @@ from google.protobuf.descriptor import Descriptor from google.protobuf.internal.message_listener import MessageListener from google.protobuf.message import Message -_T = TypeVar('_T') +_T = TypeVar("_T") + class BaseContainer(Sequence[_T]): def __init__(self, message_listener: MessageListener) -> None: ... def __len__(self) -> int: ... diff --git a/third_party/2and3/google/protobuf/internal/enum_type_wrapper.pyi b/third_party/2and3/google/protobuf/internal/enum_type_wrapper.pyi index 61d6ea10c5b6..174002d7a414 100644 --- a/third_party/2and3/google/protobuf/internal/enum_type_wrapper.pyi +++ b/third_party/2and3/google/protobuf/internal/enum_type_wrapper.pyi @@ -6,6 +6,5 @@ class EnumTypeWrapper(object): def Value(self, name: bytes) -> int: ... def keys(self) -> List[bytes]: ... def values(self) -> List[int]: ... - @classmethod def items(cls) -> List[Tuple[bytes, int]]: ... diff --git a/third_party/2and3/google/protobuf/internal/well_known_types.pyi b/third_party/2and3/google/protobuf/internal/well_known_types.pyi index 26a2e110ec26..65dee08ba899 100644 --- a/third_party/2and3/google/protobuf/internal/well_known_types.pyi +++ b/third_party/2and3/google/protobuf/internal/well_known_types.pyi @@ -55,7 +55,9 @@ class FieldMask: def CanonicalFormFromMask(self, mask: Any) -> None: ... def Union(self, mask1: Any, mask2: Any) -> None: ... def Intersect(self, mask1: Any, mask2: Any) -> None: ... - def MergeMessage(self, source: Any, destination: Any, replace_message_field: bool = ..., replace_repeated_field: bool = ...) -> None: ... + def MergeMessage( + self, source: Any, destination: Any, replace_message_field: bool = ..., replace_repeated_field: bool = ... + ) -> None: ... class _FieldMaskTree: def __init__(self, field_mask: Optional[Any] = ...) -> None: ... diff --git a/third_party/2and3/google/protobuf/json_format.pyi b/third_party/2and3/google/protobuf/json_format.pyi index c1a8b454a5e6..09706400686e 100644 --- a/third_party/2and3/google/protobuf/json_format.pyi +++ b/third_party/2and3/google/protobuf/json_format.pyi @@ -3,12 +3,10 @@ from typing import Any, Dict, Text, TypeVar, Union from google.protobuf.message import Message -_MessageVar = TypeVar('_MessageVar', bound=Message) +_MessageVar = TypeVar("_MessageVar", bound=Message) class Error(Exception): ... - class ParseError(Error): ... - class SerializeToJsonError(Error): ... def MessageToJson( @@ -17,16 +15,13 @@ def MessageToJson( preserving_proto_field_name: bool = ..., indent: int = ..., sort_keys: bool = ..., - use_integers_for_enums: bool = ... + use_integers_for_enums: bool = ..., ) -> str: ... - def MessageToDict( message: Message, including_default_value_fields: bool = ..., preserving_proto_field_name: bool = ..., - use_integers_for_enums: bool = ... + use_integers_for_enums: bool = ..., ) -> Dict[Text, Any]: ... - def Parse(text: Union[bytes, Text], message: _MessageVar, ignore_unknown_fields: bool = ...) -> _MessageVar: ... - def ParseDict(js_dict: Any, message: _MessageVar, ignore_unknown_fields: bool = ...) -> _MessageVar: ... diff --git a/third_party/2and3/google/protobuf/map_proto2_unittest_pb2.pyi b/third_party/2and3/google/protobuf/map_proto2_unittest_pb2.pyi index d5e16bd151ae..6a06d57f18f1 100644 --- a/third_party/2and3/google/protobuf/map_proto2_unittest_pb2.pyi +++ b/third_party/2and3/google/protobuf/map_proto2_unittest_pb2.pyi @@ -4,413 +4,244 @@ from google.protobuf.message import Message from google.protobuf.unittest_import_pb2 import ImportEnumForMap class Proto2MapEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> Proto2MapEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[Proto2MapEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, Proto2MapEnum]]: ... + PROTO2_MAP_ENUM_FOO: Proto2MapEnum PROTO2_MAP_ENUM_BAR: Proto2MapEnum PROTO2_MAP_ENUM_BAZ: Proto2MapEnum - class Proto2MapEnumPlusExtra(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> Proto2MapEnumPlusExtra: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[Proto2MapEnumPlusExtra]: ... - @classmethod def items(cls) -> List[Tuple[bytes, Proto2MapEnumPlusExtra]]: ... + E_PROTO2_MAP_ENUM_FOO: Proto2MapEnumPlusExtra E_PROTO2_MAP_ENUM_BAR: Proto2MapEnumPlusExtra E_PROTO2_MAP_ENUM_BAZ: Proto2MapEnumPlusExtra E_PROTO2_MAP_ENUM_EXTRA: Proto2MapEnumPlusExtra - class TestEnumMap(Message): - class KnownMapFieldEntry(Message): key: int value: Proto2MapEnum - - def __init__(self, - key: Optional[int] = ..., - value: Optional[Proto2MapEnum] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[Proto2MapEnum] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEnumMap.KnownMapFieldEntry: ... - class UnknownMapFieldEntry(Message): key: int value: Proto2MapEnum - - def __init__(self, - key: Optional[int] = ..., - value: Optional[Proto2MapEnum] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[Proto2MapEnum] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEnumMap.UnknownMapFieldEntry: ... - @property def known_map_field(self) -> MutableMapping[int, Proto2MapEnum]: ... - @property def unknown_map_field(self) -> MutableMapping[int, Proto2MapEnum]: ... - - def __init__(self, - known_map_field: Optional[Mapping[int, Proto2MapEnum]] = ..., - unknown_map_field: Optional[Mapping[int, Proto2MapEnum]] = ..., - ) -> None: ... - + def __init__( + self, + known_map_field: Optional[Mapping[int, Proto2MapEnum]] = ..., + unknown_map_field: Optional[Mapping[int, Proto2MapEnum]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEnumMap: ... - class TestEnumMapPlusExtra(Message): - class KnownMapFieldEntry(Message): key: int value: Proto2MapEnumPlusExtra - - def __init__(self, - key: Optional[int] = ..., - value: Optional[Proto2MapEnumPlusExtra] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[Proto2MapEnumPlusExtra] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEnumMapPlusExtra.KnownMapFieldEntry: ... - class UnknownMapFieldEntry(Message): key: int value: Proto2MapEnumPlusExtra - - def __init__(self, - key: Optional[int] = ..., - value: Optional[Proto2MapEnumPlusExtra] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[Proto2MapEnumPlusExtra] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEnumMapPlusExtra.UnknownMapFieldEntry: ... - @property def known_map_field(self) -> MutableMapping[int, Proto2MapEnumPlusExtra]: ... - @property def unknown_map_field(self) -> MutableMapping[int, Proto2MapEnumPlusExtra]: ... - - def __init__(self, - known_map_field: Optional[Mapping[int, Proto2MapEnumPlusExtra]] = ..., - unknown_map_field: Optional[Mapping[int, Proto2MapEnumPlusExtra]] = ..., - ) -> None: ... - + def __init__( + self, + known_map_field: Optional[Mapping[int, Proto2MapEnumPlusExtra]] = ..., + unknown_map_field: Optional[Mapping[int, Proto2MapEnumPlusExtra]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEnumMapPlusExtra: ... - class TestImportEnumMap(Message): - class ImportEnumAmpEntry(Message): key: int value: ImportEnumForMap - - def __init__(self, - key: Optional[int] = ..., - value: Optional[ImportEnumForMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[ImportEnumForMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestImportEnumMap.ImportEnumAmpEntry: ... - @property def import_enum_amp(self) -> MutableMapping[int, ImportEnumForMap]: ... - - def __init__(self, - import_enum_amp: Optional[Mapping[int, ImportEnumForMap]] = ..., - ) -> None: ... - + def __init__(self, import_enum_amp: Optional[Mapping[int, ImportEnumForMap]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestImportEnumMap: ... - class TestIntIntMap(Message): - class MEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestIntIntMap.MEntry: ... - @property def m(self) -> MutableMapping[int, int]: ... - - def __init__(self, - m: Optional[Mapping[int, int]] = ..., - ) -> None: ... - + def __init__(self, m: Optional[Mapping[int, int]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestIntIntMap: ... - class TestMaps(Message): - class MInt32Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MInt32Entry: ... - class MInt64Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MInt64Entry: ... - class MUint32Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MUint32Entry: ... - class MUint64Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MUint64Entry: ... - class MSint32Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MSint32Entry: ... - class MSint64Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MSint64Entry: ... - class MFixed32Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MFixed32Entry: ... - class MFixed64Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MFixed64Entry: ... - class MSfixed32Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MSfixed32Entry: ... - class MSfixed64Entry(Message): key: int - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MSfixed64Entry: ... - class MBoolEntry(Message): key: bool - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[bool] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[bool] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MBoolEntry: ... - class MStringEntry(Message): key: Text - @property def value(self) -> TestIntIntMap: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[TestIntIntMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[TestIntIntMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps.MStringEntry: ... - @property def m_int32(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_int64(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_uint32(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_uint64(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_sint32(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_sint64(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_fixed32(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_fixed64(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_sfixed32(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_sfixed64(self) -> MutableMapping[int, TestIntIntMap]: ... - @property def m_bool(self) -> MutableMapping[bool, TestIntIntMap]: ... - @property def m_string(self) -> MutableMapping[Text, TestIntIntMap]: ... - - def __init__(self, - m_int32: Optional[Mapping[int, TestIntIntMap]] = ..., - m_int64: Optional[Mapping[int, TestIntIntMap]] = ..., - m_uint32: Optional[Mapping[int, TestIntIntMap]] = ..., - m_uint64: Optional[Mapping[int, TestIntIntMap]] = ..., - m_sint32: Optional[Mapping[int, TestIntIntMap]] = ..., - m_sint64: Optional[Mapping[int, TestIntIntMap]] = ..., - m_fixed32: Optional[Mapping[int, TestIntIntMap]] = ..., - m_fixed64: Optional[Mapping[int, TestIntIntMap]] = ..., - m_sfixed32: Optional[Mapping[int, TestIntIntMap]] = ..., - m_sfixed64: Optional[Mapping[int, TestIntIntMap]] = ..., - m_bool: Optional[Mapping[bool, TestIntIntMap]] = ..., - m_string: Optional[Mapping[Text, TestIntIntMap]] = ..., - ) -> None: ... - + def __init__( + self, + m_int32: Optional[Mapping[int, TestIntIntMap]] = ..., + m_int64: Optional[Mapping[int, TestIntIntMap]] = ..., + m_uint32: Optional[Mapping[int, TestIntIntMap]] = ..., + m_uint64: Optional[Mapping[int, TestIntIntMap]] = ..., + m_sint32: Optional[Mapping[int, TestIntIntMap]] = ..., + m_sint64: Optional[Mapping[int, TestIntIntMap]] = ..., + m_fixed32: Optional[Mapping[int, TestIntIntMap]] = ..., + m_fixed64: Optional[Mapping[int, TestIntIntMap]] = ..., + m_sfixed32: Optional[Mapping[int, TestIntIntMap]] = ..., + m_sfixed64: Optional[Mapping[int, TestIntIntMap]] = ..., + m_bool: Optional[Mapping[bool, TestIntIntMap]] = ..., + m_string: Optional[Mapping[Text, TestIntIntMap]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMaps: ... - class TestSubmessageMaps(Message): - @property def m(self) -> TestMaps: ... - - def __init__(self, - m: Optional[TestMaps] = ..., - ) -> None: ... - + def __init__(self, m: Optional[TestMaps] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestSubmessageMaps: ... diff --git a/third_party/2and3/google/protobuf/map_unittest_pb2.pyi b/third_party/2and3/google/protobuf/map_unittest_pb2.pyi index 5962922b38f7..030be80c4be8 100644 --- a/third_party/2and3/google/protobuf/map_unittest_pb2.pyi +++ b/third_party/2and3/google/protobuf/map_unittest_pb2.pyi @@ -6,862 +6,478 @@ from google.protobuf.unittest_pb2 import ForeignMessage as ForeignMessage1 from google.protobuf.unittest_pb2 import TestAllTypes, TestRequired class MapEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> MapEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[MapEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, MapEnum]]: ... - MAP_ENUM_FOO: MapEnum MAP_ENUM_BAR: MapEnum MAP_ENUM_BAZ: MapEnum - class TestMap(Message): - class MapInt32Int32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapInt32Int32Entry: ... - class MapInt64Int64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapInt64Int64Entry: ... - class MapUint32Uint32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapUint32Uint32Entry: ... - class MapUint64Uint64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapUint64Uint64Entry: ... - class MapSint32Sint32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapSint32Sint32Entry: ... - class MapSint64Sint64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapSint64Sint64Entry: ... - class MapFixed32Fixed32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapFixed32Fixed32Entry: ... - class MapFixed64Fixed64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapFixed64Fixed64Entry: ... - class MapSfixed32Sfixed32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapSfixed32Sfixed32Entry: ... - class MapSfixed64Sfixed64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapSfixed64Sfixed64Entry: ... - class MapInt32FloatEntry(Message): key: int value: float - - def __init__(self, - key: Optional[int] = ..., - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[float] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapInt32FloatEntry: ... - class MapInt32DoubleEntry(Message): key: int value: float - - def __init__(self, - key: Optional[int] = ..., - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[float] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapInt32DoubleEntry: ... - class MapBoolBoolEntry(Message): key: bool value: bool - - def __init__(self, - key: Optional[bool] = ..., - value: Optional[bool] = ..., - ) -> None: ... - + def __init__(self, key: Optional[bool] = ..., value: Optional[bool] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapBoolBoolEntry: ... - class MapStringStringEntry(Message): key: Text value: Text - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapStringStringEntry: ... - class MapInt32BytesEntry(Message): key: int value: bytes - - def __init__(self, - key: Optional[int] = ..., - value: Optional[bytes] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[bytes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapInt32BytesEntry: ... - class MapInt32EnumEntry(Message): key: int value: MapEnum - - def __init__(self, - key: Optional[int] = ..., - value: Optional[MapEnum] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[MapEnum] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapInt32EnumEntry: ... - class MapInt32ForeignMessageEntry(Message): key: int - @property def value(self) -> ForeignMessage1: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[ForeignMessage1] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[ForeignMessage1] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapInt32ForeignMessageEntry: ... - class MapStringForeignMessageEntry(Message): key: Text - @property def value(self) -> ForeignMessage1: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[ForeignMessage1] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[ForeignMessage1] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestMap.MapStringForeignMessageEntry: ... - + def FromString(cls, s: bytes) -> TestMap.MapStringForeignMessageEntry: ... class MapInt32AllTypesEntry(Message): key: int - @property def value(self) -> TestAllTypes: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestAllTypes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.MapInt32AllTypesEntry: ... - @property def map_int32_int32(self) -> MutableMapping[int, int]: ... - @property def map_int64_int64(self) -> MutableMapping[int, int]: ... - @property def map_uint32_uint32(self) -> MutableMapping[int, int]: ... - @property def map_uint64_uint64(self) -> MutableMapping[int, int]: ... - @property def map_sint32_sint32(self) -> MutableMapping[int, int]: ... - @property def map_sint64_sint64(self) -> MutableMapping[int, int]: ... - @property def map_fixed32_fixed32(self) -> MutableMapping[int, int]: ... - @property def map_fixed64_fixed64(self) -> MutableMapping[int, int]: ... - @property def map_sfixed32_sfixed32(self) -> MutableMapping[int, int]: ... - @property def map_sfixed64_sfixed64(self) -> MutableMapping[int, int]: ... - @property def map_int32_float(self) -> MutableMapping[int, float]: ... - @property def map_int32_double(self) -> MutableMapping[int, float]: ... - @property def map_bool_bool(self) -> MutableMapping[bool, bool]: ... - @property def map_string_string(self) -> MutableMapping[Text, Text]: ... - @property def map_int32_bytes(self) -> MutableMapping[int, bytes]: ... - @property def map_int32_enum(self) -> MutableMapping[int, MapEnum]: ... - @property - def map_int32_foreign_message( - self) -> MutableMapping[int, ForeignMessage1]: ... - + def map_int32_foreign_message(self) -> MutableMapping[int, ForeignMessage1]: ... @property - def map_string_foreign_message( - self) -> MutableMapping[Text, ForeignMessage1]: ... - + def map_string_foreign_message(self) -> MutableMapping[Text, ForeignMessage1]: ... @property def map_int32_all_types(self) -> MutableMapping[int, TestAllTypes]: ... - - def __init__(self, - map_int32_int32: Optional[Mapping[int, int]] = ..., - map_int64_int64: Optional[Mapping[int, int]] = ..., - map_uint32_uint32: Optional[Mapping[int, int]] = ..., - map_uint64_uint64: Optional[Mapping[int, int]] = ..., - map_sint32_sint32: Optional[Mapping[int, int]] = ..., - map_sint64_sint64: Optional[Mapping[int, int]] = ..., - map_fixed32_fixed32: Optional[Mapping[int, int]] = ..., - map_fixed64_fixed64: Optional[Mapping[int, int]] = ..., - map_sfixed32_sfixed32: Optional[Mapping[int, int]] = ..., - map_sfixed64_sfixed64: Optional[Mapping[int, int]] = ..., - map_int32_float: Optional[Mapping[int, float]] = ..., - map_int32_double: Optional[Mapping[int, float]] = ..., - map_bool_bool: Optional[Mapping[bool, bool]] = ..., - map_string_string: Optional[Mapping[Text, Text]] = ..., - map_int32_bytes: Optional[Mapping[int, bytes]] = ..., - map_int32_enum: Optional[Mapping[int, MapEnum]] = ..., - map_int32_foreign_message: Optional[Mapping[int, ForeignMessage1]] = ..., - map_string_foreign_message: Optional[Mapping[Text, ForeignMessage1]] = ..., - map_int32_all_types: Optional[Mapping[int, TestAllTypes]] = ..., - ) -> None: ... - + def __init__( + self, + map_int32_int32: Optional[Mapping[int, int]] = ..., + map_int64_int64: Optional[Mapping[int, int]] = ..., + map_uint32_uint32: Optional[Mapping[int, int]] = ..., + map_uint64_uint64: Optional[Mapping[int, int]] = ..., + map_sint32_sint32: Optional[Mapping[int, int]] = ..., + map_sint64_sint64: Optional[Mapping[int, int]] = ..., + map_fixed32_fixed32: Optional[Mapping[int, int]] = ..., + map_fixed64_fixed64: Optional[Mapping[int, int]] = ..., + map_sfixed32_sfixed32: Optional[Mapping[int, int]] = ..., + map_sfixed64_sfixed64: Optional[Mapping[int, int]] = ..., + map_int32_float: Optional[Mapping[int, float]] = ..., + map_int32_double: Optional[Mapping[int, float]] = ..., + map_bool_bool: Optional[Mapping[bool, bool]] = ..., + map_string_string: Optional[Mapping[Text, Text]] = ..., + map_int32_bytes: Optional[Mapping[int, bytes]] = ..., + map_int32_enum: Optional[Mapping[int, MapEnum]] = ..., + map_int32_foreign_message: Optional[Mapping[int, ForeignMessage1]] = ..., + map_string_foreign_message: Optional[Mapping[Text, ForeignMessage1]] = ..., + map_int32_all_types: Optional[Mapping[int, TestAllTypes]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap: ... - class TestMapSubmessage(Message): - @property def test_map(self) -> TestMap: ... - - def __init__(self, - test_map: Optional[TestMap] = ..., - ) -> None: ... - + def __init__(self, test_map: Optional[TestMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMapSubmessage: ... - class TestMessageMap(Message): - class MapInt32MessageEntry(Message): key: int - @property def value(self) -> TestAllTypes: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestAllTypes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessageMap.MapInt32MessageEntry: ... - @property def map_int32_message(self) -> MutableMapping[int, TestAllTypes]: ... - - def __init__(self, - map_int32_message: Optional[Mapping[int, TestAllTypes]] = ..., - ) -> None: ... - + def __init__(self, map_int32_message: Optional[Mapping[int, TestAllTypes]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessageMap: ... - class TestSameTypeMap(Message): - class Map1Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestSameTypeMap.Map1Entry: ... - class Map2Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestSameTypeMap.Map2Entry: ... - @property def map1(self) -> MutableMapping[int, int]: ... - @property def map2(self) -> MutableMapping[int, int]: ... - - def __init__(self, - map1: Optional[Mapping[int, int]] = ..., - map2: Optional[Mapping[int, int]] = ..., - ) -> None: ... - + def __init__(self, map1: Optional[Mapping[int, int]] = ..., map2: Optional[Mapping[int, int]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestSameTypeMap: ... - class TestRequiredMessageMap(Message): - class MapFieldEntry(Message): key: int - @property def value(self) -> TestRequired: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[TestRequired] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[TestRequired] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestRequiredMessageMap.MapFieldEntry: ... - + def FromString(cls, s: bytes) -> TestRequiredMessageMap.MapFieldEntry: ... @property def map_field(self) -> MutableMapping[int, TestRequired]: ... - - def __init__(self, - map_field: Optional[Mapping[int, TestRequired]] = ..., - ) -> None: ... - + def __init__(self, map_field: Optional[Mapping[int, TestRequired]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRequiredMessageMap: ... - class TestArenaMap(Message): - class MapInt32Int32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapInt32Int32Entry: ... - class MapInt64Int64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapInt64Int64Entry: ... - class MapUint32Uint32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapUint32Uint32Entry: ... - class MapUint64Uint64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapUint64Uint64Entry: ... - class MapSint32Sint32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapSint32Sint32Entry: ... - class MapSint64Sint64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapSint64Sint64Entry: ... - class MapFixed32Fixed32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapFixed32Fixed32Entry: ... - class MapFixed64Fixed64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapFixed64Fixed64Entry: ... - class MapSfixed32Sfixed32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestArenaMap.MapSfixed32Sfixed32Entry: ... - + def FromString(cls, s: bytes) -> TestArenaMap.MapSfixed32Sfixed32Entry: ... class MapSfixed64Sfixed64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestArenaMap.MapSfixed64Sfixed64Entry: ... - + def FromString(cls, s: bytes) -> TestArenaMap.MapSfixed64Sfixed64Entry: ... class MapInt32FloatEntry(Message): key: int value: float - - def __init__(self, - key: Optional[int] = ..., - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[float] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapInt32FloatEntry: ... - class MapInt32DoubleEntry(Message): key: int value: float - - def __init__(self, - key: Optional[int] = ..., - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[float] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapInt32DoubleEntry: ... - class MapBoolBoolEntry(Message): key: bool value: bool - - def __init__(self, - key: Optional[bool] = ..., - value: Optional[bool] = ..., - ) -> None: ... - + def __init__(self, key: Optional[bool] = ..., value: Optional[bool] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapBoolBoolEntry: ... - class MapStringStringEntry(Message): key: Text value: Text - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapStringStringEntry: ... - class MapInt32BytesEntry(Message): key: int value: bytes - - def __init__(self, - key: Optional[int] = ..., - value: Optional[bytes] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[bytes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapInt32BytesEntry: ... - class MapInt32EnumEntry(Message): key: int value: MapEnum - - def __init__(self, - key: Optional[int] = ..., - value: Optional[MapEnum] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[MapEnum] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap.MapInt32EnumEntry: ... - class MapInt32ForeignMessageEntry(Message): key: int - @property def value(self) -> ForeignMessage1: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[ForeignMessage1] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[ForeignMessage1] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestArenaMap.MapInt32ForeignMessageEntry: ... - + def FromString(cls, s: bytes) -> TestArenaMap.MapInt32ForeignMessageEntry: ... class MapInt32ForeignMessageNoArenaEntry(Message): key: int - @property def value(self) -> ForeignMessage: ... - - def __init__(self, - key: Optional[int] = ..., - value: Optional[ForeignMessage] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[ForeignMessage] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestArenaMap.MapInt32ForeignMessageNoArenaEntry: ... - + def FromString(cls, s: bytes) -> TestArenaMap.MapInt32ForeignMessageNoArenaEntry: ... @property def map_int32_int32(self) -> MutableMapping[int, int]: ... - @property def map_int64_int64(self) -> MutableMapping[int, int]: ... - @property def map_uint32_uint32(self) -> MutableMapping[int, int]: ... - @property def map_uint64_uint64(self) -> MutableMapping[int, int]: ... - @property def map_sint32_sint32(self) -> MutableMapping[int, int]: ... - @property def map_sint64_sint64(self) -> MutableMapping[int, int]: ... - @property def map_fixed32_fixed32(self) -> MutableMapping[int, int]: ... - @property def map_fixed64_fixed64(self) -> MutableMapping[int, int]: ... - @property def map_sfixed32_sfixed32(self) -> MutableMapping[int, int]: ... - @property def map_sfixed64_sfixed64(self) -> MutableMapping[int, int]: ... - @property def map_int32_float(self) -> MutableMapping[int, float]: ... - @property def map_int32_double(self) -> MutableMapping[int, float]: ... - @property def map_bool_bool(self) -> MutableMapping[bool, bool]: ... - @property def map_string_string(self) -> MutableMapping[Text, Text]: ... - @property def map_int32_bytes(self) -> MutableMapping[int, bytes]: ... - @property def map_int32_enum(self) -> MutableMapping[int, MapEnum]: ... - - @property - def map_int32_foreign_message( - self) -> MutableMapping[int, ForeignMessage1]: ... - @property - def map_int32_foreign_message_no_arena( - self) -> MutableMapping[int, ForeignMessage]: ... - - def __init__(self, - map_int32_int32: Optional[Mapping[int, int]] = ..., - map_int64_int64: Optional[Mapping[int, int]] = ..., - map_uint32_uint32: Optional[Mapping[int, int]] = ..., - map_uint64_uint64: Optional[Mapping[int, int]] = ..., - map_sint32_sint32: Optional[Mapping[int, int]] = ..., - map_sint64_sint64: Optional[Mapping[int, int]] = ..., - map_fixed32_fixed32: Optional[Mapping[int, int]] = ..., - map_fixed64_fixed64: Optional[Mapping[int, int]] = ..., - map_sfixed32_sfixed32: Optional[Mapping[int, int]] = ..., - map_sfixed64_sfixed64: Optional[Mapping[int, int]] = ..., - map_int32_float: Optional[Mapping[int, float]] = ..., - map_int32_double: Optional[Mapping[int, float]] = ..., - map_bool_bool: Optional[Mapping[bool, bool]] = ..., - map_string_string: Optional[Mapping[Text, Text]] = ..., - map_int32_bytes: Optional[Mapping[int, bytes]] = ..., - map_int32_enum: Optional[Mapping[int, MapEnum]] = ..., - map_int32_foreign_message: Optional[Mapping[int, ForeignMessage1]] = ..., - map_int32_foreign_message_no_arena: Optional[Mapping[int, ForeignMessage]] = ..., - ) -> None: ... - + def map_int32_foreign_message(self) -> MutableMapping[int, ForeignMessage1]: ... + @property + def map_int32_foreign_message_no_arena(self) -> MutableMapping[int, ForeignMessage]: ... + def __init__( + self, + map_int32_int32: Optional[Mapping[int, int]] = ..., + map_int64_int64: Optional[Mapping[int, int]] = ..., + map_uint32_uint32: Optional[Mapping[int, int]] = ..., + map_uint64_uint64: Optional[Mapping[int, int]] = ..., + map_sint32_sint32: Optional[Mapping[int, int]] = ..., + map_sint64_sint64: Optional[Mapping[int, int]] = ..., + map_fixed32_fixed32: Optional[Mapping[int, int]] = ..., + map_fixed64_fixed64: Optional[Mapping[int, int]] = ..., + map_sfixed32_sfixed32: Optional[Mapping[int, int]] = ..., + map_sfixed64_sfixed64: Optional[Mapping[int, int]] = ..., + map_int32_float: Optional[Mapping[int, float]] = ..., + map_int32_double: Optional[Mapping[int, float]] = ..., + map_bool_bool: Optional[Mapping[bool, bool]] = ..., + map_string_string: Optional[Mapping[Text, Text]] = ..., + map_int32_bytes: Optional[Mapping[int, bytes]] = ..., + map_int32_enum: Optional[Mapping[int, MapEnum]] = ..., + map_int32_foreign_message: Optional[Mapping[int, ForeignMessage1]] = ..., + map_int32_foreign_message_no_arena: Optional[Mapping[int, ForeignMessage]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestArenaMap: ... - class MessageContainingEnumCalledType(Message): - class Type(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> MessageContainingEnumCalledType.Type: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[MessageContainingEnumCalledType.Type]: ... - @classmethod - def items(cls) -> List[Tuple[bytes, - MessageContainingEnumCalledType.Type]]: ... + def items(cls) -> List[Tuple[bytes, MessageContainingEnumCalledType.Type]]: ... TYPE_FOO: MessageContainingEnumCalledType.Type - class TypeEntry(Message): key: Text - @property def value(self) -> MessageContainingEnumCalledType: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[MessageContainingEnumCalledType] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[MessageContainingEnumCalledType] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> MessageContainingEnumCalledType.TypeEntry: ... - + def FromString(cls, s: bytes) -> MessageContainingEnumCalledType.TypeEntry: ... @property - def type(self) -> MutableMapping[Text, - MessageContainingEnumCalledType]: ... - - def __init__(self, - type: Optional[Mapping[Text, MessageContainingEnumCalledType]] = ..., - ) -> None: ... - + def type(self) -> MutableMapping[Text, MessageContainingEnumCalledType]: ... + def __init__(self, type: Optional[Mapping[Text, MessageContainingEnumCalledType]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> MessageContainingEnumCalledType: ... - class MessageContainingMapCalledEntry(Message): - class EntryEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> MessageContainingMapCalledEntry.EntryEntry: ... - + def FromString(cls, s: bytes) -> MessageContainingMapCalledEntry.EntryEntry: ... @property def entry(self) -> MutableMapping[int, int]: ... - - def __init__(self, - entry: Optional[Mapping[int, int]] = ..., - ) -> None: ... - + def __init__(self, entry: Optional[Mapping[int, int]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> MessageContainingMapCalledEntry: ... - class TestRecursiveMapMessage(Message): - class AEntry(Message): key: Text - @property def value(self) -> TestRecursiveMapMessage: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[TestRecursiveMapMessage] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[TestRecursiveMapMessage] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRecursiveMapMessage.AEntry: ... - @property def a(self) -> MutableMapping[Text, TestRecursiveMapMessage]: ... - - def __init__(self, - a: Optional[Mapping[Text, TestRecursiveMapMessage]] = ..., - ) -> None: ... - + def __init__(self, a: Optional[Mapping[Text, TestRecursiveMapMessage]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRecursiveMapMessage: ... diff --git a/third_party/2and3/google/protobuf/message.pyi b/third_party/2and3/google/protobuf/message.pyi index 92ea7cee425f..dd173a826bfd 100644 --- a/third_party/2and3/google/protobuf/message.pyi +++ b/third_party/2and3/google/protobuf/message.pyi @@ -30,7 +30,6 @@ class Message: def ByteSize(self) -> int: ... @property def Extensions(self) -> _ExtensionDict: ... - # Intentionally left out typing on these three methods, because they are # stringly typed and it is not useful to call them on a Message directly. # We prefer more specific typing on individual subclasses of Message @@ -38,6 +37,5 @@ class Message: def HasField(self, field_name: Any) -> bool: ... def ClearField(self, field_name: Any) -> None: ... def WhichOneof(self, oneof_group: Any) -> Any: ... - # TODO: check kwargs def __init__(self, **kwargs) -> None: ... diff --git a/third_party/2and3/google/protobuf/source_context_pb2.pyi b/third_party/2and3/google/protobuf/source_context_pb2.pyi index 7ccf6c889957..e800030a16fd 100644 --- a/third_party/2and3/google/protobuf/source_context_pb2.pyi +++ b/third_party/2and3/google/protobuf/source_context_pb2.pyi @@ -4,10 +4,6 @@ from google.protobuf.message import Message class SourceContext(Message): file_name: Text - - def __init__(self, - file_name: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, file_name: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> SourceContext: ... diff --git a/third_party/2and3/google/protobuf/struct_pb2.pyi b/third_party/2and3/google/protobuf/struct_pb2.pyi index 76ffc0fe7bf2..eeb6af18ad4d 100644 --- a/third_party/2and3/google/protobuf/struct_pb2.pyi +++ b/third_party/2and3/google/protobuf/struct_pb2.pyi @@ -7,85 +7,57 @@ from google.protobuf.message import Message class NullValue(int): @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> NullValue: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[NullValue]: ... - @classmethod def items(cls) -> List[Tuple[bytes, NullValue]]: ... - NULL_VALUE: NullValue - class Struct(Message, well_known_types.Struct): class FieldsEntry(Message): key: Text - @property def value(self) -> Value: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[Value] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[Value] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Struct.FieldsEntry: ... - @property def fields(self) -> MutableMapping[Text, Value]: ... - - def __init__(self, - fields: Optional[Mapping[Text, Value]] = ..., - ) -> None: ... - + def __init__(self, fields: Optional[Mapping[Text, Value]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Struct: ... - class _Value(Message): null_value: NullValue number_value: float string_value: Text bool_value: bool - @property def struct_value(self) -> Struct: ... - @property def list_value(self) -> ListValue: ... - - def __init__(self, - null_value: Optional[NullValue] = ..., - number_value: Optional[float] = ..., - string_value: Optional[Text] = ..., - bool_value: Optional[bool] = ..., - struct_value: Optional[Struct] = ..., - list_value: Optional[ListValue] = ..., - ) -> None: ... - + def __init__( + self, + null_value: Optional[NullValue] = ..., + number_value: Optional[float] = ..., + string_value: Optional[Text] = ..., + bool_value: Optional[bool] = ..., + struct_value: Optional[Struct] = ..., + list_value: Optional[ListValue] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> _Value: ... - Value = _Value - class ListValue(Message, well_known_types.ListValue): - @property def values(self) -> RepeatedCompositeFieldContainer[Value]: ... - - def __init__(self, - values: Optional[Iterable[Value]] = ..., - ) -> None: ... - + def __init__(self, values: Optional[Iterable[Value]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ListValue: ... diff --git a/third_party/2and3/google/protobuf/test_messages_proto2_pb2.pyi b/third_party/2and3/google/protobuf/test_messages_proto2_pb2.pyi index 82e78f5900e2..780942650e50 100644 --- a/third_party/2and3/google/protobuf/test_messages_proto2_pb2.pyi +++ b/third_party/2and3/google/protobuf/test_messages_proto2_pb2.pyi @@ -5,357 +5,180 @@ from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, from google.protobuf.message import Message class ForeignEnumProto2(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> ForeignEnumProto2: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[ForeignEnumProto2]: ... - @classmethod def items(cls) -> List[Tuple[bytes, ForeignEnumProto2]]: ... - FOREIGN_FOO: ForeignEnumProto2 FOREIGN_BAR: ForeignEnumProto2 FOREIGN_BAZ: ForeignEnumProto2 - class TestAllTypesProto2(Message): - class NestedEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestAllTypesProto2.NestedEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestAllTypesProto2.NestedEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestAllTypesProto2.NestedEnum]]: ... FOO: TestAllTypesProto2.NestedEnum BAR: TestAllTypesProto2.NestedEnum BAZ: TestAllTypesProto2.NestedEnum NEG: TestAllTypesProto2.NestedEnum - class NestedMessage(Message): a: int - @property def corecursive(self) -> TestAllTypesProto2: ... - - def __init__(self, - a: Optional[int] = ..., - corecursive: Optional[TestAllTypesProto2] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ..., corecursive: Optional[TestAllTypesProto2] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto2.NestedMessage: ... - class MapInt32Int32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapInt32Int32Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapInt32Int32Entry: ... class MapInt64Int64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapInt64Int64Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapInt64Int64Entry: ... class MapUint32Uint32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapUint32Uint32Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapUint32Uint32Entry: ... class MapUint64Uint64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapUint64Uint64Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapUint64Uint64Entry: ... class MapSint32Sint32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapSint32Sint32Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapSint32Sint32Entry: ... class MapSint64Sint64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapSint64Sint64Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapSint64Sint64Entry: ... class MapFixed32Fixed32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapFixed32Fixed32Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapFixed32Fixed32Entry: ... class MapFixed64Fixed64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapFixed64Fixed64Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapFixed64Fixed64Entry: ... class MapSfixed32Sfixed32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapSfixed32Sfixed32Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapSfixed32Sfixed32Entry: ... class MapSfixed64Sfixed64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapSfixed64Sfixed64Entry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapSfixed64Sfixed64Entry: ... class MapInt32FloatEntry(Message): key: int value: float - - def __init__(self, - key: Optional[int] = ..., - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[float] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapInt32FloatEntry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapInt32FloatEntry: ... class MapInt32DoubleEntry(Message): key: int value: float - - def __init__(self, - key: Optional[int] = ..., - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[float] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapInt32DoubleEntry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapInt32DoubleEntry: ... class MapBoolBoolEntry(Message): key: bool value: bool - - def __init__(self, - key: Optional[bool] = ..., - value: Optional[bool] = ..., - ) -> None: ... - + def __init__(self, key: Optional[bool] = ..., value: Optional[bool] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto2.MapBoolBoolEntry: ... - class MapStringStringEntry(Message): key: Text value: Text - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[Text] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapStringStringEntry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapStringStringEntry: ... class MapStringBytesEntry(Message): key: Text value: bytes - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[bytes] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[bytes] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapStringBytesEntry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapStringBytesEntry: ... class MapStringNestedMessageEntry(Message): key: Text - @property def value(self) -> TestAllTypesProto2.NestedMessage: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[TestAllTypesProto2.NestedMessage] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[TestAllTypesProto2.NestedMessage] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapStringNestedMessageEntry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapStringNestedMessageEntry: ... class MapStringForeignMessageEntry(Message): key: Text - @property def value(self) -> ForeignMessageProto2: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[ForeignMessageProto2] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[ForeignMessageProto2] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapStringForeignMessageEntry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapStringForeignMessageEntry: ... class MapStringNestedEnumEntry(Message): key: Text value: TestAllTypesProto2.NestedEnum - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[TestAllTypesProto2.NestedEnum] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[TestAllTypesProto2.NestedEnum] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapStringNestedEnumEntry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapStringNestedEnumEntry: ... class MapStringForeignEnumEntry(Message): key: Text value: ForeignEnumProto2 - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[ForeignEnumProto2] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[ForeignEnumProto2] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MapStringForeignEnumEntry: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MapStringForeignEnumEntry: ... class Data(Message): group_int32: int group_uint32: int - - def __init__(self, - group_int32: Optional[int] = ..., - group_uint32: Optional[int] = ..., - ) -> None: ... - + def __init__(self, group_int32: Optional[int] = ..., group_uint32: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto2.Data: ... - class MessageSetCorrect(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MessageSetCorrect: ... - + def FromString(cls, s: bytes) -> TestAllTypesProto2.MessageSetCorrect: ... class MessageSetCorrectExtension1(Message): bytes: Text - - def __init__(self, - bytes: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, bytes: Optional[Text] = ...) -> None: ... @classmethod - def FromString( - cls, s: builtins.bytes) -> TestAllTypesProto2.MessageSetCorrectExtension1: ... - + def FromString(cls, s: builtins.bytes) -> TestAllTypesProto2.MessageSetCorrectExtension1: ... class MessageSetCorrectExtension2(Message): i: int - - def __init__(self, - i: Optional[int] = ..., - ) -> None: ... - + def __init__(self, i: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestAllTypesProto2.MessageSetCorrectExtension2: ... + def FromString(cls, s: bytes) -> TestAllTypesProto2.MessageSetCorrectExtension2: ... optional_int32: int optional_int64: int optional_uint32: int @@ -420,194 +243,156 @@ class TestAllTypesProto2(Message): field__Name16: int field_name17__: int Field_name18__: int - @property def optional_nested_message(self) -> TestAllTypesProto2.NestedMessage: ... - @property def optional_foreign_message(self) -> ForeignMessageProto2: ... - @property def recursive_message(self) -> TestAllTypesProto2: ... - @property - def repeated_nested_message( - self) -> RepeatedCompositeFieldContainer[TestAllTypesProto2.NestedMessage]: ... - + def repeated_nested_message(self) -> RepeatedCompositeFieldContainer[TestAllTypesProto2.NestedMessage]: ... @property - def repeated_foreign_message( - self) -> RepeatedCompositeFieldContainer[ForeignMessageProto2]: ... - + def repeated_foreign_message(self) -> RepeatedCompositeFieldContainer[ForeignMessageProto2]: ... @property def map_int32_int32(self) -> MutableMapping[int, int]: ... - @property def map_int64_int64(self) -> MutableMapping[int, int]: ... - @property def map_uint32_uint32(self) -> MutableMapping[int, int]: ... - @property def map_uint64_uint64(self) -> MutableMapping[int, int]: ... - @property def map_sint32_sint32(self) -> MutableMapping[int, int]: ... - @property def map_sint64_sint64(self) -> MutableMapping[int, int]: ... - @property def map_fixed32_fixed32(self) -> MutableMapping[int, int]: ... - @property def map_fixed64_fixed64(self) -> MutableMapping[int, int]: ... - @property def map_sfixed32_sfixed32(self) -> MutableMapping[int, int]: ... - @property def map_sfixed64_sfixed64(self) -> MutableMapping[int, int]: ... - @property def map_int32_float(self) -> MutableMapping[int, float]: ... - @property def map_int32_double(self) -> MutableMapping[int, float]: ... - @property def map_bool_bool(self) -> MutableMapping[bool, bool]: ... - @property def map_string_string(self) -> MutableMapping[Text, Text]: ... - @property def map_string_bytes(self) -> MutableMapping[Text, bytes]: ... - @property - def map_string_nested_message( - self) -> MutableMapping[Text, TestAllTypesProto2.NestedMessage]: ... - + def map_string_nested_message(self) -> MutableMapping[Text, TestAllTypesProto2.NestedMessage]: ... @property - def map_string_foreign_message( - self) -> MutableMapping[Text, ForeignMessageProto2]: ... - + def map_string_foreign_message(self) -> MutableMapping[Text, ForeignMessageProto2]: ... @property - def map_string_nested_enum( - self) -> MutableMapping[Text, TestAllTypesProto2.NestedEnum]: ... - + def map_string_nested_enum(self) -> MutableMapping[Text, TestAllTypesProto2.NestedEnum]: ... @property - def map_string_foreign_enum( - self) -> MutableMapping[Text, ForeignEnumProto2]: ... - + def map_string_foreign_enum(self) -> MutableMapping[Text, ForeignEnumProto2]: ... @property def oneof_nested_message(self) -> TestAllTypesProto2.NestedMessage: ... - @property def data(self) -> TestAllTypesProto2.Data: ... - - def __init__(self, - optional_int32: Optional[int] = ..., - optional_int64: Optional[int] = ..., - optional_uint32: Optional[int] = ..., - optional_uint64: Optional[int] = ..., - optional_sint32: Optional[int] = ..., - optional_sint64: Optional[int] = ..., - optional_fixed32: Optional[int] = ..., - optional_fixed64: Optional[int] = ..., - optional_sfixed32: Optional[int] = ..., - optional_sfixed64: Optional[int] = ..., - optional_float: Optional[float] = ..., - optional_double: Optional[float] = ..., - optional_bool: Optional[bool] = ..., - optional_string: Optional[Text] = ..., - optional_bytes: Optional[bytes] = ..., - optional_nested_message: Optional[TestAllTypesProto2.NestedMessage] = ..., - optional_foreign_message: Optional[ForeignMessageProto2] = ..., - optional_nested_enum: Optional[TestAllTypesProto2.NestedEnum] = ..., - optional_foreign_enum: Optional[ForeignEnumProto2] = ..., - optional_string_piece: Optional[Text] = ..., - optional_cord: Optional[Text] = ..., - recursive_message: Optional[TestAllTypesProto2] = ..., - repeated_int32: Optional[Iterable[int]] = ..., - repeated_int64: Optional[Iterable[int]] = ..., - repeated_uint32: Optional[Iterable[int]] = ..., - repeated_uint64: Optional[Iterable[int]] = ..., - repeated_sint32: Optional[Iterable[int]] = ..., - repeated_sint64: Optional[Iterable[int]] = ..., - repeated_fixed32: Optional[Iterable[int]] = ..., - repeated_fixed64: Optional[Iterable[int]] = ..., - repeated_sfixed32: Optional[Iterable[int]] = ..., - repeated_sfixed64: Optional[Iterable[int]] = ..., - repeated_float: Optional[Iterable[float]] = ..., - repeated_double: Optional[Iterable[float]] = ..., - repeated_bool: Optional[Iterable[bool]] = ..., - repeated_string: Optional[Iterable[Text]] = ..., - repeated_bytes: Optional[Iterable[bytes]] = ..., - repeated_nested_message: Optional[Iterable[TestAllTypesProto2.NestedMessage]] = ..., - repeated_foreign_message: Optional[Iterable[ForeignMessageProto2]] = ..., - repeated_nested_enum: Optional[Iterable[TestAllTypesProto2.NestedEnum]] = ..., - repeated_foreign_enum: Optional[Iterable[ForeignEnumProto2]] = ..., - repeated_string_piece: Optional[Iterable[Text]] = ..., - repeated_cord: Optional[Iterable[Text]] = ..., - map_int32_int32: Optional[Mapping[int, int]] = ..., - map_int64_int64: Optional[Mapping[int, int]] = ..., - map_uint32_uint32: Optional[Mapping[int, int]] = ..., - map_uint64_uint64: Optional[Mapping[int, int]] = ..., - map_sint32_sint32: Optional[Mapping[int, int]] = ..., - map_sint64_sint64: Optional[Mapping[int, int]] = ..., - map_fixed32_fixed32: Optional[Mapping[int, int]] = ..., - map_fixed64_fixed64: Optional[Mapping[int, int]] = ..., - map_sfixed32_sfixed32: Optional[Mapping[int, int]] = ..., - map_sfixed64_sfixed64: Optional[Mapping[int, int]] = ..., - map_int32_float: Optional[Mapping[int, float]] = ..., - map_int32_double: Optional[Mapping[int, float]] = ..., - map_bool_bool: Optional[Mapping[bool, bool]] = ..., - map_string_string: Optional[Mapping[Text, Text]] = ..., - map_string_bytes: Optional[Mapping[Text, bytes]] = ..., - map_string_nested_message: Optional[Mapping[Text, TestAllTypesProto2.NestedMessage]] = ..., - map_string_foreign_message: Optional[Mapping[Text, ForeignMessageProto2]] = ..., - map_string_nested_enum: Optional[Mapping[Text, TestAllTypesProto2.NestedEnum]] = ..., - map_string_foreign_enum: Optional[Mapping[Text, ForeignEnumProto2]] = ..., - oneof_uint32: Optional[int] = ..., - oneof_nested_message: Optional[TestAllTypesProto2.NestedMessage] = ..., - oneof_string: Optional[Text] = ..., - oneof_bytes: Optional[bytes] = ..., - oneof_bool: Optional[bool] = ..., - oneof_uint64: Optional[int] = ..., - oneof_float: Optional[float] = ..., - oneof_double: Optional[float] = ..., - oneof_enum: Optional[TestAllTypesProto2.NestedEnum] = ..., - data: Optional[TestAllTypesProto2.Data] = ..., - fieldname1: Optional[int] = ..., - field_name2: Optional[int] = ..., - _field_name3: Optional[int] = ..., - field__name4_: Optional[int] = ..., - field0name5: Optional[int] = ..., - field_0_name6: Optional[int] = ..., - fieldName7: Optional[int] = ..., - FieldName8: Optional[int] = ..., - field_Name9: Optional[int] = ..., - Field_Name10: Optional[int] = ..., - FIELD_NAME11: Optional[int] = ..., - FIELD_name12: Optional[int] = ..., - __field_name13: Optional[int] = ..., - __Field_name14: Optional[int] = ..., - field__name15: Optional[int] = ..., - field__Name16: Optional[int] = ..., - field_name17__: Optional[int] = ..., - Field_name18__: Optional[int] = ..., - ) -> None: ... - + def __init__( + self, + optional_int32: Optional[int] = ..., + optional_int64: Optional[int] = ..., + optional_uint32: Optional[int] = ..., + optional_uint64: Optional[int] = ..., + optional_sint32: Optional[int] = ..., + optional_sint64: Optional[int] = ..., + optional_fixed32: Optional[int] = ..., + optional_fixed64: Optional[int] = ..., + optional_sfixed32: Optional[int] = ..., + optional_sfixed64: Optional[int] = ..., + optional_float: Optional[float] = ..., + optional_double: Optional[float] = ..., + optional_bool: Optional[bool] = ..., + optional_string: Optional[Text] = ..., + optional_bytes: Optional[bytes] = ..., + optional_nested_message: Optional[TestAllTypesProto2.NestedMessage] = ..., + optional_foreign_message: Optional[ForeignMessageProto2] = ..., + optional_nested_enum: Optional[TestAllTypesProto2.NestedEnum] = ..., + optional_foreign_enum: Optional[ForeignEnumProto2] = ..., + optional_string_piece: Optional[Text] = ..., + optional_cord: Optional[Text] = ..., + recursive_message: Optional[TestAllTypesProto2] = ..., + repeated_int32: Optional[Iterable[int]] = ..., + repeated_int64: Optional[Iterable[int]] = ..., + repeated_uint32: Optional[Iterable[int]] = ..., + repeated_uint64: Optional[Iterable[int]] = ..., + repeated_sint32: Optional[Iterable[int]] = ..., + repeated_sint64: Optional[Iterable[int]] = ..., + repeated_fixed32: Optional[Iterable[int]] = ..., + repeated_fixed64: Optional[Iterable[int]] = ..., + repeated_sfixed32: Optional[Iterable[int]] = ..., + repeated_sfixed64: Optional[Iterable[int]] = ..., + repeated_float: Optional[Iterable[float]] = ..., + repeated_double: Optional[Iterable[float]] = ..., + repeated_bool: Optional[Iterable[bool]] = ..., + repeated_string: Optional[Iterable[Text]] = ..., + repeated_bytes: Optional[Iterable[bytes]] = ..., + repeated_nested_message: Optional[Iterable[TestAllTypesProto2.NestedMessage]] = ..., + repeated_foreign_message: Optional[Iterable[ForeignMessageProto2]] = ..., + repeated_nested_enum: Optional[Iterable[TestAllTypesProto2.NestedEnum]] = ..., + repeated_foreign_enum: Optional[Iterable[ForeignEnumProto2]] = ..., + repeated_string_piece: Optional[Iterable[Text]] = ..., + repeated_cord: Optional[Iterable[Text]] = ..., + map_int32_int32: Optional[Mapping[int, int]] = ..., + map_int64_int64: Optional[Mapping[int, int]] = ..., + map_uint32_uint32: Optional[Mapping[int, int]] = ..., + map_uint64_uint64: Optional[Mapping[int, int]] = ..., + map_sint32_sint32: Optional[Mapping[int, int]] = ..., + map_sint64_sint64: Optional[Mapping[int, int]] = ..., + map_fixed32_fixed32: Optional[Mapping[int, int]] = ..., + map_fixed64_fixed64: Optional[Mapping[int, int]] = ..., + map_sfixed32_sfixed32: Optional[Mapping[int, int]] = ..., + map_sfixed64_sfixed64: Optional[Mapping[int, int]] = ..., + map_int32_float: Optional[Mapping[int, float]] = ..., + map_int32_double: Optional[Mapping[int, float]] = ..., + map_bool_bool: Optional[Mapping[bool, bool]] = ..., + map_string_string: Optional[Mapping[Text, Text]] = ..., + map_string_bytes: Optional[Mapping[Text, bytes]] = ..., + map_string_nested_message: Optional[Mapping[Text, TestAllTypesProto2.NestedMessage]] = ..., + map_string_foreign_message: Optional[Mapping[Text, ForeignMessageProto2]] = ..., + map_string_nested_enum: Optional[Mapping[Text, TestAllTypesProto2.NestedEnum]] = ..., + map_string_foreign_enum: Optional[Mapping[Text, ForeignEnumProto2]] = ..., + oneof_uint32: Optional[int] = ..., + oneof_nested_message: Optional[TestAllTypesProto2.NestedMessage] = ..., + oneof_string: Optional[Text] = ..., + oneof_bytes: Optional[bytes] = ..., + oneof_bool: Optional[bool] = ..., + oneof_uint64: Optional[int] = ..., + oneof_float: Optional[float] = ..., + oneof_double: Optional[float] = ..., + oneof_enum: Optional[TestAllTypesProto2.NestedEnum] = ..., + data: Optional[TestAllTypesProto2.Data] = ..., + fieldname1: Optional[int] = ..., + field_name2: Optional[int] = ..., + _field_name3: Optional[int] = ..., + field__name4_: Optional[int] = ..., + field0name5: Optional[int] = ..., + field_0_name6: Optional[int] = ..., + fieldName7: Optional[int] = ..., + FieldName8: Optional[int] = ..., + field_Name9: Optional[int] = ..., + Field_Name10: Optional[int] = ..., + FIELD_NAME11: Optional[int] = ..., + FIELD_name12: Optional[int] = ..., + __field_name13: Optional[int] = ..., + __Field_name14: Optional[int] = ..., + field__name15: Optional[int] = ..., + field__Name16: Optional[int] = ..., + field_name17__: Optional[int] = ..., + Field_name18__: Optional[int] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto2: ... - class ForeignMessageProto2(Message): c: int - - def __init__(self, - c: Optional[int] = ..., - ) -> None: ... - + def __init__(self, c: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ForeignMessageProto2: ... diff --git a/third_party/2and3/google/protobuf/test_messages_proto3_pb2.pyi b/third_party/2and3/google/protobuf/test_messages_proto3_pb2.pyi index 2124591824ca..be582167d1ee 100644 --- a/third_party/2and3/google/protobuf/test_messages_proto3_pb2.pyi +++ b/third_party/2and3/google/protobuf/test_messages_proto3_pb2.pyi @@ -20,292 +20,158 @@ from google.protobuf.wrappers_pb2 import ( ) class ForeignEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> ForeignEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[ForeignEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, ForeignEnum]]: ... + FOREIGN_FOO: ForeignEnum FOREIGN_BAR: ForeignEnum FOREIGN_BAZ: ForeignEnum - class TestAllTypesProto3(Message): - class NestedEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestAllTypesProto3.NestedEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestAllTypesProto3.NestedEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestAllTypesProto3.NestedEnum]]: ... FOO: TestAllTypesProto3.NestedEnum BAR: TestAllTypesProto3.NestedEnum BAZ: TestAllTypesProto3.NestedEnum NEG: TestAllTypesProto3.NestedEnum - class NestedMessage(Message): a: int - @property def corecursive(self) -> TestAllTypesProto3: ... - - def __init__(self, - a: Optional[int] = ..., - corecursive: Optional[TestAllTypesProto3] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ..., corecursive: Optional[TestAllTypesProto3] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.NestedMessage: ... - class MapInt32Int32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapInt32Int32Entry: ... - class MapInt64Int64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapInt64Int64Entry: ... - class MapUint32Uint32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapUint32Uint32Entry: ... - class MapUint64Uint64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapUint64Uint64Entry: ... - class MapSint32Sint32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapSint32Sint32Entry: ... - class MapSint64Sint64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapSint64Sint64Entry: ... - class MapFixed32Fixed32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapFixed32Fixed32Entry: ... - class MapFixed64Fixed64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapFixed64Fixed64Entry: ... - class MapSfixed32Sfixed32Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapSfixed32Sfixed32Entry: ... - class MapSfixed64Sfixed64Entry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapSfixed64Sfixed64Entry: ... - class MapInt32FloatEntry(Message): key: int value: float - - def __init__(self, - key: Optional[int] = ..., - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[float] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapInt32FloatEntry: ... - class MapInt32DoubleEntry(Message): key: int value: float - - def __init__(self, - key: Optional[int] = ..., - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[float] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapInt32DoubleEntry: ... - class MapBoolBoolEntry(Message): key: bool value: bool - - def __init__(self, - key: Optional[bool] = ..., - value: Optional[bool] = ..., - ) -> None: ... - + def __init__(self, key: Optional[bool] = ..., value: Optional[bool] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapBoolBoolEntry: ... - class MapStringStringEntry(Message): key: Text value: Text - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapStringStringEntry: ... - class MapStringBytesEntry(Message): key: Text value: bytes - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[bytes] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[bytes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapStringBytesEntry: ... - class MapStringNestedMessageEntry(Message): key: Text - @property def value(self) -> TestAllTypesProto3.NestedMessage: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[TestAllTypesProto3.NestedMessage] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[TestAllTypesProto3.NestedMessage] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapStringNestedMessageEntry: ... - class MapStringForeignMessageEntry(Message): key: Text - @property def value(self) -> ForeignMessage: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[ForeignMessage] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[ForeignMessage] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapStringForeignMessageEntry: ... - class MapStringNestedEnumEntry(Message): key: Text value: TestAllTypesProto3.NestedEnum - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[TestAllTypesProto3.NestedEnum] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[TestAllTypesProto3.NestedEnum] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapStringNestedEnumEntry: ... - class MapStringForeignEnumEntry(Message): key: Text value: ForeignEnum - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[ForeignEnum] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[ForeignEnum] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3.MapStringForeignEnumEntry: ... optional_int32: int @@ -372,304 +238,243 @@ class TestAllTypesProto3(Message): field__Name16: int field_name17__: int Field_name18__: int - @property def optional_nested_message(self) -> TestAllTypesProto3.NestedMessage: ... - @property def optional_foreign_message(self) -> ForeignMessage: ... - @property def recursive_message(self) -> TestAllTypesProto3: ... - @property def repeated_nested_message(self) -> RepeatedCompositeFieldContainer[TestAllTypesProto3.NestedMessage]: ... - @property def repeated_foreign_message(self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... - @property def map_int32_int32(self) -> MutableMapping[int, int]: ... - @property def map_int64_int64(self) -> MutableMapping[int, int]: ... - @property def map_uint32_uint32(self) -> MutableMapping[int, int]: ... - @property def map_uint64_uint64(self) -> MutableMapping[int, int]: ... - @property def map_sint32_sint32(self) -> MutableMapping[int, int]: ... - @property def map_sint64_sint64(self) -> MutableMapping[int, int]: ... - @property def map_fixed32_fixed32(self) -> MutableMapping[int, int]: ... - @property def map_fixed64_fixed64(self) -> MutableMapping[int, int]: ... - @property def map_sfixed32_sfixed32(self) -> MutableMapping[int, int]: ... - @property def map_sfixed64_sfixed64(self) -> MutableMapping[int, int]: ... - @property def map_int32_float(self) -> MutableMapping[int, float]: ... - @property def map_int32_double(self) -> MutableMapping[int, float]: ... - @property def map_bool_bool(self) -> MutableMapping[bool, bool]: ... - @property def map_string_string(self) -> MutableMapping[Text, Text]: ... - @property def map_string_bytes(self) -> MutableMapping[Text, bytes]: ... - @property def map_string_nested_message(self) -> MutableMapping[Text, TestAllTypesProto3.NestedMessage]: ... - @property def map_string_foreign_message(self) -> MutableMapping[Text, ForeignMessage]: ... - @property def map_string_nested_enum(self) -> MutableMapping[Text, TestAllTypesProto3.NestedEnum]: ... - @property def map_string_foreign_enum(self) -> MutableMapping[Text, ForeignEnum]: ... - @property def oneof_nested_message(self) -> TestAllTypesProto3.NestedMessage: ... - @property def optional_bool_wrapper(self) -> BoolValue: ... - @property def optional_int32_wrapper(self) -> Int32Value: ... - @property def optional_int64_wrapper(self) -> Int64Value: ... - @property def optional_uint32_wrapper(self) -> UInt32Value: ... - @property def optional_uint64_wrapper(self) -> UInt64Value: ... - @property def optional_float_wrapper(self) -> FloatValue: ... - @property def optional_double_wrapper(self) -> DoubleValue: ... - @property def optional_string_wrapper(self) -> StringValue: ... - @property def optional_bytes_wrapper(self) -> BytesValue: ... - @property def repeated_bool_wrapper(self) -> RepeatedCompositeFieldContainer[BoolValue]: ... - @property def repeated_int32_wrapper(self) -> RepeatedCompositeFieldContainer[Int32Value]: ... - @property def repeated_int64_wrapper(self) -> RepeatedCompositeFieldContainer[Int64Value]: ... - @property def repeated_uint32_wrapper(self) -> RepeatedCompositeFieldContainer[UInt32Value]: ... - @property def repeated_uint64_wrapper(self) -> RepeatedCompositeFieldContainer[UInt64Value]: ... - @property def repeated_float_wrapper(self) -> RepeatedCompositeFieldContainer[FloatValue]: ... - @property def repeated_double_wrapper(self) -> RepeatedCompositeFieldContainer[DoubleValue]: ... - @property def repeated_string_wrapper(self) -> RepeatedCompositeFieldContainer[StringValue]: ... - @property def repeated_bytes_wrapper(self) -> RepeatedCompositeFieldContainer[BytesValue]: ... - @property def optional_duration(self) -> Duration: ... - @property def optional_timestamp(self) -> Timestamp: ... - @property def optional_field_mask(self) -> FieldMask: ... - @property def optional_struct(self) -> Struct: ... - @property def optional_any(self) -> Any: ... - @property def optional_value(self) -> Value: ... - @property def repeated_duration(self) -> RepeatedCompositeFieldContainer[Duration]: ... - @property def repeated_timestamp(self) -> RepeatedCompositeFieldContainer[Timestamp]: ... - @property def repeated_fieldmask(self) -> RepeatedCompositeFieldContainer[FieldMask]: ... - @property def repeated_struct(self) -> RepeatedCompositeFieldContainer[Struct]: ... - @property def repeated_any(self) -> RepeatedCompositeFieldContainer[Any]: ... - @property def repeated_value(self) -> RepeatedCompositeFieldContainer[Value]: ... - - def __init__(self, - optional_int32: Optional[int] = ..., - optional_int64: Optional[int] = ..., - optional_uint32: Optional[int] = ..., - optional_uint64: Optional[int] = ..., - optional_sint32: Optional[int] = ..., - optional_sint64: Optional[int] = ..., - optional_fixed32: Optional[int] = ..., - optional_fixed64: Optional[int] = ..., - optional_sfixed32: Optional[int] = ..., - optional_sfixed64: Optional[int] = ..., - optional_float: Optional[float] = ..., - optional_double: Optional[float] = ..., - optional_bool: Optional[bool] = ..., - optional_string: Optional[Text] = ..., - optional_bytes: Optional[bytes] = ..., - optional_nested_message: Optional[TestAllTypesProto3.NestedMessage] = ..., - optional_foreign_message: Optional[ForeignMessage] = ..., - optional_nested_enum: Optional[TestAllTypesProto3.NestedEnum] = ..., - optional_foreign_enum: Optional[ForeignEnum] = ..., - optional_string_piece: Optional[Text] = ..., - optional_cord: Optional[Text] = ..., - recursive_message: Optional[TestAllTypesProto3] = ..., - repeated_int32: Optional[Iterable[int]] = ..., - repeated_int64: Optional[Iterable[int]] = ..., - repeated_uint32: Optional[Iterable[int]] = ..., - repeated_uint64: Optional[Iterable[int]] = ..., - repeated_sint32: Optional[Iterable[int]] = ..., - repeated_sint64: Optional[Iterable[int]] = ..., - repeated_fixed32: Optional[Iterable[int]] = ..., - repeated_fixed64: Optional[Iterable[int]] = ..., - repeated_sfixed32: Optional[Iterable[int]] = ..., - repeated_sfixed64: Optional[Iterable[int]] = ..., - repeated_float: Optional[Iterable[float]] = ..., - repeated_double: Optional[Iterable[float]] = ..., - repeated_bool: Optional[Iterable[bool]] = ..., - repeated_string: Optional[Iterable[Text]] = ..., - repeated_bytes: Optional[Iterable[bytes]] = ..., - repeated_nested_message: Optional[Iterable[TestAllTypesProto3.NestedMessage]] = ..., - repeated_foreign_message: Optional[Iterable[ForeignMessage]] = ..., - repeated_nested_enum: Optional[Iterable[TestAllTypesProto3.NestedEnum]] = ..., - repeated_foreign_enum: Optional[Iterable[ForeignEnum]] = ..., - repeated_string_piece: Optional[Iterable[Text]] = ..., - repeated_cord: Optional[Iterable[Text]] = ..., - map_int32_int32: Optional[Mapping[int, int]] = ..., - map_int64_int64: Optional[Mapping[int, int]] = ..., - map_uint32_uint32: Optional[Mapping[int, int]] = ..., - map_uint64_uint64: Optional[Mapping[int, int]] = ..., - map_sint32_sint32: Optional[Mapping[int, int]] = ..., - map_sint64_sint64: Optional[Mapping[int, int]] = ..., - map_fixed32_fixed32: Optional[Mapping[int, int]] = ..., - map_fixed64_fixed64: Optional[Mapping[int, int]] = ..., - map_sfixed32_sfixed32: Optional[Mapping[int, int]] = ..., - map_sfixed64_sfixed64: Optional[Mapping[int, int]] = ..., - map_int32_float: Optional[Mapping[int, float]] = ..., - map_int32_double: Optional[Mapping[int, float]] = ..., - map_bool_bool: Optional[Mapping[bool, bool]] = ..., - map_string_string: Optional[Mapping[Text, Text]] = ..., - map_string_bytes: Optional[Mapping[Text, bytes]] = ..., - map_string_nested_message: Optional[Mapping[Text, TestAllTypesProto3.NestedMessage]] = ..., - map_string_foreign_message: Optional[Mapping[Text, ForeignMessage]] = ..., - map_string_nested_enum: Optional[Mapping[Text, TestAllTypesProto3.NestedEnum]] = ..., - map_string_foreign_enum: Optional[Mapping[Text, ForeignEnum]] = ..., - oneof_uint32: Optional[int] = ..., - oneof_nested_message: Optional[TestAllTypesProto3.NestedMessage] = ..., - oneof_string: Optional[Text] = ..., - oneof_bytes: Optional[bytes] = ..., - oneof_bool: Optional[bool] = ..., - oneof_uint64: Optional[int] = ..., - oneof_float: Optional[float] = ..., - oneof_double: Optional[float] = ..., - oneof_enum: Optional[TestAllTypesProto3.NestedEnum] = ..., - optional_bool_wrapper: Optional[BoolValue] = ..., - optional_int32_wrapper: Optional[Int32Value] = ..., - optional_int64_wrapper: Optional[Int64Value] = ..., - optional_uint32_wrapper: Optional[UInt32Value] = ..., - optional_uint64_wrapper: Optional[UInt64Value] = ..., - optional_float_wrapper: Optional[FloatValue] = ..., - optional_double_wrapper: Optional[DoubleValue] = ..., - optional_string_wrapper: Optional[StringValue] = ..., - optional_bytes_wrapper: Optional[BytesValue] = ..., - repeated_bool_wrapper: Optional[Iterable[BoolValue]] = ..., - repeated_int32_wrapper: Optional[Iterable[Int32Value]] = ..., - repeated_int64_wrapper: Optional[Iterable[Int64Value]] = ..., - repeated_uint32_wrapper: Optional[Iterable[UInt32Value]] = ..., - repeated_uint64_wrapper: Optional[Iterable[UInt64Value]] = ..., - repeated_float_wrapper: Optional[Iterable[FloatValue]] = ..., - repeated_double_wrapper: Optional[Iterable[DoubleValue]] = ..., - repeated_string_wrapper: Optional[Iterable[StringValue]] = ..., - repeated_bytes_wrapper: Optional[Iterable[BytesValue]] = ..., - optional_duration: Optional[Duration] = ..., - optional_timestamp: Optional[Timestamp] = ..., - optional_field_mask: Optional[FieldMask] = ..., - optional_struct: Optional[Struct] = ..., - optional_any: Optional[Any] = ..., - optional_value: Optional[Value] = ..., - repeated_duration: Optional[Iterable[Duration]] = ..., - repeated_timestamp: Optional[Iterable[Timestamp]] = ..., - repeated_fieldmask: Optional[Iterable[FieldMask]] = ..., - repeated_struct: Optional[Iterable[Struct]] = ..., - repeated_any: Optional[Iterable[Any]] = ..., - repeated_value: Optional[Iterable[Value]] = ..., - fieldname1: Optional[int] = ..., - field_name2: Optional[int] = ..., - _field_name3: Optional[int] = ..., - field__name4_: Optional[int] = ..., - field0name5: Optional[int] = ..., - field_0_name6: Optional[int] = ..., - fieldName7: Optional[int] = ..., - FieldName8: Optional[int] = ..., - field_Name9: Optional[int] = ..., - Field_Name10: Optional[int] = ..., - FIELD_NAME11: Optional[int] = ..., - FIELD_name12: Optional[int] = ..., - __field_name13: Optional[int] = ..., - __Field_name14: Optional[int] = ..., - field__name15: Optional[int] = ..., - field__Name16: Optional[int] = ..., - field_name17__: Optional[int] = ..., - Field_name18__: Optional[int] = ..., - ) -> None: ... - + def __init__( + self, + optional_int32: Optional[int] = ..., + optional_int64: Optional[int] = ..., + optional_uint32: Optional[int] = ..., + optional_uint64: Optional[int] = ..., + optional_sint32: Optional[int] = ..., + optional_sint64: Optional[int] = ..., + optional_fixed32: Optional[int] = ..., + optional_fixed64: Optional[int] = ..., + optional_sfixed32: Optional[int] = ..., + optional_sfixed64: Optional[int] = ..., + optional_float: Optional[float] = ..., + optional_double: Optional[float] = ..., + optional_bool: Optional[bool] = ..., + optional_string: Optional[Text] = ..., + optional_bytes: Optional[bytes] = ..., + optional_nested_message: Optional[TestAllTypesProto3.NestedMessage] = ..., + optional_foreign_message: Optional[ForeignMessage] = ..., + optional_nested_enum: Optional[TestAllTypesProto3.NestedEnum] = ..., + optional_foreign_enum: Optional[ForeignEnum] = ..., + optional_string_piece: Optional[Text] = ..., + optional_cord: Optional[Text] = ..., + recursive_message: Optional[TestAllTypesProto3] = ..., + repeated_int32: Optional[Iterable[int]] = ..., + repeated_int64: Optional[Iterable[int]] = ..., + repeated_uint32: Optional[Iterable[int]] = ..., + repeated_uint64: Optional[Iterable[int]] = ..., + repeated_sint32: Optional[Iterable[int]] = ..., + repeated_sint64: Optional[Iterable[int]] = ..., + repeated_fixed32: Optional[Iterable[int]] = ..., + repeated_fixed64: Optional[Iterable[int]] = ..., + repeated_sfixed32: Optional[Iterable[int]] = ..., + repeated_sfixed64: Optional[Iterable[int]] = ..., + repeated_float: Optional[Iterable[float]] = ..., + repeated_double: Optional[Iterable[float]] = ..., + repeated_bool: Optional[Iterable[bool]] = ..., + repeated_string: Optional[Iterable[Text]] = ..., + repeated_bytes: Optional[Iterable[bytes]] = ..., + repeated_nested_message: Optional[Iterable[TestAllTypesProto3.NestedMessage]] = ..., + repeated_foreign_message: Optional[Iterable[ForeignMessage]] = ..., + repeated_nested_enum: Optional[Iterable[TestAllTypesProto3.NestedEnum]] = ..., + repeated_foreign_enum: Optional[Iterable[ForeignEnum]] = ..., + repeated_string_piece: Optional[Iterable[Text]] = ..., + repeated_cord: Optional[Iterable[Text]] = ..., + map_int32_int32: Optional[Mapping[int, int]] = ..., + map_int64_int64: Optional[Mapping[int, int]] = ..., + map_uint32_uint32: Optional[Mapping[int, int]] = ..., + map_uint64_uint64: Optional[Mapping[int, int]] = ..., + map_sint32_sint32: Optional[Mapping[int, int]] = ..., + map_sint64_sint64: Optional[Mapping[int, int]] = ..., + map_fixed32_fixed32: Optional[Mapping[int, int]] = ..., + map_fixed64_fixed64: Optional[Mapping[int, int]] = ..., + map_sfixed32_sfixed32: Optional[Mapping[int, int]] = ..., + map_sfixed64_sfixed64: Optional[Mapping[int, int]] = ..., + map_int32_float: Optional[Mapping[int, float]] = ..., + map_int32_double: Optional[Mapping[int, float]] = ..., + map_bool_bool: Optional[Mapping[bool, bool]] = ..., + map_string_string: Optional[Mapping[Text, Text]] = ..., + map_string_bytes: Optional[Mapping[Text, bytes]] = ..., + map_string_nested_message: Optional[Mapping[Text, TestAllTypesProto3.NestedMessage]] = ..., + map_string_foreign_message: Optional[Mapping[Text, ForeignMessage]] = ..., + map_string_nested_enum: Optional[Mapping[Text, TestAllTypesProto3.NestedEnum]] = ..., + map_string_foreign_enum: Optional[Mapping[Text, ForeignEnum]] = ..., + oneof_uint32: Optional[int] = ..., + oneof_nested_message: Optional[TestAllTypesProto3.NestedMessage] = ..., + oneof_string: Optional[Text] = ..., + oneof_bytes: Optional[bytes] = ..., + oneof_bool: Optional[bool] = ..., + oneof_uint64: Optional[int] = ..., + oneof_float: Optional[float] = ..., + oneof_double: Optional[float] = ..., + oneof_enum: Optional[TestAllTypesProto3.NestedEnum] = ..., + optional_bool_wrapper: Optional[BoolValue] = ..., + optional_int32_wrapper: Optional[Int32Value] = ..., + optional_int64_wrapper: Optional[Int64Value] = ..., + optional_uint32_wrapper: Optional[UInt32Value] = ..., + optional_uint64_wrapper: Optional[UInt64Value] = ..., + optional_float_wrapper: Optional[FloatValue] = ..., + optional_double_wrapper: Optional[DoubleValue] = ..., + optional_string_wrapper: Optional[StringValue] = ..., + optional_bytes_wrapper: Optional[BytesValue] = ..., + repeated_bool_wrapper: Optional[Iterable[BoolValue]] = ..., + repeated_int32_wrapper: Optional[Iterable[Int32Value]] = ..., + repeated_int64_wrapper: Optional[Iterable[Int64Value]] = ..., + repeated_uint32_wrapper: Optional[Iterable[UInt32Value]] = ..., + repeated_uint64_wrapper: Optional[Iterable[UInt64Value]] = ..., + repeated_float_wrapper: Optional[Iterable[FloatValue]] = ..., + repeated_double_wrapper: Optional[Iterable[DoubleValue]] = ..., + repeated_string_wrapper: Optional[Iterable[StringValue]] = ..., + repeated_bytes_wrapper: Optional[Iterable[BytesValue]] = ..., + optional_duration: Optional[Duration] = ..., + optional_timestamp: Optional[Timestamp] = ..., + optional_field_mask: Optional[FieldMask] = ..., + optional_struct: Optional[Struct] = ..., + optional_any: Optional[Any] = ..., + optional_value: Optional[Value] = ..., + repeated_duration: Optional[Iterable[Duration]] = ..., + repeated_timestamp: Optional[Iterable[Timestamp]] = ..., + repeated_fieldmask: Optional[Iterable[FieldMask]] = ..., + repeated_struct: Optional[Iterable[Struct]] = ..., + repeated_any: Optional[Iterable[Any]] = ..., + repeated_value: Optional[Iterable[Value]] = ..., + fieldname1: Optional[int] = ..., + field_name2: Optional[int] = ..., + _field_name3: Optional[int] = ..., + field__name4_: Optional[int] = ..., + field0name5: Optional[int] = ..., + field_0_name6: Optional[int] = ..., + fieldName7: Optional[int] = ..., + FieldName8: Optional[int] = ..., + field_Name9: Optional[int] = ..., + Field_Name10: Optional[int] = ..., + FIELD_NAME11: Optional[int] = ..., + FIELD_name12: Optional[int] = ..., + __field_name13: Optional[int] = ..., + __Field_name14: Optional[int] = ..., + field__name15: Optional[int] = ..., + field__Name16: Optional[int] = ..., + field_name17__: Optional[int] = ..., + Field_name18__: Optional[int] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypesProto3: ... - class ForeignMessage(Message): c: int - - def __init__(self, - c: Optional[int] = ..., - ) -> None: ... - + def __init__(self, c: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ForeignMessage: ... diff --git a/third_party/2and3/google/protobuf/timestamp_pb2.pyi b/third_party/2and3/google/protobuf/timestamp_pb2.pyi index 83a9d6af36e1..9aba1a39d73d 100644 --- a/third_party/2and3/google/protobuf/timestamp_pb2.pyi +++ b/third_party/2and3/google/protobuf/timestamp_pb2.pyi @@ -6,11 +6,6 @@ from google.protobuf.message import Message class Timestamp(Message, well_known_types.Timestamp): seconds: int nanos: int - - def __init__(self, - seconds: Optional[int] = ..., - nanos: Optional[int] = ..., - ) -> None: ... - + def __init__(self, seconds: Optional[int] = ..., nanos: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Timestamp: ... diff --git a/third_party/2and3/google/protobuf/type_pb2.pyi b/third_party/2and3/google/protobuf/type_pb2.pyi index 07536c268984..39d72c3b89da 100644 --- a/third_party/2and3/google/protobuf/type_pb2.pyi +++ b/third_party/2and3/google/protobuf/type_pb2.pyi @@ -6,70 +6,52 @@ from google.protobuf.message import Message from google.protobuf.source_context_pb2 import SourceContext class Syntax(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> Syntax: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[Syntax]: ... - @classmethod def items(cls) -> List[Tuple[bytes, Syntax]]: ... - SYNTAX_PROTO2: Syntax SYNTAX_PROTO3: Syntax - class Type(Message): name: Text oneofs: RepeatedScalarFieldContainer[Text] syntax: Syntax - @property def fields(self) -> RepeatedCompositeFieldContainer[Field]: ... - @property def options(self) -> RepeatedCompositeFieldContainer[Option]: ... - @property def source_context(self) -> SourceContext: ... - - def __init__(self, - name: Optional[Text] = ..., - fields: Optional[Iterable[Field]] = ..., - oneofs: Optional[Iterable[Text]] = ..., - options: Optional[Iterable[Option]] = ..., - source_context: Optional[SourceContext] = ..., - syntax: Optional[Syntax] = ..., - ) -> None: ... - + def __init__( + self, + name: Optional[Text] = ..., + fields: Optional[Iterable[Field]] = ..., + oneofs: Optional[Iterable[Text]] = ..., + options: Optional[Iterable[Option]] = ..., + source_context: Optional[SourceContext] = ..., + syntax: Optional[Syntax] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> Type: ... - class Field(Message): - class Kind(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> Field.Kind: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[Field.Kind]: ... - @classmethod def items(cls) -> List[Tuple[bytes, Field.Kind]]: ... TYPE_UNKNOWN: Field.Kind @@ -91,21 +73,15 @@ class Field(Message): TYPE_SFIXED64: Field.Kind TYPE_SINT32: Field.Kind TYPE_SINT64: Field.Kind - class Cardinality(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> Field.Cardinality: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[Field.Cardinality]: ... - @classmethod def items(cls) -> List[Tuple[bytes, Field.Cardinality]]: ... CARDINALITY_UNKNOWN: Field.Cardinality @@ -121,79 +97,59 @@ class Field(Message): packed: bool json_name: Text default_value: Text - @property def options(self) -> RepeatedCompositeFieldContainer[Option]: ... - - def __init__(self, - kind: Optional[Field.Kind] = ..., - cardinality: Optional[Field.Cardinality] = ..., - number: Optional[int] = ..., - name: Optional[Text] = ..., - type_url: Optional[Text] = ..., - oneof_index: Optional[int] = ..., - packed: Optional[bool] = ..., - options: Optional[Iterable[Option]] = ..., - json_name: Optional[Text] = ..., - default_value: Optional[Text] = ..., - ) -> None: ... - + def __init__( + self, + kind: Optional[Field.Kind] = ..., + cardinality: Optional[Field.Cardinality] = ..., + number: Optional[int] = ..., + name: Optional[Text] = ..., + type_url: Optional[Text] = ..., + oneof_index: Optional[int] = ..., + packed: Optional[bool] = ..., + options: Optional[Iterable[Option]] = ..., + json_name: Optional[Text] = ..., + default_value: Optional[Text] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> Field: ... - class Enum(Message): name: Text syntax: Syntax - @property def enumvalue(self) -> RepeatedCompositeFieldContainer[EnumValue]: ... - @property def options(self) -> RepeatedCompositeFieldContainer[Option]: ... - @property def source_context(self) -> SourceContext: ... - - def __init__(self, - name: Optional[Text] = ..., - enumvalue: Optional[Iterable[EnumValue]] = ..., - options: Optional[Iterable[Option]] = ..., - source_context: Optional[SourceContext] = ..., - syntax: Optional[Syntax] = ..., - ) -> None: ... - + def __init__( + self, + name: Optional[Text] = ..., + enumvalue: Optional[Iterable[EnumValue]] = ..., + options: Optional[Iterable[Option]] = ..., + source_context: Optional[SourceContext] = ..., + syntax: Optional[Syntax] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> Enum: ... - class EnumValue(Message): name: Text number: int - @property def options(self) -> RepeatedCompositeFieldContainer[Option]: ... - - def __init__(self, - name: Optional[Text] = ..., - number: Optional[int] = ..., - options: Optional[Iterable[Option]] = ..., - ) -> None: ... - + def __init__( + self, name: Optional[Text] = ..., number: Optional[int] = ..., options: Optional[Iterable[Option]] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> EnumValue: ... - class Option(Message): name: Text - @property def value(self) -> Any: ... - - def __init__(self, - name: Optional[Text] = ..., - value: Optional[Any] = ..., - ) -> None: ... - + def __init__(self, name: Optional[Text] = ..., value: Optional[Any] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Option: ... diff --git a/third_party/2and3/google/protobuf/unittest_arena_pb2.pyi b/third_party/2and3/google/protobuf/unittest_arena_pb2.pyi index c9d3bed55a48..f76812f6b6e2 100644 --- a/third_party/2and3/google/protobuf/unittest_arena_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_arena_pb2.pyi @@ -6,29 +6,19 @@ from google.protobuf.unittest_no_arena_import_pb2 import ImportNoArenaNestedMess class NestedMessage(Message): d: int - - def __init__(self, - d: Optional[int] = ..., - ) -> None: ... - + def __init__(self, d: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> NestedMessage: ... - class ArenaMessage(Message): - @property - def repeated_nested_message( - self) -> RepeatedCompositeFieldContainer[NestedMessage]: ... - + def repeated_nested_message(self) -> RepeatedCompositeFieldContainer[NestedMessage]: ... @property - def repeated_import_no_arena_message( - self) -> RepeatedCompositeFieldContainer[ImportNoArenaNestedMessage]: ... - - def __init__(self, - repeated_nested_message: Optional[Iterable[NestedMessage]] = ..., - repeated_import_no_arena_message: Optional[Iterable[ImportNoArenaNestedMessage]] = ..., - ) -> None: ... - + def repeated_import_no_arena_message(self) -> RepeatedCompositeFieldContainer[ImportNoArenaNestedMessage]: ... + def __init__( + self, + repeated_nested_message: Optional[Iterable[NestedMessage]] = ..., + repeated_import_no_arena_message: Optional[Iterable[ImportNoArenaNestedMessage]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> ArenaMessage: ... diff --git a/third_party/2and3/google/protobuf/unittest_custom_options_pb2.pyi b/third_party/2and3/google/protobuf/unittest_custom_options_pb2.pyi index 97f649a5744a..f5c15d8f9ee5 100644 --- a/third_party/2and3/google/protobuf/unittest_custom_options_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_custom_options_pb2.pyi @@ -5,454 +5,279 @@ from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, from google.protobuf.message import Message class MethodOpt1(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> MethodOpt1: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[MethodOpt1]: ... - @classmethod def items(cls) -> List[Tuple[bytes, MethodOpt1]]: ... - METHODOPT1_VAL1: MethodOpt1 METHODOPT1_VAL2: MethodOpt1 - class AggregateEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> AggregateEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[AggregateEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, AggregateEnum]]: ... - VALUE: AggregateEnum - class TestMessageWithCustomOptions(Message): - class AnEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestMessageWithCustomOptions.AnEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestMessageWithCustomOptions.AnEnum]: ... - @classmethod - def items(cls) -> List[Tuple[bytes, - TestMessageWithCustomOptions.AnEnum]]: ... + def items(cls) -> List[Tuple[bytes, TestMessageWithCustomOptions.AnEnum]]: ... ANENUM_VAL1: TestMessageWithCustomOptions.AnEnum ANENUM_VAL2: TestMessageWithCustomOptions.AnEnum field1: Text oneof_field: int - - def __init__(self, - field1: Optional[Text] = ..., - oneof_field: Optional[int] = ..., - ) -> None: ... - + def __init__(self, field1: Optional[Text] = ..., oneof_field: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessageWithCustomOptions: ... - class CustomOptionFooRequest(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> CustomOptionFooRequest: ... - class CustomOptionFooResponse(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> CustomOptionFooResponse: ... - class CustomOptionFooClientMessage(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> CustomOptionFooClientMessage: ... - class CustomOptionFooServerMessage(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> CustomOptionFooServerMessage: ... - class DummyMessageContainingEnum(Message): - class TestEnumType(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> DummyMessageContainingEnum.TestEnumType: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[DummyMessageContainingEnum.TestEnumType]: ... - @classmethod - def items(cls) -> List[Tuple[bytes, - DummyMessageContainingEnum.TestEnumType]]: ... + def items(cls) -> List[Tuple[bytes, DummyMessageContainingEnum.TestEnumType]]: ... TEST_OPTION_ENUM_TYPE1: DummyMessageContainingEnum.TestEnumType TEST_OPTION_ENUM_TYPE2: DummyMessageContainingEnum.TestEnumType - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> DummyMessageContainingEnum: ... - class DummyMessageInvalidAsOptionType(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> DummyMessageInvalidAsOptionType: ... - class CustomOptionMinIntegerValues(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> CustomOptionMinIntegerValues: ... - class CustomOptionMaxIntegerValues(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> CustomOptionMaxIntegerValues: ... - class CustomOptionOtherValues(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> CustomOptionOtherValues: ... - class SettingRealsFromPositiveInts(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> SettingRealsFromPositiveInts: ... - class SettingRealsFromNegativeInts(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> SettingRealsFromNegativeInts: ... - class ComplexOptionType1(Message): foo: int foo2: int foo3: int foo4: RepeatedScalarFieldContainer[int] - - def __init__(self, - foo: Optional[int] = ..., - foo2: Optional[int] = ..., - foo3: Optional[int] = ..., - foo4: Optional[Iterable[int]] = ..., - ) -> None: ... - + def __init__( + self, foo: Optional[int] = ..., foo2: Optional[int] = ..., foo3: Optional[int] = ..., foo4: Optional[Iterable[int]] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> ComplexOptionType1: ... - class ComplexOptionType2(Message): - class ComplexOptionType4(Message): waldo: int - - def __init__(self, - waldo: Optional[int] = ..., - ) -> None: ... - + def __init__(self, waldo: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> ComplexOptionType2.ComplexOptionType4: ... + def FromString(cls, s: bytes) -> ComplexOptionType2.ComplexOptionType4: ... baz: int - @property def bar(self) -> ComplexOptionType1: ... - @property def fred(self) -> ComplexOptionType2.ComplexOptionType4: ... - @property - def barney( - self) -> RepeatedCompositeFieldContainer[ComplexOptionType2.ComplexOptionType4]: ... - - def __init__(self, - bar: Optional[ComplexOptionType1] = ..., - baz: Optional[int] = ..., - fred: Optional[ComplexOptionType2.ComplexOptionType4] = ..., - barney: Optional[Iterable[ComplexOptionType2.ComplexOptionType4]] = ..., - ) -> None: ... - + def barney(self) -> RepeatedCompositeFieldContainer[ComplexOptionType2.ComplexOptionType4]: ... + def __init__( + self, + bar: Optional[ComplexOptionType1] = ..., + baz: Optional[int] = ..., + fred: Optional[ComplexOptionType2.ComplexOptionType4] = ..., + barney: Optional[Iterable[ComplexOptionType2.ComplexOptionType4]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> ComplexOptionType2: ... - class ComplexOptionType3(Message): - class ComplexOptionType5(Message): plugh: int - - def __init__(self, - plugh: Optional[int] = ..., - ) -> None: ... - + def __init__(self, plugh: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> ComplexOptionType3.ComplexOptionType5: ... + def FromString(cls, s: bytes) -> ComplexOptionType3.ComplexOptionType5: ... qux: int - @property def complexoptiontype5(self) -> ComplexOptionType3.ComplexOptionType5: ... - - def __init__(self, - qux: Optional[int] = ..., - complexoptiontype5: Optional[ComplexOptionType3.ComplexOptionType5] = ..., - ) -> None: ... - + def __init__( + self, qux: Optional[int] = ..., complexoptiontype5: Optional[ComplexOptionType3.ComplexOptionType5] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> ComplexOptionType3: ... - class ComplexOpt6(Message): xyzzy: int - - def __init__(self, - xyzzy: Optional[int] = ..., - ) -> None: ... - + def __init__(self, xyzzy: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ComplexOpt6: ... - class VariousComplexOptions(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> VariousComplexOptions: ... - class AggregateMessageSet(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> AggregateMessageSet: ... - class AggregateMessageSetElement(Message): s: Text - - def __init__(self, - s: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, s: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> AggregateMessageSetElement: ... - class Aggregate(Message): i: int s: Text - @property def sub(self) -> Aggregate: ... - @property def file(self) -> FileOptions: ... - @property def mset(self) -> AggregateMessageSet: ... - - def __init__(self, - i: Optional[int] = ..., - s: Optional[Text] = ..., - sub: Optional[Aggregate] = ..., - file: Optional[FileOptions] = ..., - mset: Optional[AggregateMessageSet] = ..., - ) -> None: ... - + def __init__( + self, + i: Optional[int] = ..., + s: Optional[Text] = ..., + sub: Optional[Aggregate] = ..., + file: Optional[FileOptions] = ..., + mset: Optional[AggregateMessageSet] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> Aggregate: ... - class AggregateMessage(Message): fieldname: int - - def __init__(self, - fieldname: Optional[int] = ..., - ) -> None: ... - + def __init__(self, fieldname: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> AggregateMessage: ... - class NestedOptionType(Message): - class NestedEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> NestedOptionType.NestedEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[NestedOptionType.NestedEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, NestedOptionType.NestedEnum]]: ... NESTED_ENUM_VALUE: NestedOptionType.NestedEnum - class NestedMessage(Message): nested_field: int - - def __init__(self, - nested_field: Optional[int] = ..., - ) -> None: ... - + def __init__(self, nested_field: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> NestedOptionType.NestedMessage: ... - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> NestedOptionType: ... - class OldOptionType(Message): - class TestEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> OldOptionType.TestEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[OldOptionType.TestEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, OldOptionType.TestEnum]]: ... OLD_VALUE: OldOptionType.TestEnum value: OldOptionType.TestEnum - - def __init__(self, - value: OldOptionType.TestEnum, - ) -> None: ... - + def __init__(self, value: OldOptionType.TestEnum) -> None: ... @classmethod def FromString(cls, s: bytes) -> OldOptionType: ... - class NewOptionType(Message): - class TestEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> NewOptionType.TestEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[NewOptionType.TestEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, NewOptionType.TestEnum]]: ... OLD_VALUE: NewOptionType.TestEnum NEW_VALUE: NewOptionType.TestEnum value: NewOptionType.TestEnum - - def __init__(self, - value: NewOptionType.TestEnum, - ) -> None: ... - + def __init__(self, value: NewOptionType.TestEnum) -> None: ... @classmethod def FromString(cls, s: bytes) -> NewOptionType: ... - class TestMessageWithRequiredEnumOption(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessageWithRequiredEnumOption: ... diff --git a/third_party/2and3/google/protobuf/unittest_import_pb2.pyi b/third_party/2and3/google/protobuf/unittest_import_pb2.pyi index 0569200eb72e..abd97af1bab6 100644 --- a/third_party/2and3/google/protobuf/unittest_import_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_import_pb2.pyi @@ -3,57 +3,39 @@ from typing import List, Optional, Tuple, cast from google.protobuf.message import Message class ImportEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> ImportEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[ImportEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, ImportEnum]]: ... - IMPORT_FOO: ImportEnum IMPORT_BAR: ImportEnum IMPORT_BAZ: ImportEnum - class ImportEnumForMap(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> ImportEnumForMap: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[ImportEnumForMap]: ... - @classmethod def items(cls) -> List[Tuple[bytes, ImportEnumForMap]]: ... - UNKNOWN: ImportEnumForMap FOO: ImportEnumForMap BAR: ImportEnumForMap - class ImportMessage(Message): d: int - - def __init__(self, - d: Optional[int] = ..., - ) -> None: ... - + def __init__(self, d: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ImportMessage: ... diff --git a/third_party/2and3/google/protobuf/unittest_import_public_pb2.pyi b/third_party/2and3/google/protobuf/unittest_import_public_pb2.pyi index 6f0daeb8fbd9..074e8c84bbe0 100644 --- a/third_party/2and3/google/protobuf/unittest_import_public_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_import_public_pb2.pyi @@ -4,10 +4,6 @@ from google.protobuf.message import Message class PublicImportMessage(Message): e: int - - def __init__(self, - e: Optional[int] = ..., - ) -> None: ... - + def __init__(self, e: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> PublicImportMessage: ... diff --git a/third_party/2and3/google/protobuf/unittest_mset_pb2.pyi b/third_party/2and3/google/protobuf/unittest_mset_pb2.pyi index 00fcd5c09451..470b05050e4c 100644 --- a/third_party/2and3/google/protobuf/unittest_mset_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_mset_pb2.pyi @@ -6,60 +6,33 @@ from google.protobuf.message import Message from google.protobuf.unittest_mset_wire_format_pb2 import TestMessageSet class TestMessageSetContainer(Message): - @property def message_set(self) -> TestMessageSet: ... - - def __init__(self, - message_set: Optional[TestMessageSet] = ..., - ) -> None: ... - + def __init__(self, message_set: Optional[TestMessageSet] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessageSetContainer: ... - class TestMessageSetExtension1(Message): i: int - - def __init__(self, - i: Optional[int] = ..., - ) -> None: ... - + def __init__(self, i: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessageSetExtension1: ... - class TestMessageSetExtension2(Message): str: Text - - def __init__(self, - bytes: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, bytes: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: builtins.bytes) -> TestMessageSetExtension2: ... - class RawMessageSet(Message): - class Item(Message): type_id: int message: bytes - - def __init__(self, - type_id: int, - message: bytes, - ) -> None: ... - + def __init__(self, type_id: int, message: bytes) -> None: ... @classmethod def FromString(cls, s: bytes) -> RawMessageSet.Item: ... - @property def item(self) -> RepeatedCompositeFieldContainer[RawMessageSet.Item]: ... - - def __init__(self, - item: Optional[Iterable[RawMessageSet.Item]] = ..., - ) -> None: ... - + def __init__(self, item: Optional[Iterable[RawMessageSet.Item]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> RawMessageSet: ... diff --git a/third_party/2and3/google/protobuf/unittest_mset_wire_format_pb2.pyi b/third_party/2and3/google/protobuf/unittest_mset_wire_format_pb2.pyi index 5e190057bf2d..f847d5715196 100644 --- a/third_party/2and3/google/protobuf/unittest_mset_wire_format_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_mset_wire_format_pb2.pyi @@ -3,22 +3,13 @@ from typing import Optional from google.protobuf.message import Message class TestMessageSet(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessageSet: ... - class TestMessageSetWireFormatContainer(Message): - @property def message_set(self) -> TestMessageSet: ... - - def __init__(self, - message_set: Optional[TestMessageSet] = ..., - ) -> None: ... - + def __init__(self, message_set: Optional[TestMessageSet] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessageSetWireFormatContainer: ... diff --git a/third_party/2and3/google/protobuf/unittest_no_arena_import_pb2.pyi b/third_party/2and3/google/protobuf/unittest_no_arena_import_pb2.pyi index a8f8a207717c..90d7c9814f28 100644 --- a/third_party/2and3/google/protobuf/unittest_no_arena_import_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_no_arena_import_pb2.pyi @@ -4,10 +4,6 @@ from google.protobuf.message import Message class ImportNoArenaNestedMessage(Message): d: int - - def __init__(self, - d: Optional[int] = ..., - ) -> None: ... - + def __init__(self, d: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ImportNoArenaNestedMessage: ... diff --git a/third_party/2and3/google/protobuf/unittest_no_arena_pb2.pyi b/third_party/2and3/google/protobuf/unittest_no_arena_pb2.pyi index a90a4cf513c7..11f758bc0599 100644 --- a/third_party/2and3/google/protobuf/unittest_no_arena_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_no_arena_pb2.pyi @@ -7,78 +7,50 @@ from google.protobuf.unittest_import_pb2 import ImportEnum, ImportMessage from google.protobuf.unittest_import_public_pb2 import PublicImportMessage class ForeignEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> ForeignEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[ForeignEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, ForeignEnum]]: ... - FOREIGN_FOO: ForeignEnum FOREIGN_BAR: ForeignEnum FOREIGN_BAZ: ForeignEnum - class TestAllTypes(Message): - class NestedEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestAllTypes.NestedEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestAllTypes.NestedEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestAllTypes.NestedEnum]]: ... FOO: TestAllTypes.NestedEnum BAR: TestAllTypes.NestedEnum BAZ: TestAllTypes.NestedEnum NEG: TestAllTypes.NestedEnum - class NestedMessage(Message): bb: int - - def __init__(self, - bb: Optional[int] = ..., - ) -> None: ... - + def __init__(self, bb: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes.NestedMessage: ... - class OptionalGroup(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes.OptionalGroup: ... - class RepeatedGroup(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes.RepeatedGroup: ... optional_int32: int @@ -144,153 +116,123 @@ class TestAllTypes(Message): oneof_uint32: int oneof_string: Text oneof_bytes: bytes - @property def optionalgroup(self) -> TestAllTypes.OptionalGroup: ... - @property def optional_nested_message(self) -> TestAllTypes.NestedMessage: ... - @property def optional_foreign_message(self) -> ForeignMessage: ... - @property def optional_import_message(self) -> ImportMessage: ... - @property def optional_public_import_message(self) -> PublicImportMessage: ... - @property def optional_message(self) -> TestAllTypes.NestedMessage: ... - @property - def repeatedgroup( - self) -> RepeatedCompositeFieldContainer[TestAllTypes.RepeatedGroup]: ... - + def repeatedgroup(self) -> RepeatedCompositeFieldContainer[TestAllTypes.RepeatedGroup]: ... @property - def repeated_nested_message( - self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... - + def repeated_nested_message(self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... @property - def repeated_foreign_message( - self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... - + def repeated_foreign_message(self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... @property - def repeated_import_message( - self) -> RepeatedCompositeFieldContainer[ImportMessage]: ... - + def repeated_import_message(self) -> RepeatedCompositeFieldContainer[ImportMessage]: ... @property - def repeated_lazy_message( - self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... - + def repeated_lazy_message(self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... @property def oneof_nested_message(self) -> TestAllTypes.NestedMessage: ... - @property def lazy_oneof_nested_message(self) -> TestAllTypes.NestedMessage: ... - - def __init__(self, - optional_int32: Optional[int] = ..., - optional_int64: Optional[int] = ..., - optional_uint32: Optional[int] = ..., - optional_uint64: Optional[int] = ..., - optional_sint32: Optional[int] = ..., - optional_sint64: Optional[int] = ..., - optional_fixed32: Optional[int] = ..., - optional_fixed64: Optional[int] = ..., - optional_sfixed32: Optional[int] = ..., - optional_sfixed64: Optional[int] = ..., - optional_float: Optional[float] = ..., - optional_double: Optional[float] = ..., - optional_bool: Optional[bool] = ..., - optional_string: Optional[Text] = ..., - optional_bytes: Optional[bytes] = ..., - optionalgroup: Optional[TestAllTypes.OptionalGroup] = ..., - optional_nested_message: Optional[TestAllTypes.NestedMessage] = ..., - optional_foreign_message: Optional[ForeignMessage] = ..., - optional_import_message: Optional[ImportMessage] = ..., - optional_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., - optional_foreign_enum: Optional[ForeignEnum] = ..., - optional_import_enum: Optional[ImportEnum] = ..., - optional_string_piece: Optional[Text] = ..., - optional_cord: Optional[Text] = ..., - optional_public_import_message: Optional[PublicImportMessage] = ..., - optional_message: Optional[TestAllTypes.NestedMessage] = ..., - repeated_int32: Optional[Iterable[int]] = ..., - repeated_int64: Optional[Iterable[int]] = ..., - repeated_uint32: Optional[Iterable[int]] = ..., - repeated_uint64: Optional[Iterable[int]] = ..., - repeated_sint32: Optional[Iterable[int]] = ..., - repeated_sint64: Optional[Iterable[int]] = ..., - repeated_fixed32: Optional[Iterable[int]] = ..., - repeated_fixed64: Optional[Iterable[int]] = ..., - repeated_sfixed32: Optional[Iterable[int]] = ..., - repeated_sfixed64: Optional[Iterable[int]] = ..., - repeated_float: Optional[Iterable[float]] = ..., - repeated_double: Optional[Iterable[float]] = ..., - repeated_bool: Optional[Iterable[bool]] = ..., - repeated_string: Optional[Iterable[Text]] = ..., - repeated_bytes: Optional[Iterable[bytes]] = ..., - repeatedgroup: Optional[Iterable[TestAllTypes.RepeatedGroup]] = ..., - repeated_nested_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., - repeated_foreign_message: Optional[Iterable[ForeignMessage]] = ..., - repeated_import_message: Optional[Iterable[ImportMessage]] = ..., - repeated_nested_enum: Optional[Iterable[TestAllTypes.NestedEnum]] = ..., - repeated_foreign_enum: Optional[Iterable[ForeignEnum]] = ..., - repeated_import_enum: Optional[Iterable[ImportEnum]] = ..., - repeated_string_piece: Optional[Iterable[Text]] = ..., - repeated_cord: Optional[Iterable[Text]] = ..., - repeated_lazy_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., - default_int32: Optional[int] = ..., - default_int64: Optional[int] = ..., - default_uint32: Optional[int] = ..., - default_uint64: Optional[int] = ..., - default_sint32: Optional[int] = ..., - default_sint64: Optional[int] = ..., - default_fixed32: Optional[int] = ..., - default_fixed64: Optional[int] = ..., - default_sfixed32: Optional[int] = ..., - default_sfixed64: Optional[int] = ..., - default_float: Optional[float] = ..., - default_double: Optional[float] = ..., - default_bool: Optional[bool] = ..., - default_string: Optional[Text] = ..., - default_bytes: Optional[bytes] = ..., - default_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., - default_foreign_enum: Optional[ForeignEnum] = ..., - default_import_enum: Optional[ImportEnum] = ..., - default_string_piece: Optional[Text] = ..., - default_cord: Optional[Text] = ..., - oneof_uint32: Optional[int] = ..., - oneof_nested_message: Optional[TestAllTypes.NestedMessage] = ..., - oneof_string: Optional[Text] = ..., - oneof_bytes: Optional[bytes] = ..., - lazy_oneof_nested_message: Optional[TestAllTypes.NestedMessage] = ..., - ) -> None: ... - + def __init__( + self, + optional_int32: Optional[int] = ..., + optional_int64: Optional[int] = ..., + optional_uint32: Optional[int] = ..., + optional_uint64: Optional[int] = ..., + optional_sint32: Optional[int] = ..., + optional_sint64: Optional[int] = ..., + optional_fixed32: Optional[int] = ..., + optional_fixed64: Optional[int] = ..., + optional_sfixed32: Optional[int] = ..., + optional_sfixed64: Optional[int] = ..., + optional_float: Optional[float] = ..., + optional_double: Optional[float] = ..., + optional_bool: Optional[bool] = ..., + optional_string: Optional[Text] = ..., + optional_bytes: Optional[bytes] = ..., + optionalgroup: Optional[TestAllTypes.OptionalGroup] = ..., + optional_nested_message: Optional[TestAllTypes.NestedMessage] = ..., + optional_foreign_message: Optional[ForeignMessage] = ..., + optional_import_message: Optional[ImportMessage] = ..., + optional_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., + optional_foreign_enum: Optional[ForeignEnum] = ..., + optional_import_enum: Optional[ImportEnum] = ..., + optional_string_piece: Optional[Text] = ..., + optional_cord: Optional[Text] = ..., + optional_public_import_message: Optional[PublicImportMessage] = ..., + optional_message: Optional[TestAllTypes.NestedMessage] = ..., + repeated_int32: Optional[Iterable[int]] = ..., + repeated_int64: Optional[Iterable[int]] = ..., + repeated_uint32: Optional[Iterable[int]] = ..., + repeated_uint64: Optional[Iterable[int]] = ..., + repeated_sint32: Optional[Iterable[int]] = ..., + repeated_sint64: Optional[Iterable[int]] = ..., + repeated_fixed32: Optional[Iterable[int]] = ..., + repeated_fixed64: Optional[Iterable[int]] = ..., + repeated_sfixed32: Optional[Iterable[int]] = ..., + repeated_sfixed64: Optional[Iterable[int]] = ..., + repeated_float: Optional[Iterable[float]] = ..., + repeated_double: Optional[Iterable[float]] = ..., + repeated_bool: Optional[Iterable[bool]] = ..., + repeated_string: Optional[Iterable[Text]] = ..., + repeated_bytes: Optional[Iterable[bytes]] = ..., + repeatedgroup: Optional[Iterable[TestAllTypes.RepeatedGroup]] = ..., + repeated_nested_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., + repeated_foreign_message: Optional[Iterable[ForeignMessage]] = ..., + repeated_import_message: Optional[Iterable[ImportMessage]] = ..., + repeated_nested_enum: Optional[Iterable[TestAllTypes.NestedEnum]] = ..., + repeated_foreign_enum: Optional[Iterable[ForeignEnum]] = ..., + repeated_import_enum: Optional[Iterable[ImportEnum]] = ..., + repeated_string_piece: Optional[Iterable[Text]] = ..., + repeated_cord: Optional[Iterable[Text]] = ..., + repeated_lazy_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., + default_int32: Optional[int] = ..., + default_int64: Optional[int] = ..., + default_uint32: Optional[int] = ..., + default_uint64: Optional[int] = ..., + default_sint32: Optional[int] = ..., + default_sint64: Optional[int] = ..., + default_fixed32: Optional[int] = ..., + default_fixed64: Optional[int] = ..., + default_sfixed32: Optional[int] = ..., + default_sfixed64: Optional[int] = ..., + default_float: Optional[float] = ..., + default_double: Optional[float] = ..., + default_bool: Optional[bool] = ..., + default_string: Optional[Text] = ..., + default_bytes: Optional[bytes] = ..., + default_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., + default_foreign_enum: Optional[ForeignEnum] = ..., + default_import_enum: Optional[ImportEnum] = ..., + default_string_piece: Optional[Text] = ..., + default_cord: Optional[Text] = ..., + oneof_uint32: Optional[int] = ..., + oneof_nested_message: Optional[TestAllTypes.NestedMessage] = ..., + oneof_string: Optional[Text] = ..., + oneof_bytes: Optional[bytes] = ..., + lazy_oneof_nested_message: Optional[TestAllTypes.NestedMessage] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes: ... - class ForeignMessage(Message): c: int - - def __init__(self, - c: Optional[int] = ..., - ) -> None: ... - + def __init__(self, c: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ForeignMessage: ... - class TestNoArenaMessage(Message): - @property def arena_message(self) -> ArenaMessage: ... - - def __init__(self, - arena_message: Optional[ArenaMessage] = ..., - ) -> None: ... - + def __init__(self, arena_message: Optional[ArenaMessage] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNoArenaMessage: ... diff --git a/third_party/2and3/google/protobuf/unittest_no_generic_services_pb2.pyi b/third_party/2and3/google/protobuf/unittest_no_generic_services_pb2.pyi index e4217590ea79..45503114b199 100644 --- a/third_party/2and3/google/protobuf/unittest_no_generic_services_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_no_generic_services_pb2.pyi @@ -5,29 +5,19 @@ from google.protobuf.message import Message class TestEnum(int): @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestEnum]]: ... - FOO: TestEnum - class TestMessage(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessage: ... diff --git a/third_party/2and3/google/protobuf/unittest_pb2.pyi b/third_party/2and3/google/protobuf/unittest_pb2.pyi index cc636c2d1eab..a87318d33251 100644 --- a/third_party/2and3/google/protobuf/unittest_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_pb2.pyi @@ -8,66 +8,49 @@ from google.protobuf.unittest_import_public_pb2 import PublicImportMessage class ForeignEnum(int): @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> ForeignEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[ForeignEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, ForeignEnum]]: ... - FOREIGN_FOO: ForeignEnum FOREIGN_BAR: ForeignEnum FOREIGN_BAZ: ForeignEnum - class TestEnumWithDupValue(int): @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestEnumWithDupValue: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestEnumWithDupValue]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestEnumWithDupValue]]: ... - FOO1: TestEnumWithDupValue BAR1: TestEnumWithDupValue BAZ: TestEnumWithDupValue FOO2: TestEnumWithDupValue BAR2: TestEnumWithDupValue - class TestSparseEnum(int): @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestSparseEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestSparseEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestSparseEnum]]: ... - SPARSE_A: TestSparseEnum SPARSE_B: TestSparseEnum SPARSE_C: TestSparseEnum @@ -76,55 +59,35 @@ SPARSE_E: TestSparseEnum SPARSE_F: TestSparseEnum SPARSE_G: TestSparseEnum - class TestAllTypes(Message): class NestedEnum(int): @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestAllTypes.NestedEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestAllTypes.NestedEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestAllTypes.NestedEnum]]: ... FOO: TestAllTypes.NestedEnum BAR: TestAllTypes.NestedEnum BAZ: TestAllTypes.NestedEnum NEG: TestAllTypes.NestedEnum - class NestedMessage(Message): bb: int - - def __init__(self, - bb: Optional[int] = ..., - ) -> None: ... - + def __init__(self, bb: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes.NestedMessage: ... - class OptionalGroup(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes.OptionalGroup: ... - class RepeatedGroup(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes.RepeatedGroup: ... optional_int32: int @@ -190,279 +153,198 @@ class TestAllTypes(Message): oneof_uint32: int oneof_string: Text oneof_bytes: bytes - @property def optionalgroup(self) -> TestAllTypes.OptionalGroup: ... - @property def optional_nested_message(self) -> TestAllTypes.NestedMessage: ... - @property def optional_foreign_message(self) -> ForeignMessage: ... - @property def optional_import_message(self) -> ImportMessage: ... - @property def optional_public_import_message(self) -> PublicImportMessage: ... - @property def optional_lazy_message(self) -> TestAllTypes.NestedMessage: ... - @property - def repeatedgroup( - self) -> RepeatedCompositeFieldContainer[TestAllTypes.RepeatedGroup]: ... - + def repeatedgroup(self) -> RepeatedCompositeFieldContainer[TestAllTypes.RepeatedGroup]: ... @property - def repeated_nested_message( - self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... - + def repeated_nested_message(self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... @property - def repeated_foreign_message( - self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... - + def repeated_foreign_message(self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... @property - def repeated_import_message( - self) -> RepeatedCompositeFieldContainer[ImportMessage]: ... - + def repeated_import_message(self) -> RepeatedCompositeFieldContainer[ImportMessage]: ... @property - def repeated_lazy_message( - self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... - + def repeated_lazy_message(self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... @property def oneof_nested_message(self) -> TestAllTypes.NestedMessage: ... - - def __init__(self, - optional_int32: Optional[int] = ..., - optional_int64: Optional[int] = ..., - optional_uint32: Optional[int] = ..., - optional_uint64: Optional[int] = ..., - optional_sint32: Optional[int] = ..., - optional_sint64: Optional[int] = ..., - optional_fixed32: Optional[int] = ..., - optional_fixed64: Optional[int] = ..., - optional_sfixed32: Optional[int] = ..., - optional_sfixed64: Optional[int] = ..., - optional_float: Optional[float] = ..., - optional_double: Optional[float] = ..., - optional_bool: Optional[bool] = ..., - optional_string: Optional[Text] = ..., - optional_bytes: Optional[bytes] = ..., - optionalgroup: Optional[TestAllTypes.OptionalGroup] = ..., - optional_nested_message: Optional[TestAllTypes.NestedMessage] = ..., - optional_foreign_message: Optional[ForeignMessage] = ..., - optional_import_message: Optional[ImportMessage] = ..., - optional_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., - optional_foreign_enum: Optional[ForeignEnum] = ..., - optional_import_enum: Optional[ImportEnum] = ..., - optional_string_piece: Optional[Text] = ..., - optional_cord: Optional[Text] = ..., - optional_public_import_message: Optional[PublicImportMessage] = ..., - optional_lazy_message: Optional[TestAllTypes.NestedMessage] = ..., - repeated_int32: Optional[Iterable[int]] = ..., - repeated_int64: Optional[Iterable[int]] = ..., - repeated_uint32: Optional[Iterable[int]] = ..., - repeated_uint64: Optional[Iterable[int]] = ..., - repeated_sint32: Optional[Iterable[int]] = ..., - repeated_sint64: Optional[Iterable[int]] = ..., - repeated_fixed32: Optional[Iterable[int]] = ..., - repeated_fixed64: Optional[Iterable[int]] = ..., - repeated_sfixed32: Optional[Iterable[int]] = ..., - repeated_sfixed64: Optional[Iterable[int]] = ..., - repeated_float: Optional[Iterable[float]] = ..., - repeated_double: Optional[Iterable[float]] = ..., - repeated_bool: Optional[Iterable[bool]] = ..., - repeated_string: Optional[Iterable[Text]] = ..., - repeated_bytes: Optional[Iterable[bytes]] = ..., - repeatedgroup: Optional[Iterable[TestAllTypes.RepeatedGroup]] = ..., - repeated_nested_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., - repeated_foreign_message: Optional[Iterable[ForeignMessage]] = ..., - repeated_import_message: Optional[Iterable[ImportMessage]] = ..., - repeated_nested_enum: Optional[Iterable[TestAllTypes.NestedEnum]] = ..., - repeated_foreign_enum: Optional[Iterable[ForeignEnum]] = ..., - repeated_import_enum: Optional[Iterable[ImportEnum]] = ..., - repeated_string_piece: Optional[Iterable[Text]] = ..., - repeated_cord: Optional[Iterable[Text]] = ..., - repeated_lazy_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., - default_int32: Optional[int] = ..., - default_int64: Optional[int] = ..., - default_uint32: Optional[int] = ..., - default_uint64: Optional[int] = ..., - default_sint32: Optional[int] = ..., - default_sint64: Optional[int] = ..., - default_fixed32: Optional[int] = ..., - default_fixed64: Optional[int] = ..., - default_sfixed32: Optional[int] = ..., - default_sfixed64: Optional[int] = ..., - default_float: Optional[float] = ..., - default_double: Optional[float] = ..., - default_bool: Optional[bool] = ..., - default_string: Optional[Text] = ..., - default_bytes: Optional[bytes] = ..., - default_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., - default_foreign_enum: Optional[ForeignEnum] = ..., - default_import_enum: Optional[ImportEnum] = ..., - default_string_piece: Optional[Text] = ..., - default_cord: Optional[Text] = ..., - oneof_uint32: Optional[int] = ..., - oneof_nested_message: Optional[TestAllTypes.NestedMessage] = ..., - oneof_string: Optional[Text] = ..., - oneof_bytes: Optional[bytes] = ..., - ) -> None: ... - + def __init__( + self, + optional_int32: Optional[int] = ..., + optional_int64: Optional[int] = ..., + optional_uint32: Optional[int] = ..., + optional_uint64: Optional[int] = ..., + optional_sint32: Optional[int] = ..., + optional_sint64: Optional[int] = ..., + optional_fixed32: Optional[int] = ..., + optional_fixed64: Optional[int] = ..., + optional_sfixed32: Optional[int] = ..., + optional_sfixed64: Optional[int] = ..., + optional_float: Optional[float] = ..., + optional_double: Optional[float] = ..., + optional_bool: Optional[bool] = ..., + optional_string: Optional[Text] = ..., + optional_bytes: Optional[bytes] = ..., + optionalgroup: Optional[TestAllTypes.OptionalGroup] = ..., + optional_nested_message: Optional[TestAllTypes.NestedMessage] = ..., + optional_foreign_message: Optional[ForeignMessage] = ..., + optional_import_message: Optional[ImportMessage] = ..., + optional_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., + optional_foreign_enum: Optional[ForeignEnum] = ..., + optional_import_enum: Optional[ImportEnum] = ..., + optional_string_piece: Optional[Text] = ..., + optional_cord: Optional[Text] = ..., + optional_public_import_message: Optional[PublicImportMessage] = ..., + optional_lazy_message: Optional[TestAllTypes.NestedMessage] = ..., + repeated_int32: Optional[Iterable[int]] = ..., + repeated_int64: Optional[Iterable[int]] = ..., + repeated_uint32: Optional[Iterable[int]] = ..., + repeated_uint64: Optional[Iterable[int]] = ..., + repeated_sint32: Optional[Iterable[int]] = ..., + repeated_sint64: Optional[Iterable[int]] = ..., + repeated_fixed32: Optional[Iterable[int]] = ..., + repeated_fixed64: Optional[Iterable[int]] = ..., + repeated_sfixed32: Optional[Iterable[int]] = ..., + repeated_sfixed64: Optional[Iterable[int]] = ..., + repeated_float: Optional[Iterable[float]] = ..., + repeated_double: Optional[Iterable[float]] = ..., + repeated_bool: Optional[Iterable[bool]] = ..., + repeated_string: Optional[Iterable[Text]] = ..., + repeated_bytes: Optional[Iterable[bytes]] = ..., + repeatedgroup: Optional[Iterable[TestAllTypes.RepeatedGroup]] = ..., + repeated_nested_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., + repeated_foreign_message: Optional[Iterable[ForeignMessage]] = ..., + repeated_import_message: Optional[Iterable[ImportMessage]] = ..., + repeated_nested_enum: Optional[Iterable[TestAllTypes.NestedEnum]] = ..., + repeated_foreign_enum: Optional[Iterable[ForeignEnum]] = ..., + repeated_import_enum: Optional[Iterable[ImportEnum]] = ..., + repeated_string_piece: Optional[Iterable[Text]] = ..., + repeated_cord: Optional[Iterable[Text]] = ..., + repeated_lazy_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., + default_int32: Optional[int] = ..., + default_int64: Optional[int] = ..., + default_uint32: Optional[int] = ..., + default_uint64: Optional[int] = ..., + default_sint32: Optional[int] = ..., + default_sint64: Optional[int] = ..., + default_fixed32: Optional[int] = ..., + default_fixed64: Optional[int] = ..., + default_sfixed32: Optional[int] = ..., + default_sfixed64: Optional[int] = ..., + default_float: Optional[float] = ..., + default_double: Optional[float] = ..., + default_bool: Optional[bool] = ..., + default_string: Optional[Text] = ..., + default_bytes: Optional[bytes] = ..., + default_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., + default_foreign_enum: Optional[ForeignEnum] = ..., + default_import_enum: Optional[ImportEnum] = ..., + default_string_piece: Optional[Text] = ..., + default_cord: Optional[Text] = ..., + oneof_uint32: Optional[int] = ..., + oneof_nested_message: Optional[TestAllTypes.NestedMessage] = ..., + oneof_string: Optional[Text] = ..., + oneof_bytes: Optional[bytes] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes: ... - class NestedTestAllTypes(Message): - @property def child(self) -> NestedTestAllTypes: ... - @property def payload(self) -> TestAllTypes: ... - @property - def repeated_child( - self) -> RepeatedCompositeFieldContainer[NestedTestAllTypes]: ... - - def __init__(self, - child: Optional[NestedTestAllTypes] = ..., - payload: Optional[TestAllTypes] = ..., - repeated_child: Optional[Iterable[NestedTestAllTypes]] = ..., - ) -> None: ... - + def repeated_child(self) -> RepeatedCompositeFieldContainer[NestedTestAllTypes]: ... + def __init__( + self, + child: Optional[NestedTestAllTypes] = ..., + payload: Optional[TestAllTypes] = ..., + repeated_child: Optional[Iterable[NestedTestAllTypes]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> NestedTestAllTypes: ... - class TestDeprecatedFields(Message): deprecated_int32: int deprecated_int32_in_oneof: int - - def __init__(self, - deprecated_int32: Optional[int] = ..., - deprecated_int32_in_oneof: Optional[int] = ..., - ) -> None: ... - + def __init__(self, deprecated_int32: Optional[int] = ..., deprecated_int32_in_oneof: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestDeprecatedFields: ... - class TestDeprecatedMessage(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestDeprecatedMessage: ... - class ForeignMessage(Message): c: int d: int - - def __init__(self, - c: Optional[int] = ..., - d: Optional[int] = ..., - ) -> None: ... - + def __init__(self, c: Optional[int] = ..., d: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ForeignMessage: ... - class TestReservedFields(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestReservedFields: ... - class TestAllExtensions(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllExtensions: ... - class OptionalGroup_extension(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> OptionalGroup_extension: ... - class RepeatedGroup_extension(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> RepeatedGroup_extension: ... - class TestGroup(Message): class OptionalGroup(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestGroup.OptionalGroup: ... optional_foreign_enum: ForeignEnum - @property def optionalgroup(self) -> TestGroup.OptionalGroup: ... - - def __init__(self, - optionalgroup: Optional[TestGroup.OptionalGroup] = ..., - optional_foreign_enum: Optional[ForeignEnum] = ..., - ) -> None: ... - + def __init__( + self, optionalgroup: Optional[TestGroup.OptionalGroup] = ..., optional_foreign_enum: Optional[ForeignEnum] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestGroup: ... - class TestGroupExtension(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestGroupExtension: ... - class TestNestedExtension(Message): class OptionalGroup_extension(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestNestedExtension.OptionalGroup_extension: ... - - def __init__(self, - ) -> None: ... - + def FromString(cls, s: bytes) -> TestNestedExtension.OptionalGroup_extension: ... + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedExtension: ... - class TestRequired(Message): a: int dummy2: int @@ -497,343 +379,220 @@ class TestRequired(Message): dummy31: int dummy32: int c: int - - def __init__(self, - a: int, - b: int, - c: int, - dummy2: Optional[int] = ..., - dummy4: Optional[int] = ..., - dummy5: Optional[int] = ..., - dummy6: Optional[int] = ..., - dummy7: Optional[int] = ..., - dummy8: Optional[int] = ..., - dummy9: Optional[int] = ..., - dummy10: Optional[int] = ..., - dummy11: Optional[int] = ..., - dummy12: Optional[int] = ..., - dummy13: Optional[int] = ..., - dummy14: Optional[int] = ..., - dummy15: Optional[int] = ..., - dummy16: Optional[int] = ..., - dummy17: Optional[int] = ..., - dummy18: Optional[int] = ..., - dummy19: Optional[int] = ..., - dummy20: Optional[int] = ..., - dummy21: Optional[int] = ..., - dummy22: Optional[int] = ..., - dummy23: Optional[int] = ..., - dummy24: Optional[int] = ..., - dummy25: Optional[int] = ..., - dummy26: Optional[int] = ..., - dummy27: Optional[int] = ..., - dummy28: Optional[int] = ..., - dummy29: Optional[int] = ..., - dummy30: Optional[int] = ..., - dummy31: Optional[int] = ..., - dummy32: Optional[int] = ..., - ) -> None: ... - + def __init__( + self, + a: int, + b: int, + c: int, + dummy2: Optional[int] = ..., + dummy4: Optional[int] = ..., + dummy5: Optional[int] = ..., + dummy6: Optional[int] = ..., + dummy7: Optional[int] = ..., + dummy8: Optional[int] = ..., + dummy9: Optional[int] = ..., + dummy10: Optional[int] = ..., + dummy11: Optional[int] = ..., + dummy12: Optional[int] = ..., + dummy13: Optional[int] = ..., + dummy14: Optional[int] = ..., + dummy15: Optional[int] = ..., + dummy16: Optional[int] = ..., + dummy17: Optional[int] = ..., + dummy18: Optional[int] = ..., + dummy19: Optional[int] = ..., + dummy20: Optional[int] = ..., + dummy21: Optional[int] = ..., + dummy22: Optional[int] = ..., + dummy23: Optional[int] = ..., + dummy24: Optional[int] = ..., + dummy25: Optional[int] = ..., + dummy26: Optional[int] = ..., + dummy27: Optional[int] = ..., + dummy28: Optional[int] = ..., + dummy29: Optional[int] = ..., + dummy30: Optional[int] = ..., + dummy31: Optional[int] = ..., + dummy32: Optional[int] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRequired: ... - class TestRequiredForeign(Message): dummy: int - @property def optional_message(self) -> TestRequired: ... - @property - def repeated_message( - self) -> RepeatedCompositeFieldContainer[TestRequired]: ... - - def __init__(self, - optional_message: Optional[TestRequired] = ..., - repeated_message: Optional[Iterable[TestRequired]] = ..., - dummy: Optional[int] = ..., - ) -> None: ... - + def repeated_message(self) -> RepeatedCompositeFieldContainer[TestRequired]: ... + def __init__( + self, + optional_message: Optional[TestRequired] = ..., + repeated_message: Optional[Iterable[TestRequired]] = ..., + dummy: Optional[int] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRequiredForeign: ... - class TestRequiredMessage(Message): - @property def optional_message(self) -> TestRequired: ... - @property - def repeated_message( - self) -> RepeatedCompositeFieldContainer[TestRequired]: ... - + def repeated_message(self) -> RepeatedCompositeFieldContainer[TestRequired]: ... @property def required_message(self) -> TestRequired: ... - - def __init__(self, - required_message: TestRequired, - optional_message: Optional[TestRequired] = ..., - repeated_message: Optional[Iterable[TestRequired]] = ..., - ) -> None: ... - + def __init__( + self, + required_message: TestRequired, + optional_message: Optional[TestRequired] = ..., + repeated_message: Optional[Iterable[TestRequired]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRequiredMessage: ... - class TestForeignNested(Message): - @property def foreign_nested(self) -> TestAllTypes.NestedMessage: ... - - def __init__(self, - foreign_nested: Optional[TestAllTypes.NestedMessage] = ..., - ) -> None: ... - + def __init__(self, foreign_nested: Optional[TestAllTypes.NestedMessage] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestForeignNested: ... - class TestEmptyMessage(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEmptyMessage: ... - class TestEmptyMessageWithExtensions(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEmptyMessageWithExtensions: ... - class TestMultipleExtensionRanges(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMultipleExtensionRanges: ... - class TestReallyLargeTagNumber(Message): a: int bb: int - - def __init__(self, - a: Optional[int] = ..., - bb: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ..., bb: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestReallyLargeTagNumber: ... - class TestRecursiveMessage(Message): i: int - @property def a(self) -> TestRecursiveMessage: ... - - def __init__(self, - a: Optional[TestRecursiveMessage] = ..., - i: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[TestRecursiveMessage] = ..., i: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRecursiveMessage: ... - class TestMutualRecursionA(Message): class SubMessage(Message): - @property def b(self) -> TestMutualRecursionB: ... - - def __init__(self, - b: Optional[TestMutualRecursionB] = ..., - ) -> None: ... - + def __init__(self, b: Optional[TestMutualRecursionB] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMutualRecursionA.SubMessage: ... - class SubGroup(Message): - @property def sub_message(self) -> TestMutualRecursionA.SubMessage: ... - @property def not_in_this_scc(self) -> TestAllTypes: ... - - def __init__(self, - sub_message: Optional[TestMutualRecursionA.SubMessage] = ..., - not_in_this_scc: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__( + self, sub_message: Optional[TestMutualRecursionA.SubMessage] = ..., not_in_this_scc: Optional[TestAllTypes] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMutualRecursionA.SubGroup: ... - @property def bb(self) -> TestMutualRecursionB: ... - @property def subgroup(self) -> TestMutualRecursionA.SubGroup: ... - - def __init__(self, - bb: Optional[TestMutualRecursionB] = ..., - subgroup: Optional[TestMutualRecursionA.SubGroup] = ..., - ) -> None: ... - + def __init__( + self, bb: Optional[TestMutualRecursionB] = ..., subgroup: Optional[TestMutualRecursionA.SubGroup] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMutualRecursionA: ... - class TestMutualRecursionB(Message): optional_int32: int - @property def a(self) -> TestMutualRecursionA: ... - - def __init__(self, - a: Optional[TestMutualRecursionA] = ..., - optional_int32: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[TestMutualRecursionA] = ..., optional_int32: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMutualRecursionB: ... - class TestIsInitialized(Message): class SubMessage(Message): class SubGroup(Message): i: int - - def __init__(self, - i: int, - ) -> None: ... - + def __init__(self, i: int) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestIsInitialized.SubMessage.SubGroup: ... - + def FromString(cls, s: bytes) -> TestIsInitialized.SubMessage.SubGroup: ... @property def subgroup(self) -> TestIsInitialized.SubMessage.SubGroup: ... - - def __init__(self, - subgroup: Optional[TestIsInitialized.SubMessage.SubGroup] = ..., - ) -> None: ... - + def __init__(self, subgroup: Optional[TestIsInitialized.SubMessage.SubGroup] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestIsInitialized.SubMessage: ... - @property def sub_message(self) -> TestIsInitialized.SubMessage: ... - - def __init__(self, - sub_message: Optional[TestIsInitialized.SubMessage] = ..., - ) -> None: ... - + def __init__(self, sub_message: Optional[TestIsInitialized.SubMessage] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestIsInitialized: ... - class TestDupFieldNumber(Message): class Foo(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestDupFieldNumber.Foo: ... - class Bar(Message): a: int - - def __init__(self, - a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestDupFieldNumber.Bar: ... a: int - @property def foo(self) -> TestDupFieldNumber.Foo: ... - @property def bar(self) -> TestDupFieldNumber.Bar: ... - - def __init__(self, - a: Optional[int] = ..., - foo: Optional[TestDupFieldNumber.Foo] = ..., - bar: Optional[TestDupFieldNumber.Bar] = ..., - ) -> None: ... - + def __init__( + self, a: Optional[int] = ..., foo: Optional[TestDupFieldNumber.Foo] = ..., bar: Optional[TestDupFieldNumber.Bar] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestDupFieldNumber: ... - class TestEagerMessage(Message): - @property def sub_message(self) -> TestAllTypes: ... - - def __init__(self, - sub_message: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__(self, sub_message: Optional[TestAllTypes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEagerMessage: ... - class TestLazyMessage(Message): - @property def sub_message(self) -> TestAllTypes: ... - - def __init__(self, - sub_message: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__(self, sub_message: Optional[TestAllTypes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestLazyMessage: ... - class TestNestedMessageHasBits(Message): class NestedMessage(Message): nestedmessage_repeated_int32: RepeatedScalarFieldContainer[int] - @property - def nestedmessage_repeated_foreignmessage( - self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... - - def __init__(self, - nestedmessage_repeated_int32: Optional[Iterable[int]] = ..., - nestedmessage_repeated_foreignmessage: Optional[Iterable[ForeignMessage]] = ..., - ) -> None: ... - + def nestedmessage_repeated_foreignmessage(self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... + def __init__( + self, + nestedmessage_repeated_int32: Optional[Iterable[int]] = ..., + nestedmessage_repeated_foreignmessage: Optional[Iterable[ForeignMessage]] = ..., + ) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestNestedMessageHasBits.NestedMessage: ... - + def FromString(cls, s: bytes) -> TestNestedMessageHasBits.NestedMessage: ... @property - def optional_nested_message( - self) -> TestNestedMessageHasBits.NestedMessage: ... - - def __init__(self, - optional_nested_message: Optional[TestNestedMessageHasBits.NestedMessage] = ..., - ) -> None: ... - + def optional_nested_message(self) -> TestNestedMessageHasBits.NestedMessage: ... + def __init__(self, optional_nested_message: Optional[TestNestedMessageHasBits.NestedMessage] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMessageHasBits: ... - class TestCamelCaseFieldNames(Message): PrimitiveField: int StringField: Text @@ -845,95 +604,67 @@ class TestCamelCaseFieldNames(Message): RepeatedEnumField: RepeatedScalarFieldContainer[ForeignEnum] RepeatedStringPieceField: RepeatedScalarFieldContainer[Text] RepeatedCordField: RepeatedScalarFieldContainer[Text] - @property def MessageField(self) -> ForeignMessage: ... - @property - def RepeatedMessageField( - self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... - - def __init__(self, - PrimitiveField: Optional[int] = ..., - StringField: Optional[Text] = ..., - EnumField: Optional[ForeignEnum] = ..., - MessageField: Optional[ForeignMessage] = ..., - StringPieceField: Optional[Text] = ..., - CordField: Optional[Text] = ..., - RepeatedPrimitiveField: Optional[Iterable[int]] = ..., - RepeatedStringField: Optional[Iterable[Text]] = ..., - RepeatedEnumField: Optional[Iterable[ForeignEnum]] = ..., - RepeatedMessageField: Optional[Iterable[ForeignMessage]] = ..., - RepeatedStringPieceField: Optional[Iterable[Text]] = ..., - RepeatedCordField: Optional[Iterable[Text]] = ..., - ) -> None: ... - + def RepeatedMessageField(self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... + def __init__( + self, + PrimitiveField: Optional[int] = ..., + StringField: Optional[Text] = ..., + EnumField: Optional[ForeignEnum] = ..., + MessageField: Optional[ForeignMessage] = ..., + StringPieceField: Optional[Text] = ..., + CordField: Optional[Text] = ..., + RepeatedPrimitiveField: Optional[Iterable[int]] = ..., + RepeatedStringField: Optional[Iterable[Text]] = ..., + RepeatedEnumField: Optional[Iterable[ForeignEnum]] = ..., + RepeatedMessageField: Optional[Iterable[ForeignMessage]] = ..., + RepeatedStringPieceField: Optional[Iterable[Text]] = ..., + RepeatedCordField: Optional[Iterable[Text]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestCamelCaseFieldNames: ... - class TestFieldOrderings(Message): class NestedMessage(Message): oo: int bb: int - - def __init__(self, - oo: Optional[int] = ..., - bb: Optional[int] = ..., - ) -> None: ... - + def __init__(self, oo: Optional[int] = ..., bb: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestFieldOrderings.NestedMessage: ... my_string: Text my_int: int my_float: float - @property def optional_nested_message(self) -> TestFieldOrderings.NestedMessage: ... - - def __init__(self, - my_string: Optional[Text] = ..., - my_int: Optional[int] = ..., - my_float: Optional[float] = ..., - optional_nested_message: Optional[TestFieldOrderings.NestedMessage] = ..., - ) -> None: ... - + def __init__( + self, + my_string: Optional[Text] = ..., + my_int: Optional[int] = ..., + my_float: Optional[float] = ..., + optional_nested_message: Optional[TestFieldOrderings.NestedMessage] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestFieldOrderings: ... - class TestExtensionOrderings1(Message): my_string: Text - - def __init__(self, - my_string: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, my_string: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestExtensionOrderings1: ... - class TestExtensionOrderings2(Message): class TestExtensionOrderings3(Message): my_string: Text - - def __init__(self, - my_string: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, my_string: Optional[Text] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestExtensionOrderings2.TestExtensionOrderings3: ... + def FromString(cls, s: bytes) -> TestExtensionOrderings2.TestExtensionOrderings3: ... my_string: Text - - def __init__(self, - my_string: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, my_string: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestExtensionOrderings2: ... - class TestExtremeDefaultValues(Message): escaped_bytes: bytes large_uint32: int @@ -962,257 +693,170 @@ class TestExtremeDefaultValues(Message): string_piece_with_zero: Text cord_with_zero: Text replacement_string: Text - - def __init__(self, - escaped_bytes: Optional[bytes] = ..., - large_uint32: Optional[int] = ..., - large_uint64: Optional[int] = ..., - small_int32: Optional[int] = ..., - small_int64: Optional[int] = ..., - really_small_int32: Optional[int] = ..., - really_small_int64: Optional[int] = ..., - utf8_string: Optional[Text] = ..., - zero_float: Optional[float] = ..., - one_float: Optional[float] = ..., - small_float: Optional[float] = ..., - negative_one_float: Optional[float] = ..., - negative_float: Optional[float] = ..., - large_float: Optional[float] = ..., - small_negative_float: Optional[float] = ..., - inf_double: Optional[float] = ..., - neg_inf_double: Optional[float] = ..., - nan_double: Optional[float] = ..., - inf_float: Optional[float] = ..., - neg_inf_float: Optional[float] = ..., - nan_float: Optional[float] = ..., - cpp_trigraph: Optional[Text] = ..., - string_with_zero: Optional[Text] = ..., - bytes_with_zero: Optional[bytes] = ..., - string_piece_with_zero: Optional[Text] = ..., - cord_with_zero: Optional[Text] = ..., - replacement_string: Optional[Text] = ..., - ) -> None: ... - + def __init__( + self, + escaped_bytes: Optional[bytes] = ..., + large_uint32: Optional[int] = ..., + large_uint64: Optional[int] = ..., + small_int32: Optional[int] = ..., + small_int64: Optional[int] = ..., + really_small_int32: Optional[int] = ..., + really_small_int64: Optional[int] = ..., + utf8_string: Optional[Text] = ..., + zero_float: Optional[float] = ..., + one_float: Optional[float] = ..., + small_float: Optional[float] = ..., + negative_one_float: Optional[float] = ..., + negative_float: Optional[float] = ..., + large_float: Optional[float] = ..., + small_negative_float: Optional[float] = ..., + inf_double: Optional[float] = ..., + neg_inf_double: Optional[float] = ..., + nan_double: Optional[float] = ..., + inf_float: Optional[float] = ..., + neg_inf_float: Optional[float] = ..., + nan_float: Optional[float] = ..., + cpp_trigraph: Optional[Text] = ..., + string_with_zero: Optional[Text] = ..., + bytes_with_zero: Optional[bytes] = ..., + string_piece_with_zero: Optional[Text] = ..., + cord_with_zero: Optional[Text] = ..., + replacement_string: Optional[Text] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestExtremeDefaultValues: ... - class SparseEnumMessage(Message): sparse_enum: TestSparseEnum - - def __init__(self, - sparse_enum: Optional[TestSparseEnum] = ..., - ) -> None: ... - + def __init__(self, sparse_enum: Optional[TestSparseEnum] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> SparseEnumMessage: ... - class OneString(Message): data: Text - - def __init__(self, - data: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, data: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> OneString: ... - class MoreString(Message): data: RepeatedScalarFieldContainer[Text] - - def __init__(self, - data: Optional[Iterable[Text]] = ..., - ) -> None: ... - + def __init__(self, data: Optional[Iterable[Text]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> MoreString: ... - class OneBytes(Message): data: bytes - - def __init__(self, - data: Optional[bytes] = ..., - ) -> None: ... - + def __init__(self, data: Optional[bytes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> OneBytes: ... - class MoreBytes(Message): data: RepeatedScalarFieldContainer[bytes] - - def __init__(self, - data: Optional[Iterable[bytes]] = ..., - ) -> None: ... - + def __init__(self, data: Optional[Iterable[bytes]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> MoreBytes: ... - class Int32Message(Message): data: int - - def __init__(self, - data: Optional[int] = ..., - ) -> None: ... - + def __init__(self, data: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Int32Message: ... - class Uint32Message(Message): data: int - - def __init__(self, - data: Optional[int] = ..., - ) -> None: ... - + def __init__(self, data: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Uint32Message: ... - class Int64Message(Message): data: int - - def __init__(self, - data: Optional[int] = ..., - ) -> None: ... - + def __init__(self, data: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Int64Message: ... - class Uint64Message(Message): data: int - - def __init__(self, - data: Optional[int] = ..., - ) -> None: ... - + def __init__(self, data: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Uint64Message: ... - class BoolMessage(Message): data: bool - - def __init__(self, - data: Optional[bool] = ..., - ) -> None: ... - + def __init__(self, data: Optional[bool] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> BoolMessage: ... - class TestOneof(Message): class FooGroup(Message): a: int b: Text - - def __init__(self, - a: Optional[int] = ..., - b: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ..., b: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestOneof.FooGroup: ... foo_int: int foo_string: Text - @property def foo_message(self) -> TestAllTypes: ... - @property def foogroup(self) -> TestOneof.FooGroup: ... - - def __init__(self, - foo_int: Optional[int] = ..., - foo_string: Optional[Text] = ..., - foo_message: Optional[TestAllTypes] = ..., - foogroup: Optional[TestOneof.FooGroup] = ..., - ) -> None: ... - + def __init__( + self, + foo_int: Optional[int] = ..., + foo_string: Optional[Text] = ..., + foo_message: Optional[TestAllTypes] = ..., + foogroup: Optional[TestOneof.FooGroup] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestOneof: ... - class TestOneofBackwardsCompatible(Message): class FooGroup(Message): a: int b: Text - - def __init__(self, - a: Optional[int] = ..., - b: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ..., b: Optional[Text] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestOneofBackwardsCompatible.FooGroup: ... + def FromString(cls, s: bytes) -> TestOneofBackwardsCompatible.FooGroup: ... foo_int: int foo_string: Text - @property def foo_message(self) -> TestAllTypes: ... - @property def foogroup(self) -> TestOneofBackwardsCompatible.FooGroup: ... - - def __init__(self, - foo_int: Optional[int] = ..., - foo_string: Optional[Text] = ..., - foo_message: Optional[TestAllTypes] = ..., - foogroup: Optional[TestOneofBackwardsCompatible.FooGroup] = ..., - ) -> None: ... - + def __init__( + self, + foo_int: Optional[int] = ..., + foo_string: Optional[Text] = ..., + foo_message: Optional[TestAllTypes] = ..., + foogroup: Optional[TestOneofBackwardsCompatible.FooGroup] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestOneofBackwardsCompatible: ... - class TestOneof2(Message): class NestedEnum(int): @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestOneof2.NestedEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestOneof2.NestedEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestOneof2.NestedEnum]]: ... FOO: TestOneof2.NestedEnum BAR: TestOneof2.NestedEnum BAZ: TestOneof2.NestedEnum - class FooGroup(Message): a: int b: Text - - def __init__(self, - a: Optional[int] = ..., - b: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, a: Optional[int] = ..., b: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestOneof2.FooGroup: ... - class NestedMessage(Message): qux_int: int corge_int: RepeatedScalarFieldContainer[int] - - def __init__(self, - qux_int: Optional[int] = ..., - corge_int: Optional[Iterable[int]] = ..., - ) -> None: ... - + def __init__(self, qux_int: Optional[int] = ..., corge_int: Optional[Iterable[int]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestOneof2.NestedMessage: ... foo_int: int @@ -1229,66 +873,54 @@ class TestOneof2(Message): bar_enum: TestOneof2.NestedEnum baz_int: int baz_string: Text - @property def foo_message(self) -> TestOneof2.NestedMessage: ... - @property def foogroup(self) -> TestOneof2.FooGroup: ... - @property def foo_lazy_message(self) -> TestOneof2.NestedMessage: ... - - def __init__(self, - foo_int: Optional[int] = ..., - foo_string: Optional[Text] = ..., - foo_cord: Optional[Text] = ..., - foo_string_piece: Optional[Text] = ..., - foo_bytes: Optional[bytes] = ..., - foo_enum: Optional[TestOneof2.NestedEnum] = ..., - foo_message: Optional[TestOneof2.NestedMessage] = ..., - foogroup: Optional[TestOneof2.FooGroup] = ..., - foo_lazy_message: Optional[TestOneof2.NestedMessage] = ..., - bar_int: Optional[int] = ..., - bar_string: Optional[Text] = ..., - bar_cord: Optional[Text] = ..., - bar_string_piece: Optional[Text] = ..., - bar_bytes: Optional[bytes] = ..., - bar_enum: Optional[TestOneof2.NestedEnum] = ..., - baz_int: Optional[int] = ..., - baz_string: Optional[Text] = ..., - ) -> None: ... - + def __init__( + self, + foo_int: Optional[int] = ..., + foo_string: Optional[Text] = ..., + foo_cord: Optional[Text] = ..., + foo_string_piece: Optional[Text] = ..., + foo_bytes: Optional[bytes] = ..., + foo_enum: Optional[TestOneof2.NestedEnum] = ..., + foo_message: Optional[TestOneof2.NestedMessage] = ..., + foogroup: Optional[TestOneof2.FooGroup] = ..., + foo_lazy_message: Optional[TestOneof2.NestedMessage] = ..., + bar_int: Optional[int] = ..., + bar_string: Optional[Text] = ..., + bar_cord: Optional[Text] = ..., + bar_string_piece: Optional[Text] = ..., + bar_bytes: Optional[bytes] = ..., + bar_enum: Optional[TestOneof2.NestedEnum] = ..., + baz_int: Optional[int] = ..., + baz_string: Optional[Text] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestOneof2: ... - class TestRequiredOneof(Message): class NestedMessage(Message): required_double: float - - def __init__(self, - required_double: float, - ) -> None: ... - + def __init__(self, required_double: float) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRequiredOneof.NestedMessage: ... foo_int: int foo_string: Text - @property def foo_message(self) -> TestRequiredOneof.NestedMessage: ... - - def __init__(self, - foo_int: Optional[int] = ..., - foo_string: Optional[Text] = ..., - foo_message: Optional[TestRequiredOneof.NestedMessage] = ..., - ) -> None: ... - + def __init__( + self, + foo_int: Optional[int] = ..., + foo_string: Optional[Text] = ..., + foo_message: Optional[TestRequiredOneof.NestedMessage] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRequiredOneof: ... - class TestPackedTypes(Message): packed_int32: RepeatedScalarFieldContainer[int] packed_int64: RepeatedScalarFieldContainer[int] @@ -1304,28 +936,26 @@ class TestPackedTypes(Message): packed_double: RepeatedScalarFieldContainer[float] packed_bool: RepeatedScalarFieldContainer[bool] packed_enum: RepeatedScalarFieldContainer[ForeignEnum] - - def __init__(self, - packed_int32: Optional[Iterable[int]] = ..., - packed_int64: Optional[Iterable[int]] = ..., - packed_uint32: Optional[Iterable[int]] = ..., - packed_uint64: Optional[Iterable[int]] = ..., - packed_sint32: Optional[Iterable[int]] = ..., - packed_sint64: Optional[Iterable[int]] = ..., - packed_fixed32: Optional[Iterable[int]] = ..., - packed_fixed64: Optional[Iterable[int]] = ..., - packed_sfixed32: Optional[Iterable[int]] = ..., - packed_sfixed64: Optional[Iterable[int]] = ..., - packed_float: Optional[Iterable[float]] = ..., - packed_double: Optional[Iterable[float]] = ..., - packed_bool: Optional[Iterable[bool]] = ..., - packed_enum: Optional[Iterable[ForeignEnum]] = ..., - ) -> None: ... - + def __init__( + self, + packed_int32: Optional[Iterable[int]] = ..., + packed_int64: Optional[Iterable[int]] = ..., + packed_uint32: Optional[Iterable[int]] = ..., + packed_uint64: Optional[Iterable[int]] = ..., + packed_sint32: Optional[Iterable[int]] = ..., + packed_sint64: Optional[Iterable[int]] = ..., + packed_fixed32: Optional[Iterable[int]] = ..., + packed_fixed64: Optional[Iterable[int]] = ..., + packed_sfixed32: Optional[Iterable[int]] = ..., + packed_sfixed64: Optional[Iterable[int]] = ..., + packed_float: Optional[Iterable[float]] = ..., + packed_double: Optional[Iterable[float]] = ..., + packed_bool: Optional[Iterable[bool]] = ..., + packed_enum: Optional[Iterable[ForeignEnum]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestPackedTypes: ... - class TestUnpackedTypes(Message): unpacked_int32: RepeatedScalarFieldContainer[int] unpacked_int64: RepeatedScalarFieldContainer[int] @@ -1341,104 +971,78 @@ class TestUnpackedTypes(Message): unpacked_double: RepeatedScalarFieldContainer[float] unpacked_bool: RepeatedScalarFieldContainer[bool] unpacked_enum: RepeatedScalarFieldContainer[ForeignEnum] - - def __init__(self, - unpacked_int32: Optional[Iterable[int]] = ..., - unpacked_int64: Optional[Iterable[int]] = ..., - unpacked_uint32: Optional[Iterable[int]] = ..., - unpacked_uint64: Optional[Iterable[int]] = ..., - unpacked_sint32: Optional[Iterable[int]] = ..., - unpacked_sint64: Optional[Iterable[int]] = ..., - unpacked_fixed32: Optional[Iterable[int]] = ..., - unpacked_fixed64: Optional[Iterable[int]] = ..., - unpacked_sfixed32: Optional[Iterable[int]] = ..., - unpacked_sfixed64: Optional[Iterable[int]] = ..., - unpacked_float: Optional[Iterable[float]] = ..., - unpacked_double: Optional[Iterable[float]] = ..., - unpacked_bool: Optional[Iterable[bool]] = ..., - unpacked_enum: Optional[Iterable[ForeignEnum]] = ..., - ) -> None: ... - + def __init__( + self, + unpacked_int32: Optional[Iterable[int]] = ..., + unpacked_int64: Optional[Iterable[int]] = ..., + unpacked_uint32: Optional[Iterable[int]] = ..., + unpacked_uint64: Optional[Iterable[int]] = ..., + unpacked_sint32: Optional[Iterable[int]] = ..., + unpacked_sint64: Optional[Iterable[int]] = ..., + unpacked_fixed32: Optional[Iterable[int]] = ..., + unpacked_fixed64: Optional[Iterable[int]] = ..., + unpacked_sfixed32: Optional[Iterable[int]] = ..., + unpacked_sfixed64: Optional[Iterable[int]] = ..., + unpacked_float: Optional[Iterable[float]] = ..., + unpacked_double: Optional[Iterable[float]] = ..., + unpacked_bool: Optional[Iterable[bool]] = ..., + unpacked_enum: Optional[Iterable[ForeignEnum]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestUnpackedTypes: ... - class TestPackedExtensions(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestPackedExtensions: ... - class TestUnpackedExtensions(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestUnpackedExtensions: ... - class TestDynamicExtensions(Message): class DynamicEnumType(int): @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestDynamicExtensions.DynamicEnumType: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestDynamicExtensions.DynamicEnumType]: ... - @classmethod - def items(cls) -> List[Tuple[bytes, - TestDynamicExtensions.DynamicEnumType]]: ... + def items(cls) -> List[Tuple[bytes, TestDynamicExtensions.DynamicEnumType]]: ... DYNAMIC_FOO: TestDynamicExtensions.DynamicEnumType DYNAMIC_BAR: TestDynamicExtensions.DynamicEnumType DYNAMIC_BAZ: TestDynamicExtensions.DynamicEnumType - class DynamicMessageType(Message): dynamic_field: int - - def __init__(self, - dynamic_field: Optional[int] = ..., - ) -> None: ... - + def __init__(self, dynamic_field: Optional[int] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestDynamicExtensions.DynamicMessageType: ... + def FromString(cls, s: bytes) -> TestDynamicExtensions.DynamicMessageType: ... scalar_extension: int enum_extension: ForeignEnum dynamic_enum_extension: TestDynamicExtensions.DynamicEnumType repeated_extension: RepeatedScalarFieldContainer[Text] packed_extension: RepeatedScalarFieldContainer[int] - @property def message_extension(self) -> ForeignMessage: ... - @property - def dynamic_message_extension( - self) -> TestDynamicExtensions.DynamicMessageType: ... - - def __init__(self, - scalar_extension: Optional[int] = ..., - enum_extension: Optional[ForeignEnum] = ..., - dynamic_enum_extension: Optional[TestDynamicExtensions.DynamicEnumType] = ..., - message_extension: Optional[ForeignMessage] = ..., - dynamic_message_extension: Optional[TestDynamicExtensions.DynamicMessageType] = ..., - repeated_extension: Optional[Iterable[Text]] = ..., - packed_extension: Optional[Iterable[int]] = ..., - ) -> None: ... - + def dynamic_message_extension(self) -> TestDynamicExtensions.DynamicMessageType: ... + def __init__( + self, + scalar_extension: Optional[int] = ..., + enum_extension: Optional[ForeignEnum] = ..., + dynamic_enum_extension: Optional[TestDynamicExtensions.DynamicEnumType] = ..., + message_extension: Optional[ForeignMessage] = ..., + dynamic_message_extension: Optional[TestDynamicExtensions.DynamicMessageType] = ..., + repeated_extension: Optional[Iterable[Text]] = ..., + packed_extension: Optional[Iterable[int]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestDynamicExtensions: ... - class TestRepeatedScalarDifferentTagSizes(Message): repeated_fixed32: RepeatedScalarFieldContainer[int] repeated_int32: RepeatedScalarFieldContainer[int] @@ -1446,203 +1050,127 @@ class TestRepeatedScalarDifferentTagSizes(Message): repeated_int64: RepeatedScalarFieldContainer[int] repeated_float: RepeatedScalarFieldContainer[float] repeated_uint64: RepeatedScalarFieldContainer[int] - - def __init__(self, - repeated_fixed32: Optional[Iterable[int]] = ..., - repeated_int32: Optional[Iterable[int]] = ..., - repeated_fixed64: Optional[Iterable[int]] = ..., - repeated_int64: Optional[Iterable[int]] = ..., - repeated_float: Optional[Iterable[float]] = ..., - repeated_uint64: Optional[Iterable[int]] = ..., - ) -> None: ... - + def __init__( + self, + repeated_fixed32: Optional[Iterable[int]] = ..., + repeated_int32: Optional[Iterable[int]] = ..., + repeated_fixed64: Optional[Iterable[int]] = ..., + repeated_int64: Optional[Iterable[int]] = ..., + repeated_float: Optional[Iterable[float]] = ..., + repeated_uint64: Optional[Iterable[int]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestRepeatedScalarDifferentTagSizes: ... - class TestParsingMerge(Message): class RepeatedFieldsGenerator(Message): class Group1(Message): - @property def field1(self) -> TestAllTypes: ... - - def __init__(self, - field1: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__(self, field1: Optional[TestAllTypes] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestParsingMerge.RepeatedFieldsGenerator.Group1: ... - + def FromString(cls, s: bytes) -> TestParsingMerge.RepeatedFieldsGenerator.Group1: ... class Group2(Message): - @property def field1(self) -> TestAllTypes: ... - - def __init__(self, - field1: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__(self, field1: Optional[TestAllTypes] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestParsingMerge.RepeatedFieldsGenerator.Group2: ... - + def FromString(cls, s: bytes) -> TestParsingMerge.RepeatedFieldsGenerator.Group2: ... @property def field1(self) -> RepeatedCompositeFieldContainer[TestAllTypes]: ... - @property def field2(self) -> RepeatedCompositeFieldContainer[TestAllTypes]: ... - @property def field3(self) -> RepeatedCompositeFieldContainer[TestAllTypes]: ... - @property - def group1( - self) -> RepeatedCompositeFieldContainer[TestParsingMerge.RepeatedFieldsGenerator.Group1]: ... - + def group1(self) -> RepeatedCompositeFieldContainer[TestParsingMerge.RepeatedFieldsGenerator.Group1]: ... @property - def group2( - self) -> RepeatedCompositeFieldContainer[TestParsingMerge.RepeatedFieldsGenerator.Group2]: ... - + def group2(self) -> RepeatedCompositeFieldContainer[TestParsingMerge.RepeatedFieldsGenerator.Group2]: ... @property def ext1(self) -> RepeatedCompositeFieldContainer[TestAllTypes]: ... - @property def ext2(self) -> RepeatedCompositeFieldContainer[TestAllTypes]: ... - - def __init__(self, - field1: Optional[Iterable[TestAllTypes]] = ..., - field2: Optional[Iterable[TestAllTypes]] = ..., - field3: Optional[Iterable[TestAllTypes]] = ..., - group1: Optional[Iterable[TestParsingMerge.RepeatedFieldsGenerator.Group1]] = ..., - group2: Optional[Iterable[TestParsingMerge.RepeatedFieldsGenerator.Group2]] = ..., - ext1: Optional[Iterable[TestAllTypes]] = ..., - ext2: Optional[Iterable[TestAllTypes]] = ..., - ) -> None: ... - + def __init__( + self, + field1: Optional[Iterable[TestAllTypes]] = ..., + field2: Optional[Iterable[TestAllTypes]] = ..., + field3: Optional[Iterable[TestAllTypes]] = ..., + group1: Optional[Iterable[TestParsingMerge.RepeatedFieldsGenerator.Group1]] = ..., + group2: Optional[Iterable[TestParsingMerge.RepeatedFieldsGenerator.Group2]] = ..., + ext1: Optional[Iterable[TestAllTypes]] = ..., + ext2: Optional[Iterable[TestAllTypes]] = ..., + ) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestParsingMerge.RepeatedFieldsGenerator: ... - + def FromString(cls, s: bytes) -> TestParsingMerge.RepeatedFieldsGenerator: ... class OptionalGroup(Message): - @property def optional_group_all_types(self) -> TestAllTypes: ... - - def __init__(self, - optional_group_all_types: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__(self, optional_group_all_types: Optional[TestAllTypes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestParsingMerge.OptionalGroup: ... - class RepeatedGroup(Message): - @property def repeated_group_all_types(self) -> TestAllTypes: ... - - def __init__(self, - repeated_group_all_types: Optional[TestAllTypes] = ..., - ) -> None: ... - + def __init__(self, repeated_group_all_types: Optional[TestAllTypes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestParsingMerge.RepeatedGroup: ... - @property def required_all_types(self) -> TestAllTypes: ... - @property def optional_all_types(self) -> TestAllTypes: ... - @property - def repeated_all_types( - self) -> RepeatedCompositeFieldContainer[TestAllTypes]: ... - + def repeated_all_types(self) -> RepeatedCompositeFieldContainer[TestAllTypes]: ... @property def optionalgroup(self) -> TestParsingMerge.OptionalGroup: ... - @property - def repeatedgroup( - self) -> RepeatedCompositeFieldContainer[TestParsingMerge.RepeatedGroup]: ... - - def __init__(self, - required_all_types: TestAllTypes, - optional_all_types: Optional[TestAllTypes] = ..., - repeated_all_types: Optional[Iterable[TestAllTypes]] = ..., - optionalgroup: Optional[TestParsingMerge.OptionalGroup] = ..., - repeatedgroup: Optional[Iterable[TestParsingMerge.RepeatedGroup]] = ..., - ) -> None: ... - + def repeatedgroup(self) -> RepeatedCompositeFieldContainer[TestParsingMerge.RepeatedGroup]: ... + def __init__( + self, + required_all_types: TestAllTypes, + optional_all_types: Optional[TestAllTypes] = ..., + repeated_all_types: Optional[Iterable[TestAllTypes]] = ..., + optionalgroup: Optional[TestParsingMerge.OptionalGroup] = ..., + repeatedgroup: Optional[Iterable[TestParsingMerge.RepeatedGroup]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestParsingMerge: ... - class TestCommentInjectionMessage(Message): a: Text - - def __init__(self, - a: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, a: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestCommentInjectionMessage: ... - class FooRequest(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> FooRequest: ... - class FooResponse(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> FooResponse: ... - class FooClientMessage(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> FooClientMessage: ... - class FooServerMessage(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> FooServerMessage: ... - class BarRequest(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> BarRequest: ... - class BarResponse(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> BarResponse: ... - class TestJsonName(Message): field_name1: int fieldName2: int @@ -1650,43 +1178,30 @@ class TestJsonName(Message): _field_name4: int FIELD_NAME5: int field_name6: int - - def __init__(self, - field_name1: Optional[int] = ..., - fieldName2: Optional[int] = ..., - FieldName3: Optional[int] = ..., - _field_name4: Optional[int] = ..., - FIELD_NAME5: Optional[int] = ..., - field_name6: Optional[int] = ..., - ) -> None: ... - + def __init__( + self, + field_name1: Optional[int] = ..., + fieldName2: Optional[int] = ..., + FieldName3: Optional[int] = ..., + _field_name4: Optional[int] = ..., + FIELD_NAME5: Optional[int] = ..., + field_name6: Optional[int] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestJsonName: ... - class TestHugeFieldNumbers(Message): class OptionalGroup(Message): group_a: int - - def __init__(self, - group_a: Optional[int] = ..., - ) -> None: ... - + def __init__(self, group_a: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestHugeFieldNumbers.OptionalGroup: ... - class StringStringMapEntry(Message): key: Text value: Text - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[Text] = ...) -> None: ... @classmethod - def FromString( - cls, s: bytes) -> TestHugeFieldNumbers.StringStringMapEntry: ... + def FromString(cls, s: bytes) -> TestHugeFieldNumbers.StringStringMapEntry: ... optional_int32: int fixed_32: int repeated_int32: RepeatedScalarFieldContainer[int] @@ -1697,40 +1212,34 @@ class TestHugeFieldNumbers(Message): oneof_uint32: int oneof_string: Text oneof_bytes: bytes - @property def optional_message(self) -> ForeignMessage: ... - @property def optionalgroup(self) -> TestHugeFieldNumbers.OptionalGroup: ... - @property def string_string_map(self) -> MutableMapping[Text, Text]: ... - @property def oneof_test_all_types(self) -> TestAllTypes: ... - - def __init__(self, - optional_int32: Optional[int] = ..., - fixed_32: Optional[int] = ..., - repeated_int32: Optional[Iterable[int]] = ..., - packed_int32: Optional[Iterable[int]] = ..., - optional_enum: Optional[ForeignEnum] = ..., - optional_string: Optional[Text] = ..., - optional_bytes: Optional[bytes] = ..., - optional_message: Optional[ForeignMessage] = ..., - optionalgroup: Optional[TestHugeFieldNumbers.OptionalGroup] = ..., - string_string_map: Optional[Mapping[Text, Text]] = ..., - oneof_uint32: Optional[int] = ..., - oneof_test_all_types: Optional[TestAllTypes] = ..., - oneof_string: Optional[Text] = ..., - oneof_bytes: Optional[bytes] = ..., - ) -> None: ... - + def __init__( + self, + optional_int32: Optional[int] = ..., + fixed_32: Optional[int] = ..., + repeated_int32: Optional[Iterable[int]] = ..., + packed_int32: Optional[Iterable[int]] = ..., + optional_enum: Optional[ForeignEnum] = ..., + optional_string: Optional[Text] = ..., + optional_bytes: Optional[bytes] = ..., + optional_message: Optional[ForeignMessage] = ..., + optionalgroup: Optional[TestHugeFieldNumbers.OptionalGroup] = ..., + string_string_map: Optional[Mapping[Text, Text]] = ..., + oneof_uint32: Optional[int] = ..., + oneof_test_all_types: Optional[TestAllTypes] = ..., + oneof_string: Optional[Text] = ..., + oneof_bytes: Optional[bytes] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestHugeFieldNumbers: ... - class TestExtensionInsideTable(Message): field1: int field2: int @@ -1741,18 +1250,17 @@ class TestExtensionInsideTable(Message): field8: int field9: int field10: int - - def __init__(self, - field1: Optional[int] = ..., - field2: Optional[int] = ..., - field3: Optional[int] = ..., - field4: Optional[int] = ..., - field6: Optional[int] = ..., - field7: Optional[int] = ..., - field8: Optional[int] = ..., - field9: Optional[int] = ..., - field10: Optional[int] = ..., - ) -> None: ... - + def __init__( + self, + field1: Optional[int] = ..., + field2: Optional[int] = ..., + field3: Optional[int] = ..., + field4: Optional[int] = ..., + field6: Optional[int] = ..., + field7: Optional[int] = ..., + field8: Optional[int] = ..., + field9: Optional[int] = ..., + field10: Optional[int] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestExtensionInsideTable: ... diff --git a/third_party/2and3/google/protobuf/unittest_proto3_arena_pb2.pyi b/third_party/2and3/google/protobuf/unittest_proto3_arena_pb2.pyi index 3c6057eaf38a..3a005d2bef5c 100644 --- a/third_party/2and3/google/protobuf/unittest_proto3_arena_pb2.pyi +++ b/third_party/2and3/google/protobuf/unittest_proto3_arena_pb2.pyi @@ -6,45 +6,32 @@ from google.protobuf.unittest_import_pb2 import ImportMessage from google.protobuf.unittest_import_public_pb2 import PublicImportMessage class ForeignEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> ForeignEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[ForeignEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, ForeignEnum]]: ... - FOREIGN_ZERO: ForeignEnum FOREIGN_FOO: ForeignEnum FOREIGN_BAR: ForeignEnum FOREIGN_BAZ: ForeignEnum - class TestAllTypes(Message): - class NestedEnum(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> TestAllTypes.NestedEnum: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[TestAllTypes.NestedEnum]: ... - @classmethod def items(cls) -> List[Tuple[bytes, TestAllTypes.NestedEnum]]: ... ZERO: TestAllTypes.NestedEnum @@ -52,14 +39,9 @@ class TestAllTypes(Message): BAR: TestAllTypes.NestedEnum BAZ: TestAllTypes.NestedEnum NEG: TestAllTypes.NestedEnum - class NestedMessage(Message): bb: int - - def __init__(self, - bb: Optional[int] = ..., - ) -> None: ... - + def __init__(self, bb: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes.NestedMessage: ... optional_int32: int @@ -103,103 +85,86 @@ class TestAllTypes(Message): oneof_uint32: int oneof_string: Text oneof_bytes: bytes - @property def optional_nested_message(self) -> TestAllTypes.NestedMessage: ... - @property def optional_foreign_message(self) -> ForeignMessage: ... - @property def optional_import_message(self) -> ImportMessage: ... - @property def optional_public_import_message(self) -> PublicImportMessage: ... - @property def optional_lazy_message(self) -> TestAllTypes.NestedMessage: ... - @property def optional_lazy_import_message(self) -> ImportMessage: ... - @property - def repeated_nested_message( - self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... - + def repeated_nested_message(self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... @property - def repeated_foreign_message( - self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... - + def repeated_foreign_message(self) -> RepeatedCompositeFieldContainer[ForeignMessage]: ... @property - def repeated_import_message( - self) -> RepeatedCompositeFieldContainer[ImportMessage]: ... - + def repeated_import_message(self) -> RepeatedCompositeFieldContainer[ImportMessage]: ... @property - def repeated_lazy_message( - self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... - + def repeated_lazy_message(self) -> RepeatedCompositeFieldContainer[TestAllTypes.NestedMessage]: ... @property def oneof_nested_message(self) -> TestAllTypes.NestedMessage: ... - - def __init__(self, - optional_int32: Optional[int] = ..., - optional_int64: Optional[int] = ..., - optional_uint32: Optional[int] = ..., - optional_uint64: Optional[int] = ..., - optional_sint32: Optional[int] = ..., - optional_sint64: Optional[int] = ..., - optional_fixed32: Optional[int] = ..., - optional_fixed64: Optional[int] = ..., - optional_sfixed32: Optional[int] = ..., - optional_sfixed64: Optional[int] = ..., - optional_float: Optional[float] = ..., - optional_double: Optional[float] = ..., - optional_bool: Optional[bool] = ..., - optional_string: Optional[Text] = ..., - optional_bytes: Optional[bytes] = ..., - optional_nested_message: Optional[TestAllTypes.NestedMessage] = ..., - optional_foreign_message: Optional[ForeignMessage] = ..., - optional_import_message: Optional[ImportMessage] = ..., - optional_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., - optional_foreign_enum: Optional[ForeignEnum] = ..., - optional_string_piece: Optional[Text] = ..., - optional_cord: Optional[Text] = ..., - optional_public_import_message: Optional[PublicImportMessage] = ..., - optional_lazy_message: Optional[TestAllTypes.NestedMessage] = ..., - optional_lazy_import_message: Optional[ImportMessage] = ..., - repeated_int32: Optional[Iterable[int]] = ..., - repeated_int64: Optional[Iterable[int]] = ..., - repeated_uint32: Optional[Iterable[int]] = ..., - repeated_uint64: Optional[Iterable[int]] = ..., - repeated_sint32: Optional[Iterable[int]] = ..., - repeated_sint64: Optional[Iterable[int]] = ..., - repeated_fixed32: Optional[Iterable[int]] = ..., - repeated_fixed64: Optional[Iterable[int]] = ..., - repeated_sfixed32: Optional[Iterable[int]] = ..., - repeated_sfixed64: Optional[Iterable[int]] = ..., - repeated_float: Optional[Iterable[float]] = ..., - repeated_double: Optional[Iterable[float]] = ..., - repeated_bool: Optional[Iterable[bool]] = ..., - repeated_string: Optional[Iterable[Text]] = ..., - repeated_bytes: Optional[Iterable[bytes]] = ..., - repeated_nested_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., - repeated_foreign_message: Optional[Iterable[ForeignMessage]] = ..., - repeated_import_message: Optional[Iterable[ImportMessage]] = ..., - repeated_nested_enum: Optional[Iterable[TestAllTypes.NestedEnum]] = ..., - repeated_foreign_enum: Optional[Iterable[ForeignEnum]] = ..., - repeated_string_piece: Optional[Iterable[Text]] = ..., - repeated_cord: Optional[Iterable[Text]] = ..., - repeated_lazy_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., - oneof_uint32: Optional[int] = ..., - oneof_nested_message: Optional[TestAllTypes.NestedMessage] = ..., - oneof_string: Optional[Text] = ..., - oneof_bytes: Optional[bytes] = ..., - ) -> None: ... - + def __init__( + self, + optional_int32: Optional[int] = ..., + optional_int64: Optional[int] = ..., + optional_uint32: Optional[int] = ..., + optional_uint64: Optional[int] = ..., + optional_sint32: Optional[int] = ..., + optional_sint64: Optional[int] = ..., + optional_fixed32: Optional[int] = ..., + optional_fixed64: Optional[int] = ..., + optional_sfixed32: Optional[int] = ..., + optional_sfixed64: Optional[int] = ..., + optional_float: Optional[float] = ..., + optional_double: Optional[float] = ..., + optional_bool: Optional[bool] = ..., + optional_string: Optional[Text] = ..., + optional_bytes: Optional[bytes] = ..., + optional_nested_message: Optional[TestAllTypes.NestedMessage] = ..., + optional_foreign_message: Optional[ForeignMessage] = ..., + optional_import_message: Optional[ImportMessage] = ..., + optional_nested_enum: Optional[TestAllTypes.NestedEnum] = ..., + optional_foreign_enum: Optional[ForeignEnum] = ..., + optional_string_piece: Optional[Text] = ..., + optional_cord: Optional[Text] = ..., + optional_public_import_message: Optional[PublicImportMessage] = ..., + optional_lazy_message: Optional[TestAllTypes.NestedMessage] = ..., + optional_lazy_import_message: Optional[ImportMessage] = ..., + repeated_int32: Optional[Iterable[int]] = ..., + repeated_int64: Optional[Iterable[int]] = ..., + repeated_uint32: Optional[Iterable[int]] = ..., + repeated_uint64: Optional[Iterable[int]] = ..., + repeated_sint32: Optional[Iterable[int]] = ..., + repeated_sint64: Optional[Iterable[int]] = ..., + repeated_fixed32: Optional[Iterable[int]] = ..., + repeated_fixed64: Optional[Iterable[int]] = ..., + repeated_sfixed32: Optional[Iterable[int]] = ..., + repeated_sfixed64: Optional[Iterable[int]] = ..., + repeated_float: Optional[Iterable[float]] = ..., + repeated_double: Optional[Iterable[float]] = ..., + repeated_bool: Optional[Iterable[bool]] = ..., + repeated_string: Optional[Iterable[Text]] = ..., + repeated_bytes: Optional[Iterable[bytes]] = ..., + repeated_nested_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., + repeated_foreign_message: Optional[Iterable[ForeignMessage]] = ..., + repeated_import_message: Optional[Iterable[ImportMessage]] = ..., + repeated_nested_enum: Optional[Iterable[TestAllTypes.NestedEnum]] = ..., + repeated_foreign_enum: Optional[Iterable[ForeignEnum]] = ..., + repeated_string_piece: Optional[Iterable[Text]] = ..., + repeated_cord: Optional[Iterable[Text]] = ..., + repeated_lazy_message: Optional[Iterable[TestAllTypes.NestedMessage]] = ..., + oneof_uint32: Optional[int] = ..., + oneof_nested_message: Optional[TestAllTypes.NestedMessage] = ..., + oneof_string: Optional[Text] = ..., + oneof_bytes: Optional[bytes] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAllTypes: ... - class TestPackedTypes(Message): packed_int32: RepeatedScalarFieldContainer[int] packed_int64: RepeatedScalarFieldContainer[int] @@ -215,28 +180,26 @@ class TestPackedTypes(Message): packed_double: RepeatedScalarFieldContainer[float] packed_bool: RepeatedScalarFieldContainer[bool] packed_enum: RepeatedScalarFieldContainer[ForeignEnum] - - def __init__(self, - packed_int32: Optional[Iterable[int]] = ..., - packed_int64: Optional[Iterable[int]] = ..., - packed_uint32: Optional[Iterable[int]] = ..., - packed_uint64: Optional[Iterable[int]] = ..., - packed_sint32: Optional[Iterable[int]] = ..., - packed_sint64: Optional[Iterable[int]] = ..., - packed_fixed32: Optional[Iterable[int]] = ..., - packed_fixed64: Optional[Iterable[int]] = ..., - packed_sfixed32: Optional[Iterable[int]] = ..., - packed_sfixed64: Optional[Iterable[int]] = ..., - packed_float: Optional[Iterable[float]] = ..., - packed_double: Optional[Iterable[float]] = ..., - packed_bool: Optional[Iterable[bool]] = ..., - packed_enum: Optional[Iterable[ForeignEnum]] = ..., - ) -> None: ... - + def __init__( + self, + packed_int32: Optional[Iterable[int]] = ..., + packed_int64: Optional[Iterable[int]] = ..., + packed_uint32: Optional[Iterable[int]] = ..., + packed_uint64: Optional[Iterable[int]] = ..., + packed_sint32: Optional[Iterable[int]] = ..., + packed_sint64: Optional[Iterable[int]] = ..., + packed_fixed32: Optional[Iterable[int]] = ..., + packed_fixed64: Optional[Iterable[int]] = ..., + packed_sfixed32: Optional[Iterable[int]] = ..., + packed_sfixed64: Optional[Iterable[int]] = ..., + packed_float: Optional[Iterable[float]] = ..., + packed_double: Optional[Iterable[float]] = ..., + packed_bool: Optional[Iterable[bool]] = ..., + packed_enum: Optional[Iterable[ForeignEnum]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestPackedTypes: ... - class TestUnpackedTypes(Message): repeated_int32: RepeatedScalarFieldContainer[int] repeated_int64: RepeatedScalarFieldContainer[int] @@ -252,65 +215,49 @@ class TestUnpackedTypes(Message): repeated_double: RepeatedScalarFieldContainer[float] repeated_bool: RepeatedScalarFieldContainer[bool] repeated_nested_enum: RepeatedScalarFieldContainer[TestAllTypes.NestedEnum] - - def __init__(self, - repeated_int32: Optional[Iterable[int]] = ..., - repeated_int64: Optional[Iterable[int]] = ..., - repeated_uint32: Optional[Iterable[int]] = ..., - repeated_uint64: Optional[Iterable[int]] = ..., - repeated_sint32: Optional[Iterable[int]] = ..., - repeated_sint64: Optional[Iterable[int]] = ..., - repeated_fixed32: Optional[Iterable[int]] = ..., - repeated_fixed64: Optional[Iterable[int]] = ..., - repeated_sfixed32: Optional[Iterable[int]] = ..., - repeated_sfixed64: Optional[Iterable[int]] = ..., - repeated_float: Optional[Iterable[float]] = ..., - repeated_double: Optional[Iterable[float]] = ..., - repeated_bool: Optional[Iterable[bool]] = ..., - repeated_nested_enum: Optional[Iterable[TestAllTypes.NestedEnum]] = ..., - ) -> None: ... - + def __init__( + self, + repeated_int32: Optional[Iterable[int]] = ..., + repeated_int64: Optional[Iterable[int]] = ..., + repeated_uint32: Optional[Iterable[int]] = ..., + repeated_uint64: Optional[Iterable[int]] = ..., + repeated_sint32: Optional[Iterable[int]] = ..., + repeated_sint64: Optional[Iterable[int]] = ..., + repeated_fixed32: Optional[Iterable[int]] = ..., + repeated_fixed64: Optional[Iterable[int]] = ..., + repeated_sfixed32: Optional[Iterable[int]] = ..., + repeated_sfixed64: Optional[Iterable[int]] = ..., + repeated_float: Optional[Iterable[float]] = ..., + repeated_double: Optional[Iterable[float]] = ..., + repeated_bool: Optional[Iterable[bool]] = ..., + repeated_nested_enum: Optional[Iterable[TestAllTypes.NestedEnum]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestUnpackedTypes: ... - class NestedTestAllTypes(Message): - @property def child(self) -> NestedTestAllTypes: ... - @property def payload(self) -> TestAllTypes: ... - @property - def repeated_child( - self) -> RepeatedCompositeFieldContainer[NestedTestAllTypes]: ... - - def __init__(self, - child: Optional[NestedTestAllTypes] = ..., - payload: Optional[TestAllTypes] = ..., - repeated_child: Optional[Iterable[NestedTestAllTypes]] = ..., - ) -> None: ... - + def repeated_child(self) -> RepeatedCompositeFieldContainer[NestedTestAllTypes]: ... + def __init__( + self, + child: Optional[NestedTestAllTypes] = ..., + payload: Optional[TestAllTypes] = ..., + repeated_child: Optional[Iterable[NestedTestAllTypes]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> NestedTestAllTypes: ... - class ForeignMessage(Message): c: int - - def __init__(self, - c: Optional[int] = ..., - ) -> None: ... - + def __init__(self, c: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> ForeignMessage: ... - class TestEmptyMessage(Message): - - def __init__(self, - ) -> None: ... - + def __init__(self,) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEmptyMessage: ... diff --git a/third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi b/third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi index 11de45422468..20b8b4812fa0 100644 --- a/third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi +++ b/third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi @@ -21,38 +21,26 @@ from google.protobuf.wrappers_pb2 import ( ) class EnumType(int): - @classmethod def Name(cls, number: int) -> bytes: ... - @classmethod def Value(cls, name: bytes) -> EnumType: ... - @classmethod def keys(cls) -> List[bytes]: ... - @classmethod def values(cls) -> List[EnumType]: ... - @classmethod def items(cls) -> List[Tuple[bytes, EnumType]]: ... - FOO: EnumType BAR: EnumType - class MessageType(Message): value: int - - def __init__(self, - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> MessageType: ... - class TestMessage(Message): bool_value: bool int32_value: int @@ -74,558 +62,343 @@ class TestMessage(Message): repeated_string_value: RepeatedScalarFieldContainer[Text] repeated_bytes_value: RepeatedScalarFieldContainer[bytes] repeated_enum_value: RepeatedScalarFieldContainer[EnumType] - @property def message_value(self) -> MessageType: ... - @property - def repeated_message_value( - self) -> RepeatedCompositeFieldContainer[MessageType]: ... - - def __init__(self, - bool_value: Optional[bool] = ..., - int32_value: Optional[int] = ..., - int64_value: Optional[int] = ..., - uint32_value: Optional[int] = ..., - uint64_value: Optional[int] = ..., - float_value: Optional[float] = ..., - double_value: Optional[float] = ..., - string_value: Optional[Text] = ..., - bytes_value: Optional[bytes] = ..., - enum_value: Optional[EnumType] = ..., - message_value: Optional[MessageType] = ..., - repeated_bool_value: Optional[Iterable[bool]] = ..., - repeated_int32_value: Optional[Iterable[int]] = ..., - repeated_int64_value: Optional[Iterable[int]] = ..., - repeated_uint32_value: Optional[Iterable[int]] = ..., - repeated_uint64_value: Optional[Iterable[int]] = ..., - repeated_float_value: Optional[Iterable[float]] = ..., - repeated_double_value: Optional[Iterable[float]] = ..., - repeated_string_value: Optional[Iterable[Text]] = ..., - repeated_bytes_value: Optional[Iterable[bytes]] = ..., - repeated_enum_value: Optional[Iterable[EnumType]] = ..., - repeated_message_value: Optional[Iterable[MessageType]] = ..., - ) -> None: ... - + def repeated_message_value(self) -> RepeatedCompositeFieldContainer[MessageType]: ... + def __init__( + self, + bool_value: Optional[bool] = ..., + int32_value: Optional[int] = ..., + int64_value: Optional[int] = ..., + uint32_value: Optional[int] = ..., + uint64_value: Optional[int] = ..., + float_value: Optional[float] = ..., + double_value: Optional[float] = ..., + string_value: Optional[Text] = ..., + bytes_value: Optional[bytes] = ..., + enum_value: Optional[EnumType] = ..., + message_value: Optional[MessageType] = ..., + repeated_bool_value: Optional[Iterable[bool]] = ..., + repeated_int32_value: Optional[Iterable[int]] = ..., + repeated_int64_value: Optional[Iterable[int]] = ..., + repeated_uint32_value: Optional[Iterable[int]] = ..., + repeated_uint64_value: Optional[Iterable[int]] = ..., + repeated_float_value: Optional[Iterable[float]] = ..., + repeated_double_value: Optional[Iterable[float]] = ..., + repeated_string_value: Optional[Iterable[Text]] = ..., + repeated_bytes_value: Optional[Iterable[bytes]] = ..., + repeated_enum_value: Optional[Iterable[EnumType]] = ..., + repeated_message_value: Optional[Iterable[MessageType]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMessage: ... - class TestOneof(Message): oneof_int32_value: int oneof_string_value: Text oneof_bytes_value: bytes oneof_enum_value: EnumType - @property def oneof_message_value(self) -> MessageType: ... - - def __init__(self, - oneof_int32_value: Optional[int] = ..., - oneof_string_value: Optional[Text] = ..., - oneof_bytes_value: Optional[bytes] = ..., - oneof_enum_value: Optional[EnumType] = ..., - oneof_message_value: Optional[MessageType] = ..., - ) -> None: ... - + def __init__( + self, + oneof_int32_value: Optional[int] = ..., + oneof_string_value: Optional[Text] = ..., + oneof_bytes_value: Optional[bytes] = ..., + oneof_enum_value: Optional[EnumType] = ..., + oneof_message_value: Optional[MessageType] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestOneof: ... - class TestMap(Message): - class BoolMapEntry(Message): key: bool value: int - - def __init__(self, - key: Optional[bool] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[bool] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.BoolMapEntry: ... - class Int32MapEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.Int32MapEntry: ... - class Int64MapEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.Int64MapEntry: ... - class Uint32MapEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.Uint32MapEntry: ... - class Uint64MapEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.Uint64MapEntry: ... - class StringMapEntry(Message): key: Text value: int - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap.StringMapEntry: ... - @property def bool_map(self) -> MutableMapping[bool, int]: ... - @property def int32_map(self) -> MutableMapping[int, int]: ... - @property def int64_map(self) -> MutableMapping[int, int]: ... - @property def uint32_map(self) -> MutableMapping[int, int]: ... - @property def uint64_map(self) -> MutableMapping[int, int]: ... - @property def string_map(self) -> MutableMapping[Text, int]: ... - - def __init__(self, - bool_map: Optional[Mapping[bool, int]] = ..., - int32_map: Optional[Mapping[int, int]] = ..., - int64_map: Optional[Mapping[int, int]] = ..., - uint32_map: Optional[Mapping[int, int]] = ..., - uint64_map: Optional[Mapping[int, int]] = ..., - string_map: Optional[Mapping[Text, int]] = ..., - ) -> None: ... - + def __init__( + self, + bool_map: Optional[Mapping[bool, int]] = ..., + int32_map: Optional[Mapping[int, int]] = ..., + int64_map: Optional[Mapping[int, int]] = ..., + uint32_map: Optional[Mapping[int, int]] = ..., + uint64_map: Optional[Mapping[int, int]] = ..., + string_map: Optional[Mapping[Text, int]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestMap: ... - class TestNestedMap(Message): - class BoolMapEntry(Message): key: bool value: int - - def __init__(self, - key: Optional[bool] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[bool] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMap.BoolMapEntry: ... - class Int32MapEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMap.Int32MapEntry: ... - class Int64MapEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMap.Int64MapEntry: ... - class Uint32MapEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMap.Uint32MapEntry: ... - class Uint64MapEntry(Message): key: int value: int - - def __init__(self, - key: Optional[int] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[int] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMap.Uint64MapEntry: ... - class StringMapEntry(Message): key: Text value: int - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMap.StringMapEntry: ... - class MapMapEntry(Message): key: Text - @property def value(self) -> TestNestedMap: ... - - def __init__(self, - key: Optional[Text] = ..., - value: Optional[TestNestedMap] = ..., - ) -> None: ... - + def __init__(self, key: Optional[Text] = ..., value: Optional[TestNestedMap] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMap.MapMapEntry: ... - @property def bool_map(self) -> MutableMapping[bool, int]: ... - @property def int32_map(self) -> MutableMapping[int, int]: ... - @property def int64_map(self) -> MutableMapping[int, int]: ... - @property def uint32_map(self) -> MutableMapping[int, int]: ... - @property def uint64_map(self) -> MutableMapping[int, int]: ... - @property def string_map(self) -> MutableMapping[Text, int]: ... - @property def map_map(self) -> MutableMapping[Text, TestNestedMap]: ... - - def __init__(self, - bool_map: Optional[Mapping[bool, int]] = ..., - int32_map: Optional[Mapping[int, int]] = ..., - int64_map: Optional[Mapping[int, int]] = ..., - uint32_map: Optional[Mapping[int, int]] = ..., - uint64_map: Optional[Mapping[int, int]] = ..., - string_map: Optional[Mapping[Text, int]] = ..., - map_map: Optional[Mapping[Text, TestNestedMap]] = ..., - ) -> None: ... - + def __init__( + self, + bool_map: Optional[Mapping[bool, int]] = ..., + int32_map: Optional[Mapping[int, int]] = ..., + int64_map: Optional[Mapping[int, int]] = ..., + uint32_map: Optional[Mapping[int, int]] = ..., + uint64_map: Optional[Mapping[int, int]] = ..., + string_map: Optional[Mapping[Text, int]] = ..., + map_map: Optional[Mapping[Text, TestNestedMap]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestNestedMap: ... - class TestWrapper(Message): - @property def bool_value(self) -> BoolValue: ... - @property def int32_value(self) -> Int32Value: ... - @property def int64_value(self) -> Int64Value: ... - @property def uint32_value(self) -> UInt32Value: ... - @property def uint64_value(self) -> UInt64Value: ... - @property def float_value(self) -> FloatValue: ... - @property def double_value(self) -> DoubleValue: ... - @property def string_value(self) -> StringValue: ... - @property def bytes_value(self) -> BytesValue: ... - @property - def repeated_bool_value( - self) -> RepeatedCompositeFieldContainer[BoolValue]: ... - + def repeated_bool_value(self) -> RepeatedCompositeFieldContainer[BoolValue]: ... @property - def repeated_int32_value( - self) -> RepeatedCompositeFieldContainer[Int32Value]: ... - + def repeated_int32_value(self) -> RepeatedCompositeFieldContainer[Int32Value]: ... @property - def repeated_int64_value( - self) -> RepeatedCompositeFieldContainer[Int64Value]: ... - + def repeated_int64_value(self) -> RepeatedCompositeFieldContainer[Int64Value]: ... @property - def repeated_uint32_value( - self) -> RepeatedCompositeFieldContainer[UInt32Value]: ... - + def repeated_uint32_value(self) -> RepeatedCompositeFieldContainer[UInt32Value]: ... @property - def repeated_uint64_value( - self) -> RepeatedCompositeFieldContainer[UInt64Value]: ... - + def repeated_uint64_value(self) -> RepeatedCompositeFieldContainer[UInt64Value]: ... @property - def repeated_float_value( - self) -> RepeatedCompositeFieldContainer[FloatValue]: ... - + def repeated_float_value(self) -> RepeatedCompositeFieldContainer[FloatValue]: ... @property - def repeated_double_value( - self) -> RepeatedCompositeFieldContainer[DoubleValue]: ... - + def repeated_double_value(self) -> RepeatedCompositeFieldContainer[DoubleValue]: ... @property - def repeated_string_value( - self) -> RepeatedCompositeFieldContainer[StringValue]: ... - + def repeated_string_value(self) -> RepeatedCompositeFieldContainer[StringValue]: ... @property - def repeated_bytes_value( - self) -> RepeatedCompositeFieldContainer[BytesValue]: ... - - def __init__(self, - bool_value: Optional[BoolValue] = ..., - int32_value: Optional[Int32Value] = ..., - int64_value: Optional[Int64Value] = ..., - uint32_value: Optional[UInt32Value] = ..., - uint64_value: Optional[UInt64Value] = ..., - float_value: Optional[FloatValue] = ..., - double_value: Optional[DoubleValue] = ..., - string_value: Optional[StringValue] = ..., - bytes_value: Optional[BytesValue] = ..., - repeated_bool_value: Optional[Iterable[BoolValue]] = ..., - repeated_int32_value: Optional[Iterable[Int32Value]] = ..., - repeated_int64_value: Optional[Iterable[Int64Value]] = ..., - repeated_uint32_value: Optional[Iterable[UInt32Value]] = ..., - repeated_uint64_value: Optional[Iterable[UInt64Value]] = ..., - repeated_float_value: Optional[Iterable[FloatValue]] = ..., - repeated_double_value: Optional[Iterable[DoubleValue]] = ..., - repeated_string_value: Optional[Iterable[StringValue]] = ..., - repeated_bytes_value: Optional[Iterable[BytesValue]] = ..., - ) -> None: ... - + def repeated_bytes_value(self) -> RepeatedCompositeFieldContainer[BytesValue]: ... + def __init__( + self, + bool_value: Optional[BoolValue] = ..., + int32_value: Optional[Int32Value] = ..., + int64_value: Optional[Int64Value] = ..., + uint32_value: Optional[UInt32Value] = ..., + uint64_value: Optional[UInt64Value] = ..., + float_value: Optional[FloatValue] = ..., + double_value: Optional[DoubleValue] = ..., + string_value: Optional[StringValue] = ..., + bytes_value: Optional[BytesValue] = ..., + repeated_bool_value: Optional[Iterable[BoolValue]] = ..., + repeated_int32_value: Optional[Iterable[Int32Value]] = ..., + repeated_int64_value: Optional[Iterable[Int64Value]] = ..., + repeated_uint32_value: Optional[Iterable[UInt32Value]] = ..., + repeated_uint64_value: Optional[Iterable[UInt64Value]] = ..., + repeated_float_value: Optional[Iterable[FloatValue]] = ..., + repeated_double_value: Optional[Iterable[DoubleValue]] = ..., + repeated_string_value: Optional[Iterable[StringValue]] = ..., + repeated_bytes_value: Optional[Iterable[BytesValue]] = ..., + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestWrapper: ... - class TestTimestamp(Message): - @property def value(self) -> Timestamp: ... - @property def repeated_value(self) -> RepeatedCompositeFieldContainer[Timestamp]: ... - - def __init__(self, - value: Optional[Timestamp] = ..., - repeated_value: Optional[Iterable[Timestamp]] = ..., - ) -> None: ... - + def __init__(self, value: Optional[Timestamp] = ..., repeated_value: Optional[Iterable[Timestamp]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestTimestamp: ... - class TestDuration(Message): - @property def value(self) -> Duration: ... - @property def repeated_value(self) -> RepeatedCompositeFieldContainer[Duration]: ... - - def __init__(self, - value: Optional[Duration] = ..., - repeated_value: Optional[Iterable[Duration]] = ..., - ) -> None: ... - + def __init__(self, value: Optional[Duration] = ..., repeated_value: Optional[Iterable[Duration]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestDuration: ... - class TestFieldMask(Message): - @property def value(self) -> FieldMask: ... - - def __init__(self, - value: Optional[FieldMask] = ..., - ) -> None: ... - + def __init__(self, value: Optional[FieldMask] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestFieldMask: ... - class TestStruct(Message): - @property def value(self) -> Struct: ... - @property def repeated_value(self) -> RepeatedCompositeFieldContainer[Struct]: ... - - def __init__(self, - value: Optional[Struct] = ..., - repeated_value: Optional[Iterable[Struct]] = ..., - ) -> None: ... - + def __init__(self, value: Optional[Struct] = ..., repeated_value: Optional[Iterable[Struct]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestStruct: ... - class TestAny(Message): - @property def value(self) -> Any: ... - @property def repeated_value(self) -> RepeatedCompositeFieldContainer[Any]: ... - - def __init__(self, - value: Optional[Any] = ..., - repeated_value: Optional[Iterable[Any]] = ..., - ) -> None: ... - + def __init__(self, value: Optional[Any] = ..., repeated_value: Optional[Iterable[Any]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestAny: ... - class TestValue(Message): - @property def value(self) -> Value: ... - @property def repeated_value(self) -> RepeatedCompositeFieldContainer[Value]: ... - - def __init__(self, - value: Optional[Value] = ..., - repeated_value: Optional[Iterable[Value]] = ..., - ) -> None: ... - + def __init__(self, value: Optional[Value] = ..., repeated_value: Optional[Iterable[Value]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestValue: ... - class TestListValue(Message): - @property def value(self) -> ListValue: ... - @property def repeated_value(self) -> RepeatedCompositeFieldContainer[ListValue]: ... - - def __init__(self, - value: Optional[ListValue] = ..., - repeated_value: Optional[Iterable[ListValue]] = ..., - ) -> None: ... - + def __init__(self, value: Optional[ListValue] = ..., repeated_value: Optional[Iterable[ListValue]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestListValue: ... - class TestBoolValue(Message): - class BoolMapEntry(Message): key: bool value: int - - def __init__(self, - key: Optional[bool] = ..., - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, key: Optional[bool] = ..., value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestBoolValue.BoolMapEntry: ... bool_value: bool - @property def bool_map(self) -> MutableMapping[bool, int]: ... - - def __init__(self, - bool_value: Optional[bool] = ..., - bool_map: Optional[Mapping[bool, int]] = ..., - ) -> None: ... - + def __init__(self, bool_value: Optional[bool] = ..., bool_map: Optional[Mapping[bool, int]] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestBoolValue: ... - class TestCustomJsonName(Message): value: int - - def __init__(self, - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestCustomJsonName: ... - class TestExtensions(Message): - @property def extensions(self) -> TestAllExtensions: ... - - def __init__(self, - extensions: Optional[TestAllExtensions] = ..., - ) -> None: ... - + def __init__(self, extensions: Optional[TestAllExtensions] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestExtensions: ... - class TestEnumValue(Message): enum_value1: EnumType enum_value2: EnumType enum_value3: EnumType - - def __init__(self, - enum_value1: Optional[EnumType] = ..., - enum_value2: Optional[EnumType] = ..., - enum_value3: Optional[EnumType] = ..., - ) -> None: ... - + def __init__( + self, enum_value1: Optional[EnumType] = ..., enum_value2: Optional[EnumType] = ..., enum_value3: Optional[EnumType] = ... + ) -> None: ... @classmethod def FromString(cls, s: bytes) -> TestEnumValue: ... diff --git a/third_party/2and3/google/protobuf/wrappers_pb2.pyi b/third_party/2and3/google/protobuf/wrappers_pb2.pyi index eabc28adcf57..6830a1931dbb 100644 --- a/third_party/2and3/google/protobuf/wrappers_pb2.pyi +++ b/third_party/2and3/google/protobuf/wrappers_pb2.pyi @@ -4,98 +4,54 @@ from google.protobuf.message import Message class DoubleValue(Message): value: float - - def __init__(self, - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, value: Optional[float] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> DoubleValue: ... - class FloatValue(Message): value: float - - def __init__(self, - value: Optional[float] = ..., - ) -> None: ... - + def __init__(self, value: Optional[float] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> FloatValue: ... - class Int64Value(Message): value: int - - def __init__(self, - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Int64Value: ... - class UInt64Value(Message): value: int - - def __init__(self, - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> UInt64Value: ... - class Int32Value(Message): value: int - - def __init__(self, - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> Int32Value: ... - class UInt32Value(Message): value: int - - def __init__(self, - value: Optional[int] = ..., - ) -> None: ... - + def __init__(self, value: Optional[int] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> UInt32Value: ... - class BoolValue(Message): value: bool - - def __init__(self, - value: Optional[bool] = ..., - ) -> None: ... - + def __init__(self, value: Optional[bool] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> BoolValue: ... - class StringValue(Message): value: Text - - def __init__(self, - value: Optional[Text] = ..., - ) -> None: ... - + def __init__(self, value: Optional[Text] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> StringValue: ... - class BytesValue(Message): value: bytes - - def __init__(self, - value: Optional[bytes] = ..., - ) -> None: ... - + def __init__(self, value: Optional[bytes] = ...) -> None: ... @classmethod def FromString(cls, s: bytes) -> BytesValue: ... diff --git a/third_party/2and3/itsdangerous.pyi b/third_party/2and3/itsdangerous.pyi index f65c156d3a03..c5d2e47ab683 100644 --- a/third_party/2and3/itsdangerous.pyi +++ b/third_party/2and3/itsdangerous.pyi @@ -24,7 +24,9 @@ class BadTimeSignature(BadSignature): class BadHeader(BadSignature): header: Any original_error: Any - def __init__(self, message, payload: Optional[Any] = ..., header: Optional[Any] = ..., original_error: Optional[Any] = ...) -> None: ... + def __init__( + self, message, payload: Optional[Any] = ..., header: Optional[Any] = ..., original_error: Optional[Any] = ... + ) -> None: ... class SignatureExpired(BadTimeSignature): ... @@ -54,14 +56,15 @@ class Signer(object): key_derivation: str digest_method: Callable algorithm: SigningAlgorithm - - def __init__(self, - secret_key: Union[Text, bytes], - salt: Optional[Union[Text, bytes]] = ..., - sep: Optional[Union[Text, bytes]] = ..., - key_derivation: Optional[str] = ..., - digest_method: Optional[Callable] = ..., - algorithm: Optional[SigningAlgorithm] = ...) -> None: ... + def __init__( + self, + secret_key: Union[Text, bytes], + salt: Optional[Union[Text, bytes]] = ..., + sep: Optional[Union[Text, bytes]] = ..., + key_derivation: Optional[str] = ..., + digest_method: Optional[Callable] = ..., + algorithm: Optional[SigningAlgorithm] = ..., + ) -> None: ... def derive_key(self) -> bytes: ... def get_signature(self, value: Union[Text, bytes]) -> bytes: ... def sign(self, value: Union[Text, bytes]) -> bytes: ... @@ -73,8 +76,9 @@ class TimestampSigner(Signer): def get_timestamp(self) -> int: ... def timestamp_to_datetime(self, ts: float) -> datetime: ... def sign(self, value: Union[Text, bytes]) -> bytes: ... - def unsign(self, value: Union[Text, bytes], max_age: Optional[int] = ..., - return_timestamp: bool = ...) -> Any: ... # morally -> Union[bytes, Tuple[bytes, datetime]] + def unsign( + self, value: Union[Text, bytes], max_age: Optional[int] = ..., return_timestamp: bool = ... + ) -> Any: ... # morally -> Union[bytes, Tuple[bytes, datetime]] def validate(self, signed_value: Union[Text, bytes], max_age: Optional[int] = ...) -> bool: ... class Serializer(object): @@ -87,10 +91,14 @@ class Serializer(object): is_text_serializer: bool signer: Callable[..., Signer] signer_kwargs: MutableMapping[str, Any] - - def __init__(self, secret_key: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., - serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ..., - signer_kwargs: Optional[MutableMapping[str, Any]] = ...) -> None: ... + def __init__( + self, + secret_key: Union[Text, bytes], + salt: Optional[Union[Text, bytes]] = ..., + serializer: Optional[_serializer] = ..., + signer: Optional[Callable[..., Signer]] = ..., + signer_kwargs: Optional[MutableMapping[str, Any]] = ..., + ) -> None: ... def load_payload(self, payload: bytes, serializer: Optional[_serializer] = ...) -> Any: ... def dump_payload(self, obj: Any) -> bytes: ... def make_signer(self, salt: Optional[Union[Text, bytes]] = ...) -> Signer: ... @@ -103,10 +111,16 @@ class Serializer(object): def load_unsafe(self, f: IO[Any], salt: Optional[Union[Text, bytes]] = ...) -> Tuple[bool, Optional[Any]]: ... class TimedSerializer(Serializer): - def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., max_age: Optional[int] = ..., - return_timestamp: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, datetime]] - def loads_unsafe(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., - max_age: Optional[int] = ...) -> Tuple[bool, Any]: ... + def loads( + self, + s: Union[Text, bytes], + salt: Optional[Union[Text, bytes]] = ..., + max_age: Optional[int] = ..., + return_timestamp: bool = ..., + ) -> Any: ... # morally -> Union[Any, Tuple[Any, datetime]] + def loads_unsafe( + self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., max_age: Optional[int] = ... + ) -> Tuple[bool, Any]: ... class JSONWebSignatureSerializer(Serializer): jws_algorithms: MutableMapping[Text, SigningAlgorithm] = ... @@ -115,32 +129,49 @@ class JSONWebSignatureSerializer(Serializer): algorithm_name: Text algorithm: SigningAlgorithm - - def __init__(self, secret_key: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., - serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ..., - signer_kwargs: Optional[MutableMapping[str, Any]] = ..., algorithm_name: Optional[Text] = ...) -> None: ... - def load_payload(self, payload: Union[Text, bytes], serializer: Optional[_serializer] = ..., - return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]] + def __init__( + self, + secret_key: Union[Text, bytes], + salt: Optional[Union[Text, bytes]] = ..., + serializer: Optional[_serializer] = ..., + signer: Optional[Callable[..., Signer]] = ..., + signer_kwargs: Optional[MutableMapping[str, Any]] = ..., + algorithm_name: Optional[Text] = ..., + ) -> None: ... + def load_payload( + self, payload: Union[Text, bytes], serializer: Optional[_serializer] = ..., return_header: bool = ... + ) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]] def dump_payload(self, header: Mapping[str, Any], obj: Any) -> bytes: ... # type: ignore def make_algorithm(self, algorithm_name: Text) -> SigningAlgorithm: ... def make_signer(self, salt: Optional[Union[Text, bytes]] = ..., algorithm: SigningAlgorithm = ...) -> Signer: ... def make_header(self, header_fields: Optional[Mapping[str, Any]]) -> MutableMapping[str, Any]: ... - def dumps(self, obj: Any, salt: Optional[Union[Text, bytes]] = ..., - header_fields: Optional[Mapping[str, Any]] = ...) -> str: ... - def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., - return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]] - def loads_unsafe(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., - return_header: bool = ...) -> Tuple[bool, Any]: ... + def dumps( + self, obj: Any, salt: Optional[Union[Text, bytes]] = ..., header_fields: Optional[Mapping[str, Any]] = ... + ) -> str: ... + def loads( + self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., return_header: bool = ... + ) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]] + def loads_unsafe( + self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., return_header: bool = ... + ) -> Tuple[bool, Any]: ... class TimedJSONWebSignatureSerializer(JSONWebSignatureSerializer): DEFAULT_EXPIRES_IN: int = ... expires_in: int - def __init__(self, secret_key: Union[Text, bytes], expires_in: Optional[int] = ..., salt: Optional[Union[Text, bytes]] = ..., - serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ..., - signer_kwargs: Optional[MutableMapping[str, Any]] = ..., algorithm_name: Optional[Text] = ...) -> None: ... + def __init__( + self, + secret_key: Union[Text, bytes], + expires_in: Optional[int] = ..., + salt: Optional[Union[Text, bytes]] = ..., + serializer: Optional[_serializer] = ..., + signer: Optional[Callable[..., Signer]] = ..., + signer_kwargs: Optional[MutableMapping[str, Any]] = ..., + algorithm_name: Optional[Text] = ..., + ) -> None: ... def make_header(self, header_fields: Optional[Mapping[str, Any]]) -> MutableMapping[str, Any]: ... - def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., - return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]] + def loads( + self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., return_header: bool = ... + ) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]] def get_issue_date(self, header: Mapping[str, Any]) -> Optional[datetime]: ... def now(self) -> int: ... diff --git a/third_party/2and3/jinja2/environment.pyi b/third_party/2and3/jinja2/environment.pyi index f5997a3aa63b..3e6ddbf0dfa5 100644 --- a/third_party/2and3/jinja2/environment.pyi +++ b/third_party/2and3/jinja2/environment.pyi @@ -46,43 +46,136 @@ class Environment: bytecode_cache: BytecodeCache auto_reload: bool extensions: List - def __init__(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., newline_sequence: Text = ..., keep_trailing_newline: bool = ..., extensions: List = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Optional[Callable] = ..., autoescape: Union[bool, Callable[[str], bool]] = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ..., enable_async: bool = ...) -> None: ... + def __init__( + self, + block_start_string: Text = ..., + block_end_string: Text = ..., + variable_start_string: Text = ..., + variable_end_string: Text = ..., + comment_start_string: Any = ..., + comment_end_string: Text = ..., + line_statement_prefix: Text = ..., + line_comment_prefix: Text = ..., + trim_blocks: bool = ..., + lstrip_blocks: bool = ..., + newline_sequence: Text = ..., + keep_trailing_newline: bool = ..., + extensions: List = ..., + optimized: bool = ..., + undefined: Type[Undefined] = ..., + finalize: Optional[Callable] = ..., + autoescape: Union[bool, Callable[[str], bool]] = ..., + loader: Optional[BaseLoader] = ..., + cache_size: int = ..., + auto_reload: bool = ..., + bytecode_cache: Optional[BytecodeCache] = ..., + enable_async: bool = ..., + ) -> None: ... def add_extension(self, extension): ... def extend(self, **attributes): ... - def overlay(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., extensions: List = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Callable = ..., autoescape: bool = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ...): ... + def overlay( + self, + block_start_string: Text = ..., + block_end_string: Text = ..., + variable_start_string: Text = ..., + variable_end_string: Text = ..., + comment_start_string: Any = ..., + comment_end_string: Text = ..., + line_statement_prefix: Text = ..., + line_comment_prefix: Text = ..., + trim_blocks: bool = ..., + lstrip_blocks: bool = ..., + extensions: List = ..., + optimized: bool = ..., + undefined: Type[Undefined] = ..., + finalize: Callable = ..., + autoescape: bool = ..., + loader: Optional[BaseLoader] = ..., + cache_size: int = ..., + auto_reload: bool = ..., + bytecode_cache: Optional[BytecodeCache] = ..., + ): ... lexer: Any def iter_extensions(self): ... def getitem(self, obj, argument): ... def getattr(self, obj, attribute): ... - def call_filter(self, name, value, args: Optional[Any] = ..., kwargs: Optional[Any] = ..., context: Optional[Any] = ..., eval_ctx: Optional[Any] = ...): ... + def call_filter( + self, + name, + value, + args: Optional[Any] = ..., + kwargs: Optional[Any] = ..., + context: Optional[Any] = ..., + eval_ctx: Optional[Any] = ..., + ): ... def call_test(self, name, value, args: Optional[Any] = ..., kwargs: Optional[Any] = ...): ... def parse(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ...): ... def lex(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ...): ... def preprocess(self, source: Text, name: Optional[Any] = ..., filename: Optional[Any] = ...): ... - def compile(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., raw: bool = ..., defer_init: bool = ...): ... + def compile( + self, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., raw: bool = ..., defer_init: bool = ... + ): ... def compile_expression(self, source: Text, undefined_to_none: bool = ...): ... - def compile_templates(self, target, extensions: Optional[Any] = ..., filter_func: Optional[Any] = ..., zip: str = ..., log_function: Optional[Any] = ..., ignore_errors: bool = ..., py_compile: bool = ...): ... + def compile_templates( + self, + target, + extensions: Optional[Any] = ..., + filter_func: Optional[Any] = ..., + zip: str = ..., + log_function: Optional[Any] = ..., + ignore_errors: bool = ..., + py_compile: bool = ..., + ): ... def list_templates(self, extensions: Optional[Any] = ..., filter_func: Optional[Any] = ...): ... def handle_exception(self, exc_info: Optional[Any] = ..., rendered: bool = ..., source_hint: Optional[Any] = ...): ... def join_path(self, template: Union[Template, Text], parent: Text) -> Text: ... - def get_template(self, name: Union[Template, Text], parent: Optional[Text] = ..., globals: Optional[Any] = ...) -> Template: ... - def select_template(self, names: List[Union[Template, Text]], parent: Optional[Text] = ..., globals: Optional[Dict[str, Any]] = ...) -> Template: ... - def get_or_select_template(self, template_name_or_list: Union[Union[Template, Text], List[Union[Template, Text]]], parent: Optional[Text] = ..., globals: Optional[Dict[str, Any]] = ...) -> Template: ... - def from_string(self, source: Text, globals: Optional[Dict[str, Any]] = ..., template_class: Optional[Type[Template]] = ...) -> Template: ... + def get_template( + self, name: Union[Template, Text], parent: Optional[Text] = ..., globals: Optional[Any] = ... + ) -> Template: ... + def select_template( + self, names: List[Union[Template, Text]], parent: Optional[Text] = ..., globals: Optional[Dict[str, Any]] = ... + ) -> Template: ... + def get_or_select_template( + self, + template_name_or_list: Union[Union[Template, Text], List[Union[Template, Text]]], + parent: Optional[Text] = ..., + globals: Optional[Dict[str, Any]] = ..., + ) -> Template: ... + def from_string( + self, source: Text, globals: Optional[Dict[str, Any]] = ..., template_class: Optional[Type[Template]] = ... + ) -> Template: ... def make_globals(self, d: Optional[Dict[str, Any]]) -> Dict[str, Any]: ... - # Frequently added extensions are included here: # from InternationalizationExtension: def install_gettext_translations(self, translations: Any, newstyle: Optional[bool]): ... def install_null_translations(self, newstyle: Optional[bool]): ... - def install_gettext_callables(self, gettext: Callable, ngettext: Callable, - newstyle: Optional[bool]): ... + def install_gettext_callables(self, gettext: Callable, ngettext: Callable, newstyle: Optional[bool]): ... def uninstall_gettext_translations(self, translations: Any): ... def extract_translations(self, source: Any, gettext_functions: Any): ... newstyle_gettext: bool class Template: - def __new__(cls, source, block_start_string: Any = ..., block_end_string: Any = ..., variable_start_string: Any = ..., variable_end_string: Any = ..., comment_start_string: Any = ..., comment_end_string: Any = ..., line_statement_prefix: Any = ..., line_comment_prefix: Any = ..., trim_blocks: Any = ..., lstrip_blocks: Any = ..., newline_sequence: Any = ..., keep_trailing_newline: Any = ..., extensions: Any = ..., optimized: bool = ..., undefined: Any = ..., finalize: Optional[Any] = ..., autoescape: bool = ...): ... + def __new__( + cls, + source, + block_start_string: Any = ..., + block_end_string: Any = ..., + variable_start_string: Any = ..., + variable_end_string: Any = ..., + comment_start_string: Any = ..., + comment_end_string: Any = ..., + line_statement_prefix: Any = ..., + line_comment_prefix: Any = ..., + trim_blocks: Any = ..., + lstrip_blocks: Any = ..., + newline_sequence: Any = ..., + keep_trailing_newline: Any = ..., + extensions: Any = ..., + optimized: bool = ..., + undefined: Any = ..., + finalize: Optional[Any] = ..., + autoescape: bool = ..., + ): ... environment: Environment = ... @classmethod def from_code(cls, environment, code, globals, uptodate: Optional[Any] = ...): ... @@ -91,8 +184,12 @@ class Template: def render(self, *args, **kwargs) -> Text: ... def stream(self, *args, **kwargs) -> TemplateStream: ... def generate(self, *args, **kwargs) -> Iterator[Text]: ... - def new_context(self, vars: Optional[Dict[str, Any]] = ..., shared: bool = ..., locals: Optional[Dict[str, Any]] = ...) -> Context: ... - def make_module(self, vars: Optional[Dict[str, Any]] = ..., shared: bool = ..., locals: Optional[Dict[str, Any]] = ...) -> Context: ... + def new_context( + self, vars: Optional[Dict[str, Any]] = ..., shared: bool = ..., locals: Optional[Dict[str, Any]] = ... + ) -> Context: ... + def make_module( + self, vars: Optional[Dict[str, Any]] = ..., shared: bool = ..., locals: Optional[Dict[str, Any]] = ... + ) -> Context: ... @property def module(self) -> Any: ... def get_corresponding_lineno(self, lineno): ... @@ -100,12 +197,10 @@ class Template: def is_up_to_date(self) -> bool: ... @property def debug_info(self): ... - if sys.version_info >= (3, 6): def render_async(self, *args, **kwargs) -> Awaitable[Text]: ... def generate_async(self, *args, **kwargs) -> AsyncIterator[Text]: ... - class TemplateModule: __name__: Any def __init__(self, template, context) -> None: ... diff --git a/third_party/2and3/jinja2/ext.pyi b/third_party/2and3/jinja2/ext.pyi index 283586030e9f..cdf28922b201 100644 --- a/third_party/2and3/jinja2/ext.pyi +++ b/third_party/2and3/jinja2/ext.pyi @@ -15,7 +15,15 @@ class Extension: def filter_stream(self, stream): ... def parse(self, parser): ... def attr(self, name, lineno: Optional[Any] = ...): ... - def call_method(self, name, args: Optional[Any] = ..., kwargs: Optional[Any] = ..., dyn_args: Optional[Any] = ..., dyn_kwargs: Optional[Any] = ..., lineno: Optional[Any] = ...): ... + def call_method( + self, + name, + args: Optional[Any] = ..., + kwargs: Optional[Any] = ..., + dyn_args: Optional[Any] = ..., + dyn_kwargs: Optional[Any] = ..., + lineno: Optional[Any] = ..., + ): ... class InternationalizationExtension(Extension): tags: Any diff --git a/third_party/2and3/jinja2/parser.pyi b/third_party/2and3/jinja2/parser.pyi index a16ae8d06a13..ae5962f64d08 100644 --- a/third_party/2and3/jinja2/parser.pyi +++ b/third_party/2and3/jinja2/parser.pyi @@ -7,7 +7,9 @@ class Parser: filename: Any closed: bool extensions: Any - def __init__(self, environment, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., state: Optional[Any] = ...) -> None: ... + def __init__( + self, environment, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., state: Optional[Any] = ... + ) -> None: ... def fail(self, msg, lineno: Optional[Any] = ..., exc: Any = ...): ... def fail_unknown_tag(self, name, lineno: Optional[Any] = ...): ... def fail_eof(self, end_tokens: Optional[Any] = ..., lineno: Optional[Any] = ...): ... @@ -46,7 +48,13 @@ class Parser: def parse_pow(self): ... def parse_unary(self, with_filter: bool = ...): ... def parse_primary(self): ... - def parse_tuple(self, simplified: bool = ..., with_condexpr: bool = ..., extra_end_rules: Optional[Any] = ..., explicit_parentheses: bool = ...): ... + def parse_tuple( + self, + simplified: bool = ..., + with_condexpr: bool = ..., + extra_end_rules: Optional[Any] = ..., + explicit_parentheses: bool = ..., + ): ... def parse_list(self): ... def parse_dict(self): ... def parse_postfix(self, node): ... diff --git a/third_party/2and3/jinja2/runtime.pyi b/third_party/2and3/jinja2/runtime.pyi index f442bfa856b0..822e8935bd1a 100644 --- a/third_party/2and3/jinja2/runtime.pyi +++ b/third_party/2and3/jinja2/runtime.pyi @@ -26,7 +26,9 @@ class Context: exported_vars: Any name: Text blocks: Dict[str, Any] - def __init__(self, environment: Environment, parent: Union[Context, Dict[str, Any]], name: Text, blocks: Dict[str, Any]) -> None: ... + def __init__( + self, environment: Environment, parent: Union[Context, Dict[str, Any]], name: Text, blocks: Dict[str, Any] + ) -> None: ... def super(self, name, current): ... def get(self, key, default: Optional[Any] = ...): ... def resolve(self, key): ... diff --git a/third_party/2and3/jinja2/utils.pyi b/third_party/2and3/jinja2/utils.pyi index 3b8029d06d76..85ffe969353b 100644 --- a/third_party/2and3/jinja2/utils.pyi +++ b/third_party/2and3/jinja2/utils.pyi @@ -13,7 +13,12 @@ def evalcontextfunction(f): ... def environmentfunction(f): ... def internalcode(f): ... def is_undefined(obj): ... -def select_autoescape(enabled_extensions: Iterable[str] = ..., disabled_extensions: Iterable[str] = ..., default_for_string: bool = ..., default: bool = ...) -> Callable[[str], bool]: ... +def select_autoescape( + enabled_extensions: Iterable[str] = ..., + disabled_extensions: Iterable[str] = ..., + default_for_string: bool = ..., + default: bool = ..., +) -> Callable[[str], bool]: ... def consume(iterable): ... def clear_caches(): ... def import_string(import_name, silent: bool = ...): ... diff --git a/third_party/2and3/markupsafe/__init__.pyi b/third_party/2and3/markupsafe/__init__.pyi index 3b6def3b9def..49807b128e7e 100644 --- a/third_party/2and3/markupsafe/__init__.pyi +++ b/third_party/2and3/markupsafe/__init__.pyi @@ -43,7 +43,9 @@ class Markup(text_type): def strip(self, chars: Optional[text_type] = ...) -> Markup: ... def center(self, width: int, fillchar: text_type = ...) -> Markup: ... def zfill(self, width: int) -> Markup: ... - def translate(self, table: Union[Mapping[int, Union[int, text_type, None]], Sequence[Union[int, text_type, None]]]) -> Markup: ... + def translate( + self, table: Union[Mapping[int, Union[int, text_type, None]], Sequence[Union[int, text_type, None]]] + ) -> Markup: ... def expandtabs(self, tabsize: int = ...) -> Markup: ... class EscapeFormatter(string.Formatter): diff --git a/third_party/2and3/markupsafe/_compat.pyi b/third_party/2and3/markupsafe/_compat.pyi index b8da6849b118..735fa7d74eee 100644 --- a/third_party/2and3/markupsafe/_compat.pyi +++ b/third_party/2and3/markupsafe/_compat.pyi @@ -1,18 +1,21 @@ import sys from typing import Any, Iterator, Mapping, Text, Tuple, TypeVar -_K = TypeVar('_K') -_V = TypeVar('_V') +_K = TypeVar("_K") +_V = TypeVar("_V") PY2: bool + def iteritems(d: Mapping[_K, _V]) -> Iterator[Tuple[_K, _V]]: ... + if sys.version_info[0] >= 3: text_type = str - string_types = str, + string_types = (str,) unichr = chr - int_types = int, + int_types = (int,) else: from __builtin__ import unichr as unichr + text_type = unicode string_types = (str, unicode) int_types = (int, long) diff --git a/third_party/2and3/mock.pyi b/third_party/2and3/mock.pyi index cb3db6198b41..58cdf3c6dd51 100644 --- a/third_party/2and3/mock.pyi +++ b/third_party/2and3/mock.pyi @@ -37,7 +37,20 @@ NonCallableMock: Any class CallableMixin(Base): side_effect: Any - def __init__(self, spec: Optional[Any] = ..., side_effect: Optional[Any] = ..., return_value: Any = ..., wraps: Optional[Any] = ..., name: Optional[Any] = ..., spec_set: Optional[Any] = ..., parent: Optional[Any] = ..., _spec_state: Optional[Any] = ..., _new_name: Any = ..., _new_parent: Optional[Any] = ..., **kwargs: Any) -> None: ... + def __init__( + self, + spec: Optional[Any] = ..., + side_effect: Optional[Any] = ..., + return_value: Any = ..., + wraps: Optional[Any] = ..., + name: Optional[Any] = ..., + spec_set: Optional[Any] = ..., + parent: Optional[Any] = ..., + _spec_state: Optional[Any] = ..., + _new_name: Any = ..., + _new_parent: Optional[Any] = ..., + **kwargs: Any + ) -> None: ... def __call__(_mock_self, *args: Any, **kwargs: Any) -> Any: ... Mock: Any @@ -55,7 +68,18 @@ class _patch: autospec: Any kwargs: Any additional_patchers: Any - def __init__(self, getter: Any, attribute: Any, new: Any, spec: Any, create: Any, spec_set: Any, autospec: Any, new_callable: Any, kwargs: Any) -> None: ... + def __init__( + self, + getter: Any, + attribute: Any, + new: Any, + spec: Any, + create: Any, + spec_set: Any, + autospec: Any, + new_callable: Any, + kwargs: Any, + ) -> None: ... def copy(self) -> Any: ... def __call__(self, func: Any) -> Any: ... def decorate_class(self, klass: Any) -> Any: ... @@ -84,9 +108,39 @@ class _patch_dict: class _patcher: TEST_PREFIX: str dict: Type[_patch_dict] - def __call__(self, target: Any, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ... - def object(self, target: Any, attribute: Text, new: Optional[Any] = ..., spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ... - def multiple(self, target: Any, spec: Optional[Any] = ..., create: bool = ..., spec_set: Optional[Any] = ..., autospec: Optional[Any] = ..., new_callable: Optional[Any] = ..., **kwargs: Any) -> _patch: ... + def __call__( + self, + target: Any, + new: Optional[Any] = ..., + spec: Optional[Any] = ..., + create: bool = ..., + spec_set: Optional[Any] = ..., + autospec: Optional[Any] = ..., + new_callable: Optional[Any] = ..., + **kwargs: Any + ) -> _patch: ... + def object( + self, + target: Any, + attribute: Text, + new: Optional[Any] = ..., + spec: Optional[Any] = ..., + create: bool = ..., + spec_set: Optional[Any] = ..., + autospec: Optional[Any] = ..., + new_callable: Optional[Any] = ..., + **kwargs: Any + ) -> _patch: ... + def multiple( + self, + target: Any, + spec: Optional[Any] = ..., + create: bool = ..., + spec_set: Optional[Any] = ..., + autospec: Optional[Any] = ..., + new_callable: Optional[Any] = ..., + **kwargs: Any + ) -> _patch: ... def stopall(self) -> None: ... patch: _patcher @@ -112,11 +166,15 @@ class _ANY: ANY: Any class _Call(tuple): - def __new__(cls, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ...) -> Any: ... + def __new__( + cls, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ... + ) -> Any: ... name: Any parent: Any from_kall: Any - def __init__(self, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ...) -> None: ... + def __init__( + self, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ... + ) -> None: ... def __eq__(self, other: Any) -> bool: ... __ne__: Any def __call__(self, *args: Any, **kwargs: Any) -> Any: ... @@ -127,7 +185,9 @@ class _Call(tuple): call: Any -def create_autospec(spec: Any, spec_set: Any = ..., instance: Any = ..., _parent: Optional[Any] = ..., _name: Optional[Any] = ..., **kwargs: Any) -> Any: ... +def create_autospec( + spec: Any, spec_set: Any = ..., instance: Any = ..., _parent: Optional[Any] = ..., _name: Optional[Any] = ..., **kwargs: Any +) -> Any: ... class _SpecState: spec: Any @@ -136,7 +196,15 @@ class _SpecState: parent: Any instance: Any name: Any - def __init__(self, spec: Any, spec_set: Any = ..., parent: Optional[Any] = ..., name: Optional[Any] = ..., ids: Optional[Any] = ..., instance: Any = ...) -> None: ... + def __init__( + self, + spec: Any, + spec_set: Any = ..., + parent: Optional[Any] = ..., + name: Optional[Any] = ..., + ids: Optional[Any] = ..., + instance: Any = ..., + ) -> None: ... def mock_open(mock: Optional[Any] = ..., read_data: Any = ...) -> Any: ... diff --git a/third_party/2and3/mypy_extensions.pyi b/third_party/2and3/mypy_extensions.pyi index 06c5df5d2ba6..4c1178f0be1d 100644 --- a/third_party/2and3/mypy_extensions.pyi +++ b/third_party/2and3/mypy_extensions.pyi @@ -2,8 +2,8 @@ import abc import sys from typing import Any, Dict, Generic, ItemsView, KeysView, Mapping, Optional, Type, TypeVar, Union, ValuesView -_T = TypeVar('_T') -_U = TypeVar('_U') +_T = TypeVar("_T") +_U = TypeVar("_U") # Internal mypy fallback type for all typed dicts (does not exist at runtime) class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): @@ -22,7 +22,6 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): def __delitem__(self, k: NoReturn) -> None: ... def TypedDict(typename: str, fields: Dict[str, Type[_T]], total: bool = ...) -> Type[dict]: ... - def Arg(type: _T = ..., name: Optional[str] = ...) -> _T: ... def DefaultArg(type: _T = ..., name: Optional[str] = ...) -> _T: ... def NamedArg(type: _T = ..., name: Optional[str] = ...) -> _T: ... diff --git a/third_party/2and3/pycurl.pyi b/third_party/2and3/pycurl.pyi index 0d9da02d3706..32f093d9382b 100644 --- a/third_party/2and3/pycurl.pyi +++ b/third_party/2and3/pycurl.pyi @@ -14,8 +14,7 @@ def global_cleanup() -> None: ... version: str -def version_info() -> Tuple[int, str, int, str, int, str, - int, str, tuple, Any, int, Any]: ... +def version_info() -> Tuple[int, str, int, str, int, str, int, str, tuple, Any, int, Any]: ... class error(Exception): ... @@ -28,7 +27,6 @@ class Curl(object): def unsetopt(self, option: int) -> Any: ... def pause(self, bitmask: Any) -> Any: ... def errstr(self) -> str: ... - # TODO(MichalPokorny): wat? USERPWD: int diff --git a/third_party/2and3/pymysql/__init__.pyi b/third_party/2and3/pymysql/__init__.pyi index a5c5d90bdb66..548f18b48dd9 100644 --- a/third_party/2and3/pymysql/__init__.pyi +++ b/third_party/2and3/pymysql/__init__.pyi @@ -44,8 +44,10 @@ ROWID: DBAPISet if sys.version_info >= (3, 0): def Binary(x) -> bytes: ... + else: def Binary(x) -> bytearray: ... + def Connect(*args, **kwargs) -> _Connection: ... def get_client_info() -> str: ... diff --git a/third_party/2and3/pymysql/connections.pyi b/third_party/2and3/pymysql/connections.pyi index 1d7f04ee51db..61f704bdd580 100644 --- a/third_party/2and3/pymysql/connections.pyi +++ b/third_party/2and3/pymysql/connections.pyi @@ -103,12 +103,28 @@ class Connection: encoders: Any decoders: Any host_info: Any - def __init__(self, host: str = ..., user: Optional[Any] = ..., passwd: str = ..., db: Optional[Any] = ..., - port: int = ..., unix_socket: Optional[Any] = ..., charset: str = ..., sql_mode: Optional[Any] = ..., - read_default_file: Optional[Any] = ..., conv=..., use_unicode: Optional[Any] = ..., client_flag: int = ..., - cursorclass=..., init_command: Optional[Any] = ..., connect_timeout: Optional[Any] = ..., - ssl: Optional[Any] = ..., read_default_group: Optional[Any] = ..., compress: Optional[Any] = ..., - named_pipe: Optional[Any] = ...): ... + def __init__( + self, + host: str = ..., + user: Optional[Any] = ..., + passwd: str = ..., + db: Optional[Any] = ..., + port: int = ..., + unix_socket: Optional[Any] = ..., + charset: str = ..., + sql_mode: Optional[Any] = ..., + read_default_file: Optional[Any] = ..., + conv=..., + use_unicode: Optional[Any] = ..., + client_flag: int = ..., + cursorclass=..., + init_command: Optional[Any] = ..., + connect_timeout: Optional[Any] = ..., + ssl: Optional[Any] = ..., + read_default_group: Optional[Any] = ..., + compress: Optional[Any] = ..., + named_pipe: Optional[Any] = ..., + ): ... socket: Any rfile: Any wfile: Any diff --git a/third_party/2and3/pynamodb/attributes.pyi b/third_party/2and3/pynamodb/attributes.pyi index 03639b7b95f2..6a3b71ea3bcc 100644 --- a/third_party/2and3/pynamodb/attributes.pyi +++ b/third_party/2and3/pynamodb/attributes.pyi @@ -1,10 +1,10 @@ from datetime import datetime from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Set, Text, Type, TypeVar, Union -_T = TypeVar('_T') -_KT = TypeVar('_KT') -_VT = TypeVar('_VT') -_MT = TypeVar('_MT', bound='MapAttribute') +_T = TypeVar("_T") +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") +_MT = TypeVar("_MT", bound="MapAttribute") class Attribute(Generic[_T]): attr_name: Optional[Text] @@ -13,7 +13,14 @@ class Attribute(Generic[_T]): default: Any is_hash_key: bool is_range_key: bool - def __init__(self, hash_key: bool = ..., range_key: bool = ..., null: Optional[bool] = ..., default: Optional[Union[_T, Callable[..., _T]]] = ..., attr_name: Optional[Text] = ...) -> None: ... + def __init__( + self, + hash_key: bool = ..., + range_key: bool = ..., + null: Optional[bool] = ..., + default: Optional[Union[_T, Callable[..., _T]]] = ..., + attr_name: Optional[Text] = ..., + ) -> None: ... def __set__(self, instance: Any, value: Optional[_T]) -> None: ... def serialize(self, value: Any) -> Any: ... def deserialize(self, value: Any) -> Any: ... @@ -76,7 +83,15 @@ class MapAttributeMeta(type): class MapAttribute(Generic[_KT, _VT], Attribute[Mapping[_KT, _VT]], metaclass=MapAttributeMeta): attribute_values: Any - def __init__(self, hash_key: bool = ..., range_key: bool = ..., null: Optional[bool] = ..., default: Optional[Union[Any, Callable[..., Any]]] = ..., attr_name: Optional[Text] = ..., **attrs) -> None: ... + def __init__( + self, + hash_key: bool = ..., + range_key: bool = ..., + null: Optional[bool] = ..., + default: Optional[Union[Any, Callable[..., Any]]] = ..., + attr_name: Optional[Text] = ..., + **attrs + ) -> None: ... def __iter__(self) -> Iterable[_VT]: ... def __getattr__(self, attr: str) -> _VT: ... def __getitem__(self, item: _KT) -> _VT: ... @@ -87,7 +102,15 @@ class MapAttribute(Generic[_KT, _VT], Attribute[Mapping[_KT, _VT]], metaclass=Ma class ListAttribute(Generic[_T], Attribute[List[_T]]): element_type: Any - def __init__(self, hash_key: bool = ..., range_key: bool = ..., null: Optional[bool] = ..., default: Optional[Union[Any, Callable[..., Any]]] = ..., attr_name: Optional[Text] = ..., of: Optional[Type[_T]] = ...) -> None: ... + def __init__( + self, + hash_key: bool = ..., + range_key: bool = ..., + null: Optional[bool] = ..., + default: Optional[Union[Any, Callable[..., Any]]] = ..., + attr_name: Optional[Text] = ..., + of: Optional[Type[_T]] = ..., + ) -> None: ... def __get__(self, instance: Any, owner: Any) -> List[_T]: ... DESERIALIZE_CLASS_MAP: Dict[Text, Attribute] diff --git a/third_party/2and3/pynamodb/connection/base.pyi b/third_party/2and3/pynamodb/connection/base.pyi index 9c751501798e..5a0a2d593f72 100644 --- a/third_party/2and3/pynamodb/connection/base.pyi +++ b/third_party/2and3/pynamodb/connection/base.pyi @@ -20,9 +20,15 @@ class Connection: host: Any region: Any session_cls: Any - def __init__(self, region: Optional[Any] = ..., host: Optional[Any] = ..., session_cls: Optional[Any] = ..., - request_timeout_seconds: Optional[Any] = ..., max_retry_attempts: Optional[Any] = ..., - base_backoff_ms: Optional[Any] = ...) -> None: ... + def __init__( + self, + region: Optional[Any] = ..., + host: Optional[Any] = ..., + session_cls: Optional[Any] = ..., + request_timeout_seconds: Optional[Any] = ..., + max_retry_attempts: Optional[Any] = ..., + base_backoff_ms: Optional[Any] = ..., + ) -> None: ... def dispatch(self, operation_name, operation_kwargs): ... @property def session(self): ... @@ -31,13 +37,25 @@ class Connection: @property def client(self): ... def get_meta_table(self, table_name: Text, refresh: bool = ...): ... - def create_table(self, table_name: Text, attribute_definitions: Optional[Any] = ..., key_schema: Optional[Any] = ..., - read_capacity_units: Optional[Any] = ..., write_capacity_units: Optional[Any] = ..., - global_secondary_indexes: Optional[Any] = ..., local_secondary_indexes: Optional[Any] = ..., - stream_specification: Optional[Any] = ...): ... + def create_table( + self, + table_name: Text, + attribute_definitions: Optional[Any] = ..., + key_schema: Optional[Any] = ..., + read_capacity_units: Optional[Any] = ..., + write_capacity_units: Optional[Any] = ..., + global_secondary_indexes: Optional[Any] = ..., + local_secondary_indexes: Optional[Any] = ..., + stream_specification: Optional[Any] = ..., + ): ... def delete_table(self, table_name: Text): ... - def update_table(self, table_name: Text, read_capacity_units: Optional[Any] = ..., write_capacity_units: Optional[Any] = ..., - global_secondary_index_updates: Optional[Any] = ...): ... + def update_table( + self, + table_name: Text, + read_capacity_units: Optional[Any] = ..., + write_capacity_units: Optional[Any] = ..., + global_secondary_index_updates: Optional[Any] = ..., + ): ... def list_tables(self, exclusive_start_table_name: Optional[Any] = ..., limit: Optional[Any] = ...): ... def describe_table(self, table_name: Text): ... def get_conditional_operator(self, operator): ... @@ -51,28 +69,90 @@ class Connection: def get_return_values_map(self, return_values): ... def get_item_collection_map(self, return_item_collection_metrics): ... def get_exclusive_start_key_map(self, table_name: Text, exclusive_start_key): ... - def delete_item(self, table_name: Text, hash_key, range_key: Optional[Any] = ..., expected: Optional[Any] = ..., - conditional_operator: Optional[Any] = ..., return_values: Optional[Any] = ..., - return_consumed_capacity: Optional[Any] = ..., return_item_collection_metrics: Optional[Any] = ...): ... - def update_item(self, table_name: Text, hash_key, range_key: Optional[Any] = ..., attribute_updates: Optional[Any] = ..., - expected: Optional[Any] = ..., return_consumed_capacity: Optional[Any] = ..., - conditional_operator: Optional[Any] = ..., return_item_collection_metrics: Optional[Any] = ..., - return_values: Optional[Any] = ...): ... - def put_item(self, table_name: Text, hash_key, range_key: Optional[Any] = ..., attributes: Optional[Any] = ..., - expected: Optional[Any] = ..., conditional_operator: Optional[Any] = ..., return_values: Optional[Any] = ..., - return_consumed_capacity: Optional[Any] = ..., return_item_collection_metrics: Optional[Any] = ...): ... - def batch_write_item(self, table_name: Text, put_items: Optional[Any] = ..., delete_items: Optional[Any] = ..., - return_consumed_capacity: Optional[Any] = ..., return_item_collection_metrics: Optional[Any] = ...): ... - def batch_get_item(self, table_name: Text, keys, consistent_read: Optional[Any] = ..., - return_consumed_capacity: Optional[Any] = ..., attributes_to_get: Optional[Any] = ...): ... - def get_item(self, table_name: Text, hash_key, range_key: Optional[Any] = ..., consistent_read: bool = ..., - attributes_to_get: Optional[Any] = ...): ... - def scan(self, table_name: Text, attributes_to_get: Optional[Any] = ..., limit: Optional[Any] = ..., - conditional_operator: Optional[Any] = ..., scan_filter: Optional[Any] = ..., - return_consumed_capacity: Optional[Any] = ..., exclusive_start_key: Optional[Any] = ..., - segment: Optional[Any] = ..., total_segments: Optional[Any] = ...): ... - def query(self, table_name: Text, hash_key, attributes_to_get: Optional[Any] = ..., consistent_read: bool = ..., - exclusive_start_key: Optional[Any] = ..., index_name: Optional[Any] = ..., key_conditions: Optional[Any] = ..., - query_filters: Optional[Any] = ..., conditional_operator: Optional[Any] = ..., limit: Optional[Any] = ..., - return_consumed_capacity: Optional[Any] = ..., scan_index_forward: Optional[Any] = ..., - select: Optional[Any] = ...): ... + def delete_item( + self, + table_name: Text, + hash_key, + range_key: Optional[Any] = ..., + expected: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + return_values: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + return_item_collection_metrics: Optional[Any] = ..., + ): ... + def update_item( + self, + table_name: Text, + hash_key, + range_key: Optional[Any] = ..., + attribute_updates: Optional[Any] = ..., + expected: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + return_item_collection_metrics: Optional[Any] = ..., + return_values: Optional[Any] = ..., + ): ... + def put_item( + self, + table_name: Text, + hash_key, + range_key: Optional[Any] = ..., + attributes: Optional[Any] = ..., + expected: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + return_values: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + return_item_collection_metrics: Optional[Any] = ..., + ): ... + def batch_write_item( + self, + table_name: Text, + put_items: Optional[Any] = ..., + delete_items: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + return_item_collection_metrics: Optional[Any] = ..., + ): ... + def batch_get_item( + self, + table_name: Text, + keys, + consistent_read: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + attributes_to_get: Optional[Any] = ..., + ): ... + def get_item( + self, + table_name: Text, + hash_key, + range_key: Optional[Any] = ..., + consistent_read: bool = ..., + attributes_to_get: Optional[Any] = ..., + ): ... + def scan( + self, + table_name: Text, + attributes_to_get: Optional[Any] = ..., + limit: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + scan_filter: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + exclusive_start_key: Optional[Any] = ..., + segment: Optional[Any] = ..., + total_segments: Optional[Any] = ..., + ): ... + def query( + self, + table_name: Text, + hash_key, + attributes_to_get: Optional[Any] = ..., + consistent_read: bool = ..., + exclusive_start_key: Optional[Any] = ..., + index_name: Optional[Any] = ..., + key_conditions: Optional[Any] = ..., + query_filters: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + limit: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + scan_index_forward: Optional[Any] = ..., + select: Optional[Any] = ..., + ): ... diff --git a/third_party/2and3/pynamodb/connection/table.pyi b/third_party/2and3/pynamodb/connection/table.pyi index 0f820af9db56..2d67c9d4dbc4 100644 --- a/third_party/2and3/pynamodb/connection/table.pyi +++ b/third_party/2and3/pynamodb/connection/table.pyi @@ -3,16 +3,106 @@ from typing import Any, Optional class TableConnection: table_name: Any connection: Any - def __init__(self, table_name, region: Optional[Any] = ..., host: Optional[Any] = ..., session_cls: Optional[Any] = ..., request_timeout_seconds: Optional[Any] = ..., max_retry_attempts: Optional[Any] = ..., base_backoff_ms: Optional[Any] = ...) -> None: ... - def delete_item(self, hash_key, range_key: Optional[Any] = ..., expected: Optional[Any] = ..., conditional_operator: Optional[Any] = ..., return_values: Optional[Any] = ..., return_consumed_capacity: Optional[Any] = ..., return_item_collection_metrics: Optional[Any] = ...): ... - def update_item(self, hash_key, range_key: Optional[Any] = ..., attribute_updates: Optional[Any] = ..., expected: Optional[Any] = ..., conditional_operator: Optional[Any] = ..., return_consumed_capacity: Optional[Any] = ..., return_item_collection_metrics: Optional[Any] = ..., return_values: Optional[Any] = ...): ... - def put_item(self, hash_key, range_key: Optional[Any] = ..., attributes: Optional[Any] = ..., expected: Optional[Any] = ..., conditional_operator: Optional[Any] = ..., return_values: Optional[Any] = ..., return_consumed_capacity: Optional[Any] = ..., return_item_collection_metrics: Optional[Any] = ...): ... - def batch_write_item(self, put_items: Optional[Any] = ..., delete_items: Optional[Any] = ..., return_consumed_capacity: Optional[Any] = ..., return_item_collection_metrics: Optional[Any] = ...): ... - def batch_get_item(self, keys, consistent_read: Optional[Any] = ..., return_consumed_capacity: Optional[Any] = ..., attributes_to_get: Optional[Any] = ...): ... - def get_item(self, hash_key, range_key: Optional[Any] = ..., consistent_read: bool = ..., attributes_to_get: Optional[Any] = ...): ... - def scan(self, attributes_to_get: Optional[Any] = ..., limit: Optional[Any] = ..., conditional_operator: Optional[Any] = ..., scan_filter: Optional[Any] = ..., return_consumed_capacity: Optional[Any] = ..., segment: Optional[Any] = ..., total_segments: Optional[Any] = ..., exclusive_start_key: Optional[Any] = ...): ... - def query(self, hash_key, attributes_to_get: Optional[Any] = ..., consistent_read: bool = ..., exclusive_start_key: Optional[Any] = ..., index_name: Optional[Any] = ..., key_conditions: Optional[Any] = ..., query_filters: Optional[Any] = ..., limit: Optional[Any] = ..., return_consumed_capacity: Optional[Any] = ..., scan_index_forward: Optional[Any] = ..., conditional_operator: Optional[Any] = ..., select: Optional[Any] = ...): ... + def __init__( + self, + table_name, + region: Optional[Any] = ..., + host: Optional[Any] = ..., + session_cls: Optional[Any] = ..., + request_timeout_seconds: Optional[Any] = ..., + max_retry_attempts: Optional[Any] = ..., + base_backoff_ms: Optional[Any] = ..., + ) -> None: ... + def delete_item( + self, + hash_key, + range_key: Optional[Any] = ..., + expected: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + return_values: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + return_item_collection_metrics: Optional[Any] = ..., + ): ... + def update_item( + self, + hash_key, + range_key: Optional[Any] = ..., + attribute_updates: Optional[Any] = ..., + expected: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + return_item_collection_metrics: Optional[Any] = ..., + return_values: Optional[Any] = ..., + ): ... + def put_item( + self, + hash_key, + range_key: Optional[Any] = ..., + attributes: Optional[Any] = ..., + expected: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + return_values: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + return_item_collection_metrics: Optional[Any] = ..., + ): ... + def batch_write_item( + self, + put_items: Optional[Any] = ..., + delete_items: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + return_item_collection_metrics: Optional[Any] = ..., + ): ... + def batch_get_item( + self, + keys, + consistent_read: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + attributes_to_get: Optional[Any] = ..., + ): ... + def get_item( + self, hash_key, range_key: Optional[Any] = ..., consistent_read: bool = ..., attributes_to_get: Optional[Any] = ... + ): ... + def scan( + self, + attributes_to_get: Optional[Any] = ..., + limit: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + scan_filter: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + segment: Optional[Any] = ..., + total_segments: Optional[Any] = ..., + exclusive_start_key: Optional[Any] = ..., + ): ... + def query( + self, + hash_key, + attributes_to_get: Optional[Any] = ..., + consistent_read: bool = ..., + exclusive_start_key: Optional[Any] = ..., + index_name: Optional[Any] = ..., + key_conditions: Optional[Any] = ..., + query_filters: Optional[Any] = ..., + limit: Optional[Any] = ..., + return_consumed_capacity: Optional[Any] = ..., + scan_index_forward: Optional[Any] = ..., + conditional_operator: Optional[Any] = ..., + select: Optional[Any] = ..., + ): ... def describe_table(self): ... def delete_table(self): ... - def update_table(self, read_capacity_units: Optional[Any] = ..., write_capacity_units: Optional[Any] = ..., global_secondary_index_updates: Optional[Any] = ...): ... - def create_table(self, attribute_definitions: Optional[Any] = ..., key_schema: Optional[Any] = ..., read_capacity_units: Optional[Any] = ..., write_capacity_units: Optional[Any] = ..., global_secondary_indexes: Optional[Any] = ..., local_secondary_indexes: Optional[Any] = ..., stream_specification: Optional[Any] = ...): ... + def update_table( + self, + read_capacity_units: Optional[Any] = ..., + write_capacity_units: Optional[Any] = ..., + global_secondary_index_updates: Optional[Any] = ..., + ): ... + def create_table( + self, + attribute_definitions: Optional[Any] = ..., + key_schema: Optional[Any] = ..., + read_capacity_units: Optional[Any] = ..., + write_capacity_units: Optional[Any] = ..., + global_secondary_indexes: Optional[Any] = ..., + local_secondary_indexes: Optional[Any] = ..., + stream_specification: Optional[Any] = ..., + ): ... diff --git a/third_party/2and3/pynamodb/indexes.pyi b/third_party/2and3/pynamodb/indexes.pyi index 66e8ae772bd6..c58d6800986d 100644 --- a/third_party/2and3/pynamodb/indexes.pyi +++ b/third_party/2and3/pynamodb/indexes.pyi @@ -9,7 +9,16 @@ class Index(metaclass=IndexMeta): @classmethod def count(cls, hash_key, consistent_read: bool = ..., **filters) -> int: ... @classmethod - def query(self, hash_key, scan_index_forward: Optional[Any] = ..., consistent_read: bool = ..., limit: Optional[Any] = ..., last_evaluated_key: Optional[Any] = ..., attributes_to_get: Optional[Any] = ..., **filters): ... + def query( + self, + hash_key, + scan_index_forward: Optional[Any] = ..., + consistent_read: bool = ..., + limit: Optional[Any] = ..., + last_evaluated_key: Optional[Any] = ..., + attributes_to_get: Optional[Any] = ..., + **filters + ): ... class GlobalSecondaryIndex(Index): ... class LocalSecondaryIndex(Index): ... diff --git a/third_party/2and3/pynamodb/models.pyi b/third_party/2and3/pynamodb/models.pyi index d115c2521108..ab6784de4ea8 100644 --- a/third_party/2and3/pynamodb/models.pyi +++ b/third_party/2and3/pynamodb/models.pyi @@ -17,7 +17,7 @@ class ResultSet(Iterable): class MetaModel(type): def __init__(self, name: Text, bases: Tuple[type, ...], attrs: Dict[Any, Any]) -> None: ... -_T = TypeVar('_T', bound='Model') +_T = TypeVar("_T", bound="Model") KeyType = Union[Text, bytes, float, int, Tuple] class Model(metaclass=MetaModel): @@ -27,22 +27,62 @@ class Model(metaclass=MetaModel): @classmethod def has_map_or_list_attributes(cls: Type[_T]) -> bool: ... @classmethod - def batch_get(cls: Type[_T], items: Iterable[Union[KeyType, Iterable[KeyType]]], consistent_read: Optional[bool] = ..., attributes_to_get: Optional[Sequence[Text]] = ...) -> Iterator[_T]: ... + def batch_get( + cls: Type[_T], + items: Iterable[Union[KeyType, Iterable[KeyType]]], + consistent_read: Optional[bool] = ..., + attributes_to_get: Optional[Sequence[Text]] = ..., + ) -> Iterator[_T]: ... @classmethod def batch_write(cls: Type[_T], auto_commit: bool = ...) -> BatchWrite[_T]: ... def delete(self, condition: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., **expected_values) -> Any: ... - def update(self, attributes: Optional[Dict[Text, Dict[Text, Any]]] = ..., actions: Optional[List[Any]] = ..., condition: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., **expected_values) -> Any: ... - def update_item(self, attribute: Text, value: Optional[Any] = ..., action: Optional[Text] = ..., conditional_operator: Optional[Text] = ..., **expected_values): ... - def save(self, condition: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., **expected_values) -> Dict[str, Any]: ... + def update( + self, + attributes: Optional[Dict[Text, Dict[Text, Any]]] = ..., + actions: Optional[List[Any]] = ..., + condition: Optional[Any] = ..., + conditional_operator: Optional[Text] = ..., + **expected_values + ) -> Any: ... + def update_item( + self, + attribute: Text, + value: Optional[Any] = ..., + action: Optional[Text] = ..., + conditional_operator: Optional[Text] = ..., + **expected_values + ): ... + def save( + self, condition: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., **expected_values + ) -> Dict[str, Any]: ... def refresh(self, consistent_read: bool = ...): ... @classmethod def get(cls: Type[_T], hash_key: KeyType, range_key: Optional[KeyType] = ..., consistent_read: bool = ...) -> _T: ... @classmethod def from_raw_data(cls: Type[_T], data) -> _T: ... @classmethod - def count(cls: Type[_T], hash_key: Optional[KeyType] = ..., consistent_read: bool = ..., index_name: Optional[Text] = ..., limit: Optional[int] = ..., **filters) -> int: ... + def count( + cls: Type[_T], + hash_key: Optional[KeyType] = ..., + consistent_read: bool = ..., + index_name: Optional[Text] = ..., + limit: Optional[int] = ..., + **filters + ) -> int: ... @classmethod - def query(cls: Type[_T], hash_key: KeyType, consistent_read: bool = ..., index_name: Optional[Text] = ..., scan_index_forward: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., limit: Optional[int] = ..., last_evaluated_key: Optional[Any] = ..., attributes_to_get: Optional[Iterable[Text]] = ..., page_size: Optional[int] = ..., **filters) -> Iterator[_T]: ... + def query( + cls: Type[_T], + hash_key: KeyType, + consistent_read: bool = ..., + index_name: Optional[Text] = ..., + scan_index_forward: Optional[Any] = ..., + conditional_operator: Optional[Text] = ..., + limit: Optional[int] = ..., + last_evaluated_key: Optional[Any] = ..., + attributes_to_get: Optional[Iterable[Text]] = ..., + page_size: Optional[int] = ..., + **filters + ) -> Iterator[_T]: ... @classmethod def rate_limited_scan( cls: Type[_T], @@ -65,7 +105,16 @@ class Model(metaclass=MetaModel): **filters: Any ) -> Iterator[_T]: ... @classmethod - def scan(cls: Type[_T], segment: Optional[int] = ..., total_segments: Optional[int] = ..., limit: Optional[int] = ..., conditional_operator: Optional[Text] = ..., last_evaluated_key: Optional[Any] = ..., page_size: Optional[int] = ..., **filters) -> Iterator[_T]: ... + def scan( + cls: Type[_T], + segment: Optional[int] = ..., + total_segments: Optional[int] = ..., + limit: Optional[int] = ..., + conditional_operator: Optional[Text] = ..., + last_evaluated_key: Optional[Any] = ..., + page_size: Optional[int] = ..., + **filters + ) -> Iterator[_T]: ... @classmethod def exists(cls: Type[_T]) -> bool: ... @classmethod @@ -73,7 +122,9 @@ class Model(metaclass=MetaModel): @classmethod def describe_table(cls): ... @classmethod - def create_table(cls: Type[_T], wait: bool = ..., read_capacity_units: Optional[Any] = ..., write_capacity_units: Optional[Any] = ...): ... + def create_table( + cls: Type[_T], wait: bool = ..., read_capacity_units: Optional[Any] = ..., write_capacity_units: Optional[Any] = ... + ): ... @classmethod def dumps(cls): ... @classmethod diff --git a/third_party/2and3/pytz/__init__.pyi b/third_party/2and3/pytz/__init__.pyi index 0f35c9a838cf..4ca6cc634a16 100644 --- a/third_party/2and3/pytz/__init__.pyi +++ b/third_party/2and3/pytz/__init__.pyi @@ -28,6 +28,7 @@ class NonExistentTimeError(InvalidTimeError): ... utc: _UTCclass UTC: _UTCclass + def timezone(zone: str) -> Union[_UTCclass, _StaticTzInfo, _DstTzInfo]: ... all_timezones: List[str] diff --git a/third_party/2and3/redis/client.pyi b/third_party/2and3/redis/client.pyi index e9a07e690bf8..b2848b6f7ede 100644 --- a/third_party/2and3/redis/client.pyi +++ b/third_party/2and3/redis/client.pyi @@ -204,17 +204,7 @@ class Redis(object): def xack(self, name, groupname, *ids): ... def xadd(self, name, fields, id=..., maxlen=..., approximate=...): ... def xclaim( - self, - name, - groupname, - consumername, - min_idle_time, - message_ids, - idle=..., - time=..., - retrycount=..., - force=..., - justid=..., + self, name, groupname, consumername, min_idle_time, message_ids, idle=..., time=..., retrycount=..., force=..., justid=... ): ... def xdel(self, name, *ids): ... def xgroup_create(self, name, groupname, id=..., mkstream=...): ... diff --git a/third_party/2and3/redis/connection.pyi b/third_party/2and3/redis/connection.pyi index 7b7ddeff25d1..97742219b8c6 100644 --- a/third_party/2and3/redis/connection.pyi +++ b/third_party/2and3/redis/connection.pyi @@ -68,9 +68,23 @@ class Connection: encoding: Any encoding_errors: Any decode_responses: Any - def __init__(self, host=..., port=..., db=..., password=..., socket_timeout=..., socket_connect_timeout=..., - socket_keepalive=..., socket_keepalive_options=..., retry_on_timeout=..., encoding=..., encoding_errors=..., - decode_responses=..., parser_class=..., socket_read_size=...) -> None: ... + def __init__( + self, + host=..., + port=..., + db=..., + password=..., + socket_timeout=..., + socket_connect_timeout=..., + socket_keepalive=..., + socket_keepalive_options=..., + retry_on_timeout=..., + encoding=..., + encoding_errors=..., + decode_responses=..., + parser_class=..., + socket_read_size=..., + ) -> None: ... def __del__(self): ... def register_connect_callback(self, callback): ... def clear_connect_callbacks(self): ... @@ -104,8 +118,19 @@ class UnixDomainSocketConnection(Connection): encoding: Any encoding_errors: Any decode_responses: Any - def __init__(self, path=..., db=..., password=..., socket_timeout=..., encoding=..., encoding_errors=..., - decode_responses=..., retry_on_timeout=..., parser_class=..., socket_read_size=...) -> None: ... + def __init__( + self, + path=..., + db=..., + password=..., + socket_timeout=..., + encoding=..., + encoding_errors=..., + decode_responses=..., + retry_on_timeout=..., + parser_class=..., + socket_read_size=..., + ) -> None: ... class ConnectionPool: @classmethod diff --git a/third_party/2and3/requests/adapters.pyi b/third_party/2and3/requests/adapters.pyi index cf4a01736fb2..f504f8d64a8a 100644 --- a/third_party/2and3/requests/adapters.pyi +++ b/third_party/2and3/requests/adapters.pyi @@ -38,13 +38,15 @@ DEFAULT_RETRIES: Any class BaseAdapter: def __init__(self) -> None: ... - def send(self, - request: PreparedRequest, - stream: bool = ..., - timeout: Union[None, float, Tuple[float, float]] = ..., - verify: Union[bool, str] = ..., - cert: Union[None, Union[bytes, Text], Container[Union[bytes, Text]]] = ..., - proxies: Optional[Mapping[str, str]] = ...) -> Response: ... + def send( + self, + request: PreparedRequest, + stream: bool = ..., + timeout: Union[None, float, Tuple[float, float]] = ..., + verify: Union[bool, str] = ..., + cert: Union[None, Union[bytes, Text], Container[Union[bytes, Text]]] = ..., + proxies: Optional[Mapping[str, str]] = ..., + ) -> Response: ... def close(self) -> None: ... class HTTPAdapter(BaseAdapter): @@ -52,8 +54,7 @@ class HTTPAdapter(BaseAdapter): max_retries: Any config: Any proxy_manager: Any - def __init__(self, pool_connections=..., pool_maxsize=..., max_retries=..., - pool_block=...) -> None: ... + def __init__(self, pool_connections=..., pool_maxsize=..., max_retries=..., pool_block=...) -> None: ... poolmanager: Any def init_poolmanager(self, connections, maxsize, block=..., **pool_kwargs): ... def proxy_manager_for(self, proxy, **proxy_kwargs): ... @@ -64,10 +65,12 @@ class HTTPAdapter(BaseAdapter): def request_url(self, request, proxies): ... def add_headers(self, request, **kwargs): ... def proxy_headers(self, proxy): ... - def send(self, - request: PreparedRequest, - stream: bool = ..., - timeout: Union[None, float, Tuple[float, float]] = ..., - verify: Union[bool, str] = ..., - cert: Union[None, Union[bytes, Text], Container[Union[bytes, Text]]] = ..., - proxies: Optional[Mapping[str, str]] = ...) -> Response: ... + def send( + self, + request: PreparedRequest, + stream: bool = ..., + timeout: Union[None, float, Tuple[float, float]] = ..., + verify: Union[bool, str] = ..., + cert: Union[None, Union[bytes, Text], Container[Union[bytes, Text]]] = ..., + proxies: Optional[Mapping[str, str]] = ..., + ) -> Response: ... diff --git a/third_party/2and3/requests/api.pyi b/third_party/2and3/requests/api.pyi index 62fae3d94232..fe5198817b74 100644 --- a/third_party/2and3/requests/api.pyi +++ b/third_party/2and3/requests/api.pyi @@ -12,26 +12,25 @@ else: _ParamsMappingValueType = Union[_Text, bytes, int, float, Iterable[Union[_Text, bytes, int, float]]] _Data = Union[ - None, - _Text, - bytes, - MutableMapping[str, Any], - MutableMapping[Text, Any], - Iterable[Tuple[_Text, Optional[_Text]]], - IO + None, _Text, bytes, MutableMapping[str, Any], MutableMapping[Text, Any], Iterable[Tuple[_Text, Optional[_Text]]], IO ] def request(method: str, url: str, **kwargs) -> Response: ... -def get(url: Union[_Text, bytes], - params: Optional[ - Union[Mapping[Union[_Text, bytes, int, float], _ParamsMappingValueType], - Union[_Text, bytes], - Tuple[Union[_Text, bytes, int, float], _ParamsMappingValueType], - Mapping[_Text, _ParamsMappingValueType], - Mapping[bytes, _ParamsMappingValueType], - Mapping[int, _ParamsMappingValueType], - Mapping[float, _ParamsMappingValueType]]] = ..., - **kwargs) -> Response: ... +def get( + url: Union[_Text, bytes], + params: Optional[ + Union[ + Mapping[Union[_Text, bytes, int, float], _ParamsMappingValueType], + Union[_Text, bytes], + Tuple[Union[_Text, bytes, int, float], _ParamsMappingValueType], + Mapping[_Text, _ParamsMappingValueType], + Mapping[bytes, _ParamsMappingValueType], + Mapping[int, _ParamsMappingValueType], + Mapping[float, _ParamsMappingValueType], + ] + ] = ..., + **kwargs +) -> Response: ... def options(url: _Text, **kwargs) -> Response: ... def head(url: _Text, **kwargs) -> Response: ... def post(url: _Text, data: _Data = ..., json=..., **kwargs) -> Response: ... diff --git a/third_party/2and3/requests/models.pyi b/third_party/2and3/requests/models.pyi index 275fbdaea7c0..7cfc2d4b4a1d 100644 --- a/third_party/2and3/requests/models.pyi +++ b/third_party/2and3/requests/models.pyi @@ -65,8 +65,9 @@ class Request(RequestHooksMixin): params: Any auth: Any cookies: Any - def __init__(self, method=..., url=..., headers=..., files=..., data=..., params=..., - auth=..., cookies=..., hooks=..., json=...) -> None: ... + def __init__( + self, method=..., url=..., headers=..., files=..., data=..., params=..., auth=..., cookies=..., hooks=..., json=... + ) -> None: ... def prepare(self): ... class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): @@ -76,8 +77,9 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): body: Optional[Union[bytes, Text]] hooks: Any def __init__(self) -> None: ... - def prepare(self, method=..., url=..., headers=..., files=..., data=..., params=..., - auth=..., cookies=..., hooks=..., json=...): ... + def prepare( + self, method=..., url=..., headers=..., files=..., data=..., params=..., auth=..., cookies=..., hooks=..., json=... + ): ... def copy(self): ... def prepare_method(self, method): ... def prepare_url(self, url, params): ... @@ -114,12 +116,10 @@ class Response: def is_permanent_redirect(self) -> bool: ... @property def apparent_encoding(self) -> str: ... - def iter_content(self, chunk_size: Optional[int] = ..., - decode_unicode: bool = ...) -> Iterator[Any]: ... - def iter_lines(self, - chunk_size: Optional[int] = ..., - decode_unicode: bool = ..., - delimiter: Union[Text, bytes] = ...) -> Iterator[Any]: ... + def iter_content(self, chunk_size: Optional[int] = ..., decode_unicode: bool = ...) -> Iterator[Any]: ... + def iter_lines( + self, chunk_size: Optional[int] = ..., decode_unicode: bool = ..., delimiter: Union[Text, bytes] = ... + ) -> Iterator[Any]: ... @property def content(self) -> bytes: ... @property diff --git a/third_party/2and3/requests/packages/urllib3/connection.pyi b/third_party/2and3/requests/packages/urllib3/connection.pyi index d7d23c952a27..511164769428 100644 --- a/third_party/2and3/requests/packages/urllib3/connection.pyi +++ b/third_party/2and3/requests/packages/urllib3/connection.pyi @@ -11,14 +11,13 @@ from .util import ssl_ if sys.version_info < (3, 0): from httplib import HTTPConnection as _HTTPConnection from httplib import HTTPException as HTTPException - class ConnectionError(Exception): ... + else: from http.client import HTTPConnection as _HTTPConnection from http.client import HTTPException as HTTPException from builtins import ConnectionError as ConnectionError - class DummyConnection: ... BaseSSLError = ssl.SSLError diff --git a/third_party/2and3/requests/packages/urllib3/connectionpool.pyi b/third_party/2and3/requests/packages/urllib3/connectionpool.pyi index 955378035718..a73899d2b60e 100644 --- a/third_party/2and3/requests/packages/urllib3/connectionpool.pyi +++ b/third_party/2and3/requests/packages/urllib3/connectionpool.pyi @@ -58,10 +58,36 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods): num_connections: Any num_requests: Any conn_kw: Any - def __init__(self, host, port=..., strict=..., timeout=..., maxsize=..., block=..., headers=..., retries=..., _proxy=..., _proxy_headers=..., **conn_kw) -> None: ... + def __init__( + self, + host, + port=..., + strict=..., + timeout=..., + maxsize=..., + block=..., + headers=..., + retries=..., + _proxy=..., + _proxy_headers=..., + **conn_kw + ) -> None: ... def close(self): ... def is_same_host(self, url): ... - def urlopen(self, method, url, body=..., headers=..., retries=..., redirect=..., assert_same_host=..., timeout=..., pool_timeout=..., release_conn=..., **response_kw): ... + def urlopen( + self, + method, + url, + body=..., + headers=..., + retries=..., + redirect=..., + assert_same_host=..., + timeout=..., + pool_timeout=..., + release_conn=..., + **response_kw + ): ... class HTTPSConnectionPool(HTTPConnectionPool): scheme: Any @@ -73,6 +99,26 @@ class HTTPSConnectionPool(HTTPConnectionPool): ssl_version: Any assert_hostname: Any assert_fingerprint: Any - def __init__(self, host, port=..., strict=..., timeout=..., maxsize=..., block=..., headers=..., retries=..., _proxy=..., _proxy_headers=..., key_file=..., cert_file=..., cert_reqs=..., ca_certs=..., ssl_version=..., assert_hostname=..., assert_fingerprint=..., **conn_kw) -> None: ... + def __init__( + self, + host, + port=..., + strict=..., + timeout=..., + maxsize=..., + block=..., + headers=..., + retries=..., + _proxy=..., + _proxy_headers=..., + key_file=..., + cert_file=..., + cert_reqs=..., + ca_certs=..., + ssl_version=..., + assert_hostname=..., + assert_fingerprint=..., + **conn_kw + ) -> None: ... def connection_from_url(url, **kw): ... diff --git a/third_party/2and3/requests/packages/urllib3/request.pyi b/third_party/2and3/requests/packages/urllib3/request.pyi index fd79126df93c..b95ab295ba84 100644 --- a/third_party/2and3/requests/packages/urllib3/request.pyi +++ b/third_party/2and3/requests/packages/urllib3/request.pyi @@ -6,4 +6,6 @@ class RequestMethods: def urlopen(self, method, url, body=..., headers=..., encode_multipart=..., multipart_boundary=..., **kw): ... def request(self, method, url, fields=..., headers=..., **urlopen_kw): ... def request_encode_url(self, method, url, fields=..., **urlopen_kw): ... - def request_encode_body(self, method, url, fields=..., headers=..., encode_multipart=..., multipart_boundary=..., **urlopen_kw): ... + def request_encode_body( + self, method, url, fields=..., headers=..., encode_multipart=..., multipart_boundary=..., **urlopen_kw + ): ... diff --git a/third_party/2and3/requests/packages/urllib3/response.pyi b/third_party/2and3/requests/packages/urllib3/response.pyi index 56c63f2f9432..d4a4e5bf0b17 100644 --- a/third_party/2and3/requests/packages/urllib3/response.pyi +++ b/third_party/2and3/requests/packages/urllib3/response.pyi @@ -33,7 +33,20 @@ class HTTPResponse(io.IOBase): reason: Any strict: Any decode_content: Any - def __init__(self, body=..., headers=..., status=..., version=..., reason=..., strict=..., preload_content=..., decode_content=..., original_response=..., pool=..., connection=...) -> None: ... + def __init__( + self, + body=..., + headers=..., + status=..., + version=..., + reason=..., + strict=..., + preload_content=..., + decode_content=..., + original_response=..., + pool=..., + connection=..., + ) -> None: ... def get_redirect_location(self): ... def release_conn(self): ... @property diff --git a/third_party/2and3/requests/packages/urllib3/util/request.pyi b/third_party/2and3/requests/packages/urllib3/util/request.pyi index 9cafcaa181f5..f770cd9faa73 100644 --- a/third_party/2and3/requests/packages/urllib3/util/request.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/request.pyi @@ -6,4 +6,6 @@ from typing import Any ACCEPT_ENCODING: Any -def make_headers(keep_alive=..., accept_encoding=..., user_agent=..., basic_auth=..., proxy_basic_auth=..., disable_cache=...): ... +def make_headers( + keep_alive=..., accept_encoding=..., user_agent=..., basic_auth=..., proxy_basic_auth=..., disable_cache=... +): ... diff --git a/third_party/2and3/requests/packages/urllib3/util/retry.pyi b/third_party/2and3/requests/packages/urllib3/util/retry.pyi index 1aac0913033c..04ddcb681c5c 100644 --- a/third_party/2and3/requests/packages/urllib3/util/retry.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/retry.pyi @@ -21,7 +21,18 @@ class Retry: method_whitelist: Any backoff_factor: Any raise_on_redirect: Any - def __init__(self, total=..., connect=..., read=..., redirect=..., method_whitelist=..., status_forcelist=..., backoff_factor=..., raise_on_redirect=..., _observed_errors=...) -> None: ... + def __init__( + self, + total=..., + connect=..., + read=..., + redirect=..., + method_whitelist=..., + status_forcelist=..., + backoff_factor=..., + raise_on_redirect=..., + _observed_errors=..., + ) -> None: ... def new(self, **kw): ... @classmethod def from_int(cls, retries, redirect=..., default=...): ... diff --git a/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi b/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi index b259338984bd..1542e91da79a 100644 --- a/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi +++ b/third_party/2and3/requests/packages/urllib3/util/ssl_.pyi @@ -17,5 +17,14 @@ def assert_fingerprint(cert, fingerprint): ... def resolve_cert_reqs(candidate): ... def resolve_ssl_version(candidate): ... def create_urllib3_context(ssl_version=..., cert_reqs=..., options=..., ciphers=...): ... -def ssl_wrap_socket(sock, keyfile=..., certfile=..., cert_reqs=..., ca_certs=..., - server_hostname=..., ssl_version=..., ciphers=..., ssl_context=...): ... +def ssl_wrap_socket( + sock, + keyfile=..., + certfile=..., + cert_reqs=..., + ca_certs=..., + server_hostname=..., + ssl_version=..., + ciphers=..., + ssl_context=..., +): ... diff --git a/third_party/2and3/requests/sessions.pyi b/third_party/2and3/requests/sessions.pyi index 9110ab5f7750..56cbc4b36aab 100644 --- a/third_party/2and3/requests/sessions.pyi +++ b/third_party/2and3/requests/sessions.pyi @@ -43,8 +43,7 @@ def merge_setting(request_setting, session_setting, dict_class=...): ... def merge_hooks(request_hooks, session_hooks, dict_class=...): ... class SessionRedirectMixin: - def resolve_redirects(self, resp, req, stream=..., timeout=..., verify=..., cert=..., - proxies=...): ... + def resolve_redirects(self, resp, req, stream=..., timeout=..., verify=..., cert=..., proxies=...): ... def rebuild_auth(self, prepared_request, response): ... def rebuild_proxies(self, prepared_request, proxies): ... @@ -73,22 +72,25 @@ class Session(SessionRedirectMixin): def __enter__(self) -> Session: ... def __exit__(self, *args) -> None: ... def prepare_request(self, request): ... - def request(self, method: str, url: str, - params: Union[None, bytes, MutableMapping[Text, Text]] = ..., - data: _Data = ..., - headers: Optional[MutableMapping[Text, Text]] = ..., - cookies: Union[None, RequestsCookieJar, MutableMapping[Text, Text]] = ..., - files: Optional[MutableMapping[Text, IO]] = ..., - auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] = ..., - timeout: Union[None, float, Tuple[float, float]] = ..., - allow_redirects: Optional[bool] = ..., - proxies: Optional[MutableMapping[Text, Text]] = ..., - hooks: Optional[_HooksInput] = ..., - stream: Optional[bool] = ..., - verify: Union[None, bool, Text] = ..., - cert: Union[Text, Tuple[Text, Text], None] = ..., - json: Optional[Any] = ..., - ) -> Response: ... + def request( + self, + method: str, + url: str, + params: Union[None, bytes, MutableMapping[Text, Text]] = ..., + data: _Data = ..., + headers: Optional[MutableMapping[Text, Text]] = ..., + cookies: Union[None, RequestsCookieJar, MutableMapping[Text, Text]] = ..., + files: Optional[MutableMapping[Text, IO]] = ..., + auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] = ..., + timeout: Union[None, float, Tuple[float, float]] = ..., + allow_redirects: Optional[bool] = ..., + proxies: Optional[MutableMapping[Text, Text]] = ..., + hooks: Optional[_HooksInput] = ..., + stream: Optional[bool] = ..., + verify: Union[None, bool, Text] = ..., + cert: Union[Text, Tuple[Text, Text], None] = ..., + json: Optional[Any] = ..., + ) -> Response: ... def get(self, url: Union[Text, bytes], **kwargs) -> Response: ... def options(self, url: Union[Text, bytes], **kwargs) -> Response: ... def head(self, url: Union[Text, bytes], **kwargs) -> Response: ... @@ -100,8 +102,6 @@ class Session(SessionRedirectMixin): def merge_environment_settings(self, url, proxies, stream, verify, cert): ... def get_adapter(self, url): ... def close(self) -> None: ... - def mount(self, prefix: - Union[Text, bytes], - adapter: BaseAdapter) -> None: ... + def mount(self, prefix: Union[Text, bytes], adapter: BaseAdapter) -> None: ... def session() -> Session: ... diff --git a/third_party/2and3/requests/structures.pyi b/third_party/2and3/requests/structures.pyi index 50a17217c2f2..b56a66604d72 100644 --- a/third_party/2and3/requests/structures.pyi +++ b/third_party/2and3/requests/structures.pyi @@ -1,6 +1,6 @@ from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, MutableMapping, Optional, Tuple, TypeVar, Union -_VT = TypeVar('_VT') +_VT = TypeVar("_VT") class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]): def __init__(self, data: Optional[Union[Mapping[str, _VT], Iterable[Tuple[str, _VT]]]] = ..., **kwargs: _VT) -> None: ... diff --git a/third_party/2and3/simplejson/__init__.pyi b/third_party/2and3/simplejson/__init__.pyi index 4073b387f904..df3c404ad4ab 100644 --- a/third_party/2and3/simplejson/__init__.pyi +++ b/third_party/2and3/simplejson/__init__.pyi @@ -7,7 +7,6 @@ from simplejson.scanner import JSONDecodeError as JSONDecodeError _LoadsString = Union[Text, bytes, bytearray] - def dumps(obj: Any, *args: Any, **kwds: Any) -> str: ... def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ... def loads(s: _LoadsString, **kwds: Any) -> Any: ... diff --git a/third_party/2and3/singledispatch.pyi b/third_party/2and3/singledispatch.pyi index daf3b85df899..eade74ae5bcb 100644 --- a/third_party/2and3/singledispatch.pyi +++ b/third_party/2and3/singledispatch.pyi @@ -2,7 +2,6 @@ from typing import Any, Callable, Generic, Mapping, Optional, TypeVar, overload _T = TypeVar("_T") - class _SingleDispatchCallable(Generic[_T]): registry: Mapping[Any, Callable[..., _T]] def dispatch(self, cls: Any) -> Callable[..., _T]: ... diff --git a/third_party/2and3/tabulate.pyi b/third_party/2and3/tabulate.pyi index 05db37713ac7..f075de17adb5 100644 --- a/third_party/2and3/tabulate.pyi +++ b/third_party/2and3/tabulate.pyi @@ -2,7 +2,6 @@ from typing import Any, Dict, Iterable, Sequence, Union def __getattr__(name: str) -> Any: ... - def tabulate( tabular_data: Iterable[Iterable[Any]], headers: Union[str, Dict[str, str], Sequence[str]] = ..., @@ -12,6 +11,5 @@ def tabulate( stralign: str = ..., missingval: str = ..., showindex: str = ..., - disable_numparse: bool = ... -) -> str: - ... + disable_numparse: bool = ..., +) -> str: ... diff --git a/third_party/2and3/termcolor.pyi b/third_party/2and3/termcolor.pyi index f0dfa022bc5a..e5ef87f54d9b 100644 --- a/third_party/2and3/termcolor.pyi +++ b/third_party/2and3/termcolor.pyi @@ -2,19 +2,8 @@ from typing import Any, Iterable, Optional, Text def colored( - text: Text, - color: Optional[Text] = ..., - on_color: Optional[Text] = ..., - attrs: Optional[Iterable[Text]] = ..., -) -> Text: - ... - - + text: Text, color: Optional[Text] = ..., on_color: Optional[Text] = ..., attrs: Optional[Iterable[Text]] = ... +) -> Text: ... def cprint( - text: Text, - color: Optional[Text] = ..., - on_color: Optional[Text] = ..., - attrs: Optional[Iterable[Text]] = ..., - **kwargs: Any, -) -> None: - ... + text: Text, color: Optional[Text] = ..., on_color: Optional[Text] = ..., attrs: Optional[Iterable[Text]] = ..., **kwargs: Any +) -> None: ... diff --git a/third_party/2and3/toml.pyi b/third_party/2and3/toml.pyi index 307cfc755006..50db5dedc053 100644 --- a/third_party/2and3/toml.pyi +++ b/third_party/2and3/toml.pyi @@ -4,8 +4,10 @@ from typing import IO, Any, List, Mapping, MutableMapping, Optional, Protocol, T if sys.version_info >= (3, 4): import pathlib + if sys.version_info >= (3, 6): import os + _PathLike = Union[Text, pathlib.PurePath, os.PathLike] else: _PathLike = Union[Text, pathlib.PurePath] @@ -19,6 +21,5 @@ class TomlDecodeError(Exception): ... def load(f: Union[_PathLike, List[Text], IO[str]], _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ... def loads(s: Text, _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ... - def dump(o: Mapping[str, Any], f: _Writable) -> str: ... def dumps(o: Mapping[str, Any]) -> str: ... diff --git a/third_party/2and3/typing_extensions.pyi b/third_party/2and3/typing_extensions.pyi index 19211e559c2b..68639b2932f7 100644 --- a/third_party/2and3/typing_extensions.pyi +++ b/third_party/2and3/typing_extensions.pyi @@ -15,16 +15,22 @@ from typing import Type as Type from typing import TypeVar, ValuesView from typing import overload as overload -_T = TypeVar('_T') -_F = TypeVar('_F', bound=Callable[..., Any]) -_TC = TypeVar('_TC', bound=Type[object]) +_T = TypeVar("_T") +_F = TypeVar("_F", bound=Callable[..., Any]) +_TC = TypeVar("_TC", bound=Type[object]) + class _SpecialForm: def __getitem__(self, typeargs: Any) -> Any: ... + def runtime(cls: _TC) -> _TC: ... + Protocol: _SpecialForm = ... Final: _SpecialForm = ... + def final(f: _F) -> _F: ... + Literal: _SpecialForm = ... + def IntVar(__name: str) -> Type: ... # Internal mypy fallback type for all typed dicts (does not exist at runtime) diff --git a/third_party/2and3/ujson.pyi b/third_party/2and3/ujson.pyi index c364cea06475..b9c08f4d0e84 100644 --- a/third_party/2and3/ujson.pyi +++ b/third_party/2and3/ujson.pyi @@ -13,7 +13,6 @@ def encode( sort_keys: bool = ..., indent: int = ..., ) -> str: ... - def dumps( obj: Any, ensure_ascii: bool = ..., @@ -23,7 +22,6 @@ def dumps( sort_keys: bool = ..., indent: int = ..., ) -> str: ... - def dump( obj: Any, fp: IO[str], @@ -34,18 +32,6 @@ def dump( sort_keys: bool = ..., indent: int = ..., ) -> None: ... - -def decode( - s: AnyStr, - precise_float: bool = ..., -) -> Any: ... - -def loads( - s: AnyStr, - precise_float: bool = ..., -) -> Any: ... - -def load( - fp: IO[AnyStr], - precise_float: bool = ..., -) -> Any: ... +def decode(s: AnyStr, precise_float: bool = ...) -> Any: ... +def loads(s: AnyStr, precise_float: bool = ...) -> Any: ... +def load(fp: IO[AnyStr], precise_float: bool = ...) -> Any: ... diff --git a/third_party/2and3/werkzeug/__init__.pyi b/third_party/2and3/werkzeug/__init__.pyi index 6632ff4984ad..8c351ab47609 100644 --- a/third_party/2and3/werkzeug/__init__.pyi +++ b/third_party/2and3/werkzeug/__init__.pyi @@ -24,7 +24,6 @@ class module(ModuleType): def __getattr__(self, name): ... def __dir__(self): ... - __version__: Any run_simple = serving.run_simple diff --git a/third_party/2and3/werkzeug/_internal.pyi b/third_party/2and3/werkzeug/_internal.pyi index 64f63a1dc3e0..ed23d7e136a5 100644 --- a/third_party/2and3/werkzeug/_internal.pyi +++ b/third_party/2and3/werkzeug/_internal.pyi @@ -10,8 +10,15 @@ class _DictAccessorProperty: load_func: Any dump_func: Any __doc__: Any - def __init__(self, name, default: Optional[Any] = ..., load_func: Optional[Any] = ..., dump_func: Optional[Any] = ..., - read_only: Optional[Any] = ..., doc: Optional[Any] = ...): ... + def __init__( + self, + name, + default: Optional[Any] = ..., + load_func: Optional[Any] = ..., + dump_func: Optional[Any] = ..., + read_only: Optional[Any] = ..., + doc: Optional[Any] = ..., + ): ... def __get__(self, obj, type: Optional[Any] = ...): ... def __set__(self, obj, value): ... def __delete__(self, obj): ... diff --git a/third_party/2and3/werkzeug/contrib/cache.pyi b/third_party/2and3/werkzeug/contrib/cache.pyi index 9ef76dae9da6..fd02f48b3d80 100644 --- a/third_party/2and3/werkzeug/contrib/cache.pyi +++ b/third_party/2and3/werkzeug/contrib/cache.pyi @@ -48,8 +48,16 @@ GAEMemcachedCache: Any class RedisCache(BaseCache): key_prefix: Any - def __init__(self, host: str = ..., port: int = ..., password: Optional[Any] = ..., db: int = ..., - default_timeout: float = ..., key_prefix: Optional[Any] = ..., **kwargs): ... + def __init__( + self, + host: str = ..., + port: int = ..., + password: Optional[Any] = ..., + db: int = ..., + default_timeout: float = ..., + key_prefix: Optional[Any] = ..., + **kwargs + ): ... def dump_object(self, value): ... def load_object(self, value): ... def get(self, key): ... diff --git a/third_party/2and3/werkzeug/contrib/profiler.pyi b/third_party/2and3/werkzeug/contrib/profiler.pyi index 601c4f1bf46d..5704b5b5abb4 100644 --- a/third_party/2and3/werkzeug/contrib/profiler.pyi +++ b/third_party/2and3/werkzeug/contrib/profiler.pyi @@ -11,5 +11,13 @@ class ProfilerMiddleware: def __init__(self, app, stream: Optional[Any] = ..., sort_by=..., restrictions=..., profile_dir: Optional[Any] = ...): ... def __call__(self, environ, start_response): ... -def make_action(app_factory, hostname: str = ..., port: int = ..., threaded: bool = ..., processes: int = ..., - stream: Optional[Any] = ..., sort_by=..., restrictions=...): ... +def make_action( + app_factory, + hostname: str = ..., + port: int = ..., + threaded: bool = ..., + processes: int = ..., + stream: Optional[Any] = ..., + sort_by=..., + restrictions=..., +): ... diff --git a/third_party/2and3/werkzeug/contrib/securecookie.pyi b/third_party/2and3/werkzeug/contrib/securecookie.pyi index bd768a7aee53..a3765e313257 100644 --- a/third_party/2and3/werkzeug/contrib/securecookie.pyi +++ b/third_party/2and3/werkzeug/contrib/securecookie.pyi @@ -24,6 +24,16 @@ class SecureCookie(ModificationTrackingDict): def unserialize(cls, string, secret_key): ... @classmethod def load_cookie(cls, request, key: str = ..., secret_key: Optional[Any] = ...): ... - def save_cookie(self, response, key: str = ..., expires: Optional[Any] = ..., session_expires: Optional[Any] = ..., - max_age: Optional[Any] = ..., path: str = ..., domain: Optional[Any] = ..., secure: Optional[Any] = ..., - httponly: bool = ..., force: bool = ...): ... + def save_cookie( + self, + response, + key: str = ..., + expires: Optional[Any] = ..., + session_expires: Optional[Any] = ..., + max_age: Optional[Any] = ..., + path: str = ..., + domain: Optional[Any] = ..., + secure: Optional[Any] = ..., + httponly: bool = ..., + force: bool = ..., + ): ... diff --git a/third_party/2and3/werkzeug/contrib/sessions.pyi b/third_party/2and3/werkzeug/contrib/sessions.pyi index 9abfed3ba6f7..64c947515761 100644 --- a/third_party/2and3/werkzeug/contrib/sessions.pyi +++ b/third_party/2and3/werkzeug/contrib/sessions.pyi @@ -33,8 +33,14 @@ class FilesystemSessionStore(SessionStore): filename_template: str renew_missing: Any mode: Any - def __init__(self, path: Optional[Any] = ..., filename_template: Text = ..., session_class: Optional[Any] = ..., - renew_missing: bool = ..., mode: int = ...): ... + def __init__( + self, + path: Optional[Any] = ..., + filename_template: Text = ..., + session_class: Optional[Any] = ..., + renew_missing: bool = ..., + mode: int = ..., + ): ... def get_session_filename(self, sid): ... def save(self, session): ... def delete(self, session): ... @@ -52,7 +58,17 @@ class SessionMiddleware: cookie_secure: Any cookie_httponly: Any environ_key: Any - def __init__(self, app, store, cookie_name: str = ..., cookie_age: Optional[Any] = ..., cookie_expires: Optional[Any] = ..., - cookie_path: str = ..., cookie_domain: Optional[Any] = ..., cookie_secure: Optional[Any] = ..., - cookie_httponly: bool = ..., environ_key: str = ...): ... + def __init__( + self, + app, + store, + cookie_name: str = ..., + cookie_age: Optional[Any] = ..., + cookie_expires: Optional[Any] = ..., + cookie_path: str = ..., + cookie_domain: Optional[Any] = ..., + cookie_secure: Optional[Any] = ..., + cookie_httponly: bool = ..., + environ_key: str = ..., + ): ... def __call__(self, environ, start_response): ... diff --git a/third_party/2and3/werkzeug/datastructures.pyi b/third_party/2and3/werkzeug/datastructures.pyi index a9b3acd5252a..47301c90faf7 100644 --- a/third_party/2and3/werkzeug/datastructures.pyi +++ b/third_party/2and3/werkzeug/datastructures.pyi @@ -388,8 +388,9 @@ class WWWAuthenticate(UpdateDictMixin, dict): on_update: Any def __init__(self, auth_type: Optional[Any] = ..., values: Optional[Any] = ..., on_update: Optional[Any] = ...): ... def set_basic(self, realm: str = ...): ... - def set_digest(self, realm, nonce, qop=..., opaque: Optional[Any] = ..., algorithm: Optional[Any] = ..., - stale: bool = ...): ... + def set_digest( + self, realm, nonce, qop=..., opaque: Optional[Any] = ..., algorithm: Optional[Any] = ..., stale: bool = ... + ): ... def to_header(self): ... @staticmethod def auth_property(name, doc: Optional[Any] = ...): ... @@ -407,8 +408,15 @@ class FileStorage: stream: Any filename: Any headers: Any - def __init__(self, stream: Optional[Any] = ..., filename: Optional[Any] = ..., name: Optional[Any] = ..., - content_type: Optional[Any] = ..., content_length: Optional[Any] = ..., headers: Optional[Any] = ...): ... + def __init__( + self, + stream: Optional[Any] = ..., + filename: Optional[Any] = ..., + name: Optional[Any] = ..., + content_type: Optional[Any] = ..., + content_length: Optional[Any] = ..., + headers: Optional[Any] = ..., + ): ... @property def content_type(self): ... @property diff --git a/third_party/2and3/werkzeug/debug/__init__.pyi b/third_party/2and3/werkzeug/debug/__init__.pyi index ae346a94b4ae..7c165498f8cf 100644 --- a/third_party/2and3/werkzeug/debug/__init__.pyi +++ b/third_party/2and3/werkzeug/debug/__init__.pyi @@ -27,9 +27,18 @@ class DebuggedApplication: secret: Any pin_logging: Any pin: Any - def __init__(self, app, evalex: bool = ..., request_key: str = ..., console_path: str = ..., - console_init_func: Optional[Any] = ..., show_hidden_frames: bool = ..., lodgeit_url: Optional[Any] = ..., - pin_security: bool = ..., pin_logging: bool = ...): ... + def __init__( + self, + app, + evalex: bool = ..., + request_key: str = ..., + console_path: str = ..., + console_init_func: Optional[Any] = ..., + show_hidden_frames: bool = ..., + lodgeit_url: Optional[Any] = ..., + pin_security: bool = ..., + pin_logging: bool = ..., + ): ... @property def pin_cookie_name(self): ... def debug_application(self, environ, start_response): ... diff --git a/third_party/2and3/werkzeug/formparser.pyi b/third_party/2and3/werkzeug/formparser.pyi index d0e6a739170f..4d0d09a86fbc 100644 --- a/third_party/2and3/werkzeug/formparser.pyi +++ b/third_party/2and3/werkzeug/formparser.pyi @@ -1,9 +1,16 @@ from typing import Any, Optional, Text def default_stream_factory(total_content_length, filename, content_type, content_length: Optional[Any] = ...): ... -def parse_form_data(environ, stream_factory: Optional[Any] = ..., charset: Text = ..., errors: Text = ..., - max_form_memory_size: Optional[Any] = ..., max_content_length: Optional[Any] = ..., - cls: Optional[Any] = ..., silent: bool = ...): ... +def parse_form_data( + environ, + stream_factory: Optional[Any] = ..., + charset: Text = ..., + errors: Text = ..., + max_form_memory_size: Optional[Any] = ..., + max_content_length: Optional[Any] = ..., + cls: Optional[Any] = ..., + silent: bool = ..., +): ... def exhaust_stream(f): ... class FormDataParser: @@ -14,9 +21,16 @@ class FormDataParser: max_content_length: Any cls: Any silent: Any - def __init__(self, stream_factory: Optional[Any] = ..., charset: Text = ..., errors: Text = ..., - max_form_memory_size: Optional[Any] = ..., max_content_length: Optional[Any] = ..., cls: Optional[Any] = ..., - silent: bool = ...): ... + def __init__( + self, + stream_factory: Optional[Any] = ..., + charset: Text = ..., + errors: Text = ..., + max_form_memory_size: Optional[Any] = ..., + max_content_length: Optional[Any] = ..., + cls: Optional[Any] = ..., + silent: bool = ..., + ): ... def get_parse_func(self, mimetype, options): ... def parse_from_environ(self, environ): ... def parse(self, stream, mimetype, content_length, options: Optional[Any] = ...): ... @@ -32,8 +46,15 @@ class MultiPartParser: stream_factory: Any cls: Any buffer_size: Any - def __init__(self, stream_factory: Optional[Any] = ..., charset: Text = ..., errors: Text = ..., - max_form_memory_size: Optional[Any] = ..., cls: Optional[Any] = ..., buffer_size=...): ... + def __init__( + self, + stream_factory: Optional[Any] = ..., + charset: Text = ..., + errors: Text = ..., + max_form_memory_size: Optional[Any] = ..., + cls: Optional[Any] = ..., + buffer_size=..., + ): ... def fail(self, message): ... def get_part_encoding(self, headers): ... def get_part_charset(self, headers) -> Text: ... diff --git a/third_party/2and3/werkzeug/http.pyi b/third_party/2and3/werkzeug/http.pyi index a6ff85ddc0af..54428b7118d4 100644 --- a/third_party/2and3/werkzeug/http.pyi +++ b/third_party/2and3/werkzeug/http.pyi @@ -34,7 +34,7 @@ from .datastructures import ( ) if sys.version_info < (3,): - _Str = TypeVar('_Str', str, unicode) + _Str = TypeVar("_Str", str, unicode) _ToBytes = Union[bytes, bytearray, buffer, unicode] _ETagData = Union[str, unicode, bytearray, buffer, memoryview] else: @@ -62,6 +62,7 @@ def parse_dict_header(value: Union[bytes, Text], cls: Type[_T]) -> _T: ... def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, Dict[str, Optional[str]]]: ... @overload def parse_options_header(value: _Str) -> Tuple[_Str, Dict[_Str, Optional[_Str]]]: ... + # actually returns Tuple[_Str, Dict[_Str, Optional[_Str]], ...] @overload def parse_options_header(value: _Str, multiple: bool = ...) -> Tuple[Any, ...]: ... @@ -70,22 +71,27 @@ def parse_accept_header(value: Optional[Text]) -> Accept: ... @overload def parse_accept_header(value: Optional[_Str], cls: Callable[[Optional[_Str]], _T]) -> _T: ... @overload -def parse_cache_control_header(value: Union[None, bytes, Text], - on_update: Optional[Callable[[RequestCacheControl], Any]] = ...) -> RequestCacheControl: ... +def parse_cache_control_header( + value: Union[None, bytes, Text], on_update: Optional[Callable[[RequestCacheControl], Any]] = ... +) -> RequestCacheControl: ... @overload -def parse_cache_control_header(value: Union[None, bytes, Text], on_update: _T, - cls: Callable[[Dict[Text, Optional[Text]], _T], _U]) -> _U: ... +def parse_cache_control_header( + value: Union[None, bytes, Text], on_update: _T, cls: Callable[[Dict[Text, Optional[Text]], _T], _U] +) -> _U: ... @overload -def parse_cache_control_header(value: Union[None, bytes, Text], *, - cls: Callable[[Dict[Text, Optional[Text]], None], _U]) -> _U: ... +def parse_cache_control_header( + value: Union[None, bytes, Text], *, cls: Callable[[Dict[Text, Optional[Text]], None], _U] +) -> _U: ... def parse_set_header(value: Text, on_update: Optional[Callable[[HeaderSet], Any]] = ...) -> HeaderSet: ... def parse_authorization_header(value: Union[None, bytes, Text]) -> Optional[Authorization]: ... -def parse_www_authenticate_header(value: Union[None, bytes, Text], - on_update: Optional[Callable[[WWWAuthenticate], Any]] = ...) -> WWWAuthenticate: ... +def parse_www_authenticate_header( + value: Union[None, bytes, Text], on_update: Optional[Callable[[WWWAuthenticate], Any]] = ... +) -> WWWAuthenticate: ... def parse_if_range_header(value: Optional[Text]) -> IfRange: ... def parse_range_header(value: Optional[Text], make_inclusive: bool = ...) -> Optional[Range]: ... -def parse_content_range_header(value: Optional[Text], - on_update: Optional[Callable[[ContentRange], Any]] = ...) -> Optional[ContentRange]: ... +def parse_content_range_header( + value: Optional[Text], on_update: Optional[Callable[[ContentRange], Any]] = ... +) -> Optional[ContentRange]: ... def quote_etag(etag: _Str, weak: bool = ...) -> _Str: ... def unquote_etag(etag: Optional[_Str]) -> Tuple[Optional[_Str], Optional[_Str]]: ... def parse_etags(value: Optional[Text]) -> ETags: ... @@ -95,20 +101,38 @@ def cookie_date(expires: Union[None, float, datetime] = ...) -> str: ... def http_date(timestamp: Union[None, float, datetime] = ...) -> str: ... def parse_age(value: Optional[SupportsInt] = ...) -> Optional[timedelta]: ... def dump_age(age: Union[None, timedelta, SupportsInt]) -> Optional[str]: ... -def is_resource_modified(environ: WSGIEnvironment, etag: Optional[Text] = ..., data: Optional[_ETagData] = ..., - last_modified: Union[None, Text, datetime] = ..., ignore_if_range: bool = ...) -> bool: ... +def is_resource_modified( + environ: WSGIEnvironment, + etag: Optional[Text] = ..., + data: Optional[_ETagData] = ..., + last_modified: Union[None, Text, datetime] = ..., + ignore_if_range: bool = ..., +) -> bool: ... def remove_entity_headers(headers: Union[List[Tuple[Text, Text]], Headers], allowed: Iterable[Text] = ...) -> None: ... def remove_hop_by_hop_headers(headers: Union[List[Tuple[Text, Text]], Headers]) -> None: ... def is_entity_header(header: Text) -> bool: ... def is_hop_by_hop_header(header: Text) -> bool: ... @overload -def parse_cookie(header: Union[None, WSGIEnvironment, Text, bytes], charset: Text = ..., - errors: Text = ...) -> TypeConversionDict: ... +def parse_cookie( + header: Union[None, WSGIEnvironment, Text, bytes], charset: Text = ..., errors: Text = ... +) -> TypeConversionDict: ... @overload -def parse_cookie(header: Union[None, WSGIEnvironment, Text, bytes], charset: Text = ..., - errors: Text = ..., cls: Optional[Callable[[Iterable[Tuple[Text, Text]]], _T]] = ...) -> _T: ... -def dump_cookie(key: _ToBytes, value: _ToBytes = ..., max_age: Union[None, float, timedelta] = ..., - expires: Union[None, Text, float, datetime] = ..., path: Union[None, tuple, str, bytes] = ..., - domain: Union[None, str, bytes] = ..., secure: bool = ..., httponly: bool = ..., charset: Text = ..., - sync_expires: bool = ...) -> str: ... +def parse_cookie( + header: Union[None, WSGIEnvironment, Text, bytes], + charset: Text = ..., + errors: Text = ..., + cls: Optional[Callable[[Iterable[Tuple[Text, Text]]], _T]] = ..., +) -> _T: ... +def dump_cookie( + key: _ToBytes, + value: _ToBytes = ..., + max_age: Union[None, float, timedelta] = ..., + expires: Union[None, Text, float, datetime] = ..., + path: Union[None, tuple, str, bytes] = ..., + domain: Union[None, str, bytes] = ..., + secure: bool = ..., + httponly: bool = ..., + charset: Text = ..., + sync_expires: bool = ..., +) -> str: ... def is_byte_range_valid(start: Optional[int], stop: Optional[int], length: Optional[int]) -> bool: ... diff --git a/third_party/2and3/werkzeug/routing.pyi b/third_party/2and3/werkzeug/routing.pyi index f1b48b7d8467..03a7661a3627 100644 --- a/third_party/2and3/werkzeug/routing.pyi +++ b/third_party/2and3/werkzeug/routing.pyi @@ -77,9 +77,19 @@ class Rule(RuleFactory): endpoint: Any redirect_to: Any arguments: Any - def __init__(self, string, defaults: Optional[Any] = ..., subdomain: Optional[Any] = ..., methods: Optional[Any] = ..., - build_only: bool = ..., endpoint: Optional[Any] = ..., strict_slashes: Optional[Any] = ..., - redirect_to: Optional[Any] = ..., alias: bool = ..., host: Optional[Any] = ...): ... + def __init__( + self, + string, + defaults: Optional[Any] = ..., + subdomain: Optional[Any] = ..., + methods: Optional[Any] = ..., + build_only: bool = ..., + endpoint: Optional[Any] = ..., + strict_slashes: Optional[Any] = ..., + redirect_to: Optional[Any] = ..., + alias: bool = ..., + host: Optional[Any] = ..., + ): ... def empty(self): ... def get_empty_kwargs(self): ... def get_rules(self, map): ... @@ -152,15 +162,32 @@ class Map: converters: Any sort_parameters: Any sort_key: Any - def __init__(self, rules: Optional[Any] = ..., default_subdomain: str = ..., charset: Text = ..., - strict_slashes: bool = ..., redirect_defaults: bool = ..., converters: Optional[Any] = ..., - sort_parameters: bool = ..., sort_key: Optional[Any] = ..., encoding_errors: Text = ..., - host_matching: bool = ...): ... + def __init__( + self, + rules: Optional[Any] = ..., + default_subdomain: str = ..., + charset: Text = ..., + strict_slashes: bool = ..., + redirect_defaults: bool = ..., + converters: Optional[Any] = ..., + sort_parameters: bool = ..., + sort_key: Optional[Any] = ..., + encoding_errors: Text = ..., + host_matching: bool = ..., + ): ... def is_endpoint_expecting(self, endpoint, *arguments): ... def iter_rules(self, endpoint: Optional[Any] = ...): ... def add(self, rulefactory): ... - def bind(self, server_name, script_name: Optional[Any] = ..., subdomain: Optional[Any] = ..., url_scheme: str = ..., - default_method: str = ..., path_info: Optional[Any] = ..., query_args: Optional[Any] = ...): ... + def bind( + self, + server_name, + script_name: Optional[Any] = ..., + subdomain: Optional[Any] = ..., + url_scheme: str = ..., + default_method: str = ..., + path_info: Optional[Any] = ..., + query_args: Optional[Any] = ..., + ): ... def bind_to_environ(self, environ, server_name: Optional[Any] = ..., subdomain: Optional[Any] = ...): ... def update(self): ... @@ -173,12 +200,19 @@ class MapAdapter: path_info: Any default_method: Any query_args: Any - def __init__(self, map, server_name, script_name, subdomain, url_scheme, path_info, default_method, - query_args: Optional[Any] = ...): ... - def dispatch(self, view_func, path_info: Optional[Any] = ..., method: Optional[Any] = ..., - catch_http_exceptions: bool = ...): ... - def match(self, path_info: Optional[Any] = ..., method: Optional[Any] = ..., return_rule: bool = ..., - query_args: Optional[Any] = ...): ... + def __init__( + self, map, server_name, script_name, subdomain, url_scheme, path_info, default_method, query_args: Optional[Any] = ... + ): ... + def dispatch( + self, view_func, path_info: Optional[Any] = ..., method: Optional[Any] = ..., catch_http_exceptions: bool = ... + ): ... + def match( + self, + path_info: Optional[Any] = ..., + method: Optional[Any] = ..., + return_rule: bool = ..., + query_args: Optional[Any] = ..., + ): ... def test(self, path_info: Optional[Any] = ..., method: Optional[Any] = ...): ... def allowed_methods(self, path_info: Optional[Any] = ...): ... def get_host(self, domain_part): ... @@ -186,5 +220,11 @@ class MapAdapter: def encode_query_args(self, query_args): ... def make_redirect_url(self, path_info, query_args: Optional[Any] = ..., domain_part: Optional[Any] = ...): ... def make_alias_redirect_url(self, path, endpoint, values, method, query_args): ... - def build(self, endpoint, values: Optional[Any] = ..., method: Optional[Any] = ..., force_external: bool = ..., - append_unknown: bool = ...): ... + def build( + self, + endpoint, + values: Optional[Any] = ..., + method: Optional[Any] = ..., + force_external: bool = ..., + append_unknown: bool = ..., + ): ... diff --git a/third_party/2and3/werkzeug/script.pyi b/third_party/2and3/werkzeug/script.pyi index b9db97a0051a..a6420e23925a 100644 --- a/third_party/2and3/werkzeug/script.pyi +++ b/third_party/2and3/werkzeug/script.pyi @@ -9,6 +9,16 @@ def find_actions(namespace, action_prefix): ... def print_usage(actions): ... def analyse_action(func): ... def make_shell(init_func: Optional[Any] = ..., banner: Optional[Any] = ..., use_ipython: bool = ...): ... -def make_runserver(app_factory, hostname: str = ..., port: int = ..., use_reloader: bool = ..., use_debugger: bool = ..., - use_evalex: bool = ..., threaded: bool = ..., processes: int = ..., static_files: Optional[Any] = ..., - extra_files: Optional[Any] = ..., ssl_context: Optional[Any] = ...): ... +def make_runserver( + app_factory, + hostname: str = ..., + port: int = ..., + use_reloader: bool = ..., + use_debugger: bool = ..., + use_evalex: bool = ..., + threaded: bool = ..., + processes: int = ..., + static_files: Optional[Any] = ..., + extra_files: Optional[Any] = ..., + ssl_context: Optional[Any] = ..., +): ... diff --git a/third_party/2and3/werkzeug/serving.pyi b/third_party/2and3/werkzeug/serving.pyi index 54bce9784bb6..950bfdc82b91 100644 --- a/third_party/2and3/werkzeug/serving.pyi +++ b/third_party/2and3/werkzeug/serving.pyi @@ -64,8 +64,16 @@ class BaseWSGIServer(HTTPServer): socket: Any server_address: Any ssl_context: Any - def __init__(self, host, port, app, handler: Optional[Any] = ..., passthrough_errors: bool = ..., - ssl_context: Optional[Any] = ..., fd: Optional[Any] = ...): ... + def __init__( + self, + host, + port, + app, + handler: Optional[Any] = ..., + passthrough_errors: bool = ..., + ssl_context: Optional[Any] = ..., + fd: Optional[Any] = ..., + ): ... def log(self, type, message, *args): ... def serve_forever(self): ... def handle_error(self, request, client_address): ... @@ -78,16 +86,46 @@ class ThreadedWSGIServer(ThreadingMixIn, BaseWSGIServer): class ForkingWSGIServer(ForkingMixIn, BaseWSGIServer): multiprocess: Any max_children: Any - def __init__(self, host, port, app, processes: int = ..., handler: Optional[Any] = ..., passthrough_errors: bool = ..., - ssl_context: Optional[Any] = ..., fd: Optional[Any] = ...): ... + def __init__( + self, + host, + port, + app, + processes: int = ..., + handler: Optional[Any] = ..., + passthrough_errors: bool = ..., + ssl_context: Optional[Any] = ..., + fd: Optional[Any] = ..., + ): ... -def make_server(host: Optional[Any] = ..., port: Optional[Any] = ..., app: Optional[Any] = ..., threaded: bool = ..., - processes: int = ..., request_handler: Optional[Any] = ..., passthrough_errors: bool = ..., - ssl_context: Optional[Any] = ..., fd: Optional[Any] = ...): ... +def make_server( + host: Optional[Any] = ..., + port: Optional[Any] = ..., + app: Optional[Any] = ..., + threaded: bool = ..., + processes: int = ..., + request_handler: Optional[Any] = ..., + passthrough_errors: bool = ..., + ssl_context: Optional[Any] = ..., + fd: Optional[Any] = ..., +): ... def is_running_from_reloader(): ... -def run_simple(hostname, port, application, use_reloader: bool = ..., use_debugger: bool = ..., use_evalex: bool = ..., - extra_files: Optional[Any] = ..., reloader_interval: int = ..., reloader_type: str = ..., threaded: bool = ..., - processes: int = ..., request_handler: Optional[Any] = ..., static_files: Optional[Any] = ..., - passthrough_errors: bool = ..., ssl_context: Optional[Any] = ...): ... +def run_simple( + hostname, + port, + application, + use_reloader: bool = ..., + use_debugger: bool = ..., + use_evalex: bool = ..., + extra_files: Optional[Any] = ..., + reloader_interval: int = ..., + reloader_type: str = ..., + threaded: bool = ..., + processes: int = ..., + request_handler: Optional[Any] = ..., + static_files: Optional[Any] = ..., + passthrough_errors: bool = ..., + ssl_context: Optional[Any] = ..., +): ... def run_with_reloader(*args, **kwargs): ... def main(): ... diff --git a/third_party/2and3/werkzeug/test.pyi b/third_party/2and3/werkzeug/test.pyi index c67189e0b513..8c1cce055adc 100644 --- a/third_party/2and3/werkzeug/test.pyi +++ b/third_party/2and3/werkzeug/test.pyi @@ -8,8 +8,9 @@ else: from urllib.request import Request as U2Request from http.cookiejar import CookieJar -def stream_encode_multipart(values, use_tempfile: int = ..., threshold=..., boundary: Optional[Any] = ..., - charset: Text = ...): ... +def stream_encode_multipart( + values, use_tempfile: int = ..., threshold=..., boundary: Optional[Any] = ..., charset: Text = ... +): ... def encode_multipart(values, boundary: Optional[Any] = ..., charset: Text = ...): ... def File(fd, filename: Optional[Any] = ..., mimetype: Optional[Any] = ...): ... @@ -49,11 +50,25 @@ class EnvironBuilder: input_stream: Any content_length: Any closed: Any - def __init__(self, path: str = ..., base_url: Optional[Any] = ..., query_string: Optional[Any] = ..., - method: str = ..., input_stream: Optional[Any] = ..., content_type: Optional[Any] = ..., - content_length: Optional[Any] = ..., errors_stream: Optional[Any] = ..., multithread: bool = ..., - multiprocess: bool = ..., run_once: bool = ..., headers: Optional[Any] = ..., data: Optional[Any] = ..., - environ_base: Optional[Any] = ..., environ_overrides: Optional[Any] = ..., charset: Text = ...): ... + def __init__( + self, + path: str = ..., + base_url: Optional[Any] = ..., + query_string: Optional[Any] = ..., + method: str = ..., + input_stream: Optional[Any] = ..., + content_type: Optional[Any] = ..., + content_length: Optional[Any] = ..., + errors_stream: Optional[Any] = ..., + multithread: bool = ..., + multiprocess: bool = ..., + run_once: bool = ..., + headers: Optional[Any] = ..., + data: Optional[Any] = ..., + environ_base: Optional[Any] = ..., + environ_overrides: Optional[Any] = ..., + charset: Text = ..., + ): ... form: Any files: Any @property @@ -72,11 +87,22 @@ class Client: response_wrapper: Any cookie_jar: Any allow_subdomain_redirects: Any - def __init__(self, application, response_wrapper: Optional[Any] = ..., use_cookies: bool = ..., - allow_subdomain_redirects: bool = ...): ... - def set_cookie(self, server_name, key, value: str = ..., max_age: Optional[Any] = ..., expires: Optional[Any] = ..., - path: str = ..., domain: Optional[Any] = ..., secure: Optional[Any] = ..., httponly: bool = ..., - charset: Text = ...): ... + def __init__( + self, application, response_wrapper: Optional[Any] = ..., use_cookies: bool = ..., allow_subdomain_redirects: bool = ... + ): ... + def set_cookie( + self, + server_name, + key, + value: str = ..., + max_age: Optional[Any] = ..., + expires: Optional[Any] = ..., + path: str = ..., + domain: Optional[Any] = ..., + secure: Optional[Any] = ..., + httponly: bool = ..., + charset: Text = ..., + ): ... def delete_cookie(self, server_name, key, path: str = ..., domain: Optional[Any] = ...): ... def run_wsgi_app(self, environ, buffered: bool = ...): ... def resolve_redirect(self, response, new_location, environ, buffered: bool = ...): ... diff --git a/third_party/2and3/werkzeug/urls.pyi b/third_party/2and3/werkzeug/urls.pyi index ff9f54ee245e..5b9ce926266c 100644 --- a/third_party/2and3/werkzeug/urls.pyi +++ b/third_party/2and3/werkzeug/urls.pyi @@ -1,11 +1,7 @@ from collections import namedtuple from typing import Any, Optional, Text -_URLTuple = namedtuple( - '_URLTuple', - ['scheme', 'netloc', 'path', 'query', 'fragment'] -) - +_URLTuple = namedtuple("_URLTuple", ["scheme", "netloc", "path", "query", "fragment"]) class BaseURL(_URLTuple): def replace(self, **kwargs): ... @@ -50,15 +46,38 @@ def url_unquote_plus(s, charset: Text = ..., errors: Text = ...): ... def url_fix(s, charset: Text = ...): ... def uri_to_iri(uri, charset: Text = ..., errors: Text = ...): ... def iri_to_uri(iri, charset: Text = ..., errors: Text = ..., safe_conversion: bool = ...): ... -def url_decode(s, charset: Text = ..., decode_keys: bool = ..., include_empty: bool = ..., errors: Text = ..., - separator: str = ..., cls: Optional[Any] = ...): ... -def url_decode_stream(stream, charset: Text = ..., decode_keys: bool = ..., include_empty: bool = ..., errors: Text = ..., - separator: str = ..., cls: Optional[Any] = ..., limit: Optional[Any] = ..., - return_iterator: bool = ...): ... -def url_encode(obj, charset: Text = ..., encode_keys: bool = ..., sort: bool = ..., key: Optional[Any] = ..., - separator: bytes = ...): ... -def url_encode_stream(obj, stream: Optional[Any] = ..., charset: Text = ..., encode_keys: bool = ..., sort: bool = ..., - key: Optional[Any] = ..., separator: bytes = ...): ... +def url_decode( + s, + charset: Text = ..., + decode_keys: bool = ..., + include_empty: bool = ..., + errors: Text = ..., + separator: str = ..., + cls: Optional[Any] = ..., +): ... +def url_decode_stream( + stream, + charset: Text = ..., + decode_keys: bool = ..., + include_empty: bool = ..., + errors: Text = ..., + separator: str = ..., + cls: Optional[Any] = ..., + limit: Optional[Any] = ..., + return_iterator: bool = ..., +): ... +def url_encode( + obj, charset: Text = ..., encode_keys: bool = ..., sort: bool = ..., key: Optional[Any] = ..., separator: bytes = ... +): ... +def url_encode_stream( + obj, + stream: Optional[Any] = ..., + charset: Text = ..., + encode_keys: bool = ..., + sort: bool = ..., + key: Optional[Any] = ..., + separator: bytes = ..., +): ... def url_join(base, url, allow_fragments: bool = ...): ... class Href: diff --git a/third_party/2and3/werkzeug/utils.pyi b/third_party/2and3/werkzeug/utils.pyi index fa638315a725..18ec6622d0fe 100644 --- a/third_party/2and3/werkzeug/utils.pyi +++ b/third_party/2and3/werkzeug/utils.pyi @@ -40,7 +40,6 @@ _RC = TypeVar("_RC", bound=Response) def redirect(location, code: int = ..., Response: None = ...) -> Response: ... @overload def redirect(location, code: int = ..., Response: Type[_RC] = ...) -> _RC: ... - def append_slash_redirect(environ, code: int = ...): ... def import_string(import_name, silent: bool = ...): ... def find_modules(import_path, include_packages: bool = ..., recursive: bool = ...): ... diff --git a/third_party/2and3/werkzeug/wrappers.pyi b/third_party/2and3/werkzeug/wrappers.pyi index fea4fd8389dc..02fcd47bd16a 100644 --- a/third_party/2and3/werkzeug/wrappers.pyi +++ b/third_party/2and3/werkzeug/wrappers.pyi @@ -65,7 +65,9 @@ class BaseRequest: @property def data(self) -> bytes: ... # TODO: once Literal types are supported, overload with as_text - def get_data(self, cache: bool = ..., as_text: bool = ..., parse_form_data: bool = ...) -> Any: ... # returns bytes if as_text is False (the default), else Text + def get_data( + self, cache: bool = ..., as_text: bool = ..., parse_form_data: bool = ... + ) -> Any: ... # returns bytes if as_text is False (the default), else Text form: ImmutableMultiDict values: CombinedMultiDict files: MultiDict @@ -99,8 +101,8 @@ class BaseRequest: def __setattr__(self, name: str, value: Any): ... def __getattr__(self, name: str): ... -_OnCloseT = TypeVar('_OnCloseT', bound=Callable[[], Any]) -_SelfT = TypeVar('_SelfT', bound=BaseResponse) +_OnCloseT = TypeVar("_OnCloseT", bound=Callable[[], Any]) +_SelfT = TypeVar("_SelfT", bound=BaseResponse) class BaseResponse: charset: str @@ -114,14 +116,15 @@ class BaseResponse: status: str direct_passthrough: bool response: Iterable[bytes] - def __init__(self, response: Optional[Union[str, bytes, bytearray, Iterable[str], Iterable[bytes]]] = ..., - status: Optional[Union[Text, int]] = ..., - headers: Optional[Union[Headers, - Mapping[Text, Text], - Sequence[Tuple[Text, Text]]]] = ..., - mimetype: Optional[Text] = ..., - content_type: Optional[Text] = ..., - direct_passthrough: bool = ...) -> None: ... + def __init__( + self, + response: Optional[Union[str, bytes, bytearray, Iterable[str], Iterable[bytes]]] = ..., + status: Optional[Union[Text, int]] = ..., + headers: Optional[Union[Headers, Mapping[Text, Text], Sequence[Tuple[Text, Text]]]] = ..., + mimetype: Optional[Text] = ..., + content_type: Optional[Text] = ..., + direct_passthrough: bool = ..., + ) -> None: ... def call_on_close(self, func: _OnCloseT) -> _OnCloseT: ... @classmethod def force_type(cls: Type[_SelfT], response: object, environ: Optional[WSGIEnvironment] = ...) -> _SelfT: ... @@ -134,8 +137,17 @@ class BaseResponse: def calculate_content_length(self) -> Optional[int]: ... def make_sequence(self) -> None: ... def iter_encoded(self) -> Iterator[bytes]: ... - def set_cookie(self, key, value: str = ..., max_age: Optional[Any] = ..., expires: Optional[Any] = ..., - path: str = ..., domain: Optional[Any] = ..., secure: bool = ..., httponly: bool = ...): ... + def set_cookie( + self, + key, + value: str = ..., + max_age: Optional[Any] = ..., + expires: Optional[Any] = ..., + path: str = ..., + domain: Optional[Any] = ..., + secure: bool = ..., + httponly: bool = ..., + ): ... def delete_cookie(self, key, path: str = ..., domain: Optional[Any] = ...): ... @property def is_streamed(self) -> bool: ... diff --git a/third_party/2and3/werkzeug/wsgi.pyi b/third_party/2and3/werkzeug/wsgi.pyi index db4b866383de..4d97303e41ea 100644 --- a/third_party/2and3/werkzeug/wsgi.pyi +++ b/third_party/2and3/werkzeug/wsgi.pyi @@ -2,8 +2,9 @@ from typing import Any, Iterable, Optional, Protocol, Text from wsgiref.types import InputStream, WSGIEnvironment def responder(f): ... -def get_current_url(environ, root_only: bool = ..., strip_querystring: bool = ..., host_only: bool = ..., - trusted_hosts: Optional[Any] = ...): ... +def get_current_url( + environ, root_only: bool = ..., strip_querystring: bool = ..., host_only: bool = ..., trusted_hosts: Optional[Any] = ... +): ... def host_is_trusted(hostname, trusted_list): ... def get_host(environ, trusted_hosts: Optional[Any] = ...): ... def get_content_length(environ: WSGIEnvironment) -> Optional[int]: ... @@ -13,8 +14,9 @@ def get_path_info(environ, charset: Text = ..., errors: Text = ...): ... def get_script_name(environ, charset: Text = ..., errors: Text = ...): ... def pop_path_info(environ, charset: Text = ..., errors: Text = ...): ... def peek_path_info(environ, charset: Text = ..., errors: Text = ...): ... -def extract_path_info(environ_or_baseurl, path_or_url, charset: Text = ..., errors: Text = ..., - collapse_http_schemes: bool = ...): ... +def extract_path_info( + environ_or_baseurl, path_or_url, charset: Text = ..., errors: Text = ..., collapse_http_schemes: bool = ... +): ... class SharedDataMiddleware: app: Any @@ -22,8 +24,9 @@ class SharedDataMiddleware: cache: Any cache_timeout: Any fallback_mimetype: Any - def __init__(self, app, exports, disallow: Optional[Any] = ..., cache: bool = ..., cache_timeout=..., - fallback_mimetype: str = ...): ... + def __init__( + self, app, exports, disallow: Optional[Any] = ..., cache: bool = ..., cache_timeout=..., fallback_mimetype: str = ... + ): ... def is_allowed(self, filename): ... def get_file_loader(self, filename): ... def get_package_loader(self, package, package_path): ... diff --git a/third_party/2and3/yaml/__init__.pyi b/third_party/2and3/yaml/__init__.pyi index 5c5c1c86f77b..68938da2098a 100644 --- a/third_party/2and3/yaml/__init__.pyi +++ b/third_party/2and3/yaml/__init__.pyi @@ -33,37 +33,210 @@ def full_load_all(stream: Union[str, IO[str]]) -> Iterator[Any]: ... def safe_load(stream: Union[str, IO[str]]) -> Any: ... def safe_load_all(stream: Union[str, IO[str]]) -> Iterator[Any]: ... def emit(events, stream=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=...): ... - @overload -def serialize_all(nodes, stream: IO[str], Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... +def serialize_all( + nodes, + stream: IO[str], + Dumper=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> None: ... @overload -def serialize_all(nodes, stream: None = ..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: Optional[_Str] = ..., explicit_start=..., explicit_end=..., version=..., tags=...) -> _Yaml: ... - +def serialize_all( + nodes, + stream: None = ..., + Dumper=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding: Optional[_Str] = ..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> _Yaml: ... @overload -def serialize(node, stream: IO[str], Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... +def serialize( + node, + stream: IO[str], + Dumper=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> None: ... @overload -def serialize(node, stream: None = ..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: Optional[_Str] = ..., explicit_start=..., explicit_end=..., version=..., tags=...) -> _Yaml: ... - +def serialize( + node, + stream: None = ..., + Dumper=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding: Optional[_Str] = ..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> _Yaml: ... @overload -def dump_all(documents: Sequence[Any], stream: IO[str], Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... +def dump_all( + documents: Sequence[Any], + stream: IO[str], + Dumper=..., + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> None: ... @overload -def dump_all(documents: Sequence[Any], stream: None = ..., Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: Optional[_Str] = ..., explicit_start=..., explicit_end=..., version=..., tags=...) -> _Yaml: ... - +def dump_all( + documents: Sequence[Any], + stream: None = ..., + Dumper=..., + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding: Optional[_Str] = ..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> _Yaml: ... @overload -def dump(data: Any, stream: IO[str], Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... +def dump( + data: Any, + stream: IO[str], + Dumper=..., + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> None: ... @overload -def dump(data: Any, stream: None = ..., Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: Optional[_Str] = ..., explicit_start=..., explicit_end=..., version=..., tags=...) -> _Yaml: ... - +def dump( + data: Any, + stream: None = ..., + Dumper=..., + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding: Optional[_Str] = ..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> _Yaml: ... @overload -def safe_dump_all(documents: Sequence[Any], stream: IO[str], default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... +def safe_dump_all( + documents: Sequence[Any], + stream: IO[str], + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> None: ... @overload -def safe_dump_all(documents: Sequence[Any], stream: None = ..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: Optional[_Str] = ..., explicit_start=..., explicit_end=..., version=..., tags=...) -> _Yaml: ... - +def safe_dump_all( + documents: Sequence[Any], + stream: None = ..., + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding: Optional[_Str] = ..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> _Yaml: ... @overload -def safe_dump(data: Any, stream: IO[str], default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... +def safe_dump( + data: Any, + stream: IO[str], + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> None: ... @overload -def safe_dump(data: Any, stream: None = ..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: Optional[_Str] = ..., explicit_start=..., explicit_end=..., version=..., tags=...) -> _Yaml: ... - +def safe_dump( + data: Any, + stream: None = ..., + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding: Optional[_Str] = ..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., +) -> _Yaml: ... def add_implicit_resolver(tag, regexp, first=..., Loader=..., Dumper=...): ... def add_path_resolver(tag, path, kind=..., Loader=..., Dumper=...): ... def add_constructor(tag, constructor, Loader=...): ... diff --git a/third_party/2and3/yaml/cyaml.pyi b/third_party/2and3/yaml/cyaml.pyi index dfaa3671be30..127dca2d6489 100644 --- a/third_party/2and3/yaml/cyaml.pyi +++ b/third_party/2and3/yaml/cyaml.pyi @@ -25,21 +25,38 @@ class CSafeLoader(CParser, SafeConstructor, Resolver): class CDangerLoader(CParser, Constructor, Resolver): ... # undocumented class CEmitter(object): - def __init__(self, stream: IO[Any], canonical: Optional[Any] = ..., - indent: Optional[int] = ..., width: Optional[int] = ..., - allow_unicode: Optional[Any] = ..., line_break: Optional[str] = ..., - encoding: Optional[Text] = ..., explicit_start: Optional[Any] = ..., - explicit_end: Optional[Any] = ..., version: Optional[Sequence[int]] = ..., - tags: Optional[Mapping[Text, Text]] = ...) -> None: ... + def __init__( + self, + stream: IO[Any], + canonical: Optional[Any] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[Any] = ..., + line_break: Optional[str] = ..., + encoding: Optional[Text] = ..., + explicit_start: Optional[Any] = ..., + explicit_end: Optional[Any] = ..., + version: Optional[Sequence[int]] = ..., + tags: Optional[Mapping[Text, Text]] = ..., + ) -> None: ... class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): - def __init__(self, stream: IO[Any], default_style: Optional[str] = ..., - default_flow_style: Optional[bool] = ..., canonical: Optional[Any] = ..., - indent: Optional[int] = ..., width: Optional[int] = ..., - allow_unicode: Optional[Any] = ..., line_break: Optional[str] = ..., - encoding: Optional[Text] = ..., explicit_start: Optional[Any] = ..., - explicit_end: Optional[Any] = ..., version: Optional[Sequence[int]] = ..., - tags: Optional[Mapping[Text, Text]] = ...) -> None: ... + def __init__( + self, + stream: IO[Any], + default_style: Optional[str] = ..., + default_flow_style: Optional[bool] = ..., + canonical: Optional[Any] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[Any] = ..., + line_break: Optional[str] = ..., + encoding: Optional[Text] = ..., + explicit_start: Optional[Any] = ..., + explicit_end: Optional[Any] = ..., + version: Optional[Sequence[int]] = ..., + tags: Optional[Mapping[Text, Text]] = ..., + ) -> None: ... class CDumper(CEmitter, SafeRepresenter, Resolver): ... diff --git a/third_party/2and3/yaml/dumper.pyi b/third_party/2and3/yaml/dumper.pyi index db5e398467f7..3bd5236b8187 100644 --- a/third_party/2and3/yaml/dumper.pyi +++ b/third_party/2and3/yaml/dumper.pyi @@ -4,10 +4,55 @@ from yaml.resolver import BaseResolver, Resolver from yaml.serializer import Serializer class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): - def __init__(self, stream, default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... + def __init__( + self, + stream, + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., + ) -> None: ... class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): - def __init__(self, stream, default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... + def __init__( + self, + stream, + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., + ) -> None: ... class Dumper(Emitter, Serializer, Representer, Resolver): - def __init__(self, stream, default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ... + def __init__( + self, + stream, + default_style=..., + default_flow_style=..., + canonical=..., + indent=..., + width=..., + allow_unicode=..., + line_break=..., + encoding=..., + explicit_start=..., + explicit_end=..., + version=..., + tags=..., + ) -> None: ... diff --git a/third_party/2and3/yaml/emitter.pyi b/third_party/2and3/yaml/emitter.pyi index 650b86bce911..9f44bd771c69 100644 --- a/third_party/2and3/yaml/emitter.pyi +++ b/third_party/2and3/yaml/emitter.pyi @@ -13,7 +13,9 @@ class ScalarAnalysis: allow_single_quoted: Any allow_double_quoted: Any allow_block: Any - def __init__(self, scalar, empty, multiline, allow_flow_plain, allow_block_plain, allow_single_quoted, allow_double_quoted, allow_block) -> None: ... + def __init__( + self, scalar, empty, multiline, allow_flow_plain, allow_block_plain, allow_single_quoted, allow_double_quoted, allow_block + ) -> None: ... class Emitter: DEFAULT_TAG_PREFIXES: Any diff --git a/third_party/3.5/contextvars.pyi b/third_party/3.5/contextvars.pyi index ab2ae9e5fabf..e228d3af431f 100644 --- a/third_party/3.5/contextvars.pyi +++ b/third_party/3.5/contextvars.pyi @@ -1,6 +1,6 @@ from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union -_T = TypeVar('_T') +_T = TypeVar("_T") class ContextVar(Generic[_T]): def __init__(self, name: str, *, default: _T = ...) -> None: ... diff --git a/third_party/3/dataclasses.pyi b/third_party/3/dataclasses.pyi index ec10fc4d65c2..f378e747a605 100644 --- a/third_party/3/dataclasses.pyi +++ b/third_party/3/dataclasses.pyi @@ -1,28 +1,24 @@ from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union, overload -_T = TypeVar('_T') +_T = TypeVar("_T") class _MISSING_TYPE: ... -MISSING: _MISSING_TYPE +MISSING: _MISSING_TYPE @overload def asdict(obj: Any) -> Dict[str, Any]: ... @overload def asdict(obj: Any, *, dict_factory: Callable[[List[Tuple[str, Any]]], _T]) -> _T: ... - @overload def astuple(obj: Any) -> Tuple[Any, ...]: ... @overload def astuple(obj: Any, *, tuple_factory: Callable[[List[Any]], _T]) -> _T: ... - - @overload def dataclass(_cls: Type[_T]) -> Type[_T]: ... - @overload -def dataclass(*, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., - unsafe_hash: bool = ..., frozen: bool = ...) -> Callable[[Type[_T]], Type[_T]]: ... - +def dataclass( + *, init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., unsafe_hash: bool = ..., frozen: bool = ... +) -> Callable[[Type[_T]], Type[_T]]: ... class Field(Generic[_T]): name: str @@ -35,36 +31,54 @@ class Field(Generic[_T]): compare: bool metadata: Optional[Mapping[str, Any]] - # NOTE: Actual return type is 'Field[_T]', but we want to help type checkers # to understand the magic that happens at runtime. @overload # `default` and `default_factory` are optional and mutually exclusive. -def field(*, default: _T, - init: bool = ..., repr: bool = ..., hash: Optional[bool] = ..., compare: bool = ..., - metadata: Optional[Mapping[str, Any]] = ...) -> _T: ... - +def field( + *, + default: _T, + init: bool = ..., + repr: bool = ..., + hash: Optional[bool] = ..., + compare: bool = ..., + metadata: Optional[Mapping[str, Any]] = ... +) -> _T: ... @overload -def field(*, default_factory: Callable[[], _T], - init: bool = ..., repr: bool = ..., hash: Optional[bool] = ..., compare: bool = ..., - metadata: Optional[Mapping[str, Any]] = ...) -> _T: ... - +def field( + *, + default_factory: Callable[[], _T], + init: bool = ..., + repr: bool = ..., + hash: Optional[bool] = ..., + compare: bool = ..., + metadata: Optional[Mapping[str, Any]] = ... +) -> _T: ... @overload -def field(*, - init: bool = ..., repr: bool = ..., hash: Optional[bool] = ..., compare: bool = ..., - metadata: Optional[Mapping[str, Any]] = ...) -> Any: ... - - +def field( + *, + init: bool = ..., + repr: bool = ..., + hash: Optional[bool] = ..., + compare: bool = ..., + metadata: Optional[Mapping[str, Any]] = ... +) -> Any: ... def fields(class_or_instance: Any) -> Tuple[Field[Any], ...]: ... - def is_dataclass(obj: Any) -> bool: ... class FrozenInstanceError(AttributeError): ... - class InitVar(Generic[_T]): ... -def make_dataclass(cls_name: str, fields: Iterable[Union[str, Tuple[str, type], Tuple[str, type, Field[Any]]]], *, - bases: Tuple[type, ...] = ..., namespace: Optional[Dict[str, Any]] = ..., - init: bool = ..., repr: bool = ..., eq: bool = ..., order: bool = ..., hash: bool = ..., - frozen: bool = ...): ... - +def make_dataclass( + cls_name: str, + fields: Iterable[Union[str, Tuple[str, type], Tuple[str, type, Field[Any]]]], + *, + bases: Tuple[type, ...] = ..., + namespace: Optional[Dict[str, Any]] = ..., + init: bool = ..., + repr: bool = ..., + eq: bool = ..., + order: bool = ..., + hash: bool = ..., + frozen: bool = ... +): ... def replace(obj: _T, **changes: Any) -> _T: ... diff --git a/third_party/3/docutils/nodes.pyi b/third_party/3/docutils/nodes.pyi index 382112bffe15..0c3588c2b0ba 100644 --- a/third_party/3/docutils/nodes.pyi +++ b/third_party/3/docutils/nodes.pyi @@ -1,10 +1,6 @@ from typing import Any, List class reference: - def __init__(self, - rawsource: str = ..., - text: str = ..., - *children: List[Any], - **attributes) -> None: ... + def __init__(self, rawsource: str = ..., text: str = ..., *children: List[Any], **attributes) -> None: ... def __getattr__(name) -> Any: ... diff --git a/third_party/3/docutils/parsers/rst/roles.pyi b/third_party/3/docutils/parsers/rst/roles.pyi index a5f7aa880386..593e0373708f 100644 --- a/third_party/3/docutils/parsers/rst/roles.pyi +++ b/third_party/3/docutils/parsers/rst/roles.pyi @@ -3,10 +3,11 @@ from typing import Any, Callable, Dict, List, Tuple import docutils.nodes import docutils.parsers.rst.states -def register_local_role(name: str, - role_fn: Callable[[str, str, str, int, docutils.parsers.rst.states.Inliner, Dict, List], - Tuple[List[docutils.nodes.reference], List[docutils.nodes.reference]]] - ) -> None: - ... - +def register_local_role( + name: str, + role_fn: Callable[ + [str, str, str, int, docutils.parsers.rst.states.Inliner, Dict, List], + Tuple[List[docutils.nodes.reference], List[docutils.nodes.reference]], + ], +) -> None: ... def __getattr__(name) -> Any: ... diff --git a/third_party/3/docutils/parsers/rst/states.pyi b/third_party/3/docutils/parsers/rst/states.pyi index ac00fe1bfe8e..e1a8e9bd8625 100644 --- a/third_party/3/docutils/parsers/rst/states.pyi +++ b/third_party/3/docutils/parsers/rst/states.pyi @@ -2,7 +2,6 @@ import typing from typing import Any class Inliner: - def __init__(self) -> None: - ... + def __init__(self) -> None: ... def __getattr__(name) -> Any: ... diff --git a/third_party/3/jwt/__init__.pyi b/third_party/3/jwt/__init__.pyi index 4a77022a768c..ac6b582a89f5 100644 --- a/third_party/3/jwt/__init__.pyi +++ b/third_party/3/jwt/__init__.pyi @@ -2,18 +2,22 @@ from typing import Any, Dict, Mapping, Optional, Union from . import algorithms -def decode(jwt: Union[str, bytes], key: Union[str, bytes] = ..., - verify: bool = ..., algorithms: Optional[Any] = ..., - options: Optional[Mapping[Any, Any]] = ..., - **kwargs: Any) -> Dict[str, Any]: ... - -def encode(payload: Mapping[str, Any], key: Union[str, bytes], - algorithm: str = ..., headers: Optional[Mapping[str, Any]] = ..., - json_encoder: Optional[Any] = ...) -> bytes: ... - -def register_algorithm(alg_id: str, - alg_obj: algorithms.Algorithm) -> None: ... - +def decode( + jwt: Union[str, bytes], + key: Union[str, bytes] = ..., + verify: bool = ..., + algorithms: Optional[Any] = ..., + options: Optional[Mapping[Any, Any]] = ..., + **kwargs: Any +) -> Dict[str, Any]: ... +def encode( + payload: Mapping[str, Any], + key: Union[str, bytes], + algorithm: str = ..., + headers: Optional[Mapping[str, Any]] = ..., + json_encoder: Optional[Any] = ..., +) -> bytes: ... +def register_algorithm(alg_id: str, alg_obj: algorithms.Algorithm) -> None: ... def unregister_algorithm(alg_id: str) -> None: ... class PyJWTError(Exception): ... diff --git a/third_party/3/jwt/algorithms.pyi b/third_party/3/jwt/algorithms.pyi index 1ee746142c37..91a081bf48f0 100644 --- a/third_party/3/jwt/algorithms.pyi +++ b/third_party/3/jwt/algorithms.pyi @@ -17,7 +17,6 @@ class Algorithm(Generic[_K]): @staticmethod def from_jwk(jwk: str) -> Any: ... # should return _K, see python/mypy#1337 - class NoneAlgorithm(Algorithm[None]): def prepare_key(self, key: Optional[str]) -> None: ... diff --git a/third_party/3/orjson.pyi b/third_party/3/orjson.pyi index 9c1cdc1e0ef5..e8c5e776751c 100644 --- a/third_party/3/orjson.pyi +++ b/third_party/3/orjson.pyi @@ -2,9 +2,7 @@ from typing import Any, Callable, Optional, Union -def dumps( - __obj: Any, default: Optional[Callable[[Any], Any]] = ..., option: Optional[int] = ... -) -> bytes: ... +def dumps(__obj: Any, default: Optional[Callable[[Any], Any]] = ..., option: Optional[int] = ...) -> bytes: ... def loads(__obj: Union[bytes, str]) -> Any: ... class JSONDecodeError(ValueError): ... diff --git a/third_party/3/six/__init__.pyi b/third_party/3/six/__init__.pyi index 6ede7db0019f..af53a6108aa8 100644 --- a/third_party/3/six/__init__.pyi +++ b/third_party/3/six/__init__.pyi @@ -7,6 +7,7 @@ import typing import unittest from builtins import next as next from functools import wraps as wraps + # Exports from io import BytesIO as BytesIO from io import StringIO as StringIO @@ -33,9 +34,9 @@ from typing import ( from . import moves -_T = TypeVar('_T') -_K = TypeVar('_K') -_V = TypeVar('_V') +_T = TypeVar("_T") +_K = TypeVar("_K") +_V = TypeVar("_V") # TODO make constant, then move this stub to 2and3 # https://github.com/python/typeshed/issues/17 @@ -43,9 +44,9 @@ PY2 = False PY3 = True PY34: bool -string_types = str, -integer_types = int, -class_types = type, +string_types = (str,) +integer_types = (int,) +class_types = (type,) text_type = str binary_type = bytes @@ -55,7 +56,6 @@ MAXSIZE: int # def remove_move def callable(obj: object) -> bool: ... - def get_unbound_function(unbound: types.FunctionType) -> types.FunctionType: ... def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ... def create_unbound_method(func: types.FunctionType, cls: type) -> types.FunctionType: ... @@ -68,35 +68,38 @@ def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, def get_function_code(fun: types.FunctionType) -> types.CodeType: ... def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ... def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ... - def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ... def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ... def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ... + # def iterlists def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ... def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ... def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ... - def b(s: str) -> binary_type: ... def u(s: str) -> text_type: ... unichr = chr + def int2byte(i: int) -> bytes: ... def byte2int(bs: binary_type) -> int: ... def indexbytes(buf: binary_type, i: int) -> int: ... def iterbytes(buf: binary_type) -> typing.Iterator[int]: ... - def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: Optional[str] = ...) -> None: ... @overload def assertRaisesRegex(self: unittest.TestCase, msg: Optional[str] = ...) -> Any: ... @overload def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ... -def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: Optional[str] = ...) -> None: ... +def assertRegex( + self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: Optional[str] = ... +) -> None: ... exec_ = exec -def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ...) -> NoReturn: ... +def reraise( + tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ... +) -> NoReturn: ... def raise_from(value: Union[BaseException, Type[BaseException]], from_value: Optional[BaseException]) -> NoReturn: ... print_ = print diff --git a/third_party/3/typed_ast/ast27.pyi b/third_party/3/typed_ast/ast27.pyi index e4e6c2fac4a0..6c2a6b22179c 100644 --- a/third_party/3/typed_ast/ast27.pyi +++ b/third_party/3/typed_ast/ast27.pyi @@ -1,7 +1,7 @@ import typing from typing import Any, Generic, Iterator, Optional, Union -class NodeVisitor(): +class NodeVisitor: def visit(self, node: AST) -> Any: ... def generic_visit(self, node: AST) -> None: ... @@ -30,8 +30,7 @@ class AST: _fields: typing.Tuple[str, ...] def __init__(self, *args, **kwargs) -> None: ... -class mod(AST): - ... +class mod(AST): ... class Module(mod): body: typing.List[stmt] @@ -50,7 +49,6 @@ class FunctionType(mod): class Suite(mod): body: typing.List[stmt] - class stmt(AST): lineno: int col_offset: int @@ -152,10 +150,7 @@ class Expr(stmt): class Pass(stmt): ... class Break(stmt): ... class Continue(stmt): ... - - -class slice(AST): - ... +class slice(AST): ... _slice = slice # this lets us type the variable named 'slice' below @@ -172,7 +167,6 @@ class Index(slice): class Ellipsis(slice): ... - class expr(AST): lineno: int col_offset: int @@ -270,27 +264,17 @@ class Tuple(expr): elts: typing.List[expr] ctx: expr_context - -class expr_context(AST): - ... - +class expr_context(AST): ... class AugLoad(expr_context): ... class AugStore(expr_context): ... class Del(expr_context): ... class Load(expr_context): ... class Param(expr_context): ... class Store(expr_context): ... - - -class boolop(AST): - ... - +class boolop(AST): ... class And(boolop): ... class Or(boolop): ... - -class operator(AST): - ... - +class operator(AST): ... class Add(operator): ... class BitAnd(operator): ... class BitOr(operator): ... @@ -303,18 +287,12 @@ class Mult(operator): ... class Pow(operator): ... class RShift(operator): ... class Sub(operator): ... - -class unaryop(AST): - ... - +class unaryop(AST): ... class Invert(unaryop): ... class Not(unaryop): ... class UAdd(unaryop): ... class USub(unaryop): ... - -class cmpop(AST): - ... - +class cmpop(AST): ... class Eq(cmpop): ... class Gt(cmpop): ... class GtE(cmpop): ... @@ -326,13 +304,11 @@ class LtE(cmpop): ... class NotEq(cmpop): ... class NotIn(cmpop): ... - class comprehension(AST): target: expr iter: expr ifs: typing.List[expr] - class ExceptHandler(AST): type: Optional[expr] name: Optional[expr] @@ -340,7 +316,6 @@ class ExceptHandler(AST): lineno: int col_offset: int - class arguments(AST): args: typing.List[expr] vararg: Optional[identifier] @@ -356,6 +331,5 @@ class alias(AST): name: identifier asname: Optional[identifier] - class TypeIgnore(AST): lineno: int diff --git a/third_party/3/typed_ast/ast3.pyi b/third_party/3/typed_ast/ast3.pyi index 15af912c7630..6b8fdab7f1fe 100644 --- a/third_party/3/typed_ast/ast3.pyi +++ b/third_party/3/typed_ast/ast3.pyi @@ -1,17 +1,14 @@ import typing from typing import Any, Generic, Iterator, Optional, Union -class NodeVisitor(): +class NodeVisitor: def visit(self, node: AST) -> Any: ... def generic_visit(self, node: AST) -> None: ... class NodeTransformer(NodeVisitor): def generic_visit(self, node: AST) -> None: ... -def parse(source: Union[str, bytes], - filename: Union[str, bytes] = ..., - mode: str = ..., - feature_version: int = ...) -> AST: ... +def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ..., feature_version: int = ...) -> AST: ... def copy_location(new_node: AST, old_node: AST) -> AST: ... def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ... def fix_missing_locations(node: AST) -> AST: ... @@ -33,8 +30,7 @@ class AST: _fields: typing.Tuple[str, ...] def __init__(self, *args, **kwargs) -> None: ... -class mod(AST): - ... +class mod(AST): ... class Module(mod): body: typing.List[stmt] @@ -53,7 +49,6 @@ class FunctionType(mod): class Suite(mod): body: typing.List[stmt] - class stmt(AST): lineno: int col_offset: int @@ -171,10 +166,7 @@ class Expr(stmt): class Pass(stmt): ... class Break(stmt): ... class Continue(stmt): ... - - -class slice(AST): - ... +class slice(AST): ... _slice = slice # this lets us type the variable named 'slice' below @@ -189,7 +181,6 @@ class ExtSlice(slice): class Index(slice): value: expr - class expr(AST): lineno: int col_offset: int @@ -308,27 +299,17 @@ class Tuple(expr): elts: typing.List[expr] ctx: expr_context - -class expr_context(AST): - ... - +class expr_context(AST): ... class AugLoad(expr_context): ... class AugStore(expr_context): ... class Del(expr_context): ... class Load(expr_context): ... class Param(expr_context): ... class Store(expr_context): ... - - -class boolop(AST): - ... - +class boolop(AST): ... class And(boolop): ... class Or(boolop): ... - -class operator(AST): - ... - +class operator(AST): ... class Add(operator): ... class BitAnd(operator): ... class BitOr(operator): ... @@ -342,18 +323,12 @@ class MatMult(operator): ... class Pow(operator): ... class RShift(operator): ... class Sub(operator): ... - -class unaryop(AST): - ... - +class unaryop(AST): ... class Invert(unaryop): ... class Not(unaryop): ... class UAdd(unaryop): ... class USub(unaryop): ... - -class cmpop(AST): - ... - +class cmpop(AST): ... class Eq(cmpop): ... class Gt(cmpop): ... class GtE(cmpop): ... @@ -365,14 +340,12 @@ class LtE(cmpop): ... class NotEq(cmpop): ... class NotIn(cmpop): ... - class comprehension(AST): target: expr iter: expr ifs: typing.List[expr] is_async: int - class ExceptHandler(AST): type: Optional[expr] name: Optional[identifier] @@ -380,7 +353,6 @@ class ExceptHandler(AST): lineno: int col_offset: int - class arguments(AST): args: typing.List[arg] vararg: Optional[arg] @@ -408,6 +380,5 @@ class withitem(AST): context_expr: expr optional_vars: Optional[expr] - class TypeIgnore(AST): lineno: int From e61c9e7da96ea9c872196e1dc62559b3b26eaa5b Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 12:10:09 -0700 Subject: [PATCH 07/10] Fix bad YAML interpretation for new shard See the failure at https://travis-ci.org/python/typeshed/jobs/546450764. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dab87339e57e..1343e6ee435f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,10 @@ matrix: - name: "autoformatters" python: 3.6 env: - - TEST_CMD="isort --check-only --recursive . && black --check stdlib tests third_party" - INSTALL="test" + script: + - isort --check-only --recursive . + - black --check stdlib tests third_party - name: "pytype" python: 3.6 env: From a4acf3102ac6cad96f6a56e76cd4110f580889a0 Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 12:18:10 -0700 Subject: [PATCH 08/10] Fix MyPy tests failing due to bad # type: ignore comments --- stdlib/2/__builtin__.pyi | 12 ++++++------ stdlib/3/configparser.pyi | 4 ++-- stdlib/3/unittest/case.pyi | 24 ++++++++++++------------ third_party/2and3/boto/connection.pyi | 4 ++-- third_party/2and3/boto/s3/connection.pyi | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index ee457a579cac..5a319eaff551 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -1188,18 +1188,18 @@ if sys.version_info >= (3,): else: @overload - def filter( - __function: Callable[[AnyStr], Any], # type: ignore + def filter( # type: ignore + __function: Callable[[AnyStr], Any], __iterable: AnyStr, ) -> AnyStr: ... @overload - def filter( - __function: None, # type: ignore + def filter( # type: ignore + __function: None, __iterable: Tuple[Optional[_T], ...], ) -> Tuple[_T, ...]: ... @overload - def filter( - __function: Callable[[_T], Any], # type: ignore + def filter( # type: ignore + __function: Callable[[_T], Any], __iterable: Tuple[_T, ...], ) -> Tuple[_T, ...]: ... @overload diff --git a/stdlib/3/configparser.pyi b/stdlib/3/configparser.pyi index b2fdfcd712e2..a2c4eeb6dfe3 100644 --- a/stdlib/3/configparser.pyi +++ b/stdlib/3/configparser.pyi @@ -154,9 +154,9 @@ class SectionProxy(MutableMapping[str, str]): def parser(self) -> RawConfigParser: ... @property def name(self) -> str: ... - def get( + def get( # type: ignore self, option: str, fallback: Optional[str] = ..., *, raw: bool = ..., vars: Optional[_section] = ..., **kwargs: Any - ) -> str: ... # type: ignore + ) -> str: ... # These are partially-applied version of the methods with the same names in # RawConfigParser; the stubs should be kept updated together def getint(self, option: str, *, raw: bool = ..., vars: Optional[_section] = ..., fallback: int = ...) -> int: ... diff --git a/stdlib/3/unittest/case.pyi b/stdlib/3/unittest/case.pyi index af0c79124e9e..1f08011b1746 100644 --- a/stdlib/3/unittest/case.pyi +++ b/stdlib/3/unittest/case.pyi @@ -73,8 +73,8 @@ class TestCase: def assertLess(self, a: Any, b: Any, msg: Any = ...) -> None: ... def assertLessEqual(self, a: Any, b: Any, msg: Any = ...) -> None: ... @overload - def assertRaises( - self, # type: ignore + def assertRaises( # type: ignore + self, expected_exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], callable: Callable[..., Any], *args: Any, @@ -85,8 +85,8 @@ class TestCase: self, expected_exception: Union[Type[_E], Tuple[Type[_E], ...]], msg: Any = ... ) -> _AssertRaisesContext[_E]: ... @overload - def assertRaisesRegex( - self, # type: ignore + def assertRaisesRegex( # type: ignore + self, expected_exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], callable: Callable[..., Any], @@ -101,8 +101,8 @@ class TestCase: msg: Any = ..., ) -> _AssertRaisesContext[_E]: ... @overload - def assertWarns( - self, # type: ignore + def assertWarns( # type: ignore + self, expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], callable: Callable[..., Any], *args: Any, @@ -113,8 +113,8 @@ class TestCase: self, expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], msg: Any = ... ) -> _AssertWarnsContext: ... @overload - def assertWarnsRegex( - self, # type: ignore + def assertWarnsRegex( # type: ignore + self, expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]], expected_regex: Union[str, bytes, Pattern[str], Pattern[bytes]], callable: Callable[..., Any], @@ -168,8 +168,8 @@ class TestCase: def assert_(self, expr: bool, msg: Any = ...) -> None: ... def failIf(self, expr: bool, msg: Any = ...) -> None: ... @overload - def failUnlessRaises( - self, # type: ignore + def failUnlessRaises( # type: ignore + self, exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], callable: Callable[..., Any] = ..., *args: Any, @@ -185,8 +185,8 @@ class TestCase: ) -> None: ... def assertRegexpMatches(self, text: AnyStr, regex: Union[AnyStr, Pattern[AnyStr]], msg: Any = ...) -> None: ... @overload - def assertRaisesRegexp( - self, # type: ignore + def assertRaisesRegexp( # type: ignore + self, exception: Union[Type[BaseException], Tuple[Type[BaseException], ...]], callable: Callable[..., Any] = ..., *args: Any, diff --git a/third_party/2and3/boto/connection.pyi b/third_party/2and3/boto/connection.pyi index a16d6c999570..7d1879176e21 100644 --- a/third_party/2and3/boto/connection.pyi +++ b/third_party/2and3/boto/connection.pyi @@ -166,9 +166,9 @@ class AWSQueryConnection(AWSAuthConnection): provider: str = ..., ) -> None: ... def get_utf8_value(self, value): ... - def make_request( + def make_request( # type: ignore # https://github.com/python/mypy/issues/1237 self, action, params: Optional[Any] = ..., path: str = ..., verb: str = ..., *args, **kwargs - ): ... # type: ignore # https://github.com/python/mypy/issues/1237 + ): ... def build_list_params(self, params, items, label): ... def build_complex_list_params(self, params, items, label, names): ... def get_list(self, action, params, markers, path: str = ..., parent: Optional[Any] = ..., verb: str = ...): ... diff --git a/third_party/2and3/boto/s3/connection.pyi b/third_party/2and3/boto/s3/connection.pyi index c24b782bd0dd..185c5e3fb094 100644 --- a/third_party/2and3/boto/s3/connection.pyi +++ b/third_party/2and3/boto/s3/connection.pyi @@ -125,7 +125,7 @@ class S3Connection(AWSAuthConnection): self, bucket_name, headers: Optional[Dict[Text, Text]] = ..., location: Any = ..., policy: Optional[Any] = ... ): ... def delete_bucket(self, bucket, headers: Optional[Dict[Text, Text]] = ...): ... - def make_request( + def make_request( # type: ignore # https://github.com/python/mypy/issues/1237 self, method, bucket: str = ..., @@ -138,4 +138,4 @@ class S3Connection(AWSAuthConnection): retry_handler: Optional[Any] = ..., *args, **kwargs - ): ... # type: ignore # https://github.com/python/mypy/issues/1237 + ): ... From 7a9b31905666c2a2b2a90d73fde1b5fd0bb58a1d Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 15:56:47 -0700 Subject: [PATCH 09/10] Fix isort vs. black conflicts via fmt: off statements They handle comments in the import section differently. The best solution for now is to turn off Black, because isort has the more desirable behavior. --- stdlib/2and3/contextlib.pyi | 4 +++- stdlib/2and3/sysconfig.pyi | 4 +++- stdlib/3/_operator.pyi | 4 +++- stdlib/3/ast.pyi | 3 ++- stdlib/3/configparser.pyi | 4 +++- stdlib/3/os/__init__.pyi | 3 ++- third_party/2/six/__init__.pyi | 3 ++- third_party/2and3/bleach/utils.pyi | 3 +++ third_party/2and3/click/__init__.pyi | 11 +++-------- third_party/3/six/__init__.pyi | 3 ++- 10 files changed, 26 insertions(+), 16 deletions(-) diff --git a/stdlib/2and3/contextlib.pyi b/stdlib/2and3/contextlib.pyi index eb0297d749e1..dc924751470f 100644 --- a/stdlib/2and3/contextlib.pyi +++ b/stdlib/2and3/contextlib.pyi @@ -1,13 +1,15 @@ # Stubs for contextlib +# fmt: off import sys from types import TracebackType - # Aliased here for backwards compatibility; TODO eventually remove this from typing import IO, Any, Callable from typing import ContextManager as ContextManager from typing import Generator, Generic, Iterable, Iterator, Optional, Type, TypeVar, overload +# fmt: on + if sys.version_info >= (3, 5): from typing import AsyncContextManager, AsyncIterator diff --git a/stdlib/2and3/sysconfig.pyi b/stdlib/2and3/sysconfig.pyi index 8378174919f4..4f1133db1e0d 100644 --- a/stdlib/2and3/sysconfig.pyi +++ b/stdlib/2and3/sysconfig.pyi @@ -1,6 +1,8 @@ # Stubs for sysconfig - +# fmt: off from typing import IO, Any, Dict, List, Optional, Tuple, Union, overload + +# fmt: on @overload def get_config_vars() -> Dict[str, Any]: ... @overload diff --git a/stdlib/3/_operator.pyi b/stdlib/3/_operator.pyi index 48022b007b64..b2f551fb55c4 100644 --- a/stdlib/3/_operator.pyi +++ b/stdlib/3/_operator.pyi @@ -1,7 +1,7 @@ # Stubs for _operator (Python 3.5) +# fmt: off import sys - # In reality the import is the other way around, but this way we can keep the operator stub in 2and3 from operator import abs as abs from operator import add as add @@ -57,6 +57,8 @@ from operator import truth as truth from operator import xor as xor from typing import AnyStr +# fmt: on + if sys.version_info >= (3, 5): from operator import matmul as matmul, imatmul as imatmul diff --git a/stdlib/3/ast.pyi b/stdlib/3/ast.pyi index b628932a6300..f4d792f349c9 100644 --- a/stdlib/3/ast.pyi +++ b/stdlib/3/ast.pyi @@ -1,7 +1,7 @@ # Python 3.5 ast +# fmt: off import sys - # Rename typing to _typing, as not to conflict with typing imported # from _ast below when loaded in an unorthodox way by the Dropbox # internal Bazel integration. @@ -10,6 +10,7 @@ from typing import Any, Iterator, Optional, TypeVar, Union from _ast import * # type: ignore +# fmt: on class NodeVisitor: def visit(self, node: AST) -> Any: ... def generic_visit(self, node: AST) -> Any: ... diff --git a/stdlib/3/configparser.pyi b/stdlib/3/configparser.pyi index a2c4eeb6dfe3..e467f6f27bac 100644 --- a/stdlib/3/configparser.pyi +++ b/stdlib/3/configparser.pyi @@ -1,8 +1,8 @@ # Based on http://docs.python.org/3.5/library/configparser.html and on # reading configparser.py. +# fmt: off import sys - # Types only used in type comments only from typing import ( # noqa IO, @@ -25,6 +25,8 @@ from typing import ( # noqa overload, ) +# fmt: on + if sys.version_info >= (3, 6): from os import PathLike diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index 8cf5261d48b1..30e1466a488a 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -1,8 +1,8 @@ # Stubs for os # Ron Murawski +# fmt: off import sys - # Re-exported names from other modules. from builtins import OSError as error from io import TextIOWrapper as _TextIOWrapper @@ -33,6 +33,7 @@ from typing import ( from . import path as path +# fmt: on _T = TypeVar("_T") # ----- os variables ----- diff --git a/third_party/2/six/__init__.pyi b/third_party/2/six/__init__.pyi index 59f4e3c60fc8..d6610360c894 100644 --- a/third_party/2/six/__init__.pyi +++ b/third_party/2/six/__init__.pyi @@ -2,10 +2,10 @@ from __future__ import print_function +# fmt: off import types import typing import unittest - # Exports from __builtin__ import unichr as unichr from functools import wraps as wraps @@ -33,6 +33,7 @@ from typing import ( from . import moves +# fmt: on _T = TypeVar("_T") _K = TypeVar("_K") _V = TypeVar("_V") diff --git a/third_party/2and3/bleach/utils.pyi b/third_party/2and3/bleach/utils.pyi index 2e0daaf47978..f54b67f94b63 100644 --- a/third_party/2and3/bleach/utils.pyi +++ b/third_party/2and3/bleach/utils.pyi @@ -1,5 +1,8 @@ +# fmt: off from collections import OrderedDict from typing import Any, Mapping, Text, overload + +# fmt:on @overload def alphabetize_attributes(attrs: None) -> None: ... @overload diff --git a/third_party/2and3/click/__init__.pyi b/third_party/2and3/click/__init__.pyi index bd04f4a99a57..b86d2d9794ce 100644 --- a/third_party/2and3/click/__init__.pyi +++ b/third_party/2and3/click/__init__.pyi @@ -14,6 +14,7 @@ :license: BSD, see LICENSE for more details. """ +# fmt: off # Core classes from .core import Argument as Argument from .core import BaseCommand as BaseCommand @@ -24,7 +25,6 @@ from .core import Group as Group from .core import MultiCommand as MultiCommand from .core import Option as Option from .core import Parameter as Parameter - # Decorators from .decorators import argument as argument from .decorators import command as command @@ -37,7 +37,6 @@ from .decorators import pass_context as pass_context from .decorators import pass_obj as pass_obj from .decorators import password_option as password_option from .decorators import version_option as version_option - # Exceptions from .exceptions import Abort as Abort from .exceptions import BadArgumentUsage as BadArgumentUsage @@ -48,17 +47,13 @@ from .exceptions import FileError as FileError from .exceptions import MissingParameter as MissingParameter from .exceptions import NoSuchOption as NoSuchOption from .exceptions import UsageError as UsageError - # Formatting from .formatting import HelpFormatter as HelpFormatter from .formatting import wrap_text as wrap_text - # Globals from .globals import get_current_context as get_current_context - # Parsing from .parser import OptionParser as OptionParser - # Terminal functions from .termui import clear as clear from .termui import confirm as confirm @@ -73,7 +68,6 @@ from .termui import prompt as prompt from .termui import secho as secho from .termui import style as style from .termui import unstyle as unstyle - # Types from .types import BOOL as BOOL from .types import FLOAT as FLOAT @@ -87,7 +81,6 @@ from .types import IntRange as IntRange from .types import ParamType as ParamType from .types import Path as Path from .types import Tuple as Tuple - # Utilities from .utils import echo as echo from .utils import format_filename as format_filename @@ -97,6 +90,8 @@ from .utils import get_os_args as get_os_args from .utils import get_text_stream as get_text_stream from .utils import open_file as open_file +# fmt: on + # Controls if click should emit the warning about the use of unicode # literals. disable_unicode_literals_warning: bool diff --git a/third_party/3/six/__init__.pyi b/third_party/3/six/__init__.pyi index af53a6108aa8..36ee88abb7db 100644 --- a/third_party/3/six/__init__.pyi +++ b/third_party/3/six/__init__.pyi @@ -2,12 +2,12 @@ from __future__ import print_function +# fmt: off import types import typing import unittest from builtins import next as next from functools import wraps as wraps - # Exports from io import BytesIO as BytesIO from io import StringIO as StringIO @@ -34,6 +34,7 @@ from typing import ( from . import moves +# fmt: on _T = TypeVar("_T") _K = TypeVar("_K") _V = TypeVar("_V") From 87bebc291925f81ada73728188d3aad9cbe47f8e Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Sun, 16 Jun 2019 15:58:22 -0700 Subject: [PATCH 10/10] Combine as imports This complies more with the original style. The only reason I didn't have this on was that I didn't know it was an option. --- pyproject.toml | 1 + stdlib/2/collections.pyi | 49 ++++--- stdlib/2/email/utils.pyi | 10 +- stdlib/2/exceptions.pyi | 98 +++++++------ stdlib/2/future_builtins.pyi | 4 +- stdlib/2/io.pyi | 28 ++-- stdlib/2/multiprocessing/__init__.pyi | 7 +- stdlib/2/sre_parse.pyi | 4 +- stdlib/2and3/contextlib.pyi | 17 ++- stdlib/2and3/csv.pyi | 29 ++-- stdlib/2and3/ctypes/__init__.pyi | 4 +- stdlib/2and3/dis.pyi | 26 ++-- stdlib/2and3/plistlib.pyi | 4 +- stdlib/2and3/weakref.pyi | 16 +- stdlib/3/_operator.pyi | 106 +++++++------- stdlib/3/asyncio/__init__.pyi | 138 ++++++++++-------- stdlib/3/asyncio/futures.pyi | 5 +- stdlib/3/collections/__init__.pyi | 57 ++++---- stdlib/3/collections/abc.pyi | 34 +++-- stdlib/3/imp.pyi | 18 ++- stdlib/3/importlib/abc.pyi | 3 +- stdlib/3/multiprocessing/__init__.pyi | 19 ++- stdlib/3/platform.pyi | 3 +- stdlib/3/sre_parse.pyi | 7 +- third_party/2/six/moves/__init__.pyi | 15 +- third_party/2/six/moves/urllib/error.pyi | 3 +- third_party/2/six/moves/urllib/parse.pyi | 50 ++++--- third_party/2/six/moves/urllib/request.pyi | 74 +++++----- third_party/2/six/moves/urllib/response.pyi | 5 +- third_party/2and3/attr/__init__.pyi | 5 +- third_party/2and3/bleach/__init__.pyi | 15 +- third_party/2and3/click/__init__.pyi | 137 +++++++++-------- third_party/2and3/click/types.pyi | 7 +- third_party/2and3/dateutil/tz/__init__.pyi | 24 +-- third_party/2and3/dateutil/tz/tz.pyi | 5 +- third_party/2and3/flask/__init__.pyi | 68 ++++----- third_party/2and3/flask/templating.pyi | 3 +- third_party/2and3/flask/wrappers.pyi | 3 +- .../google/protobuf/map_unittest_pb2.pyi | 3 +- third_party/2and3/jinja2/__init__.pyi | 79 +++++----- third_party/2and3/jinja2/runtime.pyi | 8 +- third_party/2and3/jinja2/utils.pyi | 4 +- third_party/2and3/markupsafe/__init__.pyi | 4 +- third_party/2and3/pymysql/__init__.pyi | 42 +++--- third_party/2and3/pymysql/connections.pyi | 48 +++--- third_party/2and3/pymysql/converters.pyi | 3 +- third_party/2and3/requests/adapters.pyi | 3 +- third_party/2and3/requests/models.pyi | 3 +- .../requests/packages/urllib3/__init__.pyi | 3 +- .../packages/urllib3/connectionpool.pyi | 7 +- .../requests/packages/urllib3/response.pyi | 3 +- third_party/2and3/requests/sessions.pyi | 4 +- third_party/2and3/simplejson/__init__.pyi | 3 +- third_party/2and3/typing_extensions.pyi | 35 +++-- third_party/2and3/werkzeug/debug/__init__.pyi | 3 +- third_party/2and3/werkzeug/testapp.pyi | 3 +- third_party/3/six/__init__.pyi | 3 +- third_party/3/six/moves/__init__.pyi | 16 +- third_party/3/six/moves/urllib/error.pyi | 4 +- third_party/3/six/moves/urllib/parse.pyi | 42 +++--- third_party/3/six/moves/urllib/request.pyi | 70 ++++----- 61 files changed, 761 insertions(+), 733 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 27d7c72dc443..342dbf3985e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,4 +6,5 @@ multi_line_output = 3 include_trailing_comma = true force_grid_wrap = 0 use_parentheses = true +combine_as_imports = true line_length = 130 diff --git a/stdlib/2/collections.pyi b/stdlib/2/collections.pyi index 114e16c1e106..9c6f2b310613 100644 --- a/stdlib/2/collections.pyi +++ b/stdlib/2/collections.pyi @@ -1,26 +1,33 @@ # These are not exported. # These are exported. -from typing import AbstractSet as Set -from typing import Callable as Callable -from typing import Container as Container -from typing import Dict, Generic -from typing import Hashable as Hashable -from typing import ItemsView as ItemsView -from typing import Iterable as Iterable -from typing import Iterator as Iterator -from typing import KeysView as KeysView -from typing import List -from typing import Mapping as Mapping -from typing import MappingView as MappingView -from typing import MutableMapping as MutableMapping -from typing import MutableSequence as MutableSequence -from typing import MutableSet as MutableSet -from typing import Optional, Reversible -from typing import Sequence as Sequence -from typing import Sized as Sized -from typing import Tuple, Type, TypeVar, Union -from typing import ValuesView as ValuesView -from typing import overload +from typing import ( + AbstractSet as Set, + Callable as Callable, + Container as Container, + Dict, + Generic, + Hashable as Hashable, + ItemsView as ItemsView, + Iterable as Iterable, + Iterator as Iterator, + KeysView as KeysView, + List, + Mapping as Mapping, + MappingView as MappingView, + MutableMapping as MutableMapping, + MutableSequence as MutableSequence, + MutableSet as MutableSet, + Optional, + Reversible, + Sequence as Sequence, + Sized as Sized, + Tuple, + Type, + TypeVar, + Union, + ValuesView as ValuesView, + overload, +) _S = TypeVar("_S") _T = TypeVar("_T") diff --git a/stdlib/2/email/utils.pyi b/stdlib/2/email/utils.pyi index 24bc60bda046..257e4b1c947a 100644 --- a/stdlib/2/email/utils.pyi +++ b/stdlib/2/email/utils.pyi @@ -1,7 +1,9 @@ -from email._parseaddr import AddressList as _AddressList -from email._parseaddr import mktime_tz as mktime_tz -from email._parseaddr import parsedate as _parsedate -from email._parseaddr import parsedate_tz as _parsedate_tz +from email._parseaddr import ( + AddressList as _AddressList, + mktime_tz as mktime_tz, + parsedate as _parsedate, + parsedate_tz as _parsedate_tz, +) from quopri import decodestring as _qdecode from typing import Any, Optional diff --git a/stdlib/2/exceptions.pyi b/stdlib/2/exceptions.pyi index 6642858e8d60..fbad89750731 100644 --- a/stdlib/2/exceptions.pyi +++ b/stdlib/2/exceptions.pyi @@ -1,48 +1,50 @@ -from __builtin__ import ArithmeticError as ArithmeticError -from __builtin__ import AssertionError as AssertionError -from __builtin__ import AttributeError as AttributeError -from __builtin__ import BaseException as BaseException -from __builtin__ import BufferError as BufferError -from __builtin__ import BytesWarning as BytesWarning -from __builtin__ import DeprecationWarning as DeprecationWarning -from __builtin__ import EnvironmentError as EnvironmentError -from __builtin__ import EOFError as EOFError -from __builtin__ import Exception as Exception -from __builtin__ import FloatingPointError as FloatingPointError -from __builtin__ import FutureWarning as FutureWarning -from __builtin__ import GeneratorExit as GeneratorExit -from __builtin__ import ImportError as ImportError -from __builtin__ import ImportWarning as ImportWarning -from __builtin__ import IndentationError as IndentationError -from __builtin__ import IndexError as IndexError -from __builtin__ import IOError as IOError -from __builtin__ import KeyboardInterrupt as KeyboardInterrupt -from __builtin__ import KeyError as KeyError -from __builtin__ import LookupError as LookupError -from __builtin__ import MemoryError as MemoryError -from __builtin__ import NameError as NameError -from __builtin__ import NotImplementedError as NotImplementedError -from __builtin__ import OSError as OSError -from __builtin__ import OverflowError as OverflowError -from __builtin__ import PendingDeprecationWarning as PendingDeprecationWarning -from __builtin__ import ReferenceError as ReferenceError -from __builtin__ import RuntimeError as RuntimeError -from __builtin__ import RuntimeWarning as RuntimeWarning -from __builtin__ import StandardError as StandardError -from __builtin__ import StopIteration as StopIteration -from __builtin__ import SyntaxError as SyntaxError -from __builtin__ import SyntaxWarning as SyntaxWarning -from __builtin__ import SystemError as SystemError -from __builtin__ import SystemExit as SystemExit -from __builtin__ import TabError as TabError -from __builtin__ import TypeError as TypeError -from __builtin__ import UnboundLocalError as UnboundLocalError -from __builtin__ import UnicodeDecodeError as UnicodeDecodeError -from __builtin__ import UnicodeEncodeError as UnicodeEncodeError -from __builtin__ import UnicodeError as UnicodeError -from __builtin__ import UnicodeTranslateError as UnicodeTranslateError -from __builtin__ import UnicodeWarning as UnicodeWarning -from __builtin__ import UserWarning as UserWarning -from __builtin__ import ValueError as ValueError -from __builtin__ import Warning as Warning -from __builtin__ import ZeroDivisionError as ZeroDivisionError +from __builtin__ import ( + ArithmeticError as ArithmeticError, + AssertionError as AssertionError, + AttributeError as AttributeError, + BaseException as BaseException, + BufferError as BufferError, + BytesWarning as BytesWarning, + DeprecationWarning as DeprecationWarning, + EnvironmentError as EnvironmentError, + EOFError as EOFError, + Exception as Exception, + FloatingPointError as FloatingPointError, + FutureWarning as FutureWarning, + GeneratorExit as GeneratorExit, + ImportError as ImportError, + ImportWarning as ImportWarning, + IndentationError as IndentationError, + IndexError as IndexError, + IOError as IOError, + KeyboardInterrupt as KeyboardInterrupt, + KeyError as KeyError, + LookupError as LookupError, + MemoryError as MemoryError, + NameError as NameError, + NotImplementedError as NotImplementedError, + OSError as OSError, + OverflowError as OverflowError, + PendingDeprecationWarning as PendingDeprecationWarning, + ReferenceError as ReferenceError, + RuntimeError as RuntimeError, + RuntimeWarning as RuntimeWarning, + StandardError as StandardError, + StopIteration as StopIteration, + SyntaxError as SyntaxError, + SyntaxWarning as SyntaxWarning, + SystemError as SystemError, + SystemExit as SystemExit, + TabError as TabError, + TypeError as TypeError, + UnboundLocalError as UnboundLocalError, + UnicodeDecodeError as UnicodeDecodeError, + UnicodeEncodeError as UnicodeEncodeError, + UnicodeError as UnicodeError, + UnicodeTranslateError as UnicodeTranslateError, + UnicodeWarning as UnicodeWarning, + UserWarning as UserWarning, + ValueError as ValueError, + Warning as Warning, + ZeroDivisionError as ZeroDivisionError, +) diff --git a/stdlib/2/future_builtins.pyi b/stdlib/2/future_builtins.pyi index fffe09c87c20..48728b5e8803 100644 --- a/stdlib/2/future_builtins.pyi +++ b/stdlib/2/future_builtins.pyi @@ -1,6 +1,4 @@ -from itertools import ifilter as filter -from itertools import imap as map -from itertools import izip as zip +from itertools import ifilter as filter, imap as map, izip as zip from typing import Any def ascii(obj: Any) -> str: ... diff --git a/stdlib/2/io.pyi b/stdlib/2/io.pyi index a8df7843512c..009aee4749a8 100644 --- a/stdlib/2/io.pyi +++ b/stdlib/2/io.pyi @@ -7,19 +7,21 @@ from typing import IO, Any, BinaryIO, Iterable, Iterator, List, Optional, TextIO, Union, overload import _io -from _io import DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE -from _io import BlockingIOError as BlockingIOError -from _io import BufferedRandom as BufferedRandom -from _io import BufferedReader as BufferedReader -from _io import BufferedRWPair as BufferedRWPair -from _io import BufferedWriter as BufferedWriter -from _io import BytesIO as BytesIO -from _io import FileIO as FileIO -from _io import IncrementalNewlineDecoder as IncrementalNewlineDecoder -from _io import StringIO as StringIO -from _io import TextIOWrapper as TextIOWrapper -from _io import UnsupportedOperation as UnsupportedOperation -from _io import open as open +from _io import ( + DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE, + BlockingIOError as BlockingIOError, + BufferedRandom as BufferedRandom, + BufferedReader as BufferedReader, + BufferedRWPair as BufferedRWPair, + BufferedWriter as BufferedWriter, + BytesIO as BytesIO, + FileIO as FileIO, + IncrementalNewlineDecoder as IncrementalNewlineDecoder, + StringIO as StringIO, + TextIOWrapper as TextIOWrapper, + UnsupportedOperation as UnsupportedOperation, + open as open, +) def _OpenWrapper( file: Union[str, unicode, int], diff --git a/stdlib/2/multiprocessing/__init__.pyi b/stdlib/2/multiprocessing/__init__.pyi index 7a8ce8b37467..b4f58920f574 100644 --- a/stdlib/2/multiprocessing/__init__.pyi +++ b/stdlib/2/multiprocessing/__init__.pyi @@ -1,9 +1,6 @@ from multiprocessing import pool -from multiprocessing.process import Process as Process -from multiprocessing.process import active_children as active_children -from multiprocessing.process import current_process as current_process -from multiprocessing.util import SUBDEBUG as SUBDEBUG -from multiprocessing.util import SUBWARNING as SUBWARNING +from multiprocessing.process import Process as Process, active_children as active_children, current_process as current_process +from multiprocessing.util import SUBDEBUG as SUBDEBUG, SUBWARNING as SUBWARNING from Queue import Queue as _BaseQueue from typing import Any, Callable, Iterable, Optional, TypeVar diff --git a/stdlib/2/sre_parse.pyi b/stdlib/2/sre_parse.pyi index 636ffcaf8db7..f53ba1e38f2e 100644 --- a/stdlib/2/sre_parse.pyi +++ b/stdlib/2/sre_parse.pyi @@ -1,8 +1,6 @@ # Source: https://hg.python.org/cpython/file/2.7/Lib/sre_parse.py -from typing import Any, Dict, Iterable, List, Match, Optional -from typing import Pattern as _Pattern -from typing import Set, Tuple, Union +from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Pattern, Set, Tuple, Union SPECIAL_CHARS: str REPEAT_CHARS: str diff --git a/stdlib/2and3/contextlib.pyi b/stdlib/2and3/contextlib.pyi index dc924751470f..c9b7963b267b 100644 --- a/stdlib/2and3/contextlib.pyi +++ b/stdlib/2and3/contextlib.pyi @@ -4,9 +4,20 @@ import sys from types import TracebackType # Aliased here for backwards compatibility; TODO eventually remove this -from typing import IO, Any, Callable -from typing import ContextManager as ContextManager -from typing import Generator, Generic, Iterable, Iterator, Optional, Type, TypeVar, overload +from typing import ( + IO, + Any, + Callable, + ContextManager as ContextManager, + Generator, + Generic, + Iterable, + Iterator, + Optional, + Type, + TypeVar, + overload, +) # fmt: on diff --git a/stdlib/2and3/csv.pyi b/stdlib/2and3/csv.pyi index 50287fa3c0eb..80868b6b7340 100644 --- a/stdlib/2and3/csv.pyi +++ b/stdlib/2and3/csv.pyi @@ -1,17 +1,20 @@ import sys -from _csv import QUOTE_ALL as QUOTE_ALL -from _csv import QUOTE_MINIMAL as QUOTE_MINIMAL -from _csv import QUOTE_NONE as QUOTE_NONE -from _csv import QUOTE_NONNUMERIC as QUOTE_NONNUMERIC -from _csv import Error as Error -from _csv import _reader, _writer -from _csv import field_size_limit as field_size_limit -from _csv import get_dialect as get_dialect -from _csv import list_dialects as list_dialects -from _csv import reader as reader -from _csv import register_dialect as register_dialect -from _csv import unregister_dialect as unregister_dialect -from _csv import writer as writer +from _csv import ( + QUOTE_ALL as QUOTE_ALL, + QUOTE_MINIMAL as QUOTE_MINIMAL, + QUOTE_NONE as QUOTE_NONE, + QUOTE_NONNUMERIC as QUOTE_NONNUMERIC, + Error as Error, + _reader, + _writer, + field_size_limit as field_size_limit, + get_dialect as get_dialect, + list_dialects as list_dialects, + reader as reader, + register_dialect as register_dialect, + unregister_dialect as unregister_dialect, + writer as writer, +) from collections import OrderedDict from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Type, Union diff --git a/stdlib/2and3/ctypes/__init__.pyi b/stdlib/2and3/ctypes/__init__.pyi index cbd0e3163f9c..66a5ab3c711a 100644 --- a/stdlib/2and3/ctypes/__init__.pyi +++ b/stdlib/2and3/ctypes/__init__.pyi @@ -18,9 +18,9 @@ from typing import ( Tuple, Type, TypeVar, + Union as _UnionT, + overload, ) -from typing import Union as _UnionT -from typing import overload _T = TypeVar("_T") _DLLT = TypeVar("_DLLT", bound=CDLL) diff --git a/stdlib/2and3/dis.pyi b/stdlib/2and3/dis.pyi index 717e5f0ddd9f..ccd90a14fcad 100644 --- a/stdlib/2and3/dis.pyi +++ b/stdlib/2and3/dis.pyi @@ -1,17 +1,19 @@ import sys import types -from opcode import EXTENDED_ARG as EXTENDED_ARG -from opcode import HAVE_ARGUMENT as HAVE_ARGUMENT -from opcode import cmp_op as cmp_op -from opcode import hascompare as hascompare -from opcode import hasconst as hasconst -from opcode import hasfree as hasfree -from opcode import hasjabs as hasjabs -from opcode import hasjrel as hasjrel -from opcode import haslocal as haslocal -from opcode import hasname as hasname -from opcode import opmap as opmap -from opcode import opname as opname +from opcode import ( + EXTENDED_ARG as EXTENDED_ARG, + HAVE_ARGUMENT as HAVE_ARGUMENT, + cmp_op as cmp_op, + hascompare as hascompare, + hasconst as hasconst, + hasfree as hasfree, + hasjabs as hasjabs, + hasjrel as hasjrel, + haslocal as haslocal, + hasname as hasname, + opmap as opmap, + opname as opname, +) from typing import IO, Any, Callable, Dict, Iterator, List, NamedTuple, Optional, Tuple, Union if sys.version_info >= (3, 4): diff --git a/stdlib/2and3/plistlib.pyi b/stdlib/2and3/plistlib.pyi index c5ab6c951b3f..916cf8c8e959 100644 --- a/stdlib/2and3/plistlib.pyi +++ b/stdlib/2and3/plistlib.pyi @@ -1,9 +1,7 @@ # Stubs for plistlib import sys -from typing import IO, Any -from typing import Dict as DictT -from typing import Mapping, MutableMapping, Optional, Type, TypeVar, Union +from typing import IO, Any, Dict as DictT, Mapping, MutableMapping, Optional, Type, TypeVar, Union if sys.version_info >= (3,): from enum import Enum diff --git a/stdlib/2and3/weakref.pyi b/stdlib/2and3/weakref.pyi index 2c77bcc5494e..973a4d57a25e 100644 --- a/stdlib/2and3/weakref.pyi +++ b/stdlib/2and3/weakref.pyi @@ -19,13 +19,15 @@ from typing import ( overload, ) -from _weakref import CallableProxyType as CallableProxyType -from _weakref import ProxyType as ProxyType -from _weakref import ReferenceType as ReferenceType -from _weakref import getweakrefcount as getweakrefcount -from _weakref import getweakrefs as getweakrefs -from _weakref import proxy as proxy -from _weakref import ref as ref +from _weakref import ( + CallableProxyType as CallableProxyType, + ProxyType as ProxyType, + ReferenceType as ReferenceType, + getweakrefcount as getweakrefcount, + getweakrefs as getweakrefs, + proxy as proxy, + ref as ref, +) if sys.version_info < (3, 0): from exceptions import ReferenceError as ReferenceError diff --git a/stdlib/3/_operator.pyi b/stdlib/3/_operator.pyi index b2f551fb55c4..3abebe4f7326 100644 --- a/stdlib/3/_operator.pyi +++ b/stdlib/3/_operator.pyi @@ -3,58 +3,60 @@ # fmt: off import sys # In reality the import is the other way around, but this way we can keep the operator stub in 2and3 -from operator import abs as abs -from operator import add as add -from operator import and_ as and_ -from operator import attrgetter as attrgetter -from operator import concat as concat -from operator import contains as contains -from operator import countOf as countOf -from operator import delitem as delitem -from operator import eq as eq -from operator import floordiv as floordiv -from operator import ge as ge -from operator import getitem as getitem -from operator import gt as gt -from operator import iadd as iadd -from operator import iand as iand -from operator import iconcat as iconcat -from operator import ifloordiv as ifloordiv -from operator import ilshift as ilshift -from operator import imod as imod -from operator import imul as imul -from operator import index as index -from operator import indexOf as indexOf -from operator import inv as inv -from operator import invert as invert -from operator import ior as ior -from operator import ipow as ipow -from operator import irshift as irshift -from operator import is_ as is_ -from operator import is_not as is_not -from operator import isub as isub -from operator import itemgetter as itemgetter -from operator import itruediv as itruediv -from operator import ixor as ixor -from operator import le as le -from operator import length_hint as length_hint -from operator import lshift as lshift -from operator import lt as lt -from operator import methodcaller as methodcaller -from operator import mod as mod -from operator import mul as mul -from operator import ne as ne -from operator import neg as neg -from operator import not_ as not_ -from operator import or_ as or_ -from operator import pos as pos -from operator import pow as pow -from operator import rshift as rshift -from operator import setitem as setitem -from operator import sub as sub -from operator import truediv as truediv -from operator import truth as truth -from operator import xor as xor +from operator import ( + abs as abs, + add as add, + and_ as and_, + attrgetter as attrgetter, + concat as concat, + contains as contains, + countOf as countOf, + delitem as delitem, + eq as eq, + floordiv as floordiv, + ge as ge, + getitem as getitem, + gt as gt, + iadd as iadd, + iand as iand, + iconcat as iconcat, + ifloordiv as ifloordiv, + ilshift as ilshift, + imod as imod, + imul as imul, + index as index, + indexOf as indexOf, + inv as inv, + invert as invert, + ior as ior, + ipow as ipow, + irshift as irshift, + is_ as is_, + is_not as is_not, + isub as isub, + itemgetter as itemgetter, + itruediv as itruediv, + ixor as ixor, + le as le, + length_hint as length_hint, + lshift as lshift, + lt as lt, + methodcaller as methodcaller, + mod as mod, + mul as mul, + ne as ne, + neg as neg, + not_ as not_, + or_ as or_, + pos as pos, + pow as pow, + rshift as rshift, + setitem as setitem, + sub as sub, + truediv as truediv, + truth as truth, + xor as xor, +) from typing import AnyStr # fmt: on diff --git a/stdlib/3/asyncio/__init__.pyi b/stdlib/3/asyncio/__init__.pyi index 8cc55da95a52..31b98ea21254 100644 --- a/stdlib/3/asyncio/__init__.pyi +++ b/stdlib/3/asyncio/__init__.pyi @@ -1,66 +1,82 @@ import sys from asyncio.base_events import BaseEventLoop as BaseEventLoop -from asyncio.coroutines import coroutine as coroutine -from asyncio.coroutines import iscoroutine as iscoroutine -from asyncio.coroutines import iscoroutinefunction as iscoroutinefunction -from asyncio.events import AbstractEventLoop as AbstractEventLoop -from asyncio.events import AbstractEventLoopPolicy as AbstractEventLoopPolicy -from asyncio.events import AbstractServer as AbstractServer -from asyncio.events import Handle as Handle -from asyncio.events import TimerHandle as TimerHandle -from asyncio.events import get_child_watcher as get_child_watcher -from asyncio.events import get_event_loop as get_event_loop -from asyncio.events import get_event_loop_policy as get_event_loop_policy -from asyncio.events import new_event_loop as new_event_loop -from asyncio.events import set_child_watcher as set_child_watcher -from asyncio.events import set_event_loop as set_event_loop -from asyncio.events import set_event_loop_policy as set_event_loop_policy -from asyncio.futures import CancelledError as CancelledError -from asyncio.futures import Future as Future -from asyncio.futures import InvalidStateError as InvalidStateError -from asyncio.futures import TimeoutError as TimeoutError -from asyncio.futures import wrap_future as wrap_future -from asyncio.locks import BoundedSemaphore as BoundedSemaphore -from asyncio.locks import Condition as Condition -from asyncio.locks import Event as Event -from asyncio.locks import Lock as Lock -from asyncio.locks import Semaphore as Semaphore -from asyncio.protocols import BaseProtocol as BaseProtocol -from asyncio.protocols import DatagramProtocol as DatagramProtocol -from asyncio.protocols import Protocol as Protocol -from asyncio.protocols import SubprocessProtocol as SubprocessProtocol -from asyncio.queues import LifoQueue as LifoQueue -from asyncio.queues import PriorityQueue as PriorityQueue -from asyncio.queues import Queue as Queue -from asyncio.queues import QueueEmpty as QueueEmpty -from asyncio.queues import QueueFull as QueueFull -from asyncio.streams import IncompleteReadError as IncompleteReadError -from asyncio.streams import LimitOverrunError as LimitOverrunError -from asyncio.streams import StreamReader as StreamReader -from asyncio.streams import StreamReaderProtocol as StreamReaderProtocol -from asyncio.streams import StreamWriter as StreamWriter -from asyncio.streams import open_connection as open_connection -from asyncio.streams import start_server as start_server -from asyncio.subprocess import create_subprocess_exec as create_subprocess_exec -from asyncio.subprocess import create_subprocess_shell as create_subprocess_shell -from asyncio.tasks import ALL_COMPLETED as ALL_COMPLETED -from asyncio.tasks import FIRST_COMPLETED as FIRST_COMPLETED -from asyncio.tasks import FIRST_EXCEPTION as FIRST_EXCEPTION -from asyncio.tasks import Task as Task -from asyncio.tasks import as_completed as as_completed -from asyncio.tasks import ensure_future as ensure_future -from asyncio.tasks import gather as gather -from asyncio.tasks import run_coroutine_threadsafe as run_coroutine_threadsafe -from asyncio.tasks import shield as shield -from asyncio.tasks import sleep as sleep -from asyncio.tasks import wait as wait -from asyncio.tasks import wait_for as wait_for -from asyncio.transports import BaseTransport as BaseTransport -from asyncio.transports import DatagramTransport as DatagramTransport -from asyncio.transports import ReadTransport as ReadTransport -from asyncio.transports import SubprocessTransport as SubprocessTransport -from asyncio.transports import Transport as Transport -from asyncio.transports import WriteTransport as WriteTransport +from asyncio.coroutines import coroutine as coroutine, iscoroutine as iscoroutine, iscoroutinefunction as iscoroutinefunction +from asyncio.events import ( + AbstractEventLoop as AbstractEventLoop, + AbstractEventLoopPolicy as AbstractEventLoopPolicy, + AbstractServer as AbstractServer, + Handle as Handle, + TimerHandle as TimerHandle, + get_child_watcher as get_child_watcher, + get_event_loop as get_event_loop, + get_event_loop_policy as get_event_loop_policy, + new_event_loop as new_event_loop, + set_child_watcher as set_child_watcher, + set_event_loop as set_event_loop, + set_event_loop_policy as set_event_loop_policy, +) +from asyncio.futures import ( + CancelledError as CancelledError, + Future as Future, + InvalidStateError as InvalidStateError, + TimeoutError as TimeoutError, + wrap_future as wrap_future, +) +from asyncio.locks import ( + BoundedSemaphore as BoundedSemaphore, + Condition as Condition, + Event as Event, + Lock as Lock, + Semaphore as Semaphore, +) +from asyncio.protocols import ( + BaseProtocol as BaseProtocol, + DatagramProtocol as DatagramProtocol, + Protocol as Protocol, + SubprocessProtocol as SubprocessProtocol, +) +from asyncio.queues import ( + LifoQueue as LifoQueue, + PriorityQueue as PriorityQueue, + Queue as Queue, + QueueEmpty as QueueEmpty, + QueueFull as QueueFull, +) +from asyncio.streams import ( + IncompleteReadError as IncompleteReadError, + LimitOverrunError as LimitOverrunError, + StreamReader as StreamReader, + StreamReaderProtocol as StreamReaderProtocol, + StreamWriter as StreamWriter, + open_connection as open_connection, + start_server as start_server, +) +from asyncio.subprocess import ( + create_subprocess_exec as create_subprocess_exec, + create_subprocess_shell as create_subprocess_shell, +) +from asyncio.tasks import ( + ALL_COMPLETED as ALL_COMPLETED, + FIRST_COMPLETED as FIRST_COMPLETED, + FIRST_EXCEPTION as FIRST_EXCEPTION, + Task as Task, + as_completed as as_completed, + ensure_future as ensure_future, + gather as gather, + run_coroutine_threadsafe as run_coroutine_threadsafe, + shield as shield, + sleep as sleep, + wait as wait, + wait_for as wait_for, +) +from asyncio.transports import ( + BaseTransport as BaseTransport, + DatagramTransport as DatagramTransport, + ReadTransport as ReadTransport, + SubprocessTransport as SubprocessTransport, + Transport as Transport, + WriteTransport as WriteTransport, +) from typing import List, Type if sys.version_info < (3, 5): diff --git a/stdlib/3/asyncio/futures.pyi b/stdlib/3/asyncio/futures.pyi index be31e7e733c7..926c7519bf1a 100644 --- a/stdlib/3/asyncio/futures.pyi +++ b/stdlib/3/asyncio/futures.pyi @@ -1,8 +1,5 @@ import sys -from concurrent.futures import CancelledError as CancelledError -from concurrent.futures import Error -from concurrent.futures import Future as _ConcurrentFuture -from concurrent.futures import TimeoutError as TimeoutError +from concurrent.futures import CancelledError as CancelledError, Error, Future as _ConcurrentFuture, TimeoutError as TimeoutError from typing import Any, Awaitable, Callable, Generator, Generic, Iterable, List, Optional, Tuple, Type, TypeVar, Union from .events import AbstractEventLoop diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 263937fc743c..cca45e7a6132 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -1,32 +1,37 @@ # These are not exported. import sys import typing -from typing import AbstractSet as Set -from typing import Any -from typing import ByteString as ByteString -from typing import Callable as Callable -from typing import Container as Container -from typing import Dict -from typing import Generator as Generator -from typing import Generic -from typing import Hashable as Hashable -from typing import ItemsView as ItemsView -from typing import Iterable as Iterable -from typing import Iterator as Iterator -from typing import KeysView as KeysView -from typing import List -from typing import Mapping as Mapping -from typing import MappingView as MappingView -from typing import MutableMapping as MutableMapping -from typing import MutableSequence as MutableSequence -from typing import MutableSet as MutableSet -from typing import Optional -from typing import Reversible as Reversible -from typing import Sequence as Sequence -from typing import Sized as Sized -from typing import Tuple, Type, TypeVar, Union -from typing import ValuesView as ValuesView -from typing import overload +from typing import ( + AbstractSet as Set, + Any, + ByteString as ByteString, + Callable as Callable, + Container as Container, + Dict, + Generator as Generator, + Generic, + Hashable as Hashable, + ItemsView as ItemsView, + Iterable as Iterable, + Iterator as Iterator, + KeysView as KeysView, + List, + Mapping as Mapping, + MappingView as MappingView, + MutableMapping as MutableMapping, + MutableSequence as MutableSequence, + MutableSet as MutableSet, + Optional, + Reversible as Reversible, + Sequence as Sequence, + Sized as Sized, + Tuple, + Type, + TypeVar, + Union, + ValuesView as ValuesView, + overload, +) # These are exported. from . import abc diff --git a/stdlib/3/collections/abc.pyi b/stdlib/3/collections/abc.pyi index 3792992bcb4e..f8576c9b17dc 100644 --- a/stdlib/3/collections/abc.pyi +++ b/stdlib/3/collections/abc.pyi @@ -3,22 +3,24 @@ # https://docs.python.org/3.3/whatsnew/3.3.html#collections import sys -from . import Callable as Callable -from . import Container as Container -from . import Hashable as Hashable -from . import ItemsView as ItemsView -from . import Iterable as Iterable -from . import Iterator as Iterator -from . import KeysView as KeysView -from . import Mapping as Mapping -from . import MappingView as MappingView -from . import MutableMapping as MutableMapping -from . import MutableSequence as MutableSequence -from . import MutableSet as MutableSet -from . import Sequence as Sequence -from . import Set as Set -from . import Sized as Sized -from . import ValuesView as ValuesView +from . import ( + Callable as Callable, + Container as Container, + Hashable as Hashable, + ItemsView as ItemsView, + Iterable as Iterable, + Iterator as Iterator, + KeysView as KeysView, + Mapping as Mapping, + MappingView as MappingView, + MutableMapping as MutableMapping, + MutableSequence as MutableSequence, + MutableSet as MutableSet, + Sequence as Sequence, + Set as Set, + Sized as Sized, + ValuesView as ValuesView, +) if sys.version_info >= (3, 5): from . import ( diff --git a/stdlib/3/imp.pyi b/stdlib/3/imp.pyi index 8536aa84bfe8..11d2ef5e7741 100644 --- a/stdlib/3/imp.pyi +++ b/stdlib/3/imp.pyi @@ -5,14 +5,16 @@ import sys import types from typing import IO, Any, List, Optional, Tuple, TypeVar, Union -from _imp import acquire_lock as acquire_lock -from _imp import get_frozen_object as get_frozen_object -from _imp import init_frozen as init_frozen -from _imp import is_builtin as is_builtin -from _imp import is_frozen as is_frozen -from _imp import is_frozen_package as is_frozen_package -from _imp import lock_held as lock_held -from _imp import release_lock as release_lock +from _imp import ( + acquire_lock as acquire_lock, + get_frozen_object as get_frozen_object, + init_frozen as init_frozen, + is_builtin as is_builtin, + is_frozen as is_frozen, + is_frozen_package as is_frozen_package, + lock_held as lock_held, + release_lock as release_lock, +) if sys.version_info >= (3, 5): from _imp import create_dynamic as create_dynamic diff --git a/stdlib/3/importlib/abc.pyi b/stdlib/3/importlib/abc.pyi index fbea8bcdddd2..6b82c9c50698 100644 --- a/stdlib/3/importlib/abc.pyi +++ b/stdlib/3/importlib/abc.pyi @@ -6,8 +6,7 @@ from typing import IO, Any, Iterator, Mapping, Optional, Sequence, Tuple, Union # Loader is exported from this module, but for circular import reasons # exists in its own stub file (with ModuleSpec and ModuleType). -from _importlib_modulespec import Loader as Loader # Exported -from _importlib_modulespec import ModuleSpec +from _importlib_modulespec import Loader as Loader, ModuleSpec # Exported _Path = Union[bytes, str] diff --git a/stdlib/3/multiprocessing/__init__.pyi b/stdlib/3/multiprocessing/__init__.pyi index 90c4095b174c..b4c435f1f5ec 100644 --- a/stdlib/3/multiprocessing/__init__.pyi +++ b/stdlib/3/multiprocessing/__init__.pyi @@ -3,18 +3,17 @@ import sys from logging import Logger from multiprocessing import connection, pool, spawn, synchronize -from multiprocessing.context import AuthenticationError as AuthenticationError -from multiprocessing.context import BaseContext -from multiprocessing.context import BufferTooShort as BufferTooShort -from multiprocessing.context import ProcessError as ProcessError -from multiprocessing.context import TimeoutError as TimeoutError +from multiprocessing.context import ( + AuthenticationError as AuthenticationError, + BaseContext, + BufferTooShort as BufferTooShort, + ProcessError as ProcessError, + TimeoutError as TimeoutError, +) from multiprocessing.managers import SyncManager from multiprocessing.process import current_process as current_process -from multiprocessing.queues import JoinableQueue as JoinableQueue -from multiprocessing.queues import Queue as Queue -from multiprocessing.queues import SimpleQueue as SimpleQueue -from multiprocessing.spawn import freeze_support as freeze_support -from multiprocessing.spawn import set_executable as set_executable +from multiprocessing.queues import JoinableQueue as JoinableQueue, Queue as Queue, SimpleQueue as SimpleQueue +from multiprocessing.spawn import freeze_support as freeze_support, set_executable as set_executable from typing import Any, Callable, ContextManager, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union # N.B. The functions below are generated at runtime by partially applying diff --git a/stdlib/3/platform.pyi b/stdlib/3/platform.pyi index 690d937ae7fd..ec3810b58eb8 100644 --- a/stdlib/3/platform.pyi +++ b/stdlib/3/platform.pyi @@ -1,7 +1,6 @@ # Stubs for platform (Python 3.5) -from os import devnull as DEV_NULL -from os import popen +from os import devnull as DEV_NULL, popen from typing import NamedTuple, Tuple def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> Tuple[str, str]: ... diff --git a/stdlib/3/sre_parse.pyi b/stdlib/3/sre_parse.pyi index 6cf7da49d5ce..38b63c2c61bc 100644 --- a/stdlib/3/sre_parse.pyi +++ b/stdlib/3/sre_parse.pyi @@ -1,10 +1,7 @@ # Source: https://github.com/python/cpython/blob/master/Lib/sre_parse.py -from sre_constants import _NamedIntConstant as NIC -from sre_constants import error as _Error -from typing import Any, Dict, FrozenSet, Iterable, List, Match, Optional -from typing import Pattern as _Pattern -from typing import Tuple, Union +from sre_constants import _NamedIntConstant as NIC, error as _Error +from typing import Any, Dict, FrozenSet, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union SPECIAL_CHARS: str REPEAT_CHARS: str diff --git a/third_party/2/six/moves/__init__.pyi b/third_party/2/six/moves/__init__.pyi index 6bad8fff9913..5f119a2df09f 100644 --- a/third_party/2/six/moves/__init__.pyi +++ b/third_party/2/six/moves/__init__.pyi @@ -3,19 +3,10 @@ # Note: Commented out items means they weren't implemented at the time. # Uncomment them when the modules have been added to the typeshed. import __builtin__ as builtins -from __builtin__ import intern as intern -from __builtin__ import raw_input as input -from __builtin__ import reduce as reduce -from __builtin__ import reload as reload_module -from __builtin__ import xrange as xrange +from __builtin__ import intern as intern, raw_input as input, reduce as reduce, reload as reload_module, xrange as xrange from cStringIO import StringIO as cStringIO -from itertools import ifilter as filter -from itertools import ifilterfalse as filterfalse -from itertools import imap as map -from itertools import izip as zip -from itertools import izip_longest as zip_longest -from os import getcwd as getcwdb -from os import getcwdu as getcwd +from itertools import ifilter as filter, ifilterfalse as filterfalse, imap as map, izip as zip, izip_longest as zip_longest +from os import getcwd as getcwdb, getcwdu as getcwd from pipes import quote as shlex_quote from StringIO import StringIO as StringIO from UserDict import UserDict as UserDict diff --git a/third_party/2/six/moves/urllib/error.pyi b/third_party/2/six/moves/urllib/error.pyi index ef51329c7594..0c6c1c3bd79c 100644 --- a/third_party/2/six/moves/urllib/error.pyi +++ b/third_party/2/six/moves/urllib/error.pyi @@ -1,3 +1,2 @@ from urllib import ContentTooShortError as ContentTooShortError -from urllib2 import HTTPError as HTTPError -from urllib2 import URLError as URLError +from urllib2 import HTTPError as HTTPError, URLError as URLError diff --git a/third_party/2/six/moves/urllib/parse.pyi b/third_party/2/six/moves/urllib/parse.pyi index 6733b99b0d69..8da22e31f651 100644 --- a/third_party/2/six/moves/urllib/parse.pyi +++ b/third_party/2/six/moves/urllib/parse.pyi @@ -1,24 +1,28 @@ # Stubs for six.moves.urllib.parse -from urllib import quote as quote -from urllib import quote_plus as quote_plus -from urllib import splitquery as splitquery -from urllib import splittag as splittag -from urllib import splituser as splituser -from urllib import unquote as unquote -from urllib import unquote_plus as unquote_plus -from urllib import urlencode as urlencode -from urlparse import ParseResult as ParseResult -from urlparse import SplitResult as SplitResult -from urlparse import parse_qs as parse_qs -from urlparse import parse_qsl as parse_qsl -from urlparse import urldefrag as urldefrag -from urlparse import urljoin as urljoin -from urlparse import urlparse as urlparse -from urlparse import urlsplit as urlsplit -from urlparse import urlunparse as urlunparse -from urlparse import urlunsplit as urlunsplit -from urlparse import uses_fragment as uses_fragment -from urlparse import uses_netloc as uses_netloc -from urlparse import uses_params as uses_params -from urlparse import uses_query as uses_query -from urlparse import uses_relative as uses_relative +from urllib import ( + quote as quote, + quote_plus as quote_plus, + splitquery as splitquery, + splittag as splittag, + splituser as splituser, + unquote as unquote, + unquote_plus as unquote_plus, + urlencode as urlencode, +) +from urlparse import ( + ParseResult as ParseResult, + SplitResult as SplitResult, + parse_qs as parse_qs, + parse_qsl as parse_qsl, + urldefrag as urldefrag, + urljoin as urljoin, + urlparse as urlparse, + urlsplit as urlsplit, + urlunparse as urlunparse, + urlunsplit as urlunsplit, + uses_fragment as uses_fragment, + uses_netloc as uses_netloc, + uses_params as uses_params, + uses_query as uses_query, + uses_relative as uses_relative, +) diff --git a/third_party/2/six/moves/urllib/request.pyi b/third_party/2/six/moves/urllib/request.pyi index 479e629097ef..e76109971884 100644 --- a/third_party/2/six/moves/urllib/request.pyi +++ b/third_party/2/six/moves/urllib/request.pyi @@ -1,36 +1,40 @@ # Stubs for six.moves.urllib.request -from urllib import FancyURLopener as FancyURLopener -from urllib import URLopener as URLopener -from urllib import getproxies as getproxies -from urllib import pathname2url as pathname2url -from urllib import proxy_bypass as proxy_bypass -from urllib import url2pathname as url2pathname -from urllib import urlcleanup as urlcleanup -from urllib import urlretrieve as urlretrieve -from urllib2 import AbstractBasicAuthHandler as AbstractBasicAuthHandler -from urllib2 import AbstractDigestAuthHandler as AbstractDigestAuthHandler -from urllib2 import BaseHandler as BaseHandler -from urllib2 import CacheFTPHandler as CacheFTPHandler -from urllib2 import FileHandler as FileHandler -from urllib2 import FTPHandler as FTPHandler -from urllib2 import HTTPBasicAuthHandler as HTTPBasicAuthHandler -from urllib2 import HTTPCookieProcessor as HTTPCookieProcessor -from urllib2 import HTTPDefaultErrorHandler as HTTPDefaultErrorHandler -from urllib2 import HTTPDigestAuthHandler as HTTPDigestAuthHandler -from urllib2 import HTTPErrorProcessor as HTTPErrorProcessor -from urllib2 import HTTPHandler as HTTPHandler -from urllib2 import HTTPPasswordMgr as HTTPPasswordMgr -from urllib2 import HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm -from urllib2 import HTTPRedirectHandler as HTTPRedirectHandler -from urllib2 import HTTPSHandler as HTTPSHandler -from urllib2 import OpenerDirector as OpenerDirector -from urllib2 import ProxyBasicAuthHandler as ProxyBasicAuthHandler -from urllib2 import ProxyDigestAuthHandler as ProxyDigestAuthHandler -from urllib2 import ProxyHandler as ProxyHandler -from urllib2 import Request as Request -from urllib2 import UnknownHandler as UnknownHandler -from urllib2 import build_opener as build_opener -from urllib2 import install_opener as install_opener -from urllib2 import parse_http_list as parse_http_list -from urllib2 import parse_keqv_list as parse_keqv_list -from urllib2 import urlopen as urlopen +from urllib import ( + FancyURLopener as FancyURLopener, + URLopener as URLopener, + getproxies as getproxies, + pathname2url as pathname2url, + proxy_bypass as proxy_bypass, + url2pathname as url2pathname, + urlcleanup as urlcleanup, + urlretrieve as urlretrieve, +) +from urllib2 import ( + AbstractBasicAuthHandler as AbstractBasicAuthHandler, + AbstractDigestAuthHandler as AbstractDigestAuthHandler, + BaseHandler as BaseHandler, + CacheFTPHandler as CacheFTPHandler, + FileHandler as FileHandler, + FTPHandler as FTPHandler, + HTTPBasicAuthHandler as HTTPBasicAuthHandler, + HTTPCookieProcessor as HTTPCookieProcessor, + HTTPDefaultErrorHandler as HTTPDefaultErrorHandler, + HTTPDigestAuthHandler as HTTPDigestAuthHandler, + HTTPErrorProcessor as HTTPErrorProcessor, + HTTPHandler as HTTPHandler, + HTTPPasswordMgr as HTTPPasswordMgr, + HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm, + HTTPRedirectHandler as HTTPRedirectHandler, + HTTPSHandler as HTTPSHandler, + OpenerDirector as OpenerDirector, + ProxyBasicAuthHandler as ProxyBasicAuthHandler, + ProxyDigestAuthHandler as ProxyDigestAuthHandler, + ProxyHandler as ProxyHandler, + Request as Request, + UnknownHandler as UnknownHandler, + build_opener as build_opener, + install_opener as install_opener, + parse_http_list as parse_http_list, + parse_keqv_list as parse_keqv_list, + urlopen as urlopen, +) diff --git a/third_party/2/six/moves/urllib/response.pyi b/third_party/2/six/moves/urllib/response.pyi index 83e117fb6267..e6cf099a7e55 100644 --- a/third_party/2/six/moves/urllib/response.pyi +++ b/third_party/2/six/moves/urllib/response.pyi @@ -1,5 +1,2 @@ # Stubs for six.moves.urllib.response -from urllib import addbase as addbase -from urllib import addclosehook as addclosehook -from urllib import addinfo as addinfo -from urllib import addinfourl as addinfourl +from urllib import addbase as addbase, addclosehook as addclosehook, addinfo as addinfo, addinfourl as addinfourl diff --git a/third_party/2and3/attr/__init__.pyi b/third_party/2and3/attr/__init__.pyi index 08dc615fa727..1949375e3aa1 100644 --- a/third_party/2and3/attr/__init__.pyi +++ b/third_party/2and3/attr/__init__.pyi @@ -1,10 +1,7 @@ from typing import Any, Callable, Dict, Generic, List, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, overload # `import X as X` is required to make these public -from . import converters as converters -from . import exceptions as exceptions -from . import filters as filters -from . import validators as validators +from . import converters as converters, exceptions as exceptions, filters as filters, validators as validators _T = TypeVar("_T") _C = TypeVar("_C", bound=type) diff --git a/third_party/2and3/bleach/__init__.pyi b/third_party/2and3/bleach/__init__.pyi index 7c2c6dfc917d..2e4d2b0356a6 100644 --- a/third_party/2and3/bleach/__init__.pyi +++ b/third_party/2and3/bleach/__init__.pyi @@ -1,12 +1,13 @@ from typing import Any, Container, Iterable, Optional, Text -from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS -from bleach.linkifier import Linker as Linker -from bleach.sanitizer import ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES -from bleach.sanitizer import ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS -from bleach.sanitizer import ALLOWED_STYLES as ALLOWED_STYLES -from bleach.sanitizer import ALLOWED_TAGS as ALLOWED_TAGS -from bleach.sanitizer import Cleaner as Cleaner +from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker +from bleach.sanitizer import ( + ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES, + ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS, + ALLOWED_STYLES as ALLOWED_STYLES, + ALLOWED_TAGS as ALLOWED_TAGS, + Cleaner as Cleaner, +) from .linkifier import _Callback diff --git a/third_party/2and3/click/__init__.pyi b/third_party/2and3/click/__init__.pyi index b86d2d9794ce..a587bf8c1ca1 100644 --- a/third_party/2and3/click/__init__.pyi +++ b/third_party/2and3/click/__init__.pyi @@ -16,79 +16,90 @@ # fmt: off # Core classes -from .core import Argument as Argument -from .core import BaseCommand as BaseCommand -from .core import Command as Command -from .core import CommandCollection as CommandCollection -from .core import Context as Context -from .core import Group as Group -from .core import MultiCommand as MultiCommand -from .core import Option as Option -from .core import Parameter as Parameter +from .core import ( + Argument as Argument, + BaseCommand as BaseCommand, + Command as Command, + CommandCollection as CommandCollection, + Context as Context, + Group as Group, + MultiCommand as MultiCommand, + Option as Option, + Parameter as Parameter, +) # Decorators -from .decorators import argument as argument -from .decorators import command as command -from .decorators import confirmation_option as confirmation_option -from .decorators import group as group -from .decorators import help_option as help_option -from .decorators import make_pass_decorator as make_pass_decorator -from .decorators import option as option -from .decorators import pass_context as pass_context -from .decorators import pass_obj as pass_obj -from .decorators import password_option as password_option -from .decorators import version_option as version_option +from .decorators import ( + argument as argument, + command as command, + confirmation_option as confirmation_option, + group as group, + help_option as help_option, + make_pass_decorator as make_pass_decorator, + option as option, + pass_context as pass_context, + pass_obj as pass_obj, + password_option as password_option, + version_option as version_option, +) # Exceptions -from .exceptions import Abort as Abort -from .exceptions import BadArgumentUsage as BadArgumentUsage -from .exceptions import BadOptionUsage as BadOptionUsage -from .exceptions import BadParameter as BadParameter -from .exceptions import ClickException as ClickException -from .exceptions import FileError as FileError -from .exceptions import MissingParameter as MissingParameter -from .exceptions import NoSuchOption as NoSuchOption -from .exceptions import UsageError as UsageError +from .exceptions import ( + Abort as Abort, + BadArgumentUsage as BadArgumentUsage, + BadOptionUsage as BadOptionUsage, + BadParameter as BadParameter, + ClickException as ClickException, + FileError as FileError, + MissingParameter as MissingParameter, + NoSuchOption as NoSuchOption, + UsageError as UsageError, +) # Formatting -from .formatting import HelpFormatter as HelpFormatter -from .formatting import wrap_text as wrap_text +from .formatting import HelpFormatter as HelpFormatter, wrap_text as wrap_text # Globals from .globals import get_current_context as get_current_context # Parsing from .parser import OptionParser as OptionParser # Terminal functions -from .termui import clear as clear -from .termui import confirm as confirm -from .termui import echo_via_pager as echo_via_pager -from .termui import edit as edit -from .termui import get_terminal_size as get_terminal_size -from .termui import getchar as getchar -from .termui import launch as launch -from .termui import pause as pause -from .termui import progressbar as progressbar -from .termui import prompt as prompt -from .termui import secho as secho -from .termui import style as style -from .termui import unstyle as unstyle +from .termui import ( + clear as clear, + confirm as confirm, + echo_via_pager as echo_via_pager, + edit as edit, + get_terminal_size as get_terminal_size, + getchar as getchar, + launch as launch, + pause as pause, + progressbar as progressbar, + prompt as prompt, + secho as secho, + style as style, + unstyle as unstyle, +) # Types -from .types import BOOL as BOOL -from .types import FLOAT as FLOAT -from .types import INT as INT -from .types import STRING as STRING -from .types import UNPROCESSED as UNPROCESSED -from .types import UUID as UUID -from .types import Choice as Choice -from .types import File as File -from .types import IntRange as IntRange -from .types import ParamType as ParamType -from .types import Path as Path -from .types import Tuple as Tuple +from .types import ( + BOOL as BOOL, + FLOAT as FLOAT, + INT as INT, + STRING as STRING, + UNPROCESSED as UNPROCESSED, + UUID as UUID, + Choice as Choice, + File as File, + IntRange as IntRange, + ParamType as ParamType, + Path as Path, + Tuple as Tuple, +) # Utilities -from .utils import echo as echo -from .utils import format_filename as format_filename -from .utils import get_app_dir as get_app_dir -from .utils import get_binary_stream as get_binary_stream -from .utils import get_os_args as get_os_args -from .utils import get_text_stream as get_text_stream -from .utils import open_file as open_file +from .utils import ( + echo as echo, + format_filename as format_filename, + get_app_dir as get_app_dir, + get_binary_stream as get_binary_stream, + get_os_args as get_os_args, + get_text_stream as get_text_stream, + open_file as open_file, +) # fmt: on diff --git a/third_party/2and3/click/types.pyi b/third_party/2and3/click/types.pyi index 79d81e56105f..8371a555b7d3 100644 --- a/third_party/2and3/click/types.pyi +++ b/third_party/2and3/click/types.pyi @@ -1,11 +1,8 @@ import datetime import uuid -from typing import IO, Any, Callable, Iterable, List, Optional -from typing import Tuple as _PyTuple -from typing import Type, TypeVar, Union +from typing import IO, Any, Callable, Iterable, List, Optional, Tuple as _PyTuple, Type, TypeVar, Union -from click.core import Context, Parameter, _ConvertibleType -from click.core import _ParamType as ParamType +from click.core import Context, Parameter, _ConvertibleType, _ParamType as ParamType class BoolParamType(ParamType): def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> bool: ... diff --git a/third_party/2and3/dateutil/tz/__init__.pyi b/third_party/2and3/dateutil/tz/__init__.pyi index 21c155e923f4..334ca4825094 100644 --- a/third_party/2and3/dateutil/tz/__init__.pyi +++ b/third_party/2and3/dateutil/tz/__init__.pyi @@ -1,13 +1,15 @@ -from .tz import datetime_ambiguous as datetime_ambiguous -from .tz import datetime_exists as datetime_exists -from .tz import gettz as gettz -from .tz import resolve_imaginary as resolve_imaginary -from .tz import tzfile as tzfile -from .tz import tzical as tzical -from .tz import tzlocal as tzlocal -from .tz import tzoffset as tzoffset -from .tz import tzrange as tzrange -from .tz import tzstr as tzstr -from .tz import tzutc as tzutc +from .tz import ( + datetime_ambiguous as datetime_ambiguous, + datetime_exists as datetime_exists, + gettz as gettz, + resolve_imaginary as resolve_imaginary, + tzfile as tzfile, + tzical as tzical, + tzlocal as tzlocal, + tzoffset as tzoffset, + tzrange as tzrange, + tzstr as tzstr, + tzutc as tzutc, +) UTC: tzutc diff --git a/third_party/2and3/dateutil/tz/tz.pyi b/third_party/2and3/dateutil/tz/tz.pyi index c41397bdb516..ee7e6a539ffb 100644 --- a/third_party/2and3/dateutil/tz/tz.pyi +++ b/third_party/2and3/dateutil/tz/tz.pyi @@ -2,10 +2,7 @@ import datetime from typing import IO, Any, List, Optional, Text, Tuple, Union from ..relativedelta import relativedelta -from ._common import _tzinfo as _tzinfo -from ._common import enfold as enfold -from ._common import tzname_in_python2 as tzname_in_python2 -from ._common import tzrangebase as tzrangebase +from ._common import _tzinfo as _tzinfo, enfold as enfold, tzname_in_python2 as tzname_in_python2, tzrangebase as tzrangebase _FileObj = Union[str, Text, IO[str], IO[Text]] diff --git a/third_party/2and3/flask/__init__.pyi b/third_party/2and3/flask/__init__.pyi index 7aed80e8112c..e9d72b829712 100644 --- a/third_party/2and3/flask/__init__.pyi +++ b/third_party/2and3/flask/__init__.pyi @@ -2,44 +2,44 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from jinja2 import Markup as Markup -from jinja2 import escape as escape +from jinja2 import Markup as Markup, escape as escape from werkzeug.exceptions import abort as abort from werkzeug.utils import redirect as redirect from .app import Flask as Flask from .blueprints import Blueprint as Blueprint from .config import Config as Config -from .ctx import after_this_request as after_this_request -from .ctx import copy_current_request_context as copy_current_request_context -from .ctx import has_app_context as has_app_context -from .ctx import has_request_context as has_request_context -from .globals import current_app as current_app -from .globals import g as g -from .globals import request as request -from .globals import session as session -from .helpers import flash as flash -from .helpers import get_flashed_messages as get_flashed_messages -from .helpers import get_template_attribute as get_template_attribute -from .helpers import make_response as make_response -from .helpers import safe_join as safe_join -from .helpers import send_file as send_file -from .helpers import send_from_directory as send_from_directory -from .helpers import stream_with_context as stream_with_context -from .helpers import url_for as url_for +from .ctx import ( + after_this_request as after_this_request, + copy_current_request_context as copy_current_request_context, + has_app_context as has_app_context, + has_request_context as has_request_context, +) +from .globals import current_app as current_app, g as g, request as request, session as session +from .helpers import ( + flash as flash, + get_flashed_messages as get_flashed_messages, + get_template_attribute as get_template_attribute, + make_response as make_response, + safe_join as safe_join, + send_file as send_file, + send_from_directory as send_from_directory, + stream_with_context as stream_with_context, + url_for as url_for, +) from .json import jsonify as jsonify -from .signals import appcontext_popped as appcontext_popped -from .signals import appcontext_pushed as appcontext_pushed -from .signals import appcontext_tearing_down as appcontext_tearing_down -from .signals import before_render_template as before_render_template -from .signals import got_request_exception as got_request_exception -from .signals import message_flashed as message_flashed -from .signals import request_finished as request_finished -from .signals import request_started as request_started -from .signals import request_tearing_down as request_tearing_down -from .signals import signals_available as signals_available -from .signals import template_rendered as template_rendered -from .templating import render_template as render_template -from .templating import render_template_string as render_template_string -from .wrappers import Request as Request -from .wrappers import Response as Response +from .signals import ( + appcontext_popped as appcontext_popped, + appcontext_pushed as appcontext_pushed, + appcontext_tearing_down as appcontext_tearing_down, + before_render_template as before_render_template, + got_request_exception as got_request_exception, + message_flashed as message_flashed, + request_finished as request_finished, + request_started as request_started, + request_tearing_down as request_tearing_down, + signals_available as signals_available, + template_rendered as template_rendered, +) +from .templating import render_template as render_template, render_template_string as render_template_string +from .wrappers import Request as Request, Response as Response diff --git a/third_party/2and3/flask/templating.pyi b/third_party/2and3/flask/templating.pyi index 2284496b21e6..87d4de61ab31 100644 --- a/third_party/2and3/flask/templating.pyi +++ b/third_party/2and3/flask/templating.pyi @@ -4,8 +4,7 @@ from typing import Any -from jinja2 import BaseLoader -from jinja2 import Environment as BaseEnvironment +from jinja2 import BaseLoader, Environment as BaseEnvironment from .globals import _app_ctx_stack, _request_ctx_stack from .signals import before_render_template, template_rendered diff --git a/third_party/2and3/flask/wrappers.pyi b/third_party/2and3/flask/wrappers.pyi index 263dc3b66eb0..0dc905945484 100644 --- a/third_party/2and3/flask/wrappers.pyi +++ b/third_party/2and3/flask/wrappers.pyi @@ -6,8 +6,7 @@ from typing import Any, Dict, Optional from werkzeug.exceptions import HTTPException from werkzeug.routing import Rule -from werkzeug.wrappers import Request as RequestBase -from werkzeug.wrappers import Response as ResponseBase +from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase class JSONMixin: @property diff --git a/third_party/2and3/google/protobuf/map_unittest_pb2.pyi b/third_party/2and3/google/protobuf/map_unittest_pb2.pyi index 030be80c4be8..794e45d9842b 100644 --- a/third_party/2and3/google/protobuf/map_unittest_pb2.pyi +++ b/third_party/2and3/google/protobuf/map_unittest_pb2.pyi @@ -2,8 +2,7 @@ from typing import List, Mapping, MutableMapping, Optional, Text, Tuple, cast from google.protobuf.message import Message from google.protobuf.unittest_no_arena_pb2 import ForeignMessage -from google.protobuf.unittest_pb2 import ForeignMessage as ForeignMessage1 -from google.protobuf.unittest_pb2 import TestAllTypes, TestRequired +from google.protobuf.unittest_pb2 import ForeignMessage as ForeignMessage1, TestAllTypes, TestRequired class MapEnum(int): @classmethod diff --git a/third_party/2and3/jinja2/__init__.pyi b/third_party/2and3/jinja2/__init__.pyi index cf26a1d29226..1121f8dee408 100644 --- a/third_party/2and3/jinja2/__init__.pyi +++ b/third_party/2and3/jinja2/__init__.pyi @@ -1,34 +1,45 @@ -from jinja2.bccache import BytecodeCache as BytecodeCache -from jinja2.bccache import FileSystemBytecodeCache as FileSystemBytecodeCache -from jinja2.bccache import MemcachedBytecodeCache as MemcachedBytecodeCache -from jinja2.environment import Environment as Environment -from jinja2.environment import Template as Template -from jinja2.exceptions import TemplateAssertionError as TemplateAssertionError -from jinja2.exceptions import TemplateError as TemplateError -from jinja2.exceptions import TemplateNotFound as TemplateNotFound -from jinja2.exceptions import TemplatesNotFound as TemplatesNotFound -from jinja2.exceptions import TemplateSyntaxError as TemplateSyntaxError -from jinja2.exceptions import UndefinedError as UndefinedError -from jinja2.filters import contextfilter as contextfilter -from jinja2.filters import environmentfilter as environmentfilter -from jinja2.filters import evalcontextfilter as evalcontextfilter -from jinja2.loaders import BaseLoader as BaseLoader -from jinja2.loaders import ChoiceLoader as ChoiceLoader -from jinja2.loaders import DictLoader as DictLoader -from jinja2.loaders import FileSystemLoader as FileSystemLoader -from jinja2.loaders import FunctionLoader as FunctionLoader -from jinja2.loaders import ModuleLoader as ModuleLoader -from jinja2.loaders import PackageLoader as PackageLoader -from jinja2.loaders import PrefixLoader as PrefixLoader -from jinja2.runtime import DebugUndefined as DebugUndefined -from jinja2.runtime import StrictUndefined as StrictUndefined -from jinja2.runtime import Undefined as Undefined -from jinja2.runtime import make_logging_undefined as make_logging_undefined -from jinja2.utils import Markup as Markup -from jinja2.utils import clear_caches as clear_caches -from jinja2.utils import contextfunction as contextfunction -from jinja2.utils import environmentfunction as environmentfunction -from jinja2.utils import escape as escape -from jinja2.utils import evalcontextfunction as evalcontextfunction -from jinja2.utils import is_undefined as is_undefined -from jinja2.utils import select_autoescape as select_autoescape +from jinja2.bccache import ( + BytecodeCache as BytecodeCache, + FileSystemBytecodeCache as FileSystemBytecodeCache, + MemcachedBytecodeCache as MemcachedBytecodeCache, +) +from jinja2.environment import Environment as Environment, Template as Template +from jinja2.exceptions import ( + TemplateAssertionError as TemplateAssertionError, + TemplateError as TemplateError, + TemplateNotFound as TemplateNotFound, + TemplatesNotFound as TemplatesNotFound, + TemplateSyntaxError as TemplateSyntaxError, + UndefinedError as UndefinedError, +) +from jinja2.filters import ( + contextfilter as contextfilter, + environmentfilter as environmentfilter, + evalcontextfilter as evalcontextfilter, +) +from jinja2.loaders import ( + BaseLoader as BaseLoader, + ChoiceLoader as ChoiceLoader, + DictLoader as DictLoader, + FileSystemLoader as FileSystemLoader, + FunctionLoader as FunctionLoader, + ModuleLoader as ModuleLoader, + PackageLoader as PackageLoader, + PrefixLoader as PrefixLoader, +) +from jinja2.runtime import ( + DebugUndefined as DebugUndefined, + StrictUndefined as StrictUndefined, + Undefined as Undefined, + make_logging_undefined as make_logging_undefined, +) +from jinja2.utils import ( + Markup as Markup, + clear_caches as clear_caches, + contextfunction as contextfunction, + environmentfunction as environmentfunction, + escape as escape, + evalcontextfunction as evalcontextfunction, + is_undefined as is_undefined, + select_autoescape as select_autoescape, +) diff --git a/third_party/2and3/jinja2/runtime.pyi b/third_party/2and3/jinja2/runtime.pyi index 822e8935bd1a..66ffe9d3e367 100644 --- a/third_party/2and3/jinja2/runtime.pyi +++ b/third_party/2and3/jinja2/runtime.pyi @@ -1,12 +1,8 @@ from typing import Any, Dict, Optional, Text, Union from jinja2.environment import Environment -from jinja2.exceptions import TemplateNotFound as TemplateNotFound -from jinja2.exceptions import TemplateRuntimeError as TemplateRuntimeError -from jinja2.utils import Markup as Markup -from jinja2.utils import concat as concat -from jinja2.utils import escape as escape -from jinja2.utils import missing as missing +from jinja2.exceptions import TemplateNotFound as TemplateNotFound, TemplateRuntimeError as TemplateRuntimeError +from jinja2.utils import Markup as Markup, concat as concat, escape as escape, missing as missing to_string: Any identity: Any diff --git a/third_party/2and3/jinja2/utils.pyi b/third_party/2and3/jinja2/utils.pyi index 85ffe969353b..6414b1e3c8d8 100644 --- a/third_party/2and3/jinja2/utils.pyi +++ b/third_party/2and3/jinja2/utils.pyi @@ -1,8 +1,6 @@ from typing import Any, Callable, Iterable, Optional -from markupsafe import Markup as Markup -from markupsafe import escape as escape -from markupsafe import soft_unicode as soft_unicode +from markupsafe import Markup as Markup, escape as escape, soft_unicode as soft_unicode missing: Any internal_code: Any diff --git a/third_party/2and3/markupsafe/__init__.pyi b/third_party/2and3/markupsafe/__init__.pyi index 49807b128e7e..e86ed6ee498f 100644 --- a/third_party/2and3/markupsafe/__init__.pyi +++ b/third_party/2and3/markupsafe/__init__.pyi @@ -4,9 +4,7 @@ from collections import Mapping from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Text, Tuple, Union from markupsafe._compat import text_type -from markupsafe._native import escape as escape -from markupsafe._native import escape_silent as escape_silent -from markupsafe._native import soft_unicode as soft_unicode +from markupsafe._native import escape as escape, escape_silent as escape_silent, soft_unicode as soft_unicode class Markup(text_type): def __new__(cls, base: Text = ..., encoding: Optional[Text] = ..., errors: Text = ...) -> Markup: ... diff --git a/third_party/2and3/pymysql/__init__.pyi b/third_party/2and3/pymysql/__init__.pyi index 548f18b48dd9..4f01043c93c5 100644 --- a/third_party/2and3/pymysql/__init__.pyi +++ b/third_party/2and3/pymysql/__init__.pyi @@ -3,26 +3,28 @@ from typing import Callable, FrozenSet, Tuple, Union from .connections import Connection as _Connection from .constants import FIELD_TYPE as FIELD_TYPE -from .converters import escape_dict as escape_dict -from .converters import escape_sequence as escape_sequence -from .converters import escape_string as escape_string -from .err import DatabaseError as DatabaseError -from .err import DataError as DataError -from .err import Error as Error -from .err import IntegrityError as IntegrityError -from .err import InterfaceError as InterfaceError -from .err import InternalError as InternalError -from .err import MySQLError as MySQLError -from .err import NotSupportedError as NotSupportedError -from .err import OperationalError as OperationalError -from .err import ProgrammingError as ProgrammingError -from .err import Warning as Warning -from .times import Date as Date -from .times import DateFromTicks as DateFromTicks -from .times import Time as Time -from .times import TimeFromTicks as TimeFromTicks -from .times import Timestamp as Timestamp -from .times import TimestampFromTicks as TimestampFromTicks +from .converters import escape_dict as escape_dict, escape_sequence as escape_sequence, escape_string as escape_string +from .err import ( + DatabaseError as DatabaseError, + DataError as DataError, + Error as Error, + IntegrityError as IntegrityError, + InterfaceError as InterfaceError, + InternalError as InternalError, + MySQLError as MySQLError, + NotSupportedError as NotSupportedError, + OperationalError as OperationalError, + ProgrammingError as ProgrammingError, + Warning as Warning, +) +from .times import ( + Date as Date, + DateFromTicks as DateFromTicks, + Time as Time, + TimeFromTicks as TimeFromTicks, + Timestamp as Timestamp, + TimestampFromTicks as TimestampFromTicks, +) threadsafety: int apilevel: str diff --git a/third_party/2and3/pymysql/connections.pyi b/third_party/2and3/pymysql/connections.pyi index 61f704bdd580..afe2ef550bd4 100644 --- a/third_party/2and3/pymysql/connections.pyi +++ b/third_party/2and3/pymysql/connections.pyi @@ -1,31 +1,29 @@ from typing import Any, Optional, Type -from .charset import MBLENGTH as MBLENGTH -from .charset import charset_by_id as charset_by_id -from .charset import charset_by_name as charset_by_name -from .constants import CLIENT as CLIENT -from .constants import COMMAND as COMMAND -from .constants import FIELD_TYPE as FIELD_TYPE -from .constants import FLAG as FLAG -from .constants import SERVER_STATUS as SERVER_STATUS -from .converters import decoders as decoders -from .converters import encoders as encoders -from .converters import escape_item as escape_item +from .charset import MBLENGTH as MBLENGTH, charset_by_id as charset_by_id, charset_by_name as charset_by_name +from .constants import ( + CLIENT as CLIENT, + COMMAND as COMMAND, + FIELD_TYPE as FIELD_TYPE, + FLAG as FLAG, + SERVER_STATUS as SERVER_STATUS, +) +from .converters import decoders as decoders, encoders as encoders, escape_item as escape_item from .cursors import Cursor as Cursor -from .err import DatabaseError as DatabaseError -from .err import DataError as DataError -from .err import Error as Error -from .err import IntegrityError as IntegrityError -from .err import InterfaceError as InterfaceError -from .err import InternalError as InternalError -from .err import NotSupportedError as NotSupportedError -from .err import OperationalError as OperationalError -from .err import ProgrammingError as ProgrammingError -from .err import Warning as Warning -from .err import raise_mysql_exception as raise_mysql_exception -from .util import byte2int as byte2int -from .util import int2byte as int2byte -from .util import join_bytes as join_bytes +from .err import ( + DatabaseError as DatabaseError, + DataError as DataError, + Error as Error, + IntegrityError as IntegrityError, + InterfaceError as InterfaceError, + InternalError as InternalError, + NotSupportedError as NotSupportedError, + OperationalError as OperationalError, + ProgrammingError as ProgrammingError, + Warning as Warning, + raise_mysql_exception as raise_mysql_exception, +) +from .util import byte2int as byte2int, int2byte as int2byte, join_bytes as join_bytes sha_new: Any SSL_ENABLED: Any diff --git a/third_party/2and3/pymysql/converters.pyi b/third_party/2and3/pymysql/converters.pyi index ec53254543af..01a256158d1c 100644 --- a/third_party/2and3/pymysql/converters.pyi +++ b/third_party/2and3/pymysql/converters.pyi @@ -1,8 +1,7 @@ from typing import Any from .charset import charset_by_id as charset_by_id -from .constants import FIELD_TYPE as FIELD_TYPE -from .constants import FLAG as FLAG +from .constants import FIELD_TYPE as FIELD_TYPE, FLAG as FLAG PYTHON3: Any ESCAPE_REGEX: Any diff --git a/third_party/2and3/requests/adapters.pyi b/third_party/2and3/requests/adapters.pyi index f504f8d64a8a..93db88811cca 100644 --- a/third_party/2and3/requests/adapters.pyi +++ b/third_party/2and3/requests/adapters.pyi @@ -3,8 +3,7 @@ from typing import Any, Container, Mapping, Optional, Text, Tuple, Union from . import auth, compat, cookies, exceptions, models, structures, utils -from .packages.urllib3 import exceptions as urllib3_exceptions -from .packages.urllib3 import poolmanager, response +from .packages.urllib3 import exceptions as urllib3_exceptions, poolmanager, response from .packages.urllib3.util import retry PreparedRequest = models.PreparedRequest diff --git a/third_party/2and3/requests/models.pyi b/third_party/2and3/requests/models.pyi index 7cfc2d4b4a1d..3eb5dbf05c23 100644 --- a/third_party/2and3/requests/models.pyi +++ b/third_party/2and3/requests/models.pyi @@ -6,8 +6,7 @@ from typing import Any, Dict, Iterator, List, MutableMapping, Optional, Text, Un from . import auth, compat, cookies, exceptions, hooks, status_codes, structures, utils from .cookies import RequestsCookieJar -from .packages.urllib3 import exceptions as urllib3_exceptions -from .packages.urllib3 import fields, filepost, util +from .packages.urllib3 import exceptions as urllib3_exceptions, fields, filepost, util default_hooks = hooks.default_hooks CaseInsensitiveDict = structures.CaseInsensitiveDict diff --git a/third_party/2and3/requests/packages/urllib3/__init__.pyi b/third_party/2and3/requests/packages/urllib3/__init__.pyi index 943043eb147b..f63b8fa12da6 100644 --- a/third_party/2and3/requests/packages/urllib3/__init__.pyi +++ b/third_party/2and3/requests/packages/urllib3/__init__.pyi @@ -2,8 +2,7 @@ import logging from typing import Any from . import connectionpool, filepost, poolmanager, response -from .util import request as _request -from .util import retry, timeout, url +from .util import request as _request, retry, timeout, url __license__: Any diff --git a/third_party/2and3/requests/packages/urllib3/connectionpool.pyi b/third_party/2and3/requests/packages/urllib3/connectionpool.pyi index a73899d2b60e..bed46b24f432 100644 --- a/third_party/2and3/requests/packages/urllib3/connectionpool.pyi +++ b/third_party/2and3/requests/packages/urllib3/connectionpool.pyi @@ -1,12 +1,9 @@ from typing import Any from . import connection, exceptions, packages, request, response -from .connection import BaseSSLError as BaseSSLError -from .connection import ConnectionError as ConnectionError -from .connection import HTTPException as HTTPException +from .connection import BaseSSLError as BaseSSLError, ConnectionError as ConnectionError, HTTPException as HTTPException from .packages import ssl_match_hostname -from .util import connection as _connection -from .util import retry, timeout, url +from .util import connection as _connection, retry, timeout, url ClosedPoolError = exceptions.ClosedPoolError ProtocolError = exceptions.ProtocolError diff --git a/third_party/2and3/requests/packages/urllib3/response.pyi b/third_party/2and3/requests/packages/urllib3/response.pyi index d4a4e5bf0b17..1c78b48a2572 100644 --- a/third_party/2and3/requests/packages/urllib3/response.pyi +++ b/third_party/2and3/requests/packages/urllib3/response.pyi @@ -2,8 +2,7 @@ import io from typing import Any from . import _collections, exceptions -from .connection import BaseSSLError as BaseSSLError -from .connection import HTTPException as HTTPException +from .connection import BaseSSLError as BaseSSLError, HTTPException as HTTPException from .util import response HTTPHeaderDict = _collections.HTTPHeaderDict diff --git a/third_party/2and3/requests/sessions.pyi b/third_party/2and3/requests/sessions.pyi index 56cbc4b36aab..1dd9086fec50 100644 --- a/third_party/2and3/requests/sessions.pyi +++ b/third_party/2and3/requests/sessions.pyi @@ -2,9 +2,7 @@ from typing import IO, Any, Callable, Iterable, List, MutableMapping, Optional, Text, Tuple, Union -from . import adapters -from . import auth as _auth -from . import compat, cookies, exceptions, hooks, models, status_codes, structures, utils +from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, structures, utils from .models import Response from .packages.urllib3 import _collections diff --git a/third_party/2and3/simplejson/__init__.pyi b/third_party/2and3/simplejson/__init__.pyi index df3c404ad4ab..19ba570f64b8 100644 --- a/third_party/2and3/simplejson/__init__.pyi +++ b/third_party/2and3/simplejson/__init__.pyi @@ -1,8 +1,7 @@ from typing import IO, Any, Text, Union from simplejson.decoder import JSONDecoder as JSONDecoder -from simplejson.encoder import JSONEncoder as JSONEncoder -from simplejson.encoder import JSONEncoderForHTML as JSONEncoderForHTML +from simplejson.encoder import JSONEncoder as JSONEncoder, JSONEncoderForHTML as JSONEncoderForHTML from simplejson.scanner import JSONDecodeError as JSONDecodeError _LoadsString = Union[Text, bytes, bytearray] diff --git a/third_party/2and3/typing_extensions.pyi b/third_party/2and3/typing_extensions.pyi index 68639b2932f7..8b1e51126f91 100644 --- a/third_party/2and3/typing_extensions.pyi +++ b/third_party/2and3/typing_extensions.pyi @@ -1,19 +1,26 @@ import abc import sys -from typing import TYPE_CHECKING as TYPE_CHECKING -from typing import Any, Callable -from typing import ClassVar as ClassVar -from typing import ContextManager as ContextManager -from typing import Counter as Counter -from typing import DefaultDict as DefaultDict -from typing import Deque as Deque -from typing import Dict, ItemsView, KeysView, Mapping -from typing import NewType as NewType -from typing import NoReturn as NoReturn -from typing import Text as Text -from typing import Type as Type -from typing import TypeVar, ValuesView -from typing import overload as overload +from typing import ( + TYPE_CHECKING as TYPE_CHECKING, + Any, + Callable, + ClassVar as ClassVar, + ContextManager as ContextManager, + Counter as Counter, + DefaultDict as DefaultDict, + Deque as Deque, + Dict, + ItemsView, + KeysView, + Mapping, + NewType as NewType, + NoReturn as NoReturn, + Text as Text, + Type as Type, + TypeVar, + ValuesView, + overload as overload, +) _T = TypeVar("_T") _F = TypeVar("_F", bound=Callable[..., Any]) diff --git a/third_party/2and3/werkzeug/debug/__init__.pyi b/third_party/2and3/werkzeug/debug/__init__.pyi index 7c165498f8cf..82664dc4ab04 100644 --- a/third_party/2and3/werkzeug/debug/__init__.pyi +++ b/third_party/2and3/werkzeug/debug/__init__.pyi @@ -1,7 +1,6 @@ from typing import Any, Optional -from werkzeug.wrappers import BaseRequest as Request -from werkzeug.wrappers import BaseResponse as Response +from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response PIN_TIME: Any diff --git a/third_party/2and3/werkzeug/testapp.pyi b/third_party/2and3/werkzeug/testapp.pyi index 63cf3310d688..a074482bd8e5 100644 --- a/third_party/2and3/werkzeug/testapp.pyi +++ b/third_party/2and3/werkzeug/testapp.pyi @@ -1,7 +1,6 @@ from typing import Any -from werkzeug.wrappers import BaseRequest as Request -from werkzeug.wrappers import BaseResponse as Response +from werkzeug.wrappers import BaseRequest as Request, BaseResponse as Response logo: Any TEMPLATE: Any diff --git a/third_party/3/six/__init__.pyi b/third_party/3/six/__init__.pyi index 36ee88abb7db..d684bf537231 100644 --- a/third_party/3/six/__init__.pyi +++ b/third_party/3/six/__init__.pyi @@ -9,8 +9,7 @@ import unittest from builtins import next as next from functools import wraps as wraps # Exports -from io import BytesIO as BytesIO -from io import StringIO as StringIO +from io import BytesIO as BytesIO, StringIO as StringIO from typing import ( Any, AnyStr, diff --git a/third_party/3/six/moves/__init__.pyi b/third_party/3/six/moves/__init__.pyi index 34e586211ab6..4a63ddff36b0 100644 --- a/third_party/3/six/moves/__init__.pyi +++ b/third_party/3/six/moves/__init__.pyi @@ -3,21 +3,13 @@ # Note: Commented out items means they weren't implemented at the time. # Uncomment them when the modules have been added to the typeshed. import sys -from builtins import filter as filter -from builtins import input as input -from builtins import map as map -from builtins import range as xrange -from builtins import zip as zip -from collections import UserDict as UserDict -from collections import UserList as UserList -from collections import UserString as UserString +from builtins import filter as filter, input as input, map as map, range as xrange, zip as zip +from collections import UserDict as UserDict, UserList as UserList, UserString as UserString from functools import reduce as reduce from importlib import reload as reload_module from io import StringIO as StringIO -from itertools import filterfalse as filterfalse -from itertools import zip_longest as zip_longest -from os import getcwd as getcwd -from os import getcwdb as getcwdb +from itertools import filterfalse as filterfalse, zip_longest as zip_longest +from os import getcwd as getcwd, getcwdb as getcwdb from shlex import quote as shlex_quote from sys import intern as intern diff --git a/third_party/3/six/moves/urllib/error.pyi b/third_party/3/six/moves/urllib/error.pyi index 8e1bd9cb67ae..4e10fe2fd42f 100644 --- a/third_party/3/six/moves/urllib/error.pyi +++ b/third_party/3/six/moves/urllib/error.pyi @@ -1,3 +1 @@ -from urllib.error import ContentTooShortError as ContentTooShortError -from urllib.error import HTTPError as HTTPError -from urllib.error import URLError as URLError +from urllib.error import ContentTooShortError as ContentTooShortError, HTTPError as HTTPError, URLError as URLError diff --git a/third_party/3/six/moves/urllib/parse.pyi b/third_party/3/six/moves/urllib/parse.pyi index 2deffbbafb6b..7d04ed0cdcd6 100644 --- a/third_party/3/six/moves/urllib/parse.pyi +++ b/third_party/3/six/moves/urllib/parse.pyi @@ -5,23 +5,25 @@ # from urllib.parse import splitquery as splitquery # from urllib.parse import splittag as splittag # from urllib.parse import splituser as splituser -from urllib.parse import ParseResult as ParseResult -from urllib.parse import SplitResult as SplitResult -from urllib.parse import parse_qs as parse_qs -from urllib.parse import parse_qsl as parse_qsl -from urllib.parse import quote as quote -from urllib.parse import quote_plus as quote_plus -from urllib.parse import unquote as unquote -from urllib.parse import unquote_plus as unquote_plus -from urllib.parse import urldefrag as urldefrag -from urllib.parse import urlencode as urlencode -from urllib.parse import urljoin as urljoin -from urllib.parse import urlparse as urlparse -from urllib.parse import urlsplit as urlsplit -from urllib.parse import urlunparse as urlunparse -from urllib.parse import urlunsplit as urlunsplit -from urllib.parse import uses_fragment as uses_fragment -from urllib.parse import uses_netloc as uses_netloc -from urllib.parse import uses_params as uses_params -from urllib.parse import uses_query as uses_query -from urllib.parse import uses_relative as uses_relative +from urllib.parse import ( + ParseResult as ParseResult, + SplitResult as SplitResult, + parse_qs as parse_qs, + parse_qsl as parse_qsl, + quote as quote, + quote_plus as quote_plus, + unquote as unquote, + unquote_plus as unquote_plus, + urldefrag as urldefrag, + urlencode as urlencode, + urljoin as urljoin, + urlparse as urlparse, + urlsplit as urlsplit, + urlunparse as urlunparse, + urlunsplit as urlunsplit, + uses_fragment as uses_fragment, + uses_netloc as uses_netloc, + uses_params as uses_params, + uses_query as uses_query, + uses_relative as uses_relative, +) diff --git a/third_party/3/six/moves/urllib/request.pyi b/third_party/3/six/moves/urllib/request.pyi index 7f3f6cdeef87..9b670b4d98b0 100644 --- a/third_party/3/six/moves/urllib/request.pyi +++ b/third_party/3/six/moves/urllib/request.pyi @@ -3,37 +3,39 @@ # Note: Commented out items means they weren't implemented at the time. # Uncomment them when the modules have been added to the typeshed. # from urllib.request import proxy_bypass as proxy_bypass -from urllib.request import AbstractBasicAuthHandler as AbstractBasicAuthHandler -from urllib.request import AbstractDigestAuthHandler as AbstractDigestAuthHandler -from urllib.request import BaseHandler as BaseHandler -from urllib.request import CacheFTPHandler as CacheFTPHandler -from urllib.request import FancyURLopener as FancyURLopener -from urllib.request import FileHandler as FileHandler -from urllib.request import FTPHandler as FTPHandler -from urllib.request import HTTPBasicAuthHandler as HTTPBasicAuthHandler -from urllib.request import HTTPCookieProcessor as HTTPCookieProcessor -from urllib.request import HTTPDefaultErrorHandler as HTTPDefaultErrorHandler -from urllib.request import HTTPDigestAuthHandler as HTTPDigestAuthHandler -from urllib.request import HTTPErrorProcessor as HTTPErrorProcessor -from urllib.request import HTTPHandler as HTTPHandler -from urllib.request import HTTPPasswordMgr as HTTPPasswordMgr -from urllib.request import HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm -from urllib.request import HTTPRedirectHandler as HTTPRedirectHandler -from urllib.request import HTTPSHandler as HTTPSHandler -from urllib.request import OpenerDirector as OpenerDirector -from urllib.request import ProxyBasicAuthHandler as ProxyBasicAuthHandler -from urllib.request import ProxyDigestAuthHandler as ProxyDigestAuthHandler -from urllib.request import ProxyHandler as ProxyHandler -from urllib.request import Request as Request -from urllib.request import UnknownHandler as UnknownHandler -from urllib.request import URLopener as URLopener -from urllib.request import build_opener as build_opener -from urllib.request import getproxies as getproxies -from urllib.request import install_opener as install_opener -from urllib.request import parse_http_list as parse_http_list -from urllib.request import parse_keqv_list as parse_keqv_list -from urllib.request import pathname2url as pathname2url -from urllib.request import url2pathname as url2pathname -from urllib.request import urlcleanup as urlcleanup -from urllib.request import urlopen as urlopen -from urllib.request import urlretrieve as urlretrieve +from urllib.request import ( + AbstractBasicAuthHandler as AbstractBasicAuthHandler, + AbstractDigestAuthHandler as AbstractDigestAuthHandler, + BaseHandler as BaseHandler, + CacheFTPHandler as CacheFTPHandler, + FancyURLopener as FancyURLopener, + FileHandler as FileHandler, + FTPHandler as FTPHandler, + HTTPBasicAuthHandler as HTTPBasicAuthHandler, + HTTPCookieProcessor as HTTPCookieProcessor, + HTTPDefaultErrorHandler as HTTPDefaultErrorHandler, + HTTPDigestAuthHandler as HTTPDigestAuthHandler, + HTTPErrorProcessor as HTTPErrorProcessor, + HTTPHandler as HTTPHandler, + HTTPPasswordMgr as HTTPPasswordMgr, + HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm, + HTTPRedirectHandler as HTTPRedirectHandler, + HTTPSHandler as HTTPSHandler, + OpenerDirector as OpenerDirector, + ProxyBasicAuthHandler as ProxyBasicAuthHandler, + ProxyDigestAuthHandler as ProxyDigestAuthHandler, + ProxyHandler as ProxyHandler, + Request as Request, + UnknownHandler as UnknownHandler, + URLopener as URLopener, + build_opener as build_opener, + getproxies as getproxies, + install_opener as install_opener, + parse_http_list as parse_http_list, + parse_keqv_list as parse_keqv_list, + pathname2url as pathname2url, + url2pathname as url2pathname, + urlcleanup as urlcleanup, + urlopen as urlopen, + urlretrieve as urlretrieve, +)