當前位置: 首頁>>代碼示例>>Python>>正文


Python statemachine.ViewList方法代碼示例

本文整理匯總了Python中docutils.statemachine.ViewList方法的典型用法代碼示例。如果您正苦於以下問題:Python statemachine.ViewList方法的具體用法?Python statemachine.ViewList怎麽用?Python statemachine.ViewList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在docutils.statemachine的用法示例。


在下文中一共展示了statemachine.ViewList方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: wrap_mangling_directive

# 需要導入模塊: from docutils import statemachine [as 別名]
# 或者: from docutils.statemachine import ViewList [as 別名]
def wrap_mangling_directive(base_directive, objtype):
    class directive(base_directive):
        def run(self):
            env = self.state.document.settings.env

            name = None
            if self.arguments:
                m = re.match(r'^(.*\s+)?(.*?)(\(.*)?', self.arguments[0])
                name = m.group(2).strip()

            if not name:
                name = self.arguments[0]

            lines = list(self.content)
            mangle_docstrings(env.app, objtype, name, None, None, lines)
            # local import to avoid testing dependency
            from docutils.statemachine import ViewList
            self.content = ViewList(lines, self.content.parent)

            return base_directive.run(self)

    return directive 
開發者ID:tgsmith61591,項目名稱:skutil,代碼行數:24,代碼來源:numpydoc.py

示例2: wrap_mangling_directive

# 需要導入模塊: from docutils import statemachine [as 別名]
# 或者: from docutils.statemachine import ViewList [as 別名]
def wrap_mangling_directive(base_directive, objtype):
    class directive(base_directive):
        def run(self):
            env = self.state.document.settings.env

            name = None
            if self.arguments:
                m = re.match(r'^(.*\s+)?(.*?)(\(.*)?', self.arguments[0])
                name = m.group(2).strip()

            if not name:
                name = self.arguments[0]

            lines = list(self.content)
            mangle_docstrings(env.app, objtype, name, None, None, lines)
            self.content = ViewList(lines, self.content.parent)

            return base_directive.run(self)

    return directive 
開發者ID:jakevdp,項目名稱:supersmoother,代碼行數:22,代碼來源:numpydoc.py

示例3: run

# 需要導入模塊: from docutils import statemachine [as 別名]
# 或者: from docutils.statemachine import ViewList [as 別名]
def run(self):
        module = self.options.get("module")
        attr = self.options.get("attr")
        parser = get_parser(module, attr)

        self._available_options = []
        for group in parser.groups:
            for arg in group.arguments:
                self._available_options += arg.args

        node = nodes.section()
        node.document = self.state.document
        result = ViewList()
        for line in self.generate_parser_rst(parser):
            result.append(line, "argparse")

        nested_parse_with_titles(self.state, result, node)
        return node.children 
開發者ID:streamlink,項目名稱:streamlink,代碼行數:20,代碼來源:ext_argparse.py

示例4: _generate_app_node

# 需要導入模塊: from docutils import statemachine [as 別名]
# 或者: from docutils.statemachine import ViewList [as 別名]
def _generate_app_node(self, app, application_name):
        ignored_opts = self._get_ignored_opts()

        parser = app.parser

        self._drop_ignored_options(parser, ignored_opts)

        parser.prog = application_name

        source_name = '<{}>'.format(app.__class__.__name__)
        result = statemachine.ViewList()
        for line in _format_parser(parser):
            result.append(line, source_name)

        section = nodes.section()
        self.state.nested_parse(result, 0, section)

        # return [section.children]
        return section.children 
開發者ID:openstack,項目名稱:cliff,代碼行數:21,代碼來源:sphinxext.py

示例5: run

# 需要導入模塊: from docutils import statemachine [as 別名]
# 或者: from docutils.statemachine import ViewList [as 別名]
def run(self):
        self.filenames = set()
        if self.arguments[0] == 'lexers':
            out = self.document_lexers()
        elif self.arguments[0] == 'formatters':
            out = self.document_formatters()
        elif self.arguments[0] == 'filters':
            out = self.document_filters()
        else:
            raise Exception('invalid argument for "pygmentsdoc" directive')
        node = nodes.compound()
        vl = ViewList(out.split('\n'), source='')
        nested_parse_with_titles(self.state, vl, node)
        for fn in self.filenames:
            self.state.document.settings.record_dependencies.add(fn)
        return node.children 
開發者ID:joxeankoret,項目名稱:pigaios,代碼行數:18,代碼來源:sphinxext.py

示例6: wrap_mangling_directive

# 需要導入模塊: from docutils import statemachine [as 別名]
# 或者: from docutils.statemachine import ViewList [as 別名]
def wrap_mangling_directive(base_directive, objtype):
    class directive(base_directive):

        def run(self):
            env = self.state.document.settings.env

            name = None
            if self.arguments:
                m = re.match(r'^(.*\s+)?(.*?)(\(.*)?', self.arguments[0])
                name = m.group(2).strip()

            if not name:
                name = self.arguments[0]

            lines = list(self.content)
            mangle_docstrings(env.app, objtype, name, None, None, lines)
            self.content = ViewList(lines, self.content.parent)

            return base_directive.run(self)

    return directive 
開發者ID:comp-imaging,項目名稱:ProxImaL,代碼行數:23,代碼來源:numpydoc.py

示例7: _create_row

# 需要導入模塊: from docutils import statemachine [as 別名]
# 或者: from docutils.statemachine import ViewList [as 別名]
def _create_row(self, *column_texts):
        row = nodes.row('')
        source, line = self.state_machine.get_source_and_line()
        for text_line in column_texts:
            node = nodes.paragraph('')
            vl = ViewList()
            for text in text_line.split('\n'):
                vl.append(text, '%s:%d' % (source, line))
            with switch_source_input(self.state, vl):
                self.state.nested_parse(vl, 0, node)
                try:
                    if isinstance(node[0], nodes.paragraph) and len(node.children) == 1:
                        node = node[0]
                except IndexError:
                    pass
                row.append(nodes.entry('', node))
        return row 
開發者ID:gardener,項目名稱:cc-utils,代碼行數:19,代碼來源:sphinxutil.py

示例8: run

# 需要導入模塊: from docutils import statemachine [as 別名]
# 或者: from docutils.statemachine import ViewList [as 別名]
def run(self):
        all_workbooks = get_workbooks()

        # Build the view of the data to be parsed for rendering.
        result = ViewList()
        for workbook_name in sorted(all_workbooks.keys()):
            workbook = all_workbooks[workbook_name]
            for line in _workbook_to_rst(workbook_name, workbook):
                result.append(line, '<' + __name__ + '>')

        # Parse what we have into a new section.
        node = nodes.section()
        node.document = self.state.document
        nested_parse_with_titles(self.state, result, node)

        return node.children 
開發者ID:openstack,項目名稱:tripleo-common,代碼行數:18,代碼來源:workbooks.py


注:本文中的docutils.statemachine.ViewList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。