Code Duplication    Length = 11-12 lines in 2 locations

asyncua/client/client.py 1 location

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

asyncua/server/server.py 1 location

@@ 385-395 (lines=11) @@
382
        ns_node = self.get_node(ua.NodeId(ua.ObjectIds.Server_NamespaceArray))
383
        return ns_node.get_value()
384
385
    async def register_namespace(self, uri) -> int:
386
        """
387
        Register a new namespace. Nodes should in custom namespace, not 0.
388
        """
389
        ns_node = self.get_node(ua.NodeId(ua.ObjectIds.Server_NamespaceArray))
390
        uries = await ns_node.get_value()
391
        if uri in uries:
392
            return uries.index(uri)
393
        uries.append(uri)
394
        await ns_node.set_value(uries)
395
        return len(uries) - 1
396
397
    async def get_namespace_index(self, uri):
398
        """