1- from typing import Annotated , List , Union
1+ from typing import Annotated , List , TYPE_CHECKING , Union
22
33import strawberry
44import strawberry_django
55
66from core .graphql .mixins import ChangelogMixin
77from dcim import models
88from extras .graphql .mixins import (
9- ConfigContextMixin , ContactsMixin , CustomFieldsMixin , ImageAttachmentsMixin , TagsMixin ,
9+ ConfigContextMixin ,
10+ ContactsMixin ,
11+ CustomFieldsMixin ,
12+ ImageAttachmentsMixin ,
13+ TagsMixin ,
1014)
1115from ipam .graphql .mixins import IPAddressesMixin , VLANGroupsMixin
1216from netbox .graphql .scalars import BigInt
1317from netbox .graphql .types import BaseObjectType , NetBoxObjectType , OrganizationalObjectType
1418from .filters import *
1519from .mixins import CabledObjectMixin , PathEndpointMixin
1620
21+ if TYPE_CHECKING :
22+ from circuits .graphql .types import CircuitTerminationType
23+ from extras .graphql .types import ConfigTemplateType
24+ from ipam .graphql .types import (
25+ ASNType ,
26+ IPAddressType ,
27+ PrefixType ,
28+ ServiceType ,
29+ VLANTranslationPolicyType ,
30+ VLANType ,
31+ VRFType ,
32+ )
33+ from tenancy .graphql .types import TenantType
34+ from users .graphql .types import UserType
35+ from virtualization .graphql .types import ClusterType , VMInterfaceType , VirtualMachineType
36+ from wireless .graphql .types import WirelessLANType , WirelessLinkType
37+
1738__all__ = (
1839 'CableType' ,
1940 'ComponentType' ,
@@ -111,7 +132,7 @@ class ModularComponentTemplateType(ComponentTemplateType):
111132
112133@strawberry_django .type (
113134 models .CableTermination ,
114- exclude = ( 'termination_type' , 'termination_id' , '_device' , '_rack' , '_location' , '_site' ) ,
135+ exclude = [ 'termination_type' , 'termination_id' , '_device' , '_rack' , '_location' , '_site' ] ,
115136 filters = CableTerminationFilter
116137)
117138class CableTerminationType (NetBoxObjectType ):
@@ -167,7 +188,7 @@ class CableType(NetBoxObjectType):
167188
168189@strawberry_django .type (
169190 models .ConsolePort ,
170- exclude = ( '_path' ,) ,
191+ exclude = [ '_path' ] ,
171192 filters = ConsolePortFilter
172193)
173194class ConsolePortType (ModularComponentType , CabledObjectMixin , PathEndpointMixin ):
@@ -185,7 +206,7 @@ class ConsolePortTemplateType(ModularComponentTemplateType):
185206
186207@strawberry_django .type (
187208 models .ConsoleServerPort ,
188- exclude = ( '_path' ,) ,
209+ exclude = [ '_path' ] ,
189210 filters = ConsoleServerPortFilter
190211)
191212class ConsoleServerPortType (ModularComponentType , CabledObjectMixin , PathEndpointMixin ):
@@ -276,7 +297,7 @@ class DeviceBayTemplateType(ComponentTemplateType):
276297
277298@strawberry_django .type (
278299 models .InventoryItemTemplate ,
279- exclude = ( 'component_type' , 'component_id' , 'parent' ) ,
300+ exclude = [ 'component_type' , 'component_id' , 'parent' ] ,
280301 filters = InventoryItemTemplateFilter
281302)
282303class InventoryItemTemplateType (ComponentTemplateType ):
@@ -369,7 +390,7 @@ class FrontPortTemplateType(ModularComponentTemplateType):
369390
370391@strawberry_django .type (
371392 models .MACAddress ,
372- exclude = ( 'assigned_object_type' , 'assigned_object_id' ) ,
393+ exclude = [ 'assigned_object_type' , 'assigned_object_id' ] ,
373394 filters = MACAddressFilter
374395)
375396class MACAddressType (NetBoxObjectType ):
@@ -385,7 +406,7 @@ def assigned_object(self) -> Annotated[Union[
385406
386407@strawberry_django .type (
387408 models .Interface ,
388- exclude = ( '_path' ,) ,
409+ exclude = [ '_path' ] ,
389410 filters = InterfaceFilter
390411)
391412class InterfaceType (IPAddressesMixin , ModularComponentType , CabledObjectMixin , PathEndpointMixin ):
@@ -424,7 +445,7 @@ class InterfaceTemplateType(ModularComponentTemplateType):
424445
425446@strawberry_django .type (
426447 models .InventoryItem ,
427- exclude = ( 'component_type' , 'component_id' , 'parent' ) ,
448+ exclude = [ 'component_type' , 'component_id' , 'parent' ] ,
428449 filters = InventoryItemFilter
429450)
430451class InventoryItemType (ComponentType ):
@@ -463,7 +484,7 @@ class InventoryItemRoleType(OrganizationalObjectType):
463484@strawberry_django .type (
464485 models .Location ,
465486 # fields='__all__',
466- exclude = ( 'parent' ,) , # bug - temp
487+ exclude = [ 'parent' ] , # bug - temp
467488 filters = LocationFilter
468489)
469490class LocationType (VLANGroupsMixin , ImageAttachmentsMixin , ContactsMixin , OrganizationalObjectType ):
@@ -524,7 +545,7 @@ class ModuleType(NetBoxObjectType):
524545@strawberry_django .type (
525546 models .ModuleBay ,
526547 # fields='__all__',
527- exclude = ( 'parent' ,) ,
548+ exclude = [ 'parent' ] ,
528549 filters = ModuleBayFilter
529550)
530551class ModuleBayType (ModularComponentType ):
@@ -579,7 +600,7 @@ class PlatformType(OrganizationalObjectType):
579600
580601@strawberry_django .type (
581602 models .PowerFeed ,
582- exclude = ( '_path' ,) ,
603+ exclude = [ '_path' ] ,
583604 filters = PowerFeedFilter
584605)
585606class PowerFeedType (NetBoxObjectType , CabledObjectMixin , PathEndpointMixin ):
@@ -590,7 +611,7 @@ class PowerFeedType(NetBoxObjectType, CabledObjectMixin, PathEndpointMixin):
590611
591612@strawberry_django .type (
592613 models .PowerOutlet ,
593- exclude = ( '_path' ,) ,
614+ exclude = [ '_path' ] ,
594615 filters = PowerOutletFilter
595616)
596617class PowerOutletType (ModularComponentType , CabledObjectMixin , PathEndpointMixin ):
@@ -621,7 +642,7 @@ class PowerPanelType(NetBoxObjectType, ContactsMixin):
621642
622643@strawberry_django .type (
623644 models .PowerPort ,
624- exclude = ( '_path' ,) ,
645+ exclude = [ '_path' ] ,
625646 filters = PowerPortFilter
626647)
627648class PowerPortType (ModularComponentType , CabledObjectMixin , PathEndpointMixin ):
@@ -712,8 +733,7 @@ class RearPortTemplateType(ModularComponentTemplateType):
712733
713734@strawberry_django .type (
714735 models .Region ,
715- exclude = ('parent' ,),
716- # fields='__all__',
736+ exclude = ['parent' ],
717737 filters = RegionFilter
718738)
719739class RegionType (VLANGroupsMixin , ContactsMixin , OrganizationalObjectType ):
@@ -772,8 +792,7 @@ def circuit_terminations(self) -> List[
772792
773793@strawberry_django .type (
774794 models .SiteGroup ,
775- # fields='__all__',
776- exclude = ('parent' ,), # bug - temp
795+ exclude = ['parent' ], # bug - temp
777796 filters = SiteGroupFilter
778797)
779798class SiteGroupType (VLANGroupsMixin , ContactsMixin , OrganizationalObjectType ):
0 commit comments