Code Duplication    Length = 29-31 lines in 4 locations

opcua/ua/uaprotocol_auto.py 4 locations

@@ 12430-12460 (lines=31) @@
12427
    __repr__ = __str__
12428
12429
12430
class DeleteSubscriptionsParameters(FrozenClass):
12431
    '''
12432
    :ivar SubscriptionIds:
12433
    :vartype SubscriptionIds: UInt32
12434
    '''
12435
    def __init__(self, binary=None):
12436
        if binary is not None:
12437
            self._binary_init(binary)
12438
            self._freeze = True
12439
            return
12440
        self.SubscriptionIds = []
12441
        self._freeze = True
12442
12443
    def to_binary(self):
12444
        packet = []
12445
        packet.append(uatype_Int32.pack(len(self.SubscriptionIds)))
12446
        for fieldname in self.SubscriptionIds:
12447
            packet.append(uatype_UInt32.pack(fieldname))
12448
        return b''.join(packet)
12449
12450
    @staticmethod
12451
    def from_binary(data):
12452
        return DeleteSubscriptionsParameters(data)
12453
12454
    def _binary_init(self, data):
12455
        self.SubscriptionIds = unpack_uatype_array('UInt32', data)
12456
12457
    def __str__(self):
12458
        return 'DeleteSubscriptionsParameters(' + 'SubscriptionIds:' + str(self.SubscriptionIds) + ')'
12459
12460
    __repr__ = __str__
12461
12462
12463
class DeleteSubscriptionsRequest(FrozenClass):
@@ 6969-6997 (lines=29) @@
6966
    __repr__ = __str__
6967
6968
6969
class ElementOperand(FrozenClass):
6970
    '''
6971
    :ivar Index:
6972
    :vartype Index: UInt32
6973
    '''
6974
    def __init__(self, binary=None):
6975
        if binary is not None:
6976
            self._binary_init(binary)
6977
            self._freeze = True
6978
            return
6979
        self.Index = 0
6980
        self._freeze = True
6981
6982
    def to_binary(self):
6983
        packet = []
6984
        packet.append(uatype_UInt32.pack(self.Index))
6985
        return b''.join(packet)
6986
6987
    @staticmethod
6988
    def from_binary(data):
6989
        return ElementOperand(data)
6990
6991
    def _binary_init(self, data):
6992
        self.Index = uatype_UInt32.unpack(data.read(4))[0]
6993
6994
    def __str__(self):
6995
        return 'ElementOperand(' + 'Index:' + str(self.Index) + ')'
6996
6997
    __repr__ = __str__
6998
6999
7000
class LiteralOperand(FrozenClass):
@@ 3644-3672 (lines=29) @@
3641
    __repr__ = __str__
3642
3643
3644
class CancelResult(FrozenClass):
3645
    '''
3646
    :ivar CancelCount:
3647
    :vartype CancelCount: UInt32
3648
    '''
3649
    def __init__(self, binary=None):
3650
        if binary is not None:
3651
            self._binary_init(binary)
3652
            self._freeze = True
3653
            return
3654
        self.CancelCount = 0
3655
        self._freeze = True
3656
3657
    def to_binary(self):
3658
        packet = []
3659
        packet.append(uatype_UInt32.pack(self.CancelCount))
3660
        return b''.join(packet)
3661
3662
    @staticmethod
3663
    def from_binary(data):
3664
        return CancelResult(data)
3665
3666
    def _binary_init(self, data):
3667
        self.CancelCount = uatype_UInt32.unpack(data.read(4))[0]
3668
3669
    def __str__(self):
3670
        return 'CancelResult(' + 'CancelCount:' + str(self.CancelCount) + ')'
3671
3672
    __repr__ = __str__
3673
3674
3675
class CancelResponse(FrozenClass):
@@ 3568-3596 (lines=29) @@
3565
    __repr__ = __str__
3566
3567
3568
class CancelParameters(FrozenClass):
3569
    '''
3570
    :ivar RequestHandle:
3571
    :vartype RequestHandle: UInt32
3572
    '''
3573
    def __init__(self, binary=None):
3574
        if binary is not None:
3575
            self._binary_init(binary)
3576
            self._freeze = True
3577
            return
3578
        self.RequestHandle = 0
3579
        self._freeze = True
3580
3581
    def to_binary(self):
3582
        packet = []
3583
        packet.append(uatype_UInt32.pack(self.RequestHandle))
3584
        return b''.join(packet)
3585
3586
    @staticmethod
3587
    def from_binary(data):
3588
        return CancelParameters(data)
3589
3590
    def _binary_init(self, data):
3591
        self.RequestHandle = uatype_UInt32.unpack(data.read(4))[0]
3592
3593
    def __str__(self):
3594
        return 'CancelParameters(' + 'RequestHandle:' + str(self.RequestHandle) + ')'
3595
3596
    __repr__ = __str__
3597
3598
3599
class CancelRequest(FrozenClass):