Commit Graph

242 Commits

Author SHA1 Message Date
Eric Traut
0bf45ea2ed Added support for new type narrowing pattern for discriminating among tuples. The pattern is V[I] == L or V[I] != L where I is an integer literal, L is another literal value, V is a tuple with a known length and a type at index I that is declared as a literal type. 2021-08-06 23:17:21 -07:00
Eric Traut
f842817006 Updated docs for reportUnsupportedDunderAll. 2021-07-17 09:41:29 -06:00
Eric Traut
295db6af56 Disabled reportUnitializedInstanceVariable in strict mode, as intended. 2021-07-14 16:46:21 -06:00
Eric Traut
2156f2eb73 Implemented "reportUninitializedInstanceVariable" diagnostic check that looks for instance variables that are not initialized in the class body or constructor. 2021-07-14 16:13:49 -06:00
Eric Traut
845764c5ae Modified reportUnnecessaryIsInstance diagnostic to never report always-false conditions because the type checker no longer generates such conditions. 2021-07-03 10:03:49 -06:00
Eric Traut
c23d563a17 Took another swing at making the markdown processor in github do what I want in the typed-libraries documentation. 2021-06-22 10:01:50 -07:00
Eric Traut
bf66ff22c5 Fixed a few typos and formatting issues in typed-libraries documentation. 2021-06-22 10:00:30 -07:00
Eric Traut
0440272219 Added support for type narrowing conditional expressions of the form a is False, a is True, a is not False and a is not True. 2021-06-18 17:01:59 -07:00
Eric Traut
562a6b4848 In basic type checking mode, enabled the following diagnostic checks by default: reportOptionalSubscript, reportOptionalMemberAccess, reportOptionalCall, reportOptionalIterable, reportOptionalContextManager, and reportOptionalOperand. 2021-06-16 18:43:58 -07:00
Arnav Jindal
68a0cb85e0
Update command-line.md to emphazise flags with arguments (#1980)
* Update command-line.md

* Update command-line.md

* Update command-line.md
2021-06-12 09:20:57 -07:00
Yuichi Tateno (secon)
e09560c3ea
Fixing wrong type int to str of type-concepts.md (#1958) 2021-06-07 15:53:48 -07:00
Eric Traut
0f9d308827 Added documentation for conditional types reported with "*". 2021-05-29 15:43:09 -07:00
Eric Traut
eced7b57bd Added support for "tagged union" type narrowing when the conditional expression is of the form x[K] == V or x[K] != V where x is a union of TypedDict objects and K is a literal str key value that refers to a field with a literal type and V is a literal value. 2021-05-23 23:38:04 -07:00
Eric Traut
c52c928e66 Added type narrowing support for index expressions where the index value is a string literal. 2021-05-23 23:03:05 -07:00
Eric Traut
186e444652 Added new diagnostic rule "reportIncompleteStub", which reports a diagnostic for a module-level __getattr__ function in a type stub, indicating that it's incomplete. This check was previously part of the "reportUnknownMemberType" diagnostic rule. 2021-05-15 19:23:25 -07:00
Jake Bailey
893d08be8c Update everything for main branch rename 2021-05-13 13:26:44 -07:00
Eric Traut
320a0a2fd3 Updated documentation to indicate that some forms of subscripts are supported in type guards. 2021-04-29 08:20:19 -07:00
Eric Traut
69a0c5594a Added support for pyproject.toml files. 2021-04-20 21:51:39 -07:00
Steve Rice
bda2a94294
Update command line directions with new output format (#1749)
Since ba901d1449 (diff-c3f0fa903325059f6e7dda1116458aafa72061ac3d1a51ddfd077a5dc0801030R394), the `--outputjson` result schema has changed.
2021-04-08 17:36:48 -07:00
Eric Traut
27fb622a5e Implemented new diagnostic rule "reportUnnecessaryComparison". It checks for "==" and "!=" comparisons where the LHS and RHS types have no overlap and the LHS has no __eq__ overload. This new diagnostic rule is off by default in normal type checking mode but is on in strict mode. 2021-04-08 16:32:08 -07:00
Eric Traut
4f03ba88c0 Added configuration option "strictSetInference" which is analogous to "strictListInference" and "strictDictionaryInference" but specifically for set expressions. 2021-04-03 08:35:40 -07:00
karthickeyan
3b5a6d1a02
Update configuration.md (#1707)
Fixing a typo in "extraPaths" of configuration.md document
2021-03-31 10:34:48 -07:00
Andrew Grangaard
9f544885bc
fix typo in settings documentation. (#1699) 2021-03-29 20:21:32 -07:00
Eric Traut
ea8628909a Added "reportTypedDictNotRequiredAccess" diagnostic rule and split out diagnostics that pertain specifically to unguarded accesses to non-required TypedDict keys. 2021-03-27 09:28:28 -07:00
Eric Traut
e5714b3365 Added smarter handling of empty lists ([]) and dicts ({}). Previously, these were inferred to have types list[Unknown] and dict[Unknown, Unknown], respectively. They are now provided with a known type if the variable is assigned a known list or dict type along another code path. 2021-03-24 13:50:59 -07:00
Eric Traut
cb4aad13dc
Added new top-level "extraPaths" config option for pythonconfig.json that specifies the default extraPaths to use when no execution environments apply to a file. Changed settings logic to use the new default extraPaths mechanism for the "python.analysis.extraPaths" setting. (#1632)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-03-15 17:43:31 -07:00
Eric Traut
b86718ed0d Fixed example configuration in documentation. 2021-03-10 08:01:50 -08:00
Eric Traut
09cb091fe9 Removed support for "venv" entry in execution environments since this never really worked. Clarified in documentation that import resolution within an execution environment is not transitive. 2021-03-09 18:19:36 -08:00
Eric Traut
9ac028e7ab Fixed bug in sample code for documentation. 2021-03-07 09:12:54 -08:00
Eric Traut
ee2b18986e Added more documentation for "implied else narrowing". 2021-03-07 09:12:06 -08:00
Eric Traut
adabd54bf8 Changed reportOverlappingOverload to be an error in strict mode. 2021-03-05 09:23:23 -07:00
Eric Traut
acdefc550c Updated documentation on type narrowing to cover "Narrowing for Implied Else". 2021-03-05 09:07:26 -07:00
Eric Traut
af4426c4d6 Clarified default value for reportOverlappingOverload setting in docs. 2021-03-04 17:48:45 -07:00
Eric Traut
a192486099 Renamed "--ignore-external" to "--ignoreexternal" for consistency. Removed undocuemented "!" mechanism for invoking this functionality. 2021-03-03 00:51:18 -07:00
Vlad Emelianov
dc7382d52f
Add --ignore-external CLI flag (#1564)
Co-authored-by: Eric Traut <eric@traut.com>
2021-03-03 00:42:37 -07:00
Eric Traut
e6f8dbf4fa
Implemented command-line switches for pythonplatform and pythonversion. These are overridden by pyrightconfig.json settings. (#1529)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-02-23 17:05:13 -07:00
Eric Traut
36d499cada Further clarified in the typed libraries docs that “from .A import X” form is honored only in “__init__.py”. 2021-02-23 01:10:51 -07:00
Eric Traut
b5017de462 Updated typed library documentation to explicitly mention import statements of the form “from . import A” and “from .A import X”. 2021-02-23 01:02:15 -07:00
Eric Traut
68fca4eab6 Added "reportOverlappingOverload" diagnostic rule, splitting out a few checks that were previously in the "reportGeneralTypeIssue" rule. This allows for finer-grained control over these overload checks. 2021-02-20 09:28:57 -07:00
Richard Höchenberger
2e1b01f866
Fix typo in import (#1476) 2021-02-12 07:03:58 -08:00
Eric Traut
36c168c1ae Changed the reportUnboundVariable default severity from "warning" to "none" when typeCheckingMode is "off". There were too many complaints of false positives from users who have no interest in type checking. 2021-02-05 21:57:48 -08:00
Eric Traut
77410d86e5 Updated typing guidance for libraries documentation based on @JelleZijlstra's feedback. 2021-02-02 20:54:00 -08:00
Simon Hawkins
0977764a7e
Update typed-libraries.md (#1369)
Fixed minor typos in documentation.
2021-01-13 16:55:27 -08:00
Eric Traut
3dc83c0b1a Fixed minor typos in documentation. 2021-01-06 07:38:29 -08:00
Eric Traut
d6206e6b61 Updated git hook to refer to a more recent version of pyright. 2021-01-03 16:11:16 -08:00
Eric Traut
f9db4dcc8a Updated README to refer to PEP 647. 2021-01-03 12:13:20 -08:00
Alexey Shamrin
ec7bf81cb8
correct useLibraryCodeForTypes CLI argument (#1322) 2020-12-28 07:46:39 -08:00
Eric Traut
51387b95cd Added documentation for the default severity levels for each type checking mode (off, basic and strict). 2020-12-27 21:50:35 -08:00
Eric Traut
fb4a4e92bd Added new diagnostic rule "reportUnusedCoroutine" that reports an error if the result returned by an async function is not consumed (awaited, assigned to a variable, etc.). This detects and reports a common error when using async coroutines. 2020-12-26 22:30:49 -08:00
Eric Traut
b1d9ab7002 Added a new diagnostic rule called "reportInvalidTypeVarUse" that flags errors when TypeVars are used incorrectly. In particular, it flags the use of a single instance of a TypeVar within a generic function signature. 2020-12-11 22:28:19 -08:00