mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 12:44:29 +08:00
12 lines
464 B
Python
12 lines
464 B
Python
from mypy.plugin import FunctionContext
|
|
from mypy.types import Type
|
|
|
|
|
|
def determine_type_of_array_field(ctx: FunctionContext) -> Type:
|
|
if 'base_field' not in ctx.arg_names:
|
|
return ctx.default_return_type
|
|
|
|
base_field_arg_type = ctx.arg_types[ctx.arg_names.index('base_field')][0]
|
|
return ctx.api.named_generic_type(ctx.context.callee.fullname,
|
|
args=[base_field_arg_type.type.names['__get__'].type.ret_type])
|