Commit Graph

2165 Commits

Author SHA1 Message Date
Jake Bailey
b89504d593
Add python.analysis.autoImportCompletions to control auto-import completions (#917) 2020-08-05 16:00:11 -07:00
Eric Traut
1c396ac436 The token "..." should mean an ellipsis object, not the ellipsis class, when used in a normal expression within a non-stub file. 2020-08-05 15:59:55 -07:00
Eric Traut
b83658bc38 Changed logic for reportUnusedClass and reportUnusedFunction diagnostic rules so they don't report private-named functions and classes within stub files. 2020-08-05 15:22:16 -07:00
Eric Traut
ae74874ed0 Fixed bug that caused imports (and other symbols) to be reported as unaccessed if they were accessed from within code that was deemed to be unreachable (e.g. due to the current platform configuration). 2020-08-05 15:09:44 -07:00
Eric Traut
bae8d1303e Added diagnostic for a module-level __getattr__ function defined in a type stub file when in strict mode. 2020-08-04 22:56:33 -07:00
Eric Traut
109e2dfd71 Added new diagnostic rule "reportInvalidStubStatement" (on by default in strict mode, off otherwise) that reports diagnostics for statements that should not appear within a type stub file. 2020-08-04 22:02:56 -07:00
Eric Traut
77cd54e4d2 Fixed a bug that caused an error to be reported when a newline token was used within an f-string expression. 2020-08-04 14:20:38 -07:00
Eric Traut
7c72278a28 Updated typeshed stubs to the latest versions. 2020-08-04 08:45:23 -07:00
Eric Traut
4ece660c28 Added heuristics to type var solver so it picks the "least complex" solution when considering the elements within a union. 2020-08-03 20:32:20 -07:00
Jake Bailey
3ee506a86b
Use sys.version_info to query interpreter version (#915) 2020-08-03 12:05:13 -07:00
Eric Traut
997fd7d57c More docs improvements. 2020-08-02 14:50:14 -07:00
Eric Traut
c7dfba390d More docs improvements. 2020-08-02 14:48:48 -07:00
Eric Traut
9555cab75f Small code clean-up, no functional change. 2020-08-02 14:20:20 -07:00
Eric Traut
b7ae207558 Small improvements to documentation. 2020-08-02 14:20:07 -07:00
Eric Traut
d7e96540e4 Added new diagnostic message for when "Generic" is used in contexts outside of a class definition statement. 2020-08-02 10:22:36 -07:00
Eric Traut
e9e9de72ce Fixed a bug that caused the wrong diagnostic message string to be used when "Generic" is used with no type arguments. 2020-08-02 10:21:57 -07:00
Eric Traut
5ff393ae20 Fixed a bug "aliased import with leading underscore produces private usage error". 2020-08-01 20:58:50 -07:00
Eric Traut
0394b96ba3 Published 1.1.59 2020-08-01 09:18:43 -07:00
Eric Traut
590312ebc5 On the Windows platform, avoid calling 'python3' to determine the import paths for the current interpreter. This command can sometimes display a dialog indicating that python isn't installed and can be downloaded from the store. 2020-08-01 09:13:47 -07:00
Eric Traut
00b34068ec Fixed a bug whereby a TypeVar in a source type could be conflated with a same-named TypeVar in a dest type when performing TypeVar matching. 2020-08-01 09:10:32 -07:00
Eric Traut
b0e9f1d3d7 Improved the diagnostic message used to report parameter type mismatches when a parameter name isn't known. 2020-08-01 09:09:24 -07:00
Eric Traut
da06e54bd2 Changed type checker to treat "..." as an "Unknown" type when used as the RHS of an assignment statement such as "a = ...". This idiom appears sometimes within type stubs, and it should be treated as a missing (unknown) type so stub authors know that they need to fill in a type annotation. 2020-07-31 19:41:31 -07:00
Eric Traut
cbb38e390e Changed type checker to flag unaccessed symbols within type stubs in some cases. It doesn't mark function parameters or variables as unaccessed, and it doesn't mark imports of the form "from x import y as z" or "import a as b" as unaccessed since those are intended to be re-exports. 2020-07-31 17:37:18 -07:00
Eric Traut
1091ba065e Changed type stub generator to avoid emitting functions and methods that begin with an underscore. 2020-07-31 12:40:31 -07:00
Eric Traut
20584d3eb9 Missed a file. 2020-07-31 12:37:52 -07:00
Eric Traut
6bfdd3100c Changed type stub generator to never generate parameter type annotations based purely on default value types since those can be incorrect or incomplete. Changed type stub generator to automatically add method return types for common magic methods whose return type is always the same. 2020-07-31 12:30:10 -07:00
Eric Traut
2acaac4a0d Code simplification: added accessor functions isModule and isTypeVar. 2020-07-30 22:52:18 -07:00
Eric Traut
a384998542 Code simplification: added accessor function isObject. 2020-07-30 22:44:10 -07:00
Eric Traut
2d0e3eb4c1 Removed code that returns the "organize imports" code action for every position within the file. 2020-07-30 18:53:13 -07:00
Eric Traut
2ade4f0aeb Removed redundant documentation from configuration.md. 2020-07-30 18:52:17 -07:00
Eric Traut
ee55c2c099 Fixed bug where "from .A import A" statement caused symbol "A" to have an inferred type that was a union of a module and other type, even though the other type immediately overwrites the module. 2020-07-30 17:14:28 -07:00
Eric Traut
a0a6ff5367 Fixed a bug where "yield from" argument was assumed to be an "Iterator", but it should really be an "Iterable". 2020-07-30 17:13:08 -07:00
Eric Traut
1d815ef964 Code simplification: added accessor function isClass. 2020-07-30 10:48:16 -07:00
Eric Traut
f2b0ebcb3a Code simplification: added accessor function isUnknown. 2020-07-30 10:02:05 -07:00
Eric Traut
9b6fed4125 Fixed a bug in the handling of position-only parameters with default values followed by named parameters or **kwargs. 2020-07-29 18:44:12 -07:00
Eric Traut
11516186ed Small code improvement — no functional change. 2020-07-29 09:51:38 -07:00
Eric Traut
9e7e6cc8df Changed the inferred type of an async function to use Coroutine rather than Awaitable type. Coroutine is a subclass of Awaitable and is arguably more correct in this case. 2020-07-29 09:25:40 -07:00
Eric Traut
a65343ef87 Published 1.1.58 2020-07-28 15:21:53 -07:00
Eric Traut
90015a3852 Improved bidirectional type inference in the case where the type and the expected type are generic but the expected type is a base class that has been specialized. For example, if the expected type is Mapping[str, int] and the type is a dict. 2020-07-28 14:45:56 -07:00
Eric Traut
14a3851980 Small code cleanup. No functional change. 2020-07-28 14:44:33 -07:00
Eric Traut
d34bc15f7b Fixed bug in logic that handles chained comparisons (e.g. "a < b < c"). The code was not properly handling the case where the left expression was parenthesized (e.g. "(a < b) < c"). 2020-07-28 09:06:38 -07:00
Eric Traut
8b7b5fb1c8 Fixed bug where an f-string expression generated an error if it ended in an equal sign followed by whitespace. The Python 3.8 spec doesn't indicate whether whitespace is allowed here, but clearly the interpreter accepts it. 2020-07-28 08:47:27 -07:00
Eric Traut
ff348b1432 Fixed a bug that caused infinite recursion and a crash when printing the type of a function that refers to itself within its own return type annotation. 2020-07-28 08:32:40 -07:00
Eric Traut
a525ea4ffb Fixed bugs in a few of the "find all references" tests, which were not properly quoting a forward-declared symbol. 2020-07-28 08:32:10 -07:00
Eric Traut
c2c2c51512 Fixed bug that caused "find all references" and "replace symbol" to sometimes miss references to a symbol if they were within quoted type annotations or type comments. 2020-07-28 08:31:29 -07:00
Eric Traut
fdca53a939 Fixed bug that caused duplicate diagnostics to be reported for quoted type annotations in some cases. 2020-07-28 08:28:29 -07:00
Eric Traut
51fd428596 Fixed bug in type checker that resulted in a crash when a function declaration referred to itself within its return type annotation. 2020-07-28 08:25:31 -07:00
Eric Traut
1eac5af6b4 Added strict-mode check for declared return types in type stubs, which don't allow for return type inference. 2020-07-27 21:31:55 -07:00
Eric Traut
63c9b5b691 Fixed a few typos in the inference documentation. 2020-07-27 21:03:20 -07:00
Jake Bailey
77c4908553
Sync from Pylance (#888)
Refactor initialization process to make it overridable.

Rework signature help to use new VS Code / LSP APIs. Function overrides and active parameters are handled much, much better.
2020-07-27 15:34:07 -07:00