Commit Graph

337 Commits

Author SHA1 Message Date
Eric Traut
5f48e39671 Exposed new configuration setting analyzeUnannotatedFunctions which corresponds to the --skipunannotated command-line option. Added an information diagnostic for skipped functions. This addresses https://github.com/microsoft/pyright/issues/4303. 2022-12-08 20:05:32 -08:00
Steve C
fa75fd6556
Fix typo in -> is, in typed-libraries.md (#4180) 2022-11-10 17:51:04 -08:00
Rich Chiodo
04a1058378
20221121 (#4174) 2022-11-09 16:00:25 -08:00
Rich Chiodo
8c0ba8a78a
Show a warning when a stdlib module is being overridden (#4132)
* Working for simple cases

* Fix localize

* Move logic to source mapper

* Add support for the current file

* Add rename file command

* Fix comments

* Closer to getting tests to work. Rename added

* Rework how stdlib modules are found. Fix tests

* Do the rename without bringing up a dialog

* Fix tests and add docs

* Fix tests on unix

* Review feedback

* Default shadowed imports to off

* Missed spot for execEnv not needing to be passed
2022-11-04 16:45:16 -07:00
Ignacio Vergara Kausel
512df5e922
Update type-concepts.md (#4099)
Fixed typo in documentation.
2022-10-27 06:05:31 -07:00
Eric Traut
d5d27505ef Updated types in documentation to use PEP 604 syntax. 2022-10-24 20:06:21 -07:00
Eric Traut
8538998719 Extended the defineConstant mechanism to work with conditional statements that contain member access expressions that reference a defined member name. This addresses https://github.com/microsoft/pyright/issues/4060. 2022-10-18 15:28:17 -07:00
Kwanghoon Choi
40d511fadc
Update type-concepts.md (#4029)
A fix to add a missing parameter to isinstance as:
 - isinstance(val, Bar)
2022-10-09 23:24:19 -07:00
Erik De Bonte
f21d04f204
Editable install docs (#4020) 2022-10-07 11:44:33 -07:00
Eric Traut
4105b97749 Updated documentation for pre-commit hooks to eliminate confusion and point users to the pyright-python wrapper. 2022-09-03 11:58:28 -06:00
Eric Traut
285550c5ce Updated configuration documentation to include reportUnnecessaryContains in the table. 2022-07-17 23:42:44 -07:00
Eric Traut
7f3e7b0d2e Added support for new reportUnnecessaryContains diagnostic rule to catch potential bugs in in and not in containment checks. 2022-07-17 23:29:50 -07:00
Eric Traut
04945a4309 Made tweak to documentation for clarity. 2022-06-23 08:34:18 -07:00
Keming
de86a34dd4
fix typo (#3601) 2022-06-21 19:08:37 -07:00
Eric Traut
4ae8b9233e Made suggested improvements to documentation. 2022-06-18 23:00:11 -07:00
Eric Traut
055dc1296a Updated comments documentation to talk about reportTypeCommentUsage diagnostic check. 2022-06-12 11:50:47 -07:00
Eric Traut
484faf7ba3 Added support for new reportTypeCommentUsage diagnostic check. It flag the usage of # type: xxx comments for functions and variables. These are still supported for backward compatibility, but they are increasingly irrelevant and will likely be deprecated in the next few years. 2022-06-09 21:00:47 -07:00
Eric Traut
794d151050 Added new configuration setting called "defineConstant". It allows a configuration to specify one or more identifiers that should be assigned by pyright's binder to be constant anywhere they appear. Values can be boolean (true or false) or a string. If an identifier of this value is used within a conditional statement (like if not DEBUG:) it will affect pyright's reachability analysis for the guarded code blocks. 2022-06-08 22:01:33 -07:00
Eric Traut
f2328237d3 Extended the "X in Y" type narrowing to support dict, defaultdict and OrderedDict classes. 2022-05-30 00:55:22 -07:00
Eric Traut
255497446a Fixed bug in type narrowing logic for expressions of the form "X not in Y". 2022-05-29 23:54:15 -07:00
Eric Traut
21a67358df Specified that node.js 14.x should be used. 2022-05-21 10:47:05 -07:00
Eric Traut
42ad212d8d Added missing quotes in library documentation for __all__ statements. 2022-05-19 17:12:04 -07:00
Eric Traut
48c910d0e3 Added back git hook example for non-github users. 2022-05-19 16:04:32 -07:00
Eric Traut
4b65372d4a Changed CI integration instructions to point to the pyright-action project. 2022-05-19 15:34:10 -07:00
Eric Traut
5840e3eb7c Improved docs string for the --skipunannotated command line option. 2022-05-18 15:29:06 -07:00
Eric Traut
8d5da97ba6 More doc improvements. 2022-05-08 11:12:37 -07:00
Eric Traut
9f08b64bcd Added documentation for class and instance variables. 2022-05-08 11:09:48 -07:00
Eric Traut
3b5752431b Extended type guard for discriminated literal fields to support properties. 2022-04-29 20:39:32 -07:00
Eric Traut
2c7bcc81e1 Updated library guidance to include a small section on positional-only parameters. 2022-04-15 21:42:42 -07:00
Eric Traut
ab1fbfc0d6 Enhanced reportUnnecessaryComparison diagnostic check so it also detects cases where a function appears within a condition expression. This is a common source of programming error. 2022-04-10 23:33:41 -07:00
Eric Traut
8660a6f870
Added support for type guard based on a.b is None or a.b is not None patterns where b is a member variable that distinguishes two different classes. (#3273)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2022-04-01 11:06:53 -07:00
Eric Traut
d1e5c924bd Revert "Add support for type narrowing of NamedTuple fields with "is None" (#3271)"
This reverts commit e296cd58ee.
2022-03-29 20:02:54 -06:00
Kevin Coffey
e296cd58ee
Add support for type narrowing of NamedTuple fields with "is None" (#3271)
* Add support for type narrowing of NamedTuple fields with is None.

* Add description for `x.y is None` narrowing

Fix capitalization for filename of sample in test.
2022-03-29 19:59:55 -06:00
Eric Traut
189f0314bb Another attempt at formatting 2022-03-20 14:35:38 -06:00
Eric Traut
fadeea36b4 Updated diagnostic rule table so it groups basic and strict diagnostics. 2022-03-20 14:34:42 -06:00
Eric Traut
d28c481535 Added new diagnostic check reportUnusedExpression to catch bugs like a == 4 when a = 4 was intended. 2022-03-13 15:25:18 -06:00
Eric Traut
77dc80f48a Clarified the role of __all__ in the libraries documentation. 2022-03-11 18:11:55 -07:00
Eric Traut
2aeac06f5e Updated comments doc to talk about reportUnnecessaryTypeIgnoreComment. 2022-03-11 17:55:20 -07:00
Eric Traut
4cbd352d39 Added support for per-line suppression of diagnostics using # pyright: ignore comment. This also supports rule-specific suppression using a list of diagnostic rules, as in # pyright: ignore [reportGeneralTypeIssues]. 2022-03-11 09:47:41 -07:00
Eric Traut
a4900ebd03 Extended support for narrowing of index expressions to include those with negative subscripts, such as a[-1]. This is supported for all supported type guard patterns. 2022-03-05 01:35:17 -07:00
Eric Traut
faecce31ad Updated library guidance to clarify that submodules under a private module are also considered private. 2022-03-04 17:52:51 -07:00
Eric Traut
c9b9676e21 Updated package type verifier to differentiate between "unknown" and "ambiguous" types. 2022-02-24 15:12:36 -07:00
Eric Traut
c061adb5b8 Fixed typo in documentation. 2022-02-22 16:01:28 -07:00
Eric Traut
450524d004 Added support for parameter type inference based on annotated base class method signatures and on default argument expressions. 2022-02-22 12:42:14 -07:00
Eric Traut
dc24fab779 Changed strictParameterNoneValue to default to true rather than false. This reflects the updated guidance in PEP 484, which indicates that type checkers should not assume that a default argument of None should imply an Optional type. 2022-02-21 17:54:31 -07:00
Eric Traut
4d75f59065 Fixed typo in documentation. 2022-02-19 14:11:16 -07:00
Eric Traut
92b4028cd5 Changed the behavior of the package type verifier so it does not flag unannotated class or instance variables if a parent class provides a type annotation for a variable of the same name. The type is inherited in this case. Also updated the library guidance to reflect this change. 2022-02-11 10:25:48 -08:00
Jelle Zijlstra
3cc4e6ccdd
Document reveal_type() and reveal_locals() (#2996)
reveal_locals() was not documented anywhere, which may be part of why so few people know about it.

Happy to put this somewhere else if you prefer.
2022-02-05 19:21:30 -08:00
Eric Traut
94db5376c1 Added the ability to add new symbols to builtins by simply adding a type stub file named __builtins__.pyi locally. 2022-02-02 19:27:12 -08:00
Eric Traut
10a122ccd6 Fixed error in documentation for reportInvalidTypeVarUse. 2022-01-29 07:54:18 -08:00