From dbd2f0ee06f21dfcf6b994139f42315fee080e36 Mon Sep 17 00:00:00 2001 From: qubesuser Date: Thu, 9 Nov 2017 17:05:14 +0100 Subject: [PATCH] remove format_doc and docutils import This wastes 100-200ms loading and removing markup every run and none of the strings contain any markup anyway... --- qubesadmin/tools/qvm_ls.py | 2 +- qubesadmin/utils.py | 25 ------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/qubesadmin/tools/qvm_ls.py b/qubesadmin/tools/qvm_ls.py index 6485554..e4f5c95 100644 --- a/qubesadmin/tools/qvm_ls.py +++ b/qubesadmin/tools/qvm_ls.py @@ -58,7 +58,7 @@ class Column(object): def __init__(self, head, attr=None, doc=None): self.ls_head = head - self.__doc__ = doc if doc is None else qubesadmin.utils.format_doc(doc) + self.__doc__ = doc # intentionally not always do set self._attr, # to cause AttributeError in self.format() diff --git a/qubesadmin/utils.py b/qubesadmin/utils.py index 41440c9..85109b7 100644 --- a/qubesadmin/utils.py +++ b/qubesadmin/utils.py @@ -27,34 +27,9 @@ import os import pkg_resources -import docutils -import docutils.core -import docutils.io import qubesadmin.exc -def format_doc(docstring): - '''Return parsed documentation string, stripping RST markup. - ''' - - if not docstring: - return '' - - # pylint: disable=unused-variable - output, pub = docutils.core.publish_programmatically( - source_class=docutils.io.StringInput, - source=' '.join(docstring.strip().split()), - source_path=None, - destination_class=docutils.io.NullOutput, destination=None, - destination_path=None, - reader=None, reader_name='standalone', - parser=None, parser_name='restructuredtext', - writer=None, writer_name='null', - settings=None, settings_spec=None, settings_overrides=None, - config_section=None, enable_exit_status=None) - return pub.writer.document.astext() - - def parse_size(size): '''Parse human readable size into bytes.''' units = [