From 22836da3dc060e49b3c1870c599a0ffb502123b2 Mon Sep 17 00:00:00 2001 From: Guillaume Leclerc Date: Thu, 19 May 2016 19:41:01 +0200 Subject: [PATCH] add docstring for dynamic_pwd methods --- xonsh/environ.py | 6 ++++++ xonsh/tools.py | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/xonsh/environ.py b/xonsh/environ.py index 72bf75812..ab05efac2 100644 --- a/xonsh/environ.py +++ b/xonsh/environ.py @@ -1025,6 +1025,12 @@ def _collapsed_pwd(): return leader + sep.join(base) def _dynamically_collapsed_pwd(): + """ + Return the compact current working directory + + It respects the environment variable DYNAMIC_CWD_WIDTH. + """ + sep = get_sep() originial_path = _replace_home_cwd() pwd = originial_path.split(sep) diff --git a/xonsh/tools.py b/xonsh/tools.py index 2885a38af..7c3029f39 100644 --- a/xonsh/tools.py +++ b/xonsh/tools.py @@ -738,12 +738,19 @@ def is_history_tuple(x): def is_dynamic_cwd_width(x): + """ + Determine if the input is a valid input for the DYNAMIC_CWD_WIDTH + environement variable + """ if x[-1] == '%': x = x[:-1] return x.isdigit() def to_dynamic_cwd_tuple(x): + """ + Convert to a canonical cwd_width tuple + """ unit = 'c' if x[-1] == '%': x = x[:-1] @@ -752,6 +759,9 @@ def to_dynamic_cwd_tuple(x): def dynamic_cwd_tuple_to_str(x): + """ + Convert a canonical cwd_width tuple to a string + """ if x[1] == '%': return str(x[0]) + '%' else: