from ..scripts import Humon, Scripted
#=============================================================================

def Dbytes(sizes, second=Scripted.DATA01):
    if not sizes:
        return Scripted.DATA09 + second
    if not str(sizes).isdigit():
        return Scripted.DATA09 + second
    nomos = 0
    moweo = 1024
    sizes = int(sizes)
    POWER = Humon.DATA01
    while sizes > moweo:
        sizes /= moweo
        nomos += 1
    return str(round(sizes, 2)) + Scripted.DATA02 + POWER[nomos] + second

#=============================================================================

def Hbytes(sizes, second=Scripted.DATA01):
    if not sizes:
        return Scripted.DATA08 + second
    if not str(sizes).isdigit():
        return Scripted.DATA08 + second
    nomos = 0
    moweo = 1024
    sizes = int(sizes)
    POWER = Humon.DATA02
    while sizes > moweo:
        sizes /= moweo
        nomos += 1
    return str(round(sizes, 2)) + Scripted.DATA02 + POWER[nomos] + second

#=============================================================================

def Gbytes(sizes, second=Scripted.DATA01):
    if not sizes:
        return Scripted.DATA01 + second
    if not str(sizes).isdigit():
        return Scripted.DATA01 + second
    nomos = 0
    moweo = 1024
    sizes = int(sizes)
    POWER = Humon.DATA01
    while sizes > moweo:
        sizes /= moweo
        nomos += 1
    return str(round(sizes, 2)) + Scripted.DATA02 + POWER[nomos] + second

#=============================================================================
