当前位置: 首页>>代码示例>>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;未经允许,请勿转载。