From 80a979898118cb7f1f0e8648df18ef5395edde9c Mon Sep 17 00:00:00 2001 From: laerus Date: Fri, 29 Jul 2016 19:42:00 +0300 Subject: [PATCH] cleanup --- xonsh/history.py | 8 ++++---- xonsh/tools.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xonsh/history.py b/xonsh/history.py index 54a91af48..71211f0ae 100644 --- a/xonsh/history.py +++ b/xonsh/history.py @@ -426,7 +426,7 @@ def _hist_filter_ts(commands, start_time=None, end_time=None): if end_time is None: end_time = float('inf') for cmd in commands: - if end_time > cmd[1] > start_time: + if start_time <= cmd[1] < end_time: yield cmd @@ -447,7 +447,7 @@ def _hist_get(session='session', slices=None, Returns ------- - list + generator A filtered list of commands """ cmds = _hist_get_session(session, location) @@ -462,14 +462,14 @@ def _hist_show(ns, *args, **kwargs): """Show the requested portion of shell history. Accepts same parameters with `_hist_get`.""" try: - commands = _hist_get(ns.session, ns.slices, **kwargs) + commands = list(_hist_get(ns.session, ns.slices, **kwargs)) except ValueError as err: print("history: error: {}".format(err), file=sys.stderr) return if not commands: return if ns.reverse: - commands = reversed(list(commands)) + commands = reversed(commands) if not ns.numerate: for c, _, _ in commands: print(c) diff --git a/xonsh/tools.py b/xonsh/tools.py index 4f2781c77..c9daa188e 100644 --- a/xonsh/tools.py +++ b/xonsh/tools.py @@ -926,7 +926,7 @@ def SLICE_REG(): def ensure_slice(x): - """Convert `x` to a slice. If `x` is already a slice object return as is.""" + """Try to convert an object into a slice, complain on failure""" if not x: return slice(None) elif isinstance(x, slice):