Code Duplication    Length = 55-57 lines in 9 locations

opcua/ua/uaprotocol_auto.py 9 locations

@@ 6563-6619 (lines=57) @@
6560
    __repr__ = __str__
6561
6562
6563
class RelativePathElement(FrozenClass):
6564
    '''
6565
    An element in a relative path.
6566
6567
    :ivar ReferenceTypeId:
6568
    :vartype ReferenceTypeId: NodeId
6569
    :ivar IsInverse:
6570
    :vartype IsInverse: Boolean
6571
    :ivar IncludeSubtypes:
6572
    :vartype IncludeSubtypes: Boolean
6573
    :ivar TargetName:
6574
    :vartype TargetName: QualifiedName
6575
    '''
6576
6577
    ua_types = {
6578
        'ReferenceTypeId': 'NodeId',
6579
        'IsInverse': 'Boolean',
6580
        'IncludeSubtypes': 'Boolean',
6581
        'TargetName': 'QualifiedName',
6582
               }
6583
6584
    def __init__(self, binary=None):
6585
        if binary is not None:
6586
            self._binary_init(binary)
6587
            self._freeze = True
6588
            return
6589
        self.ReferenceTypeId = NodeId()
6590
        self.IsInverse = True
6591
        self.IncludeSubtypes = True
6592
        self.TargetName = QualifiedName()
6593
        self._freeze = True
6594
6595
    def to_binary(self):
6596
        packet = []
6597
        packet.append(self.ReferenceTypeId.to_binary())
6598
        packet.append(uabin.Primitives.Boolean.pack(self.IsInverse))
6599
        packet.append(uabin.Primitives.Boolean.pack(self.IncludeSubtypes))
6600
        packet.append(self.TargetName.to_binary())
6601
        return b''.join(packet)
6602
6603
    @staticmethod
6604
    def from_binary(data):
6605
        return RelativePathElement(data)
6606
6607
    def _binary_init(self, data):
6608
        self.ReferenceTypeId = NodeId.from_binary(data)
6609
        self.IsInverse = uabin.Primitives.Boolean.unpack(data)
6610
        self.IncludeSubtypes = uabin.Primitives.Boolean.unpack(data)
6611
        self.TargetName = QualifiedName.from_binary(data)
6612
6613
    def __str__(self):
6614
        return 'RelativePathElement(' + 'ReferenceTypeId:' + str(self.ReferenceTypeId) + ', ' + \
6615
               'IsInverse:' + str(self.IsInverse) + ', ' + \
6616
               'IncludeSubtypes:' + str(self.IncludeSubtypes) + ', ' + \
6617
               'TargetName:' + str(self.TargetName) + ')'
6618
6619
    __repr__ = __str__
6620
6621
6622
class RelativePath(FrozenClass):
@@ 15666-15720 (lines=55) @@
15663
    __repr__ = __str__
15664
15665
15666
class EUInformation(FrozenClass):
15667
    '''
15668
    :ivar NamespaceUri:
15669
    :vartype NamespaceUri: String
15670
    :ivar UnitId:
15671
    :vartype UnitId: Int32
15672
    :ivar DisplayName:
15673
    :vartype DisplayName: LocalizedText
15674
    :ivar Description:
15675
    :vartype Description: LocalizedText
15676
    '''
15677
15678
    ua_types = {
15679
        'NamespaceUri': 'String',
15680
        'UnitId': 'Int32',
15681
        'DisplayName': 'LocalizedText',
15682
        'Description': 'LocalizedText',
15683
               }
15684
15685
    def __init__(self, binary=None):
15686
        if binary is not None:
15687
            self._binary_init(binary)
15688
            self._freeze = True
15689
            return
15690
        self.NamespaceUri = None
15691
        self.UnitId = 0
15692
        self.DisplayName = LocalizedText()
15693
        self.Description = LocalizedText()
15694
        self._freeze = True
15695
15696
    def to_binary(self):
15697
        packet = []
15698
        packet.append(uabin.Primitives.String.pack(self.NamespaceUri))
15699
        packet.append(uabin.Primitives.Int32.pack(self.UnitId))
15700
        packet.append(self.DisplayName.to_binary())
15701
        packet.append(self.Description.to_binary())
15702
        return b''.join(packet)
15703
15704
    @staticmethod
15705
    def from_binary(data):
15706
        return EUInformation(data)
15707
15708
    def _binary_init(self, data):
15709
        self.NamespaceUri = uabin.Primitives.String.unpack(data)
15710
        self.UnitId = uabin.Primitives.Int32.unpack(data)
