Ejemplo n.º 1
0
def location_block_renderer(
        source_location: Optional[SourceLocationPath],
        section_name: Optional[str],
        description: Optional[str]) -> Renderer[MajorBlock]:
    return comp_rend.MajorBlockR(
        location_minor_blocks_renderer(source_location, section_name,
                                       description))
Ejemplo n.º 2
0
 def render(self) -> MajorBlock:
     renderer = comp_rend.MajorBlockR(
         rend_comb.SingletonSequenceR(
             comp_rend.MinorBlockR(
                 rendering.details_renderer_to_line_elements(
                     layout__node_wo_data.RENDERING_CONFIGURATION,
                     self._details.render()))))
     return renderer.render()
Ejemplo n.º 3
0
    def visit_act_phase_failure(self, failure_info: ActPhaseFailureInfo) -> SequenceRenderer[MajorBlock]:
        phase_source_and_actor = source_location.section_and_source(
            failure_info.phase_step.phase.identifier,
            rend_comb.PrependR(
                self._actor_info_block(failure_info.actor_name),
                source_location.source_str_renderer(failure_info.phase_source),
            )
        )

        return rend_comb.SingletonSequenceR(
            comp_rend.MajorBlockR(phase_source_and_actor)
        )
def _actual_exit_code_and_stderr_block(
        exit_code: int, stderr_contents: str) -> Renderer[MajorBlock]:
    def exit_code_block() -> Renderer[MinorBlock]:
        return blocks.MinorBlockOfSingleLineObject(
            line_objects.PreFormattedString(_actual_exit_code_line(exit_code)))

    minor_blocks = [
        exit_code_block(),
    ]
    if stderr_contents:
        minor_blocks.append(stderr_contents_block(stderr_contents))

    return comp_rend.MajorBlockR(combinators.SequenceR(minor_blocks))
Ejemplo n.º 5
0
 def render(self) -> MajorBlock:
     reference = self.reference
     source_info = reference.source_info()
     source_location_info = source_info.source_location_info
     if source_location_info is not None:
         return source_location.location_block_renderer(
             source_location_info.source_location_path,
             reference.phase().section_name,
             None,
         ).render()
     elif source_info.source_lines is not None:
         return rend.MajorBlockR(
             source_location.source_lines_in_section_block_renderer(
                 reference.phase().section_name,
                 source_info.source_lines,
             )).render()
     else:
         raise ValueError('inconsistency of source info: ' +
                          str(source_info))
Ejemplo n.º 6
0
 def renderer(self) -> TextRenderer:
     return rend_comb.SingletonSequenceR(
         comp_rend.MajorBlockR(self._minor_blocks_renderer()))
Ejemplo n.º 7
0
def major_blocks_of_string_lines(
        lines: Sequence[str]) -> SequenceRenderer[MajorBlock]:
    return rend_comb.SingletonSequenceR(
        comp_rend.MajorBlockR(minor_blocks_of_string_lines(lines)))
Ejemplo n.º 8
0
def w_details(header: ToStringObject,
              details: SequenceRenderer[MinorBlock]) -> Renderer[MajorBlock]:
    return comp_rend.MajorBlockR(
        combinators.PrependR(
            header_rendering.SimpleHeaderMinorBlockRenderer(header),
            combinators.Indented(details)))
Ejemplo n.º 9
0
def major_block_of_string_blocks(contents: Blocks) -> Renderer[MajorBlock]:
    return comp_rend.MajorBlockR(minor_blocks_of_string_blocks(contents))