split helpers into smaller files

This commit is contained in:
Maxim Kurnikov
2019-07-12 15:09:51 +03:00
parent a9c1bcbbc6
commit 9c5a6be9a7
18 changed files with 199 additions and 200 deletions

View File

@@ -1,7 +1,7 @@
from mypy.plugin import ClassDefContext, MethodContext
from mypy.types import CallableType, Instance, NoneTyp, Type, TypeType
from mypy_django_plugin import helpers
from mypy_django_plugin.lib import metadata, helpers
def make_meta_nested_class_inherit_from_any(ctx: ClassDefContext) -> None:
@@ -19,7 +19,7 @@ def extract_proper_type_for_get_form(ctx: MethodContext) -> Type:
form_class_type = helpers.get_argument_type_by_name(ctx, 'form_class')
if form_class_type is None or isinstance(form_class_type, NoneTyp):
# extract from specified form_class in metadata
form_class_fullname = helpers.get_django_metadata(object_type.type).get('form_class', None)
form_class_fullname = metadata.get_django_metadata(object_type.type).get('form_class', None)
if not form_class_fullname:
return ctx.default_return_type
@@ -39,7 +39,7 @@ def extract_proper_type_for_get_form_class(ctx: MethodContext) -> Type:
if not isinstance(object_type, Instance):
return ctx.default_return_type
form_class_fullname = helpers.get_django_metadata(object_type.type).get('form_class', None)
form_class_fullname = metadata.get_django_metadata(object_type.type).get('form_class', None)
if not form_class_fullname:
return ctx.default_return_type