Code Duplication    Length = 35-37 lines in 6 locations

opcua/ua/uaprotocol_auto.py 6 locations

@@ 3152-3188 (lines=37) @@
3149
    __repr__ = __str__
3150
3151
3152
class X509IdentityToken(FrozenClass):
3153
    '''
3154
    A token representing a user identified by an X509 certificate.
3155
3156
    :ivar PolicyId:
3157
    :vartype PolicyId: String
3158
    :ivar CertificateData:
3159
    :vartype CertificateData: ByteString
3160
    '''
3161
    def __init__(self, binary=None):
3162
        if binary is not None:
3163
            self._binary_init(binary)
3164
            self._freeze = True
3165
            return
3166
        self.PolicyId = None
3167
        self.CertificateData = None
3168
        self._freeze = True
3169
3170
    def to_binary(self):
3171
        packet = []
3172
        packet.append(pack_string(self.PolicyId))
3173
        packet.append(pack_bytes(self.CertificateData))
3174
        return b''.join(packet)
3175
3176
    @staticmethod
3177
    def from_binary(data):
3178
        return X509IdentityToken(data)
3179
3180
    def _binary_init(self, data):
3181
        self.PolicyId = unpack_string(data)
3182
        self.CertificateData = unpack_bytes(data)
3183
3184
    def __str__(self):
3185
        return 'X509IdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3186
               'CertificateData:' + str(self.CertificateData) + ')'
3187
3188
    __repr__ = __str__
3189
3190
3191
class KerberosIdentityToken(FrozenClass):
@@ 2740-2776 (lines=37) @@
2737
    __repr__ = __str__
2738
2739
2740
class SignatureData(FrozenClass):
2741
    '''
2742
    A digital signature.
2743
2744
    :ivar Algorithm:
2745
    :vartype Algorithm: String
2746
    :ivar Signature:
2747
    :vartype Signature: ByteString
2748
    '''
2749
    def __init__(self, binary=None):
2750
        if binary is not None:
2751
            self._binary_init(binary)
2752
            self._freeze = True
2753
            return
2754
        self.Algorithm = None
2755
        self.Signature = None
2756
        self._freeze = True
2757
2758
    def to_binary(self):
2759
        packet = []
2760
        packet.append(pack_string(self.Algorithm))
2761
        packet.append(pack_bytes(self.Signature))
2762
        return b''.join(packet)
2763
2764
    @staticmethod
2765
    def from_binary(data):
2766
        return SignatureData(data)
2767
2768
    def _binary_init(self, data):
2769
        self.Algorithm = unpack_string(data)
2770
        self.Signature = unpack_bytes(data)
2771
2772
    def __str__(self):
2773
        return 'SignatureData(' + 'Algorithm:' + str(self.Algorithm) + ', ' + \
2774
               'Signature:' + str(self.Signature) + ')'
2775
2776
    __repr__ = __str__
2777
2778
2779
class CreateSessionParameters(FrozenClass):
@@ 2701-2737 (lines=37) @@
2698
    __repr__ = __str__
2699
2700
2701
class SignedSoftwareCertificate(FrozenClass):
2702
    '''
2703
    A software certificate with a digital signature.
2704
2705
    :ivar CertificateData:
2706
    :vartype CertificateData: ByteString
2707
    :ivar Signature:
2708
    :vartype Signature: ByteString
2709
    '''
2710
    def __init__(self, binary=None):
2711
        if binary is not None:
2712
            self._binary_init(binary)
2713
            self._freeze = True
2714
            return
2715
        self.CertificateData = None
2716
        self.Signature = None
2717
        self._freeze = True
2718
2719
    def to_binary(self):
2720
        packet = []
2721
        packet.append(pack_bytes(self.CertificateData))
2722
        packet.append(pack_bytes(self.Signature))
2723
        return b''.join(packet)
2724
2725
    @staticmethod
2726
    def from_binary(data):
2727
        return SignedSoftwareCertificate(data)
2728
2729
    def _binary_init(self, data):
2730
        self.CertificateData = unpack_bytes(data)
2731
        self.Signature = unpack_bytes(data)
2732
2733
    def __str__(self):
2734
        return 'SignedSoftwareCertificate(' + 'CertificateData:' + str(self.CertificateData) + ', ' + \
2735
               'Signature:' + str(self.Signature) + ')'
2736
2737
    __repr__ = __str__
2738
2739
2740
class SignatureData(FrozenClass):
@@ 994-1030 (lines=37) @@
991
    __repr__ = __str__
