Return the a string with the data type of a value, for Graph data
325915
def gtype(n):
    
    t = type(n).__name__
    return str(t) if t != 'Literal' else 'Literal, {}'.format(n.language)
190034
def str2bytes(x):
  """"""
  if type(x) is bytes:
    return x
  elif type(x) is str:
    return bytes([ ord(i) for i in x ])
  else:
    return str2bytes(str(x))
1092871
def python_type(textx_type_name):
    """"""
    return {
        'ID': text,
        'BOOL': bool,
        'INT': int,
        'FLOAT': float,
        'STRICTFLOAT': float,
        'STRING': text,
        'NUMBER': float,
        'BASETYPE': text,
    }.get(textx_type_name, textx_type_name)
911523
def get_node_type(type_str):
    """"""
    if type_str == "container":
        return NodeType.CONTAINER
    elif type_str == "loop_plate":
        return NodeType.LOOP
    elif type_str == "assign":
        return NodeType.ASSIGN
    elif type_str == "condition":
        return NodeType.CONDITION
    elif type_str == "decision":
        return NodeType.DECISION
    else:
        raise ValueError("Unrecognized type string: ", type_str)
406644
def read_string(self, start: int, line: int, col: int, prev: Token) -> Token:
        """"""
        source = self.source
        body = source.body
        body_length = len(body)
        position = start + 1
        chunk_start = position
        value: List[str] = []
        append = value.append

        while position < body_length:
            char = body[position]
            if char in "\n\r":
                break
            if char == '"':
                append(body[chunk_start:position])
                return Token(
                    TokenKind.STRING,
                    start,
                    position + 1,
                    line,
                    col,
                    prev,
                    "".join(value),
                )
            if char < " " and char != "\t":
                raise GraphQLSyntaxError(
                    source,
                    position,
                    f"Invalid character within String: {print_char(char)}.",
                )
            position += 1
            if char == "\\":
                append(body[chunk_start : position - 1])
                char = body[position : position + 1]
                escaped = _ESCAPED_CHARS.get(char)
                if escaped:
                    value.append(escaped)
                elif char == "u" and position + 4 < body_length:
                    code = uni_char_code(*body[position + 1 : position + 5])
                    if code < 0:
                        escape = repr(body[position : position + 5])
                        escape = escape[:1] + "\\" + escape[1:]
                        raise GraphQLSyntaxError(
                            source,
                            position,
                            f"Invalid character escape sequence: {escape}.",
                        )
                    append(chr(code))
                    position += 4
                else:
                    escape = repr(char)
                    escape = escape[:1] + "\\" + escape[1:]
                    raise GraphQLSyntaxError(
                        source,
                        position,
                        f"Invalid character escape sequence: {escape}.",
                    )
                position += 1
                chunk_start = position

        raise GraphQLSyntaxError(source, position, "Unterminated string.")
1054188
function CharToString(val) {
    if (val < 0x10000) {
        return String.fromCharCode(val);
    }
    else {
        val -= 0x10000;
        return String.fromCharCode(0xD800 + (val >> 10), 0xDC00 + (val & 0x3FF));
    }
}
420363
function _fnDetectType( sData )
		{
			var aTypes = DataTable.ext.aTypes;
			var iLen = aTypes.length;
			
			for ( var i=0 ; i<iLen ; i++ )
			{
				var sType = aTypes[i]( sData );
				if ( sType !== null )
				{
					return sType;
				}
			}
			
			return 'string';
		}
32833
def _get_string_type_from_token(token_type):
    """"""
    return_value = None
    if token_type in [TokenType.BeginSingleQuotedLiteral,
                      TokenType.EndSingleQuotedLiteral]:
        return_value = "Single"
    elif token_type in [TokenType.BeginDoubleQuotedLiteral,
                        TokenType.EndDoubleQuotedLiteral]:
        return_value = "Double"

    assert return_value is not None
    return return_value
