Code Duplication    Length = 12-13 lines in 3 locations

opcua/common/xmlimporter.py 3 locations

@@ 377-389 (lines=13) @@
374
        res[0].StatusCode.check()
375
        return res[0].AddedNodeId
376
377
    def add_datatype(self, obj):
378
        node = self._get_node(obj)
379
        attrs = ua.DataTypeAttributes()
380
        if obj.desc:
381
            attrs.Description = ua.LocalizedText(obj.desc)
382
        attrs.DisplayName = ua.LocalizedText(obj.displayname)
383
        if obj.abstract:
384
            attrs.IsAbstract = obj.abstract
385
        node.NodeAttributes = attrs
386
        res = self._add_node(node)
387
        self._add_refs(obj)
388
        res[0].StatusCode.check()
389
        return res[0].AddedNodeId
390
391
    def _add_refs(self, obj):
392
        if not obj.refs:
@@ 182-193 (lines=12) @@
179
        res[0].StatusCode.check()
180
        return res[0].AddedNodeId
181
182
    def add_object_type(self, obj):
183
        node = self._get_node(obj)
184
        attrs = ua.ObjectTypeAttributes()
185
        if obj.desc:
186
            attrs.Description = ua.LocalizedText(obj.desc)
187
        attrs.DisplayName = ua.LocalizedText(obj.displayname)
188
        attrs.IsAbstract = obj.abstract
189
        node.NodeAttributes = attrs
190
        res = self._add_node(node)
191
        self._add_refs(obj)
192
        res[0].StatusCode.check()
193
        return res[0].AddedNodeId
194
195
    def add_variable(self, obj):
196
        node = self._get_node(obj)
@@ 169-180 (lines=12) @@
166
            else:
167
                return ua.NodeId(getattr(ua.ObjectIds, nodeid))
168
169
    def add_object(self, obj):
170
        node = self._get_node(obj)
171
        attrs = ua.ObjectAttributes()
172
        if obj.desc:
173
            attrs.Description = ua.LocalizedText(obj.desc)
174
        attrs.DisplayName = ua.LocalizedText(obj.displayname)
175
        attrs.EventNotifier = obj.eventnotifier
176
        node.NodeAttributes = attrs
177
        res = self._add_node(node)
178
        self._add_refs(obj)
179
        res[0].StatusCode.check()
180
        return res[0].AddedNodeId
181
182
    def add_object_type(self, obj):
183
        node = self._get_node(obj)