Skip to content

Commit

Permalink
[INTERNAL] Linting across the project #533
Browse files Browse the repository at this point in the history
  • Loading branch information
kfdm authored Jul 25, 2024
2 parents 4b111f6 + 72374da commit 9981096
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion promgen/migrations/0023_shard_authorization.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 4.2.11 on 2024-06-28 09:57

import django.core.validators
from django.db import migrations, models


Expand Down
1 change: 0 additions & 1 deletion promgen/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.urls import path
from django.contrib import admin
from django.urls import include, path
from django.views.decorators.csrf import csrf_exempt
Expand Down
3 changes: 2 additions & 1 deletion promgen/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def setting(key, default=None, domain=None):
try:
rtn = rtn[index]
except KeyError:
if default != KeyError:
if default is not KeyError:
return default
raise KeyError(f"Missing required setting: {key}")
return rtn
Expand Down Expand Up @@ -121,6 +121,7 @@ def wrapped(field):

return wrapped


def proxy_error(response: requests.Response) -> HttpResponse:
"""
Return a wrapped proxy error
Expand Down
15 changes: 7 additions & 8 deletions promgen/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
from itertools import chain

import prometheus_client
from prometheus_client.parser import text_string_to_metric_families

import requests
from django.conf import settings
from django.contrib import messages
Expand All @@ -30,6 +28,7 @@
from django.views.generic.detail import SingleObjectMixin
from django.views.generic.edit import CreateView, DeleteView, FormView
from prometheus_client.core import CounterMetricFamily, GaugeMetricFamily
from prometheus_client.parser import text_string_to_metric_families
from requests.exceptions import HTTPError

import promgen.templatetags.promgen as macro
Expand Down Expand Up @@ -309,8 +308,8 @@ def post(self, request, pk):
request,
"Removed filter {} {}".format(
self.escape_square_brackets(f.name),
self.escape_square_brackets(f.value)
)
self.escape_square_brackets(f.value),
),
)
if "filter.name" in request.POST:
obj = self.get_object()
Expand All @@ -322,16 +321,16 @@ def post(self, request, pk):
request,
"Created filter {} {}".format(
self.escape_square_brackets(f.name),
self.escape_square_brackets(f.value)
)
self.escape_square_brackets(f.value),
),
)
else:
messages.warning(
request,
"Updated filter {} {}".format(
self.escape_square_brackets(f.name),
self.escape_square_brackets(f.value)
)
self.escape_square_brackets(f.value),
),
)
if "next" in request.POST:
return redirect(request.POST["next"])
Expand Down

0 comments on commit 9981096

Please sign in to comment.