Code Duplication    Length = 67-67 lines in 4 locations

opcua/ua/uaprotocol_auto.py 4 locations

@@ 5867-5933 (lines=67) @@
5864
    __repr__ = __str__
5865
5866
5867
class BrowseDescription(FrozenClass):
5868
    '''
5869
    A request to browse the the references from a node.
5870
5871
    :ivar NodeId:
5872
    :vartype NodeId: NodeId
5873
    :ivar BrowseDirection:
5874
    :vartype BrowseDirection: BrowseDirection
5875
    :ivar ReferenceTypeId:
5876
    :vartype ReferenceTypeId: NodeId
5877
    :ivar IncludeSubtypes:
5878
    :vartype IncludeSubtypes: Boolean
5879
    :ivar NodeClassMask:
5880
    :vartype NodeClassMask: UInt32
5881
    :ivar ResultMask:
5882
    :vartype ResultMask: UInt32
5883
    '''
5884
5885
    ua_types = [
5886
5887
        ('NodeId', 'NodeId'),
5888
        ('BrowseDirection', 'BrowseDirection'),
5889
        ('ReferenceTypeId', 'NodeId'),
5890
        ('IncludeSubtypes', 'Boolean'),
5891
        ('NodeClassMask', 'UInt32'),
5892
        ('ResultMask', 'UInt32'),
5893
               ]
5894
5895
    def __init__(self):
5896
        self.NodeId = NodeId()
5897
        self.BrowseDirection = BrowseDirection(0)
5898
        self.ReferenceTypeId = NodeId()
5899
        self.IncludeSubtypes = True
5900
        self.NodeClassMask = 0
5901
        self.ResultMask = 0
5902
        self._freeze = True
5903
5904
    def to_binary(self):
5905
        packet = []
5906
        packet.append(self.NodeId.to_binary())
5907
        packet.append(uabin.Primitives.UInt32.pack(self.BrowseDirection.value))
5908
        packet.append(self.ReferenceTypeId.to_binary())
5909
        packet.append(uabin.Primitives.Boolean.pack(self.IncludeSubtypes))
5910
        packet.append(uabin.Primitives.UInt32.pack(self.NodeClassMask))
5911
        packet.append(uabin.Primitives.UInt32.pack(self.ResultMask))
5912
        return b''.join(packet)
5913
5914
    @staticmethod
5915
    def from_binary(data):
5916
        obj = BrowseDescription()
5917
        obj.NodeId = NodeId.from_binary(data)
5918
        self.BrowseDirection = BrowseDirection(uabin.Primitives.UInt32.unpack(data))
5919
        obj.ReferenceTypeId = NodeId.from_binary(data)
5920
        self.IncludeSubtypes = uabin.Primitives.Boolean.unpack(data)
5921
        self.NodeClassMask = uabin.Primitives.UInt32.unpack(data)
5922
        self.ResultMask = uabin.Primitives.UInt32.unpack(data)
5923
        return obj
5924
5925
    def __str__(self):
5926
        return 'BrowseDescription(' + 'NodeId:' + str(self.NodeId) + ', ' + \
5927
               'BrowseDirection:' + str(self.BrowseDirection) + ', ' + \
5928
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5929
               'IncludeSubtypes:' + str(self.IncludeSubtypes) + ', ' + \
5930
               'NodeClassMask:' + str(self.NodeClassMask) + ', ' + \
5931
               'ResultMask:' + str(self.ResultMask) + ')'
5932
5933
    __repr__ = __str__
5934
5935
5936
class ReferenceDescription(FrozenClass):
@@ 5147-5213 (lines=67) @@
5144
    __repr__ = __str__
5145
5146
5147
class AddReferencesItem(FrozenClass):
5148
    '''
5149
    A request to add a reference to the server address space.
5150
5151
    :ivar SourceNodeId:
5152
    :vartype SourceNodeId: NodeId
5153
    :ivar ReferenceTypeId:
5154
    :vartype ReferenceTypeId: NodeId
5155
    :ivar IsForward:
5156
    :vartype IsForward: Boolean
5157
    :ivar TargetServerUri:
5158
    :vartype TargetServerUri: String
5159
    :ivar TargetNodeId:
5160
    :vartype TargetNodeId: ExpandedNodeId
5161
    :ivar TargetNodeClass:
5162
    :vartype TargetNodeClass: NodeClass
5163
    '''
