Code Duplication    Length = 62-71 lines in 3 locations

opcua/ua/uaprotocol_auto.py 3 locations

@@ 4777-4847 (lines=71) @@
4774
    __repr__ = __str__
4775
4776
4777
class DataTypeAttributes(FrozenClass):
4778
    '''
4779
    The attributes for a data type node.
4780
4781
    :ivar SpecifiedAttributes:
4782
    :vartype SpecifiedAttributes: UInt32
4783
    :ivar DisplayName:
4784
    :vartype DisplayName: LocalizedText
4785
    :ivar Description:
4786
    :vartype Description: LocalizedText
4787
    :ivar WriteMask:
4788
    :vartype WriteMask: UInt32
4789
    :ivar UserWriteMask:
4790
    :vartype UserWriteMask: UInt32
4791
    :ivar IsAbstract:
4792
    :vartype IsAbstract: Boolean
4793
    '''
4794
4795
    ua_types = {
4796
        'SpecifiedAttributes': 'UInt32',
4797
        'DisplayName': 'LocalizedText',
4798
        'Description': 'LocalizedText',
4799
        'WriteMask': 'UInt32',
4800
        'UserWriteMask': 'UInt32',
4801
        'IsAbstract': 'Boolean',
4802
               }
4803
4804
    def __init__(self, binary=None):
4805
        if binary is not None:
4806
            self._binary_init(binary)
4807
            self._freeze = True
4808
            return
4809
        self.SpecifiedAttributes = 0
4810
        self.DisplayName = LocalizedText()
4811
        self.Description = LocalizedText()
4812
        self.WriteMask = 0
4813
        self.UserWriteMask = 0
4814
        self.IsAbstract = True
4815
        self._freeze = True
4816
4817
    def to_binary(self):
4818
        packet = []
4819
        packet.append(uabin.Primitives.UInt32.pack(self.SpecifiedAttributes))
4820
        packet.append(self.DisplayName.to_binary())
4821
        packet.append(self.Description.to_binary())
4822
        packet.append(uabin.Primitives.UInt32.pack(self.WriteMask))
4823
        packet.append(uabin.Primitives.UInt32.pack(self.UserWriteMask))
4824
        packet.append(uabin.Primitives.Boolean.pack(self.IsAbstract))
4825
        return b''.join(packet)
4826
4827
    @staticmethod
4828
    def from_binary(data):
4829
        return DataTypeAttributes(data)
4830
4831
    def _binary_init(self, data):
4832
        self.SpecifiedAttributes = uabin.Primitives.UInt32.unpack(data)
4833
        self.DisplayName = LocalizedText.from_binary(data)
4834
        self.Description = LocalizedText.from_binary(data)
4835
        self.WriteMask = uabin.Primitives.UInt32.unpack(data)
4836
        self.UserWriteMask = uabin.Primitives.UInt32.unpack(data)
4837
        self.IsAbstract = uabin.Primitives.Boolean.unpack(data)
4838
4839
    def __str__(self):
4840
        return 'DataTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4841
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4842
               'Description:' + str(self.Description) + ', ' + \
4843
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4844
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4845
               'IsAbstract:' + str(self.IsAbstract) + ')'
4846
4847
    __repr__ = __str__
4848
4849
4850
class ViewAttributes(FrozenClass):
@@ 4514-4584 (lines=71) @@
4511
    __repr__ = __str__
4512
4513
4514
class ObjectTypeAttributes(FrozenClass):
4515
    '''
4516
    The attributes for an object type node.
4517
4518
    :ivar SpecifiedAttributes:
4519
    :vartype SpecifiedAttributes: UInt32
4520
    :ivar DisplayName:
4521
    :vartype DisplayName: LocalizedText
4522
    :ivar Description:
4523
    :vartype Description: LocalizedText
4524
    :ivar WriteMask:
4525
    :vartype WriteMask: UInt32
4526
    :ivar UserWriteMask:
4527
    :vartype UserWriteMask: UInt32
4528
    :ivar IsAbstract:
4529
    :vartype IsAbstract: Boolean
4530
    '''
4531
4532
    ua_types = {
4533
        'SpecifiedAttributes': 'UInt32',
4534
        'DisplayName': 'LocalizedText',
4535
        'Description': 'LocalizedText',
4536
        'WriteMask': 'UInt32',
4537
        'UserWriteMask': 'UInt32',
4538
        'IsAbstract': 'Boolean',
4539
               }
4540
4541
    def __init__(self, binary=None):
4542
        if binary is not None:
4543
            self._binary_init(binary)
4544
            self._freeze = True
4545
            return
4546
        self.SpecifiedAttributes = 0
4547
        self.DisplayName = LocalizedText()
4548
        self.Description = LocalizedText()
4549
        self.WriteMask = 0
