Commit Graph
4610 Commits
Author SHA1 Message Date
Rohan Joyce 85659912d0 py/resolve: consider all candidate module paths 2018-02-08 18:15:28 +03:00
Ilya.Kazakevich 0d34341283 Test moved to staging 2018-02-08 18:11:47 +03:00
Ilya.Kazakevich d54baa1c84 Django tests moved to JUnit4
To use Assume we need to be JUnit4 based, so DjangoTestCase does not inherit TestCase anymore
2018-02-08 01:47:43 +03:00
Ilya.Kazakevich 3eb34429eb leaked test moved to staging 2018-02-08 01:24:07 +03:00
Dmitry Trofimov e15aa54336 Don't inherit PYTHONPATH if parent envs disabled (PY-19218) 2018-02-07 20:35:03 +01:00
Semyon Proshev 57e8c38989 Reduce unstubbing while processing instance level declarations (PY-27863)
Stub->AST switch happened when passed location was inside unstubbed file.
2018-02-07 21:15:42 +03:00
Anna.Kozlova 48d3ce215c make private fields final 2018-02-07 09:44:30 +01:00
Elizaveta Shashkova 79cc4d9ef4 Support for typing.NewType (PY-21302) 2018-02-06 20:24:29 +03:00
Mikhail Golubev 294a18a2ac PY-16412 Properly import TypeVars from other files for type hints 2018-02-05 21:41:59 +03:00
Mikhail Golubev af64e90b62 PY-16412 Properly import named tuples for their use in type hints
For that I introduced a new method -- getElement() in PyType
that allows to find out the element that can be used to reference
this type according to PEP 484 perspective, e.g. a target assignment
for TypeVar's and NamedTuples and PSI class themselves for class types.

Also, class object types for named tuples are wrapped in typing.Type[]
as expected.
2018-02-05 21:41:59 +03:00
Mikhail Golubev d1ae008593 PY-16412 Fixed handling of callable types in the intention
by adding an alternative implementation of TypeVisitor that strives
to render a type in PEP 484 compatible format.
2018-02-05 21:41:59 +03:00
Mikhail Golubev b7ebc74682 PY-27392 Better names of intentions for functions and variable type hints
Now it's possible to distinguish between them when both are offered
on a target of a call expression result assignment (as it was noticed
during the testing of PY-16412).
2018-02-05 21:41:59 +03:00
Mikhail Golubev 149eefa75e PY-16412 Proper use of a smart pointer in case of malformed annotations
Namely, it was mistakenly dereferenced before the document was
committed after modifications.

