Code Duplication    Length = 12-13 lines in 3 locations

opcua/common/xmlimporter.py 3 locations

@@ 335-347 (lines=13) @@
332
        res[0].StatusCode.check()
333
        return res[0].AddedNodeId
334
335
    def add_datatype(self, obj):
336
        node = self._get_node(obj)
337
        attrs = ua.DataTypeAttributes()
338
        if obj.desc:
339
            attrs.Description = ua.LocalizedText(obj.desc)
340
        attrs.DisplayName = ua.LocalizedText(obj.displayname)
341
        if obj.abstract:
342
            attrs.IsAbstract = obj.abstract
343
        node.NodeAttributes = attrs
344
        res = self._add_node(node)
345
        self._add_refs(obj)
346
        res[0].StatusCode.check()
347
        return res[0].AddedNodeId
348
349
    def _add_refs(self, obj):
350
        if not obj.refs:
@@ 162-173 (lines=12) @@
159
        res[0].StatusCode.check()
160
        return res[0].AddedNodeId
161
162
    def add_object_type(self, obj):
163
        node = self._get_node(obj)
164
        attrs = ua.ObjectTypeAttributes()
165
        if obj.desc:
166
            attrs.Description = ua.LocalizedText(obj.desc)
167
        attrs.DisplayName = ua.LocalizedText(obj.displayname)
168
        attrs.IsAbstract = obj.abstract
169
        node.NodeAttributes = attrs
170
        res = self._add_node(node)
171
        self._add_refs(obj)
172
        res[0].StatusCode.check()
173
        return res[0].AddedNodeId
174
175
    def add_variable(self, obj):
176
        node = self._get_node(obj)
@@ 149-160 (lines=12) @@
146
            else:
147
                return ua.NodeId(getattr(ua.ObjectIds, nodeid))
148
149
    def add_object(self, obj):
150
        node = self._get_node(obj)
151
        attrs = ua.ObjectAttributes()
152
        if obj.desc:
153
            attrs.Description = ua.LocalizedText(obj.desc)
154
        attrs.DisplayName = ua.LocalizedText(obj.displayname)
155
        attrs.EventNotifier = obj.eventnotifier
156
        node.NodeAttributes = attrs
157
        res = self._add_node(node)
158
        self._add_refs(obj)
159
        res[0].StatusCode.check()
160
        return res[0].AddedNodeId
161
162
    def add_object_type(self, obj):
163
        node = self._get_node(obj)