当前位置: 首页>>代码示例>>Python>>正文


Python nodes.transition方法代码示例

本文整理汇总了Python中docutils.nodes.transition方法的典型用法代码示例。如果您正苦于以下问题:Python nodes.transition方法的具体用法?Python nodes.transition怎么用?Python nodes.transition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docutils.nodes的用法示例。


在下文中一共展示了nodes.transition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: line

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import transition [as 别名]
def line(self, match, context, next_state):
        """Section title overline or transition marker."""
        if self.state_machine.match_titles:
            return [match.string], 'Line', []
        elif match.string.strip() == '::':
            raise statemachine.TransitionCorrection('text')
        elif len(match.string.strip()) < 4:
            msg = self.reporter.info(
                'Unexpected possible title overline or transition.\n'
                "Treating it as ordinary text because it's so short.",
                line=self.state_machine.abs_line_number())
            self.parent += msg
            raise statemachine.TransitionCorrection('text')
        else:
            blocktext = self.state_machine.line
            msg = self.reporter.severe(
                  'Unexpected section title or transition.',
                  nodes.literal_block(blocktext, blocktext),
                  line=self.state_machine.abs_line_number())
            self.parent += msg
            return [], next_state, [] 
开发者ID:skarlekar,项目名称:faces,代码行数:23,代码来源:states.py

示例2: run

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import transition [as 别名]
def run(self):
        species = stdpopsim.get_species(self.arguments[0])
        sid = f"sec_catalog_{species.id}"
        species_target = self.get_target(sid)
        section = nodes.section(ids=[sid], names=[sid])
        section += nodes.title(text=species.name)
        section += self.species_summary(species)

        genome_section = nodes.section(ids=[f"sec_catalog_{species.id}_genome"])
        genome_section += nodes.title(text="Genome")
        genome_section += self.chromosomes_table(species)
        section += genome_section
        section += nodes.transition()

        maps_section = nodes.section(ids=[f"sec_catalog_{species.id}_genetic_maps"])
        maps_section += nodes.title(text="Genetic Maps")
        maps_section += self.genetic_maps_table(species)
        for gmap in species.genetic_maps:
            maps_section += self.genetic_map_section(species, gmap)
        section += maps_section
        section += nodes.transition()
        models_section = nodes.section(ids=[f"sec_catalog_{species.id}_models"])
        models_section += nodes.title(text="Models")
        models_section += self.models_table(species)
        for i, model in enumerate(species.demographic_models):
            models_section += self.model_section(species, model)
            if i < len(species.demographic_models) - 1:
                models_section += nodes.transition()
        section += models_section
        return [species_target, section] 
开发者ID:popsim-consortium,项目名称:stdpopsim,代码行数:32,代码来源:speciescatalog.py

示例3: apply

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import transition [as 别名]
def apply(self):
        for node in self.document.traverse(nodes.transition):
            self.visit_transition(node) 
开发者ID:skarlekar,项目名称:faces,代码行数:5,代码来源:misc.py

示例4: no_match

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import transition [as 别名]
def no_match(self, context, transitions):
        """
        Override `StateWS.no_match` to generate a system message.

        This code should never be run.
        """
        self.reporter.severe(
            'Internal error: no transition pattern match.  State: "%s"; '
            'transitions: %s; context: %s; current line: %r.'
            % (self.__class__.__name__, transitions, context,
               self.state_machine.line))
        return context, None, [] 
开发者ID:skarlekar,项目名称:faces,代码行数:14,代码来源:states.py

示例5: eof

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import transition [as 别名]
def eof(self, context):
        """Transition marker at end of section or document."""
        marker = context[0].strip()
        if self.memo.section_bubble_up_kludge:
            self.memo.section_bubble_up_kludge = False
        elif len(marker) < 4:
            self.state_correction(context)
        if self.eofcheck:               # ignore EOFError with sections
            lineno = self.state_machine.abs_line_number() - 1
            transition = nodes.transition(rawsource=context[0])
            transition.line = lineno
            self.parent += transition
        self.eofcheck = 1
        return [] 
开发者ID:skarlekar,项目名称:faces,代码行数:16,代码来源:states.py

示例6: underline

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import transition [as 别名]
def underline(self, match, context, next_state):
        overline = context[0]
        blocktext = overline + '\n' + self.state_machine.line
        lineno = self.state_machine.abs_line_number() - 1
        if len(overline.rstrip()) < 4:
            self.short_overline(context, blocktext, lineno, 1)
        msg = self.reporter.error(
              'Invalid section title or transition marker.',
              nodes.literal_block(blocktext, blocktext),
              line=lineno)
        self.parent += msg
        return [], 'Body', [] 
开发者ID:skarlekar,项目名称:faces,代码行数:14,代码来源:states.py

示例7: initial_quoted

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import transition [as 别名]
def initial_quoted(self, match, context, next_state):
        """Match arbitrary quote character on the first line only."""
        self.remove_transition('initial_quoted')
        quote = match.string[0]
        pattern = re.compile(re.escape(quote), re.UNICODE)
        # New transition matches consistent quotes only:
        self.add_transition('quoted',
                            (pattern, self.quoted, self.__class__.__name__))
        self.initial_lineno = self.state_machine.abs_line_number()
        return [match.string], next_state, [] 
开发者ID:skarlekar,项目名称:faces,代码行数:12,代码来源:states.py

示例8: blank

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import transition [as 别名]
def blank(self, match, context, next_state):
        """Transition marker."""
        src, srcline = self.state_machine.get_source_and_line()
        marker = context[0].strip()
        if len(marker) < 4:
            self.state_correction(context)
        transition = nodes.transition(rawsource=marker)
        transition.source = src
        transition.line = srcline - 1
        self.parent += transition
        return [], 'Body', [] 
开发者ID:skarlekar,项目名称:faces,代码行数:13,代码来源:states.py


注:本文中的docutils.nodes.transition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。