Code Duplication    Length = 11-12 lines in 2 locations

asyncua/client/client.py 1 location

@@ 534-545 (lines=12) @@
531
        await exp.build_etree(nodes)
532
        await exp.write_xml(path)
533
534
    async def register_namespace(self, uri):
535
        """
536
        Register a new namespace. Nodes should in custom namespace, not 0.
537
        This method is mainly implemented for symetry with server
538
        """
539
        ns_node = self.get_node(ua.NodeId(ua.ObjectIds.Server_NamespaceArray))
540
        uries = await ns_node.get_value()
541
        if uri in uries:
542
            return uries.index(uri)
543
        uries.append(uri)
544
        await ns_node.set_value(uries)
545
        return len(uries) - 1
546
547
    def load_type_definitions(self, nodes=None) -> Coroutine:
548
        """

asyncua/server/server.py 1 location

@@ 397-407 (lines=11) @@
394
        ns_node = self.get_node(ua.NodeId(ua.ObjectIds.Server_NamespaceArray))
395
        return ns_node.get_value()
396
397
    async def register_namespace(self, uri) -> int:
398
        """
399
        Register a new namespace. Nodes should in custom namespace, not 0.
400
        """
401
        ns_node = self.get_node(ua.NodeId(ua.ObjectIds.Server_NamespaceArray))
402
        uries = await ns_node.get_value()
403
        if uri in uries:
404
            return uries.index(uri)
405
        uries.append(uri)
406
        await ns_node.set_value(uries)
407
        return len(uries) - 1
408
409
    async def get_namespace_index(self, uri):
410
        """