Code Duplication    Length = 11-12 lines in 2 locations

asyncua/client/client.py 1 location

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

asyncua/server/server.py 1 location

@@ 404-414 (lines=11) @@
401
        ns_node = self.get_node(ua.NodeId(ua.ObjectIds.Server_NamespaceArray))
402
        return ns_node.get_value()
403
404
    async def register_namespace(self, uri) -> int:
405
        """
406
        Register a new namespace. Nodes should in custom namespace, not 0.
407
        """
408
        ns_node = self.get_node(ua.NodeId(ua.ObjectIds.Server_NamespaceArray))
409
        uries = await ns_node.get_value()
410
        if uri in uries:
411
            return uries.index(uri)
412
        uries.append(uri)
413
        await ns_node.set_value(uries)
414
        return len(uries) - 1
415
416
    async def get_namespace_index(self, uri):
417
        """