Eric Traut
ff134e6467
Added documentation to mypy comparison that talks about narrowing for captured variables.
2023-04-02 08:34:28 -07:00
Eric Traut
08085479ef
Extended type narrowing for type guards of the form x[I] is B
and x[I] is not B
where x
is a tuple and B
is an enum literal.
2023-03-30 18:26:46 -07:00
Eric Traut
f1db88481f
Added support for type guards of the form x[I] is B
and x[I] is not B
where x
is a tuple and B
is a boolean literal True
or False
. This addresses part of https://github.com/microsoft/pyright/issues/4875 .
2023-03-30 18:10:06 -07:00
Dmitry Volodin
14b0831697
Fix Markdown links ( #4849 )
...
* Fixed Markdown links
* Gave main doc page prettier name
2023-03-27 19:48:11 -06:00
Eric Traut
e2e3a5c9ff
Added new diagnostic check reportImplicitOverride
. This addresses https://github.com/microsoft/pyright/issues/4788 .
2023-03-16 09:52:25 -06:00
Eric Traut
65ca325a14
Changed # pyright: basic
file-level comment so it overrides "strict" settings specified in the config file or language server settings. This allows an individual file to be "downgraded" from strict to basic. This addresses https://github.com/microsoft/pyright/issues/4751 .
2023-03-09 10:28:44 -07:00
Eric Traut
3f987e3137
Fixed broken links in README for npmjs page. Added missing link to command line interface documentation in sidebar.
2023-03-09 09:46:17 -07:00
Eric Traut
9c6ebad347
Updated mypy comparison to reflect change in mypy's type narrowing capabilities.
2023-03-09 08:21:01 -07:00
Eric Traut
c83a95e62e
More improvements to documentation.
2023-03-07 16:38:22 -07:00
Eric Traut
414dce170e
Updated documentation for import modeling differences between mypy and pyright.
2023-03-07 10:16:14 -07:00
Eric Traut
1fdeadeca6
Improved "getting started" documentation.
2023-03-07 09:53:49 -07:00
Eric Traut
a00a026953
Fixed capitalization inconsistency in docs.
2023-03-06 18:12:20 -07:00
Eric Traut
08b2cb4698
Did a consistency pass on documentation markdown.
2023-03-06 18:10:33 -07:00
Eric Traut
f7db5822ef
Ran auto-formatter on html to avoid style issue in CI.
2023-03-06 17:59:23 -07:00
Eric Traut
8f17673300
Fixed main Pyright link in sidebar.
2023-03-06 17:55:58 -07:00
Eric Traut
400dd260cc
Another small tweak to docs sidebar.
2023-03-06 17:54:36 -07:00
Eric Traut
2c4a9da2ae
More tweaks to documentation and README files. Added a navbar to docs site.
2023-03-06 17:52:06 -07:00
Eric Traut
65874c5254
Small tweak for main docs page.
2023-03-06 17:45:37 -07:00
Eric Traut
deabba5e6a
Tweaked documentation theming and added language highlighting for json.
2023-03-06 17:44:15 -07:00
Eric Traut
2827c94d89
Small correction to settings documentation.
2023-03-06 16:10:06 -07:00
Eric Traut
dc87fa46af
Added a missing HTML tag to index.html.
2023-03-06 16:03:19 -07:00
Eric Traut
6cb2f4a058
Moved installation instructions and FAQ to their own docs pages, further simplifying the main README.
2023-03-06 15:58:44 -07:00
Eric Traut
b61f121efe
Minor tweak to README.
2023-03-06 15:51:49 -07:00
Eric Traut
4c4aec52a5
Added support for docsify-based docs site.
2023-03-06 15:46:07 -07:00
Eric Traut
b3fd962116
Fixed bugs in documentation.
2023-03-06 15:45:51 -07:00
Eric Traut
735c19a1c9
Improved documentation for ...
function bodies.
2023-03-06 10:49:54 -07:00
Eric Traut
7197a8d624
Added documentation for import statements.
2023-03-06 08:49:00 -07:00
Eric Traut
81f21ee3d4
Added support for type guard patterns type(x) == T
and type(x) != T
. This addresses https://github.com/microsoft/pyright/issues/4719 .
2023-03-01 23:29:44 -07:00
ErezAmihud
2857963212
add gitlab ci documentation ( #4704 )
2023-02-27 13:57:05 -07:00
Eric Traut
526d907def
Slimmed down the README to remove information that most pyright users probably don't care about. Features of pyright were moved to a separate "features.md" document.
2023-02-26 10:54:20 -07:00
Eric Traut
344b091bfe
Minor formatting improvements to documentation.
2023-02-14 18:23:13 -08:00
Eric Traut
4eb4397a90
Updated documentation for default exclude settings.
2023-02-08 13:09:55 -08:00
Eric Traut
f8eb114de3
Fixed a few typos in the pyright documentation.
2023-02-01 08:09:36 -08:00
Eric Traut
b17f64ddcb
A few more tweaks to the documentation for consistency.
2023-01-27 09:29:38 -08:00
Eric Traut
3829e8e32d
Tweaked documentation for readability.
2023-01-27 09:26:30 -08:00
Eric Traut
53e8cd4145
Added provisional support for draft PEP 702 (marking deprecations using the type system).
2023-01-13 21:16:07 -08:00
Eric Traut
a2784020f2
Added support for x[K] is V
and x[K] is not V
type narrowing forms. This addresses https://github.com/microsoft/pyright/issues/4453 .
2023-01-13 16:53:18 -08:00
Eric Traut
452bd59778
Updated build instructions.
2023-01-08 09:20:12 -08:00
Christian Clauss
bd3ac8b722
Fix typos discovered by codespell ( #4399 )
2023-01-04 06:54:43 -07:00
Eric Traut
c7626944f1
Added support for type guard forms x is ...
, x is not ...
, x == ...
and x != ...
. Support for these were recently added to mypy. This addresses https://github.com/microsoft/pyright/issues/4397 .
2023-01-04 06:13:44 -07:00
Christian Clauss
7be1d77360
Fix typo ( #4398 )
2023-01-04 05:53:27 -07:00
Eric Traut
775b7b4d85
Improved handling of TypeVars that appear only within a Callable within a return type annotation for a function. By a strict reading of PEP 484, these should be bound to the function's scope, but practically, they are bound to the Callable. This allows a function to return a generic callable type. When TypeVars are rescoped in this manner, the TypeVar cannot be referenced within the function body because it is no longer in scope in that context. This addresses https://github.com/microsoft/pyright/issues/4285 .
2022-12-25 10:57:02 -07:00
Eric Traut
0be873e289
Fixed a couple of typos in the documentation.
2022-12-21 10:47:28 -07:00
Eric Traut
97b6231d13
Added a few more minor improvements to the docs.
2022-12-18 18:40:29 -08:00
Jelle Zijlstra
355361e8b3
fix typos in mypy-comparison ( #4354 )
...
* fix typos in mypy-comparison
* fix versions
2022-12-18 18:15:17 -08:00
Eric Traut
e3ddbb3171
Small tweaks to the new documentation based on proofreading pass.
2022-12-18 15:24:59 -08:00
Eric Traut
5a19cb9f0a
Added documentation that covers the major behavioral differences between pyright and mypy and the justifications for those differences.
2022-12-18 15:11:11 -08:00
Eric Traut
c4e61dcc6a
Fixed a few bugs in the type guard documentation.
2022-12-18 15:10:30 -08:00
Eric Traut
8d3a6e62c8
Further clarified the new overload behavior in the documentation.
2022-12-18 08:06:47 -08:00
Eric Traut
1dc84b93b1
Modified the overload matching algorithm to match the behavior of mypy when the overload match is ambiguous because an argument evaluates to Any
or Unknown
. In this case, the call expression evaluates to Unknown
. Previously, pyright used the first of the matching overloads in this case. This addresses https://github.com/microsoft/pyright/issues/4347 .
2022-12-16 23:18:37 -08:00
Eric Traut
2f21a0d975
Fixed a bug in the dictionary inference documentation.
2022-12-16 19:27:12 -08:00
Eric Traut
8458382477
Implemented a new --level
command-line option that allows filtering of 'information' and 'warning' diagnostics.
2022-12-14 09:20:15 -08:00
Rich Chiodo
4897e993d5
Fix 'reportShadowedImports' link
...
Fixes https://github.com/microsoft/pylance-release/issues/3752
2022-12-12 09:51:37 -08:00
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
Eric Traut
6776c0ce86
Fixed bug in documentation for reportMissingImports.
2022-01-29 00:05:40 -08:00
Eric Traut
a03acb0f41
Changed import resolution order to more closely match PEP 561. Typeshed stdlib type stubs are now resolved later in the import resolution process, after all local modules and modules within the python environment.
2022-01-27 22:57:30 -08:00
Eric Traut
b69843cf03
Updated type inference documentation to eliminate a statement that was leading to some confusion.
2022-01-27 13:20:55 -08:00
Eric Traut
b740ddfae5
Added new diagnostic check "reportMatchNotExhaustive" which reports cases where a match
statement doesn't exhaustively cover all cases.
2022-01-23 12:49:27 -08:00
Eric Traut
da81cdf22f
Updated documentation to cover the new # pyright: basic
comment.
2022-01-19 12:53:07 -08:00
Eric Traut
163ef21c3c
Changed "reportMissingSuperCall" to be off by default in strict mode.
2022-01-14 14:13:49 -08:00
Eric Traut
62ac83694e
Implemented a new diagnostic check "reportMissingSuperCall" that checks for __init__
, __init_subclass__
, __enter__
and __exit__
methods that fail to call through to their parent class(es) methods of the same name. This is a common source of bugs. The check is disabled by default in basic mode but enabled by default in strict mode.
2022-01-14 11:55:23 -08:00
Eric Traut
4934e906d5
Added new diagnostic check reportInconsistentConstructor
that checks for inconsistent input signatures between __new__
and __init__
methods.
2022-01-12 11:31:33 -08:00
Eric Traut
f9f4c34b5e
Added new diagnostic check reportUnnecessaryTypeIgnoreComment
that emits a diagnostic when a # type: ignore
comment has no effect.
2022-01-09 11:16:22 -07:00
Eric Traut
17f37a2482
Fixed a typo in the documentation.
2022-01-06 13:02:31 -07:00
Eric Traut
130c1cc055
Changed type guard logic that involves is
operator and literals to be limited to bool
and enum literals. It was making unsafe assumptions for other forms of literals.
2022-01-06 09:13:05 -07:00
Eric Traut
4fe3f1f7c0
Improved type narrowing for x == L
pattern to include x is L
, since they are equivalent. Likewise, extended x.y == L
pattern to include x.y is L
.
2022-01-05 15:19:37 -07:00
Eric Traut
c09480adb7
Updated CI script to make it clear that the latest pyright version should be used.
2022-01-03 17:43:08 -07:00
Eric Traut
d74b89a758
Added support for new type narrowing pattern: len(x) == L
and len(x) != L
where x
is a tuple or union of tuples and L
is a literal integer value.
2022-01-01 13:31:10 -07:00
Eric Traut
046eab4a8d
Added support for bool(x)
type guard.
2021-12-31 14:23:56 -07:00
Eric Traut
2f616204d9
Added documentation for pyright's overload matching algorithm.
2021-12-13 15:00:17 -08:00
Eric Traut
211ebe44dd
Changed class pattern matching behavior to support narrowing of Any
or Unknown
, exempting this case from the general "never narrow Any" rule.
2021-12-12 14:54:59 -08:00
Eric Traut
50b31d533f
Improved documentation.
2021-12-10 00:06:35 -08:00
Eric Traut
c5788d4916
Implemented support for type guards that are based on a local variable that is assigned an expression that narrows the type of the assigned expression. Some limitations apply. For details, refer to https://github.com/microsoft/pyright/blob/main/docs/type-concepts.md#narrowing-based-on-local-variable .
2021-12-09 23:56:44 -08:00
Eric Traut
e267b8adec
Improved handling of x in y
type guard to handle the case where y
is a tuple.
2021-12-08 00:17:46 -08:00
Eric Traut
7e59a19eaa
Updated library guidance doc to clarify point of confusion about import forms.
2021-12-01 08:57:29 -08:00
Eric Traut
28d60e62ae
Updated command-line documentation for consistency.
2021-11-29 22:31:14 -08:00
Jos Verlinde
8d32784230
extend documentation on JSON ( #2635 )
...
copying the information provided as answer to https://github.com/microsoft/pyright/issues/2634
2021-11-29 13:20:41 -08:00
Eric Traut
ed84eb7b36
Changed reportPropertyTypeMismatch to be disabled by default in all diagnostic modes.
2021-11-27 17:08:01 -08:00
Eric Traut
280d95cd80
Updated documentation for reportUnusedVariable.
2021-11-24 16:05:53 -08:00
Elijah K
c70cee87ea
Update configuration.md ( #2519 )
...
Links the description of the `executionEnvironment` option. Would have partially prevented a question in #2518 .
2021-10-30 11:09:25 -07:00
Eric Traut
cc7216e66e
Changed text representation of inferred type of self
and cls
parameters to Self@ClassName
. This is more consistent with the emerging standard for an explicit Self
type.
2021-10-29 21:21:32 -07:00
Eric Traut
ef773d2407
Added "--skipunannotated" option for command-line version of pyright. If specified, pyright skips type analysis of functions and methods that have no parameter or return type annotations. Return types of functions are also never inferred from the function implementation. This matches the default behavior of mypy and allows for more efficient analysis of complex code bases that are only partially annotated.
2021-10-22 23:17:29 -07:00
Eric Traut
3fbb23a5c4
Fixed typo in command-line docs.
2021-10-15 10:01:29 -07:00
Eric Traut
5f0317229c
Updated documentation for pythonPlatform to include "All".
2021-10-15 09:43:28 -07:00
Eric Traut
9976ff0436
Fixed a misleading statement in the documentation about the strict
config setting.
2021-10-14 14:56:49 -07:00
Eric Traut
38bd56b130
Clarified directory for tests
2021-10-12 00:10:29 -07:00
Eric Traut
06c69907fe
Added instructions for running tests.
2021-10-12 00:06:34 -07:00
Eric Traut
1cbb690b11
Added support for new type guard pattern: x[I] is None
and x[I] is not None
where x
is a tuple or union of tuples with known lengths and entry types and I
is an integer.
2021-10-06 22:48:14 -07:00
Eric Traut
ff55b895f9
Added new diagnostic check "reportMissingParameterType" that checks for function and method input parameters that are missing a type annotation.
2021-10-06 21:55:12 -07:00
Eric Traut
6107de9090
Added new "--warnings" command-line option that generates an exit code of 1 if one or more warnings are emitted. By default, only errors generate an exit code of 1.
2021-10-06 20:12:15 -07:00
Eric Traut
dbe41fa4d2
Made a few small improvements to the documentation.
2021-09-26 12:10:05 -07:00
Eric Traut
3fa5299614
Changed code that converts types to textual representation to prepend a tilde ("~") character for the inferred type of a "self" or "cls" parameter.
2021-09-24 20:01:48 -07:00
Eric Traut
14ad02575f
Extended reportCallInDefaultInitializer diagnostic check to disallow list, set or dict expressions in default argument expression.
2021-09-16 21:22:31 -07:00
Eric Traut
9035f64c71
Added reportPrivateImportUsage diagnostic rule, which reports usage of a symbol from a py.typed library that is not intended to be re-exported by the library's author. The rule is on by default in basic type checking mode but can be disabled. Completion provider no longer offers these symbols as completion suggestions.
2021-09-12 01:10:57 -07:00
sasano8
a1ebf82bb8
Ambiguous tuples become as specific as possible. ( #2291 )
...
The rationale is as follows.
>Tuple Expressions
>When inferring the type of a tuple expression (in the absence of bidirectional inference hints), Pyright assumes that the tuple has a fixed length, and each tuple element is >typed as specifically as possible.
```python
# The inferred type is Tuple[Literal[1], Literal["a"], Literal[True]]
var1 = (1, "a", True)
def func1(a: int):
# The inferred type is Tuple[int, int]
var2 = (a, a)
# If you want the type to be Tuple[int, ...]
# (i.e. a homogenous tuple of indeterminate length),
# use a type annotation.
var3: Tuple[int, ...] = (a, a)
```
2021-09-10 12:27:42 -07:00
Kyle Kovacs
ad0e8acf14
Add missing strictSetInference
option to table ( #2263 )
...
The `strictSetInference` row was missing from the Diagnostic Rule Defaults table.
2021-09-03 15:44:28 -07:00
Eric Traut
2202af33a7
Improved readability of docs.
2021-08-30 09:44:14 -07:00
Omer Tuchfeld
9edf6d2d1a
Fix docs/configuration.md misleading case sensitive Pyproject.toml
typo ( #2238 )
...
Creating `Pyproject.toml` as it is currently shown in the docs title will not work,
because the file name is case sensitive. It should be exactly `pyproject.toml`
2021-08-28 07:37:25 -07:00
Denis Eliseev
475a44273c
Update type-concepts.md ( #2230 )
2021-08-26 08:33:12 -07:00
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