Returns a gas estimate for the function with the given arguments or
        None if the function call will fail due to Insufficient funds or
        the logic in the called function.
540861
def estimate_gas(
            self,
            block_identifier,
            function: str,
            *args,
            **kwargs,
    ) -> typing.Optional[int]:
        """"""
        fn = getattr(self.contract.functions, function)
        address = to_checksum_address(self.jsonrpc_client.address)
        if self.jsonrpc_client.eth_node is constants.EthClient.GETH:
            # Unfortunately geth does not follow the ethereum JSON-RPC spec and
            # does not accept a block identifier argument for eth_estimateGas
            # parity and py-evm (trinity) do.
            #
            # Geth only runs estimateGas on the pending block and that's why we
            # should also enforce parity, py-evm and others to do the same since
            # we can't customize geth.
            #
            # Spec: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas
            # Geth Issue: https://github.com/ethereum/go-ethereum/issues/2586
            # Relevant web3 PR: https://github.com/ethereum/web3.py/pull/1046
            block_identifier = None
        try:
            return fn(*args, **kwargs).estimateGas(
                transaction={'from': address},
                block_identifier=block_identifier,
            )
        except ValueError as err:
            action = inspect_client_error(err, self.jsonrpc_client.eth_node)
            will_fail = action in (
                ClientErrorInspectResult.INSUFFICIENT_FUNDS,
                ClientErrorInspectResult.ALWAYS_FAIL,
            )
            if will_fail:
                return None

            raise err
603393
def patched_contractfunction_estimateGas(self, transaction=None, block_identifier=None):
    """"""
    if transaction is None:
        estimate_gas_transaction = {}
    else:
        estimate_gas_transaction = dict(**transaction)

    if 'data' in estimate_gas_transaction:
        raise ValueError('Cannot set data in estimateGas transaction')
    if 'to' in estimate_gas_transaction:
        raise ValueError('Cannot set to in estimateGas transaction')

    if self.address:
        estimate_gas_transaction.setdefault('to', self.address)
    if self.web3.eth.defaultAccount is not empty:
        estimate_gas_transaction.setdefault('from', self.web3.eth.defaultAccount)

    if 'to' not in estimate_gas_transaction:
        if isinstance(self, type):
            raise ValueError(
                'When using `Contract.estimateGas` from a contract factory '
                'you must provide a `to` address with the transaction',
            )
        else:
            raise ValueError(
                'Please ensure that this contract instance has an address.',
            )

    return estimate_gas_for_function(
        self.address,
        self.web3,
        self.function_identifier,
        estimate_gas_transaction,
        self.contract_abi,
        self.abi,
        block_identifier,
        *self.args,
        **self.kwargs,
    )
738822
function estimateGas(provider, txParams, cb) {
  provider.sendAsync(createPayload({
    method: 'eth_estimateGas',
    params: [txParams]
  }), function(err, res){
    if (err) {
      // handle simple value transfer case
      if (err.message === 'no contract code at given address') {
        return cb(null, '0xcf08')
      } else {
        return cb(err)        
      }
    }
    cb(null, res.result)
  })
}
11581
def func(self, p):
        
        self._set_stochastics(p)
        try:
            return -1. * self.logp
        except ZeroProbability:
            return Inf
1125500
def func(nargs: Optional[int] = None, nouts: Optional[int] = None, ndefs: Optional[int] = None):
    
    return lambda f: wraps(f)(WrappedFunction(f, nargs=nargs, nouts=nouts, ndefs=ndefs))
519896
def _evaluate_f(self, n, xdata, p=None):
        
        # by default, use the fit values, otherwise, use the guess values.
        if   p is None and self.results is not None: p = self.results[0]
        elif p is None and self.results is None:     p = self._pguess

        # assemble the arguments for the function
        args = (xdata,) + tuple(p)

        # evaluate this function.
        return self.f[n](*args)
934463
def low(self, fun, low):
        '''
        
        '''
        l_fun = getattr(self, fun)
        f_call = salt.utils.args.format_call(l_fun, low)
        return l_fun(*f_call.get('args', ()), **f_call.get('kwargs', {}))
468367
def arguments(self):
        
        if not self.is_function:
            raise ValueError('expected function value, got %s' % (self._kind,))
        it = ffi.lib.LLVMPY_FunctionArgumentsIter(self)
        parents = self._parents.copy()
        parents.update(function=self)
        return _ArgumentsIterator(it, parents)
1374683
def _call(self, x):
        """"""

        sum_constr = abs(x.ufuncs.sum() / self.diameter - 1) <= self.sum_rtol

        nonneq_constr = x.ufuncs.greater_equal(0).asarray().all()

        if sum_constr and nonneq_constr:
            return 0
        else:
            return np.inf
786441
def plot(self, **kwargs):
        
        set_kwargs_drawstyle(kwargs, "default")
        return _plot_estimate(
            self, estimate=getattr(self, self._estimate_name), confidence_intervals=self.confidence_interval_, **kwargs
        )
1369743
def fn_minimum_argcount(callable):
    """"""
    fn = get_fn(callable)
    available_argcount = fn_available_argcount(callable)
    try:
        return available_argcount - len(fn.__defaults__)
    except TypeError:
        return available_argcount
1142623
def _check_bool(result, func, args):  # pylint: disable=unused-argument
    

    if not result:
        raise ctypes.WinError(ctypes.get_last_error())
    return args
