Переглянути джерело

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...
qubesuser 7 роки тому
батько
коміт
dbd2f0ee06
2 змінених файлів з 1 додано та 26 видалено
  1. 1 1
      qubesadmin/tools/qvm_ls.py
  2. 0 25
      qubesadmin/utils.py

+ 1 - 1
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()

+ 0 - 25
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 = [