Commit Graph

1091 Commits

Author SHA1 Message Date
Peter Law
5184d0cb9c Support passing values through decorators from factories
This builds on the approach taken in https://github.com/davidhalter/jedi/pull/1613
but applies it to type vars themselves so that their type var
nature is preserved when a function returns Callable[[T], T] and
the T has an upper bound.
2020-06-26 11:22:19 +01:00
Peter Law
2d0258db1a Add tests for class-style decorator factories 2020-06-26 11:19:51 +01:00
Dave Halter
a3410f124a Make sure that Callables are properly represented
See also comment of https://github.com/davidhalter/jedi/pull/1614#issuecomment-647054740
2020-06-21 01:31:58 +02:00
Dave Halter
1872ad311b Fix decorator param completion 2020-06-15 00:34:55 +02:00
Dave Halter
364d33119c Merge branch 'django' 2020-06-14 22:24:31 +02:00
Dave Halter
4ab35cac7b Merge branch 'master' of github.com:davidhalter/jedi 2020-06-14 18:11:50 +02:00
Dave Halter
21f1df18b6 Fix some issues with sub class matching, fixes #1560 2020-06-14 18:10:00 +02:00
Peter Law
4f11f20e1d Add a signature check for decorated functions
Specifically where the decorator is type annotated.
2020-06-14 16:24:42 +01:00
Peter Law
1f082b69d2 Handle passing functions and classes through a TypeVar
This fixes #1425 and #1607 by persisting the original underlying
function or class when we process a TypeVar they are passed into.
2020-06-13 23:28:20 +01:00
Dave Halter
9de5ab2037 Make it possible to complete on QuerySet methods, fixes #1587 2020-06-13 20:55:37 +02:00
Dave Halter
3415ccbb73 Add support for Django signatures, fixes parts of #1587 2020-06-13 16:18:47 +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
a2108de2c0 Use py__get__ for Django Model.objects
This includes the fix in https://github.com/typeddjango/django-stubs/pull/394
2020-06-09 23:26:43 +02:00
Dave Halter
9adcf3d233 Make sure meta class filters can distinguish between classes and instances 2020-06-07 14:54:26 +02:00
Dave Halter
105c097fea Merge branch 'django-custom-object-manager' of https://github.com/PeterJCLaw/jedi into django 2020-06-06 01:24:24 +02:00
Dave Halter
574b790296 Make it possible to use inheritance on generics without always specifying type vars, see also discussion in #1593 2020-06-06 01:23:14 +02:00
Peter Law
c62cbd6654 Explicitly handle a not in b operator comparison
This avoids a `KeyError` from operator_to_magic_method lookup for
this case. Jedi probably could check for `__contains__` here, however
as it doesn't do so for `in` checks I'm following that lead for now.

Fixes https://github.com/davidhalter/jedi/issues/1594.
2020-05-23 12:49:53 +01:00
Peter Law
c36904d983 Support custom managers in Django models
For the moment this support is limited to just Model.objects
replacements and does not use the custom manager for ForeignKey
related managers.
2020-05-22 12:33:03 +01:00
Peter Law
669b70b2cd Validate instance methods on Django models 2020-05-22 12:32:14 +01:00
Peter Law
b7cdec427e Support OneToOneFields 2020-05-18 22:19:20 +01:00
Peter Law
df66b35444 Support UUIDFields 2020-05-18 22:11:31 +01:00
Peter Law
cd9f2f31ea Support URLFields 2020-05-18 22:10:48 +01:00
Peter Law
b54d7433c7 Support GenericIPAddressFields 2020-05-18 22:10:09 +01:00
Dave Halter
d16355fcf2 Fix tests in Python 2 2020-05-16 17:47:33 +02:00
Dave Halter
b3fc10a6e4 Magic methods fixes for reverse methods 2020-05-16 15:39:48 +02:00
Dave Halter
0db50b521d Fix an issue with Tuple generics 2020-05-16 14:55:59 +02:00
Dave Halter
41c146a6f3 Implement magic method return values, fixes #1577 2020-05-15 23:53:44 +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
0caee73975 Merge pull request #1572 from davidhalter/classvar
Remove is_class_value from infer_type_vars
2020-05-12 23:56:03 +02:00
Dave Halter
6dbc5e783e Fix argument clinic unpacking, remove dynamic bullshit 2020-05-10 13:27:20 +02:00
Dave Halter
bf4ec2282f Fix getattr completions on very weird cases, fixes #1573 2020-05-10 11:37:58 +02:00
Dave Halter
c2d1da09cb Make sure that Tuple/Callable instances have the correct py__class__ 2020-05-10 01:05:55 +02: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
a3a147f028 Make sure that Django's values/values_list is tested (though not implemented 2020-04-25 22:55:29 +02:00
Dave Halter
c761dded35 Properly implement inheritance for Django models 2020-04-25 22:55:29 +02:00
Dave Halter
92623232c3 Make sure Django User inference works 2020-04-25 22:55:29 +02:00
Dave Halter
bf8b58aeeb Some more django query tests 2020-04-25 22:55:29 +02:00
Dave Halter
f6803bce2c Infer many to many fields 2020-04-25 22:55:29 +02:00
Dave Halter
6bff30fbbb Include Django stubs as a third party repo 2020-04-25 22:55:29 +02:00
Dave Halter
6d927d502e Make sure that infering the Django User model works 2020-04-25 22:55:29 +02:00
Dave Halter
2e1284f044 Fix a recursion error issue 2020-04-25 22:55:29 +02:00
Peter Law
df951733cd Rename variable to placate mypy 2020-04-24 12:45:05 +01:00
Dave Halter
f3eaa418bb Work with a NameWrapper, so Django goto works better 2020-04-22 09:32:39 +02:00
Dave Halter
f9176578ea Fix another django modelfield issue 2020-04-22 00:54:43 +02:00
Dave Halter
7756792bba Fix another issue with foreign keys 2020-04-22 00:33:51 +02:00
Dave Halter
ba4e3393d3 Fix ForeignKey issues with invalid values 2020-04-22 00:27:06 +02:00
Dave Halter
df307b8eda Refactor a few things for django 2020-04-22 00:05:35 +02:00
Dave Halter
d96887b102 Remove old third party django tests 2020-04-21 23:43:59 +02:00