15711
        self.DisplayName = LocalizedText.from_binary(data)
15712
        self.Description = LocalizedText.from_binary(data)
15713
15714
    def __str__(self):
15715
        return 'EUInformation(' + 'NamespaceUri:' + str(self.NamespaceUri) + ', ' + \
15716
               'UnitId:' + str(self.UnitId) + ', ' + \
15717
               'DisplayName:' + str(self.DisplayName) + ', ' + \
15718
               'Description:' + str(self.Description) + ')'
15719
15720
    __repr__ = __str__
15721
15722
15723
class ComplexNumberType(FrozenClass):
@@ 11626-11680 (lines=55) @@
11623
    __repr__ = __str__
11624
11625
11626
class MonitoredItemModifyResult(FrozenClass):
11627
    '''
11628
    :ivar StatusCode:
11629
    :vartype StatusCode: StatusCode
11630
    :ivar RevisedSamplingInterval:
11631
    :vartype RevisedSamplingInterval: Double
11632
    :ivar RevisedQueueSize:
11633
    :vartype RevisedQueueSize: UInt32
11634
    :ivar FilterResult:
11635
    :vartype FilterResult: ExtensionObject
11636
    '''
11637
11638
    ua_types = {
11639
        'StatusCode': 'StatusCode',
11640
        'RevisedSamplingInterval': 'Double',
11641
        'RevisedQueueSize': 'UInt32',
11642
        'FilterResult': 'ExtensionObject',
11643
               }
11644
11645
    def __init__(self, binary=None):
11646
        if binary is not None:
11647
            self._binary_init(binary)
11648
            self._freeze = True
11649
            return
11650
        self.StatusCode = StatusCode()
11651
        self.RevisedSamplingInterval = 0
11652
        self.RevisedQueueSize = 0
11653
        self.FilterResult = None
11654
        self._freeze = True
11655
11656
    def to_binary(self):
11657
        packet = []
11658
        packet.append(self.StatusCode.to_binary())
11659
        packet.append(uabin.Primitives.Double.pack(self.RevisedSamplingInterval))
11660
        packet.append(uabin.Primitives.UInt32.pack(self.RevisedQueueSize))
11661
        packet.append(extensionobject_to_binary(self.FilterResult))
11662
        return b''.join(packet)
11663
11664
    @staticmethod
11665
    def from_binary(data):
11666
        return MonitoredItemModifyResult(data)
11667
11668
    def _binary_init(self, data):
11669
        self.StatusCode = StatusCode.from_binary(data)
11670
        self.RevisedSamplingInterval = uabin.Primitives.Double.unpack(data)
11671
        self.RevisedQueueSize = uabin.Primitives.UInt32.unpack(data)
11672
        self.FilterResult = extensionobject_from_binary(data)
11673
11674
    def __str__(self):
11675
        return 'MonitoredItemModifyResult(' + 'StatusCode:' + str(self.StatusCode) + ', ' + \
11676
               'RevisedSamplingInterval:' + str(self.RevisedSamplingInterval) + ', ' + \
11677
               'RevisedQueueSize:' + str(self.RevisedQueueSize) + ', ' + \
11678
               'FilterResult:' + str(self.FilterResult) + ')'
11679
11680
    __repr__ = __str__
11681
11682
11683
class ModifyMonitoredItemsParameters(FrozenClass):
@@ 11025-11079 (lines=55) @@
11022
    __repr__ = __str__
11023
11024
11025
class AggregateFilter(FrozenClass):
11026
    '''
11027
    :ivar StartTime:
11028
    :vartype StartTime: DateTime
11029
    :ivar AggregateType:
11030
    :vartype AggregateType: NodeId
11031
    :ivar ProcessingInterval:
11032
    :vartype ProcessingInterval: Double
11033
    :ivar AggregateConfiguration:
11034
    :vartype AggregateConfiguration: AggregateConfiguration
11035
    '''
11036
11037
    ua_types = {
11038
        'StartTime': 'DateTime',
11039
        'AggregateType': 'NodeId',
11040
        'ProcessingInterval': 'Double',
11041
        'AggregateConfiguration': 'AggregateConfiguration',
11042
               }
11043
11044
    def __init__(self, binary=None):
11045
        if binary is not None:
11046
            self._binary_init(binary)
11047
            self._freeze = True
11048
            return
11049
        self.StartTime = datetime.now()
11050
        self.AggregateType = NodeId()
11051
        self.ProcessingInterval = 0
11052
        self.AggregateConfiguration = AggregateConfiguration()
11053
        self._freeze = True
