Code Duplication    Length = 12-13 lines in 3 locations

opcua/common/xmlimporter.py 3 locations

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