mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
commit
51fcf4be85
3 changed files with 22 additions and 2 deletions
15
news/lazyobject-repr.rst
Normal file
15
news/lazyobject-repr.rst
Normal file
|
@ -0,0 +1,15 @@
|
|||
**Added:**
|
||||
|
||||
* ``__repr__`` and ``__str__`` magic method on LazyObject
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:**
|
||||
|
||||
* Unused imports in proc, flake8.
|
||||
|
||||
**Fixed:** None
|
||||
|
||||
**Security:** None
|
|
@ -116,6 +116,12 @@ class LazyObject(object):
|
|||
obj = self._lazy_obj()
|
||||
return obj | other
|
||||
|
||||
def __str__(self):
|
||||
return str(self._lazy_obj())
|
||||
|
||||
def __repr__(self):
|
||||
return repr(self._lazy_obj())
|
||||
|
||||
|
||||
def lazyobject(f):
|
||||
"""Decorator for constructing lazy objects from a function."""
|
||||
|
|
|
@ -15,7 +15,6 @@ import signal
|
|||
import builtins
|
||||
import functools
|
||||
import threading
|
||||
import importlib
|
||||
import subprocess
|
||||
import collections
|
||||
import collections.abc as abc
|
||||
|
@ -24,7 +23,7 @@ from xonsh.platform import ON_WINDOWS, ON_LINUX, ON_POSIX
|
|||
from xonsh.tools import (redirect_stdout, redirect_stderr, fallback,
|
||||
print_exception, XonshCalledProcessError)
|
||||
from xonsh.teepty import TeePTY
|
||||
from xonsh.lazyasd import LazyObject, lazyobject
|
||||
from xonsh.lazyasd import lazyobject
|
||||
|
||||
|
||||
# force some lazy imports so we don't have errors on non-windows platforms
|
||||
|
|
Loading…
Add table
Reference in a new issue