11054
11055
    def to_binary(self):
11056
        packet = []
11057
        packet.append(uabin.Primitives.DateTime.pack(self.StartTime))
11058
        packet.append(self.AggregateType.to_binary())
11059
        packet.append(uabin.Primitives.Double.pack(self.ProcessingInterval))
11060
        packet.append(self.AggregateConfiguration.to_binary())
11061
        return b''.join(packet)
11062
11063
    @staticmethod
11064
    def from_binary(data):
11065
        return AggregateFilter(data)
11066
11067
    def _binary_init(self, data):
11068
        self.StartTime = uabin.Primitives.DateTime.unpack(data)
11069
        self.AggregateType = NodeId.from_binary(data)
11070
        self.ProcessingInterval = uabin.Primitives.Double.unpack(data)
11071
        self.AggregateConfiguration = AggregateConfiguration.from_binary(data)
11072
11073
    def __str__(self):
11074
        return 'AggregateFilter(' + 'StartTime:' + str(self.StartTime) + ', ' + \
11075
               'AggregateType:' + str(self.AggregateType) + ', ' + \
11076
               'ProcessingInterval:' + str(self.ProcessingInterval) + ', ' + \
11077
               'AggregateConfiguration:' + str(self.AggregateConfiguration) + ')'
11078
11079
    __repr__ = __str__
11080
11081
11082
class MonitoringFilterResult(FrozenClass):
@@ 10156-10210 (lines=55) @@
10153
    __repr__ = __str__
10154
10155
10156
class DeleteRawModifiedDetails(FrozenClass):
10157
    '''
10158
    :ivar NodeId:
10159
    :vartype NodeId: NodeId
10160
    :ivar IsDeleteModified:
10161
    :vartype IsDeleteModified: Boolean
10162
    :ivar StartTime:
10163
    :vartype StartTime: DateTime
10164
    :ivar EndTime:
10165
    :vartype EndTime: DateTime
10166
    '''
10167
10168
    ua_types = {
10169
        'NodeId': 'NodeId',
10170
        'IsDeleteModified': 'Boolean',
10171
        'StartTime': 'DateTime',
10172
        'EndTime': 'DateTime',
10173
               }
10174
10175
    def __init__(self, binary=None):
10176
        if binary is not None:
10177
            self._binary_init(binary)
10178
            self._freeze = True
10179
            return
10180
        self.NodeId = NodeId()
10181
        self.IsDeleteModified = True
10182
        self.StartTime = datetime.now()
10183
        self.EndTime = datetime.now()
10184
        self._freeze = True
10185
10186
    def to_binary(self):
10187
        packet = []
10188
        packet.append(self.NodeId.to_binary())
10189
        packet.append(uabin.Primitives.Boolean.pack(self.IsDeleteModified))
10190
        packet.append(uabin.Primitives.DateTime.pack(self.StartTime))
10191
        packet.append(uabin.Primitives.DateTime.pack(self.EndTime))
10192
        return b''.join(packet)
10193
10194
    @staticmethod
10195
    def from_binary(data):
10196
        return DeleteRawModifiedDetails(data)
10197
10198
    def _binary_init(self, data):
10199
        self.NodeId = NodeId.from_binary(data)
10200
        self.IsDeleteModified = uabin.Primitives.Boolean.unpack(data)
10201
        self.StartTime = uabin.Primitives.DateTime.unpack(data)
10202
        self.EndTime = uabin.Primitives.DateTime.unpack(data)
10203
10204
    def __str__(self):
10205
        return 'DeleteRawModifiedDetails(' + 'NodeId:' + str(self.NodeId) + ', ' + \
10206
               'IsDeleteModified:' + str(self.IsDeleteModified) + ', ' + \
10207
               'StartTime:' + str(self.StartTime) + ', ' + \
10208
               'EndTime:' + str(self.EndTime) + ')'
10209
10210
    __repr__ = __str__
10211
10212
10213
class DeleteAtTimeDetails(FrozenClass):
@@ 9721-9775 (lines=55) @@
9718
    __repr__ = __str__
9719
9720
9721
class WriteValue(FrozenClass):
9722
    '''
9723
    :ivar NodeId:
9724
    :vartype NodeId: NodeId
9725
    :ivar AttributeId:
9726
    :vartype AttributeId: UInt32
9727
    :ivar IndexRange:
9728
    :vartype IndexRange: String
9729
    :ivar Value:
9730
    :vartype Value: DataValue
9731
    '''
9732
9733
    ua_types = {
9734
        'NodeId': 'NodeId',
9735
        'AttributeId': 'UInt32',
9736
        'IndexRange': 'String',
9737
        'Value': 'DataValue',
9738
               }
9739
9740
    def __init__(self, binary=None):
9741
        if binary is not None:
9742
            self._binary_init(binary)
9743
            self._freeze = True
9744
            return
9745
        self.NodeId = NodeId()
9746
        self.AttributeId = 0
9747
        self.IndexRange = None
9748
        self.Value = DataValue()
9749
        self._freeze = True
9750
9751
    def to_binary(self):
9752
        packet = []
9753
        packet.append(self.NodeId.to_binary())
9754
        packet.append(uabin.Primitives.UInt32.pack(self.AttributeId))
9755
        packet.append(uabin.Primitives.String.pack(self.IndexRange))
9756
        packet.append(self.Value.to_binary())
9757
        return b''.join(packet)
9758
9759
    @staticmethod
9760
    def from_binary(data):
9761
        return WriteValue(data)
9762
9763
    def _binary_init(self, data):
9764
        self.NodeId = NodeId.from_binary(data)
9765
        self.AttributeId = uabin.Primitives.UInt32.unpack(data)
9766
        self.IndexRange = uabin.Primitives.String.unpack(data)
9767
        self.Value = DataValue.from_binary(data)
9768
9769
    def __str__(self):
9770
        return 'WriteValue(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9771
               'AttributeId:' + str(self.AttributeId) + ', ' + \
9772
               'IndexRange:' + str(self.IndexRange) + ', ' + \
9773
               'Value:' + str(self.Value) + ')'
9774
9775
    __repr__ = __str__
9776
9777
9778
class WriteParameters(FrozenClass):
@@ 9106-9160 (lines=55) @@
9103
    __repr__ = __str__
9104
9105
9106
class ReadEventDetails(FrozenClass):
9107
    '''
9108
    :ivar NumValuesPerNode:
9109
    :vartype NumValuesPerNode: UInt32
9110
    :ivar StartTime:
9111
    :vartype StartTime: DateTime
9112
    :ivar EndTime:
9113
    :vartype EndTime: DateTime
9114
    :ivar Filter:
9115
    :vartype Filter: EventFilter
9116
    '''
9117
9118
    ua_types = {
9119
        'NumValuesPerNode': 'UInt32',
9120
        'StartTime': 'DateTime',
9121
        'EndTime': 'DateTime',
9122
        'Filter': 'EventFilter',
9123
               }
9124
9125
    def __init__(self, binary=None):
9126
        if binary is not None:
9127
            self._binary_init(binary)
9128
            self._freeze = True
9129
            return
9130
        self.NumValuesPerNode = 0
9131
        self.StartTime = datetime.now()
9132
        self.EndTime = datetime.now()
9133
        self.Filter = EventFilter()
9134
        self._freeze = True
9135
9136
    def to_binary(self):
9137
        packet = []
9138
        packet.append(uabin.Primitives.UInt32.pack(self.NumValuesPerNode))
9139
        packet.append(uabin.Primitives.DateTime.pack(self.StartTime))
9140
        packet.append(uabin.Primitives.DateTime.pack(self.EndTime))
9141
        packet.append(self.Filter.to_binary())
9142
        return b''.join(packet)
9143
9144
    @staticmethod
9145
    def from_binary(data):
9146
        return ReadEventDetails(data)
9147
9148
    def _binary_init(self, data):
9149
        self.NumValuesPerNode = uabin.Primitives.UInt32.unpack(data)
9150
        self.StartTime = uabin.Primitives.DateTime.unpack(data)
9151
        self.EndTime = uabin.Primitives.DateTime.unpack(data)
9152
        self.Filter = EventFilter.from_binary(data)
9153
9154
    def __str__(self):
9155
        return 'ReadEventDetails(' + 'NumValuesPerNode:' + str(self.NumValuesPerNode) + ', ' + \
9156
               'StartTime:' + str(self.StartTime) + ', ' + \
9157
               'EndTime:' + str(self.EndTime) + ', ' + \
9158
               'Filter:' + str(self.Filter) + ')'
9159
9160
    __repr__ = __str__
9161
9162
9163
class ReadRawModifiedDetails(FrozenClass):
@@ 8968-9022 (lines=55) @@
8965
    __repr__ = __str__
8966
8967
8968
class HistoryReadValueId(FrozenClass):
8969
    '''
8970
    :ivar NodeId:
8971
    :vartype NodeId: NodeId
8972
    :ivar IndexRange:
8973
    :vartype IndexRange: String
8974
    :ivar DataEncoding:
8975
    :vartype DataEncoding: QualifiedName
8976
    :ivar ContinuationPoint:
8977
    :vartype ContinuationPoint: ByteString
8978
    '''
8979
8980
    ua_types = {
8981
        'NodeId': 'NodeId',
8982
        'IndexRange': 'String',
8983
        'DataEncoding': 'QualifiedName',
8984
        'ContinuationPoint': 'ByteString',
8985
               }
8986
8987
    def __init__(self, binary=None):
8988
        if binary is not None:
8989
            self._binary_init(binary)
8990
            self._freeze = True
8991
            return
8992
        self.NodeId = NodeId()
8993
        self.IndexRange = None
8994
        self.DataEncoding = QualifiedName()
8995
        self.ContinuationPoint = None
8996
        self._freeze = True
8997
8998
    def to_binary(self):
8999
        packet = []
9000
        packet.append(self.NodeId.to_binary())
9001
        packet.append(uabin.Primitives.String.pack(self.IndexRange))
9002
        packet.append(self.DataEncoding.to_binary())
9003
        packet.append(uabin.Primitives.ByteString.pack(self.ContinuationPoint))
9004
        return b''.join(packet)
9005
9006
    @staticmethod
9007
    def from_binary(data):
9008
        return HistoryReadValueId(data)
9009
9010
    def _binary_init(self, data):
9011
        self.NodeId = NodeId.from_binary(data)
9012
        self.IndexRange = uabin.Primitives.String.unpack(data)
9013
        self.DataEncoding = QualifiedName.from_binary(data)
9014
        self.ContinuationPoint = uabin.Primitives.ByteString.unpack(data)
9015
9016
    def __str__(self):
9017
        return 'HistoryReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
9018
               'IndexRange:' + str(self.IndexRange) + ', ' + \
9019
               'DataEncoding:' + str(self.DataEncoding) + ', ' + \
9020
               'ContinuationPoint:' + str(self.ContinuationPoint) + ')'
9021
9022
    __repr__ = __str__
9023
9024
9025
class HistoryReadResult(FrozenClass):
@@ 8733-8787 (lines=55) @@
8730
    __repr__ = __str__
8731
8732
8733
class ReadValueId(FrozenClass):
8734
    '''
8735
    :ivar NodeId:
8736
    :vartype NodeId: NodeId
8737
    :ivar AttributeId:
8738
    :vartype AttributeId: UInt32
8739
    :ivar IndexRange:
8740
    :vartype IndexRange: String
8741
    :ivar DataEncoding:
8742
    :vartype DataEncoding: QualifiedName
8743
    '''
8744
8745
    ua_types = {
8746
        'NodeId': 'NodeId',
8747
        'AttributeId': 'UInt32',
8748
        'IndexRange': 'String',
8749
        'DataEncoding': 'QualifiedName',
8750
               }
8751
8752
    def __init__(self, binary=None):
8753
        if binary is not None:
8754
            self._binary_init(binary)
8755
            self._freeze = True
8756
            return
8757
        self.NodeId = NodeId()
8758
        self.AttributeId = 0
8759
        self.IndexRange = None
8760
        self.DataEncoding = QualifiedName()
8761
        self._freeze = True
8762
8763
    def to_binary(self):
8764
        packet = []
8765
        packet.append(self.NodeId.to_binary())
8766
        packet.append(uabin.Primitives.UInt32.pack(self.AttributeId))
8767
        packet.append(uabin.Primitives.String.pack(self.IndexRange))
8768
        packet.append(self.DataEncoding.to_binary())
8769
        return b''.join(packet)
8770
8771
    @staticmethod
8772
    def from_binary(data):
8773
        return ReadValueId(data)
8774
8775
    def _binary_init(self, data):
8776
        self.NodeId = NodeId.from_binary(data)
8777
        self.AttributeId = uabin.Primitives.UInt32.unpack(data)
8778
        self.IndexRange = uabin.Primitives.String.unpack(data)
8779
        self.DataEncoding = QualifiedName.from_binary(data)
8780
8781
    def __str__(self):
8782
        return 'ReadValueId(' + 'NodeId:' + str(self.NodeId) + ', ' + \
8783
               'AttributeId:' + str(self.AttributeId) + ', ' + \
8784
               'IndexRange:' + str(self.IndexRange) + ', ' + \
8785
               'DataEncoding:' + str(self.DataEncoding) + ')'
8786
8787
    __repr__ = __str__
8788
8789
8790
class ReadParameters(FrozenClass):