Code Duplication    Length = 55-57 lines in 7 locations

opcua/ua/uaprotocol_auto.py 7 locations

@@ 6606-6662 (lines=57) @@
6603
    '''
6604
    Browse the references for one or more nodes from the server address space.
6605
6606
    :ivar TypeId:
6607
    :vartype TypeId: NodeId
6608
    :ivar RequestHeader:
6609
    :vartype RequestHeader: RequestHeader
6610
    :ivar Parameters:
6611
    :vartype Parameters: BrowseParameters
6612
    '''
6613
6614
    ua_types = (
6615
6616
        ('TypeId', 'NodeId'),
6617
        ('RequestHeader', 'RequestHeader'),
6618
        ('Parameters', 'BrowseParameters'),
6619
               )
6620
6621
    def __init__(self, binary=None):
6622
        if binary is not None:
6623
            self._binary_init(binary)
6624
            self._freeze = True
6625
            return
6626
        self.TypeId = FourByteNodeId(ObjectIds.BrowseRequest_Encoding_DefaultBinary)
6627
        self.RequestHeader = RequestHeader()
6628
        self.Parameters = BrowseParameters()
6629
        self._freeze = True
6630
6631
    def to_binary(self):
6632
        packet = []
6633
        packet.append(self.TypeId.to_binary())
6634
        packet.append(self.RequestHeader.to_binary())
6635
        packet.append(self.Parameters.to_binary())
6636
        return b''.join(packet)
6637
6638
    @staticmethod
6639
    def from_binary(data):
6640
        return BrowseRequest(data)
6641
6642
    def _binary_init(self, data):
6643
        self.TypeId = NodeId.from_binary(data)
6644
        self.RequestHeader = RequestHeader.from_binary(data)
6645
        self.Parameters = BrowseParameters.from_binary(data)
6646
6647
    def __str__(self):
6648
        return 'BrowseRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
6649
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
6650
               'Parameters:' + str(self.Parameters) + ')'
6651
6652
    __repr__ = __str__
6653
6654
6655
class BrowseResponse(FrozenClass):
6656
    '''
6657
    Browse the references for one or more nodes from the server address space.
6658
6659
    :ivar TypeId:
6660
    :vartype TypeId: NodeId
6661
    :ivar ResponseHeader:
6662
    :vartype ResponseHeader: ResponseHeader
6663
    :ivar Results:
6664
    :vartype Results: BrowseResult
6665
    :ivar DiagnosticInfos:
@@ 15709-15763 (lines=55) @@
15706
        self.Encoding = uabin.Primitives.String.unpack(data)
15707
        self.TransportProtocol = uabin.Primitives.String.unpack(data)
15708
        self.SecurityMode = MessageSecurityMode(uabin.Primitives.UInt32.unpack(data))
15709
        self.SecurityPolicyUri = uabin.Primitives.String.unpack(data)
15710
        self.ClientCertificate = uabin.Primitives.ByteString.unpack(data)
15711
15712
    def __str__(self):
15713
        return 'SessionSecurityDiagnosticsDataType(' + 'SessionId:' + str(self.SessionId) + ', ' + \
15714
               'ClientUserIdOfSession:' + str(self.ClientUserIdOfSession) + ', ' + \
15715
               'ClientUserIdHistory:' + str(self.ClientUserIdHistory) + ', ' + \
15716
               'AuthenticationMechanism:' + str(self.AuthenticationMechanism) + ', ' + \
15717
               'Encoding:' + str(self.Encoding) + ', ' + \
15718
               'TransportProtocol:' + str(self.TransportProtocol) + ', ' + \
15719
               'SecurityMode:' + str(self.SecurityMode) + ', ' + \
15720
               'SecurityPolicyUri:' + str(self.SecurityPolicyUri) + ', ' + \
15721
               'ClientCertificate:' + str(self.ClientCertificate) + ')'
15722
15723
    __repr__ = __str__
15724
15725
15726
class ServiceCounterDataType(FrozenClass):
15727
    '''
15728
    :ivar TotalCount:
15729
    :vartype TotalCount: UInt32
15730
    :ivar ErrorCount:
15731
    :vartype ErrorCount: UInt32
