1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Tidy-up imports and typing

(cherry picked from commit adee5cf6a8856ceda0170a4382cec8fd784be93b)
This commit is contained in:
Jonathan Senecal
2022-09-20 15:50:33 -04:00
committed by jeremystretch
parent 5cc55d1e99
commit ac7db3cc88

View File

@ -1,18 +1,17 @@
import hashlib import hashlib
import importlib import importlib
import logging
import os import os
import platform import platform
import re
import socket
import sys import sys
import warnings import warnings
from urllib.parse import urlsplit from urllib.parse import urlsplit
import django
import sentry_sdk import sentry_sdk
from django.contrib.messages import constants as messages from django.contrib.messages import constants as messages
from django.core.exceptions import ImproperlyConfigured, ValidationError from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.core.validators import URLValidator from django.core.validators import URLValidator
from django.utils.encoding import force_str
from sentry_sdk.integrations.django import DjangoIntegration from sentry_sdk.integrations.django import DjangoIntegration
from netbox.config import PARAMS from netbox.config import PARAMS
@ -20,9 +19,7 @@ from netbox.config import PARAMS
# Monkey patch to fix Django 4.0 support for graphene-django (see # Monkey patch to fix Django 4.0 support for graphene-django (see
# https://github.com/graphql-python/graphene-django/issues/1284) # https://github.com/graphql-python/graphene-django/issues/1284)
# TODO: Remove this when graphene-django 2.16 becomes available # TODO: Remove this when graphene-django 2.16 becomes available
import django django.utils.encoding.force_text = force_str # type: ignore
from django.utils.encoding import force_str
django.utils.encoding.force_text = force_str
# #
@ -186,7 +183,7 @@ if STORAGE_BACKEND is not None:
if STORAGE_BACKEND.startswith('storages.'): if STORAGE_BACKEND.startswith('storages.'):
try: try:
import storages.utils import storages.utils # type: ignore
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
if getattr(e, 'name') == 'storages': if getattr(e, 'name') == 'storages':
raise ImproperlyConfigured( raise ImproperlyConfigured(