mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-13 23:41:55 +08:00
15 lines
519 B
Python
15 lines
519 B
Python
from mypy.plugin import FunctionContext
|
|
from mypy.types import Type
|
|
|
|
from mypy_django_plugin import helpers
|
|
|
|
|
|
def determine_type_of_array_field(ctx: FunctionContext) -> Type:
|
|
signature = helpers.get_call_signature_or_none(ctx)
|
|
if signature is None:
|
|
return ctx.default_return_type
|
|
|
|
_, base_field_arg_type = signature['base_field']
|
|
return ctx.api.named_generic_type(ctx.context.callee.fullname,
|
|
args=[base_field_arg_type.type.names['__get__'].type.ret_type])
|