Fix/ignore a few new Ruff violations

This commit is contained in:
Bruno Alla 2025-06-18 14:09:57 +01:00
parent 32073c059f
commit e9d3dc053a
4 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,3 @@
# ruff: noqa: E501
from .base import * # noqa: F403
from .base import INSTALLED_APPS
from .base import MIDDLEWARE
@ -79,7 +78,7 @@ if env("USE_DOCKER") == "yes":
import socket
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
INTERNAL_IPS += [".".join([*ip.split(".")[:-1], "1"]) for ip in ips]
{%- if cookiecutter.frontend_pipeline in ['Gulp', 'Webpack'] %}
try:
_, _, ips = socket.gethostbyname_ex("node")

View File

@ -10,7 +10,7 @@ def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
try:
from django.core.management import execute_from_command_line
from django.core.management import execute_from_command_line # noqa: PLC0415
except ImportError as exc:
raise ImportError( # noqa: TRY003
"Couldn't import Django. Are you sure it's installed and " # noqa: EM101

View File

@ -10,4 +10,4 @@ class UsersConfig(AppConfig):
def ready(self):
with contextlib.suppress(ImportError):
import {{ cookiecutter.project_slug }}.users.signals # noqa: F401
import {{ cookiecutter.project_slug }}.users.signals # noqa: F401, PLC0415

View File

@ -60,7 +60,7 @@ class TestUserAdmin:
def _force_allauth(self, settings):
settings.DJANGO_ADMIN_FORCE_ALLAUTH = True
# Reload the admin module to apply the setting change
import {{ cookiecutter.project_slug }}.users.admin as users_admin
import {{ cookiecutter.project_slug }}.users.admin as users_admin # noqa: PLC0415
with contextlib.suppress(admin.sites.AlreadyRegistered): # type: ignore[attr-defined]
reload(users_admin)