Dave Halter
21f1df18b6
Fix some issues with sub class matching, fixes #1560
2020-06-14 18:10:00 +02:00
Dave Halter
df7dd026d2
Make it possible to use inheritance on generics without always specifying type vars, see also discussion in #1593
2020-06-10 09:54:32 +02:00
Dave Halter
cd3d40a3b8
Fix a small issue
2020-05-16 15:42:15 +02:00
Dave Halter
0db50b521d
Fix an issue with Tuple generics
2020-05-16 14:55:59 +02:00
Dave Halter
9942a3d44c
A few class renames
2020-05-16 14:35:15 +02:00
Peter Law
43806f8668
Add support for generic optional parameters ( #1559 )
...
* Add support for generic optional parameters
* Tests for passing non-optional arguments to optional parameters
* Remove now-redundant is_class_value handling
This parameter has since been removed from infer_type_vars methods,
much simplifying the code.
2020-05-15 19:56:03 +02:00
Dave Halter
3104443212
Merge pull request #1579 from muffinmad/pseudotreenameclass
...
Return 'class' as _PseudoTreeNameClass.type (fix #1578 )
2020-05-13 18:59:05 +02:00
muffinmad
7cd89cff6e
Return 'class' as BaseName.type of _PseudoTreeNameClass ( fix #1578 )
2020-05-12 23:14:32 +03:00
Dave Halter
e6e43413ff
Any -> AnyClass
2020-05-10 03:17:52 +02:00
Dave Halter
e9a0c01af8
TypedDictBase -> TypedDictClass
2020-05-10 03:17:07 +02:00
Dave Halter
d0270b5e59
DefineGenericBase -> DefineGenericBaseClass
2020-05-10 03:07:40 +02:00
Dave Halter
b57654aed3
Rename some classes to make it clearer that they are classes
2020-05-10 03:04:52 +02:00
Dave Halter
78ad06612e
Remove an unused import
2020-05-10 03:00:47 +02:00
Dave Halter
434866558a
Instances should not need get_generics
2020-05-10 02:59:54 +02:00
Dave Halter
42963a0e03
By having get_annotated_class_object for Tuple/Callable, some details are not necessary anymore
2020-05-10 02:52:42 +02:00
Dave Halter
c2d1da09cb
Make sure that Tuple/Callable instances have the correct py__class__
2020-05-10 01:05:55 +02:00
Dave Halter
f362932ec5
Return a more correct py__class__ for typing base objects
2020-05-09 16:28:05 +02:00
Dave Halter
3b48c76e4a
Make a function private
2020-05-09 00:49:37 +02:00
Dave Halter
d56f607f35
Reinstate an if that was deleted by mistake
2020-05-09 00:13:18 +02:00
Dave Halter
39a2cd8aa2
Fix a potential issue with tuples
2020-05-08 18:07:15 +02:00
Dave Halter
14ca8e6499
Add a comment
2020-05-08 18:00:35 +02:00
Dave Halter
2a227dcc7a
Remove is_class_value from infer_type_vars
2020-05-08 17:49:02 +02:00
Peter Law
55facaaf3d
Switch back to using execute_annotation
...
get_annotated_class_object is (sort-of) the inverse of execute_annotation,
so adding a get_annotated_class_object to implement execute_annotation
specifically for Tuples didn't make much sense.
2020-04-26 14:39:39 +01:00
Peter Law
17ca3a620f
Merge branch 'master' into fix-nested-tuple-argument
2020-04-26 13:56:14 +01:00
Peter Law
612fd23777
Support accessing the py__class__ of a NewType
...
The test here is a bit contrived, the actual place I found this
was in using a NewType as a type within a NamedTuple. However due
to https://github.com/davidhalter/jedi/issues/1560 that currently
also fails for other reasons. This still feels useful to fix on
its own though.
2020-04-26 00:59:07 +01:00
Dave Halter
dca505c884
Merge pull request #1553 from PeterJCLaw/generic-tuple-return
...
Fix construction of nested generic tuple return types
2020-04-26 01:28:51 +02:00
Dave Halter
6bff30fbbb
Include Django stubs as a third party repo
2020-04-25 22:55:29 +02:00
Peter Law
c19c13e2c6
Apply tuple-only filtering to apply more broadly
2020-04-24 16:44:25 +01:00
Peter Law
891383f8dc
Use get_annotated_class_object over execute_annotation
2020-04-24 16:32:00 +01:00
Peter Law
ce1ac38cde
Implement get_annotated_class_object for Tuples
2020-04-24 16:25:19 +01:00
Peter Law
343a10d491
Drop redundant blank line
2020-04-19 14:42:57 +01:00
Peter Law
72c52f5f15
Add type match guard
2020-04-19 14:29:44 +01:00
Peter Law
cfa01d3ac5
Add handling of nested generic tuples
2020-04-19 14:10:03 +01:00
Peter Law
f8e7447d35
Add handling of nested generic callables
...
Previously tests for these were passing somewhat by accident,
however this commit's parent adds a case which showed that the
handling was missing.
Note that this also relies on the recent fix for nested tuples
which changed the `isinstance` check in `define_generics`.
2020-04-19 13:27:06 +01:00
Peter Law
1c4a2edbdb
Fix construction of nested generic tuple return types
...
Unfortunately this appears to show up a separate bug.
2020-04-18 19:43:47 +01:00
Dave Halter
c3fc129695
Fix a small issue
2020-04-12 00:54:31 +02:00
Dave Halter
02c3d651bd
Some more code quality fixes
2020-04-11 02:23:23 +02:00
Dave Halter
bdd4deedc1
Some code cleanups
2020-04-11 02:11:52 +02:00
Dave Halter
61e9371849
Fix a potential AttributeError
2020-04-02 00:32:50 +02:00
Dave Halter
dde40b3a71
Add a comment to clarify the Type case
2020-04-02 00:23:38 +02:00
Dave Halter
ebb2786748
Avoid AttributeErrors for generics when a module is passed
2020-04-01 01:59:13 +02:00
Dave Halter
28f256d2a6
Merge branch 'improve-type-annotation-inference-refactors' of https://github.com/PeterJCLaw/jedi
2020-04-01 00:54:25 +02:00
Dave Halter
883f5a3824
Merge branch 'improve-type-annotation-inference' of https://github.com/PeterJCLaw/jedi
2020-04-01 00:54:13 +02:00
Peter Law
eac5ac8426
Update comment after refactor moved code
2020-03-25 22:35:12 +00:00
Peter Law
e2090772f3
Push tuple handling onto Tuple class
...
This resolves a TODO to avoid using a private method
2020-03-22 16:04:39 +00:00
Peter Law
525b88e9f1
Simplify early-exit code by having it once
2020-03-22 15:49:31 +00:00
Peter Law
3c90a84f68
Extract common get_generics() calls
...
These no longer need to be guarded by the conditions now that we
know these types are generic anyway.
2020-03-22 15:47:46 +00:00
Peter Law
ea33db388b
Remove dict merging where it doesn't do anything
...
These cases are all at the end of a single-path branch that ends
up "merging" against an empty mapping which is then returned
unchanged.
2020-03-22 15:45:18 +00:00
Peter Law
f68d65ed59
Push much looping and merging of infering type vars into ValueSet
2020-03-22 15:29:11 +00:00
Peter Law
3c7621049c
Extract annotation inference onto annotation classes
...
This removes the _infer_type_vars util in favour of a polymorphic
implementation, removing the conditional checks on the type of
the annotation instance.
While for the moment this creates some circular imports, further
refactoring to follow should be able to remove those.
2020-03-22 15:29:11 +00:00