예제 #1
0
    def _renderer_of_non_empty(self) -> DetailsRenderer:
        entries_renderer = details.SequenceRenderer([
            file_spec.describer
            for file_spec in self._files
        ])

        return details.SequenceRenderer([
            self.BEGIN_BRACE_RENDERER,
            details.IndentedRenderer(entries_renderer),
            self.END_BRACE_RENDERER,
        ])
예제 #2
0
    def _renderer_of_non_empty(
        self, entries: Sequence[Tuple[Renderer[str],
                                      Optional[TSD]]]) -> DetailsRenderer:
        entries_renderer = details.SequenceRenderer(
            [self._file(fn, mb_matcher) for fn, mb_matcher in entries])

        return details.SequenceRenderer([
            _LITERAL_BEGIN_RENDERER,
            details.IndentedRenderer(entries_renderer),
            _LITERAL_END_RENDERER,
        ])
예제 #3
0
 def _limits(self) -> DetailsRenderer:
     limits = filter_not_none([
         map_optional(
             lambda d: self._mk_detail(
                 file_or_dir_contents.MIN_DEPTH_OPTION, d),
             self._min_depth),
         map_optional(
             lambda d: self._mk_detail(
                 file_or_dir_contents.MAX_DEPTH_OPTION, d),
             self._max_depth),
     ])
     num_limits = len(limits)
     if num_limits == 0:
         return details.empty()
     elif num_limits == 1:
         return details.IndentedRenderer(limits[0])
     else:
         return details.IndentedRenderer(details.SequenceRenderer(limits))
예제 #4
0
    def _details(self) -> DetailsRenderer:
        parts = []

        if self._files_found:
            parts.append(
                custom_details.HeaderAndValue(
                    common.FILES_FOUND,
                    custom_details.string_list(self._files_found)
                ),
            )

        parts.append(
            custom_details.HeaderAndValue(
                common.FILES_NOT_FOUND,
                custom_details.string_list(sorted(self._files_not_found.keys()))
            )
        )

        return details.SequenceRenderer(parts)
예제 #5
0
 def _renderer(self) -> DetailsRenderer:
     return details.SequenceRenderer([self._recursive(), self._limits()])