This commit is contained in:
Eric Traut 2019-03-11 20:45:56 -07:00
Родитель da82496b3c
Коммит 1d91744b1f
604 изменённых файлов: 64339 добавлений и 57 удалений

62
.gitignore поставляемый
Просмотреть файл

@ -1,61 +1,11 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
node_modules
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next
# Output files
server/out/
client/out/
client/server/
client/*.vsix

Просмотреть файл

@ -1,5 +1,16 @@
# pyright
# Contributing
Static type checker for the Python language
## Build Instructions
1. Install [nodejs](https://nodejs.org/en/)
2. Open terminal window in main directory of cloned source
3. Execute "npm install" to download dependencies
4. Execute "npm run build"
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us

Просмотреть файл

@ -0,0 +1,44 @@
"use strict";
/*
* extension.ts
*
* Provides client for Pyright Python language server. This portion runs
* in the context of the VS Code process and talks to the server, which
* runs in another process.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const vscode_1 = require("vscode");
const vscode_languageclient_1 = require("vscode-languageclient");
function activate(context) {
let serverModule = context.asAbsolutePath(path.join('server', 'server.js'));
let debugOptions = { execArgv: ["--nolazy", "--inspect=6600"] };
// If the extension is launched in debug mode, then the debug server options are used.
// Otherwise the run options are used.
let serverOptions = {
run: { module: serverModule, transport: vscode_languageclient_1.TransportKind.ipc },
debug: { module: serverModule, transport: vscode_languageclient_1.TransportKind.ipc, options: debugOptions }
};
// Options to control the language client
let clientOptions = {
// Register the server for plain text documents
documentSelector: [{
scheme: 'file',
language: 'python'
}],
synchronize: {
// Synchronize the setting section 'languageServerExample' to the server
configurationSection: 'python',
// Notify the server about file changes to '.clientrc files contain in the workspace
fileEvents: vscode_1.workspace.createFileSystemWatcher('**/.clientrc')
}
};
// Create the language client and start the client.
let languageClient = new vscode_languageclient_1.LanguageClient('python', 'Python', serverOptions, clientOptions);
let disposable = languageClient.start();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation.
context.subscriptions.push(disposable);
}
exports.activate = activate;
//# sourceMappingURL=extension.js.map

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/extension.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;AAEF,6BAA6B;AAC7B,mCAAqD;AACrD,iEAA4G;AAE5G,SAAgB,QAAQ,CAAC,OAAyB;IACjD,IAAI,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5E,IAAI,YAAY,GAAG,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,EAAE,CAAC;IAEhE,sFAAsF;IACtF,sCAAsC;IACtC,IAAI,aAAa,GAAkB;QAClC,GAAG,EAAG,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,qCAAa,CAAC,GAAG,EAAE;QAC5D,KAAK,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,qCAAa,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE;KACpF,CAAA;IAED,yCAAyC;IACzC,IAAI,aAAa,GAA0B;QAC1C,+CAA+C;QAC/C,gBAAgB,EAAE,CAAC;gBAClB,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,QAAQ;aAClB,CAAC;QACF,WAAW,EAAE;YACZ,wEAAwE;YACxE,oBAAoB,EAAE,QAAQ;YAC9B,oFAAoF;YACpF,UAAU,EAAE,kBAAS,CAAC,uBAAuB,CAAC,cAAc,CAAC;SAC7D;KACD,CAAA;IAED,mDAAmD;IACnD,IAAI,cAAc,GAAG,IAAI,sCAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IAC1F,IAAI,UAAU,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;IAExC,kEAAkE;IAClE,uDAAuD;IACvD,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAjCD,4BAiCC"}

1819
client/package-lock.json сгенерированный Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

55
client/package.json Normal file
Просмотреть файл

@ -0,0 +1,55 @@
{
"name": "pyright",
"displayName": "Pyright",
"description": "VS Code language support for Python",
"version": "0.1.0",
"licensce": "MIT",
"author": {
"name": "Microsoft Corporation"
},
"publisher": "Microsoft",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/pyright"
},
"engines": {
"vscode": "^1.26.0"
},
"keywords": [
"python"
],
"categories": [
"Programming Languages"
],
"activationEvents": [
"onLanguage:python"
],
"main": "./out/src/extension",
"contributes": {
"languages": [
{
"id": "python",
"aliases": [
"Python"
],
"extensions": [
".py",
".pyi"
]
}
]
},
"scripts": {
"vscode:prepublish": "npm run build",
"build": "tsc -p ./",
"update-vscode": "node ./node_modules/vscode/bin/install",
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"typescript": "^3.2.2",
"vscode": "^1.1.26"
},
"dependencies": {
"vscode-languageclient": "^5.1.1"
}
}

46
client/src/extension.ts Normal file
Просмотреть файл

@ -0,0 +1,46 @@
/*
* extension.ts
*
* Provides client for Pyright Python language server. This portion runs
* in the context of the VS Code process and talks to the server, which
* runs in another process.
*/
import * as path from 'path';
import { ExtensionContext, workspace } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient';
export function activate(context: ExtensionContext) {
let serverModule = context.asAbsolutePath(path.join('server', 'server.js'));
let debugOptions = { execArgv: ["--nolazy", "--inspect=6600"] };
// If the extension is launched in debug mode, then the debug server options are used.
// Otherwise the run options are used.
let serverOptions: ServerOptions = {
run : { module: serverModule, transport: TransportKind.ipc },
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
}
// Options to control the language client
let clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{
scheme: 'file',
language: 'python'
}],
synchronize: {
// Synchronize the setting section 'languageServerExample' to the server
configurationSection: 'python',
// Notify the server about file changes to '.clientrc files contain in the workspace
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
}
}
// Create the language client and start the client.
let languageClient = new LanguageClient('python', 'Python', serverOptions, clientOptions);
let disposable = languageClient.start();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation.
context.subscriptions.push(disposable);
}

20
client/tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,20 @@
{
"compilerOptions": {
"noUnusedLocals": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"skipLibCheck": true,
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"rootDir": ".",
"outDir": "out",
"lib": [ "es2016" ],
"sourceMap": true
},
"exclude": [
"node_modules",
"server"
]
}

Просмотреть файл

@ -0,0 +1,238 @@
The "typeshed" project is licensed under the terms of the Apache license, as
reproduced below.
= = = = =
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
= = = = =
Parts of typeshed are licensed under different licenses (like the MIT
license), reproduced below.
= = = = =
The MIT License
Copyright (c) 2015 Jukka Lehtosalo and contributors
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
= = = = =

Просмотреть файл

