1
- """IConfiguration interfaces."""
2
-
3
1
from collections .abc import AsyncIterator
4
2
from contextlib import suppress
5
3
from dataclasses import dataclass , field
13
11
14
12
15
13
@dataclass
16
- class OpenFilter :
17
- """IConfiguration.OpenFilter method definition."""
14
+ class WrappedObject :
15
+ # Wildcard type that can be used to represent any object.
16
+ vid : int = field (metadata = {"name" : "VID" , "type" : "Attribute" })
17
+ obj : object = field (metadata = {"type" : "Wildcard" })
18
+
18
19
20
+ @dataclass
21
+ class OpenFilter :
19
22
@dataclass
20
23
class Params :
21
- """Method parameters."""
22
-
23
24
object_types : list [str ] | None = field (
24
25
default = None ,
25
26
metadata = {"wrapper" : "Objects" , "name" : "ObjectType" , "type" : "Element" },
@@ -32,64 +33,40 @@ class Params:
32
33
33
34
@dataclass
34
35
class GetFilterResults :
35
- """IConfiguration.GetFilterResults method definition."""
36
-
37
36
@dataclass
38
37
class Params :
39
- """Method parameters."""
40
-
41
38
h_filter : int = field (metadata = {"name" : "hFilter" })
42
39
count : int = 50
43
40
whole_object : bool = True
44
41
45
- @dataclass
46
- class Object :
47
- """Wildcard type that can be used to represent any object."""
48
-
49
- vid : int = field (metadata = {"name" : "VID" , "type" : "Attribute" })
50
- obj : object = field (metadata = {"type" : "Wildcard" })
51
-
52
42
call : Params | None = field (default = None , metadata = {"name" : "call" })
53
- result : list [Object ] | None = field (
43
+ result : list [WrappedObject ] | None = field (
54
44
default_factory = list ,
55
45
metadata = {"wrapper" : "return" , "name" : "Object" , "type" : "Element" },
56
46
)
57
47
58
48
59
49
@dataclass
60
50
class CloseFilter :
61
- """IConfiguration.CloseFilter method definition."""
62
-
63
51
call : int | None = field (default = None , metadata = {"name" : "call" })
64
52
result : bool | None = field (default = None , metadata = {"name" : "return" })
65
53
66
54
67
55
@dataclass
68
56
class GetObject :
69
- """IConfiguration.GetObject method definition."""
70
-
71
- @dataclass
72
- class Object :
73
- """Wildcard type that can be used to represent any object."""
74
-
75
- vid : int = field (metadata = {"name" : "VID" , "type" : "Attribute" })
76
- obj : object = field (metadata = {"type" : "Wildcard" })
77
-
78
57
call : list [int ] | None = field (
79
58
default_factory = list ,
80
59
metadata = {"wrapper" : "call" , "name" : "VID" , "type" : "Element" },
81
60
)
82
61
83
- result : list [Object ] | None = field (
62
+ result : list [WrappedObject ] | None = field (
84
63
default_factory = list ,
85
64
metadata = {"wrapper" : "return" , "name" : "Object" , "type" : "Element" },
86
65
)
87
66
88
67
89
68
@dataclass (kw_only = True )
90
69
class IConfiguration :
91
- """IConfiguration interface."""
92
-
93
70
open_filter : OpenFilter | None = None
94
71
get_filter_results : GetFilterResults | None = None
95
72
close_filter : CloseFilter | None = None
@@ -113,7 +90,7 @@ async def open_filter(
113
90
Returns:
114
91
The handle of the opened filter
115
92
"""
116
- return await client .rpc_call (
93
+ return await client .rpc (
117
94
IConfiguration ,
118
95
OpenFilter ,
119
96
OpenFilter .Params (object_types = list (object_types ), xpath = xpath ),
@@ -122,7 +99,7 @@ async def open_filter(
122
99
@staticmethod
123
100
async def get_filter_results (
124
101
client : ConfigClient , h_filter : int , count : int = 50 , whole_object : bool = True
125
- ) -> list [GetFilterResults . Object ]:
102
+ ) -> list [WrappedObject ]:
126
103
"""Get results from a filter handle previously opened with open_filter.
127
104
128
105
Args:
@@ -134,7 +111,7 @@ async def get_filter_results(
134
111
Returns:
135
112
A list of Vantage objects
136
113
"""
137
- return await client .rpc_call (
114
+ return await client .rpc (
138
115
IConfiguration , GetFilterResults , GetFilterResults .Params (h_filter )
139
116
)
140
117
@@ -149,10 +126,10 @@ async def close_filter(client: ConfigClient, h_filter: int) -> bool:
149
126
Returns:
150
127
True if the filter was closed successfully, False otherwise
151
128
"""
152
- return await client .rpc_call (IConfiguration , CloseFilter , h_filter )
129
+ return await client .rpc (IConfiguration , CloseFilter , h_filter )
153
130
154
131
@staticmethod
155
- async def get_object (client : ConfigClient , * vids : int ) -> list [GetObject . Object ]:
132
+ async def get_object (client : ConfigClient , * vids : int ) -> list [WrappedObject ]:
156
133
"""Get one or more Vantage objects by their VIDs.
157
134
158
135
Args:
@@ -162,7 +139,7 @@ async def get_object(client: ConfigClient, *vids: int) -> list[GetObject.Object]
162
139
Returns:
163
140
A list of Vantage objects
164
141
"""
165
- return await client .rpc_call (IConfiguration , GetObject , list (vids ))
142
+ return await client .rpc (IConfiguration , GetObject , list (vids ))
166
143
167
144
# Convenience functions, not part of the interface
168
145
@overload
0 commit comments