Skip to content

Commit ec3bcf6

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 8196b1f commit ec3bcf6

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

pylint_django/checkers/foreign_key_strings.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -101,30 +101,23 @@ def open(self):
101101
try:
102102
import django # pylint: disable=import-outside-toplevel
103103

104-
if (
105-
os.environ.get("DJANGO_SETTINGS_MODULE") is None
106-
or os.environ.get("DJANGO_CONFIGURATION") is None
107-
):
104+
if os.environ.get("DJANGO_SETTINGS_MODULE") is None or os.environ.get("DJANGO_CONFIGURATION") is None:
108105
try:
109106
os.environ.setdefault(
110107
"DJANGO_SETTINGS_MODULE",
111-
os.environ.get("DJANGO_SETTINGS_MODULE")
112-
or self.config.django_settings_module,
108+
os.environ.get("DJANGO_SETTINGS_MODULE") or self.config.django_settings_module,
113109
)
114110
os.environ.setdefault(
115111
"DJANGO_CONFIGURATION",
116-
os.environ.get("DJANGO_CONFIGURATION")
117-
or self.config.django_configuration,
112+
os.environ.get("DJANGO_CONFIGURATION") or self.config.django_configuration,
118113
)
119114
except TypeError as ex:
120115
missing_module = ""
121116
if self.config.django_settings_module is None:
122117
missing_module = "DJANGO_SETTINGS_MODULE"
123118
else:
124119
missing_module = "DJANGO_CONFIGURATION"
125-
raise RuntimeError(
126-
f"{missing_module} required to initialize Django project settings"
127-
) from ex
120+
raise RuntimeError(f"{missing_module} required to initialize Django project settings") from ex
128121
importer.install()
129122

130123
django.setup()

0 commit comments

Comments
 (0)