@ -0,0 +1,144 @@
# typeshed
[![Build Status](https://travis-ci.org/python/typeshed.svg?branch=master)](https://travis-ci.org/python/typeshed)
[![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## About
Typeshed contains external type annotations for the Python standard library
and Python builtins, as well as third party packages.
This data can e.g. be used for static analysis, type checking or type inference.
For information on how to use `typeshed`, read below. Information for
contributors can be found in [CONTRIBUTING.md](CONTRIBUTING.md). **Please read
it before submitting pull requests.**
Typeshed supports Python versions 2.7 and 3.4 and up.
## Using
If you're just using mypy (or pytype or PyCharm), as opposed to
developing it, you don't need to interact with the typeshed repo at
all: a copy of typeshed is bundled with mypy.
When you use a checked-out clone of the mypy repo, a copy of typeshed
should be included as a submodule, using
$ git clone --recurse-submodules https://github.com/python/mypy.git
or
$ git clone https://github.com/python/mypy.git
$ cd mypy
$ git submodule init
$ git submodule update
and occasionally you will have to repeat the final command (`git
submodule update`) to pull in changes made in the upstream typeshed
repo.
PyCharm and pytype similarly include a copy of typeshed. The one in
pytype can be updated in the same way if you are working with the
pytype repo.
## Format
Each Python module is represented by a `.pyi` "stub". This is a normal Python
file (i.e., it can be interpreted by Python 3), except all the methods are empty.
Python function annotations ([PEP 3107](https://www.python.org/dev/peps/pep-3107/))
are used to describe the types the function has.
See [PEP 484](http://www.python.org/dev/peps/pep-0484/) for the exact
syntax of the stub files and [CONTRIBUTING.md](CONTRIBUTING.md) for the
coding style used in typeshed.
## Directory structure
### stdlib
This contains stubs for modules the Python standard library -- which
includes pure Python modules, dynamically loaded extension modules,
hard-linked extension modules, and the builtins.
### third_party
Modules that are not shipped with Python but have a type description in Python
go into `third_party`. Since these modules can behave differently for different
versions of Python, `third_party` has version subdirectories, just like
`stdlib`.
NOTE: When you're contributing a new stub for a package that you did
not develop, please obtain consent of the package owner (this is
specified in [PEP
484](https://www.python.org/dev/peps/pep-0484/#the-typeshed-repo)).
The best way to obtain consent is to file an issue in the third-party
package's tracker and include the link to a positive response in your PR
for typeshed.
For more information on directory structure and stub versioning, see
[the relevant section of CONTRIBUTING.md](
https://github.com/python/typeshed/blob/master/CONTRIBUTING.md#stub-versioning).
## Contributing
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
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`
runs tests against [mypy](https://github.com/python/mypy/), while
`tests/pytype_test.py` runs tests against
[pytype](https://github.com/google/pytype/).
Both sets of tests are shallow -- they verify that all stubs can be
imported but they don't check whether stubs match their implementation
(in the Python standard library or a third-party package). Also note
that each set of tests has a blacklist of modules that are not tested
at all. The blacklists also live in the tests directory.
In addition, you can run `tests/mypy_selftest.py` to run mypy's own
test suite using the typeshed code in your repo. This will sometimes
catch issues with incorrectly typed stubs, but is much slower than the
other tests.
To manually run the mypy tests, you need to have Python 3.5 or higher;
Python 3.6.1 or higher is recommended.
Run:
```
$ 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:
```
(.venv3)$ python3 tests/mypy_test.py
...
(.venv3)$ python3 tests/mypy_selftest.py
...
(.venv3)$ flake8
...
(.venv3)$ python3 tests/pytype_test.py
...
```
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
them with the `--python27-exe` and `--python36-exe` arguments, respectively.
For mypy, if you are in the typeshed repo that is submodule of the
mypy repo (so `..` refers to the mypy repo), there's a shortcut to run
the mypy tests that avoids installing mypy:
```bash
$ PYTHONPATH=../.. python3 tests/mypy_test.py
```
You can mypy tests to a single version by passing `-p2` or `-p3.5` e.g.
```bash
$ PYTHONPATH=../.. python3 tests/mypy_test.py -p3.5
running mypy --python-version 3.5 --strict-optional # with 342 files
```

Просмотреть файл

@ -0,0 +1,47 @@
# Stubs for BaseHTTPServer (Python 2.7)
from typing import Any, BinaryIO, Mapping, Optional, Tuple, Union
import SocketServer
import mimetools
class HTTPServer(SocketServer.TCPServer):
server_name = ... # type: str
server_port = ... # type: int
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: type) -> None: ...
class BaseHTTPRequestHandler:
client_address = ... # type: Tuple[str, int]
server = ... # type: SocketServer.BaseServer
close_connection = ... # type: bool
command = ... # type: str
path = ... # type: str
request_version = ... # type: str
headers = ... # type: mimetools.Message
rfile = ... # type: BinaryIO
wfile = ... # type: BinaryIO
server_version = ... # type: str
sys_version = ... # type: str
error_message_format = ... # type: str
error_content_type = ... # type: str
protocol_version = ... # type: str
MessageClass = ... # type: type
responses = ... # type: Mapping[int, Tuple[str, str]]
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_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_error(self, format: str, *args: Any) -> None: ...
def log_message(self, format: str, *args: Any) -> None: ...
def version_string(self) -> str: ...
def date_time_string(self, timestamp: Optional[int] = ...) -> str: ...
def log_date_time_string(self) -> str: ...
def address_string(self) -> str: ...

Просмотреть файл

@ -0,0 +1,97 @@
from typing import Any, IO, Sequence, Tuple, Union, List, Dict, Protocol
DEFAULTSECT = ... # type: str
MAX_INTERPOLATION_DEPTH = ... # type: int
class Error(Exception):
message = ... # type: Any
def __init__(self, msg: str = ...) -> None: ...
def _get_message(self) -> None: ...
def _set_message(self, value: str) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
class NoSectionError(Error):
section = ... # type: str
def __init__(self, section: str) -> None: ...
class DuplicateSectionError(Error):
section = ... # type: str
def __init__(self, section: str) -> None: ...
class NoOptionError(Error):
section = ... # type: str
option = ... # type: str
def __init__(self, option: str, section: str) -> None: ...
class InterpolationError(Error):
section = ... # type: str
option = ... # type: str
msg = ... # type: str
def __init__(self, option: str, section: str, msg: str) -> None: ...
class InterpolationMissingOptionError(InterpolationError):
reference = ... # type: str
def __init__(self, option: str, section: str, rawval: str, reference: str) -> None: ...
class InterpolationSyntaxError(InterpolationError): ...
class InterpolationDepthError(InterpolationError):
def __init__(self, option: str, section: str, rawval: str) -> None: ...
class ParsingError(Error):
filename = ... # type: str
errors = ... # type: List[Tuple[Any, Any]]
def __init__(self, filename: str) -> None: ...
def append(self, lineno: Any, line: Any) -> None: ...
class MissingSectionHeaderError(ParsingError):
lineno = ... # type: Any
line = ... # type: Any
def __init__(self, filename: str, lineno: Any, line: Any) -> None: ...
class _Readable(Protocol):
def readline(self) -> str: ...
class RawConfigParser:
_dict = ... # type: Any
_sections = ... # type: dict
_defaults = ... # type: dict
_optcre = ... # type: Any
SECTCRE = ... # type: Any
OPTCRE = ... # type: Any
OPTCRE_NV = ... # type: Any
def __init__(self, defaults: Dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ...
def defaults(self) -> Dict[Any, Any]: ...
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 read(self, filenames: Union[str, Sequence[str]]) -> List[str]: ...
def readfp(self, fp: _Readable, filename: str = ...) -> None: ...
def get(self, section: str, option: str) -> str: ...
def items(self, section: str) -> List[Tuple[Any, Any]]: ...
def _get(self, section: str, conv: type, option: str) -> Any: ...
def getint(self, section: str, option: str) -> int: ...
def getfloat(self, section: str, option: str) -> float: ...
_boolean_states = ... # type: Dict[str, bool]
def getboolean(self, section: str, option: str) -> bool: ...
def optionxform(self, optionstr: str) -> str: ...
def has_option(self, section: str, option: str) -> bool: ...
def set(self, section: str, option: str, value: Any = ...) -> None: ...
def write(self, fp: IO[str]) -> None: ...
def remove_option(self, section: str, option: Any) -> bool: ...
def remove_section(self, section: str) -> bool: ...
def _read(self, fp: IO[str], fpname: str) -> None: ...
class ConfigParser(RawConfigParser):
_KEYCRE = ... # type: Any
def get(self, section: str, option: str, raw: bool = ..., vars: dict = ...) -> Any: ...
def items(self, section: str, raw: bool = ..., vars: dict = ...) -> List[Tuple[str, Any]]: ...
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
def _interpolation_replace(self, match: Any) -> str: ...
class SafeConfigParser(ConfigParser):
_interpvar_re = ... # type: Any
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
def _interpolate_some(self, option: str, accum: list, rest: str, section: str, map: dict, depth: int) -> None: ...

Просмотреть файл

@ -0,0 +1,40 @@
from typing import Any, Optional
class CookieError(Exception): ...
class Morsel(dict):
key = ... # type: Any
def __init__(self): ...
def __setitem__(self, K, V): ...
def isReservedKey(self, K): ...
value = ... # type: Any
coded_value = ... # type: Any
def set(self, key, val, coded_val, LegalChars=..., idmap=..., translate=...): ...
def output(self, attrs: Optional[Any] = ..., header=...): ...
def js_output(self, attrs: Optional[Any] = ...): ...
def OutputString(self, attrs: Optional[Any] = ...): ...
class BaseCookie(dict):
def value_decode(self, val): ...
def value_encode(self, val): ...
def __init__(self, input: Optional[Any] = ...): ...
def __setitem__(self, key, value): ...
def output(self, attrs: Optional[Any] = ..., header=..., sep=...): ...
def js_output(self, attrs: Optional[Any] = ...): ...
def load(self, rawdata): ...
class SimpleCookie(BaseCookie):
def value_decode(self, val): ...
def value_encode(self, val): ...
class SerialCookie(BaseCookie):
def __init__(self, input: Optional[Any] = ...): ...
def value_decode(self, val): ...
def value_encode(self, val): ...
class SmartCookie(BaseCookie):
def __init__(self, input: Optional[Any] = ...): ...
def value_decode(self, val): ...
def value_encode(self, val): ...
Cookie = ... # type: Any

Просмотреть файл

@ -0,0 +1,31 @@
from typing import List, Tuple, AnyStr
from markupbase import ParserBase
class HTMLParser(ParserBase):
def __init__(self) -> None: ...
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): ...
def handle_charref(self, name: AnyStr): ...
def handle_entityref(self, name: AnyStr): ...
def handle_data(self, data: AnyStr): ...
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):
msg = ... # type: str
lineno = ... # type: int
offset = ... # type: int

Просмотреть файл

@ -0,0 +1,29 @@
# Stubs for Queue (Python 2)
from typing import Any, TypeVar, Generic, Optional
_T = TypeVar('_T')
class Empty(Exception): ...
class Full(Exception): ...
class Queue(Generic[_T]):
maxsize = ... # type: Any
mutex = ... # type: Any
not_empty = ... # type: Any
not_full = ... # type: Any
all_tasks_done = ... # type: Any
unfinished_tasks = ... # type: Any
def __init__(self, maxsize: int = ...) -> None: ...
def task_done(self) -> None: ...
def join(self) -> None: ...
def qsize(self) -> int: ...
def empty(self) -> bool: ...
def full(self) -> bool: ...
def put(self, item: _T, block: bool = ..., timeout: Optional[float] = ...) -> None: ...
def put_nowait(self, item: _T) -> None: ...
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
def get_nowait(self) -> _T: ...
class PriorityQueue(Queue): ...
class LifoQueue(Queue): ...

Просмотреть файл

@ -0,0 +1,16 @@
# Stubs for SimpleHTTPServer (Python 2)
from typing import Any, AnyStr, IO, Mapping, Optional, Union
import BaseHTTPServer
from StringIO import StringIO
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
server_version = ... # type: str
def do_GET(self) -> None: ...
def do_HEAD(self) -> None: ...
def send_head(self) -> Optional[IO[str]]: ...
def list_directory(self, path: Union[str, unicode]) -> Optional[StringIO]: ...
def translate_path(self, path: AnyStr) -> AnyStr: ...
def copyfile(self, source: IO[AnyStr], outputfile: IO[AnyStr]): ...
def guess_type(self, path: Union[str, unicode]) -> str: ...
extensions_map = ... # type: Mapping[str, str]

Просмотреть файл

@ -0,0 +1,99 @@
# 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
class BaseServer:
address_family = ... # type: int
RequestHandlerClass = ... # type: type
server_address = ... # type: Tuple[str, int]
socket = ... # type: SocketType
allow_reuse_address = ... # type: bool
request_queue_size = ... # type: int
socket_type = ... # type: int
timeout = ... # type: Optional[float]
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 get_request(self) -> 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 server_activate(self) -> None: ...
def server_bind(self) -> None: ...
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: ...
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: ...
class UDPServer(BaseServer):
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: type,
bind_and_activate: bool = ...) -> None: ...
if sys.platform != 'win32':
class UnixStreamServer(BaseServer):
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: ...
class ForkingMixIn: ...
class ThreadingMixIn: ...
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
class ThreadingTCPServer(ThreadingMixIn, TCPServer): ...
class ThreadingUDPServer(ThreadingMixIn, UDPServer): ...
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]]
# * Union[Tuple[str, int], str]
# But there are some concerns that having unions here would cause
# too much inconvenience to people using it (see
# https://github.com/python/typeshed/pull/384#issuecomment-234649696)
request = ... # type: Any
client_address = ... # type: Any
server = ... # type: BaseServer
def setup(self) -> None: ...
def handle(self) -> None: ...
def finish(self) -> None: ...
class StreamRequestHandler(BaseRequestHandler):
rfile = ... # type: BinaryIO
wfile = ... # type: BinaryIO
class DatagramRequestHandler(BaseRequestHandler):
rfile = ... # type: BinaryIO
wfile = ... # type: BinaryIO

Просмотреть файл

@ -0,0 +1,30 @@
# Stubs for StringIO (Python 2)
from typing import Any, IO, AnyStr, Iterator, Iterable, Generic, List, Optional
class StringIO(IO[AnyStr], Generic[AnyStr]):
closed = ... # type: bool
softspace = ... # type: int
len = ... # type: int
name = ... # type: str
def __init__(self, buf: AnyStr = ...) -> None: ...
def __iter__(self) -> Iterator[AnyStr]: ...
def next(self) -> AnyStr: ...
def close(self) -> None: ...
def isatty(self) -> bool: ...
def seek(self, pos: int, mode: int = ...) -> int: ...
def tell(self) -> int: ...
def read(self, n: int = ...) -> AnyStr: ...
def readline(self, length: int = ...) -> AnyStr: ...
def readlines(self, sizehint: int = ...) -> List[AnyStr]: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def write(self, s: AnyStr) -> int: ...
def writelines(self, iterable: Iterable[AnyStr]) -> None: ...
def flush(self) -> None: ...
def getvalue(self) -> AnyStr: ...
def __enter__(self) -> Any: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> Any: ...
def fileno(self) -> int: ...
def readable(self) -> bool: ...
def seekable(self) -> bool: ...
def writable(self) -> bool: ...

Просмотреть файл

@ -0,0 +1,44 @@
from typing import (Any, Container, Dict, Generic, Iterable, Iterator, List,
Mapping, Optional, Sized, Tuple, TypeVar, Union, overload)
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
_T = TypeVar('_T')
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
data = ... # type: 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 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
def get(self, k: _KT) -> Optional[_VT]: ...
@overload
def get(self, k: _KT, default: Union[_VT, _T]) -> Union[_VT, _T]: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...
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: ...
def popitem(self) -> Tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
@overload
def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...

Просмотреть файл

@ -0,0 +1,18 @@
from typing import Iterable, MutableSequence, TypeVar, Union, overload
_T = TypeVar("_T")
_ULT = TypeVar("_ULT", bound=UserList)
class UserList(MutableSequence[_T]):
def insert(self, index: int, object: _T) -> None: ...
@overload
def __setitem__(self, i: int, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __delitem__(self, i: Union[int, slice]) -> None: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
def __getitem__(self: _ULT, s: slice) -> _ULT: ...
def sort(self) -> None: ...

Просмотреть файл

@ -0,0 +1,75 @@
import collections
from typing import Any, Iterable, List, MutableSequence, Sequence, Optional, overload, Text, TypeVar, Tuple, Union
_UST = TypeVar("_UST", bound=UserString)
_MST = TypeVar("_MST", bound=MutableString)
class UserString(Sequence[UserString]):
data: unicode
def __init__(self, seq: object) -> None: ...
def __int__(self) -> int: ...
def __long__(self) -> long: ...
def __float__(self) -> float: ...
def __complex__(self) -> complex: ...
def __hash__(self) -> int: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self: _UST, i: int) -> _UST: ...
@overload
def __getitem__(self: _UST, s: slice) -> _UST: ...
def __add__(self: _UST, other: Any) -> _UST: ...
def __radd__(self: _UST, other: Any) -> _UST: ...
def __mul__(self: _UST, other: int) -> _UST: ...
def __rmul__(self: _UST, other: int) -> _UST: ...
def __mod__(self: _UST, args: Any) -> _UST: ...
def capitalize(self: _UST) -> _UST: ...
def center(self: _UST, width: int, *args: Any) -> _UST: ...
def count(self, sub: int, start: int = ..., end: int = ...) -> int: ...
def decode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ...
def encode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ...
def endswith(self, suffix: Text, start: int = ..., end: int = ...) -> bool: ...
def expandtabs(self: _UST, tabsize: int = ...) -> _UST: ...
def find(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def index(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def isalpha(self) -> bool: ...
def isalnum(self) -> bool: ...
def isdecimal(self) -> bool: ...
def isdigit(self) -> bool: ...
def islower(self) -> bool: ...
def isnumeric(self) -> bool: ...
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, seq: Iterable[Text]) -> Text: ...
def ljust(self: _UST, width: int, *args: Any) -> _UST: ...
def lower(self: _UST) -> _UST: ...
def lstrip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def partition(self, sep: Text) -> Tuple[Text, Text, Text]: ...
def replace(self: _UST, old: Text, new: Text, maxsplit: int = ...) -> _UST: ...
def rfind(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def rindex(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def rjust(self: _UST, width: int, *args: Any) -> _UST: ...
def rpartition(self, sep: Text) -> Tuple[Text, Text, Text]: ...
def rstrip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def split(self, sep: Optional[Text] = ..., maxsplit: int = ...) -> List[Text]: ...
def rsplit(self, sep: Optional[Text] = ..., maxsplit: int = ...) -> List[Text]: ...
def splitlines(self, keepends: int = ...) -> List[Text]: ...
def startswith(self, suffix: Text, start: int = ..., end: int = ...) -> bool: ...
def strip(self: _UST, chars: Optional[Text] = ...) -> _UST: ...
def swapcase(self: _UST) -> _UST: ...
def title(self: _UST) -> _UST: ...
def translate(self: _UST, *args: Any) -> _UST: ...
def upper(self: _UST) -> _UST: ...
def zfill(self: _UST, width: int) -> _UST: ...
class MutableString(UserString, MutableSequence[MutableString]): # type: ignore
@overload
def __getitem__(self: _MST, i: int) -> _MST: ...
@overload
def __getitem__(self: _MST, s: slice) -> _MST: ...
def __setitem__(self, index: Union[int, slice], sub: Any) -> None: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
def immutable(self) -> UserString: ...
def __iadd__(self: _MST, other: Any) -> _MST: ...
def __imul__(self, n: int) -> _MST: ...
def insert(self, index: int, value: Any) -> None: ...

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,328 @@
import typing
from typing import Optional
__version__ = ... # type: str
PyCF_ONLY_AST = ... # type: int
_identifier = str
class AST:
_attributes = ... # type: typing.Tuple[str, ...]
_fields = ... # type: typing.Tuple[str, ...]
def __init__(self, *args, **kwargs) -> None: ...
class mod(AST):
...
class Module(mod):
body = ... # type: typing.List[stmt]
class Interactive(mod):
body = ... # type: typing.List[stmt]
class Expression(mod):
body = ... # type: expr
class Suite(mod):
body = ... # type: typing.List[stmt]
class stmt(AST):
lineno = ... # type: int
col_offset = ... # type: int
class FunctionDef(stmt):
name = ... # type: _identifier
args = ... # type: arguments
body = ... # type: typing.List[stmt]
decorator_list = ... # type: typing.List[expr]
class ClassDef(stmt):
name = ... # type: _identifier
bases = ... # type: typing.List[expr]
body = ... # type: typing.List[stmt]
decorator_list = ... # type: typing.List[expr]
class Return(stmt):
value = ... # type: Optional[expr]
class Delete(stmt):
targets = ... # type: typing.List[expr]
class Assign(stmt):
targets = ... # type: typing.List[expr]
value = ... # type: expr
class AugAssign(stmt):
target = ... # type: expr
op = ... # type: operator
value = ... # type: expr
class Print(stmt):
dest = ... # type: Optional[expr]
values = ... # type: typing.List[expr]
nl = ... # type: bool
class For(stmt):
target = ... # type: expr
iter = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
class While(stmt):
test = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
class If(stmt):
test = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
class With(stmt):
context_expr = ... # type: expr
optional_vars = ... # type: Optional[expr]
body = ... # type: typing.List[stmt]
class Raise(stmt):
type = ... # type: Optional[expr]
inst = ... # type: Optional[expr]
tback = ... # type: Optional[expr]
class TryExcept(stmt):
body = ... # type: typing.List[stmt]
handlers = ... # type: typing.List[ExceptHandler]
orelse = ... # type: typing.List[stmt]
class TryFinally(stmt):
body = ... # type: typing.List[stmt]
finalbody = ... # type: typing.List[stmt]
class Assert(stmt):
test = ... # type: expr
msg = ... # type: Optional[expr]
class Import(stmt):
names = ... # type: typing.List[alias]
class ImportFrom(stmt):
module = ... # type: Optional[_identifier]
names = ... # type: typing.List[alias]
level = ... # type: Optional[int]
class Exec(stmt):
body = ... # type: expr
globals = ... # type: Optional[expr]
locals = ... # type: Optional[expr]
class Global(stmt):
names = ... # type: typing.List[_identifier]
class Expr(stmt):
value = ... # type: expr
class Pass(stmt): ...
class Break(stmt): ...
class Continue(stmt): ...
class slice(AST):
...
_slice = slice # this lets us type the variable named 'slice' below
class Slice(slice):
lower = ... # type: Optional[expr]
upper = ... # type: Optional[expr]
step = ... # type: Optional[expr]
class ExtSlice(slice):
dims = ... # type: typing.List[slice]
class Index(slice):
value = ... # type: expr
class Ellipsis(slice): ...
class expr(AST):
lineno = ... # type: int
col_offset = ... # type: int
class BoolOp(expr):
op = ... # type: boolop
values = ... # type: typing.List[expr]
class BinOp(expr):
left = ... # type: expr
op = ... # type: operator
right = ... # type: expr
class UnaryOp(expr):
op = ... # type: unaryop
operand = ... # type: expr
class Lambda(expr):
args = ... # type: arguments
body = ... # type: expr
class IfExp(expr):
test = ... # type: expr
body = ... # type: expr
orelse = ... # type: expr
class Dict(expr):
keys = ... # type: typing.List[expr]
values = ... # type: typing.List[expr]
class Set(expr):
elts = ... # type: typing.List[expr]
class ListComp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
class SetComp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
class DictComp(expr):
key = ... # type: expr
value = ... # type: expr
generators = ... # type: typing.List[comprehension]
class GeneratorExp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
class Yield(expr):
value = ... # type: Optional[expr]
class Compare(expr):
left = ... # type: expr
ops = ... # type: typing.List[cmpop]
comparators = ... # type: typing.List[expr]
class Call(expr):
func = ... # type: expr
args = ... # type: typing.List[expr]
keywords = ... # type: typing.List[keyword]
starargs = ... # type: Optional[expr]
kwargs = ... # type: Optional[expr]
class Repr(expr):
value = ... # type: expr
class Num(expr):
n = ... # type: float
class Str(expr):
s = ... # type: str
class Attribute(expr):
value = ... # type: expr
attr = ... # type: _identifier
ctx = ... # type: expr_context
class Subscript(expr):
value = ... # type: expr
slice = ... # type: _slice
ctx = ... # type: expr_context
class Name(expr):
id = ... # type: _identifier
ctx = ... # type: expr_context
class List(expr):
elts = ... # type: typing.List[expr]
ctx = ... # type: expr_context
class Tuple(expr):
elts = ... # type: typing.List[expr]
ctx = ... # type: expr_context
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 And(boolop): ...
class Or(boolop): ...
class operator(AST):
...
class Add(operator): ...
class BitAnd(operator): ...
class BitOr(operator): ...
class BitXor(operator): ...
class Div(operator): ...
class FloorDiv(operator): ...
class LShift(operator): ...
class Mod(operator): ...
class Mult(operator): ...
class Pow(operator): ...
class RShift(operator): ...
class Sub(operator): ...
class unaryop(AST):
...
class Invert(unaryop): ...
class Not(unaryop): ...
class UAdd(unaryop): ...
class USub(unaryop): ...
class cmpop(AST):
...
class Eq(cmpop): ...
class Gt(cmpop): ...
class GtE(cmpop): ...
class In(cmpop): ...
class Is(cmpop): ...
class IsNot(cmpop): ...
class Lt(cmpop): ...
class LtE(cmpop): ...
class NotEq(cmpop): ...
class NotIn(cmpop): ...
class comprehension(AST):
target = ... # type: expr
iter = ... # type: expr
ifs = ... # type: typing.List[expr]
class ExceptHandler(AST):
type = ... # type: Optional[expr]
name = ... # type: Optional[expr]
body = ... # type: typing.List[stmt]
lineno = ... # type: int
col_offset = ... # type: int
class arguments(AST):
args = ... # type: typing.List[expr]
vararg = ... # type: Optional[_identifier]
kwarg = ... # type: Optional[_identifier]
defaults = ... # type: typing.List[expr]
class keyword(AST):
arg = ... # type: _identifier
value = ... # type: expr
class alias(AST):
name = ... # type: _identifier
asname = ... # type: Optional[_identifier]

Просмотреть файл

@ -0,0 +1,41 @@
"""Stub file for the '_collections' module."""
from typing import Any, Generic, Iterator, TypeVar, Optional, Union
class defaultdict(dict):
default_factory = ... # type: None
def __init__(self, default: Any = ..., init: Any = ...) -> None: ...
def __missing__(self, key) -> Any:
raise KeyError()
def __copy__(self) -> defaultdict: ...
def copy(self) -> defaultdict: ...
_T = TypeVar('_T')
_T2 = TypeVar('_T2')
class deque(Generic[_T]):
maxlen = ... # type: Optional[int]
def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ...
def append(self, x: _T) -> None: ...
def appendleft(self, x: _T) -> None: ...
def clear(self) -> None: ...
def count(self, x: Any) -> int: ...
def extend(self, iterable: Iterator[_T]) -> None: ...
def extendleft(self, iterable: Iterator[_T]) -> None: ...
def pop(self) -> _T:
raise IndexError()
def popleft(self) -> _T:
raise IndexError()
def remove(self, value: _T) -> None:
raise IndexError()
def reverse(self) -> None: ...
def rotate(self, n: int = ...) -> None: ...
def __contains__(self, o: Any) -> bool: ...
def __copy__(self) -> deque[_T]: ...
def __getitem__(self, i: int) -> _T:
raise IndexError()
def __iadd__(self, other: deque[_T2]) -> deque[Union[_T, _T2]]: ...
def __iter__(self) -> Iterator[_T]: ...
def __len__(self) -> int: ...
def __reversed__(self) -> Iterator[_T]: ...
def __setitem__(self, i: int, x: _T) -> None: ...

Просмотреть файл

@ -0,0 +1,20 @@
"""Stub file for the '_functools' module."""
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Tuple, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
@overload
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: ...
class partial(object):
func = ... # type: Callable[..., Any]
args = ... # type: Tuple[Any, ...]
keywords = ... # type: Dict[str, Any]
def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...

Просмотреть файл

@ -0,0 +1,34 @@
"""Stub file for the '_hotshot' module."""
# This is an autogenerated file. It serves as a starting point
# 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
def coverage(a: str) -> Any: ...
def logreader(a: str) -> LogReaderType:
raise IOError()
raise RuntimeError()
def profiler(a: str, *args, **kwargs) -> Any:
raise IOError()
def resolution() -> tuple: ...
class LogReaderType(object):
def close(self) -> None: ...
def fileno(self) -> int:
raise ValueError()
class ProfilerType(object):
def addinfo(self, a: str, b: str) -> None: ...
def close(self) -> None: ...
def fileno(self) -> int:
raise ValueError()
def runcall(self, *args, **kwargs) -> Any: ...
def runcode(self, a, b, *args, **kwargs) -> Any:
raise TypeError()
def start(self) -> None: ...
def stop(self) -> None: ...

Просмотреть файл

@ -0,0 +1,183 @@
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
_bytearray_like = Union[bytearray, mmap]
DEFAULT_BUFFER_SIZE = ... # type: int
class BlockingIOError(IOError):
characters_written = ... # type: int
class UnsupportedOperation(ValueError, IOError): ...
_T = TypeVar("_T")
class _IOBase(BinaryIO):
@property
def closed(self) -> bool: ...
def _checkClosed(self) -> None: ...
def _checkReadable(self) -> None: ...
def _checkSeekable(self) -> None: ...
def _checkWritable(self) -> None: ...
# All these methods are concrete here (you can instantiate this)
def close(self) -> None: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...
def __iter__(self: _T) -> _T: ...
# The parameter type of writelines[s]() is determined by that of write():
def writelines(self, lines: Iterable[bytes]) -> None: ...
# The return type of readline[s]() and next() is determined by that of read():
def readline(self, limit: int = ...) -> bytes: ...
def readlines(self, hint: int = ...) -> List[bytes]: ...
def next(self) -> bytes: ...
# These don't actually exist but we need to pretend that it does
# so that this class is concrete.
def write(self, s: bytes) -> int: ...
def read(self, n: int = ...) -> bytes: ...
class _BufferedIOBase(_IOBase):
def read1(self, n: int) -> bytes: ...
def read(self, size: int = ...) -> bytes: ...
def readinto(self, buffer: _bytearray_like) -> int: ...
def write(self, s: bytes) -> int: ...
def detach(self) -> _IOBase: ...
class BufferedRWPair(_BufferedIOBase):
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: ...
class BufferedRandom(_BufferedIOBase):
mode = ... # type: str
name = ... # type: str
raw = ... # type: _IOBase
def __init__(self, raw: _IOBase,
buffer_size: int = ...,
max_buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
class BufferedReader(_BufferedIOBase):
mode = ... # type: str
name = ... # type: str
raw = ... # type: _IOBase
def __init__(self, raw: _IOBase, buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
class BufferedWriter(_BufferedIOBase):
name = ... # type: str
raw = ... # type: _IOBase
mode = ... # type: str
def __init__(self, raw: _IOBase,
buffer_size: int = ...,
max_buffer_size: int = ...) -> None: ...
class BytesIO(_BufferedIOBase):
def __init__(self, initial_bytes: bytes = ...) -> None: ...
def __setstate__(self, tuple) -> None: ...
def __getstate__(self) -> tuple: ...
# BytesIO does not contain a "name" field. This workaround is necessary
# to allow BytesIO sub-classes to add this field, as it is defined
# as a read-only property on IO[].
name: Any
def getvalue(self) -> bytes: ...
def write(self, s: bytes) -> int: ...
def writelines(self, lines: Iterable[bytes]) -> None: ...
def read1(self, size: int) -> bytes: ...
def next(self) -> bytes: ...
class _RawIOBase(_IOBase):
def readall(self) -> str: ...
def read(self, n: int = ...) -> str: ...
class FileIO(_RawIOBase, BytesIO):
mode = ... # type: str
closefd = ... # type: bool
def __init__(self, file: Union[str, int], mode: str = ..., closefd: bool = ...) -> None: ...
def readinto(self, buffer: _bytearray_like) -> int: ...
def write(self, pbuf: str) -> int: ...
class IncrementalNewlineDecoder(object):
newlines = ... # type: Union[str, unicode]
def __init__(self, decoder, translate, z=...) -> None: ...
def decode(self, input, final) -> Any: ...
def getstate(self) -> Tuple[Any, int]: ...
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 = ... # type: Optional[str]
# TODO: On _TextIOBase, this is always None. But it's unicode/bytes in subclasses.
newlines = ... # type: Union[None, unicode, bytes]
encoding = ... # type: str
@property
def closed(self) -> bool: ...
def _checkClosed(self) -> None: ...
def _checkReadable(self) -> None: ...
def _checkSeekable(self) -> None: ...
def _checkWritable(self) -> None: ...
def close(self) -> None: ...
def detach(self) -> IO: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def next(self) -> unicode: ...
def read(self, size: int = ...) -> unicode: ...
def readable(self) -> bool: ...
def readline(self, limit: int = ...) -> unicode: ...
def readlines(self, hint: int = ...) -> list[unicode]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def write(self, pbuf: unicode) -> int: ...
def writelines(self, lines: Iterable[unicode]) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...
def __iter__(self: _T) -> _T: ...
class StringIO(_TextIOBase):
line_buffering = ... # type: bool
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
# to allow StringIO sub-classes to add this field, as it is defined
# as a read-only property on IO[].
name: Any
def getvalue(self) -> unicode: ...
class TextIOWrapper(_TextIOBase):
name = ... # type: str
line_buffering = ... # type: bool
buffer = ... # type: BinaryIO
_CHUNK_SIZE = ... # type: 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]: ...

Просмотреть файл

@ -0,0 +1,17 @@
"""Stub file for the '_json' module."""
# This is an autogenerated file. It serves as a starting point
# 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
def encode_basestring_ascii(*args, **kwargs) -> str:
raise TypeError()
def scanstring(a, b, *args, **kwargs) -> tuple:
raise TypeError()
class Encoder(object): ...
class Scanner(object): ...

Просмотреть файл

@ -0,0 +1,13 @@
blocksize = ... # type: int
digest_size = ... # type: int
class MD5Type(object):
name = ... # type: str
block_size = ... # type: int
digest_size = ... # type: int
def copy(self) -> MD5Type: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...
def new(arg: str = ...) -> MD5Type: ...

Просмотреть файл

@ -0,0 +1,15 @@
blocksize = ... # type: int
block_size = ... # type: int
digest_size = ... # type: int
class sha(object): # not actually exposed
name = ... # type: str
block_size = ... # type: int
digest_size = ... # type: int
digestsize = ... # type: int
def copy(self) -> sha: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...
def new(arg: str = ...) -> sha: ...

Просмотреть файл

@ -0,0 +1,23 @@
from typing import Optional
class sha224(object):
name = ... # type: str
block_size = ... # type: int
digest_size = ... # type: int
digestsize = ... # type: int
def __init__(self, init: Optional[str]) -> None: ...
def copy(self) -> sha224: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...
class sha256(object):
name = ... # type: str
block_size = ... # type: int
digest_size = ... # type: int
digestsize = ... # type: int
def __init__(self, init: Optional[str]) -> None: ...
def copy(self) -> sha256: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...

Просмотреть файл

@ -0,0 +1,23 @@
from typing import Optional
class sha384(object):
name = ... # type: str
block_size = ... # type: int
digest_size = ... # type: int
digestsize = ... # type: int
def __init__(self, init: Optional[str]) -> None: ...
def copy(self) -> sha384: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...
class sha512(object):
name = ... # type: str
block_size = ... # type: int
digest_size = ... # type: int
digestsize = ... # type: int
def __init__(self, init: Optional[str]) -> None: ...
def copy(self) -> sha512: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
def update(self, arg: str) -> None: ...

Просмотреть файл

@ -0,0 +1,287 @@
from typing import Tuple, Union, IO, Any, Optional, overload
AF_APPLETALK = ... # type: int
AF_ASH = ... # type: int
AF_ATMPVC = ... # type: int
AF_ATMSVC = ... # type: int
AF_AX25 = ... # type: int
AF_BLUETOOTH = ... # type: int
AF_BRIDGE = ... # type: int
AF_DECnet = ... # type: int
AF_ECONET = ... # type: int
AF_INET = ... # type: int
AF_INET6 = ... # type: int
AF_IPX = ... # type: int
AF_IRDA = ... # type: int
AF_KEY = ... # type: int
AF_LLC = ... # type: int
AF_NETBEUI = ... # type: int
AF_NETLINK = ... # type: int
AF_NETROM = ... # type: int
AF_PACKET = ... # type: int
AF_PPPOX = ... # type: int
AF_ROSE = ... # type: int
AF_ROUTE = ... # type: int
AF_SECURITY = ... # type: int
AF_SNA = ... # type: int
AF_TIPC = ... # type: int
AF_UNIX = ... # type: int
AF_UNSPEC = ... # type: int
AF_WANPIPE = ... # type: int
AF_X25 = ... # type: int
AI_ADDRCONFIG = ... # type: int
AI_ALL = ... # type: int
AI_CANONNAME = ... # type: int
AI_NUMERICHOST = ... # type: int
AI_NUMERICSERV = ... # type: int
AI_PASSIVE = ... # type: int
AI_V4MAPPED = ... # type: int
BDADDR_ANY = ... # type: str
BDADDR_LOCAL = ... # type: str
BTPROTO_HCI = ... # type: int
BTPROTO_L2CAP = ... # type: int
BTPROTO_RFCOMM = ... # type: int
BTPROTO_SCO = ... # type: int
EAI_ADDRFAMILY = ... # type: int
EAI_AGAIN = ... # type: int
EAI_BADFLAGS = ... # type: int
EAI_FAIL = ... # type: int
EAI_FAMILY = ... # type: int
EAI_MEMORY = ... # type: int
EAI_NODATA = ... # type: int
EAI_NONAME = ... # type: int
EAI_OVERFLOW = ... # type: int
EAI_SERVICE = ... # type: int
EAI_SOCKTYPE = ... # type: int
EAI_SYSTEM = ... # type: int
EBADF = ... # type: int
EINTR = ... # type: int
HCI_DATA_DIR = ... # type: int
HCI_FILTER = ... # type: int
HCI_TIME_STAMP = ... # type: int
INADDR_ALLHOSTS_GROUP = ... # type: int
INADDR_ANY = ... # type: int
INADDR_BROADCAST = ... # type: int
INADDR_LOOPBACK = ... # type: int
INADDR_MAX_LOCAL_GROUP = ... # type: int
INADDR_NONE = ... # type: int
INADDR_UNSPEC_GROUP = ... # type: int
IPPORT_RESERVED = ... # type: int
IPPORT_USERRESERVED = ... # type: int
IPPROTO_AH = ... # type: int
IPPROTO_DSTOPTS = ... # type: int
IPPROTO_EGP = ... # type: int
IPPROTO_ESP = ... # type: int
IPPROTO_FRAGMENT = ... # type: int
IPPROTO_GRE = ... # type: int
IPPROTO_HOPOPTS = ... # type: int
IPPROTO_ICMP = ... # type: int
IPPROTO_ICMPV6 = ... # type: int
IPPROTO_IDP = ... # type: int
IPPROTO_IGMP = ... # type: int
IPPROTO_IP = ... # type: int
IPPROTO_IPIP = ... # type: int
IPPROTO_IPV6 = ... # type: int
IPPROTO_NONE = ... # type: int
IPPROTO_PIM = ... # type: int
IPPROTO_PUP = ... # type: int
IPPROTO_RAW = ... # type: int
IPPROTO_ROUTING = ... # type: int
IPPROTO_RSVP = ... # type: int
IPPROTO_TCP = ... # type: int
IPPROTO_TP = ... # type: int
IPPROTO_UDP = ... # type: int
IPV6_CHECKSUM = ... # type: int
IPV6_DSTOPTS = ... # type: int
IPV6_HOPLIMIT = ... # type: int
IPV6_HOPOPTS = ... # type: int
IPV6_JOIN_GROUP = ... # type: int
IPV6_LEAVE_GROUP = ... # type: int
IPV6_MULTICAST_HOPS = ... # type: int
IPV6_MULTICAST_IF = ... # type: int
IPV6_MULTICAST_LOOP = ... # type: int
IPV6_NEXTHOP = ... # type: int
IPV6_PKTINFO = ... # type: int
IPV6_RECVDSTOPTS = ... # type: int
IPV6_RECVHOPLIMIT = ... # type: int
IPV6_RECVHOPOPTS = ... # type: int
IPV6_RECVPKTINFO = ... # type: int
IPV6_RECVRTHDR = ... # type: int
IPV6_RECVTCLASS = ... # type: int
IPV6_RTHDR = ... # type: int
IPV6_RTHDRDSTOPTS = ... # type: int
IPV6_RTHDR_TYPE_0 = ... # type: int
IPV6_TCLASS = ... # type: int
IPV6_UNICAST_HOPS = ... # type: int
IPV6_V6ONLY = ... # type: int
IP_ADD_MEMBERSHIP = ... # type: int
IP_DEFAULT_MULTICAST_LOOP = ... # type: int
IP_DEFAULT_MULTICAST_TTL = ... # type: int
IP_DROP_MEMBERSHIP = ... # type: int
IP_HDRINCL = ... # type: int
IP_MAX_MEMBERSHIPS = ... # type: int
IP_MULTICAST_IF = ... # type: int
IP_MULTICAST_LOOP = ... # type: int
IP_MULTICAST_TTL = ... # type: int
IP_OPTIONS = ... # type: int
IP_RECVOPTS = ... # type: int
IP_RECVRETOPTS = ... # type: int
IP_RETOPTS = ... # type: int
IP_TOS = ... # type: int
IP_TTL = ... # type: int
MSG_CTRUNC = ... # type: int
MSG_DONTROUTE = ... # type: int
MSG_DONTWAIT = ... # type: int
MSG_EOR = ... # type: int
MSG_OOB = ... # type: int
MSG_PEEK = ... # type: int
MSG_TRUNC = ... # type: int
MSG_WAITALL = ... # type: int
MethodType = ... # type: type
NETLINK_DNRTMSG = ... # type: int
NETLINK_FIREWALL = ... # type: int
NETLINK_IP6_FW = ... # type: int
NETLINK_NFLOG = ... # type: int
NETLINK_ROUTE = ... # type: int
NETLINK_USERSOCK = ... # type: int
NETLINK_XFRM = ... # type: int
NI_DGRAM = ... # type: int
NI_MAXHOST = ... # type: int
NI_MAXSERV = ... # type: int
NI_NAMEREQD = ... # type: int
NI_NOFQDN = ... # type: int
NI_NUMERICHOST = ... # type: int
NI_NUMERICSERV = ... # type: int
PACKET_BROADCAST = ... # type: int
PACKET_FASTROUTE = ... # type: int
PACKET_HOST = ... # type: int
PACKET_LOOPBACK = ... # type: int
PACKET_MULTICAST = ... # type: int
PACKET_OTHERHOST = ... # type: int
PACKET_OUTGOING = ... # type: int
PF_PACKET = ... # type: int
SHUT_RD = ... # type: int
SHUT_RDWR = ... # type: int
SHUT_WR = ... # type: int
SOCK_DGRAM = ... # type: int
SOCK_RAW = ... # type: int
SOCK_RDM = ... # type: int
SOCK_SEQPACKET = ... # type: int
SOCK_STREAM = ... # type: int
SOL_HCI = ... # type: int
SOL_IP = ... # type: int
SOL_SOCKET = ... # type: int
SOL_TCP = ... # type: int
SOL_TIPC = ... # type: int
SOL_UDP = ... # type: int
SOMAXCONN = ... # type: int
SO_ACCEPTCONN = ... # type: int
SO_BROADCAST = ... # type: int
SO_DEBUG = ... # type: int
SO_DONTROUTE = ... # type: int
SO_ERROR = ... # type: int
SO_KEEPALIVE = ... # type: int
SO_LINGER = ... # type: int
SO_OOBINLINE = ... # type: int
SO_RCVBUF = ... # type: int
SO_RCVLOWAT = ... # type: int
SO_RCVTIMEO = ... # type: int
SO_REUSEADDR = ... # type: int
SO_REUSEPORT = ... # type: int
SO_SNDBUF = ... # type: int
SO_SNDLOWAT = ... # type: int
SO_SNDTIMEO = ... # type: int
SO_TYPE = ... # type: int
SSL_ERROR_EOF = ... # type: int
SSL_ERROR_INVALID_ERROR_CODE = ... # type: int
SSL_ERROR_SSL = ... # type: int
SSL_ERROR_SYSCALL = ... # type: int
SSL_ERROR_WANT_CONNECT = ... # type: int
SSL_ERROR_WANT_READ = ... # type: int
SSL_ERROR_WANT_WRITE = ... # type: int
SSL_ERROR_WANT_X509_LOOKUP = ... # type: int
SSL_ERROR_ZERO_RETURN = ... # type: int
TCP_CORK = ... # type: int
TCP_DEFER_ACCEPT = ... # type: int
TCP_INFO = ... # type: int
TCP_KEEPCNT = ... # type: int
TCP_KEEPIDLE = ... # type: int
TCP_KEEPINTVL = ... # type: int
TCP_LINGER2 = ... # type: int
TCP_MAXSEG = ... # type: int
TCP_NODELAY = ... # type: int
TCP_QUICKACK = ... # type: int
TCP_SYNCNT = ... # type: int
TCP_WINDOW_CLAMP = ... # type: int
TIPC_ADDR_ID = ... # type: int
TIPC_ADDR_NAME = ... # type: int
TIPC_ADDR_NAMESEQ = ... # type: int
TIPC_CFG_SRV = ... # type: int
TIPC_CLUSTER_SCOPE = ... # type: int
TIPC_CONN_TIMEOUT = ... # type: int
TIPC_CRITICAL_IMPORTANCE = ... # type: int
TIPC_DEST_DROPPABLE = ... # type: int
TIPC_HIGH_IMPORTANCE = ... # type: int
TIPC_IMPORTANCE = ... # type: int
TIPC_LOW_IMPORTANCE = ... # type: int
TIPC_MEDIUM_IMPORTANCE = ... # type: int
TIPC_NODE_SCOPE = ... # type: int
TIPC_PUBLISHED = ... # type: int
TIPC_SRC_DROPPABLE = ... # type: int
TIPC_SUBSCR_TIMEOUT = ... # type: int
TIPC_SUB_CANCEL = ... # type: int
TIPC_SUB_PORTS = ... # type: int
TIPC_SUB_SERVICE = ... # type: int
TIPC_TOP_SRV = ... # type: int
TIPC_WAIT_FOREVER = ... # type: int
TIPC_WITHDRAWN = ... # type: int
TIPC_ZONE_SCOPE = ... # type: int
# PyCapsule
CAPI = ... # type: Any
has_ipv6 = ... # type: bool
class error(IOError): ...
class gaierror(error): ...
class timeout(error): ...
class SocketType(object):
family = ... # type: int
type = ... # type: int
proto = ... # type: int
timeout = ... # type: float
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
def accept(self) -> Tuple[SocketType, tuple]: ...
def bind(self, address: tuple) -> None: ...
def close(self) -> None: ...
def connect(self, address: tuple) -> None:
raise gaierror
raise timeout
def connect_ex(self, address: tuple) -> int: ...
def dup(self) -> SocketType: ...
def fileno(self) -> int: ...
def getpeername(self) -> tuple: ...
def getsockname(self) -> tuple: ...
def getsockopt(self, level: int, option: int, buffersize: int = ...) -> str: ...
def gettimeout(self) -> float: ...
def listen(self, backlog: int) -> None:
raise error
def makefile(self, mode: str = ..., buffersize: int = ...) -> IO[Any]: ...
def recv(self, buffersize: int, flags: int = ...) -> str: ...
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 send(self, data: str, flags: int = ...) -> int: ...
def sendall(self, data: str, flags: int = ...) -> None: ...
@overload
def sendto(self, data: str, address: tuple) -> int: ...
@overload
def sendto(self, data: str, flags: int, address: tuple) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def setsockopt(self, level: int, option: int, value: Union[int, str]) -> None: ...
def settimeout(self, value: Optional[float]) -> None: ...
def shutdown(self, flag: int) -> None: ...

Просмотреть файл

@ -0,0 +1,53 @@
"""Stub file for the '_sre' module."""
from typing import Any, Union, Iterable, Optional, Mapping, Sequence, Dict, List, Tuple, overload
CODESIZE = ... # type: int
MAGIC = ... # type: int
MAXREPEAT = ... # type: long
copyright = ... # type: str
class SRE_Match(object):
def start(self, group: int = ...) -> int:
raise IndexError()
def end(self, group: int = ...) -> int:
raise IndexError()
def expand(self, s: str) -> Any: ...
@overload
def group(self) -> str: ...
@overload
def group(self, group: int = ...) -> Optional[str]: ...
def groupdict(self) -> Dict[int, Optional[str]]: ...
def groups(self) -> Tuple[Optional[str], ...]: ...
def span(self) -> Tuple[int, int]:
raise IndexError()
class SRE_Scanner(object):
pattern = ... # type: str
def match(self) -> SRE_Match: ...
def search(self) -> SRE_Match: ...
class SRE_Pattern(object):
pattern = ... # type: str
flags = ... # type: int
groups = ... # type: int
groupindex = ... # type: Mapping[str, int]
indexgroup = ... # type: Sequence[int]
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[tuple, str]]: ...
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[tuple, str]]: ...
def match(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
def scanner(self, s: str, start: int = ..., end: int = ...) -> SRE_Scanner: ...
def search(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
def split(self, source: str, maxsplit: int = ...) -> List[Optional[str]]: ...
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:
raise OverflowError()
def getcodesize() -> int: ...
def getlower(a: int, b: int) -> int: ...

Просмотреть файл

@ -0,0 +1,22 @@
"""Stub file for the '_struct' module."""
from typing import Any, AnyStr, Tuple
class error(Exception): ...
class Struct(object):
size = ... # type: int
format = ... # type: str
def __init__(self, fmt: str) -> None: ...
def pack_into(self, buffer: bytearray, offset: int, obj: Any) -> None: ...
def pack(self, *args) -> str: ...
def unpack(self, s: str) -> Tuple[Any, ...]: ...
def unpack_from(self, buffer: bytearray, offset: int = ...) -> Tuple[Any, ...]: ...
def _clearcache() -> None: ...
def calcsize(fmt: str) -> int: ...
def pack(fmt: AnyStr, obj: Any) -> str: ...
def pack_into(fmt: AnyStr, buffer: bytearray, offset: int, obj: Any) -> None: ...
def unpack(fmt: AnyStr, data: str) -> Tuple[Any, ...]: ...
def unpack_from(fmt: AnyStr, buffer: bytearray, offset: int = ...) -> Tuple[Any, ...]: ...

Просмотреть файл

@ -0,0 +1,39 @@
from typing import List, Dict
CELL = ... # type: int
DEF_BOUND = ... # type: int
DEF_FREE = ... # type: int
DEF_FREE_CLASS = ... # type: int
DEF_GLOBAL = ... # type: int
DEF_IMPORT = ... # type: int
DEF_LOCAL = ... # type: int
DEF_PARAM = ... # type: int
FREE = ... # type: int
GLOBAL_EXPLICIT = ... # type: int
GLOBAL_IMPLICIT = ... # type: int
LOCAL = ... # type: int
OPT_BARE_EXEC = ... # type: int
OPT_EXEC = ... # type: int
OPT_IMPORT_STAR = ... # type: int
SCOPE_MASK = ... # type: int
SCOPE_OFF = ... # type: int
TYPE_CLASS = ... # type: int
TYPE_FUNCTION = ... # type: int
TYPE_MODULE = ... # type: int
USE = ... # type: int
class _symtable_entry(object):
...
class symtable(object):
children = ... # type: List[_symtable_entry]
id = ... # type: int
lineno = ... # type: int
name = ... # type: str
nested = ... # type: int
optimized = ... # type: int
symbols = ... # type: Dict[str, int]
type = ... # type: int
varnames = ... # type: List[str]
def __init__(self, src: str, filename: str, startstr: str) -> None: ...

Просмотреть файл

@ -0,0 +1,14 @@
# Source: https://hg.python.org/cpython/file/2.7/Lib/_threading_local.py
from typing import Any, List
__all__: List[str]
class _localbase(object): ...
class local(_localbase):
def __getattribute__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __delattr__(self, name: str) -> None: ...
def __del__(self) -> None: ...
def _patch(self: local) -> None: ...

Просмотреть файл

@ -0,0 +1,11 @@
from typing import Any, List, Optional, Type
default_action = ... # type: str
filters = ... # type: List[tuple]
once_registry = ... # type: 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: ...

Просмотреть файл

@ -0,0 +1,29 @@
from typing import Any, Dict, Set, Tuple, Type
import _weakrefset
# NOTE: mypy has special processing for ABCMeta and abstractmethod.
def abstractmethod(funcobj: Any) -> Any: ...
class ABCMeta(type):
# TODO: FrozenSet
__abstractmethods__ = ... # type: Set[Any]
_abc_cache = ... # type: _weakrefset.WeakSet
_abc_invalidation_counter = ... # type: int
_abc_negative_cache = ... # type: _weakrefset.WeakSet
_abc_negative_cache_version = ... # type: int
_abc_registry = ... # type: _weakrefset.WeakSet
def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[Any, Any]) -> None: ...
def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ...
def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ...
def _dump_registry(cls: ABCMeta, *args: Any, **kwargs: Any) -> None: ...
def register(cls: ABCMeta, subclass: Type[Any]) -> None: ...
# TODO: The real abc.abstractproperty inherits from "property".
class abstractproperty(object):
def __new__(cls, func: Any) -> Any: ...
__isabstractmethod__ = ... # type: bool
doc = ... # type: Any
fdel = ... # type: Any
fget = ... # type: Any
fset = ... # type: Any

Просмотреть файл

@ -0,0 +1,32 @@
# Python 2.7 ast
# 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.
import typing as _typing
from typing import Any, Iterator, Optional, Union
from _ast import *
from _ast import AST, Module
__version__ = ... # type: str
PyCF_ONLY_AST = ... # type: int
def parse(source: Union[str, unicode], filename: Union[str, unicode] = ..., mode: Union[str, unicode] = ...) -> Module: ...
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: ...
def get_docstring(node: AST, clean: bool = ...) -> str: ...
def increment_lineno(node: AST, n: int = ...) -> AST: ...
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
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():
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> Any: ...
class NodeTransformer(NodeVisitor):
def generic_visit(self, node: AST) -> Optional[AST]: ...

Просмотреть файл

@ -0,0 +1,5 @@
from typing import TypeVar, Any
_FT = TypeVar('_FT')
def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ...

Просмотреть файл

@ -0,0 +1,32 @@
from typing import Any, IO, List
HIGHEST_PROTOCOL = ... # type: int
compatible_formats = ... # type: List[str]
format_version = ... # type: 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: ...
def loads(str: str) -> Any: ...
class PickleError(Exception): ...
class UnpicklingError(PickleError): ...
class BadPickleGet(UnpicklingError): ...
class PicklingError(PickleError): ...
class UnpickleableError(PicklingError): ...

Просмотреть файл

@ -0,0 +1,54 @@
# Stubs for cStringIO (Python 2.7)
# 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
# TODO the typing.IO[] generics should be split into input and output.
# This class isn't actually abstract, but you can't instantiate it
# directly, so we might as well treat it as abstract in the stub.
class InputType(IO[str], Iterator[str], metaclass=ABCMeta):
def getvalue(self) -> str: ...
def close(self) -> None: ...
@property
def closed(self) -> bool: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, size: int = ...) -> str: ...
def readline(self, size: int = ...) -> str: ...
def readlines(self, hint: int = ...) -> List[str]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def __iter__(self) -> InputType: ...
def next(self) -> str: ...
def reset(self) -> None: ...
class OutputType(IO[str], Iterator[str], metaclass=ABCMeta):
@property
def softspace(self) -> int: ...
def getvalue(self) -> str: ...
def close(self) -> None: ...
@property
def closed(self) -> bool: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, size: int = ...) -> str: ...
def readline(self, size: int = ...) -> str: ...
def readlines(self, hint: int = ...) -> List[str]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def __iter__(self) -> OutputType: ...
def next(self) -> str: ...
def reset(self) -> None: ...
def write(self, b: Union[str, unicode]) -> int: ...
def writelines(self, lines: Iterable[Union[str, unicode]]) -> None: ...
@overload
def StringIO() -> OutputType: ...
@overload
def StringIO(s: str) -> InputType: ...

Просмотреть файл

@ -0,0 +1,126 @@
# 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,
)
_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]: ...
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...,
maxlen: int = ...) -> None: ...
@property
def maxlen(self) -> Optional[int]: ...
def append(self, x: _T) -> None: ...
def appendleft(self, x: _T) -> None: ...
def clear(self) -> None: ...
def count(self, x: _T) -> int: ...
def extend(self, iterable: Iterable[_T]) -> None: ...
def extendleft(self, iterable: Iterable[_T]) -> None: ...
def pop(self) -> _T: ...
def popleft(self) -> _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: ...
def __getitem__(self, i: int) -> _T: ...
def __setitem__(self, i: int, x: _T) -> None: ...
def __contains__(self, o: _T) -> bool: ...
def __reversed__(self) -> Iterator[_T]: ...
def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ...
_CounterT = TypeVar('_CounterT', bound=Counter)
class Counter(Dict[_T, int], Generic[_T]):
@overload
def __init__(self, **kwargs: int) -> None: ...
@overload
def __init__(self, mapping: Mapping[_T, int]) -> None: ...
@overload
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
# Dict.update. Not sure if we should use '# type: ignore' instead
# and omit the type from the union.
@overload
def update(self, __m: Mapping[_T, int], **kwargs: int) -> None: ...
@overload
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]: ...
def __or__(self, other: Counter[_T]) -> Counter[_T]: ...
def __iadd__(self, other: Counter[_T]) -> Counter[_T]: ...
def __isub__(self, other: Counter[_T]) -> Counter[_T]: ...
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
_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)
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
default_factory = ... # type: Callable[[], _VT]
@overload
def __init__(self, **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]]) -> None: ...
@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: ...
@overload
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: ...
@overload
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: ...

