Return "Gimatria" number.
172483
def hebrew_number(num, hebrew=True, short=False):
    """"""
    if not hebrew:
        return str(num)
    if not 0 <= num < 10000:
        raise ValueError('num must be between 0 to 9999, got:{}'.format(num))
    hstring = u""
    if num >= 1000:
        hstring += htables.DIGITS[0][num // 1000]
        hstring += u"' "
        num = num % 1000
    while num >= 400:
        hstring += htables.DIGITS[2][4]
        num = num - 400
    if num >= 100:
        hstring += htables.DIGITS[2][num // 100]
        num = num % 100
    if num >= 10:
        if num in [15, 16]:
            num = num - 9
        hstring += htables.DIGITS[1][num // 10]
        num = num % 10
    if num > 0:
        hstring += htables.DIGITS[0][num]
    # possibly add the ' and " to hebrew numbers
    if not short:
        if len(hstring) < 2:
            hstring += u"'"
        else:
            hstring = hstring[:-1] + u'"' + hstring[-1]
    return hstring
1342418
def _number_desc_by_type(metadata, num_type):
    """"""
    if num_type == PhoneNumberType.PREMIUM_RATE:
        return metadata.premium_rate
    elif num_type == PhoneNumberType.TOLL_FREE:
        return metadata.toll_free
    elif num_type == PhoneNumberType.MOBILE:
        return metadata.mobile
    elif (num_type == PhoneNumberType.FIXED_LINE or
          num_type == PhoneNumberType.FIXED_LINE_OR_MOBILE):
        return metadata.fixed_line
    elif num_type == PhoneNumberType.SHARED_COST:
        return metadata.shared_cost
    elif num_type == PhoneNumberType.VOIP:
        return metadata.voip
    elif num_type == PhoneNumberType.PERSONAL_NUMBER:
        return metadata.personal_number
    elif num_type == PhoneNumberType.PAGER:
        return metadata.pager
    elif num_type == PhoneNumberType.UAN:
        return metadata.uan
    elif num_type == PhoneNumberType.VOICEMAIL:
        return metadata.voicemail
    else:
        return metadata.general_desc
1156436
def start(st_reg_number):
    """"""

    divisor = 11

    verificador_one = int(st_reg_number[len(st_reg_number)-4])
    verificador_two = int(st_reg_number[len(st_reg_number)-1])
    weights_first = [1, 3, 4, 5, 6, 7, 8, 10]
    weights_secund = [3, 2, 10, 9, 8, 7, 6, 5, 4, 3, 2]

    if len(st_reg_number) > 13:
        return False

    if len(st_reg_number) < 12:
        return False

    if len(st_reg_number) == 12:
        sum_total = 0
        for i in range(len(st_reg_number)-4):
            sum_total = sum_total + int(st_reg_number[i]) * weights_first[i]

        rest_division = sum_total % divisor
        digit_first = rest_division

        if rest_division == 10:
            digit_first = 0

        num = 0
        mult = 10000000000
        for i in range(len(st_reg_number)-1):
            if i == 8:
                num = num + digit_first * mult
            else:
                num = num + int(st_reg_number[i]) * mult
            mult = mult/10

        if num < 10000000000:
            new_st = str('0') + str(num)
        else:
            new_st = str(num)

        sum_total = 0
        for i in range(len(new_st)):
            sum_total = sum_total + int(new_st[i]) * weights_secund[i]

        rest_division = sum_total % divisor
        digit_secund = rest_division

        if rest_division == 10:
            digit_secund = 0

        if digit_secund == verificador_two and digit_first == verificador_one:
            return True
        else:
            return False

    else:
        if st_reg_number[0] != "P":
            return False

        sum_total = 0
        for i in range(1, 9):
            sum_total = sum_total + int(st_reg_number[i]) * weights_first[i-1]

        digit = sum_total % divisor

        if digit == 10:
            digit = 0

        return digit == int(st_reg_number[len(st_reg_number)-4])
15845
def get_prtfmt(self, key="fmta"):
        """"""
        prtfmt = self.sortobj.grprobj.gosubdag.prt_attr[key]
        prtfmt = prtfmt.replace("{NS}", "{NS} {num_usrgos:>4} uGOs")
        return "".join(['{hdr1usr01:2}', prtfmt, '\n'])
303743
def human(value):
    ""
    if value >= 1073741824000:
        return '{:.1f} T'.format(value / 1099511627776.0)
    if value >= 1048576000:
        return '{:.1f} G'.format(value / 1073741824.0)
    if value >= 1024000:
        return '{:.1f} M'.format(value / 1048576.0)
    if value >= 1000:
        return '{:.1f} K'.format(value / 1024.0)
    return '{}   B'.format(value)
306958
def _displaystr2num(st):
    """"""
    num = None
    for s, n in [('DFP-', 16), ('TV-', 8), ('CRT-', 0)]:
        if st.startswith(s):
            try:
                curnum = int(st[len(s):])
                if 0 <= curnum <= 7:
                    num = n + curnum
                    break
            except Exception:
                pass
    if num is not None:
        return num
    else:
        raise ValueError('Unrecognised display name: ' + st)
700834
def visit_num(self, node, parent):
        """"""
        return nodes.Const(
            node.n,
            getattr(node, "lineno", None),
            getattr(node, "col_offset", None),
            parent,
        )
1045908
def get_number_unit(number):
    """"""
    n = str(float(number))
    mult, submult = n.split('.')
    if float(submult) != 0:
        unit = '0.' + (len(submult)-1)*'0' + '1'
        return float(unit)
    else:
        return float(1)
1262983
def numberp(v):
    """"""
    return (not(isinstance(v, bool)) and
            (isinstance(v, int) or isinstance(v, float)))
343522
def number(self, p_todo):
        
        if config().identifiers() == "text":
            return self.uid(p_todo)
        else:
            return self.linenumber(p_todo)
1269942
def group_to_gid(group):
    '''
    
    '''
    if group is None:
        return ''
    try:
        if isinstance(group, int):
            return group
        return grp.getgrnam(group).gr_gid
    except KeyError:
        return ''
651880
function getMagnitude(num) {
	return math.pow(10, mathFloor(math.log(num) / math.LN10));
}
758371
protected function gerarNossoNumero()
    {
        $numero_boleto = $this->getNumero();
        return Util::numberFormatGeral($numero_boleto, 12)
            . CalculoDV::santanderNossoNumero($numero_boleto);
    }
1042972
def get(self):
        """"""
        ret = sparklines(self.percents)[0]
        if self.__with_text:
            percents_without_none = [x for x in self.percents if x is not None]
            if len(percents_without_none) > 0:
                ret = '{}{:5.1f}%'.format(ret, percents_without_none[-1])
        return nativestr(ret)
760419
def gid_to_group(gid):
    '''
    
    '''
    try:
        gid = int(gid)
    except ValueError:
        # This is not an integer, maybe it's already the group name?
        gid = group_to_gid(gid)

    if gid == '':
        # Don't even bother to feed it to grp
        return ''

    try:
        return grp.getgrgid(gid).gr_name
    except (KeyError, NameError):
        # If group is not present, fall back to the gid.
        return gid
1175795
def as_int(width, height):
    ""
    gcd = get_gcd(width, height)
    return int(width / gcd), int(height / gcd)
1061768
def _get_sortgo(self):
        """"""
        if 'sortgo' in self.datobj.kws:
            return self.datobj.kws['sortgo']
        return self.datobj.grprdflt.gosubdag.prt_attr['sort'] + "\n"