15732
    '''
15733
15734
    ua_types = (
15735
15736
        ('TotalCount', 'UInt32'),
15737
        ('ErrorCount', 'UInt32'),
15738
               )
15739
15740
    def __init__(self, binary=None):
15741
        if binary is not None:
15742
            self._binary_init(binary)
15743
            self._freeze = True
15744
            return
15745
        self.TotalCount = 0
15746
        self.ErrorCount = 0
15747
        self._freeze = True
15748
15749
    def to_binary(self):
15750
        packet = []
15751
        packet.append(uabin.Primitives.UInt32.pack(self.TotalCount))
15752
        packet.append(uabin.Primitives.UInt32.pack(self.ErrorCount))
15753
        return b''.join(packet)
15754
15755
    @staticmethod
15756
    def from_binary(data):
15757
        return ServiceCounterDataType(data)
15758
15759
    def _binary_init(self, data):
15760
        self.TotalCount = uabin.Primitives.UInt32.unpack(data)
15761
        self.ErrorCount = uabin.Primitives.UInt32.unpack(data)
15762
15763
    def __str__(self):
15764
        return 'ServiceCounterDataType(' + 'TotalCount:' + str(self.TotalCount) + ', ' + \
15765
               'ErrorCount:' + str(self.ErrorCount) + ')'
15766
@@ 11669-11723 (lines=55) @@
11666
        packet.append(uabin.Primitives.DateTime.pack(self.RevisedStartTime))
11667
        packet.append(uabin.Primitives.Double.pack(self.RevisedProcessingInterval))
11668
        packet.append(self.RevisedAggregateConfiguration.to_binary())
11669
        return b''.join(packet)
11670
11671
    @staticmethod
11672
    def from_binary(data):
11673
        return AggregateFilterResult(data)
11674
11675
    def _binary_init(self, data):
11676
        self.RevisedStartTime = uabin.Primitives.DateTime.unpack(data)
11677
        self.RevisedProcessingInterval = uabin.Primitives.Double.unpack(data)
11678
        self.RevisedAggregateConfiguration = AggregateConfiguration.from_binary(data)
11679
11680
    def __str__(self):
11681
        return 'AggregateFilterResult(' + 'RevisedStartTime:' + str(self.RevisedStartTime) + ', ' + \
11682
               'RevisedProcessingInterval:' + str(self.RevisedProcessingInterval) + ', ' + \
11683
               'RevisedAggregateConfiguration:' + str(self.RevisedAggregateConfiguration) + ')'
11684
11685
    __repr__ = __str__
11686
11687
11688
class MonitoringParameters(FrozenClass):
11689
    '''
11690
    :ivar ClientHandle:
11691
    :vartype ClientHandle: UInt32
11692
    :ivar SamplingInterval:
11693
    :vartype SamplingInterval: Double
11694
    :ivar Filter:
11695
    :vartype Filter: ExtensionObject
11696
    :ivar QueueSize:
11697
    :vartype QueueSize: UInt32
11698
    :ivar DiscardOldest:
11699
    :vartype DiscardOldest: Boolean
