本文整理汇总了Python中exactly_lib.util.textformat.textformat_parser.TextParser.para方法的典型用法代码示例。如果您正苦于以下问题:Python TextParser.para方法的具体用法?Python TextParser.para怎么用?Python TextParser.para使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exactly_lib.util.textformat.textformat_parser.TextParser
的用法示例。
在下文中一共展示了TextParser.para方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ContentsConstructor
# 需要导入模块: from exactly_lib.util.textformat.textformat_parser import TextParser [as 别名]
# 或者: from exactly_lib.util.textformat.textformat_parser.TextParser import para [as 别名]
class ContentsConstructor(SectionContentsConstructor):
def __init__(self, setup: Setup):
self._setup = setup
self._tp = TextParser({
'phase': setup.phase_names,
'program_name': formatting.program_name(program_info.PROGRAM_NAME),
'instruction': concepts.INSTRUCTION_CONCEPT_INFO.name.singular,
'instructions': concepts.INSTRUCTION_CONCEPT_INFO.name.plural,
'ATC': concepts.ACTION_TO_CHECK_CONCEPT_INFO.singular_name,
'act_phase': phase_infos.ACT.name,
'symbol': concepts.SYMBOL_CONCEPT_INFO.name.singular,
'symbols': concepts.SYMBOL_CONCEPT_INFO.name.plural,
'cli_option_for_preprocessor': formatting.cli_option(OPTION_FOR_PREPROCESSOR),
'an_error_in_source': misc_texts.SYNTAX_ERROR_NAME.singular_determined,
'directive': concepts.DIRECTIVE_CONCEPT_INFO.name,
'including': formatting.keyword(directives.INCLUDING_DIRECTIVE_INFO.singular_name),
})
def apply(self, environment: ConstructionEnvironment) -> SectionContents:
preamble_paragraphs = self._tp.fnap(BEFORE_STEP_LIST)
paragraphs = (
preamble_paragraphs +
[self.processing_step_list()]
)
return docs.SectionContents(
paragraphs,
[
see_also.SeeAlsoSectionConstructor(
see_also.items_of_targets(_see_also_targets())
).apply(environment)
]
)
def processing_step_list(self) -> docs.ParagraphItem:
items = [
docs.list_item('Preprocessing',
step_with_single_exit_value(
self._tp.fnap(PURPOSE_OF_PREPROCESSING),
self._tp.para(FAILURE_CONDITION_OF_PREPROCESSING),
exit_values.NO_EXECUTION__PRE_PROCESS_ERROR)
),
docs.list_item(self._tp.text('Syntax checking and {directive:s} processing'),
step_with_multiple_exit_values(
self._tp.fnap(PURPOSE_OF_SYNTAX_CHECKING),
self._tp.fnap(FAILURE_CONDITION_OF_SYNTAX_CHECKING),
[
('Syntax error', exit_values.NO_EXECUTION__SYNTAX_ERROR),
('File inclusion error', exit_values.NO_EXECUTION__FILE_ACCESS_ERROR),
])
),
docs.list_item('Validation',
step_with_single_exit_value(
self._tp.fnap(PURPOSE_OF_VALIDATION),
self._tp.para(FAILURE_CONDITION_OF_VALIDATION),
exit_values.EXECUTION__VALIDATION_ERROR)
),
docs.list_item('Execution',
self._tp.fnap(EXECUTION_DESCRIPTION) +
[self.execution_sub_steps_description()] +
self._tp.fnap(OUTCOME_OF_EXECUTION)),
]
return lists.HeaderContentList(items,
lists.Format(lists.ListType.ORDERED_LIST,
custom_separations=docs.SEPARATION_OF_HEADER_AND_CONTENTS)
)
def execution_sub_steps_description(self) -> docs.ParagraphItem:
return lists.HeaderContentList([
docs.list_item(self._tp.text('execution of {phase[setup]:syntax}')),
docs.list_item(docs.text(post_setup_validation_step_name(self._setup))),
docs.list_item(docs.text('execution of remaining phases')),
],
lists.Format(lists.ListType.ORDERED_LIST,
custom_separations=docs.SEPARATION_OF_HEADER_AND_CONTENTS)
)