Code Duplication    Length = 78-78 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 6036-6113 (lines=78) @@
6033
        self.ReferenceTypeId = NodeId()
6034
        self.IncludeSubtypes = True
6035
        self.NodeClassMask = 0
6036
        self.ResultMask = 0
6037
        self._freeze = True
6038
6039
    def to_binary(self):
6040
        packet = []
6041
        packet.append(self.NodeId.to_binary())
6042
        packet.append(uabin.Primitives.UInt32.pack(self.BrowseDirection.value))
6043
        packet.append(self.ReferenceTypeId.to_binary())
6044
        packet.append(uabin.Primitives.Boolean.pack(self.IncludeSubtypes))
6045
        packet.append(uabin.Primitives.UInt32.pack(self.NodeClassMask))
6046
        packet.append(uabin.Primitives.UInt32.pack(self.ResultMask))
6047
        return b''.join(packet)
6048
6049
    @staticmethod
6050
    def from_binary(data):
6051
        return BrowseDescription(data)
6052
6053
    def _binary_init(self, data):
6054
        self.NodeId = NodeId.from_binary(data)
6055
        self.BrowseDirection = BrowseDirection(uabin.Primitives.UInt32.unpack(data))
6056
        self.ReferenceTypeId = NodeId.from_binary(data)
6057
        self.IncludeSubtypes = uabin.Primitives.Boolean.unpack(data)
6058
        self.NodeClassMask = uabin.Primitives.UInt32.unpack(data)
6059
        self.ResultMask = uabin.Primitives.UInt32.unpack(data)
6060
6061
    def __str__(self):
6062
        return 'BrowseDescription(' + 'NodeId:' + str(self.NodeId) + ', ' + \
6063
               'BrowseDirection:' + str(self.BrowseDirection) + ', ' + \
6064
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
6065
               'IncludeSubtypes:' + str(self.IncludeSubtypes) + ', ' + \
6066
               'NodeClassMask:' + str(self.NodeClassMask) + ', ' + \
6067
               'ResultMask:' + str(self.ResultMask) + ')'
6068
6069
    __repr__ = __str__
6070
6071
6072
class ReferenceDescription(FrozenClass):
6073
    '''
6074
    The description of a reference.
6075
6076
    :ivar ReferenceTypeId:
6077
    :vartype ReferenceTypeId: NodeId
6078
    :ivar IsForward:
6079
    :vartype IsForward: Boolean
6080
    :ivar NodeId:
6081
    :vartype NodeId: ExpandedNodeId
6082
    :ivar BrowseName:
6083
    :vartype BrowseName: QualifiedName
6084
    :ivar DisplayName:
6085
    :vartype DisplayName: LocalizedText
6086
    :ivar NodeClass:
6087
    :vartype NodeClass: NodeClass
6088
    :ivar TypeDefinition:
6089
    :vartype TypeDefinition: ExpandedNodeId
6090
    '''
6091
6092
    ua_types = {
6093
        'ReferenceTypeId': 'NodeId',
6094
        'IsForward': 'Boolean',
6095
        'NodeId': 'ExpandedNodeId',
6096
        'BrowseName': 'QualifiedName',
6097
        'DisplayName': 'LocalizedText',
6098
        'NodeClass': 'NodeClass',
6099
        'TypeDefinition': 'ExpandedNodeId',
6100
               }
6101
6102
    def __init__(self, binary=None):
6103
        if binary is not None:
6104
            self._binary_init(binary)
6105
            self._freeze = True
6106
            return
6107
        self.ReferenceTypeId = NodeId()
6108
        self.IsForward = True
6109
        self.NodeId = ExpandedNodeId()
6110
        self.BrowseName = QualifiedName()
6111
        self.DisplayName = LocalizedText()
6112
        self.NodeClass = NodeClass(0)
6113
        self.TypeDefinition = ExpandedNodeId()
6114
        self._freeze = True
6115
6116
    def to_binary(self):
@@ 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):