1
0
forked from VimPlug/jedi
Commit Graph

64 Commits

Author SHA1 Message Date
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
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
Dave Halter dde40b3a71 Add a comment to clarify the Type case 2020-04-02 00:23:38 +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 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
Dave Halter 656324f686 Disable some more tests for Python 2 2020-03-01 13:30:41 +01:00
Dave Halter 609737322d TypedDict checking should be at a later point 2020-03-01 02:34:38 +01:00
Peter Law bc53dabce3 Make tuple generic parameters work 2020-02-23 13:59:44 +00:00
Sam Roeca 9d2083fa08 Remove argument to filter.values()
Given 87161df2, values(from_instance=False) doesn't produce completions
anymore. Therefore, we remove from_instance as an argument.
2020-02-07 13:38:52 -05:00
Sam Roeca 6a9745b42b Get basic completions working with TypedDict 2020-02-07 13:24:00 -05:00
Dave Halter 87161df2f0 Make sure that typeddict py__getitem__ works 2020-02-07 16:45:03 +01:00
Dave Halter 8eb980db73 Create the basics to work with TypedDict in the future 2020-01-26 19:25:23 +01:00
Dave Halter 095f1295af Avoid a bug that a compiler might have found, fixes #1469 2020-01-11 21:35:39 +01:00
Dave Halter 3ba68b5bc6 Properly convert compiled values to generic classes 2020-01-10 15:09:16 +01:00
Dave Halter 8611fcf8ea Fix some tests 2019-12-27 11:59:40 +01:00
Dave Halter 51e2e90dce Make sure overload checks work for TypeAlias, see #1416 2019-12-20 01:33:41 +01:00
Dave Halter e656a5f18f Make it possible to infer Callable TypeVars, fixes #1449 2019-12-12 23:46:55 +01:00
Dave Halter 28ecc2709a Don't use globals anymore 2019-12-09 00:15:21 +01:00
Dave Halter 33224ae7e1 Remove a duplicate method 2019-12-09 00:11:51 +01:00
Dave Halter 5acbb06315 Refactor so typing uses BaseTypingValueWithGenerics
This makes it finally possible to use type vars with Callable and some other classes.
Fixes #1413
2019-12-08 23:50:57 +01:00
Dave Halter 9eef771ec5 Remove get_index_and_execute and use something else 2019-12-08 22:55:52 +01:00
Dave Halter ad92882c48 Use the generics manager for all the typing classes 2019-12-08 22:42:01 +01:00
Dave Halter c112858a1c Move iter_over_arguments to a separate file 2019-12-08 20:14:15 +01:00
Dave Halter deaa7265dd value_of_index -> context_of_index 2019-12-08 20:09:53 +01:00
Dave Halter aab0002950 Rename two classes to make some things clearer 2019-12-07 15:32:59 +01:00
Dave Halter ddbb87fd1d Make some lines shorter 2019-12-07 15:29:56 +01:00
Dave Halter 48ac0c9421 Move more stuff from gradual/typing.py to gradual/base.py 2019-12-07 15:27:14 +01:00
Dave Halter 37a9d1536c Remove TypingName, it looks like it's not used 2019-12-07 15:12:27 +01:00
Dave Halter 3dbe5c10ae Start splitting up gradual/typing.py 2019-12-07 15:11:50 +01:00
Dave Halter 4bd7c2e627 Remove a TODO that was implemented 2019-12-07 14:56:20 +01:00
Dave Halter 36b800f8d3 Make sure that Tuple autocompletes properly, fixes #1389 2019-12-05 18:55:33 +01:00
Samuel Roeca 761f0828c7 Fix missing inference for typing.Type[typing.TypeVar] (#1448)
* Add Type[TypeVar] support
* Completion tests for typing.Type[typing.TypeVar]
2019-11-27 22:10:58 +01:00
Dave Halter 18ecb5a746 Small rename 2019-08-26 23:34:01 +02:00
Dave Halter 14fc5ed289 Fix more issues with where contexts are used and where values are used 2019-08-20 09:59:10 +02:00
Dave Halter caee8e9952 Fix final gradual typing related issues 2019-08-19 19:43:45 +02:00
Dave Halter b19ba12566 Fix some more context issues 2019-08-19 19:33:12 +02:00