Code Duplication    Length = 67-67 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 4306-4372 (lines=67) @@
4303
    __repr__ = __str__
4304
4305
4306
class ViewAttributes(FrozenClass):
4307
    '''
4308
    The attributes for a view node.
4309
4310
    :ivar SpecifiedAttributes:
4311
    :vartype SpecifiedAttributes: UInt32
4312
    :ivar DisplayName:
4313
    :vartype DisplayName: LocalizedText
4314
    :ivar Description:
4315
    :vartype Description: LocalizedText
4316
    :ivar WriteMask:
4317
    :vartype WriteMask: UInt32
4318
    :ivar UserWriteMask:
4319
    :vartype UserWriteMask: UInt32
4320
    :ivar ContainsNoLoops:
4321
    :vartype ContainsNoLoops: Boolean
4322
    :ivar EventNotifier:
4323
    :vartype EventNotifier: Byte
4324
    '''
4325
    def __init__(self, binary=None):
4326
        if binary is not None:
4327
            self._binary_init(binary)
4328
            self._freeze = True
4329
            return
4330
        self.SpecifiedAttributes = 0
4331
        self.DisplayName = LocalizedText()
4332
        self.Description = LocalizedText()
4333
        self.WriteMask = 0
4334
        self.UserWriteMask = 0
4335
        self.ContainsNoLoops = True
4336
        self.EventNotifier = 0
4337
        self._freeze = True
4338
4339
    def to_binary(self):
4340
        packet = []
4341
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
4342
        packet.append(self.DisplayName.to_binary())
4343
        packet.append(self.Description.to_binary())
4344
        packet.append(uatype_UInt32.pack(self.WriteMask))
4345
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
4346
        packet.append(uatype_Boolean.pack(self.ContainsNoLoops))
4347
        packet.append(uatype_Byte.pack(self.EventNotifier))
4348
        return b''.join(packet)
4349
4350
    @staticmethod
4351
    def from_binary(data):
4352
        return ViewAttributes(data)
4353
4354
    def _binary_init(self, data):
4355
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
4356
        self.DisplayName = LocalizedText.from_binary(data)
4357
        self.Description = LocalizedText.from_binary(data)
4358
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4359
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4360
        self.ContainsNoLoops = uatype_Boolean.unpack(data.read(1))[0]
4361
        self.EventNotifier = uatype_Byte.unpack(data.read(1))[0]
4362
4363
    def __str__(self):
4364
        return 'ViewAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4365
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4366
               'Description:' + str(self.Description) + ', ' + \
4367
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4368
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4369
               'ContainsNoLoops:' + str(self.ContainsNoLoops) + ', ' + \
4370
               'EventNotifier:' + str(self.EventNotifier) + ')'
4371
4372
    __repr__ = __str__
4373
4374
4375
class AddNodesItem(FrozenClass):
@@ 3947-4013 (lines=67) @@
3944
    __repr__ = __str__
3945
3946
3947
class MethodAttributes(FrozenClass):
3948
    '''
3949
    The attributes for a method node.
3950
3951
    :ivar SpecifiedAttributes:
3952
    :vartype SpecifiedAttributes: UInt32
3953
    :ivar DisplayName:
3954
    :vartype DisplayName: LocalizedText
3955
    :ivar Description:
3956
    :vartype Description: LocalizedText
3957
    :ivar WriteMask:
3958
    :vartype WriteMask: UInt32
3959
    :ivar UserWriteMask:
3960
    :vartype UserWriteMask: UInt32
3961
    :ivar Executable:
3962
    :vartype Executable: Boolean
3963
    :ivar UserExecutable:
3964
    :vartype UserExecutable: Boolean
3965
    '''
3966
    def __init__(self, binary=None):
3967
        if binary is not None:
3968
            self._binary_init(binary)
3969
            self._freeze = True
3970
            return
3971
        self.SpecifiedAttributes = 0
3972
        self.DisplayName = LocalizedText()
3973
        self.Description = LocalizedText()
3974
        self.WriteMask = 0
3975
        self.UserWriteMask = 0
3976
        self.Executable = True
3977
        self.UserExecutable = True
3978
        self._freeze = True
3979
3980
    def to_binary(self):
3981
        packet = []
3982
        packet.append(uatype_UInt32.pack(self.SpecifiedAttributes))
3983
        packet.append(self.DisplayName.to_binary())
3984
        packet.append(self.Description.to_binary())
3985
        packet.append(uatype_UInt32.pack(self.WriteMask))
3986
        packet.append(uatype_UInt32.pack(self.UserWriteMask))
3987
        packet.append(uatype_Boolean.pack(self.Executable))
3988
        packet.append(uatype_Boolean.pack(self.UserExecutable))
3989
        return b''.join(packet)
3990
3991
    @staticmethod
3992
    def from_binary(data):
3993
        return MethodAttributes(data)
3994
3995
    def _binary_init(self, data):
3996
        self.SpecifiedAttributes = uatype_UInt32.unpack(data.read(4))[0]
3997
        self.DisplayName = LocalizedText.from_binary(data)
3998
        self.Description = LocalizedText.from_binary(data)
3999
        self.WriteMask = uatype_UInt32.unpack(data.read(4))[0]
4000
        self.UserWriteMask = uatype_UInt32.unpack(data.read(4))[0]
4001
        self.Executable = uatype_Boolean.unpack(data.read(1))[0]
4002
        self.UserExecutable = uatype_Boolean.unpack(data.read(1))[0]
4003
4004
    def __str__(self):
4005
        return 'MethodAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4006
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4007
               'Description:' + str(self.Description) + ', ' + \
4008
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4009
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4010
               'Executable:' + str(self.Executable) + ', ' + \
4011
               'UserExecutable:' + str(self.UserExecutable) + ')'
4012
4013
    __repr__ = __str__
4014
4015
4016
class ObjectTypeAttributes(FrozenClass):