Code Duplication    Length = 13-14 lines in 2 locations

asyncua/common/events.py 2 locations

@@ 235-248 (lines=14) @@
232
    return properties
233
234
235
async def get_event_variables_from_type_node(node):
236
    variables = []
237
    curr_node = node
238
    while True:
239
        variables.extend(await curr_node.get_variables())
240
        if curr_node.nodeid.Identifier == ua.ObjectIds.BaseEventType:
241
            break
242
        parents = await curr_node.get_referenced_nodes(
243
            refs=ua.ObjectIds.HasSubtype, direction=ua.BrowseDirection.Inverse, includesubtypes=True
244
        )
245
        if len(parents) != 1:  # Something went wrong
246
            return None
247
        curr_node = parents[0]
248
    return variables
249
250
251
async def get_event_obj_from_type_node(node):
@@ 204-216 (lines=13) @@
201
    return cf
202
203
204
async def get_event_variables_from_type_node(node):
205
    variables = []
206
    curr_node = node
207
    while True:
208
        variables.extend(await curr_node.get_variables())
209
        if curr_node.nodeid.Identifier == ua.ObjectIds.BaseEventType:
210
            break
211
        parents = await curr_node.get_referenced_nodes(
212
            refs=ua.ObjectIds.HasSubtype, direction=ua.BrowseDirection.Inverse, includesubtypes=True)
213
        if len(parents) != 1:  # Something went wrong
214
            return None
215
        curr_node = parents[0]
216
    return variables
217
218
219
async def get_event_properties_from_type_node(node):