Просмотреть файл

@ -0,0 +1,12 @@
from typing import overload, AnyStr, Text, Tuple
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: ...

Просмотреть файл

@ -0,0 +1,10 @@
# Stubs for compileall (Python 2)
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_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...

Просмотреть файл

@ -0,0 +1,110 @@
from typing import Any, Optional
class Cookie:
version = ... # type: Any
name = ... # type: Any
value = ... # type: Any
port = ... # type: Any
port_specified = ... # type: Any
domain = ... # type: Any
domain_specified = ... # type: Any
domain_initial_dot = ... # type: Any
path = ... # type: Any
path_specified = ... # type: Any
secure = ... # type: Any
expires = ... # type: Any
discard = ... # type: Any
comment = ... # type: Any
comment_url = ... # type: Any
rfc2109 = ... # type: 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 has_nonstandard_attr(self, name): ...
def get_nonstandard_attr(self, name, default: Optional[Any] = ...): ...
def set_nonstandard_attr(self, name, value): ...
def is_expired(self, now: Optional[Any] = ...): ...
class CookiePolicy:
def set_ok(self, cookie, request): ...
def return_ok(self, cookie, request): ...
def domain_return_ok(self, domain, request): ...
def path_return_ok(self, path, request): ...
class DefaultCookiePolicy(CookiePolicy):
DomainStrictNoDots = ... # type: Any
DomainStrictNonDomain = ... # type: Any
DomainRFC2965Match = ... # type: Any
DomainLiberal = ... # type: Any
DomainStrict = ... # type: Any
netscape = ... # type: Any
rfc2965 = ... # type: Any
rfc2109_as_netscape = ... # type: Any
hide_cookie2 = ... # type: Any
strict_domain = ... # type: Any
strict_rfc2965_unverifiable = ... # type: Any
strict_ns_unverifiable = ... # type: Any
strict_ns_domain = ... # type: Any
strict_ns_set_initial_dollar = ... # type: Any
strict_ns_set_path = ... # type: 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 blocked_domains(self): ...
def set_blocked_domains(self, blocked_domains): ...
def is_blocked(self, domain): ...
def allowed_domains(self): ...
def set_allowed_domains(self, allowed_domains): ...
def is_not_allowed(self, domain): ...
def set_ok(self, cookie, request): ...
def set_ok_version(self, cookie, request): ...
def set_ok_verifiability(self, cookie, request): ...
def set_ok_name(self, cookie, request): ...
def set_ok_path(self, cookie, request): ...
def set_ok_domain(self, cookie, request): ...
def set_ok_port(self, cookie, request): ...
def return_ok(self, cookie, request): ...
def return_ok_version(self, cookie, request): ...
def return_ok_verifiability(self, cookie, request): ...
def return_ok_secure(self, cookie, request): ...
def return_ok_expires(self, cookie, request): ...
def return_ok_port(self, cookie, request): ...
def return_ok_domain(self, cookie, request): ...
def domain_return_ok(self, domain, request): ...
def path_return_ok(self, path, request): ...
class Absent: ...
class CookieJar:
non_word_re = ... # type: Any
quote_re = ... # type: Any
strict_domain_re = ... # type: Any
domain_re = ... # type: Any
dots_re = ... # type: Any
magic_re = ... # type: Any
def __init__(self, policy: Optional[Any] = ...): ...
def set_policy(self, policy): ...
def add_cookie_header(self, request): ...
def make_cookies(self, response, request): ...
def set_cookie_if_ok(self, cookie, request): ...
def set_cookie(self, cookie): ...
def extract_cookies(self, response, request): ...
def clear(self, domain: Optional[Any] = ..., path: Optional[Any] = ..., name: Optional[Any] = ...): ...
def clear_session_cookies(self): ...
def clear_expired_cookies(self): ...
def __iter__(self): ...
def __len__(self): ...
class LoadError(IOError): ...
class FileCookieJar(CookieJar):
filename = ... # type: Any
delayload = ... # type: Any
def __init__(self, filename: Optional[Any] = ..., delayload: bool = ..., policy: Optional[Any] = ...): ...
def save(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def load(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def revert(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
MozillaCookieJar = FileCookieJar
LWPCookieJar = FileCookieJar
def lwp_cookie_str(cookie: Cookie) -> str: ...

Просмотреть файл

@ -0,0 +1,10 @@
# Source: https://hg.python.org/cpython/file/2.7/Lib/dircache.py
from typing import List, MutableSequence, Text, Union
def reset() -> None: ...
def listdir(path: Text) -> List[str]: ...
opendir = listdir
def annotate(head: Text, list: Union[MutableSequence[str], MutableSequence[Text], MutableSequence[Union[str, Text]]]) -> None: ...

Просмотреть файл

Просмотреть файл

@ -0,0 +1,5 @@
# Stubs for emxccompiler
from distutils.unixccompiler import UnixCCompiler
class EMXCCompiler(UnixCCompiler): ...

Просмотреть файл

@ -0,0 +1,21 @@
from typing import Any, Callable, Dict, NoReturn, Optional, Tuple
class error(Exception):
def __init__(self, *args: Any) -> None: ...
def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> None: ...
def exit() -> NoReturn: ...
def get_ident() -> int: ...
def allocate_lock() -> LockType: ...
def stack_size(size: Optional[int] = ...) -> int: ...
class LockType(object):
locked_status: bool
def __init__(self) -> None: ...
def acquire(self, waitflag: Optional[bool] = ...) -> bool: ...
def __enter__(self, waitflag: Optional[bool] = ...) -> bool: ...
def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ...
def release(self) -> bool: ...
def locked(self) -> bool: ...
def interrupt_main() -> None: ...

Просмотреть файл

@ -0,0 +1,4 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEText(MIMENonMultipart):
def __init__(self, _text, _subtype=..., _charset=...) -> None: ...

Просмотреть файл

@ -0,0 +1,6 @@
from typing import IO, Any, AnyStr
def message_from_string(s: AnyStr, *args, **kwargs): ...
def message_from_bytes(s: str, *args, **kwargs): ...
def message_from_file(fp: IO[AnyStr], *args, **kwargs): ...
def message_from_binary_file(fp: IO[str], *args, **kwargs): ...

Просмотреть файл

@ -0,0 +1,40 @@
from typing import Any, Optional
def parsedate_tz(data): ...
def parsedate(data): ...
def mktime_tz(data): ...
def quote(str): ...
class AddrlistClass:
specials = ... # type: Any
pos = ... # type: Any
LWS = ... # type: Any
CR = ... # type: Any
FWS = ... # type: Any
atomends = ... # type: Any
phraseends = ... # type: Any
field = ... # type: Any
commentlist = ... # type: Any
def __init__(self, field): ...
def gotonext(self): ...
def getaddrlist(self): ...
def getaddress(self): ...
def getrouteaddr(self): ...
def getaddrspec(self): ...
def getdomain(self): ...
def getdelimited(self, beginchar, endchars, allowcomments: bool = ...): ...
def getquote(self): ...
def getcomment(self): ...
def getdomainliteral(self): ...
def getatom(self, atomends: Optional[Any] = ...): ...
def getphraselist(self): ...
class AddressList(AddrlistClass):
addresslist = ... # type: Any
def __init__(self, field): ...
def __len__(self): ...
def __add__(self, other): ...
def __iadd__(self, other): ...
def __sub__(self, other): ...
def __isub__(self, other): ...
def __getitem__(self, index): ...

Просмотреть файл

@ -0,0 +1,8 @@
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

Просмотреть файл

@ -0,0 +1,22 @@
def add_charset(charset, header_enc=..., body_enc=..., output_charset=...) -> None: ...
def add_alias(alias, canonical) -> None: ...
def add_codec(charset, codecname) -> None: ...
class Charset:
input_charset = ...
header_encoding = ...
body_encoding = ...
output_charset = ...
input_codec = ...
output_codec = ...
def __init__(self, input_charset=...) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def get_body_encoding(self): ...
def convert(self, s): ...
def to_splittable(self, s): ...
def from_splittable(self, ustr, to_output: bool = ...): ...
def get_output_charset(self): ...
def encoded_header_len(self, s): ...
def header_encode(self, s, convert: bool = ...): ...
def body_encode(self, s, convert: bool = ...): ...

Просмотреть файл

@ -0,0 +1,4 @@
def encode_base64(msg) -> None: ...
def encode_quopri(msg) -> None: ...
def encode_7or8bit(msg) -> None: ...
def encode_noop(msg) -> None: ...

Просмотреть файл

@ -0,0 +1,18 @@
class BufferedSubFile:
def __init__(self) -> None: ...
def push_eof_matcher(self, pred) -> None: ...
def pop_eof_matcher(self): ...
def close(self) -> None: ...
def readline(self): ...
def unreadline(self, line) -> None: ...
def push(self, data): ...
def pushlines(self, lines) -> None: ...
def is_closed(self): ...
def __iter__(self): ...
def next(self): ...
class FeedParser:
def __init__(self, _factory=...) -> None: ...
def feed(self, data) -> None: ...
def close(self): ...

Просмотреть файл

@ -0,0 +1,9 @@
class Generator:
def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ...) -> None: ...
def write(self, s) -> None: ...
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: ...

Просмотреть файл

@ -0,0 +1,11 @@
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 __unicode__(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def append(self, s, charset=..., errors=...) -> None: ...
def encode(self, splitchars=...): ...

Просмотреть файл

@ -0,0 +1,5 @@
from typing import Generator
def walk(self) -> Generator: ...
def body_line_iterator(msg, decode: bool = ...) -> Generator: ...
def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator: ...

Просмотреть файл

@ -0,0 +1,45 @@
from typing import Generator
class Message:
preamble = ...
epilogue = ...
defects = ...
def __init__(self): ...
def as_string(self, unixfrom=...): ...
def is_multipart(self) -> bool: ...
def set_unixfrom(self, unixfrom) -> None: ...
def get_unixfrom(self): ...
def attach(self, payload) -> None: ...
def get_payload(self, i=..., decode: bool = ...): ...
def set_payload(self, payload, charset=...) -> None: ...
def set_charset(self, charset): ...
def get_charset(self): ...
def __len__(self): ...
def __getitem__(self, name): ...
def __setitem__(self, name, val) -> None: ...
def __delitem__(self, name) -> None: ...
def __contains__(self, name): ...
def has_key(self, name) -> bool: ...
def keys(self): ...
def values(self): ...
def items(self): ...
def get(self, name, failobj=...): ...
def get_all(self, name, failobj=...): ...
def add_header(self, _name, _value, **_params) -> None: ...
def replace_header(self, _name, _value) -> None: ...
def get_content_type(self): ...
def get_content_maintype(self): ...
def get_content_subtype(self): ...
def get_default_type(self): ...
def set_default_type(self, ctype) -> None: ...
def get_params(self, failobj=..., header=..., unquote: bool = ...): ...
def get_param(self, param, failobj=..., header=..., unquote: bool = ...): ...
def set_param(self, param, value, header=..., requote: bool = ..., charset=..., language=...) -> None: ...
def del_param(self, param, header=..., requote: bool = ...): ...
def set_type(self, type, header=..., requote: bool = ...): ...
def get_filename(self, failobj=...): ...
def get_boundary(self, failobj=...): ...
def set_boundary(self, boundary) -> None: ...
def get_content_charset(self, failobj=...): ...
def get_charsets(self, failobj=...): ...
def walk(self) -> Generator: ...

Просмотреть файл

Просмотреть файл

@ -0,0 +1,11 @@
# Stubs for email.mime.application
from typing import Callable, Optional, Tuple, Union
from email.mime.nonmultipart import MIMENonMultipart
_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: ...

Просмотреть файл

@ -0,0 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEAudio(MIMENonMultipart):
def __init__(self, _audiodata, _subtype=..., _encoder=..., **_params) -> None: ...

Просмотреть файл

@ -0,0 +1,4 @@
from email import message
class MIMEBase(message.Message):
def __init__(self, _maintype, _subtype, **_params) -> None: ...

Просмотреть файл

@ -0,0 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEImage(MIMENonMultipart):
def __init__(self, _imagedata, _subtype=..., _encoder=..., **_params) -> None: ...

Просмотреть файл

@ -0,0 +1,5 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEMessage(MIMENonMultipart):
def __init__(self, _msg, _subtype=...) -> None: ...

Просмотреть файл

@ -0,0 +1,4 @@
from email.mime.base import MIMEBase
class MIMEMultipart(MIMEBase):
def __init__(self, _subtype=..., boundary=..., _subparts=..., **_params) -> None: ...

Просмотреть файл

@ -0,0 +1,4 @@
from email.mime.base import MIMEBase
class MIMENonMultipart(MIMEBase):
def attach(self, payload): ...

Просмотреть файл

@ -0,0 +1,4 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEText(MIMENonMultipart):
def __init__(self, _text, _subtype=..., _charset=...) -> None: ...

Просмотреть файл

@ -0,0 +1,10 @@
from .feedparser import FeedParser as FeedParser # not in __all__ but listed in documentation
class Parser:
def __init__(self, *args, **kws) -> None: ...
def parse(self, fp, headersonly: bool = ...): ...
def parsestr(self, text, headersonly: bool = ...): ...
class HeaderParser(Parser):
def parse(self, fp, headersonly: bool = ...): ...
def parsestr(self, text, headersonly: bool = ...): ...

Просмотреть файл

@ -0,0 +1,18 @@
def header_quopri_check(c): ...
def body_quopri_check(c): ...
def header_quopri_len(s): ...
def body_quopri_len(str): ...
def unquote(s): ...
def quote(c): ...
def header_encode(header, charset: str = ..., keep_eols: bool = ..., maxlinelen: int = ..., eol=...): ...
def encode(body, binary: bool = ..., maxlinelen: int = ..., eol=...): ...
body_encode = encode
encodestring = encode
def decode(encoded, eol=...): ...
body_decode = decode
decodestring = decode
def header_decode(s): ...

Просмотреть файл

@ -0,0 +1,19 @@
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 quopri import decodestring as _qdecode
from typing import Optional, Any
def formataddr(pair): ...
def getaddresses(fieldvalues): ...
def formatdate(timeval: Optional[Any] = ..., localtime: bool = ..., usegmt: bool = ...): ...
def make_msgid(idstring: Optional[Any] = ...): ...
def parsedate(data): ...
def parsedate_tz(data): ...
def parseaddr(addr): ...
def unquote(str): ...
def decode_rfc2231(s): ...
def encode_rfc2231(s, charset: Optional[Any] = ..., language: Optional[Any] = ...): ...
def decode_params(params): ...
def collapse_rfc2231_value(value, errors=..., fallback_charset=...): ...

Просмотреть файл

@ -0,0 +1,6 @@
import codecs
import typing
def search_function(encoding: str) -> codecs.CodecInfo:
...

Просмотреть файл

@ -0,0 +1,15 @@
import codecs
from typing import Text, Tuple
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input: Text, final: bool = ...) -> bytes: ...
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[Text, int]: ...
class StreamWriter(codecs.StreamWriter): ...
class StreamReader(codecs.StreamReader): ...
def getregentry() -> codecs.CodecInfo: ...
def encode(input: Text, errors: Text = ...) -> bytes: ...
def decode(input: bytes, errors: Text = ...) -> Text: ...

Просмотреть файл

@ -0,0 +1,48 @@
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 EOFError as EOFError
from __builtin__ import EnvironmentError as EnvironmentError
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 KeyboardInterrupt as KeyboardInterrupt
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 UnicodeError as UnicodeError
from __builtin__ import UnicodeDecodeError as UnicodeDecodeError
from __builtin__ import UnicodeEncodeError as UnicodeEncodeError
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

Просмотреть файл

@ -0,0 +1,87 @@
from typing import Any, Union, IO
import io
FASYNC = ... # type: int
FD_CLOEXEC = ... # type: int
DN_ACCESS = ... # type: int
DN_ATTRIB = ... # type: int
DN_CREATE = ... # type: int
DN_DELETE = ... # type: int
DN_MODIFY = ... # type: int
DN_MULTISHOT = ... # type: int
DN_RENAME = ... # type: int
F_DUPFD = ... # type: int
F_EXLCK = ... # type: int
F_GETFD = ... # type: int
F_GETFL = ... # type: int
F_GETLEASE = ... # type: int
F_GETLK = ... # type: int
F_GETLK64 = ... # type: int
F_GETOWN = ... # type: int
F_GETSIG = ... # type: int
F_NOTIFY = ... # type: int
F_RDLCK = ... # type: int
F_SETFD = ... # type: int
F_SETFL = ... # type: int
F_SETLEASE = ... # type: int
F_SETLK = ... # type: int
F_SETLK64 = ... # type: int
F_SETLKW = ... # type: int
F_SETLKW64 = ... # type: int
F_SETOWN = ... # type: int
F_SETSIG = ... # type: int
F_SHLCK = ... # type: int
F_UNLCK = ... # type: int
F_WRLCK = ... # type: int
I_ATMARK = ... # type: int
I_CANPUT = ... # type: int
I_CKBAND = ... # type: int
I_FDINSERT = ... # type: int
I_FIND = ... # type: int
I_FLUSH = ... # type: int
I_FLUSHBAND = ... # type: int
I_GETBAND = ... # type: int
I_GETCLTIME = ... # type: int
I_GETSIG = ... # type: int
I_GRDOPT = ... # type: int
I_GWROPT = ... # type: int
I_LINK = ... # type: int
I_LIST = ... # type: int
I_LOOK = ... # type: int
I_NREAD = ... # type: int
I_PEEK = ... # type: int
I_PLINK = ... # type: int
I_POP = ... # type: int
I_PUNLINK = ... # type: int
I_PUSH = ... # type: int
I_RECVFD = ... # type: int
I_SENDFD = ... # type: int
I_SETCLTIME = ... # type: int
I_SETSIG = ... # type: int
I_SRDOPT = ... # type: int
I_STR = ... # type: int
I_SWROPT = ... # type: int
I_UNLINK = ... # type: int
LOCK_EX = ... # type: int
LOCK_MAND = ... # type: int
LOCK_NB = ... # type: int
LOCK_READ = ... # type: int
LOCK_RW = ... # type: int
LOCK_SH = ... # type: int
LOCK_UN = ... # type: int
LOCK_WRITE = ... # type: int
_ANYFILE = Union[int, IO]
# TODO All these return either int or bytes depending on the value of
# cmd (not on the type of arg).
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 flock(fd: _ANYFILE, op: int) -> None: ...
def lockf(fd: _ANYFILE, op: int, length: int = ..., start: int = ...,
whence: int = ...) -> Any: ...

Просмотреть файл

@ -0,0 +1,8 @@
from typing import AnyStr, Iterable, List, Union
_EitherStr = Union[str, unicode]
def fnmatch(filename: _EitherStr, pattern: _EitherStr) -> bool: ...
def fnmatchcase(filename: _EitherStr, pattern: _EitherStr) -> bool: ...
def filter(names: Iterable[AnyStr], pattern: _EitherStr) -> List[AnyStr]: ...
def translate(pattern: AnyStr) -> AnyStr: ...

Просмотреть файл

@ -0,0 +1,34 @@
# Stubs for functools (Python 2.7)
# 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
_AnyCallable = Callable[..., Any]
_T = TypeVar("_T")
_S = TypeVar("_S")
@overload
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: ...
WRAPPER_ASSIGNMENTS = ... # type: Sequence[str]
WRAPPER_UPDATES = ... # type: 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 total_ordering(cls: type) -> type: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
class partial(Generic[_T]):
func = ... # Callable[..., _T]
args = ... # type: Tuple[Any, ...]
keywords = ... # type: Dict[str, Any]
def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...

Просмотреть файл

@ -0,0 +1,14 @@
from typing import Any
from itertools import ifilter as filter
from itertools import imap as map
from itertools import izip as zip
def ascii(obj: Any) -> str: ...
def hex(x: int) -> str: ...
def oct(x: int) -> str: ...

Просмотреть файл

@ -0,0 +1,29 @@
# Stubs for gc
from typing import Any, List, Tuple
def enable() -> None: ...
def disable() -> None: ...
def isenabled() -> bool: ...
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 get_count() -> Tuple[int, int, int]: ...
def get_threshold() -> Tuple[int, int, int]: ...
def get_referrers(*objs: Any) -> List[Any]: ...
def get_referents(*objs: Any) -> List[Any]: ...
def is_tracked(obj: Any) -> bool: ...
garbage = ... # type: List[Any]
DEBUG_STATS = ... # type: int
DEBUG_COLLECTABLE = ... # type: int
DEBUG_UNCOLLECTABLE = ... # type: int
DEBUG_INSTANCES = ... # type: int
DEBUG_OBJECTS = ... # type: int
DEBUG_SAVEALL = ... # type: int
DEBUG_LEAK = ... # type: int

Просмотреть файл

@ -0,0 +1,12 @@
from typing import List, Tuple
class GetoptError(Exception):
opt = ... # type: str
msg = ... # type: str
def __init__(self, msg: str, opt: str = ...) -> None: ...
def __str__(self) -> str: ...
error = GetoptError
def getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ...
def gnu_getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ...

Просмотреть файл

@ -0,0 +1,8 @@
# Stubs for getpass (Python 2)
from typing import Any, IO
class GetPassWarning(UserWarning): ...
def getpass(prompt: str = ..., stream: IO[Any] = ...) -> str: ...
def getuser() -> str: ...

Просмотреть файл

@ -0,0 +1,41 @@
from typing import Any, Container, Dict, IO, List, Optional, Sequence, Type, Union
def bindtextdomain(domain: str, localedir: str = ...) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str = ...) -> str: ...
def textdomain(domain: str = ...) -> str: ...
def gettext(message: str) -> str: ...
def lgettext(message: str) -> str: ...
def dgettext(domain: str, message: str) -> str: ...
def ldgettext(domain: str, message: str) -> str: ...
def ngettext(singular: str, plural: str, n: int) -> str: ...
def lngettext(singular: str, plural: str, n: int) -> str: ...
def dngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
def ldngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
class NullTranslations(object):
def __init__(self, fp: IO[str] = ...) -> None: ...
def _parse(self, fp: IO[str]) -> None: ...
def add_fallback(self, fallback: NullTranslations) -> None: ...
def gettext(self, message: str) -> str: ...
def lgettext(self, message: str) -> str: ...
def ugettext(self, message: Union[str, unicode]) -> unicode: ...
def ngettext(self, singular: str, plural: str, n: int) -> str: ...
def lngettext(self, singular: str, plural: str, n: int) -> str: ...
def ungettext(self, singular: Union[str, unicode], plural: Union[str, unicode], n: int) -> unicode: ...
def info(self) -> Dict[str, str]: ...
def charset(self) -> Optional[str]: ...
def output_charset(self) -> Optional[str]: ...
def set_output_charset(self, charset: Optional[str]) -> None: ...
def install(self, unicode: bool = ..., names: Container[str] = ...) -> None: ...
class GNUTranslations(NullTranslations):
LE_MAGIC = ... # type: int
BE_MAGIC = ... # type: 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: ...

Просмотреть файл

@ -0,0 +1,6 @@
from typing import List, Iterator, Union, AnyStr
def glob(pathname: AnyStr) -> List[AnyStr]: ...
def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ...
def glob1(dirname: Union[str, unicode], pattern: AnyStr) -> List[AnyStr]: ...
def glob0(dirname: Union[str, unicode], basename: AnyStr) -> List[AnyStr]: ...

Просмотреть файл

@ -0,0 +1,37 @@
from typing import Any, IO, Text
import io
class GzipFile(io.BufferedIOBase):
myfileobj = ... # type: Any
max_read_chunk = ... # type: Any
mode = ... # type: Any
extrabuf = ... # type: Any
extrasize = ... # type: Any
extrastart = ... # type: Any
name = ... # type: Any
min_readsize = ... # type: Any
compress = ... # type: Any
fileobj = ... # type: Any
offset = ... # type: Any
mtime = ... # type: Any
def __init__(self, filename: str = ..., mode: Text = ..., compresslevel: int = ...,
fileobj: IO[str] = ..., mtime: float = ...) -> None: ...
@property
def filename(self): ...
size = ... # type: Any
crc = ... # type: Any
def write(self, data): ...
def read(self, size=...): ...
@property
def closed(self): ...
def close(self): ...
def flush(self, zlib_mode=...): ...
def fileno(self): ...
def rewind(self): ...
def readable(self): ...
def writable(self): ...
def seekable(self): ...
def seek(self, offset, whence=...): ...
def readline(self, size=...): ...
def open(filename: str, mode: Text = ..., compresslevel: int = ...) -> GzipFile: ...

Просмотреть файл

@ -0,0 +1,31 @@
# Stubs for hashlib (Python 2)
from typing import Tuple, Union
_DataType = Union[str, unicode, bytearray, buffer, memoryview]
class _hash(object): # This is not actually in the module namespace.
name = ... # type: str
block_size = 0
digest_size = 0
digestsize = 0
def __init__(self, arg: _DataType = ...) -> None: ...
def update(self, arg: _DataType) -> None: ...
def digest(self) -> str: ...
def hexdigest(self) -> str: ...
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: ...
def sha256(s: _DataType = ...) -> _hash: ...
def sha384(s: _DataType = ...) -> _hash: ...
def sha512(s: _DataType = ...) -> _hash: ...
algorithms = ... # type: Tuple[str, ...]
algorithms_guaranteed = ... # type: Tuple[str, ...]
algorithms_available = ... # type: Tuple[str, ...]
def pbkdf2_hmac(name: str, password: str, salt: str, rounds: int, dklen: int = ...) -> str: ...

Просмотреть файл

@ -0,0 +1,16 @@
from typing import TypeVar, List, Iterable, Any, Callable, Optional
_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 nsmallest(n: int, iterable: Iterable[_T]) -> List[_T]: ...

Просмотреть файл

@ -0,0 +1,5 @@
from typing import Any, Mapping
name2codepoint = ... # type: Mapping[str, int]
codepoint2name = ... # type: Mapping[int, str]
entitydefs = ... # type: Mapping[str, str]

Просмотреть файл

@ -0,0 +1,205 @@
# Stubs for httplib (Python 2)
#
# Generated by stubgen and manually massaged a bit.
# Needs lots more work!
from typing import Any, Dict, Optional, Protocol
import mimetools
import ssl
class HTTPMessage(mimetools.Message):
def addcontinue(self, key: str, more: str) -> None: ...
dict = ... # type: Dict[str, str]
def addheader(self, key: str, value: str) -> None: ...
unixfrom = ... # type: str
headers = ... # type: Any
status = ... # type: str
seekable = ... # type: bool
def readheaders(self) -> None: ...
class HTTPResponse:
fp = ... # type: Any
debuglevel = ... # type: Any
strict = ... # type: Any
msg = ... # type: Any
version = ... # type: Any
status = ... # type: Any
reason = ... # type: Any
chunked = ... # type: Any
chunk_left = ... # type: Any
length = ... # type: Any
will_close = ... # type: Any
def __init__(self, sock, debuglevel: int = ..., strict: int = ..., method: Optional[Any] = ...,
buffering: bool = ...) -> None: ...
def begin(self): ...
def close(self): ...
def isclosed(self): ...
def read(self, amt: Optional[Any] = ...): ...
def fileno(self): ...
def getheader(self, name, default: Optional[Any] = ...): ...
def getheaders(self): ...
# This is an API stub only for HTTPConnection and HTTPSConnection, as used in
# urllib2.AbstractHTTPHandler.do_open, which takes either the class
# HTTPConnection or the class HTTPSConnection, *not* an instance of either
# class. do_open does not use all of the parameters of HTTPConnection.__init__
# or HTTPSConnection.__init__, so HTTPConnectionProtocol only implements the
# parameters that do_open does use.
class HTTPConnectionProtocol(Protocol):
def __call__(self, host: str, timeout: int = ..., **http_con_args: Any) -> HTTPConnection: ...
class HTTPConnection:
response_class = ... # type: Any
default_port = ... # type: Any
auto_open = ... # type: Any
debuglevel = ... # type: Any
strict = ... # type: Any
timeout = ... # type: Any
source_address = ... # type: Any
sock = ... # type: Any
host: str = ...
port: int = ...
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): ...
def close(self): ...
def send(self, data): ...
def putrequest(self, method, url, skip_host: int = ..., skip_accept_encoding: int = ...): ...
def putheader(self, header, *values): ...
def endheaders(self, message_body: Optional[Any] = ...): ...
def request(self, method, url, body: Optional[Any] = ..., headers=...): ...
def getresponse(self, buffering: bool = ...): ...
class HTTP:
debuglevel = ... # type: Any
def __init__(self, host: str = ..., port: Optional[Any] = ..., strict: Optional[Any] = ...) -> None: ...
def connect(self, host: Optional[Any] = ..., port: Optional[Any] = ...): ...
def getfile(self): ...
file = ... # type: Any
headers = ... # type: Any
def getreply(self, buffering: bool = ...): ...
def close(self): ...
class HTTPSConnection(HTTPConnection):
default_port = ... # type: Any
key_file = ... # type: Any
cert_file = ... # type: 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: ...
sock = ... # type: Any
def connect(self): ...
class HTTPS(HTTP):
key_file = ... # type: Any
cert_file = ... # type: Any
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): ...
class InvalidURL(HTTPException): ...
class UnknownProtocol(HTTPException):
args = ... # type: Any
version = ... # type: Any
def __init__(self, version) -> None: ...
class UnknownTransferEncoding(HTTPException): ...
class UnimplementedFileMode(HTTPException): ...
class IncompleteRead(HTTPException):
args = ... # type: Any
partial = ... # type: Any
expected = ... # type: Any
def __init__(self, partial, expected: Optional[Any] = ...) -> None: ...
class ImproperConnectionState(HTTPException): ...
class CannotSendRequest(ImproperConnectionState): ...
class CannotSendHeader(ImproperConnectionState): ...
class ResponseNotReady(ImproperConnectionState): ...
class BadStatusLine(HTTPException):
args = ... # type: Any
line = ... # type: Any
def __init__(self, line) -> None: ...
class LineTooLong(HTTPException):
def __init__(self, line_type) -> None: ...
error = ... # type: Any
class LineAndFileWrapper:
def __init__(self, line, file) -> None: ...
def __getattr__(self, attr): ...
def read(self, amt: Optional[Any] = ...): ...
def readline(self): ...
def readlines(self, size: Optional[Any] = ...): ...
# Constants
responses = ... # type: Dict[int, str]
HTTP_PORT = ... # type: int
HTTPS_PORT = ... # type: int
# status codes
# informational
CONTINUE = ... # type: int
SWITCHING_PROTOCOLS = ... # type: int
PROCESSING = ... # type: int
# successful
OK = ... # type: int
CREATED = ... # type: int
ACCEPTED = ... # type: int
NON_AUTHORITATIVE_INFORMATION = ... # type: int
NO_CONTENT = ... # type: int
RESET_CONTENT = ... # type: int
PARTIAL_CONTENT = ... # type: int
MULTI_STATUS = ... # type: int
IM_USED = ... # type: int
# redirection
MULTIPLE_CHOICES = ... # type: int
MOVED_PERMANENTLY = ... # type: int
FOUND = ... # type: int
SEE_OTHER = ... # type: int
NOT_MODIFIED = ... # type: int
USE_PROXY = ... # type: int
TEMPORARY_REDIRECT = ... # type: int
# client error
BAD_REQUEST = ... # type: int
UNAUTHORIZED = ... # type: int
PAYMENT_REQUIRED = ... # type: int
FORBIDDEN = ... # type: int
NOT_FOUND = ... # type: int
METHOD_NOT_ALLOWED = ... # type: int
NOT_ACCEPTABLE = ... # type: int
PROXY_AUTHENTICATION_REQUIRED = ... # type: int
REQUEST_TIMEOUT = ... # type: int
CONFLICT = ... # type: int
GONE = ... # type: int
LENGTH_REQUIRED = ... # type: int
PRECONDITION_FAILED = ... # type: int
REQUEST_ENTITY_TOO_LARGE = ... # type: int
REQUEST_URI_TOO_LONG = ... # type: int
UNSUPPORTED_MEDIA_TYPE = ... # type: int
REQUESTED_RANGE_NOT_SATISFIABLE = ... # type: int
EXPECTATION_FAILED = ... # type: int
UNPROCESSABLE_ENTITY = ... # type: int
LOCKED = ... # type: int
FAILED_DEPENDENCY = ... # type: int
UPGRADE_REQUIRED = ... # type: int
# server error
INTERNAL_SERVER_ERROR = ... # type: int
NOT_IMPLEMENTED = ... # type: int
BAD_GATEWAY = ... # type: int
SERVICE_UNAVAILABLE = ... # type: int
GATEWAY_TIMEOUT = ... # type: int
HTTP_VERSION_NOT_SUPPORTED = ... # type: int
INSUFFICIENT_STORAGE = ... # type: int
NOT_EXTENDED = ... # type: int

