Variant of mpfr_get_str, for internal use:  simply splits off the '-'
    sign from the digit string, and returns a triple

        (sign, digits, exp)

    Also converts the byte-string produced by mpfr_get_str to Unicode.
540426
def _mpfr_get_str2(base, ndigits, op, rounding_mode):
    
    digits, exp = mpfr.mpfr_get_str(base, ndigits, op, rounding_mode)
    negative = digits.startswith('-')
    if negative:
        digits = digits[1:]
    return negative, digits, exp
214816
def custom_triplet_bytes(custom_triplet):
    
    # Structure: 0, NOTE, len(aux_note), aux_note, codenumber, space, codesymbol, space, description, (0 null if necessary)
    # Remember, aux_note string includes 'number(s)<space><symbol><space><description>''
    annbytes = [0, 88, len(custom_triplet[2]) + 3 + len(str(custom_triplet[0])), 252] + [ord(c) for c in str(custom_triplet[0])] \
               + [32] + [ord(custom_triplet[1])] + [32] + [ord(c) for c in custom_triplet[2]]

    if len(annbytes) % 2:
        annbytes.append(0)

    return annbytes
679944
def three_digit(number):
    
    number = str(number)
    if len(number) == 1:
        return u'00%s' % number
    elif len(number) == 2:
        return u'0%s' % number
    else:
        return number
329935
def _translate_str(self, oprnd1, oprnd2, oprnd3):
        
        assert oprnd1.size and oprnd3.size

        op1_var = self._translate_src_oprnd(oprnd1)
        op3_var, op3_var_constrs = self._translate_dst_oprnd(oprnd3)

        if oprnd3.size > oprnd1.size:
            result = smtfunction.zero_extend(op1_var, op3_var.size)
        elif oprnd3.size < oprnd1.size:
            result = smtfunction.extract(op1_var, 0, op3_var.size)
        else:
            result = op1_var

        return [op3_var == result] + op3_var_constrs
1150523
def get_obj_frm_str(obj_str, **kwargs):
    
    obj_str = obj_str.format(**kwargs)
    args = []
    kwargs = {}
    params = []
    # parse the call portion of the string
    if "(" in obj_str:
        call_args = obj_str[obj_str.find("("):]
        obj_str = obj_str[:obj_str.find("(")]
        call_args = call_args[1:-1]
        if call_args:
            call_args = call_args.split(",")
        else:
            call_args = []
        call_args = [arg.strip() for arg in call_args]

        for arg in call_args:
            if "=" in arg:
                parts = arg.split("=")
                kwargs[parts[0]] = parts[1]
            else:
                args.append(arg)
    # parse a the __getitem__ portion of the string
    if "[" in obj_str:
        params = obj_str[obj_str.find("["):]
        obj_str = obj_str[:obj_str.find("[")]
        params = [part.replace("[", "").replace("]", "")
                  for part in params.split("][")]
    obj = pydoc.locate(obj_str)
    if params:
        for part in params:
            obj = get_attr(obj, part)
    if args or kwargs:
        if kwargs:
            obj = obj.__call__(*args, **kwargs)
        else:
            obj = obj.__call__(*args)
    return obj
1094930
def pp_hex(raw, reverse=True):
    
    if not reverse:
        return ''.join(['{:02x}'.format(v) for v in bytearray(raw)])
    return ''.join(reversed(['{:02x}'.format(v) for v in bytearray(raw)]))
1285808
def format_decimal(decimal):
    
    # strip trailing fractional zeros
    normalized = decimal.normalize()
    sign, digits, exponent = normalized.as_tuple()
    if exponent >= 1:
        normalized = normalized.quantize(1)

    return str(normalized)
782209
def parse_coordinate(string_rep):
        

        # Any CRTF coordinate representation (sexagesimal or degrees)
        if 'pix' in string_rep:
            return u.Quantity(string_rep[:-3], u.dimensionless_unscaled)
        if 'h' in string_rep or 'rad' in string_rep:
            return coordinates.Angle(string_rep)
        if len(string_rep.split('.')) >= 3:
            string_rep = string_rep.replace('.', ':', 2)

        return coordinates.Angle(string_rep, u.deg)
