def fold_arg_vars(typevars, args, vararg, kws):
 n_pos_args = len(args)
 kwds = [kw for (kw, var) in kws]
 argtypes = [typevars[a.name] for a in args]
 argtypes += [typevars[var.name] for (kw, var) in kws]
 if (vararg is not None):
  argtypes.append(typevars[vararg.name])
 if (not all((a.defined for a in argtypes))):
  return
 args = tuple((a.getone() for a in argtypes))
 pos_args = args[:n_pos_args]
 if (vararg is not None):
  if (not isinstance(args[(-1)], types.BaseTuple)):
   raise TypeError(('*args in function call should be a tuple, got %s' % (args[(-1)],)))
  pos_args += args[(-1)].types
  args = args[:(-1)]
 kw_args = dict(zip(kwds, args[n_pos_args:]))
 return (pos_args, kw_args)

def fold_arg_vars ( typevars , args , vararg , kws ) : n_pos_args = len ( args ) kwds = [ kw for ( kw , var ) in kws ] argtypes = [ typevars [ a . name ] for a in args ] argtypes += [ typevars [ var . name ] for ( kw , var ) in kws ] if ( vararg is not None ) : argtypes . append ( typevars [ vararg . name ] ) if ( not all ( ( a . defined for a in argtypes ) ) ) : return args = tuple ( ( a . getone ( ) for a in argtypes ) ) pos_args = args [ : n_pos_args ] if ( vararg is not None ) : if ( not isinstance ( args [ ( - 1 ) ] , types . BaseTuple ) ) : raise TypeError ( ( '*args in function call should be a tuple, got %s' % ( args [ ( - 1 ) ] , ) ) ) pos_args += args [ ( - 1 ) ] . types args = args [ : ( - 1 ) ] kw_args = dict ( zip ( kwds , args [ n_pos_args : ] ) ) return ( pos_args , kw_args )
fold and resolve the argument variables of a function call .