Code Duplication    Length = 67-67 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

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