1
0
forked from VimPlug/jedi
Commit Graph

158 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
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
Peter Law dd60a8a4c9 Extract nested function which is going to be used elsewhere 2020-03-22 15:20:58 +00:00
Peter Law 5bd6a9c164 Rename function which is going to be used elsewhere 2020-03-22 15:18:41 +00:00
Peter Law c743e5d9f3 Push type check into helper 2020-03-22 15:14:01 +00:00
Peter Law 5ca69458d4 Add testing for mismatch cases
This should help catch any errors in our handling of invalid cases.
While some of these produce outputs which aren't correct, what
we're checking here is that we don't _error_ while producing that
output.

Also fix a case which this showed up.
2020-03-22 15:10:43 +00:00
Dave Halter a2f4d1bbe7 Fix stub conversion for Decoratee, so docstrings work, see #117 2020-03-21 17:23:27 +01:00
Dave Halter 8000d425ec Don't use desc_with_module in integration tests 2020-03-21 01:47:00 +01:00
Peter Law 0f8e7b453e Formatting 2020-03-18 22:12:21 +00:00
Dave Halter 6220b20659 "Document" stubs for develops 2020-03-16 00:19:08 +01:00
Dave Halter 10bc578bfe Merge branch 'master' into refactor 2020-03-13 23:53:09 +01:00
Peter Law da9d312185 Remove redundant attribute check 2020-03-12 22:06:13 +00:00
Dave Halter d574162da3 Fix namedtuple docstring/signature issues, fixes #1506 2020-03-10 20:07:10 +01:00
Dave Halter 0aa1ef6639 Move an import to the top 2020-03-10 09:36:45 +01:00
Dave Halter 33c61b8708 Make a method public 2020-03-10 09:35:03 +01:00
Dave Halter cf3d83ee4f Don't mix up caches for stubs and python files 2020-03-09 17:48:36 +01:00
Peter Law b198434694 Remove resolved TODO
The common logic this refers to has now been extracted (see 95cec459)
and the remaining checks are specific to tuple handling.
2020-03-07 20:29:14 +00:00
Peter Law d06efd0dd1 Push fetching of generics into nested function
This slightly simplifies both the calling code and semantics of
the nested function.
2020-03-07 18:09:20 +00:00
Peter Law 96132587b7 Clarify generic tuple inference
This hoist a loop invariant conditional check outside the loop
making it clearer and one branch more obviously similar to the
general type handling.
2020-03-07 17:35:29 +00:00
Peter Law 5d273f4630 Explain these branches 2020-03-07 17:35:03 +00:00
Peter Law 95cec459a8 Extract nested function for common pattern
This slightly simplifies the code, as well as providing a place
to put an explanation of what the moved block of code does.
2020-03-07 17:06:22 +00:00
Peter Law 3b4fa2aa9c Clarify variable name 2020-03-07 16:32:38 +00:00
Peter Law 54e29eede1 Add explanation of the parameters to _infer_type_vars 2020-03-07 16:31:12 +00:00
Dave Halter 656324f686 Disable some more tests for Python 2 2020-03-01 13:30:41 +01:00