38666
def pass_none(func):
	
	@functools.wraps(func)
	def wrapper(param, *args, **kwargs):
		if param is not None:
			return func(param, *args, **kwargs)
	return wrapper
461714
def infer_argument(self, funcnode, name, context):
        
        if name in self.duplicated_keywords:
            raise exceptions.InferenceError(
                "The arguments passed to {func!r} " " have duplicate keywords.",
                call_site=self,
                func=funcnode,
                arg=name,
                context=context,
            )

        # Look into the keywords first, maybe it's already there.
        try:
            return self.keyword_arguments[name].infer(context)
        except KeyError:
            pass

        # Too many arguments given and no variable arguments.
        if len(self.positional_arguments) > len(funcnode.args.args):
            if not funcnode.args.vararg:
                raise exceptions.InferenceError(
                    "Too many positional arguments "
                    "passed to {func!r} that does "
                    "not have *args.",
                    call_site=self,
                    func=funcnode,
                    arg=name,
                    context=context,
                )

        positional = self.positional_arguments[: len(funcnode.args.args)]
        vararg = self.positional_arguments[len(funcnode.args.args) :]
        argindex = funcnode.args.find_argname(name)[0]
        kwonlyargs = {arg.name for arg in funcnode.args.kwonlyargs}
        kwargs = {
            key: value
            for key, value in self.keyword_arguments.items()
            if key not in kwonlyargs
        }
        # If there are too few positionals compared to
        # what the function expects to receive, check to see
        # if the missing positional arguments were passed
        # as keyword arguments and if so, place them into the
        # positional args list.
        if len(positional) < len(funcnode.args.args):
            for func_arg in funcnode.args.args:
                if func_arg.name in kwargs:
                    arg = kwargs.pop(func_arg.name)
                    positional.append(arg)

        if argindex is not None:
            # 2. first argument of instance/class method
            if argindex == 0 and funcnode.type in ("method", "classmethod"):
                if context.boundnode is not None:
                    boundnode = context.boundnode
                else:
                    # XXX can do better ?
                    boundnode = funcnode.parent.frame()

                if isinstance(boundnode, nodes.ClassDef):
                    # Verify that we're accessing a method
                    # of the metaclass through a class, as in
                    # `cls.metaclass_method`. In this case, the
                    # first argument is always the class.
                    method_scope = funcnode.parent.scope()
                    if method_scope is boundnode.metaclass():
                        return iter((boundnode,))

                if funcnode.type == "method":
                    if not isinstance(boundnode, bases.Instance):
                        boundnode = bases.Instance(boundnode)
                    return iter((boundnode,))
                if funcnode.type == "classmethod":
                    return iter((boundnode,))
            # if we have a method, extract one position
            # from the index, so we'll take in account
            # the extra parameter represented by `self` or `cls`
            if funcnode.type in ("method", "classmethod"):
                argindex -= 1
            # 2. search arg index
            try:
                return self.positional_arguments[argindex].infer(context)
            except IndexError:
                pass

        if funcnode.args.kwarg == name:
            # It wants all the keywords that were passed into
            # the call site.
            if self.has_invalid_keywords():
                raise exceptions.InferenceError(
                    "Inference failed to find values for all keyword arguments "
                    "to {func!r}: {unpacked_kwargs!r} doesn't correspond to "
                    "{keyword_arguments!r}.",
                    keyword_arguments=self.keyword_arguments,
                    unpacked_kwargs=self._unpacked_kwargs,
                    call_site=self,
                    func=funcnode,
                    arg=name,
                    context=context,
                )
            kwarg = nodes.Dict(
                lineno=funcnode.args.lineno,
                col_offset=funcnode.args.col_offset,
                parent=funcnode.args,
            )
            kwarg.postinit(
                [(nodes.const_factory(key), value) for key, value in kwargs.items()]
            )
            return iter((kwarg,))
        if funcnode.args.vararg == name:
            # It wants all the args that were passed into
            # the call site.
            if self.has_invalid_arguments():
                raise exceptions.InferenceError(
                    "Inference failed to find values for all positional "
                    "arguments to {func!r}: {unpacked_args!r} doesn't "
                    "correspond to {positional_arguments!r}.",
                    positional_arguments=self.positional_arguments,
                    unpacked_args=self._unpacked_args,
                    call_site=self,
                    func=funcnode,
                    arg=name,
                    context=context,
                )
            args = nodes.Tuple(
                lineno=funcnode.args.lineno,
                col_offset=funcnode.args.col_offset,
                parent=funcnode.args,
            )
            args.postinit(vararg)
            return iter((args,))

        # Check if it's a default parameter.
        try:
            return funcnode.args.default_value(name).infer(context)
        except exceptions.NoDefault:
            pass
        raise exceptions.InferenceError(
            "No value found for argument {name} to " "{func!r}",
            call_site=self,
            func=funcnode,
            arg=name,
            context=context,
        )
810959
def aggregate(self, dimensions=None, function=None, spreadfn=None, **kwargs):
        
        kwargs['_method_args'] = (dimensions, function, spreadfn)
        return self.__call__('aggregate', **kwargs)
1356865
def callable_check(func, arg_count=1, arg_value=None, allow_none=False):
        """"""
        if func is None:
            if not allow_none:
                raise ValueError('callable cannot be None')
        elif not arg_checker(func, *[arg_value for _ in range(arg_count)]):
            raise ValueError('callable %s invalid (for %d arguments)' % (func, arg_count))
115440
def sd(self):
        ''''''
        v = self.var()
        if len(v):
            return np.sqrt(v)
        else:
            return None