0
0
Fork 0
mirror of https://github.com/healthchecks/healthchecks.git synced 2025-04-11 15:51:19 +00:00

Fix lint issues

This commit is contained in:
Pēteris Caune 2023-07-12 10:07:14 +03:00
parent a3965fcae5
commit f6a04d2256
No known key found for this signature in database
GPG key ID: E28D7679E9A9EDE2
5 changed files with 9 additions and 17 deletions
hc
accounts
front
lib

View file

@ -1,7 +1,5 @@
from __future__ import annotations
from datetime import timedelta as td
from django.contrib import admin
from django.contrib.auth import login as auth_login
from django.contrib.auth.admin import UserAdmin
@ -12,7 +10,6 @@ from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.timezone import now
from hc.accounts.models import Credential, Profile, Project

View file

@ -1,6 +1,6 @@
from __future__ import annotations
import os
from importlib.util import find_spec
from django.conf import settings
from django.core.management.base import BaseCommand
@ -10,16 +10,14 @@ class Command(BaseCommand):
help = "Renders Markdown to HTML"
def handle(self, *args, **options):
try:
import markdown
for pkg in ("markdown", "pygments"):
if find_spec(pkg) is None:
self.stdout.write(f"This command requires the {pkg} package.")
self.stdout.write("Please install it with:\n\n")
self.stdout.write(f" pip install {pkg}\n\n")
return
# We use pygments for highlighting code samples
import pygments
except ImportError as e:
self.stdout.write(f"This command requires the {e.name} package.")
self.stdout.write("Please install it with:\n\n")
self.stdout.write(f" pip install {e.name}\n\n")
return
import markdown
extensions = [
"fenced_code",

View file

@ -1,7 +1,5 @@
from __future__ import annotations
from django.test.utils import override_settings
from hc.api.models import Channel, Check
from hc.test import BaseTestCase

View file

@ -24,7 +24,7 @@ class ServeDocTestCase(TestCase):
@patch("hc.front.views.settings.BASE_DIR")
def test_it_rejects_bad_characters(self, mock_base_dir):
r = self.client.get("/docs/NAUGHTY/")
self.client.get("/docs/NAUGHTY/")
# URL dispatcher's slug filter lets the uppercase letters through,
# but the view should still reject them, before any filesystem
# operations

View file

@ -1,7 +1,6 @@
from __future__ import annotations
import logging
import time
from io import BytesIO
from threading import Thread