Commit Graph

218 Commits

Author SHA1 Message Date
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
Eric Traut
cf1a5790d2 Implemented new diagnostic rule reportUnusedCallResult that checks whether a call expression's results are consumed. If the results are None or Any, no diagnostic is produced. 2020-11-25 19:50:31 -08:00
Eric Traut
a44e254c32 Added support for new reportUnsupportedDunderAll diagnostic rule. It checks for unsupported manipulations of __all__. 2020-11-25 16:07:59 -08:00
Eric Traut
1601a177cd Added new diagnostic rule "reportFunctionMemberAccess" that reports an attempt to access, set or delete non-standard attributes of function objects. 2020-11-19 17:19:22 -08:00
Eric Traut
8cb9bfca41 Updated out-of-date information in type-stubs.md documentation. 2020-11-17 17:47:17 -08:00
Eric Traut
258202af72 Added more documentation about type narrowing and type guards. 2020-11-11 14:54:37 -08:00
Eric Traut
5e5e55449e Changed re-export logic for type stub and py.typed modules to honor the clarification that was recently added to PEP 484. Previously, any import that used an "as" clause was considered to be re-exported. Now, symbols are re-exported only if the "as" clause is redundant (i.e. it is of the form import A as A or from A import X as X). 2020-11-01 08:54:09 -08:00
Eric Traut
9046794205 Removed recently-added "reportInvalidTypeVarUse" diagnostic rule and associated checks. After further discussion, we decided that there are legitimate cases where a TypeVar can appear only once in a function signature. 2020-10-21 09:59:36 -07:00
Eric Traut
bb04ffa6be Added new diagnostic rule "reportInvalidTypeVarUse" that controls reporting of TypeVars that appear only once in a function signature. By default it is off in basic type checking mode but on in strict mode. 2020-10-19 13:30:06 -07:00
Eric Traut
246ff993e7 Fixed bug in decorator annotation documentation. 2020-10-14 20:14:08 -07:00
Eric Traut
57175e8d3a Did another editing pass on the typed library documentation for readability and consistency. 2020-10-02 23:56:37 -07:00
Eric Traut
af01be3244 Fixed documentation for building pyright. 2020-10-02 11:00:26 -07:00
Eric Traut
b2882fd6be Added support for the __all__ += <module>.__all__ idiom for mutating the __all__ value. This idiom is used by numpy. 2020-10-02 10:55:24 -07:00
Eric Traut
05cdaf9344 Added missing section on type aliases within typed library documentation. 2020-09-29 15:16:48 -07:00
Eric Traut
67e94f4c8a Fixed markdown rendering issue in docs. 2020-09-29 15:04:51 -07:00
Eric Traut
1cb2a3a950 Added detailed documentation for the "--verifytypes" option. 2020-09-29 15:03:14 -07:00
Eric Traut
dc5cd387fc Implemented new "verifytypes" command-line option that analyzes a py.typed package and reports missing or partially-unknown types. 2020-09-28 14:49:32 -07:00
Eric Traut
b6cd5eedae Fixed missing JSON field in command-line documentation. 2020-09-28 14:34:29 -07:00
Eric Traut
5d44a7e35d Updated import resolution documentation to accurately reflect recent changes related to py.typed packages. 2020-09-23 14:20:23 -07:00
Eric Traut
6378f7761f Changed reveal_type to use an information diagnostic severity rather than warning. Added support in CLI for information diagnostic severity. These were previously dropped. 2020-09-16 10:11:30 -07:00
Eric Traut
006f5d60d1 Changed python.analysis.logLevel to use "Information" rather than "Info" for consistency with Python extension. 2020-09-14 14:44:18 -07:00
Eric Traut
f72711b07b Added support for new "reportWildcardImportFromLibrary" diagnostic rule that checks for the use of wildcard imports from non-local modules. By default, it is reported as a warning, but in strict mode it is an error. 2020-09-12 20:31:25 -07:00
Eric Traut
6356575664 Changed the behavior of the command-line version of pyright when file specs are passed on the command line. Previously, file specs couldn't be used in conjunction with a config file. Now a config file is used, but the specified file specs override the "include" section of the config file. 2020-09-11 00:27:57 -07:00
Eric Traut
cea376e59b Added new diagnostic rule "reportPropertyTypeMismatch" that verifies that the type of the input parameter to a property's setter is assignable to the return type of the getter. 2020-09-05 14:55:12 -07:00
Eric Traut
0a65625e03 More documentation improvements. 2020-09-04 14:51:40 -07:00