Code Duplication    Length = 78-78 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 6036-6113 (lines=78) @@
6033
    __repr__ = __str__
6034
6035
6036
class ReferenceDescription(FrozenClass):
6037
    '''
6038
    The description of a reference.
6039
6040
    :ivar ReferenceTypeId:
6041
    :vartype ReferenceTypeId: NodeId
6042
    :ivar IsForward:
6043
    :vartype IsForward: Boolean
6044
    :ivar NodeId:
6045
    :vartype NodeId: ExpandedNodeId
6046
    :ivar BrowseName:
6047
    :vartype BrowseName: QualifiedName
6048
    :ivar DisplayName:
6049
    :vartype DisplayName: LocalizedText
6050
    :ivar NodeClass:
6051
    :vartype NodeClass: NodeClass
6052
    :ivar TypeDefinition:
6053
    :vartype TypeDefinition: ExpandedNodeId
6054
    '''
6055
6056
    ua_types = {
6057
        'ReferenceTypeId': 'NodeId',
6058
        'IsForward': 'Boolean',
6059
        'NodeId': 'ExpandedNodeId',
6060
        'BrowseName': 'QualifiedName',
6061
        'DisplayName': 'LocalizedText',
6062
        'NodeClass': 'NodeClass',
6063
        'TypeDefinition': 'ExpandedNodeId',
6064
               }
6065
6066
    def __init__(self, binary=None):
6067
        if binary is not None:
6068
            self._binary_init(binary)
6069
            self._freeze = True
6070
            return
6071
        self.ReferenceTypeId = NodeId()
6072
        self.IsForward = True
6073
        self.NodeId = ExpandedNodeId()
6074
        self.BrowseName = QualifiedName()
6075
        self.DisplayName = LocalizedText()
6076
        self.NodeClass = NodeClass(0)
6077
        self.TypeDefinition = ExpandedNodeId()
6078
        self._freeze = True
6079
6080
    def to_binary(self):
6081
        packet = []
6082
        packet.append(self.ReferenceTypeId.to_binary())
6083
        packet.append(uabin.Primitives.Boolean.pack(self.IsForward))
6084
        packet.append(self.NodeId.to_binary())
6085
        packet.append(self.BrowseName.to_binary())
6086
        packet.append(self.DisplayName.to_binary())
6087
        packet.append(uabin.Primitives.UInt32.pack(self.NodeClass.value))
6088
        packet.append(self.TypeDefinition.to_binary())
6089
        return b''.join(packet)
6090
6091
    @staticmethod
6092
    def from_binary(data):
6093
        return ReferenceDescription(data)
6094
6095
    def _binary_init(self, data):
6096
        self.ReferenceTypeId = NodeId.from_binary(data)
6097
        self.IsForward = uabin.Primitives.Boolean.unpack(data)
6098
        self.NodeId = ExpandedNodeId.from_binary(data)
6099
        self.BrowseName = QualifiedName.from_binary(data)
6100
        self.DisplayName = LocalizedText.from_binary(data)
6101
        self.NodeClass = NodeClass(uabin.Primitives.UInt32.unpack(data))
6102
        self.TypeDefinition = ExpandedNodeId.from_binary(data)
6103
6104
    def __str__(self):
6105
        return 'ReferenceDescription(' + 'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
6106
               'IsForward:' + str(self.IsForward) + ', ' + \
6107
               'NodeId:' + str(self.NodeId) + ', ' + \
6108
               'BrowseName:' + str(self.BrowseName) + ', ' + \
6109
               'DisplayName:' + str(self.DisplayName) + ', ' + \
6110
               'NodeClass:' + str(self.NodeClass) + ', ' + \
6111
               'TypeDefinition:' + str(self.TypeDefinition) + ')'
6112
6113
    __repr__ = __str__
6114
6115
6116
class BrowseResult(FrozenClass):
@@ 4930-5007 (lines=78) @@
4927
    __repr__ = __str__
