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

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