11700
    '''
11701
11702
    ua_types = (
11703
11704
        ('ClientHandle', 'UInt32'),
11705
        ('SamplingInterval', 'Double'),
11706
        ('Filter', 'ExtensionObject'),
11707
        ('QueueSize', 'UInt32'),
11708
        ('DiscardOldest', 'Boolean'),
11709
               )
11710
11711
    def __init__(self, binary=None):
11712
        if binary is not None:
11713
            self._binary_init(binary)
11714
            self._freeze = True
11715
            return
11716
        self.ClientHandle = 0
11717
        self.SamplingInterval = 0
11718
        self.Filter = None
11719
        self.QueueSize = 0
11720
        self.DiscardOldest = True
11721
        self._freeze = True
11722
11723
    def to_binary(self):
11724
        packet = []
11725
        packet.append(uabin.Primitives.UInt32.pack(self.ClientHandle))
11726
        packet.append(uabin.Primitives.Double.pack(self.SamplingInterval))
@@ 11068-11122 (lines=55) @@
11065
        self.OutputArguments = []
11066
        self._freeze = True
11067
11068
    def to_binary(self):
11069
        packet = []
11070
        packet.append(self.StatusCode.to_binary())
11071
        packet.append(uabin.Primitives.Int32.pack(len(self.InputArgumentResults)))
11072
        for fieldname in self.InputArgumentResults:
11073
            packet.append(fieldname.to_binary())
11074
        packet.append(uabin.Primitives.Int32.pack(len(self.InputArgumentDiagnosticInfos)))
11075
        for fieldname in self.InputArgumentDiagnosticInfos:
11076
            packet.append(fieldname.to_binary())
11077
        packet.append(uabin.Primitives.Int32.pack(len(self.OutputArguments)))
11078
        for fieldname in self.OutputArguments:
11079
            packet.append(fieldname.to_binary())
11080
        return b''.join(packet)
11081
11082
    @staticmethod
11083
    def from_binary(data):
11084
        return CallMethodResult(data)
11085
11086
    def _binary_init(self, data):
11087
        self.StatusCode = StatusCode.from_binary(data)
11088
        length = uabin.Primitives.Int32.unpack(data)
11089
        array = []
11090
        if length != -1:
11091
            for _ in range(0, length):
11092
                array.append(StatusCode.from_binary(data))
11093
        self.InputArgumentResults = array
11094
        length = uabin.Primitives.Int32.unpack(data)
11095
        array = []
11096
        if length != -1:
11097
            for _ in range(0, length):
11098
                array.append(DiagnosticInfo.from_binary(data))
11099
        self.InputArgumentDiagnosticInfos = array
11100
        length = uabin.Primitives.Int32.unpack(data)
11101
        array = []
11102
        if length != -1:
11103
            for _ in range(0, length):
11104
                array.append(Variant.from_binary(data))
11105
        self.OutputArguments = array
11106
11107
    def __str__(self):
11108
        return 'CallMethodResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
11109
               'InputArgumentResults:' + str(self.InputArgumentResults) + ', ' + \
11110
               'InputArgumentDiagnosticInfos:' + str(self.InputArgumentDiagnosticInfos) + ', ' + \
11111
               'OutputArguments:' + str(self.OutputArguments) + ')'
11112
11113
    __repr__ = __str__
11114
11115
11116
class CallParameters(FrozenClass):
11117
    '''
11118
    :ivar MethodsToCall:
11119
    :vartype MethodsToCall: CallMethodRequest
11120
    '''
11121
11122
    ua_types = (
11123
11124
        ('MethodsToCall', 'ListOfCallMethodRequest'),
11125
               )
@@ 9764-9818 (lines=55) @@
9761
9762
    def __str__(self):
9763
        return 'ReadAtTimeDetails(' + 'ReqTimes:' + str(self.ReqTimes) + ', ' + \
9764
               'UseSimpleBounds:' + str(self.UseSimpleBounds) + ')'
9765
9766
    __repr__ = __str__
9767
9768
9769
class HistoryData(FrozenClass):
9770
    '''
9771
    :ivar DataValues:
9772
    :vartype DataValues: DataValue
9773
    '''
9774
9775
    ua_types = (
9776
9777
        ('DataValues', 'ListOfDataValue'),
9778
               )
9779
9780
    def __init__(self, binary=None):
9781
        if binary is not None:
9782
            self._binary_init(binary)
9783
            self._freeze = True
9784
            return
9785
        self.DataValues = []
9786
        self._freeze = True
9787
9788
    def to_binary(self):
9789
        packet = []
9790
        packet.append(uabin.Primitives.Int32.pack(len(self.DataValues)))
9791
        for fieldname in self.DataValues:
9792
            packet.append(fieldname.to_binary())
9793
        return b''.join(packet)
9794
9795
    @staticmethod
9796
    def from_binary(data):
9797
        return HistoryData(data)
9798
9799
    def _binary_init(self, data):
9800
        length = uabin.Primitives.Int32.unpack(data)
9801
        array = []
9802
        if length != -1:
9803
            for _ in range(0, length):
9804
                array.append(DataValue.from_binary(data))
9805
        self.DataValues = array
9806
9807
    def __str__(self):
9808
        return 'HistoryData(' + 'DataValues:' + str(self.DataValues) + ')'
9809
9810
    __repr__ = __str__
9811
9812
9813
class ModificationInfo(FrozenClass):
9814
    '''
9815
    :ivar ModificationTime:
9816
    :vartype ModificationTime: DateTime
9817
    :ivar UpdateType:
9818
    :vartype UpdateType: HistoryUpdateType
9819
    :ivar UserName:
9820
    :vartype UserName: String
