Code Duplication    Length = 78-78 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 4850-4927 (lines=78) @@
4847
4848
class ViewAttributes(FrozenClass):
4849
    '''
4850
    The attributes for a view node.
4851
4852
    :ivar SpecifiedAttributes:
4853
    :vartype SpecifiedAttributes: UInt32
4854
    :ivar DisplayName:
4855
    :vartype DisplayName: LocalizedText
4856
    :ivar Description:
4857
    :vartype Description: LocalizedText
4858
    :ivar WriteMask:
4859
    :vartype WriteMask: UInt32
4860
    :ivar UserWriteMask:
4861
    :vartype UserWriteMask: UInt32
4862
    :ivar ContainsNoLoops:
4863
    :vartype ContainsNoLoops: Boolean
4864
    :ivar EventNotifier:
4865
    :vartype EventNotifier: Byte
4866
    '''
4867
4868
    ua_types = {
4869
        'SpecifiedAttributes': 'UInt32',
4870
        'DisplayName': 'LocalizedText',
4871
        'Description': 'LocalizedText',
4872
        'WriteMask': 'UInt32',
4873
        'UserWriteMask': 'UInt32',
4874
        'ContainsNoLoops': 'Boolean',
4875
        'EventNotifier': 'Byte',
4876
               }
4877
4878
    def __init__(self, binary=None):
4879
        if binary is not None:
4880
            self._binary_init(binary)
4881
            self._freeze = True
4882
            return
4883
        self.SpecifiedAttributes = 0
4884
        self.DisplayName = LocalizedText()
4885
        self.Description = LocalizedText()
4886
        self.WriteMask = 0
4887
        self.UserWriteMask = 0
4888
        self.ContainsNoLoops = True
4889
        self.EventNotifier = 0
4890
        self._freeze = True
4891
4892
    def to_binary(self):
4893
        packet = []
4894
        packet.append(uabin.Primitives.UInt32.pack(self.SpecifiedAttributes))
4895
        packet.append(self.DisplayName.to_binary())
4896
        packet.append(self.Description.to_binary())
4897
        packet.append(uabin.Primitives.UInt32.pack(self.WriteMask))
4898
        packet.append(uabin.Primitives.UInt32.pack(self.UserWriteMask))
4899
        packet.append(uabin.Primitives.Boolean.pack(self.ContainsNoLoops))
4900
        packet.append(uabin.Primitives.Byte.pack(self.EventNotifier))
4901
        return b''.join(packet)
4902
4903
    @staticmethod
4904
    def from_binary(data):
4905
        return ViewAttributes(data)
4906
4907
    def _binary_init(self, data):
4908
        self.SpecifiedAttributes = uabin.Primitives.UInt32.unpack(data)
4909
        self.DisplayName = LocalizedText.from_binary(data)
4910
        self.Description = LocalizedText.from_binary(data)
4911
        self.WriteMask = uabin.Primitives.UInt32.unpack(data)
4912
        self.UserWriteMask = uabin.Primitives.UInt32.unpack(data)
4913
        self.ContainsNoLoops = uabin.Primitives.Boolean.unpack(data)
4914
        self.EventNotifier = uabin.Primitives.Byte.unpack(data)
4915
4916
    def __str__(self):
4917
        return 'ViewAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4918
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4919
               'Description:' + str(self.Description) + ', ' + \
4920
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4921
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4922
               'ContainsNoLoops:' + str(self.ContainsNoLoops) + ', ' + \
4923
               'EventNotifier:' + str(self.EventNotifier) + ')'
4924
4925
    __repr__ = __str__
4926
4927
4928
class AddNodesItem(FrozenClass):
4929
    '''
4930
    A request to add a node to the server address space.
@@ 4434-4511 (lines=78) @@
4431
4432
class MethodAttributes(FrozenClass):
4433
    '''
4434
    The attributes for a method node.
4435
4436
    :ivar SpecifiedAttributes:
4437
    :vartype SpecifiedAttributes: UInt32
4438
    :ivar DisplayName:
4439
    :vartype DisplayName: LocalizedText
4440
    :ivar Description:
4441
    :vartype Description: LocalizedText
4442
    :ivar WriteMask:
4443
    :vartype WriteMask: UInt32
4444
    :ivar UserWriteMask:
4445
    :vartype UserWriteMask: UInt32
4446
    :ivar Executable:
4447
    :vartype Executable: Boolean
4448
    :ivar UserExecutable:
4449
    :vartype UserExecutable: Boolean
4450
    '''
4451
4452
    ua_types = {
4453
        'SpecifiedAttributes': 'UInt32',
4454
        'DisplayName': 'LocalizedText',
4455
        'Description': 'LocalizedText',
4456
        'WriteMask': 'UInt32',
4457
        'UserWriteMask': 'UInt32',
4458
        'Executable': 'Boolean',
4459
        'UserExecutable': 'Boolean',
4460
               }
4461
4462
    def __init__(self, binary=None):
4463
        if binary is not None:
4464
            self._binary_init(binary)
4465
            self._freeze = True
4466
            return
4467
        self.SpecifiedAttributes = 0
4468
        self.DisplayName = LocalizedText()
4469
        self.Description = LocalizedText()
4470
        self.WriteMask = 0
4471
        self.UserWriteMask = 0
4472
        self.Executable = True
4473
        self.UserExecutable = True
4474
        self._freeze = True
4475
4476
    def to_binary(self):
4477
        packet = []
4478
        packet.append(uabin.Primitives.UInt32.pack(self.SpecifiedAttributes))
4479
        packet.append(self.DisplayName.to_binary())
4480
        packet.append(self.Description.to_binary())
4481
        packet.append(uabin.Primitives.UInt32.pack(self.WriteMask))
4482
        packet.append(uabin.Primitives.UInt32.pack(self.UserWriteMask))
4483
        packet.append(uabin.Primitives.Boolean.pack(self.Executable))
4484
        packet.append(uabin.Primitives.Boolean.pack(self.UserExecutable))
4485
        return b''.join(packet)
4486
4487
    @staticmethod
4488
    def from_binary(data):
4489
        return MethodAttributes(data)
4490
4491
    def _binary_init(self, data):
4492
        self.SpecifiedAttributes = uabin.Primitives.UInt32.unpack(data)
4493
        self.DisplayName = LocalizedText.from_binary(data)
4494
        self.Description = LocalizedText.from_binary(data)
4495
        self.WriteMask = uabin.Primitives.UInt32.unpack(data)
4496
        self.UserWriteMask = uabin.Primitives.UInt32.unpack(data)
4497
        self.Executable = uabin.Primitives.Boolean.unpack(data)
4498
        self.UserExecutable = uabin.Primitives.Boolean.unpack(data)
4499
4500
    def __str__(self):
4501
        return 'MethodAttributes(' + 'SpecifiedAttributes:' + str(self.SpecifiedAttributes) + ', ' + \
4502
               'DisplayName:' + str(self.DisplayName) + ', ' + \
4503
               'Description:' + str(self.Description) + ', ' + \
4504
               'WriteMask:' + str(self.WriteMask) + ', ' + \
4505
               'UserWriteMask:' + str(self.UserWriteMask) + ', ' + \
4506
               'Executable:' + str(self.Executable) + ', ' + \
4507
               'UserExecutable:' + str(self.UserExecutable) + ')'
4508
4509
    __repr__ = __str__
4510
4511
4512
class ObjectTypeAttributes(FrozenClass):
4513
    '''
4514
    The attributes for an object type node.