From 86c3768e4ee73c3a82736b4444929908e0249f2b Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 24 Aug 2014 19:19:12 +0400 Subject: [PATCH] Move with_docstring function to powerline.segments --- powerline/lib/threaded.py | 5 ----- powerline/segments/__init__.py | 7 ++++++- powerline/segments/common.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/powerline/lib/threaded.py b/powerline/lib/threaded.py index acb258c3..e4f2f0a4 100644 --- a/powerline/lib/threaded.py +++ b/powerline/lib/threaded.py @@ -256,8 +256,3 @@ class KwThreadedSegment(ThreadedSegment): @staticmethod def render_one(update_state, **kwargs): return update_state - - -def with_docstring(instance, doc): - instance.__doc__ = doc - return instance diff --git a/powerline/segments/__init__.py b/powerline/segments/__init__.py index 8199b3cc..0a33bdbc 100644 --- a/powerline/segments/__init__.py +++ b/powerline/segments/__init__.py @@ -40,7 +40,7 @@ class Segment(object): '''List arguments which should be omitted Returns a tuple with indexes of omitted arguments. - + .. note::``segment_info``, ``create_watcher`` and ``pl`` will be omitted regardless of the below return (for ``segment_info`` and ``create_watcher``: only if object was marked to require segment @@ -56,3 +56,8 @@ class Segment(object): '''Returns a list of (additional argument name[, default value]) tuples. ''' return () + + +def with_docstring(instance, doc): + instance.__doc__ = doc + return instance diff --git a/powerline/segments/common.py b/powerline/segments/common.py index 72f0cce0..e10108a4 100644 --- a/powerline/segments/common.py +++ b/powerline/segments/common.py @@ -15,12 +15,12 @@ from powerline.lib import add_divider_highlight_group from powerline.lib.shell import asrun, run_cmd from powerline.lib.url import urllib_read, urllib_urlencode from powerline.lib.vcs import guess, tree_status -from powerline.lib.threaded import ThreadedSegment, KwThreadedSegment, with_docstring +from powerline.lib.threaded import ThreadedSegment, KwThreadedSegment from powerline.lib.monotonic import monotonic from powerline.lib.humanize_bytes import humanize_bytes from powerline.lib.unicode import u from powerline.theme import requires_segment_info, requires_filesystem_watcher -from powerline.segments import Segment +from powerline.segments import Segment, with_docstring from collections import namedtuple