Skip to content

Commit 30a12c8

Browse files
Increase priority of mypy internal Django settings import (#8)
Co-authored-by: Marti Raudsepp <[email protected]>
1 parent d2604b1 commit 30a12c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mypy_django_plugin/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from functools import partial
44
from typing import Any, Callable, Dict, List, Optional, Tuple, Type
55

6-
from mypy.build import PRI_MYPY
6+
from mypy.build import PRI_HIGH, PRI_MYPY
77
from mypy.modulefinder import mypy_path
88
from mypy.nodes import MypyFile, TypeInfo
99
from mypy.options import Options
@@ -99,14 +99,14 @@ def _get_typeinfo_or_none(self, class_name: str) -> Optional[TypeInfo]:
9999
return sym.node
100100
return None
101101

102-
def _new_dependency(self, module: str) -> Tuple[int, str, int]:
102+
def _new_dependency(self, module: str, priority: int = PRI_MYPY) -> Tuple[int, str, int]:
103103
fake_lineno = -1
104-
return (PRI_MYPY, module, fake_lineno)
104+
return (priority, module, fake_lineno)
105105

106106
def get_additional_deps(self, file: MypyFile) -> List[Tuple[int, str, int]]:
107107
# for settings
108108
if file.fullname == "django.conf" and self.django_context.django_settings_module:
109-
return [self._new_dependency(self.django_context.django_settings_module)]
109+
return [self._new_dependency(self.django_context.django_settings_module, PRI_HIGH)]
110110

111111
# for values / values_list
112112
if file.fullname == "django.db.models":

0 commit comments

Comments
 (0)