966537
function (cp) {
	        return (cp < 0x10000) ? String.fromCharCode(cp) :
	            String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
	                String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
	    }
949799
private String decodePercent(String str) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            switch (c) {
                case '+':
                    sb.append(' ');
                    break;
                case '%':
                    sb.append((char) Integer.parseInt(str.substring(i + 1, i + 3), 16));
                    i += 2;
                    break;
                default:
                    sb.append(c);
                    break;
            }
        }
        str = sb.toString();
        if (str.contains("%")) {
            str = decodePercent(str);
        }
        return str;
    }
787178
def get_output_str(item, detect_numerics, precision, sign_value):
    """"""
    if detect_numerics:
        item = _convert_to_numeric(item)
    if isinstance(item, float):
        item = round(item, precision)
    try:
        item = '{:{sign}}'.format(item, sign=sign_value)
    except (ValueError, TypeError):
        pass
    return to_unicode(item)
286945
def get_digits_from_string(cyphertext, length=4):
    
    digits = ''
   
    """
    The algorigthm is used for PVV and CVV calculation.

    1. The cyphertext is scanned from left to right. Decimal digits are
    selected during the scan until the needed number of decimal digits is found. 
    Each selected digit is placed from left to right according to the order
    of selection. If needed number of decimal digits is found (four in case of PVV, 
    three in case of CVV), those digits are the PVV or CVV.
    """
    for c in cyphertext:
        if len(digits) >= length:
            break
        try:
            int(c)
            digits += c
        except ValueError:
            continue
    
    """
    2. If, at the end of the first scan, less than four decimal digits
    have been selected, a second scan is performed from left to right.
    During the second scan, all decimal digits are skipped and only nondecimal
    digits can be processed. Nondecimal digits are converted to decimal
    digits by subtracting 10. The process proceeds until four digits of
    PVV are found.
    """
    if len(digits) < length:
        for c in cyphertext:
            if len(digits) >= length:
                break
    
            if (int(c, 16) - 10) >= 0:
                digits += str(int(c, 16) - 10)
    
    return digits
345043
def convert_to_bytes(mem_str):
    
    if str(mem_str)[-1].upper().endswith("G"):
        return int(round(float(mem_str[:-1]) * 1024 * 1024))
    elif str(mem_str)[-1].upper().endswith("M"):
        return int(round(float(mem_str[:-1]) * 1024))
    else:
        return int(round(float(mem_str)))
1253422
def str_to_num(self, arg):
        

        if len(arg) == 1:
            ten = '10'
        else:
            ten = ''
        switcher = {
            '一': '1',
            '二': '2',
            '三': '3',
            '四': '4',
            '五': '5',
            '六': '6',
            '七': '7',
            '八': '8',
            '九': '9',
            '十': ten,
            '〇': '0',
            '○': '0',
        }
        test = ''
        for i in arg:
            test = test + switcher.get(i, None)
        return int(test)
528873
def extractAtCyther(string):
    
    if isinstance(string, str) and os.path.isfile(string):
        with open(string) as file:
            string = file.read()

    found_pound = extract(POUND_PATTERN, string)
    found_tripple = extract(TRIPPLE_PATTERN, string)
    all_found = found_pound + found_tripple
    code = '\n'.join([item for item in all_found])

    return code
427646
def convert_string_to_number(str)
      matches = RE_NUMBER_STR.match(str)

      s = matches[:sign] == '-' ? -1 : 1
      i = matches[:integer].to_i
      f = matches[:fractional].to_i
      d = matches[:fractional] ? matches[:fractional].length : 0
      t = matches[:exponent_sign] == '-' ? -1 : 1
      e = matches[:exponent].to_i

      # I know this looks nutty, but it's exactly what's defined in the spec,
      # and it works.
      s * (i + f * 10**-d) * 10**(t * e)
    end
120469
function stringTrimLeft (str) {
  return str && str.trimLeft ? str.trimLeft() : ('' + str).replace(/^[\s\uFEFF\xA0]+/g, '')
}