992
993
994
class OptionSet(FrozenClass):
995
    '''
996
    This abstract Structured DataType is the base DataType for all DataTypes representing a bit mask.
997
998
    :ivar Value:
999
    :vartype Value: ByteString
1000
    :ivar ValidBits:
1001
    :vartype ValidBits: ByteString
1002
    '''
1003
    def __init__(self, binary=None):
1004
        if binary is not None:
1005
            self._binary_init(binary)
1006
            self._freeze = True
1007
            return
1008
        self.Value = None
1009
        self.ValidBits = None
1010
        self._freeze = True
1011
1012
    def to_binary(self):
1013
        packet = []
1014
        packet.append(pack_bytes(self.Value))
1015
        packet.append(pack_bytes(self.ValidBits))
1016
        return b''.join(packet)
1017
1018
    @staticmethod
1019
    def from_binary(data):
1020
        return OptionSet(data)
1021
1022
    def _binary_init(self, data):
1023
        self.Value = unpack_bytes(data)
1024
        self.ValidBits = unpack_bytes(data)
1025
1026
    def __str__(self):
1027
        return 'OptionSet(' + 'Value:' + str(self.Value) + ', ' + \
1028
               'ValidBits:' + str(self.ValidBits) + ')'
1029
1030
    __repr__ = __str__
1031
1032
1033
class Union(FrozenClass):
@@ 7531-7565 (lines=35) @@
7528
    __repr__ = __str__
7529
7530
7531
class QueryNextParameters(FrozenClass):
7532
    '''
7533
    :ivar ReleaseContinuationPoint:
7534
    :vartype ReleaseContinuationPoint: Boolean
7535
    :ivar ContinuationPoint:
7536
    :vartype ContinuationPoint: ByteString
7537
    '''
7538
    def __init__(self, binary=None):
7539
        if binary is not None:
7540
            self._binary_init(binary)
7541
            self._freeze = True
7542
            return
7543
        self.ReleaseContinuationPoint = True
7544
        self.ContinuationPoint = None
7545
        self._freeze = True
7546
7547
    def to_binary(self):
7548
        packet = []
7549
        packet.append(uatype_Boolean.pack(self.ReleaseContinuationPoint))
7550
        packet.append(pack_bytes(self.ContinuationPoint))
7551
        return b''.join(packet)
7552
7553
    @staticmethod
7554
    def from_binary(data):
7555
        return QueryNextParameters(data)
7556
7557
    def _binary_init(self, data):
7558
        self.ReleaseContinuationPoint = uatype_Boolean.unpack(data.read(1))[0]
7559
        self.ContinuationPoint = unpack_bytes(data)
7560
7561
    def __str__(self):
7562
        return 'QueryNextParameters(' + 'ReleaseContinuationPoint:' + str(self.ReleaseContinuationPoint) + ', ' + \
7563
               'ContinuationPoint:' + str(self.ContinuationPoint) + ')'
7564
7565
    __repr__ = __str__
7566
7567
7568
class QueryNextRequest(FrozenClass):
@@ 3191-3225 (lines=35) @@
3188
    __repr__ = __str__
3189
3190
3191
class KerberosIdentityToken(FrozenClass):
3192
    '''
3193
    :ivar PolicyId:
3194
    :vartype PolicyId: String
3195
    :ivar TicketData:
3196
    :vartype TicketData: ByteString
3197
    '''
3198
    def __init__(self, binary=None):
3199
        if binary is not None:
3200
            self._binary_init(binary)
3201
            self._freeze = True
3202
            return
3203
        self.PolicyId = None
3204
        self.TicketData = None
3205
        self._freeze = True
3206
3207
    def to_binary(self):
3208
        packet = []
3209
        packet.append(pack_string(self.PolicyId))
3210
        packet.append(pack_bytes(self.TicketData))
3211
        return b''.join(packet)
3212
3213
    @staticmethod
3214
    def from_binary(data):
3215
        return KerberosIdentityToken(data)
3216
3217
    def _binary_init(self, data):
3218
        self.PolicyId = unpack_string(data)
3219
        self.TicketData = unpack_bytes(data)
3220
3221
    def __str__(self):
3222
        return 'KerberosIdentityToken(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \
3223
               'TicketData:' + str(self.TicketData) + ')'
3224
3225
    __repr__ = __str__
3226
3227
3228
class IssuedIdentityToken(FrozenClass):