4550
        self.UserWriteMask = 0
4551
        self.IsAbstract = True
4552
        self._freeze = True
4553
4554
    def to_binary(self):
4555
        packet = []
4556
        packet.append(uabin.Primitives.UInt32.pack(self.SpecifiedAttributes))
4557
        packet.append(self.DisplayName.to_binary())
4558
        packet.append(self.Description.to_binary())
4559
        packet.append(uabin.Primitives.UInt32.pack(self.WriteMask))
4560
        packet.append(uabin.Primitives.UInt32.pack(self.UserWriteMask))
4561
        packet.append(uabin.Primitives.Boolean.pack(self.IsAbstract))
4562
        return b''.join(packet)
4563
4564
    @staticmethod
4565
    def from_binary(data):
4566
        return ObjectTypeAttributes(data)
4567
4568
    def _binary_init(self, data):
4569
        self.SpecifiedAttributes = uabin.Primitives.UInt32.unpack(data)
4570
        self.DisplayName = LocalizedText.from_binary(data)
4571
        self.Description = LocalizedText.from_binary(data)
4572
        self.WriteMask = uabin.Primitives.UInt32.unpack(data)
4573
        self.UserWriteMask = uabin.Primitives.UInt32.unpack(data)
4574
        self.IsAbstract = uabin.Primitives.Boolean.unpack(data)
4575
4576
    def __str__(self):
4577
        return 'ObjectTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4578
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4579
               'Description:' + str(self.Description) + ', ' + \
4580
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4581
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4582
               'IsAbstract:' + str(self.IsAbstract) + ')'
4583
4584
    __repr__ = __str__
4585
4586
4587
class VariableTypeAttributes(FrozenClass):
@@ 9163-9224 (lines=62) @@
9160
    __repr__ = __str__
9161
9162
9163
class ReadRawModifiedDetails(FrozenClass):
9164
    '''
9165
    :ivar IsReadModified:
9166
    :vartype IsReadModified: Boolean
9167
    :ivar StartTime:
9168
    :vartype StartTime: DateTime
9169
    :ivar EndTime:
9170
    :vartype EndTime: DateTime
9171
    :ivar NumValuesPerNode:
9172
    :vartype NumValuesPerNode: UInt32
9173
    :ivar ReturnBounds:
9174
    :vartype ReturnBounds: Boolean
9175
    '''
9176
9177
    ua_types = {
9178
        'IsReadModified': 'Boolean',
9179
        'StartTime': 'DateTime',
9180
        'EndTime': 'DateTime',
9181
        'NumValuesPerNode': 'UInt32',
9182
        'ReturnBounds': 'Boolean',
9183
               }
9184
9185
    def __init__(self, binary=None):
9186
        if binary is not None:
9187
            self._binary_init(binary)
9188
            self._freeze = True
9189
            return
9190
        self.IsReadModified = True
9191
        self.StartTime = datetime.now()
9192
        self.EndTime = datetime.now()
9193
        self.NumValuesPerNode = 0
9194
        self.ReturnBounds = True
9195
        self._freeze = True
9196
9197
    def to_binary(self):
9198
        packet = []
9199
        packet.append(uabin.Primitives.Boolean.pack(self.IsReadModified))
9200
        packet.append(uabin.Primitives.DateTime.pack(self.StartTime))
9201
        packet.append(uabin.Primitives.DateTime.pack(self.EndTime))
9202
        packet.append(uabin.Primitives.UInt32.pack(self.NumValuesPerNode))
9203
        packet.append(uabin.Primitives.Boolean.pack(self.ReturnBounds))
9204
        return b''.join(packet)
9205
9206
    @staticmethod
9207
    def from_binary(data):
9208
        return ReadRawModifiedDetails(data)
9209
9210
    def _binary_init(self, data):
9211
        self.IsReadModified = uabin.Primitives.Boolean.unpack(data)
9212
        self.StartTime = uabin.Primitives.DateTime.unpack(data)
9213
        self.EndTime = uabin.Primitives.DateTime.unpack(data)
9214
        self.NumValuesPerNode = uabin.Primitives.UInt32.unpack(data)
9215
        self.ReturnBounds = uabin.Primitives.Boolean.unpack(data)
9216
9217
    def __str__(self):
9218
        return 'ReadRawModifiedDetails(' + 'IsReadModified:' + str(self.IsReadModified) + ', ' + \
9219
               'StartTime:' + str(self.StartTime) + ', ' + \
9220
               'EndTime:' + str(self.EndTime) + ', ' + \
9221
               'NumValuesPerNode:' + str(self.NumValuesPerNode) + ', ' + \
9222
               'ReturnBounds:' + str(self.ReturnBounds) + ')'
9223
9224
    __repr__ = __str__
9225
9226
9227
class ReadProcessedDetails(FrozenClass):