chore: ignore rest of ruff warnings
This commit is contained in:
6 files changed
+14
-14
No files matched your search
+4
-4
@@ -3,7 +3,7 @@ import logging
|
||||
import requests
|
||||
from django.conf import settings
|
||||
from requests.auth import HTTPBasicAuth
|
||||
from requests.exceptions import ConnectionError
|
||||
from requests.exceptions import ConnectionError # noqa: A004
|
||||
from rest_framework import exceptions, status
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -41,7 +41,7 @@ class DjangoPostfixDovecotAPI:
|
||||
url = f"{self.base_url}{path}"
|
||||
|
||||
try:
|
||||
r = requests.request(
|
||||
r = requests.request( # noqa: S113
|
||||
method,
|
||||
url,
|
||||
params=params,
|
||||
@@ -52,7 +52,7 @@ class DjangoPostfixDovecotAPI:
|
||||
except ConnectionError as e:
|
||||
msg = f"mxapi at {url} unavailable {e!s}"
|
||||
logger.warning(msg)
|
||||
raise DPDAPIException(status_code=status.HTTP_503_SERVICE_UNAVAILABLE, detail={"error": msg})
|
||||
raise DPDAPIException(status_code=status.HTTP_503_SERVICE_UNAVAILABLE, detail={"error": msg}) # noqa: B904
|
||||
|
||||
try:
|
||||
r.raise_for_status()
|
||||
@@ -61,7 +61,7 @@ class DjangoPostfixDovecotAPI:
|
||||
try:
|
||||
raise DPDAPIException(status_code=e.response.status_code, detail=e.response.json())
|
||||
except ValueError:
|
||||
raise DPDAPIException(status_code=e.response.status_code, detail="mxapi fatal error")
|
||||
raise DPDAPIException(status_code=e.response.status_code, detail="mxapi fatal error") # noqa: B904
|
||||
|
||||
try:
|
||||
ret = r.json()
|
||||
|
||||
@@ -2,7 +2,7 @@ import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def normalize_prefixes(apps, schema_editor):
|
||||
def normalize_prefixes(apps, schema_editor): # noqa: ARG001
|
||||
Prefix = apps.get_model("mailadmin", "Prefix")
|
||||
OrgUnit = apps.get_model("mailadmin", "OrgUnit")
|
||||
|
||||
|
||||
+5
-5
@@ -6,7 +6,7 @@ class OrgUnit(models.Model):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
name = models.CharField(max_length=500)
|
||||
name = models.CharField(max_length=500) # noqa: DJ012
|
||||
is_active = models.BooleanField(default=True)
|
||||
admin_groups = models.ManyToManyField(Group, blank=True, related_name="admin_orgunits")
|
||||
member_groups = models.ManyToManyField(Group, blank=True, related_name="member_orgunits")
|
||||
@@ -14,7 +14,7 @@ class OrgUnit(models.Model):
|
||||
update = models.DateTimeField(auto_now=True)
|
||||
inside_id = models.IntegerField(null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
class Meta: # noqa: DJ012
|
||||
ordering = ["name"]
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@ class Prefix(models.Model):
|
||||
def __str__(self):
|
||||
return self.name or ""
|
||||
|
||||
name = models.CharField(max_length=500, blank=True, null=True)
|
||||
name = models.CharField(max_length=500, blank=True, null=True) # noqa: DJ001, DJ012
|
||||
orgunit = models.ForeignKey("mailadmin.OrgUnit", models.CASCADE, related_name="prefixes")
|
||||
|
||||
objects = PrefixQueryset.as_manager()
|
||||
objects = PrefixQueryset.as_manager() # noqa: DJ012
|
||||
|
||||
class Meta:
|
||||
class Meta: # noqa: DJ012
|
||||
verbose_name_plural = "prefixes"
|
||||
@@ -9,7 +9,7 @@ class SourcePrefixOwner(permissions.BasePermission):
|
||||
"""Ref: http://www.django-rest-framework.org/api-guide/permissions"""
|
||||
|
||||
def has_permission(self, request, view):
|
||||
assert hasattr(view, "user_prefixes")
|
||||
assert hasattr(view, "user_prefixes") # noqa: S101
|
||||
|
||||
# Read permissions (GET, HEAD or OPTIONS) are allowed for all authenticated request
|
||||
if request.method in permissions.SAFE_METHODS or request.method not in [
|
||||
|
||||
@@ -6,11 +6,11 @@ from django.urls import reverse
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user(db):
|
||||
def user(db): # noqa: ARG001
|
||||
return User.objects.create(username="admin")
|
||||
|
||||
|
||||
def test_open_lists(user, client):
|
||||
client.force_login(user=user)
|
||||
response = client.get(reverse("lists"))
|
||||
assert response.status_code == HTTPStatus.OK
|
||||
assert response.status_code == HTTPStatus.OK # noqa: S101
|
||||
+1
-1
@@ -133,7 +133,7 @@ class OrgUnitViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
|
||||
|
||||
@api_view(["GET"])
|
||||
def get_domains(request):
|
||||
def get_domains(request): # noqa: ARG001
|
||||
api = DjangoPostfixDovecotAPI()
|
||||
domains = api.list_domains(name=settings.NEUF_EMAIL_DOMAIN_NAME)
|
||||
|
||||
|
||||
Reference in new issue
Block a user