def _commonFormatVal(self, val, valueType, valueDim): valTypeInfo = Gtrack.VAL_TYPE_DICT[valueType] if valueDim == 'scalar': if not isinstance(val, str) and hasattr(val, '__len__') and len(val)==1: val = val[0] if (val == valTypeInfo.missingVal) or (isNan(val) and isNan(valTypeInfo.missingVal)): return '.' elif isinstance(val, str): return self._formatPhraseWithCorrectChrUsage(val, useUrlEncoding=True, notAllowedChars='#.,;=\t') else: if isinstance(val, bool): return '1' if val == True else '0' else: return str(val) else: return valTypeInfo.delim.join([self._commonFormatVal(valPart, valueType, 'scalar') for valPart in val]) \ if len(val) != 0 else '.'
def _commonFormatVal(self, val, valueType, valueDim): valTypeInfo = Gtrack.VAL_TYPE_DICT[valueType] if valueDim == 'scalar': if not isinstance(val, str) and hasattr( val, '__len__') and len(val) == 1: val = val[0] if (val == valTypeInfo.missingVal) or (isNan(val) and isNan( valTypeInfo.missingVal)): return '.' elif isinstance(val, str): return self._formatPhraseWithCorrectChrUsage( val, useUrlEncoding=True, notAllowedChars='#.,;=\t') else: if isinstance(val, bool): return '1' if val == True else '0' else: return str(val) else: return valTypeInfo.delim.join([self._commonFormatVal(valPart, valueType, 'scalar') for valPart in val]) \ if len(val) != 0 else '.'
def _commonFormatNumberVal(self, val): if isNan(val) or val is None: return '.' return ('%#.' + str(Config.OUTPUT_PRECISION) + 'g') % val