Code Duplication    Length = 61-61 lines in 3 locations

opcua/ua/uaprotocol_auto.py 3 locations

@@ 4243-4303 (lines=61) @@
4240
    __repr__ = __str__
4241
4242
4243
class DataTypeAttributes(FrozenClass):
4244
    '''
4245
    The attributes for a data type node.
4246
4247
    :ivar SpecifiedAttributes:
4248
    :vartype SpecifiedAttributes: UInt32
4249
    :ivar DisplayName:
4250
    :vartype DisplayName: LocalizedText
4251
    :ivar Description:
4252
    :vartype Description: LocalizedText
4253
    :ivar WriteMask:
4254
    :vartype WriteMask: UInt32
4255
    :ivar UserWriteMask:
4256
    :vartype UserWriteMask: UInt32
4257
    :ivar IsAbstract:
4258
    :vartype IsAbstract: Boolean
4259
    '''
4260
    def __init__(self, binary=None):
4261
        if binary is not None:
4262
            self._binary_init(binary)
4263
            self._freeze = True
4264
            return
4265
        self.SpecifiedAttributes = 0
4266
        self.DisplayName = LocalizedText()
4267
        self.Description = LocalizedText()
4268
        self.WriteMask = 0
4269
        self.UserWriteMask = 0
4270
        self.IsAbstract = True
4271
        self._freeze = True
4272
4273
    def to_binary(self):
4274
        packet = []
4275
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4276
        packet.append(self.DisplayName.to_binary())
4277
        packet.append(self.Description.to_binary())
4278
        packet.append(uatype_UInt32.pack(self.WriteMask))
4279
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4280
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4281
        return b''.join(packet)
4282
4283
    @staticmethod
4284
    def from_binary(data):
4285
        return DataTypeAttributes(data)
4286
4287
    def _binary_init(self, data):
4288
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4289
        self.DisplayName = LocalizedText.from_binary(data)
4290
        self.Description = LocalizedText.from_binary(data)
4291
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4292
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4293
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4294
4295
    def __str__(self):
4296
        return 'DataTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4297
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4298
               'Description:' + str(self.Description) + ', ' + \
4299
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4300
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4301
               'IsAbstract:' + str(self.IsAbstract) + ')'
4302
4303
    __repr__ = __str__
4304
4305
4306
class ViewAttributes(FrozenClass):
@@ 4016-4076 (lines=61) @@
4013
    __repr__ = __str__
4014
4015
4016
class ObjectTypeAttributes(FrozenClass):
4017
    '''
4018
    The attributes for an object type node.
4019
4020
    :ivar SpecifiedAttributes:
4021
    :vartype SpecifiedAttributes: UInt32
4022
    :ivar DisplayName:
4023
    :vartype DisplayName: LocalizedText
4024
    :ivar Description:
4025
    :vartype Description: LocalizedText
4026
    :ivar WriteMask:
4027
    :vartype WriteMask: UInt32
4028
    :ivar UserWriteMask:
4029
    :vartype UserWriteMask: UInt32
4030
    :ivar IsAbstract:
4031
    :vartype IsAbstract: Boolean
4032
    '''
4033
    def __init__(self, binary=None):
4034
        if binary is not None:
4035
            self._binary_init(binary)
4036
            self._freeze = True
4037
            return
4038
        self.SpecifiedAttributes = 0
4039
        self.DisplayName = LocalizedText()
4040
        self.Description = LocalizedText()
4041
        self.WriteMask = 0
4042
        self.UserWriteMask = 0
4043
        self.IsAbstract = True
4044
        self._freeze = True
4045
4046
    def to_binary(self):
4047
        packet = []
4048
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4049
        packet.append(self.DisplayName.to_binary())
4050
        packet.append(self.Description.to_binary())
4051
        packet.append(uatype_UInt32.pack(self.WriteMask))
4052
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4053
        packet.append(uatype_Boolean.pack(self.IsAbstract))
4054
        return b''.join(packet)
4055
4056
    @staticmethod
4057
    def from_binary(data):
4058
        return ObjectTypeAttributes(data)
4059
4060
    def _binary_init(self, data):
4061
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4062
        self.DisplayName = LocalizedText.from_binary(data)
4063
        self.Description = LocalizedText.from_binary(data)
4064
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4065
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4066
        self.IsAbstract = uatype_Boolean.unpack(data.read(1))[0]
4067
4068
    def __str__(self):
4069
        return 'ObjectTypeAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4070
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4071
               'Description:' + str(self.Description) + ', ' + \
4072
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4073
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4074
               'IsAbstract:' + str(self.IsAbstract) + ')'
4075
4076
    __repr__ = __str__
4077
4078
4079
class VariableTypeAttributes(FrozenClass):
@@ 3777-3837 (lines=61) @@
3774
    __repr__ = __str__
3775
3776
3777
class ObjectAttributes(FrozenClass):
3778
    '''
3779
    The attributes for an object node.
3780
3781
    :ivar SpecifiedAttributes:
3782
    :vartype SpecifiedAttributes: UInt32
3783
    :ivar DisplayName:
3784
    :vartype DisplayName: LocalizedText
3785
    :ivar Description:
3786
    :vartype Description: LocalizedText
3787
    :ivar WriteMask:
3788
    :vartype WriteMask: UInt32
3789
    :ivar UserWriteMask:
3790
    :vartype UserWriteMask: UInt32
3791
    :ivar EventNotifier:
3792
    :vartype EventNotifier: Byte
3793
    '''
3794
    def __init__(self, binary=None):
3795
        if binary is not None:
3796
            self._binary_init(binary)
3797
            self._freeze = True
3798
            return
3799
        self.SpecifiedAttributes = 0
3800
        self.DisplayName = LocalizedText()
3801
        self.Description = LocalizedText()
3802
        self.WriteMask = 0
3803
        self.UserWriteMask = 0
3804
        self.EventNotifier = 0
3805
        self._freeze = True
3806
3807
    def to_binary(self):
3808
        packet = []
3809
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3810
        packet.append(self.DisplayName.to_binary())
3811
        packet.append(self.Description.to_binary())
3812
        packet.append(uatype_UInt32.pack(self.WriteMask))
3813
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3814
        packet.append(uatype_Byte.pack(self.EventNotifier))
3815
        return b''.join(packet)
3816
3817
    @staticmethod
3818
    def from_binary(data):
3819
        return ObjectAttributes(data)
3820
3821
    def _binary_init(self, data):
3822
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3823
        self.DisplayName = LocalizedText.from_binary(data)
3824
        self.Description = LocalizedText.from_binary(data)
3825
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
3826
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
3827
        self.EventNotifier = uatype_Byte.unpack(data.read(1))[0]
3828
3829
    def __str__(self):
3830
        return 'ObjectAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
3831
               'DisplayName:' + str(self.DisplayName) + ', ' + \
3832
               'Description:' + str(self.Description) + ', ' + \
3833
               'WriteMask:' + str(self.WriteMask) + ', ' + \
3834
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
3835
               'EventNotifier:' + str(self.EventNotifier) + ')'
3836
3837
    __repr__ = __str__
3838
3839
3840
class VariableAttributes(FrozenClass):