Code Duplication    Length = 35-37 lines in 6 locations

opcua/ua/uaprotocol_auto.py 6 locations

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