722312
def convert_string_value_to_type_value(string_value, data_type):
    
    from ast import literal_eval

    try:
        if data_type in (str, type(None)):
            converted_value = str(string_value)
        elif data_type == int:
            converted_value = int(string_value)
        elif data_type == float:
            converted_value = float(string_value)
        elif data_type == bool:
            converted_value = bool(literal_eval(string_value))
        elif data_type in (list, dict, tuple):
            converted_value = literal_eval(string_value)
            if type(converted_value) != data_type:
                raise ValueError("Invalid syntax: {0}".format(string_value))
        elif data_type == object:
            try:
                converted_value = literal_eval(string_value)
            except (ValueError, SyntaxError):
                converted_value = literal_eval('"' + string_value + '"')
        elif isinstance(data_type, type):  # Try native type conversion
            converted_value = data_type(string_value)
        elif isclass(data_type):  # Call class constructor
            converted_value = data_type(string_value)
        else:
            raise ValueError("No conversion from string '{0}' to data type '{0}' defined".format(
                string_value, data_type.__name__))
    except (ValueError, SyntaxError, TypeError) as e:
        raise AttributeError("Can't convert '{0}' to type '{1}': {2}".format(string_value, data_type.__name__, e))
    return converted_value
1017613
def graph_type(self, graph):
        """"""
        graph = self.pack(graph)
        return self.sql('graph_type', graph).fetchone()[0]
208008
def get_type(obj, **kwargs):
    """"""
    t = type(obj)

    s = extract_type(str(t))

    return 'Type: {}'.format(s)
1005337
def _get_ascii_field(self, values):
        ''''''

        empty_space = ' '

        # This formats as field[x][y]
        field = [[empty_space for y in range(max(values) + 1)] for x in range(len(values))]

        # Draw graph into field
        for x in range(len(values)):
            y = values[x]
            y_prev = values[x - 1] if x - 1 in range(len(values)) else y
            y_next = values[x + 1] if x + 1 in range(len(values)) else y
            # Fill empty space
            if abs(y_prev - y) > 1:
                # Fill space between y and y_prev
                step = 1 if y_prev - y > 0 else -1

                # We don't want the first item to be inclusive, so we use step instead of y+1 since step can be negative
                for h in range(y + step, y_prev, step):
                    if field[x][h] is empty_space:
                        field[x][h] = '|'

            # Assign the character to be placed into the graph
            char = self._assign_ascii_character(y_prev, y, y_next)

            field[x][y] = char
        return field
393383
def fmt_data(text, data_formating = None, data_type = None):
        
        if data_type:
            return DATA_TYPES[data_type](text)
        elif data_formating:
            return str(data_formating).format(text)
        return str(text)
805988
def _get_type(self, obj):
        """"""
        typever = obj['Type']
        typesplit = typever.split('.')
        return typesplit[0] + '.' + typesplit[1]
379740
function _data(model, node_or_edge) {

      var data = {};
      var attvalues_els = node_or_edge.getElementsByTagName('attvalue');

      // Getting Node Indicated Attributes
      var ah = _helpers.nodeListToHash(attvalues_els, function(el) {
        var attributes = _helpers.namedNodeMapToObject(el.attributes);
        var key = attributes.id || attributes['for'];

        // Returning object
        return {key: key, value: attributes.value};
      });


      // Iterating through model
      model.map(function(a) {

        // Default value?
        data[a.id] = !(a.id in ah) && 'defaultValue' in a ?
          _helpers.enforceType(a.type, a.defaultValue) :
          _helpers.enforceType(a.type, ah[a.id]);

      });

      return data;
    }
510928
def string_value(node):
    """"""
    if (node.nodeType == node.DOCUMENT_NODE or
        node.nodeType == node.ELEMENT_NODE):
        s = u''
        for n in axes['descendant'](node):
            if n.nodeType == n.TEXT_NODE:
                s += n.data
        return s

    elif node.nodeType == node.ATTRIBUTE_NODE:
        return node.value

    elif (node.nodeType == node.PROCESSING_INSTRUCTION_NODE or
          node.nodeType == node.COMMENT_NODE or
          node.nodeType == node.TEXT_NODE):
        return node.data
533608
def format_value(self):
        
        return format_value(
            self.data_type,
            self.data,
            self.parent.stringpool_main.getString
        )