Show More
@@ -1,26 +1,23 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Being removed |
|
2 | """Being removed | |
3 | """ |
|
3 | """ | |
4 |
|
4 | |||
5 | from IPython.utils import py3compat |
|
5 | from IPython.utils import py3compat | |
6 |
|
6 | |||
7 | class LazyEvaluate(object): |
|
7 | class LazyEvaluate(object): | |
8 | """This is used for formatting strings with values that need to be updated |
|
8 | """This is used for formatting strings with values that need to be updated | |
9 | at that time, such as the current time or working directory.""" |
|
9 | at that time, such as the current time or working directory.""" | |
10 | def __init__(self, func, *args, **kwargs): |
|
10 | def __init__(self, func, *args, **kwargs): | |
11 | self.func = func |
|
11 | self.func = func | |
12 | self.args = args |
|
12 | self.args = args | |
13 | self.kwargs = kwargs |
|
13 | self.kwargs = kwargs | |
14 |
|
14 | |||
15 | def __call__(self, **kwargs): |
|
15 | def __call__(self, **kwargs): | |
16 | self.kwargs.update(kwargs) |
|
16 | self.kwargs.update(kwargs) | |
17 | return self.func(*self.args, **self.kwargs) |
|
17 | return self.func(*self.args, **self.kwargs) | |
18 |
|
18 | |||
19 | def __str__(self): |
|
19 | def __str__(self): | |
20 | return str(self()) |
|
20 | return str(self()) | |
21 |
|
21 | |||
22 | def __unicode__(self): |
|
|||
23 | return self.__str__() |
|
|||
24 |
|
||||
25 | def __format__(self, format_spec): |
|
22 | def __format__(self, format_spec): | |
26 | return format(self(), format_spec) |
|
23 | return format(self(), format_spec) |
General Comments 0
You need to be logged in to leave comments.
Login now