Accepts both the output of to_simple_str() and __str__().
511236
def from_str(cls, s):
        
        if not isinstance(s, str):
            raise TypeError("Expected an str instance, received %r" % (s,))
        return cls(cls.bits_from_str(s))
339411
def set_str2(s, base, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        _set_from_whole_string,
        (s, base),
        context,
    )
1046546
def to_str(value):
    '''
    
    '''
    value = from_str(value)

    if value:
        value = value.replace('"', '\\"')
        if ' ' in value:
            value = '"' + value + '"'
    elif value is None:
        value = 'none'

    return value
694703
def str_to_uuid(value):
    
    if isfunction(value):
        value = value()

    return UUID(value) if isinstance(value, string_types) else value
337046
def StrConcat(*args):
    
    new_value = ''.join([arg.value for arg in args])
    return StringV(new_value)
1041770
def stringify(*args):
    
    if (len(args) == 1) and callable(args[0]):
        func = args[0]

        @wraps(func)
        def _inner(*args, **kwargs):
            return "".join([str(i) for i in func(*args, **kwargs)])
        return _inner
    else:
        return "".join([str(i) for i in args])
965796
def _to_python(input_string):
    ''' '''
    python_string = ''
    for i in range(len(input_string)):
        if not python_string:
            python_string += input_string[i].lower()
        elif input_string[i].isupper():
            python_string += '_%s' % input_string[i].lower()
        else:
            python_string += input_string[i]
    return python_string
612152
def strings_to_integers(strings: Iterable[str]) -> Iterable[int]:
    
    return strings_to_(strings, lambda x: int(float(x)))
328521
def ensure_str(s, encoding='utf-8', errors='strict'):
    
    if not isinstance(s, (text_type, binary_type)):
        raise TypeError("not expecting type '%s'" % type(s))
    if PY2 and isinstance(s, text_type):
        s = s.encode(encoding, errors)
    elif PY3 and isinstance(s, binary_type):
        s = s.decode(encoding, errors)
    return s
340109
def __toString(self, values):
		
		for key in values:
			if not values[key] is str:
				values[key] = str(values[key])
		return values
55738
def tokenize(str)
      raise ArgumentError, 'str must be a String' unless str.is_a?(String)

      j_instance.tokenize(str).to_ary
    end
481135
def smart_str(s, encoding='utf-8', strings_only=False, errors='strict'):
    
    if strings_only and isinstance(s, (types.NoneType, int)):
        return s
    # if isinstance(s, Promise):
    #     return unicode(s).encode(encoding, errors)
    if not isinstance(s, basestring):
        try:
            return str(s)
        except UnicodeEncodeError:
            if isinstance(s, Exception):
                # An Exception subclass containing non-ASCII data that doesn't
                # know how to print itself properly. We shouldn't raise a
                # further exception.
                return ' '.join([smart_str(arg, encoding, strings_only,
                        errors) for arg in s])
            return unicode(s).encode(encoding, errors)
    elif isinstance(s, unicode):
        return s.encode(encoding, errors)
    elif s and encoding != 'utf-8':
        return s.decode('utf-8', errors).encode(encoding, errors)
    else:
        return s
1221240
def _float_or_str(value):
    
    # remove any surrounding quotes
    value = QUOTE_REGEX.sub('', value)
    try:  # attempt `float()` conversion
        return float(value)
    except ValueError:  # just return the input
        return value
1136750
def pattern_to_str(pattern):
    
    if isinstance(pattern, str):
        return repr(pattern)
    else:
        return repr(pattern.pattern) if pattern else None
1216480
def to_str(self, s):
        '''
        
        '''
        if s.__class__ != str:
            if not IS_PY3K:
                s = s.encode('utf-8')
            else:
                raise AssertionError('Expected to have str on Python 3. Found: %s (%s)' % (s, s.__class__))
        return s
422445
def safe_mult(a, b):
    """"""
    if isinstance(a, str) and isinstance(b, int) and len(a) * b > MAX_STR_LEN:
        raise RuntimeError("String length exceeded, max string length is {}".format(MAX_STR_LEN))
    return a * b
269518
def debugDumpString(output, str):
    
    if output is not None: output.flush()
    libxml2mod.xmlDebugDumpString(output, str)