Просмотреть файл

@ -0,0 +1,35 @@
"""Stubs for the 'imp' module."""
from typing import List, Optional, Tuple, Iterable, IO, Any
import types
C_BUILTIN = ... # type: int
C_EXTENSION = ... # type: int
IMP_HOOK = ... # type: int
PKG_DIRECTORY = ... # type: int
PY_CODERESOURCE = ... # type: int
PY_COMPILED = ... # type: int
PY_FROZEN = ... # type: int
PY_RESOURCE = ... # type: int
PY_SOURCE = ... # type: int
SEARCH_ERROR = ... # type: int
def acquire_lock() -> None: ...
def find_module(name: str, path: Iterable[str] = ...) -> Optional[Tuple[str, str, Tuple[str, str, int]]]: ...
def get_magic() -> str: ...
def get_suffixes() -> List[Tuple[str, str, int]]: ...
def init_builtin(name: str) -> types.ModuleType: ...
def init_frozen(name: str) -> types.ModuleType: ...
def is_builtin(name: str) -> int: ...
def is_frozen(name: str) -> bool: ...
def load_compiled(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ...
def load_dynamic(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ...
def load_module(name: str, file: str, pathname: str, description: Tuple[str, str, int]) -> types.ModuleType: ...
def load_source(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ...
def lock_held() -> bool: ...
def new_module(name: str) -> types.ModuleType: ...
def release_lock() -> None: ...
class NullImporter:
def __init__(self, path_string: str) -> None: ...
def find_module(self, fullname: str, path: str = ...) -> None: ...

Просмотреть файл

@ -0,0 +1,4 @@
import types
from typing import Optional, Text
def import_module(name: Text, package: Optional[Text] = ...) -> types.ModuleType: ...

Просмотреть файл

@ -0,0 +1,135 @@
from types import CodeType, TracebackType, FrameType, ModuleType
from typing import Any, Dict, Callable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
# Types and members
class EndOfBlock(Exception): ...
class BlockFinder:
indent: int
islambda: bool
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: ...
CO_GENERATOR = ... # type: int
CO_NESTED = ... # type: int
CO_NEWLOCALS = ... # type: int
CO_NOFREE = ... # type: int
CO_OPTIMIZED = ... # type: int
CO_VARARGS = ... # type: int
CO_VARKEYWORDS = ... # type: int
TPFLAGS_IS_ABSTRACT = ... # type: 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]]: ...
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: ...
def isfunction(object: object) -> bool: ...
def isgeneratorfunction(object: object) -> bool: ...
def isgenerator(object: object) -> bool: ...
def istraceback(object: object) -> bool: ...
def isframe(object: object) -> bool: ...
def iscode(object: object) -> bool: ...
def isbuiltin(object: object) -> bool: ...
def isroutine(object: object) -> bool: ...
def isabstract(object: object) -> bool: ...
def ismethoddescriptor(object: object) -> bool: ...
def isdatadescriptor(object: object) -> bool: ...
def isgetsetdescriptor(object: object) -> bool: ...
def ismemberdescriptor(object: object) -> bool: ...
# Retrieving source code
def findsource(object: object) -> Tuple[List[str], int]: ...
def getabsfile(object: object) -> str: ...
def getblock(lines: Sequence[str]) -> Sequence[str]: ...
def getdoc(object: object) -> str: ...
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: ...
# 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 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 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),
]
)
_FrameInfo = Tuple[FrameType, str, int, str, List[str], int]
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),
])
def classify_class_attrs(cls: type) -> List[Attribute]: ...

