MCPcopy Create free account
hub / github.com/EasyIME/PIME / replace

Method replace

python/python3/tornado/util.py:399–420  ·  view source on GitHub ↗

Replace the named argument in ``args, kwargs`` with ``new_value``. Returns ``(old_value, args, kwargs)``. The returned ``args`` and ``kwargs`` objects may not be the same as the input objects, or the input objects may be mutated. If the named argument was not found

(
        self, new_value: Any, args: Sequence[Any], kwargs: Dict[str, Any]
    )

Source from the content-addressed store, hash-verified

397 return kwargs.get(self.name, default)
398
399 def replace(
400 self, new_value: Any, args: Sequence[Any], kwargs: Dict[str, Any]
401 ) -> Tuple[Any, Sequence[Any], Dict[str, Any]]:
402 """Replace the named argument in ``args, kwargs`` with ``new_value``.
403
404 Returns ``(old_value, args, kwargs)``. The returned ``args`` and
405 ``kwargs`` objects may not be the same as the input objects, or
406 the input objects may be mutated.
407
408 If the named argument was not found, ``new_value`` will be added
409 to ``kwargs`` and None will be returned as ``old_value``.
410 """
411 if self.arg_pos is not None and len(args) > self.arg_pos:
412 # The arg to replace is passed positionally
413 old_value = args[self.arg_pos]
414 args = list(args) # *args is normally a tuple
415 args[self.arg_pos] = new_value
416 else:
417 # The arg to replace is either omitted or passed by keyword.
418 old_value = kwargs.get(self.name)
419 kwargs[self.name] = new_value
420 return old_value, args, kwargs
421
422
423def timedelta_to_seconds(td):

Callers 15

loadFromJsonMethod · 0.80
getWildcardCharDefsMethod · 0.80
to_friendly_hzFunction · 0.80
to_raw_hzFunction · 0.80
iFunction · 0.80
bootstrap.jsFile · 0.80
clickHandlerFunction · 0.80
getTargetFromTriggerFunction · 0.80
getParentFunction · 0.80
bootstrap.min.jsFile · 0.80
eFunction · 0.80
bFunction · 0.80

Calls 2

listFunction · 0.85
getMethod · 0.45

Tested by 15

test_omittedMethod · 0.64
test_positionMethod · 0.64
test_keywordMethod · 0.64
accept_callbackMethod · 0.64
test_non_ssl_requestMethod · 0.64
test_error_loggingMethod · 0.64
getMethod · 0.64
test_host_headerMethod · 0.64