Checking the inspector is always called with exactly args/kwargs
        Args: SinonSpy, args/kwargs
511369
def alwaysCalledWithExactly(cls, spy, *args, **kwargs): #pylint: disable=invalid-name
        
        cls.__is_spy(spy)
        if not (spy.alwaysCalledWithExactly(*args, **kwargs)):
            raise cls.failException(cls.message)
782091
def _has_method(arg, method):
    
    return hasattr(arg, method) and callable(getattr(arg, method))
33709
def satisfy_exact_match(self, args, kwargs):
        

        if self.args is None and self.kwargs is None:
            return False
        elif self.args is _any and self.kwargs is _any:
            return True
        elif args == self.args and kwargs == self.kwargs:
            return True
        elif len(args) != len(self.args) or len(kwargs) != len(self.kwargs):
            return False

        if not all(x == y or y == x for x, y in zip(args, self.args)):
            return False

        for key, value in self.kwargs.items():
            if key not in kwargs:
                return False
            elif not (kwargs[key] == value or value == kwargs[key]):
                return False

        return True
655898
def _check_toolplus(x):
    
    if "=" in x and len(x.split("=")) == 2:
        name, fname = x.split("=")
        fname = os.path.normpath(os.path.realpath(fname))
        if not os.path.exists(fname):
            raise argparse.ArgumentTypeError("Unexpected --toolplus argument for %s. File does not exist: %s"
                                             % (name, fname))
        return Tool(name, fname)
    else:
        raise argparse.ArgumentTypeError("Unexpected --toolplus argument. Expect toolname=filename.")
787035
def calledWithMatch(cls, spy, *args, **kwargs): #pylint: disable=invalid-name
        
        cls.__is_spy(spy)
        if not (spy.calledWithMatch(*args, **kwargs)):
            raise cls.failException(cls.message)
1142623
def _check_bool(result, func, args):  # pylint: disable=unused-argument
    

    if not result:
        raise ctypes.WinError(ctypes.get_last_error())
    return args
692910
def execInspectorDialog(self):
        
        dialog = OpenInspectorDialog(self.argosApplication.inspectorRegistry, parent=self)
        dialog.setCurrentInspectorRegItem(self.inspectorRegItem)
        dialog.exec_()
        if dialog.result():
            inspectorRegItem = dialog.getCurrentInspectorRegItem()
            if inspectorRegItem is not None:
                self.getInspectorActionById(inspectorRegItem.identifier).trigger()
412334
def callfunc(self, argv=None):
        
        if not self.checked:
            self.check_arguments()
            self.checked = True
        namespace = self.parentparser.parse_args(argv or sys.argv[1:])
        return self.func(**vars(namespace))
866253
def with_args(self, *args, **kwargs):
        

        self.args = args
        self.kwargs = kwargs
        self.verify_arguments()
        return self
683842
def _validate_func_args(func, kwargs):
    """"""

    args, varargs, varkw, defaults = inspect.getargspec(func)
    if set(kwargs.keys()) != set(args[1:]): # chop off self
        raise TypeError("decorator kwargs do not match %s()'s kwargs"
                        % func.__name__)
475206
def _has_argument(func):
    
    if hasattr(inspect, 'signature'):
        # New way in python 3.3
        sig = inspect.signature(func)
        return bool(sig.parameters)
    else:
        # Old way
        return bool(inspect.getargspec(func).args)
650088
def assert_valid_arguments(func, *args, **kwargs):
    
    # get the function argspec
    argspec = getargspec(func)

    func_defaults = argspec.defaults or tuple()
    defaults = (Required,) * (len(argspec.args) - len(func_defaults)) + func_defaults
    for index, arg_name in enumerate(argspec.args):
        arg_value = args[index] if index < len(args) else kwargs.get(arg_name)
        if arg_value is not None:
            continue
        if defaults[index] is not Required:
            continue
        abort("Missing required argument: {}".format(arg_name))
239076
def called_with(self, *args, **kwargs):
        
        expected_call = Call(*args, **kwargs)
        if expected_call in calls(self.spy):
            return True
        raise VerificationError(
            "expected %s to be called with %s, but it wasn't" % (
                self.spy, expected_call.formatted_args))
127349
def fn_available_argcount(callable):
    
    fn = get_fn_or_method(callable)
    if _inspect.isfunction(fn):
        return fn.__code__.co_argcount
    else: # method
        if fn.__self__ is None:
            return fn.__func__.__code__.co_argcount
        else:
            return fn.__func__.__code__.co_argcount - 1
730391
def takes_arg(obj, arg: str) -> bool:
    
    if inspect.isclass(obj):
        signature = inspect.signature(obj.__init__)
    elif inspect.ismethod(obj) or inspect.isfunction(obj):
        signature = inspect.signature(obj)
    else:
        raise ConfigurationError(f"object {obj} is not callable")
    return arg in signature.parameters
103414
def _pulse_method_call(pulse_op, func=None, index_arg=True):
		''''''
		def _wrapper(self, *args, **kws):
			if index_arg:
				if 'index' in kws: index = kws.pop('index')
				else: index, args = args[0], args[1:]
			pulse_args = func(*args, **kws) if func else list()
			if not is_list(pulse_args): pulse_args = [pulse_args]
			if index_arg: pulse_args = [index] + list(pulse_args)
			with self._pulse_op_cb() as cb:
				try: pulse_op(self._ctx, *(list(pulse_args) + [cb, None]))
				except c.ArgumentError as err: raise TypeError(err.args)
				except c.pa.CallError as err: raise PulseOperationInvalid(err.args[-1])
		func_args = list(inspect.getargspec(func or (lambda: None)))
		func_args[0] = list(func_args[0])
		if index_arg: func_args[0] = ['index'] + func_args[0]
		_wrapper.__name__ = '...'
		_wrapper.__doc__ = 'Signature: func' + inspect.formatargspec(*func_args)
		if func.__doc__: _wrapper.__doc__ += '\n\n' + func.__doc__
		return _wrapper
1045009
def is_invalid_params_py3(func, *args, **kwargs):
    
    signature = inspect.signature(func)
    parameters = signature.parameters

    unexpected = set(kwargs.keys()) - set(parameters.keys())
    if len(unexpected) > 0:
        return True

    params = [
        parameter for name, parameter in parameters.items()
        if name not in kwargs
    ]
    params_required = [
        param for param in params
        if param.default is param.empty
    ]

    return not (len(params_required) <= len(args) <= len(params))