-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pyright to test suite, pyrightconfig.json (#5059)
Co-authored-by: Sebastian Rittau <[email protected]>
- Loading branch information
1 parent
a1f16da
commit c00c725
Showing
5 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"typeshedPath": ".", | ||
"include": [ | ||
"stdlib", | ||
"stubs" | ||
], | ||
"exclude": [ | ||
"**/@python2", | ||
"stdlib/encodings/__init__.pyi", | ||
"stdlib/sqlite3/dbapi2.pyi", | ||
"stdlib/tkinter", | ||
"stdlib/xml/dom", | ||
"stdlib/xml/sax", | ||
"stubs/backports", | ||
"stubs/backports_abc", | ||
"stubs/boto", | ||
"stubs/cachetools", | ||
"stubs/chardet", | ||
"stubs/click", | ||
"stubs/cryptography", | ||
"stubs/dateparser", | ||
"stubs/DateTimeRange", | ||
"stubs/decorator", | ||
"stubs/docutils", | ||
"stubs/fb303", | ||
"stubs/Flask", | ||
"stubs/frozendict", | ||
"stubs/Jinja2", | ||
"stubs/kazoo", | ||
"stubs/Markdown", | ||
"stubs/MarkupSafe", | ||
"stubs/mock", | ||
"stubs/nmap", | ||
"stubs/openssl-python", | ||
"stubs/polib", | ||
"stubs/paramiko", | ||
"stubs/protobuf", | ||
"stubs/pymssql", | ||
"stubs/PyMySQL", | ||
"stubs/python-dateutil", | ||
"stubs/pyvmomi", | ||
"stubs/PyYAML", | ||
"stubs/redis", | ||
"stubs/requests", | ||
"stubs/Routes", | ||
"stubs/scribe", | ||
"stubs/simplejson", | ||
"stubs/tornado", | ||
"stubs/waitress", | ||
"stubs/Werkzeug" | ||
], | ||
"pythonVersion": "3.9", | ||
"typeCheckingMode": "basic", | ||
"strictListInference": true, | ||
"strictDictionaryInference": true, | ||
"strictParameterNoneValue": true, | ||
"reportFunctionMemberAccess": "error", | ||
"reportMissingModuleSource": "none", | ||
"reportMissingTypeStubs": "error", | ||
"reportUnusedImport": "error", | ||
"reportUnusedClass": "error", | ||
"reportUnusedFunction": "error", | ||
"reportUnusedVariable": "error", | ||
"reportDuplicateImport": "error", | ||
"reportOptionalSubscript": "error", | ||
"reportOptionalMemberAccess": "error", | ||
"reportOptionalCall": "error", | ||
"reportOptionalIterable": "error", | ||
"reportOptionalContextManager": "error", | ||
"reportOptionalOperand": "error", | ||
"reportUntypedFunctionDecorator": "error", | ||
"reportUntypedClassDecorator": "error", | ||
"reportUntypedBaseClass": "error", | ||
"reportUntypedNamedTuple": "error", | ||
"reportPrivateUsage": "error", | ||
"reportConstantRedefinition": "error", | ||
"reportIncompatibleMethodOverride": "error", | ||
"reportIncompatibleVariableOverride": "error", | ||
"reportInvalidStringEscapeSequence": "error", | ||
"reportUnknownParameterType": "error", | ||
"reportUnknownArgumentType": "error", | ||
"reportUnknownLambdaType": "error", | ||
"reportUnknownVariableType": "error", | ||
"reportUnknownMemberType": "error", | ||
"reportMissingTypeArgument": "error", | ||
"reportUndefinedVariable": "error", | ||
"reportUnboundVariable": "error", | ||
"reportInvalidStubStatement": "error", | ||
"reportUnsupportedDunderAll": "error", | ||
"reportInvalidTypeVarUse": "none", | ||
"reportOverlappingOverload": "none", | ||
"reportPropertyTypeMismatch": "none", | ||
"reportSelfClsParameterName": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Pyright is configured using a "pyrightconfig.json" file. You will find | ||
it at the root of the repo. It contains an "exclude" section that accepts | ||
globs for specifying which files and/or directories to exclude from analysis. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
|
||
_WELL_KNOWN_FILE = Path("tests", "pyright_test.py") | ||
_PYRIGHT_COMMAND = ["npx", "-p", "[email protected]", "pyright"] | ||
|
||
|
||
def main() -> None: | ||
assert_npm_is_installed() | ||
ret = subprocess.run(_PYRIGHT_COMMAND).returncode | ||
sys.exit(ret) | ||
|
||
|
||
def assert_npm_is_installed() -> None: | ||
if not _WELL_KNOWN_FILE.exists(): | ||
print("pyright_test.py must be run from the typeshed root directory", file=sys.stderr) | ||
sys.exit(1) | ||
try: | ||
subprocess.run(["npx", "--version"]) | ||
except OSError: | ||
print("error running npx; is Node.js installed?", file=sys.stderr) | ||
sys.exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |