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...
This commit is contained in:
qubesuser 2017-11-09 17:05:14 +01:00
parent da327d7abd
commit dbd2f0ee06
2 changed files with 1 additions and 26 deletions

View File

@ -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()

View File

@ -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 = [