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:
parent
da327d7abd
commit
dbd2f0ee06
@ -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()
|
||||
|
@ -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 = [
|
||||
|
Loading…
Reference in New Issue
Block a user