Files
django-stubs/mypy_django_plugin/plugins/postgres_fields.py
Maxim Kurnikov f59cfe6371 latest changes
2018-11-26 23:58:34 +03:00

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])