Просмотреть файл

@ -0,0 +1,42 @@
# Stubs for io
# Based on https://docs.python.org/2/library/io.html
# Only a subset of functionality is included.
from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union, Optional
import _io
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 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
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]: ...
SEEK_SET = ... # type: int
SEEK_CUR = ... # type: int
SEEK_END = ... # type: int
class IOBase(_io._IOBase): ...
class RawIOBase(_io._RawIOBase, IOBase): ...
class BufferedIOBase(_io._BufferedIOBase, IOBase): ...
# Note: In the actual io.py, TextIOBase subclasses IOBase.
# (Which we don't do here because we don't want to subclass both TextIO and BinaryIO.)
class TextIOBase(_io._TextIOBase): ...

Просмотреть файл

@ -0,0 +1,165 @@
# Stubs for itertools
# Based on https://docs.python.org/2/library/itertools.html
from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple,
Union, Sequence, Generic, Optional)
_T = TypeVar('_T')
_S = TypeVar('_S')
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]):
def __init__(self, *iterables: Iterable[_T]) -> None: ...
def next(self) -> _T: ...
def __iter__(self) -> Iterator[_T]: ...
@staticmethod
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]: ...
@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')
@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 starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ...
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]: ...
@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, ...]]: ...
@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]]: ...

Просмотреть файл

