convert to a string value based on the type of `inferredType`
343417
function(value, inferredType) {
      if (inferredType === 'boolean') {
        return value ? '' : undefined;
      } else if (inferredType !== 'object' && inferredType !== 'function'
          && value !== undefined) {
        return value;
      }
    }
1280192
def infer_type(node, context=None):
    """"""
    if len(node.args) != 1:
        raise UseInferenceDefault

    return helpers.object_type(node.args[0], context)
315471
function parseStoredType(value /* , context */) {
    const regex = /^(\w+)(\((.*?)\))?$/;
    const result = value.match(regex);
    if (!result) throw new ImplementationError(`Invalid storedType "${value}"`);

    const type = result[1];
    const options = {};
    if (result[2]) {
        const regexOptions = /^(\w+)=(.*)/;
        result[3].split(';').forEach(o => {
            const resultOptions = o.match(regexOptions);
            if (!resultOptions) throw new ImplementationError(`Invalid storedType "${value}"`);
            options[resultOptions[1]] = resultOptions[2];
        });
    }

    return { type, options };
}
810268
def infer_struct(value: Mapping[str, GenericAny]) -> Struct:
    """"""
    if not value:
        raise TypeError('Empty struct type not supported')
    return Struct(list(value.keys()), list(map(infer, value.values())))
601062
def infer_typing_attr(node, context=None):
    """"""
    try:
        value = next(node.value.infer())
    except InferenceError as exc:
        raise UseInferenceDefault from exc

    if not value.qname().startswith("typing."):
        raise UseInferenceDefault

    node = extract_node(TYPING_TYPE_TEMPLATE.format(value.qname().split(".")[-1]))
    return node.infer(context=context)
809704
def type_string(self):
        """"""
        if self.is_tuple:
            subtypes = [item.type_string for item in self.children]
            return '{}({})'.format(
                '' if self.val_guaranteed else '*',
                ', '.join(subtypes))
        elif self.is_list:
            return '{}[{}]'.format(
                '' if self.val_guaranteed else '*',
                self.children[0].type_string)
        else:
            return '{}{}'.format(
                '' if self.val_guaranteed else '*',
                self.type_.__name__)
1348056
function (type) {
            var ret = null, meth;
            if (isString(type)) {
                ret = this._static.CAST_TYPES[type] || this._super(arguments);
            } else if (type === String) {
                meth += "CHAR";
            } else if (type === Number) {
                meth += "DECIMAL";
            } else if (type === DateTime) {
                meth += "DATETIME";
            } else if (type === Year) {
                meth += "Year";
            } else if (type === Time) {
                meth += "DATETIME";
            } else if (type === Double) {
                meth += "DECIMAL";
            } else {
                ret = this._super(arguments);
            }
            return ret;
        }
451242
function tryConvertType(typeToConvert, value) {
  if (typeToConvert === 'string') {
    return value && value.toString();
  } else if (typeToConvert === 'number') {
    return Number(value);
  } else {
    return value;
  }
}
23385
def _cast_to_type(self, value):
        
        if value in (True, False):
            return bool(value)
        if value in ('t', 'True', '1'):
            return True
        if value in ('f', 'False', '0'):
            return False
        self.fail('invalid', value=value)
422810
def str2type(value):
    
    if not isinstance(value, str):
        return value
    try:
        return json.loads(value)
    except JSONDecodeError:
        return value
474861
def to_type(value, ptype):
    
    if ptype == 'str':
        return str(value)
    elif ptype == 'int':
        return int(value)
    elif ptype == 'float':
        return float(value)
    elif ptype == 'bool':
        if value.lower() == 'true':
            return True
        elif value.lower() == 'false':
            return False
        raise ValueError('Bad bool value: %s' % value)
    elif ptype == 'json':
        return json.loads(value)

    return ValueError('Unknown type')
16048
def check_type(param, datatype):
    
    if param is None:
        return param

    if getattr(datatype, 'clean', None) and callable(datatype.clean):
        try:
            return datatype.clean(param)
        except ValueError:
            raise BadArgumentError(param)

    elif isinstance(datatype, str):
        # You've given it something like `'bool'` as a string.
        # This is the legacy way of doing it.
        datatype = {
            'str': str,
            'bool': bool,
            'float': float,
            'date': datetime.date,
            'datetime': datetime.datetime,
            'timedelta': datetime.timedelta,
            'json': 'json',  # exception
            'int': int,
        }[datatype]

    if datatype is str and not isinstance(param, basestring):
        try:
            param = str(param)
        except ValueError:
            param = str()

    elif datatype is int and not isinstance(param, int):
        try:
            param = int(param)
        except ValueError:
            param = int()

    elif datatype is bool and not isinstance(param, bool):
        param = str(param).lower() in ("true", "t", "1", "y", "yes")

    elif (
        datatype is datetime.datetime and
        not isinstance(param, datetime.datetime)
    ):
        try:
            param = dtutil.string_to_datetime(param)
        except ValueError:
            param = None

    elif datatype is datetime.date and not isinstance(param, datetime.date):
        try:
            param = dtutil.string_to_datetime(param).date()
        except ValueError:
            param = None

    elif (
        datatype is datetime.timedelta and
        not isinstance(param, datetime.timedelta)
    ):
        try:
            param = dtutil.strHoursToTimeDelta(param)
        except ValueError:
            param = None

    elif datatype == "json" and isinstance(param, basestring):
        try:
            param = json.loads(param)
        except ValueError:
            param = None

    return param
901872
def type_check_and_str(python_type, value):
    """"""
    if not isinstance(value, python_type):
        raise GraphQLInvalidArgumentError(u'Attempting to represent a non-{type} as a {type}: '
                                          u'{value}'.format(type=python_type, value=value))

    return str(value)
270231
def _guess_type(val):
        """"""
        if isinstance(val, bool):
            return "choice"
        elif isinstance(val, int):
            return "number"
        elif isinstance(val, float):
            return "number"
        elif isinstance(val, str):
            return "text"
        elif hasattr(val, 'read'):
            return "file"
        else:
            return "text"
875285
def _infer_type(value, element_kind, element_name):
    

    if value is None:
        raise ValueError(
            _format("Cannot infer CIM type of {0} {1!A} from its value when "
                    "the value is None", element_kind, element_name))

    try:
        return cimtype(value)
    except TypeError as exc:
        raise ValueError(
            _format("Cannot infer CIM type of {0} {1!A} from its value: {2!A}",
                    element_kind, element_name, exc))
538266
def value_type(type_):
        """"""
        if not smart_pointer_traits.is_smart_pointer(type_):
            raise TypeError(
                'Type "%s" is not an instantiation of \
                boost::shared_ptr or std::shared_ptr' %
                type_.decl_string)
        try:
            return internal_type_traits.get_by_name(type_, "element_type")
        except runtime_errors.declaration_not_found_t:
            return _search_in_bases(type_)
681166
function inferResponseType (src) {
  var dotLastIndex = src.lastIndexOf('.');
  if (dotLastIndex >= 0) {
    var extension = src.slice(dotLastIndex, src.length);
    if (extension === '.gltf' || extension === '.glb') {
      return 'arraybuffer';
    }
  }
  return 'text';
}