예제 #1
0
파일: stdlib.py 프로젝트: yaoshaojun/pyhp
def array_range(interpreter, space, args):
    start = args[0].get_value()
    finish = args[1].get_value()
    assert(isint(start))
    assert(isint(finish))
    array = [space.wrap(number) for number
             in range(start.get_int(), finish.get_int()+1)]
    return space.wrap(array)
예제 #2
0
파일: stdlib.py 프로젝트: fetus-hina/pyhp
def array_range(args):
    start = args[0]
    finish = args[1]
    assert(isint(start))
    assert(isint(finish))
    array = W_Array()
    i = 0
    for number in range(start.get_int(), finish.get_int()+1):
        array.put(W_IntObject(i), W_IntObject(number))
        i += 1
    return array
예제 #3
0
파일: stdlib.py 프로젝트: codewizz/pyhp
def array_range(space, args):
    start = args[0].get_value()
    finish = args[1].get_value()
    assert(isint(start))
    assert(isint(finish))
    array = W_Array()
    i = 0
    for number in range(start.get_int(), finish.get_int()+1):
        array.put(newint(i), newint(number))
        i += 1
    return array
예제 #4
0
파일: stdlib.py 프로젝트: fetus-hina/pyhp
def str_repeat(args):
    string = args[0]
    repeat = args[1]
    assert(isstr(string))
    assert(isint(repeat))
    repeated = string.str() * repeat.get_int()
    return W_StringObject(repeated)
예제 #5
0
파일: stdlib.py 프로젝트: yaoshaojun/pyhp
def str_repeat(interpreter, space, args):
    string = args[0].get_value()
    repeat = args[1].get_value()
    assert(isstr(string))
    assert(isint(repeat))
    repeated = string.str() * repeat.get_int()
    return space.wrap(repeated)
예제 #6
0
파일: stdlib.py 프로젝트: codewizz/pyhp
def str_repeat(space, args):
    string = args[0].get_value()
    repeat = args[1].get_value()
    assert(isstr(string))
    assert(isint(repeat))
    repeated = string.str() * repeat.get_int()
    return newstring(repeated)
예제 #7
0
파일: stdlib.py 프로젝트: yaoshaojun/pyhp
def number_format(interpreter, space, args):
    number = args[0].get_value()
    assert(isfloat(number))
    positions = args[1].get_value()
    assert(isint(positions))

    number = number.to_number()
    positions = positions.get_int()

    return space.wrap(formatd(number, "f", positions))
예제 #8
0
파일: stdlib.py 프로젝트: fetus-hina/pyhp
def number_format(args):
    number = args[0]
    positions = args[1]
    assert(isint(positions))

    number = number.to_number()
    positions = positions.get_int()

    formatted = str(formatd(number, "f", positions))

    return W_StringObject(formatted)
예제 #9
0
파일: stdlib.py 프로젝트: codewizz/pyhp
def number_format(space, args):
    number = args[0].get_value()
    assert(isfloat(number))
    positions = args[1].get_value()
    assert(isint(positions))

    number = number.to_number()
    positions = positions.get_int()

    formatted = str(formatd(number, "f", positions))

    return newstring(formatted)
예제 #10
0
파일: stdlib.py 프로젝트: fetus-hina/pyhp
def dechex(args):
    number = args[0]
    assert(isint(number))
    return W_StringObject(hex(number.get_int()))
예제 #11
0
파일: stdlib.py 프로젝트: yaoshaojun/pyhp
def dechex(interpreter, space, args):
    number = args[0].get_value()
    assert(isint(number))
    return space.wrap(unicode(hex(number.get_int())))
예제 #12
0
파일: stdlib.py 프로젝트: codewizz/pyhp
def dechex(space, args):
    number = args[0].get_value()
    assert(isint(number))
    return newstring(hex(number.get_int()))