Coverage for dcim/graphql/mixins.py: 75%

10 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 18:35 +0000

1from typing import TYPE_CHECKING, Annotated 

2 

3import strawberry 

4 

5if TYPE_CHECKING: 5 ↛ 6line 5 didn't jump to line 6 because the condition on line 5 was never true

6 from circuits.graphql.types import CircuitTerminationType, ProviderNetworkType, VirtualCircuitTerminationType 

7 from dcim.graphql.types import ( 

8 CableType, 

9 ConsolePortType, 

10 ConsoleServerPortType, 

11 FrontPortType, 

12 InterfaceType, 

13 PowerFeedType, 

14 PowerOutletType, 

15 PowerPortType, 

16 RearPortType, 

17 ) 

18 

19__all__ = ( 

20 'CabledObjectMixin', 

21 'PathEndpointMixin', 

22) 

23 

24 

25@strawberry.type 

26class CabledObjectMixin: 

27 cable: Annotated["CableType", strawberry.lazy('dcim.graphql.types')] | None 

28 

29 link_peers: list[ 

30 Annotated[ 

31 Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')] 

32 | Annotated["ConsolePortType", strawberry.lazy('dcim.graphql.types')] 

33 | Annotated["ConsoleServerPortType", strawberry.lazy('dcim.graphql.types')] 

34 | Annotated["FrontPortType", strawberry.lazy('dcim.graphql.types')] 

35 | Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] 

36 | Annotated["PowerFeedType", strawberry.lazy('dcim.graphql.types')] 

37 | Annotated["PowerOutletType", strawberry.lazy('dcim.graphql.types')] 

38 | Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')] 

39 | Annotated["RearPortType", strawberry.lazy('dcim.graphql.types')], 

40 strawberry.union("LinkPeerType"), 

41 ] 

42 ] 

43 

44 

45@strawberry.type 

46class PathEndpointMixin: 

47 

48 connected_endpoints: list[ 

49 Annotated[ 

50 Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')] 

51 | Annotated["VirtualCircuitTerminationType", strawberry.lazy('circuits.graphql.types')] 

52 | Annotated["ConsolePortType", strawberry.lazy('dcim.graphql.types')] 

53 | Annotated["ConsoleServerPortType", strawberry.lazy('dcim.graphql.types')] 

54 | Annotated["FrontPortType", strawberry.lazy('dcim.graphql.types')] 

55 | Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] 

56 | Annotated["PowerFeedType", strawberry.lazy('dcim.graphql.types')] 

57 | Annotated["PowerOutletType", strawberry.lazy('dcim.graphql.types')] 

58 | Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')] 

59 | Annotated["ProviderNetworkType", strawberry.lazy('circuits.graphql.types')] 

60 | Annotated["RearPortType", strawberry.lazy('dcim.graphql.types')], 

61 strawberry.union("ConnectedEndpointType"), 

62 ] 

63 ]