def test_callable_args(func, args):
 assert isinstance(args, (list, tuple))
 signature = getattr(inspect, u'signature', None)
 if (signature is not None):
  try:
   sig = _signatures_cache[func]
  except KeyError:
   sig = signature(func)
   _signatures_cache[func] = sig
  try:
   sig.bind(*args)
  except TypeError:
   return False
  else:
   return True
 else:
  spec = inspect.getargspec(func)
  def drop_self(spec):
   (args, varargs, varkw, defaults) = spec
   if (args[0:1] == [u'self']):
    args = args[1:]
   return inspect.ArgSpec(args, varargs, varkw, defaults)
  spec = drop_self(spec)
  if (spec.varargs is not None):
   return True
  return ((len(spec.args) - len((spec.defaults or []))) <= len(args) <= len(spec.args))

def test_callable_args ( func , args ) : assert isinstance ( args , ( list , tuple ) ) signature = getattr ( inspect , u'signature' , None ) if ( signature is not None ) : try : sig = _signatures_cache [ func ] except KeyError : sig = signature ( func ) _signatures_cache [ func ] = sig try : sig . bind ( * args ) except TypeError : return False else : return True else : spec = inspect . getargspec ( func ) def drop_self ( spec ) : ( args , varargs , varkw , defaults ) = spec if ( args [ 0 : 1 ] == [ u'self' ] ) : args = args [ 1 : ] return inspect . ArgSpec ( args , varargs , varkw , defaults ) spec = drop_self ( spec ) if ( spec . varargs is not None ) : return True return ( ( len ( spec . args ) - len ( ( spec . defaults or [ ] ) ) ) <= len ( args ) <= len ( spec . args ) )
return true when this function can be called with the given arguments .