4928
4929
4930
class AddNodesItem(FrozenClass):
4931
    '''
4932
    A request to add a node to the server address space.
4933
4934
    :ivar ParentNodeId:
4935
    :vartype ParentNodeId: ExpandedNodeId
4936
    :ivar ReferenceTypeId:
4937
    :vartype ReferenceTypeId: NodeId
4938
    :ivar RequestedNewNodeId:
4939
    :vartype RequestedNewNodeId: ExpandedNodeId
4940
    :ivar BrowseName:
4941
    :vartype BrowseName: QualifiedName
4942
    :ivar NodeClass:
4943
    :vartype NodeClass: NodeClass
4944
    :ivar NodeAttributes:
4945
    :vartype NodeAttributes: ExtensionObject
4946
    :ivar TypeDefinition:
4947
    :vartype TypeDefinition: ExpandedNodeId
4948
    '''
4949
4950
    ua_types = {
4951
        'ParentNodeId': 'ExpandedNodeId',
4952
        'ReferenceTypeId': 'NodeId',
4953
        'RequestedNewNodeId': 'ExpandedNodeId',
4954
        'BrowseName': 'QualifiedName',
4955
        'NodeClass': 'NodeClass',
4956
        'NodeAttributes': 'ExtensionObject',
4957
        'TypeDefinition': 'ExpandedNodeId',
4958
               }
4959
4960
    def __init__(self, binary=None):
4961
        if binary is not None:
4962
            self._binary_init(binary)
4963
            self._freeze = True
4964
            return
4965
        self.ParentNodeId = ExpandedNodeId()
4966
        self.ReferenceTypeId = NodeId()
4967
        self.RequestedNewNodeId = ExpandedNodeId()
4968
        self.BrowseName = QualifiedName()
4969
        self.NodeClass = NodeClass(0)
4970
        self.NodeAttributes = None
4971
        self.TypeDefinition = ExpandedNodeId()
4972
        self._freeze = True
4973
4974
    def to_binary(self):
4975
        packet = []
4976
        packet.append(self.ParentNodeId.to_binary())
4977
        packet.append(self.ReferenceTypeId.to_binary())
4978
        packet.append(self.RequestedNewNodeId.to_binary())
4979
        packet.append(self.BrowseName.to_binary())
4980
        packet.append(uabin.Primitives.UInt32.pack(self.NodeClass.value))
4981
        packet.append(extensionobject_to_binary(self.NodeAttributes))
4982
        packet.append(self.TypeDefinition.to_binary())
4983
        return b''.join(packet)
4984
4985
    @staticmethod
4986
    def from_binary(data):
4987
        return AddNodesItem(data)
4988
4989
    def _binary_init(self, data):
4990
        self.ParentNodeId = ExpandedNodeId.from_binary(data)
4991
        self.ReferenceTypeId = NodeId.from_binary(data)
4992
        self.RequestedNewNodeId = ExpandedNodeId.from_binary(data)
4993
        self.BrowseName = QualifiedName.from_binary(data)
4994
        self.NodeClass = NodeClass(uabin.Primitives.UInt32.unpack(data))
4995
        self.NodeAttributes = extensionobject_from_binary(data)
4996
        self.TypeDefinition = ExpandedNodeId.from_binary(data)
4997
4998
    def __str__(self):
4999
        return 'AddNodesItem(' + 'ParentNodeId:' + str(self.ParentNodeId) + ', ' + \
5000
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5001
               'RequestedNewNodeId:' + str(self.RequestedNewNodeId) + ', ' + \
5002
               'BrowseName:' + str(self.BrowseName) + ', ' + \
5003
               'NodeClass:' + str(self.NodeClass) + ', ' + \
5004
               'NodeAttributes:' + str(self.NodeAttributes) + ', ' + \
5005
               'TypeDefinition:' + str(self.TypeDefinition) + ')'
5006
5007
    __repr__ = __str__
5008
5009
5010
class AddNodesResult(FrozenClass):