@ -0,0 +1,96 @@
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol
class JSONDecodeError(ValueError):
def dumps(self, obj: Any) -> str: ...
def dump(self, obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
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: ...
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: ...
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 decode(self, s: Union[Text, bytes], _w: Any = ...) -> Any: ...
def raw_decode(self, s: Union[Text, bytes], idx: int = ...) -> Tuple[Any, Any]: ...
class JSONEncoder(object):
item_separator = ... # type: str
key_separator = ... # type: str
skipkeys = ... # type: bool
ensure_ascii = ... # type: bool
check_circular = ... # type: bool
allow_nan = ... # type: bool
sort_keys = ... # type: bool
indent = ... # type: 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 default(self, o: Any) -> Any: ...
def encode(self, o: Any) -> str: ...
def iterencode(self, o: Any, _one_shot: bool = ...) -> str: ...

Просмотреть файл

@ -0,0 +1,9 @@
from typing import Tuple
class ParserBase(object):
def __init__(self) -> None: ...
def error(self, message: str) -> None: ...
def reset(self) -> None: ...
def getpos(self) -> Tuple[int, int]: ...
def unknown_decl(self, data: str) -> None: ...

Просмотреть файл

@ -0,0 +1,6 @@
# Stubs for Python 2.7 md5 stdlib module
from hashlib import md5 as md5, md5 as new
blocksize = 0
digest_size = 0

Просмотреть файл

@ -0,0 +1,27 @@
from typing import Any
import rfc822
class Message(rfc822.Message):
encodingheader = ... # type: Any
typeheader = ... # type: Any
def __init__(self, fp, seekable: int = ...): ...
plisttext = ... # type: Any
type = ... # type: Any
maintype = ... # type: Any
subtype = ... # type: Any
def parsetype(self): ...
plist = ... # type: Any
def parseplist(self): ...
def getplist(self): ...
def getparam(self, name): ...
def getparamnames(self): ...
def getencoding(self): ...
def gettype(self): ...
def getmaintype(self): ...
def getsubtype(self): ...
def choose_boundary(): ...
def decode(input, output, encoding): ...
def encode(input, output, encoding): ...
def copyliteral(input, output): ...
def copybinary(input, output): ...

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше