Code Duplication    Length = 45-45 lines in 2 locations

opcua/ua/uaprotocol_auto.py 2 locations

@@ 1852-1896 (lines=45) @@
1849
    __repr__ = __str__
1850
1851
1852
class GetEndpointsParameters(FrozenClass):
1853
    '''
1854
    :ivar EndpointUrl:
1855
    :vartype EndpointUrl: String
1856
    :ivar LocaleIds:
1857
    :vartype LocaleIds: String
1858
    :ivar ProfileUris:
1859
    :vartype ProfileUris: String
1860
    '''
1861
    def __init__(self, binary=None):
1862
        if binary is not None:
1863
            self._binary_init(binary)
1864
            self._freeze = True
1865
            return
1866
        self.EndpointUrl = ''
1867
        self.LocaleIds = []
1868
        self.ProfileUris = []
1869
        self._freeze = True
1870
1871
    def to_binary(self):
1872
        packet = []
1873
        packet.append(pack_string(self.EndpointUrl))
1874
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
1875
        for fieldname in self.LocaleIds:
1876
            packet.append(pack_string(fieldname))
1877
        packet.append(uatype_Int32.pack(len(self.ProfileUris)))
1878
        for fieldname in self.ProfileUris:
1879
            packet.append(pack_string(fieldname))
1880
        return b''.join(packet)
1881
1882
    @staticmethod
1883
    def from_binary(data):
1884
        return GetEndpointsParameters(data)
1885
1886
    def _binary_init(self, data):
1887
        self.EndpointUrl = unpack_string(data)
1888
        self.LocaleIds = unpack_uatype_array('String', data)
1889
        self.ProfileUris = unpack_uatype_array('String', data)
1890
1891
    def __str__(self):
1892
        return 'GetEndpointsParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1893
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1894
               'ProfileUris:' + str(self.ProfileUris) + ')'
1895
1896
    __repr__ = __str__
1897
1898
1899
class GetEndpointsRequest(FrozenClass):
@@ 1343-1387 (lines=45) @@
1340
    __repr__ = __str__
1341
1342
1343
class FindServersParameters(FrozenClass):
1344
    '''
1345
    :ivar EndpointUrl:
1346
    :vartype EndpointUrl: String
1347
    :ivar LocaleIds:
1348
    :vartype LocaleIds: String
1349
    :ivar ServerUris:
1350
    :vartype ServerUris: String
1351
    '''
1352
    def __init__(self, binary=None):
1353
        if binary is not None:
1354
            self._binary_init(binary)
1355
            self._freeze = True
1356
            return
1357
        self.EndpointUrl = ''
1358
        self.LocaleIds = []
1359
        self.ServerUris = []
1360
        self._freeze = True
1361
1362
    def to_binary(self):
1363
        packet = []
1364
        packet.append(pack_string(self.EndpointUrl))
1365
        packet.append(uatype_Int32.pack(len(self.LocaleIds)))
1366
        for fieldname in self.LocaleIds:
1367
            packet.append(pack_string(fieldname))
1368
        packet.append(uatype_Int32.pack(len(self.ServerUris)))
1369
        for fieldname in self.ServerUris:
1370
            packet.append(pack_string(fieldname))
1371
        return b''.join(packet)
1372
1373
    @staticmethod
1374
    def from_binary(data):
1375
        return FindServersParameters(data)
1376
1377
    def _binary_init(self, data):
1378
        self.EndpointUrl = unpack_string(data)
1379
        self.LocaleIds = unpack_uatype_array('String', data)
1380
        self.ServerUris = unpack_uatype_array('String', data)
1381
1382
    def __str__(self):
1383
        return 'FindServersParameters(' + 'EndpointUrl:' + str(self.EndpointUrl) + ', ' + \
1384
               'LocaleIds:' + str(self.LocaleIds) + ', ' + \
1385
               'ServerUris:' + str(self.ServerUris) + ')'
1386
1387
    __repr__ = __str__
1388
1389
1390
class FindServersRequest(FrozenClass):