Code Duplication    Length = 34-36 lines in 7 locations

opcua/ua/uaprotocol_auto.py 7 locations

@@ 14477-14512 (lines=36) @@
14474
    __repr__ = __str__
14475
14476
14477
class EndpointUrlListDataType(FrozenClass):
14478
    '''
14479
    :ivar EndpointUrlList:
14480
    :vartype EndpointUrlList: String
14481
    '''
14482
14483
    ua_types = {
14484
        'EndpointUrlList': 'String',
14485
               }
14486
14487
    def __init__(self, binary=None):
14488
        if binary is not None:
14489
            self._binary_init(binary)
14490
            self._freeze = True
14491
            return
14492
        self.EndpointUrlList = []
14493
        self._freeze = True
14494
14495
    def to_binary(self):
14496
        packet = []
14497
        packet.append(uabin.Primitives.Int32.pack(len(self.EndpointUrlList)))
14498
        for fieldname in self.EndpointUrlList:
14499
            packet.append(uabin.Primitives.String.pack(fieldname))
14500
        return b''.join(packet)
14501
14502
    @staticmethod
14503
    def from_binary(data):
14504
        return EndpointUrlListDataType(data)
14505
14506
    def _binary_init(self, data):
14507
        self.EndpointUrlList = uabin.Primitives.String.unpack_array(data)
14508
14509
    def __str__(self):
14510
        return 'EndpointUrlListDataType(' + 'EndpointUrlList:' + str(self.EndpointUrlList) + ')'
14511
14512
    __repr__ = __str__
14513
14514
14515
class NetworkGroupDataType(FrozenClass):
@@ 14197-14232 (lines=36) @@
14194
    __repr__ = __str__
14195
14196
14197
class DeleteSubscriptionsParameters(FrozenClass):
14198
    '''
14199
    :ivar SubscriptionIds:
14200
    :vartype SubscriptionIds: UInt32
14201
    '''
14202
14203
    ua_types = {
14204
        'SubscriptionIds': 'UInt32',
14205
               }
14206
14207
    def __init__(self, binary=None):
14208
        if binary is not None:
14209
            self._binary_init(binary)
14210
            self._freeze = True
14211
            return
14212
        self.SubscriptionIds = []
14213
        self._freeze = True
14214
14215
    def to_binary(self):
14216
        packet = []
14217
        packet.append(uabin.Primitives.Int32.pack(len(self.SubscriptionIds)))
14218
        for fieldname in self.SubscriptionIds:
14219
            packet.append(uabin.Primitives.UInt32.pack(fieldname))
14220
        return b''.join(packet)
14221
14222
    @staticmethod
14223
    def from_binary(data):
14224
        return DeleteSubscriptionsParameters(data)
14225
14226
    def _binary_init(self, data):
14227
        self.SubscriptionIds = uabin.Primitives.UInt32.unpack_array(data)
14228
14229
    def __str__(self):
14230
        return 'DeleteSubscriptionsParameters(' + 'SubscriptionIds:' + str(self.SubscriptionIds) + ')'
14231
14232
    __repr__ = __str__
14233
14234
14235
class DeleteSubscriptionsRequest(FrozenClass):
@@ 3418-3453 (lines=36) @@
3415
    __repr__ = __str__
3416
3417
3418
class AnonymousIdentityToken(FrozenClass):
3419
    '''
3420
    A token representing an anonymous user.
3421
3422
    :ivar PolicyId:
3423
    :vartype PolicyId: String
3424
    '''
3425
3426
    ua_types = {
3427
        'PolicyId': 'String',
3428
               }
3429
3430
    def __init__(self, binary=None):
3431
        if binary is not None:
3432
            self._binary_init(binary)
3433
            self._freeze = True
3434
            return
3435
        self.PolicyId = None
3436
        self._freeze = True
3437
3438
    def to_binary(self):
3439
        packet = []
3440
        packet.append(uabin.Primitives.String.pack(self.PolicyId))
3441
        return b''.join(packet)
3442
3443
    @staticmethod
3444
    def from_binary(data):
3445
        return AnonymousIdentityToken(data)
3446
3447
    def _binary_init(self, data):
3448
        self.PolicyId = uabin.Primitives.String.unpack(data)
3449
3450
    def __str__(self):
3451
        return 'AnonymousIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ')'
3452
3453
    __repr__ = __str__
3454
3455
3456
class UserNameIdentityToken(FrozenClass):
@@ 3380-3415 (lines=36) @@
3377
    __repr__ = __str__
3378
3379
3380
class UserIdentityToken(FrozenClass):
3381
    '''
3382
    A base type for a user identity token.
3383
3384
    :ivar PolicyId:
3385
    :vartype PolicyId: String
3386
    '''
