Skip to content

Commit 14f7bd3

Browse files
committed
Fix: resolve internal errors and strict typing issues in Meta validation
1 parent dc76c80 commit 14f7bd3

3 files changed

Lines changed: 376 additions & 161 deletions

File tree

mypy_django_plugin/main.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import itertools
55
import sys
66
from functools import cached_property, partial
7-
from typing import TYPE_CHECKING, Any
7+
from typing import TYPE_CHECKING, Any, cast
88

99
from mypy.build import PRI_MED, PRI_MYPY
1010
from mypy.modulefinder import mypy_path
@@ -326,20 +326,18 @@ def get_dynamic_class_hook(self, fullname: str) -> Callable[[DynamicClassDefCont
326326
if info and info.has_base(fullnames.BASE_MANAGER_CLASS_FULLNAME):
327327
return create_new_manager_class_from_from_queryset_method
328328
return None
329-
330-
@override
331-
def report_config_data(self, ctx: ReportConfigContext) -> dict[str, Any]:
332-
# Cache would be cleared if any settings do change.
333-
extra_data = {
329+
@override
330+
def report_config_data(self, ctx: ReportConfigContext) -> dict[str, Any]:
331+
extra_data: dict[str, Any] = {
334332
"AUTH_USER_MODEL": self.django_context.settings.AUTH_USER_MODEL,
335333
"django_version": importlib.metadata.version("django"),
336-
"django_stubs_version": "5.1.0",
334+
"django_stubs_version": "5.1.0",
337335
}
338-
try:
339-
extra_data["django_stubs_ext_version"] = "5.1.0"
340-
except Exception:
341-
pass
342-
return self.plugin_config.to_json(extra_data)
343-
336+
try:
337+
extra_data["django_stubs_ext_version"] = "5.1.0"
338+
except Exception:
339+
pass
340+
341+
return self.plugin_config.to_json(extra_data)
344342
def plugin(version: str) -> type[NewSemanalDjangoPlugin]:
345-
return NewSemanalDjangoPlugin
343+
return NewSemanalDjangoPlugin

0 commit comments

Comments
 (0)