Callable types are still not rendered properly in PEP 484 compatible
format, but at least they don't lead to PIEAE anymore.
2018-02-05 21:41:59 +03:00
Mikhail Golubev eedca22cbb PY-16412 Prohibit annotations for structural types
since they cannot be expression in PEP 484 compatible format (yet).
2018-02-05 21:41:59 +03:00
Mikhail Golubev 7af0d59f92 PY-16412 Add a test on absence of import for a class in the same module 2018-02-05 21:41:59 +03:00
Mikhail Golubev 352fc7fdc7 PY-16412 Rename negative tests for consistency 2018-02-05 21:41:59 +03:00
Mikhail Golubev 28e74fcc04 PY-16412 Import Tuple for parametrized types of tuples 2018-02-05 21:41:59 +03:00
Mikhail Golubev f27611869f PY-16412 Handle mapping of builtin collections to special types from typing 2018-02-05 21:41:59 +03:00
Mikhail Golubev 034f409a6a PY-16412 Import Type for annotations containing types of class objects 2018-02-05 21:41:59 +03:00
Mikhail Golubev 7c5c6d1a7e PY-16412 Suggest the intention when the caret is at the identifier's end 2018-02-05 21:41:59 +03:00
Mikhail Golubev 8c904faac4 PY-16412 Handle augmented assignments in the intention
by resolving them further to the corresponding target expressions.
2018-02-05 21:41:59 +03:00
Mikhail Golubev 25710b0fe1 PY-16412 Fix NPE when a target expression is annotated with explicit Any 2018-02-05 21:41:59 +03:00
Mikhail Golubev d46e5f07c0 PY-16412 Add tests on import of necessary classes and symbols from typing 2018-02-05 21:41:59 +03:00
Mikhail Golubev bf5a0dd8b1 PY-16412 Add annotations and type comments to existing class-level definitions
for instance attributes
2018-02-05 21:41:59 +03:00
Mikhail Golubev 3c74966e95 PY-16412 Support type hints for instance attributes using type comments 2018-02-05 21:41:59 +03:00
Mikhail Golubev 1d71f182c1 PY-16412 Support type hints for instance attributes using annotations 2018-02-05 21:41:59 +03:00
Mikhail Golubev af24ba5f20 PY-16412 Detect presence of type annotations for variables purely syntactically
Namely, if there is any PEP 526 variable type annotation or a comment
that starts with "# type:", don't suggest the intention regardless
of whether the type hint itself is well-formed, properly resolved, etc.
2018-02-05 21:41:59 +03:00
Mikhail Golubev 209eadd7ee PY-16412 Combine type comments with normal ones if it's necessary 2018-02-05 21:41:59 +03:00
Mikhail Golubev e488dcd690 PY-16412 A more complex case of a type comment for unpacked assignment target 2018-02-05 21:41:59 +03:00
Mikhail Golubev 085c4e063a PY-16412 Don't allow to unstub external files to check if target is inside a comprehension 2018-02-05 21:41:59 +03:00
Mikhail Golubev fc3d1b7beb PY-16412 Don't suggest the intention for targets that doesn't allow annotations 2018-02-05 21:41:59 +03:00
Mikhail Golubev ec50917ab3 PY-16412 Generate type hints in type comments for variables
Cases with unpacking are still unsupported, though.
2018-02-05 21:41:59 +03:00
Mikhail Golubev 54574eac34 PY-16412 Extract common logic for generation of variable annotations 2018-02-05 21:41:59 +03:00
Mikhail Golubev 0cb6c91134 PY-16412 Start working on the intention to generate variable annotations 2018-02-05 21:41:59 +03:00
Semyon Proshev af70662e8d "Inherit" typing.Generic and Protocol from object (PY-26628)
Generic(s) or Protocol(s) inheritor has `object` in mro in runtime
2018-02-05 20:58:32 +03:00
Semyon Proshev cb24e8ad55 Support typing_extensions.Protocol (PY-26628) 2018-02-05 20:58:32 +03:00
Semyon Proshev 126d8b1bf3 Highlight instance and class checks on non-runtime protocols (PY-26628) 2018-02-05 20:58:31 +03:00
Semyon Proshev c39f05ad55 Highlight protocol usage as a base for typing.NewType (PY-26628) 2018-02-05 20:58:31 +03:00
Semyon Proshev 233549dd73 Inspect protocol bases (PY-26628) 2018-02-05 20:58:30 +03:00
Semyon Proshev 6b3f10f5e5 Update abstract class inspection to correctly process protocols (PY-26628) 2018-02-05 20:58:30 +03:00
Semyon Proshev 68a7b6040e Inspect protocol subclass types (PY-26628) 2018-02-05 20:58:30 +03:00
Semyon Proshev 6fa83614d4 Implement matching types against protocol definitions (PY-26628) 2018-02-05 20:58:29 +03:00
Semyon Proshev 5eecc4b814 Implement matching types against protocols (PY-26628)
Update PyTypeChecker to prevent recursion while matching types.
SOE was received while matching `self` parameters for methods inside protocol and other class.
2018-02-05 20:58:29 +03:00
Elizaveta Shashkova 91044050b0 Support in-place modifications for dict, list and set (PY-1182) 2018-02-05 19:30:26 +03:00
Lada Gagina cedb7bda67 Initial implementation of lists type inference (PY-1182) 2018-02-05 19:30:26 +03:00
Semyon Proshev 6a09e252eb Support __class_getitem__ (PY-27913)
Update resolve for `[]` on definitions so `__class_getitem__` is supported.
Support this method (and `__mro_entries__`) in highlighting and completion.
Process it as a static method.
2018-02-05 18:29:15 +03:00
Semyon Proshev d431a156cd Update provided type for typing.Callable (PY-28177)
Use custom type inheriting class-like type to suppress `Callable[...]` warnings.
Remove some checks against `Callable` in type checker because they are processed below when matching callable types.
Update custom type to detemine ability to call from the name as well.
2018-02-05 17:19:47 +03:00
Ilya.Kazakevich 47550347e4 Killing thread to workaround LiteXmlRpcTransport infinite loop bug 2018-02-02 18:18:24 +03:00
Ilya.Kazakevich 02aef8e8af Killing thread to workaround LiteXmlRpcTransport infinite loop bug 2018-02-02 18:15:06 +03:00
Ilya.Kazakevich 92044617b8 test moved to staging: thread leak 2018-02-02 05:26:21 +03:00