mirror of
https://github.com/Unidata/python-awips.git
synced 2025-02-23 14:57:56 -05:00
six.PY conditionals for utf8 encoding/decoding
This commit is contained in:
parent
580453acf0
commit
dce5a7a25a
10 changed files with 174 additions and 56 deletions
|
@ -13,6 +13,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
from awips.dataaccess import IData
|
from awips.dataaccess import IData
|
||||||
|
import six
|
||||||
|
|
||||||
class PyData(IData):
|
class PyData(IData):
|
||||||
|
|
||||||
|
@ -33,6 +34,10 @@ class PyData(IData):
|
||||||
return self.__time
|
return self.__time
|
||||||
|
|
||||||
def getLevel(self):
|
def getLevel(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.__level
|
||||||
|
if type(self.__level) is not str:
|
||||||
|
return self.__level.decode('utf-8')
|
||||||
return self.__level
|
return self.__level
|
||||||
|
|
||||||
def getLocationName(self):
|
def getLocationName(self):
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
from awips.dataaccess import IGeometryData
|
from awips.dataaccess import IGeometryData
|
||||||
from awips.dataaccess import PyData
|
from awips.dataaccess import PyData
|
||||||
|
import six
|
||||||
|
|
||||||
class PyGeometryData(IGeometryData, PyData.PyData):
|
class PyGeometryData(IGeometryData, PyData.PyData):
|
||||||
|
|
||||||
|
@ -34,15 +35,22 @@ class PyGeometryData(IGeometryData, PyData.PyData):
|
||||||
return self.__geometry
|
return self.__geometry
|
||||||
|
|
||||||
def getParameters(self):
|
def getParameters(self):
|
||||||
return list(self.__dataMap.keys())
|
if six.PY2:
|
||||||
|
return list(self.__dataMap.keys())
|
||||||
|
else:
|
||||||
|
return [x.decode('utf-8') for x in list(self.__dataMap.keys())]
|
||||||
|
|
||||||
def getString(self, param):
|
def getString(self, param):
|
||||||
value = self.__dataMap[param][0]
|
if six.PY2:
|
||||||
|
return self.__dataMap[param][0]
|
||||||
|
value = self.__dataMap[param.encode('utf-8')][0]
|
||||||
|
if value is not None:
|
||||||
|
return value.decode('utf-8')
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def getNumber(self, param):
|
def getNumber(self, param):
|
||||||
t = self.getType(param)
|
t = self.getType(param)
|
||||||
value = self.__dataMap[param][0]
|
value = self.__dataMap[param.encode('utf-8')][0]
|
||||||
if t == 'INT' or t == 'SHORT' or t == 'LONG':
|
if t == 'INT' or t == 'SHORT' or t == 'LONG':
|
||||||
return int(value)
|
return int(value)
|
||||||
elif t == 'FLOAT':
|
elif t == 'FLOAT':
|
||||||
|
@ -54,8 +62,16 @@ class PyGeometryData(IGeometryData, PyData.PyData):
|
||||||
|
|
||||||
def getUnit(self, param):
|
def getUnit(self, param):
|
||||||
unit = self.__dataMap[param][2]
|
unit = self.__dataMap[param][2]
|
||||||
|
if six.PY2:
|
||||||
|
return unit
|
||||||
|
if unit is not None:
|
||||||
|
return unit.decode('utf-8')
|
||||||
return unit
|
return unit
|
||||||
|
|
||||||
def getType(self, param):
|
def getType(self, param):
|
||||||
type = self.__dataMap[param][1]
|
if six.PY2:
|
||||||
|
return self.__dataMap[param][1]
|
||||||
|
type = self.__dataMap[param.encode('utf-8')][1]
|
||||||
|
if type is not None:
|
||||||
|
return type.decode('utf-8')
|
||||||
return type
|
return type
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# #
|
|
||||||
# #
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Implements IGridData for use by native Python clients to the Data Access
|
# Implements IGridData for use by native Python clients to the Data Access
|
||||||
# Framework.
|
# Framework.
|
||||||
|
@ -20,6 +17,7 @@
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
import warnings
|
import warnings
|
||||||
|
import six
|
||||||
|
|
||||||
from awips.dataaccess import IGridData
|
from awips.dataaccess import IGridData
|
||||||
from awips.dataaccess import PyData
|
from awips.dataaccess import PyData
|
||||||
|
@ -46,6 +44,10 @@ class PyGridData(IGridData, PyData.PyData):
|
||||||
return self.__parameter
|
return self.__parameter
|
||||||
|
|
||||||
def getUnit(self):
|
def getUnit(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.__unit
|
||||||
|
if self.__unit is not None and type(self.__unit) is not str:
|
||||||
|
return self.__unit.decode('utf-8')
|
||||||
return self.__unit
|
return self.__unit
|
||||||
|
|
||||||
def getRawData(self, unit=None):
|
def getRawData(self, unit=None):
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# #
|
|
||||||
# #
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Routes requests to the Data Access Framework through Python Thrift.
|
# Routes requests to the Data Access Framework through Python Thrift.
|
||||||
#
|
#
|
||||||
|
@ -28,6 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
import six
|
||||||
import shapely.wkb
|
import shapely.wkb
|
||||||
|
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.impl import DefaultDataRequest
|
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.impl import DefaultDataRequest
|
||||||
|
@ -125,7 +123,10 @@ class ThriftClientRouter(object):
|
||||||
retVal = []
|
retVal = []
|
||||||
for gridDataRecord in response.getGridData():
|
for gridDataRecord in response.getGridData():
|
||||||
locationName = gridDataRecord.getLocationName()
|
locationName = gridDataRecord.getLocationName()
|
||||||
locData = locSpecificData[locationName]
|
if locationName is not None:
|
||||||
|
locData = locSpecificData[locationName.encode('utf-8')]
|
||||||
|
else:
|
||||||
|
locData = locSpecificData[locationName]
|
||||||
if self._lazyLoadGridLatLon:
|
if self._lazyLoadGridLatLon:
|
||||||
retVal.append(PyGridData.PyGridData(gridDataRecord, locData[
|
retVal.append(PyGridData.PyGridData(gridDataRecord, locData[
|
||||||
0], locData[1], latLonDelegate=locData[2]))
|
0], locData[1], latLonDelegate=locData[2]))
|
||||||
|
@ -163,12 +164,20 @@ class ThriftClientRouter(object):
|
||||||
locNamesRequest = GetAvailableLocationNamesRequest()
|
locNamesRequest = GetAvailableLocationNamesRequest()
|
||||||
locNamesRequest.setRequestParameters(request)
|
locNamesRequest.setRequestParameters(request)
|
||||||
response = self._client.sendRequest(locNamesRequest)
|
response = self._client.sendRequest(locNamesRequest)
|
||||||
return [item.decode('utf8') for item in response]
|
if six.PY2:
|
||||||
|
return response
|
||||||
|
if response is not None:
|
||||||
|
return [x.decode('utf-8') for x in response]
|
||||||
|
return response
|
||||||
|
|
||||||
def getAvailableParameters(self, request):
|
def getAvailableParameters(self, request):
|
||||||
paramReq = GetAvailableParametersRequest()
|
paramReq = GetAvailableParametersRequest()
|
||||||
paramReq.setRequestParameters(request)
|
paramReq.setRequestParameters(request)
|
||||||
response = self._client.sendRequest(paramReq)
|
response = self._client.sendRequest(paramReq)
|
||||||
|
if six.PY2:
|
||||||
|
return response
|
||||||
|
if response is not None:
|
||||||
|
return [x.decode('utf-8') for x in response]
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def getAvailableLevels(self, request):
|
def getAvailableLevels(self, request):
|
||||||
|
@ -184,6 +193,10 @@ class ThriftClientRouter(object):
|
||||||
idReq = GetRequiredIdentifiersRequest()
|
idReq = GetRequiredIdentifiersRequest()
|
||||||
idReq.setRequest(request)
|
idReq.setRequest(request)
|
||||||
response = self._client.sendRequest(idReq)
|
response = self._client.sendRequest(idReq)
|
||||||
|
if six.PY2:
|
||||||
|
return response
|
||||||
|
if response is not None:
|
||||||
|
return [x.decode('utf-8') for x in response]
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def getOptionalIdentifiers(self, request):
|
def getOptionalIdentifiers(self, request):
|
||||||
|
@ -193,6 +206,10 @@ class ThriftClientRouter(object):
|
||||||
idReq = GetOptionalIdentifiersRequest()
|
idReq = GetOptionalIdentifiersRequest()
|
||||||
idReq.setRequest(request)
|
idReq.setRequest(request)
|
||||||
response = self._client.sendRequest(idReq)
|
response = self._client.sendRequest(idReq)
|
||||||
|
if six.PY2:
|
||||||
|
return response
|
||||||
|
if response is not None:
|
||||||
|
return [x.decode('utf-8') for x in response]
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def getIdentifierValues(self, request, identifierKey):
|
def getIdentifierValues(self, request, identifierKey):
|
||||||
|
@ -200,6 +217,10 @@ class ThriftClientRouter(object):
|
||||||
idValReq.setIdentifierKey(identifierKey)
|
idValReq.setIdentifierKey(identifierKey)
|
||||||
idValReq.setRequestParameters(request)
|
idValReq.setRequestParameters(request)
|
||||||
response = self._client.sendRequest(idValReq)
|
response = self._client.sendRequest(idValReq)
|
||||||
|
if six.PY2:
|
||||||
|
return response
|
||||||
|
if response is not None:
|
||||||
|
return [x.decode('utf-8') for x in response]
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def newDataRequest(self, datatype, parameters=[], levels=[], locationNames=[], envelope=None, **kwargs):
|
def newDataRequest(self, datatype, parameters=[], levels=[], locationNames=[], envelope=None, **kwargs):
|
||||||
|
@ -221,6 +242,10 @@ class ThriftClientRouter(object):
|
||||||
|
|
||||||
def getSupportedDatatypes(self):
|
def getSupportedDatatypes(self):
|
||||||
response = self._client.sendRequest(GetSupportedDatatypesRequest())
|
response = self._client.sendRequest(GetSupportedDatatypesRequest())
|
||||||
|
if six.PY2:
|
||||||
|
return response
|
||||||
|
if response is not None:
|
||||||
|
return [x.decode('utf-8') for x in response]
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def getNotificationFilter(self, request):
|
def getNotificationFilter(self, request):
|
||||||
|
|
|
@ -73,7 +73,7 @@ class DafTestCase(unittest.TestCase):
|
||||||
return times
|
return times
|
||||||
|
|
||||||
def testDatatypeIsSupported(self):
|
def testDatatypeIsSupported(self):
|
||||||
allSupported = (item.lower().decode('utf-8') for item in DAL.getSupportedDatatypes())
|
allSupported = DAL.getSupportedDatatypes()
|
||||||
self.assertIn(self.datatype.lower(), allSupported)
|
self.assertIn(self.datatype.lower(), allSupported)
|
||||||
|
|
||||||
def testGetRequiredIdentifiers(self):
|
def testGetRequiredIdentifiers(self):
|
||||||
|
|
|
@ -17,6 +17,7 @@ import time, sys
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import dynamicserialize
|
import dynamicserialize
|
||||||
|
from io import open
|
||||||
|
|
||||||
TIME_TO_SLEEP = 300
|
TIME_TO_SLEEP = 300
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
from thrift.Thrift import TType
|
from thrift.Thrift import TType
|
||||||
import inspect
|
import inspect
|
||||||
import sys
|
import sys
|
||||||
|
import types
|
||||||
|
import six
|
||||||
import numpy
|
import numpy
|
||||||
import dynamicserialize
|
import dynamicserialize
|
||||||
from dynamicserialize import dstypes, adapters
|
from dynamicserialize import dstypes, adapters
|
||||||
|
@ -49,29 +51,54 @@ def buildObjMap(module):
|
||||||
|
|
||||||
buildObjMap(dstypes)
|
buildObjMap(dstypes)
|
||||||
|
|
||||||
pythonToThriftMap = {
|
if six.PY2:
|
||||||
bytes: TType.STRING,
|
pythonToThriftMap = {
|
||||||
int: TType.I32,
|
types.StringType: TType.STRING,
|
||||||
int: TType.I64,
|
types.IntType: TType.I32,
|
||||||
list: TType.LIST,
|
types.LongType: TType.I64,
|
||||||
dict: TType.MAP,
|
types.ListType: TType.LIST,
|
||||||
type(set([])): TType.SET,
|
unicode: TType.STRING,
|
||||||
float: SelfDescribingBinaryProtocol.FLOAT,
|
types.DictionaryType: TType.MAP,
|
||||||
# types.FloatType: TType.DOUBLE,
|
type(set([])): TType.SET,
|
||||||
bool: TType.BOOL,
|
types.FloatType: SelfDescribingBinaryProtocol.FLOAT,
|
||||||
object: TType.STRUCT,
|
# types.FloatType: TType.DOUBLE,
|
||||||
str: TType.STRING,
|
types.BooleanType: TType.BOOL,
|
||||||
type(None): TType.VOID,
|
types.InstanceType: TType.STRUCT,
|
||||||
numpy.float32: SelfDescribingBinaryProtocol.FLOAT,
|
types.NoneType: TType.VOID,
|
||||||
numpy.int32: TType.I32,
|
numpy.float32: SelfDescribingBinaryProtocol.FLOAT,
|
||||||
numpy.ndarray: TType.LIST,
|
numpy.int32: TType.I32,
|
||||||
numpy.object_: TType.STRING, # making an assumption here
|
numpy.ndarray: TType.LIST,
|
||||||
numpy.string_: TType.STRING,
|
numpy.object_: TType.STRING, # making an assumption here
|
||||||
numpy.float64: TType.DOUBLE,
|
numpy.string_: TType.STRING,
|
||||||
numpy.int16: TType.I16,
|
numpy.float64: TType.DOUBLE,
|
||||||
numpy.int8: TType.BYTE,
|
numpy.int16: TType.I16,
|
||||||
numpy.int64: TType.I64
|
numpy.int8: TType.BYTE,
|
||||||
}
|
numpy.int64: TType.I64
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
pythonToThriftMap = {
|
||||||
|
bytes: TType.STRING,
|
||||||
|
int: TType.I32,
|
||||||
|
int: TType.I64,
|
||||||
|
list: TType.LIST,
|
||||||
|
dict: TType.MAP,
|
||||||
|
type(set([])): TType.SET,
|
||||||
|
float: SelfDescribingBinaryProtocol.FLOAT,
|
||||||
|
# types.FloatType: TType.DOUBLE,
|
||||||
|
bool: TType.BOOL,
|
||||||
|
object: TType.STRUCT,
|
||||||
|
str: TType.STRING,
|
||||||
|
type(None): TType.VOID,
|
||||||
|
numpy.float32: SelfDescribingBinaryProtocol.FLOAT,
|
||||||
|
numpy.int32: TType.I32,
|
||||||
|
numpy.ndarray: TType.LIST,
|
||||||
|
numpy.object_: TType.STRING, # making an assumption here
|
||||||
|
numpy.string_: TType.STRING,
|
||||||
|
numpy.float64: TType.DOUBLE,
|
||||||
|
numpy.int16: TType.I16,
|
||||||
|
numpy.int8: TType.BYTE,
|
||||||
|
numpy.int64: TType.I64
|
||||||
|
}
|
||||||
|
|
||||||
primitiveSupport = (TType.BYTE, TType.I16, TType.I32, TType.I64,
|
primitiveSupport = (TType.BYTE, TType.I16, TType.I32, TType.I64,
|
||||||
SelfDescribingBinaryProtocol.FLOAT, TType.DOUBLE)
|
SelfDescribingBinaryProtocol.FLOAT, TType.DOUBLE)
|
||||||
|
@ -227,7 +254,10 @@ class ThriftSerializationContext(object):
|
||||||
if pyt in pythonToThriftMap:
|
if pyt in pythonToThriftMap:
|
||||||
return pythonToThriftMap[pyt]
|
return pythonToThriftMap[pyt]
|
||||||
elif pyt.__module__[:DS_LEN - 1] == ('dynamicserialize.dstypes'):
|
elif pyt.__module__[:DS_LEN - 1] == ('dynamicserialize.dstypes'):
|
||||||
return pythonToThriftMap[object]
|
if six.PY2:
|
||||||
|
return pythonToThriftMap[types.InstanceType]
|
||||||
|
else:
|
||||||
|
return pythonToThriftMap[object]
|
||||||
else:
|
else:
|
||||||
raise dynamicserialize.SerializationException(
|
raise dynamicserialize.SerializationException(
|
||||||
"Don't know how to serialize object of type: " + str(pyt))
|
"Don't know how to serialize object of type: " + str(pyt))
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
# File auto-generated against equivalent DynamicSerialize Java class
|
# File auto-generated against equivalent DynamicSerialize Java class
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
from six import with_metaclass
|
import six
|
||||||
|
|
||||||
class AbstractResponseData(with_metaclass(abc.ABCMeta, object)):
|
|
||||||
|
class AbstractResponseData(six.with_metaclass(abc.ABCMeta, object)):
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.time = None
|
self.time = None
|
||||||
|
@ -27,13 +25,20 @@ class AbstractResponseData(with_metaclass(abc.ABCMeta, object)):
|
||||||
self.level = level
|
self.level = level
|
||||||
|
|
||||||
def getLocationName(self):
|
def getLocationName(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.locationName
|
||||||
|
if self.locationName is not None:
|
||||||
|
return self.locationName.decode('utf-8')
|
||||||
return self.locationName
|
return self.locationName
|
||||||
|
|
||||||
def setLocationName(self, locationName):
|
def setLocationName(self, locationName):
|
||||||
self.locationName = locationName
|
self.locationName = locationName
|
||||||
|
|
||||||
def getAttributes(self):
|
def getAttributes(self):
|
||||||
return self.attributes
|
if six.PY2:
|
||||||
|
return self.attributes
|
||||||
|
else:
|
||||||
|
return [item.decode('utf-8') for item in self.attributes]
|
||||||
|
|
||||||
def setAttributes(self, attributes):
|
def setAttributes(self, attributes):
|
||||||
self.attributes = attributes
|
self.attributes = attributes
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
# File auto-generated against equivalent DynamicSerialize Java class
|
# File auto-generated against equivalent DynamicSerialize Java class
|
||||||
# and then modified post-generation to use AbstractResponseData.
|
# and then modified post-generation to use AbstractResponseData.
|
||||||
#
|
#
|
||||||
|
@ -12,8 +9,9 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import AbstractResponseData
|
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import AbstractResponseData
|
||||||
|
import six
|
||||||
|
|
||||||
|
|
||||||
class GridResponseData(AbstractResponseData):
|
class GridResponseData(AbstractResponseData):
|
||||||
|
|
||||||
|
@ -24,12 +22,20 @@ class GridResponseData(AbstractResponseData):
|
||||||
self.gridData = None
|
self.gridData = None
|
||||||
|
|
||||||
def getParameter(self):
|
def getParameter(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.parameter
|
||||||
|
if self.parameter is not None:
|
||||||
|
return self.parameter.decode('utf-8')
|
||||||
return self.parameter
|
return self.parameter
|
||||||
|
|
||||||
def setParameter(self, parameter):
|
def setParameter(self, parameter):
|
||||||
self.parameter = parameter
|
self.parameter = parameter
|
||||||
|
|
||||||
def getUnit(self):
|
def getUnit(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.unit
|
||||||
|
if self.unit is not None:
|
||||||
|
return self.unit.decode('utf-8')
|
||||||
return self.unit
|
return self.unit
|
||||||
|
|
||||||
def setUnit(self, unit):
|
def setUnit(self, unit):
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
# File auto-generated against equivalent DynamicSerialize Java class
|
# File auto-generated against equivalent DynamicSerialize Java class
|
||||||
# and then modified post-generation to add additional features to better
|
# and then modified post-generation to add additional features to better
|
||||||
# match Java implementation.
|
# match Java implementation.
|
||||||
|
@ -15,6 +12,9 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
|
|
||||||
class MasterLevel(object):
|
class MasterLevel(object):
|
||||||
|
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
|
@ -37,39 +37,67 @@ class MasterLevel(object):
|
||||||
return not self.__eq__(other)
|
return not self.__eq__(other)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
retVal = "MasterLevel["
|
if six.PY2:
|
||||||
retVal += "name=" + str(self.name) + ","
|
retVal = "MasterLevel["
|
||||||
retVal += "type=" + str(self.type) + ","
|
retVal += "name=" + str(self.name) + ","
|
||||||
retVal += "unit=" + str(self.unitString) + ","
|
retVal += "type=" + str(self.type) + ","
|
||||||
retVal += "description=" + str(self.description)
|
retVal += "unit=" + str(self.unitString) + ","
|
||||||
retVal += "]"
|
retVal += "description=" + str(self.description)
|
||||||
|
retVal += "]"
|
||||||
|
else:
|
||||||
|
retVal = "MasterLevel["
|
||||||
|
retVal += "name=" + str(self.name.decode('utf-8')) + ","
|
||||||
|
retVal += "type=" + str(self.type.decode('utf-8')) + ","
|
||||||
|
retVal += "unit=" + str(self.unitString.decode('utf-8')) + ","
|
||||||
|
retVal += "description=" + str(self.description.decode('utf-8'))
|
||||||
|
retVal += "]"
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.name
|
||||||
|
if self.name is not None and type(self.name) is not str:
|
||||||
|
return self.name.decode('utf-8')
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
def setName(self, name):
|
def setName(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.description
|
||||||
|
if self.description is not None:
|
||||||
|
return self.description.decode('utf-8')
|
||||||
return self.description
|
return self.description
|
||||||
|
|
||||||
def setDescription(self, description):
|
def setDescription(self, description):
|
||||||
self.description = description
|
self.description = description
|
||||||
|
|
||||||
def getUnitString(self):
|
def getUnitString(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.unitString
|
||||||
|
if self.unitString is not None:
|
||||||
|
return self.unitString.decode('utf-8')
|
||||||
return self.unitString
|
return self.unitString
|
||||||
|
|
||||||
def setUnitString(self, unitString):
|
def setUnitString(self, unitString):
|
||||||
self.unitString = unitString
|
self.unitString = unitString
|
||||||
|
|
||||||
def getType(self):
|
def getType(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.type
|
||||||
|
if self.type is not None:
|
||||||
|
return self.type.decode('utf-8')
|
||||||
return self.type
|
return self.type
|
||||||
|
|
||||||
def setType(self, type):
|
def setType(self, type):
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
||||||
def getIdentifier(self):
|
def getIdentifier(self):
|
||||||
|
if six.PY2:
|
||||||
|
return self.identifier
|
||||||
|
if self.identifier is not None:
|
||||||
|
return self.identifier.decode('utf-8')
|
||||||
return self.identifier
|
return self.identifier
|
||||||
|
|
||||||
def setIdentifier(self, identifier):
|
def setIdentifier(self, identifier):
|
||||||
|
|
Loading…
Add table
Reference in a new issue