5164
5165
    ua_types = [
5166
5167
        ('SourceNodeId', 'NodeId'),
5168
        ('ReferenceTypeId', 'NodeId'),
5169
        ('IsForward', 'Boolean'),
5170
        ('TargetServerUri', 'String'),
5171
        ('TargetNodeId', 'ExpandedNodeId'),
5172
        ('TargetNodeClass', 'NodeClass'),
5173
               ]
5174
5175
    def __init__(self):
5176
        self.SourceNodeId = NodeId()
5177
        self.ReferenceTypeId = NodeId()
5178
        self.IsForward = True
5179
        self.TargetServerUri = None
5180
        self.TargetNodeId = ExpandedNodeId()
5181
        self.TargetNodeClass = NodeClass(0)
5182
        self._freeze = True
5183
5184
    def to_binary(self):
5185
        packet = []
5186
        packet.append(self.SourceNodeId.to_binary())
5187
        packet.append(self.ReferenceTypeId.to_binary())
5188
        packet.append(uabin.Primitives.Boolean.pack(self.IsForward))
5189
        packet.append(uabin.Primitives.String.pack(self.TargetServerUri))
5190
        packet.append(self.TargetNodeId.to_binary())
5191
        packet.append(uabin.Primitives.UInt32.pack(self.TargetNodeClass.value))
5192
        return b''.join(packet)
5193
5194
    @staticmethod
5195
    def from_binary(data):
5196
        obj = AddReferencesItem()
5197
        obj.SourceNodeId = NodeId.from_binary(data)
5198
        obj.ReferenceTypeId = NodeId.from_binary(data)
5199
        self.IsForward = uabin.Primitives.Boolean.unpack(data)
5200
        self.TargetServerUri = uabin.Primitives.String.unpack(data)
5201
        obj.TargetNodeId = ExpandedNodeId.from_binary(data)
5202
        self.TargetNodeClass = NodeClass(uabin.Primitives.UInt32.unpack(data))
5203
        return obj
5204
5205
    def __str__(self):
5206
        return 'AddReferencesItem(' + 'SourceNodeId:' + str(self.SourceNodeId) + ', ' + \
5207
               'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
5208
               'IsForward:' + str(self.IsForward) + ', ' + \
5209
               'TargetServerUri:' + str(self.TargetServerUri) + ', ' + \
5210
               'TargetNodeId:' + str(self.TargetNodeId) + ', ' + \
5211
               'TargetNodeClass:' + str(self.TargetNodeClass) + ')'
5212
5213
    __repr__ = __str__
5214
5215
5216
class AddReferencesParameters(FrozenClass):
@@ 4729-4795 (lines=67) @@
4726
    __repr__ = __str__
4727
4728
4729
class DataTypeAttributes(FrozenClass):
4730
    '''
4731
    The attributes for a data type node.
4732
4733
    :ivar SpecifiedAttributes:
4734
    :vartype SpecifiedAttributes: UInt32
4735
    :ivar DisplayName:
4736
    :vartype DisplayName: LocalizedText
4737
    :ivar Description:
4738
    :vartype Description: LocalizedText
4739
    :ivar WriteMask:
4740
    :vartype WriteMask: UInt32
4741
    :ivar UserWriteMask:
4742
    :vartype UserWriteMask: UInt32
4743
    :ivar IsAbstract:
4744
    :vartype IsAbstract: Boolean
4745
    '''
4746
4747
    ua_types = [
4748
4749
        ('SpecifiedAttributes', 'UInt32'),
4750
        ('DisplayName', 'LocalizedText'),
4751
        ('Description', 'LocalizedText'),
4752
        ('WriteMask', 'UInt32'),
4753
        ('UserWriteMask', 'UInt32'),
4754
        ('IsAbstract', 'Boolean'),
4755
               ]
4756
4757
    def __init__(self):
4758
        self.SpecifiedAttributes = 0
4759
        self.DisplayName = LocalizedText()
4760
        self.Description = LocalizedText()
4761
        self.WriteMask = 0
4762
        self.UserWriteMask = 0
4763
        self.IsAbstract = True
4764
        self._freeze = True
4765
4766
    def to_binary(self):
4767
        packet = []
4768
        packet.append(uabin.Primitives.UInt32.pack(self.SpecifiedAttributes))
4769
        packet.append(self.DisplayName.to_binary())
4770
        packet.append(self.Description.to_binary())
4771
        packet.append(uabin.Primitives.UInt32.pack(self.WriteMask))
4772
        packet.append(uabin.Primitives.UInt32.pack(self.UserWriteMask))
4773
        packet.append(uabin.Primitives.Boolean.pack(self.IsAbstract))
4774
        return b''.join(packet)
4775
4776
    @staticmethod
4777
    def from_binary(data):
4778
        obj = DataTypeAttributes()
4779
        self.SpecifiedAttributes = uabin.Primitives.UInt32.unpack(data)
4780
        obj.DisplayName = LocalizedText.from_binary(data)
4781
        obj.Description = LocalizedText.from_binary(data)
4782
        self.WriteMask = uabin.Primitives.UInt32.unpack(data)
4783
        self.UserWriteMask = uabin.Primitives.UInt32.unpack(data)
4784
        self.IsAbstract = uabin.Primitives.Boolean.unpack(data)
4785
        return obj
4786
4787
    def __str__(self):
4788
        return 'DataTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4789
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4790
               'Description:' + str(self.Description) + ', ' + \
4791
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4792
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4793
               'IsAbstract:' + str(self.IsAbstract) + ')'
4794
4795
    __repr__ = __str__
4796
4797
4798
class ViewAttributes(FrozenClass):
@@ 4478-4544 (lines=67) @@
4475
    __repr__ = __str__
4476
4477
4478
class ObjectTypeAttributes(FrozenClass):
4479
    '''
4480
    The attributes for an object type node.
4481
4482
    :ivar SpecifiedAttributes:
4483
    :vartype SpecifiedAttributes: UInt32
4484
    :ivar DisplayName:
4485
    :vartype DisplayName: LocalizedText
4486
    :ivar Description:
4487
    :vartype Description: LocalizedText
4488
    :ivar WriteMask:
4489
    :vartype WriteMask: UInt32
4490
    :ivar UserWriteMask:
4491
    :vartype UserWriteMask: UInt32
4492
    :ivar IsAbstract:
4493
    :vartype IsAbstract: Boolean
4494
    '''
4495
4496
    ua_types = [
4497
4498
        ('SpecifiedAttributes', 'UInt32'),
4499
        ('DisplayName', 'LocalizedText'),
4500
        ('Description', 'LocalizedText'),
4501
        ('WriteMask', 'UInt32'),
4502
        ('UserWriteMask', 'UInt32'),
4503
        ('IsAbstract', 'Boolean'),
4504
               ]
4505
4506
    def __init__(self):
4507
        self.SpecifiedAttributes = 0
4508
        self.DisplayName = LocalizedText()
4509
        self.Description = LocalizedText()
4510
        self.WriteMask = 0
4511
        self.UserWriteMask = 0
4512
        self.IsAbstract = True
4513
        self._freeze = True
4514
4515
    def to_binary(self):
4516
        packet = []
4517
        packet.append(uabin.Primitives.UInt32.pack(self.SpecifiedAttributes))
4518
        packet.append(self.DisplayName.to_binary())
4519
        packet.append(self.Description.to_binary())
4520
        packet.append(uabin.Primitives.UInt32.pack(self.WriteMask))
4521
        packet.append(uabin.Primitives.UInt32.pack(self.UserWriteMask))
4522
        packet.append(uabin.Primitives.Boolean.pack(self.IsAbstract))
4523
        return b''.join(packet)
4524
4525
    @staticmethod
4526
    def from_binary(data):
4527
        obj = ObjectTypeAttributes()
4528
        self.SpecifiedAttributes = uabin.Primitives.UInt32.unpack(data)
4529
        obj.DisplayName = LocalizedText.from_binary(data)
4530
        obj.Description = LocalizedText.from_binary(data)
4531
        self.WriteMask = uabin.Primitives.UInt32.unpack(data)
4532
        self.UserWriteMask = uabin.Primitives.UInt32.unpack(data)
4533
        self.IsAbstract = uabin.Primitives.Boolean.unpack(data)
4534
        return obj
4535
4536
    def __str__(self):
4537
        return 'ObjectTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4538
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4539
               'Description:' + str(self.Description) + ', ' + \
4540
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4541
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4542
               'IsAbstract:' + str(self.IsAbstract) + ')'
4543
4544
    __repr__ = __str__
4545
4546
4547
class VariableTypeAttributes(FrozenClass):