Skip to content

Commit

Permalink
style: black and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
kpetremann committed Aug 8, 2024
1 parent 52d2fcd commit c701582
Show file tree
Hide file tree
Showing 21 changed files with 37 additions and 25 deletions.
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/api/bgp/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.core.exceptions import ValidationError
from django.db.models import Q
from ipam.api.nested_serializers import NestedIPAddressSerializer
from netbox.api.serializers import WritableNestedSerializer
from rest_framework import serializers
from rest_framework.serializers import (
IntegerField,
Expand All @@ -9,7 +10,6 @@
)
from tenancy.api.nested_serializers import NestedTenantSerializer

from netbox.api.serializers import WritableNestedSerializer
from netbox_cmdb.api.common_serializers import CommonDeviceSerializer
from netbox_cmdb.choices import AssetMonitoringStateChoices
from netbox_cmdb.constants import BGP_MAX_ASN, BGP_MIN_ASN
Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/api/bgp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from django.db import transaction
from django_pglocks import advisory_lock
from drf_yasg.utils import swagger_auto_schema
from netbox.api.viewsets.mixins import ObjectValidationMixin
from rest_framework import status
from rest_framework.exceptions import ValidationError
from rest_framework.response import Response
from rest_framework.views import APIView

from netbox.api.viewsets.mixins import ObjectValidationMixin
from netbox_cmdb import filtersets
from netbox_cmdb.api.bgp.serializers import (
AvailableAsnSerializer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Route Policy serializers."""

from rest_framework.serializers import ModelSerializer, ValidationError

from netbox_cmdb.api.common_serializers import CommonDeviceSerializer
from netbox_cmdb.models.bgp_community_list import BGPCommunityList, BGPCommunityListTerm
from rest_framework.serializers import ModelSerializer, ValidationError


class BGPCommunityListTermSerializer(ModelSerializer):
Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/api/cmdb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from drf_yasg import openapi
from drf_yasg.openapi import Parameter
from drf_yasg.utils import swagger_auto_schema
from netbox.api.authentication import IsAuthenticatedOrLoginNotRequired
from rest_framework import serializers, status
from rest_framework.response import Response
from rest_framework.views import APIView

from netbox.api.authentication import IsAuthenticatedOrLoginNotRequired
from netbox_cmdb.models.bgp import BGPPeerGroup, BGPSession, DeviceBGPSession
from netbox_cmdb.models.bgp_community_list import BGPCommunityList
from netbox_cmdb.models.prefix_list import PrefixList
Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/api/route_policy/serializers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Route Policy serializers."""

from django.core.exceptions import ValidationError
from netbox.api.serializers import WritableNestedSerializer
from rest_framework import serializers
from rest_framework.serializers import ModelSerializer, SerializerMethodField

from netbox.api.serializers import WritableNestedSerializer
from netbox_cmdb.api.bgp.serializers import AsnSerializer
from netbox_cmdb.api.common_serializers import CommonDeviceSerializer
from netbox_cmdb.models.bgp_community_list import BGPCommunityList
Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/api/snmp/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from rest_framework.serializers import ModelSerializer, ValidationError

from netbox_cmdb.models.snmp import SNMP, SNMPCommunity
from netbox_cmdb.api.common_serializers import CommonDeviceSerializer
from netbox_cmdb.constants import MAX_COMMUNITY_PER_DEVICE
from netbox_cmdb.models.snmp import SNMP, SNMPCommunity


class SNMPCommunitySerializer(ModelSerializer):
Expand Down
8 changes: 4 additions & 4 deletions netbox_cmdb/netbox_cmdb/api/snmp/views.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""Route Policy views."""

from netbox_cmdb import filtersets
from rest_framework.response import Response

from netbox_cmdb.api.viewsets import CustomNetBoxModelViewSet
from netbox_cmdb.models.snmp import SNMP, SNMPCommunity
from netbox_cmdb import filtersets
from netbox_cmdb.api.snmp.serializers import (
SNMPCommunitySerializer,
SNMPReadSerializer,
SNMPSerializer,
)
from rest_framework.response import Response
from netbox_cmdb.api.viewsets import CustomNetBoxModelViewSet
from netbox_cmdb.models.snmp import SNMP, SNMPCommunity


class SNMPCommunityViewSet(CustomNetBoxModelViewSet):
Expand Down
4 changes: 2 additions & 2 deletions netbox_cmdb/netbox_cmdb/filtersets.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import django_filters
from django.db.models import Q
from netbox_cmdb.models.snmp import SNMP
from netbox.filtersets import ChangeLoggedModelFilterSet
from tenancy.filtersets import TenancyFilterSet
from utilities.filters import MultiValueCharFilter

from netbox.filtersets import ChangeLoggedModelFilterSet
from netbox_cmdb.models.bgp import ASN, BGPPeerGroup, BGPSession, DeviceBGPSession
from netbox_cmdb.models.route_policy import RoutePolicy
from netbox_cmdb.models.snmp import SNMP

device_location_filterset = [
"device__location__name",
Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from django import forms
from django.utils.translation import gettext as _
from extras.models import Tag
from netbox.forms import NetBoxModelFilterSetForm, NetBoxModelForm
from utilities.forms import DynamicModelMultipleChoiceField
from utilities.forms.fields import DynamicModelChoiceField, MultipleChoiceField

from netbox.forms import NetBoxModelFilterSetForm, NetBoxModelForm
from netbox_cmdb.choices import AssetMonitoringStateChoices, AssetStateChoices
from netbox_cmdb.constants import MAX_COMMUNITY_PER_DEVICE
from netbox_cmdb.models.bgp import ASN, BGPPeerGroup, BGPSession, DeviceBGPSession
Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/models/bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from django.db import models
from django.db.models import Q
from django.urls import reverse
from netbox.models import ChangeLoggedModel
from utilities.choices import ChoiceSet
from utilities.querysets import RestrictedQuerySet

from netbox.models import ChangeLoggedModel
from netbox_cmdb.choices import AssetMonitoringStateChoices, AssetStateChoices
from netbox_cmdb.constants import BGP_MAX_ASN, BGP_MIN_ASN

Expand Down
5 changes: 3 additions & 2 deletions netbox_cmdb/netbox_cmdb/models/interface.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.core.exceptions import ValidationError
from django.db import models
from netbox_cmdb.choices import AssetStateChoices, AssetMonitoringStateChoices
from netbox.models import ChangeLoggedModel
from django.core.exceptions import ValidationError

from netbox_cmdb.choices import AssetMonitoringStateChoices, AssetStateChoices

FEC_CHOICES = [
(None, "None"),
Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/models/route_policy.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
from netbox.models import ChangeLoggedModel
from utilities.querysets import RestrictedQuerySet

from netbox.models import ChangeLoggedModel
from netbox_cmdb.choices import DecisionChoice
from netbox_cmdb.fields import CustomIPAddressField

Expand Down
7 changes: 4 additions & 3 deletions netbox_cmdb/netbox_cmdb/models/snmp.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ValidationError
from django.db import models
from netbox_cmdb.choices import SNMPCommunityType
from netbox.models import ChangeLoggedModel
from django.core.exceptions import ValidationError
from django.contrib.postgres.fields import ArrayField

from netbox_cmdb.choices import SNMPCommunityType


class SNMPCommunity(ChangeLoggedModel):
Expand Down
1 change: 1 addition & 0 deletions netbox_cmdb/netbox_cmdb/signals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db.models.signals import post_delete
from django.dispatch import receiver

from netbox_cmdb.models.bgp import BGPSession


Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/tables.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Tables."""

import django_tables2 as tables

from netbox.tables import NetBoxTable, columns

from netbox_cmdb.models.bgp import ASN, BGPPeerGroup, BGPSession, DeviceBGPSession
from netbox_cmdb.models.route_policy import RoutePolicy
from netbox_cmdb.models.snmp import SNMP, SNMPCommunity
Expand Down
3 changes: 2 additions & 1 deletion netbox_cmdb/netbox_cmdb/template_content.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from extras.plugins import PluginTemplateExtension


class Decommisioning(PluginTemplateExtension):
model = 'dcim.device'
model = "dcim.device"

def buttons(self):
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from dcim.models.devices import Device, DeviceRole, DeviceType, Manufacturer
from dcim.models.sites import Site
from django.test import TestCase
from rest_framework.serializers import ValidationError

from netbox_cmdb.api.bgp_community_list.serializers import BGPCommunityListSerializer
from netbox_cmdb.models.bgp_community_list import BGPCommunityList, BGPCommunityListTerm
from rest_framework.serializers import ValidationError


def validate(device, data):
Expand Down
1 change: 1 addition & 0 deletions netbox_cmdb/netbox_cmdb/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.test import TestCase
from ipam.models.ip import IPAddress
from tenancy.models.tenants import Tenant

from netbox_cmdb.models.bgp import ASN


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.forms import ValidationError
from django.test import TestCase
from netaddr import IPNetwork

from netbox_cmdb.models.prefix_list import PrefixList, PrefixListTerm


Expand Down
2 changes: 1 addition & 1 deletion netbox_cmdb/netbox_cmdb/tests/snmp/test_snmp_serializer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from netbox_cmdb.api.snmp.serializers import SNMPCommunitySerializer, SNMPSerializer
from netbox_cmdb.models.snmp import SNMP, SNMPCommunity
from netbox_cmdb.choices import SNMPCommunityType
from netbox_cmdb.models.snmp import SNMP, SNMPCommunity
from netbox_cmdb.tests.common import BaseTestCase


Expand Down
6 changes: 5 additions & 1 deletion netbox_cmdb/netbox_cmdb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
)

urlpatterns = [
path("decommisioning/<int:pk>/delete", DecommissioningView.as_view(), name="decommisioning_delete"),
path(
"decommisioning/<int:pk>/delete",
DecommissioningView.as_view(),
name="decommisioning_delete",
),
# ASN
path("asn/", ASNListView.as_view(), name="asn_list"),
path("asn/add/", ASNEditView.as_view(), name="asn_add"),
Expand Down

0 comments on commit c701582

Please sign in to comment.