Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a6d277

Browse files
authored
Simplify pyrightconfigs by removing redundant keys (#9293)
1 parent a132ff2 commit 4a6d277

3 files changed

Lines changed: 17 additions & 99 deletions

File tree

pyrightconfig.json

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,44 @@
33
"typeshedPath": ".",
44
"include": [
55
"stdlib",
6-
"stubs"
6+
"stubs",
77
],
88
"exclude": [
99
// `cryptography` stubs are outdated and to be removed
10-
"stubs/cryptography"
10+
"stubs/cryptography",
1111
],
1212
"typeCheckingMode": "basic",
1313
"strictListInference": true,
1414
"strictDictionaryInference": true,
15-
"strictParameterNoneValue": true,
1615
"strictSetInference": true,
1716
"reportFunctionMemberAccess": "error",
18-
"reportMissingModuleSource": "none",
1917
"reportMissingTypeStubs": "error",
2018
"reportUnusedImport": "error",
2119
"reportUnusedClass": "error",
2220
"reportUnusedFunction": "error",
2321
"reportUnusedVariable": "error",
2422
"reportDuplicateImport": "error",
25-
"reportOptionalSubscript": "error",
26-
"reportOptionalMemberAccess": "error",
27-
"reportOptionalCall": "error",
28-
"reportOptionalIterable": "error",
29-
"reportOptionalContextManager": "error",
30-
"reportOptionalOperand": "error",
3123
"reportUntypedFunctionDecorator": "error",
3224
"reportUntypedClassDecorator": "error",
3325
"reportUntypedBaseClass": "error",
3426
"reportUntypedNamedTuple": "error",
35-
"reportPrivateUsage": "none",
3627
"reportConstantRedefinition": "error",
3728
"reportInvalidStringEscapeSequence": "error",
3829
"reportUnknownArgumentType": "error",
3930
"reportUnknownLambdaType": "error",
4031
"reportMissingTypeArgument": "error",
41-
"reportUndefinedVariable": "error",
42-
"reportUnboundVariable": "error",
4332
"reportInvalidStubStatement": "error",
4433
"reportInvalidTypeVarUse": "error",
4534
"reportUnsupportedDunderAll": "error",
4635
"reportInconsistentConstructor": "error",
4736
"reportTypeCommentUsage": "error",
4837
"reportUnnecessaryComparison": "error",
38+
"reportMissingModuleSource": "none",
4939
// Incompatible overrides and property type mismatches are out of typeshed's control
5040
// as they are inherited from the implementation.
51-
"reportPropertyTypeMismatch": "none",
5241
"reportIncompatibleMethodOverride": "none",
5342
"reportIncompatibleVariableOverride": "none",
43+
"reportPropertyTypeMismatch": "none",
5444
// Overlapping overloads are often necessary in a stub, meaning pyright's check
5545
// (which is stricter than mypy's; see mypy issue #10143 and #10157)
5646
// would cause many false positives and catch few bugs.

pyrightconfig.stricter.json

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"typeshedPath": ".",
44
"include": [
55
"stdlib",
6-
"stubs"
6+
"stubs",
77
],
88
"exclude": [
99
"stdlib/distutils/command",
@@ -70,49 +70,12 @@
7070
"stubs/tqdm",
7171
"stubs/ttkthemes",
7272
"stubs/urllib3",
73-
"stubs/vobject"
73+
"stubs/vobject",
7474
],
75-
"typeCheckingMode": "basic",
76-
"strictListInference": true,
77-
"strictDictionaryInference": true,
78-
"strictParameterNoneValue": true,
79-
"strictSetInference": true,
80-
"reportFunctionMemberAccess": "error",
81-
"reportMissingModuleSource": "none",
82-
"reportMissingParameterType": "error",
83-
"reportMissingTypeStubs": "error",
84-
"reportUnusedImport": "error",
85-
"reportUnusedClass": "error",
86-
"reportUnusedFunction": "error",
87-
"reportUnusedVariable": "error",
88-
"reportDuplicateImport": "error",
89-
"reportOptionalSubscript": "error",
90-
"reportOptionalMemberAccess": "error",
91-
"reportOptionalCall": "error",
92-
"reportOptionalIterable": "error",
93-
"reportOptionalContextManager": "error",
94-
"reportOptionalOperand": "error",
95-
"reportUntypedFunctionDecorator": "error",
96-
"reportUntypedClassDecorator": "error",
97-
"reportUntypedBaseClass": "error",
98-
"reportUntypedNamedTuple": "error",
75+
"typeCheckingMode": "strict",
9976
"reportPrivateUsage": "none",
100-
"reportConstantRedefinition": "error",
101-
"reportInvalidStringEscapeSequence": "error",
102-
"reportUnknownParameterType": "error",
103-
"reportUnknownArgumentType": "error",
104-
"reportUnknownLambdaType": "error",
105-
"reportUnknownVariableType": "error",
106-
"reportUnknownMemberType": "error",
107-
"reportMissingTypeArgument": "error",
108-
"reportUndefinedVariable": "error",
109-
"reportUnboundVariable": "error",
110-
"reportInvalidStubStatement": "error",
111-
"reportInvalidTypeVarUse": "error",
112-
"reportUnsupportedDunderAll": "error",
113-
"reportInconsistentConstructor": "error",
114-
"reportTypeCommentUsage": "error",
115-
"reportUnnecessaryComparison": "error",
77+
"reportIncompleteStub": "none",
78+
"reportMissingModuleSource": "none",
11679
// Incompatible overrides and property type mismatches are out of typeshed's control
11780
// as they are inherited from the implementation.
11881
"reportIncompatibleMethodOverride": "none",

pyrightconfig.testcases.json

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,15 @@
22
"$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json",
33
"typeshedPath": ".",
44
"include": [
5-
"test_cases"
5+
"test_cases",
66
],
7-
"typeCheckingMode": "basic",
8-
"strictListInference": true,
9-
"strictDictionaryInference": true,
10-
"strictParameterNoneValue": true,
11-
"reportFunctionMemberAccess": "error",
12-
"reportMissingModuleSource": "none",
13-
"reportMissingTypeStubs": "error",
14-
"reportUnusedImport": "error",
15-
"reportUnusedClass": "error",
16-
"reportUnusedFunction": "error",
17-
"reportUnusedVariable": "error",
18-
"reportDuplicateImport": "error",
19-
"reportOptionalSubscript": "error",
20-
"reportOptionalMemberAccess": "error",
21-
"reportOptionalCall": "error",
22-
"reportOptionalIterable": "error",
23-
"reportOptionalContextManager": "error",
24-
"reportOptionalOperand": "error",
25-
"reportUntypedFunctionDecorator": "error",
26-
"reportUntypedClassDecorator": "error",
27-
"reportUntypedBaseClass": "error",
28-
"reportUntypedNamedTuple": "error",
29-
"reportPrivateUsage": "none",
30-
"reportConstantRedefinition": "error",
31-
"reportInvalidStringEscapeSequence": "error",
32-
"reportUnknownParameterType": "error",
33-
"reportUnknownArgumentType": "error",
34-
"reportUnknownLambdaType": "error",
35-
"reportUnknownVariableType": "error",
36-
"reportUnknownMemberType": "error",
37-
"reportMissingTypeArgument": "error",
38-
"reportUndefinedVariable": "error",
39-
"reportUnboundVariable": "error",
40-
"reportInvalidStubStatement": "error",
41-
"reportInvalidTypeVarUse": "error",
7+
"typeCheckingMode": "strict",
428
"reportPropertyTypeMismatch": "error",
43-
"reportSelfClsParameterName": "error",
44-
"reportUnsupportedDunderAll": "error",
45-
"reportIncompatibleMethodOverride": "error",
46-
"reportIncompatibleVariableOverride": "error",
47-
"reportOverlappingOverload": "error",
489
"reportUnnecessaryTypeIgnoreComment": "error",
49-
"reportMissingTypeStubs": "error",
50-
"reportMatchNotExhaustive": "error"
10+
"reportMissingModuleSource": "none",
11+
"reportPrivateUsage": "none",
12+
// isinstance checks are still needed when validating inputs outside of typeshed's control
13+
"reportUnnecessaryIsInstance": "none",
14+
// The name of the self/cls parameter is out of typeshed's control.
15+
"reportSelfClsParameterName": "none",
5116
}

0 commit comments

Comments
 (0)