Exemplo n.º 1
0
 def CALL_FUNCTION(decompiler, argc, star=None, star2=None):
     pop = decompiler.stack.pop
     kwarg, posarg = divmod(argc, 256)
     args = []
     for i in xrange(kwarg):
         arg = pop()
         key = pop().value
         args.append(ast.Keyword(key, arg))
     for i in xrange(posarg): args.append(pop())
     args.reverse()
     return decompiler._call_function(args, star, star2)
Exemplo n.º 2
0
def isbn10_checksum(digits):
    if len(digits) != 9: raise ValueError()
    reminder = sum(
        digit * coef
        for digit, coef in izip(imap(int, digits), xrange(10, 1, -1))) % 11
    if reminder == 1: return 'X'
    return reminder and str(11 - reminder) or '0'
Exemplo n.º 3
0
def isbn10_checksum(digits):
    if len(digits) != 9:
        raise ValueError()
    reminder = sum(digit * coef for digit, coef in izip(imap(int, digits), xrange(10, 1, -1))) % 11
    if reminder == 1:
        return "X"
    return reminder and str(11 - reminder) or "0"
Exemplo n.º 4
0
 def CALL_FUNCTION(decompiler, argc, star=None, star2=None):
     pop = decompiler.stack.pop
     kwarg, posarg = divmod(argc, 256)
     args = []
     for i in xrange(kwarg):
         arg = pop()
         key = pop().value
         args.append(ast.Keyword(key, arg))
     for i in xrange(posarg): args.append(pop())
     args.reverse()
     tos = pop()
     if isinstance(tos, ast.GenExpr):
         assert len(args) == 1 and star is None and star2 is None
         genexpr = tos
         qual = genexpr.code.quals[0]
         assert isinstance(qual.iter, ast.Name)
         assert qual.iter.name in ('.0', '[outmost-iterable]')
         qual.iter = args[0]
         return genexpr
     else: return ast.CallFunc(tos, args, star, star2)
 def CALL_FUNCTION(decompiler, argc, star=None, star2=None):
     pop = decompiler.stack.pop
     kwarg, posarg = divmod(argc, 256)
     args = []
     for i in xrange(kwarg):
         arg = pop()
         key = pop().value
         args.append(ast.Keyword(key, arg))
     for i in xrange(posarg): args.append(pop())
     args.reverse()
     tos = pop()
     if isinstance(tos, ast.GenExpr):
         assert len(args) == 1 and star is None and star2 is None
         genexpr = tos
         qual = genexpr.code.quals[0]
         assert isinstance(qual.iter, ast.Name)
         assert qual.iter.name in ('.0', '[outmost-iterable]')
         qual.iter = args[0]
         return genexpr
     else: return ast.CallFunc(tos, args, star, star2)