Code Duplication    Length = 61-61 lines in 3 locations

opcua/ua/uaprotocol_auto.py 3 locations

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