3387
3388
    ua_types = {
3389
        'PolicyId': 'String',
3390
               }
3391
3392
    def __init__(self, binary=None):
3393
        if binary is not None:
3394
            self._binary_init(binary)
3395
            self._freeze = True
3396
            return
3397
        self.PolicyId = None
3398
        self._freeze = True
3399
3400
    def to_binary(self):
3401
        packet = []
3402
        packet.append(uabin.Primitives.String.pack(self.PolicyId))
3403
        return b''.join(packet)
3404
3405
    @staticmethod
3406
    def from_binary(data):
3407
        return UserIdentityToken(data)
3408
3409
    def _binary_init(self, data):
3410
        self.PolicyId = uabin.Primitives.String.unpack(data)
3411
3412
    def __str__(self):
3413
        return 'UserIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ')'
3414
3415
    __repr__ = __str__
3416
3417
3418
class AnonymousIdentityToken(FrozenClass):
@@ 7933-7966 (lines=34) @@
7930
    __repr__ = __str__
7931
7932
7933
class ElementOperand(FrozenClass):
7934
    '''
7935
    :ivar Index:
7936
    :vartype Index: UInt32
7937
    '''
7938
7939
    ua_types = {
7940
        'Index': 'UInt32',
7941
               }
7942
7943
    def __init__(self, binary=None):
7944
        if binary is not None:
7945
            self._binary_init(binary)
7946
            self._freeze = True
7947
            return
7948
        self.Index = 0
7949
        self._freeze = True
7950
7951
    def to_binary(self):
7952
        packet = []
7953
        packet.append(uabin.Primitives.UInt32.pack(self.Index))
7954
        return b''.join(packet)
7955
7956
    @staticmethod
7957
    def from_binary(data):
7958
        return ElementOperand(data)
7959
7960
    def _binary_init(self, data):
7961
        self.Index = uabin.Primitives.UInt32.unpack(data)
7962
7963
    def __str__(self):
7964
        return 'ElementOperand(' + 'Index:' + str(self.Index) + ')'
7965
7966
    __repr__ = __str__
7967
7968
7969
class LiteralOperand(FrozenClass):
@@ 4081-4114 (lines=34) @@
4078
    __repr__ = __str__
4079
4080
4081
class CancelResult(FrozenClass):
4082
    '''
4083
    :ivar CancelCount:
4084
    :vartype CancelCount: UInt32
4085
    '''
4086
4087
    ua_types = {
4088
        'CancelCount': 'UInt32',
4089
               }
4090
4091
    def __init__(self, binary=None):
4092
        if binary is not None:
4093
            self._binary_init(binary)
4094
            self._freeze = True
4095
            return
4096
        self.CancelCount = 0
4097
        self._freeze = True
4098
4099
    def to_binary(self):
4100
        packet = []
4101
        packet.append(uabin.Primitives.UInt32.pack(self.CancelCount))
4102
        return b''.join(packet)
4103
4104
    @staticmethod
4105
    def from_binary(data):
4106
        return CancelResult(data)
4107
4108
    def _binary_init(self, data):
4109
        self.CancelCount = uabin.Primitives.UInt32.unpack(data)
4110
4111
    def __str__(self):
4112
        return 'CancelResult(' + 'CancelCount:' + str(self.CancelCount) + ')'
4113
4114
    __repr__ = __str__
4115
4116
4117
class CancelResponse(FrozenClass):
@@ 3993-4026 (lines=34) @@
3990
    __repr__ = __str__
3991
3992
3993
class CancelParameters(FrozenClass):
3994
    '''
3995
    :ivar RequestHandle:
3996
    :vartype RequestHandle: UInt32
3997
    '''
3998
3999
    ua_types = {
4000
        'RequestHandle': 'UInt32',
4001
               }
4002
4003
    def __init__(self, binary=None):
4004
        if binary is not None:
4005
            self._binary_init(binary)
4006
            self._freeze = True
4007
            return
4008
        self.RequestHandle = 0
4009
        self._freeze = True
4010
4011
    def to_binary(self):
4012
        packet = []
4013
        packet.append(uabin.Primitives.UInt32.pack(self.RequestHandle))
4014
        return b''.join(packet)
4015
4016
    @staticmethod
4017
    def from_binary(data):
4018
        return CancelParameters(data)
4019
4020
    def _binary_init(self, data):
4021
        self.RequestHandle = uabin.Primitives.UInt32.unpack(data)
4022
4023
    def __str__(self):
4024
        return 'CancelParameters(' + 'RequestHandle:' + str(self.RequestHandle) + ')'
4025
4026
    __repr__ = __str__
4027
4028
4029
class CancelRequest(FrozenClass):