9821
    '''
@@ 9011-9065 (lines=55) @@
9008
        ('RequestHeader', 'RequestHeader'),
9009
        ('Parameters', 'QueryNextParameters'),
9010
               )
9011
9012
    def __init__(self, binary=None):
9013
        if binary is not None:
9014
            self._binary_init(binary)
9015
            self._freeze = True
9016
            return
9017
        self.TypeId = FourByteNodeId(ObjectIds.QueryNextRequest_Encoding_DefaultBinary)
9018
        self.RequestHeader = RequestHeader()
9019
        self.Parameters = QueryNextParameters()
9020
        self._freeze = True
9021
9022
    def to_binary(self):
9023
        packet = []
9024
        packet.append(self.TypeId.to_binary())
9025
        packet.append(self.RequestHeader.to_binary())
9026
        packet.append(self.Parameters.to_binary())
9027
        return b''.join(packet)
9028
9029
    @staticmethod
9030
    def from_binary(data):
9031
        return QueryNextRequest(data)
9032
9033
    def _binary_init(self, data):
9034
        self.TypeId = NodeId.from_binary(data)
9035
        self.RequestHeader = RequestHeader.from_binary(data)
9036
        self.Parameters = QueryNextParameters.from_binary(data)
9037
9038
    def __str__(self):
9039
        return 'QueryNextRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
9040
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
9041
               'Parameters:' + str(self.Parameters) + ')'
9042
9043
    __repr__ = __str__
9044
9045
9046
class QueryNextResult(FrozenClass):
9047
    '''
9048
    :ivar QueryDataSets:
9049
    :vartype QueryDataSets: QueryDataSet
9050
    :ivar RevisedContinuationPoint:
9051
    :vartype RevisedContinuationPoint: ByteString
9052
    '''
9053
9054
    ua_types = (
9055
9056
        ('QueryDataSets', 'ListOfQueryDataSet'),
9057
        ('RevisedContinuationPoint', 'ByteString'),
9058
               )
9059
9060
    def __init__(self, binary=None):
9061
        if binary is not None:
9062
            self._binary_init(binary)
9063
            self._freeze = True
9064
            return
9065
        self.QueryDataSets = []
9066
        self.RevisedContinuationPoint = None
9067
        self._freeze = True
9068
@@ 8776-8830 (lines=55) @@
8773
    ua_types = (
8774
8775
        ('TypeId', 'NodeId'),
8776
        ('RequestHeader', 'RequestHeader'),
8777
        ('Parameters', 'QueryFirstParameters'),
8778
               )
8779
8780
    def __init__(self, binary=None):
8781
        if binary is not None:
8782
            self._binary_init(binary)
8783
            self._freeze = True
8784
            return
8785
        self.TypeId = FourByteNodeId(ObjectIds.QueryFirstRequest_Encoding_DefaultBinary)
8786
        self.RequestHeader = RequestHeader()
8787
        self.Parameters = QueryFirstParameters()
8788
        self._freeze = True
8789
8790
    def to_binary(self):
8791
        packet = []
8792
        packet.append(self.TypeId.to_binary())
8793
        packet.append(self.RequestHeader.to_binary())
8794
        packet.append(self.Parameters.to_binary())
8795
        return b''.join(packet)
8796
8797
    @staticmethod
8798
    def from_binary(data):
8799
        return QueryFirstRequest(data)
8800
8801
    def _binary_init(self, data):
8802
        self.TypeId = NodeId.from_binary(data)
8803
        self.RequestHeader = RequestHeader.from_binary(data)
8804
        self.Parameters = QueryFirstParameters.from_binary(data)
8805
8806
    def __str__(self):
8807
        return 'QueryFirstRequest(' + 'TypeId:' + str(self.TypeId) + ', ' + \
8808
               'RequestHeader:' + str(self.RequestHeader) + ', ' + \
8809
               'Parameters:' + str(self.Parameters) + ')'
8810
8811
    __repr__ = __str__
8812
8813
8814
class QueryFirstResult(FrozenClass):
8815
    '''
8816
    :ivar QueryDataSets:
8817
    :vartype QueryDataSets: QueryDataSet
8818
    :ivar ContinuationPoint:
8819
    :vartype ContinuationPoint: ByteString
8820
    :ivar ParsingResults:
8821
    :vartype ParsingResults: ParsingResult
8822
    :ivar DiagnosticInfos:
8823
    :vartype DiagnosticInfos: DiagnosticInfo
8824
    :ivar FilterResult:
8825
    :vartype FilterResult: ContentFilterResult
8826
    '''
8827
8828
    ua_types = (
8829
8830
        ('QueryDataSets', 'ListOfQueryDataSet'),
8831
        ('ContinuationPoint', 'ByteString'),
8832
        ('ParsingResults', 'ListOfParsingResult'),
8833
        ('DiagnosticInfos', 'ListOfDiagnosticInfo'),