MCPcopy Create free account
hub / github.com/ipython/ipython / LazyEvaluate

Class LazyEvaluate

IPython/core/prompts.py:5–21  ·  view source on GitHub ↗

This is used for formatting strings with values that need to be updated at that time, such as the current time or working directory.

Source from the content-addressed store, hash-verified

3"""
4
5class LazyEvaluate(object):
6 """This is used for formatting strings with values that need to be updated
7 at that time, such as the current time or working directory."""
8 def __init__(self, func, *args, **kwargs):
9 self.func = func
10 self.args = args
11 self.kwargs = kwargs
12
13 def __call__(self, **kwargs):
14 self.kwargs.update(kwargs)
15 return self.func(*self.args, **self.kwargs)
16
17 def __str__(self):
18 return str(self())
19
20 def __format__(self, format_spec):
21 return format(self(), format_spec)

Callers 3

test_lazy_eval_floatMethod · 0.90

Calls

no outgoing calls

Tested by 3

test_lazy_eval_floatMethod · 0.72