mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 12:44:29 +08:00
enable some test folders, bunch of fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from mypy.plugin import FunctionContext
|
||||
from mypy.types import Type
|
||||
from mypy.types import Type, Instance
|
||||
|
||||
|
||||
def determine_type_of_array_field(ctx: FunctionContext) -> Type:
|
||||
@@ -7,5 +7,13 @@ def determine_type_of_array_field(ctx: FunctionContext) -> Type:
|
||||
return ctx.default_return_type
|
||||
|
||||
base_field_arg_type = ctx.arg_types[ctx.callee_arg_names.index('base_field')][0]
|
||||
if not isinstance(base_field_arg_type, Instance):
|
||||
return ctx.default_return_type
|
||||
|
||||
get_method = base_field_arg_type.type.get_method('__get__')
|
||||
if not get_method:
|
||||
# not a method
|
||||
return ctx.default_return_type
|
||||
|
||||
return ctx.api.named_generic_type(ctx.context.callee.fullname,
|
||||
args=[base_field_arg_type.type.names['__get__'].type.ret_type])
|
||||
args=[get_method.type.ret_type])
|
||||
|
||||
Reference in New Issue
Block a user