prompts.py 605 B

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