Exemplo n.º 1
0
 def make_iterator_wrapper_content_blank() -> IteratorTestWrapper[Line]:
     blank_line = Line.make('')
     condition = EmptyLineFilter.make()
     iterator = ListIterator.make([blank_line, blank_line, blank_line])
     actual = ConditionFilter.make(iterator, condition)
     expected = []  # type: List[Line]
     return IteratorTestWrapper.make(actual, expected)
Exemplo n.º 2
0
 def make_iterator_wrapper_content_no_padding(
 ) -> IteratorTestWrapper[Line]:
     blank_line = Line.make('')
     line1 = Line.make('Hello')
     line2 = Line.make('Goodbye')
     line3 = Line.make('Goodbye again')
     condition = EmptyLineFilter.make()
     iterator = ListIterator.make([line1, line2, blank_line, line3])
     actual = ConditionFilter.make(iterator, condition)
     expected = [line1, line2, line3]
     return IteratorTestWrapper.make(actual, expected)
Exemplo n.º 3
0
 def __enter__(self) -> Iterator[Makefile]:
     filenames = []
     for entry in os.scandir(self._directory_path):
         if entry.is_file():
             filenames.append(entry.name)
     list_ = []
     name = self._parent._get_best_name(filenames)
     if name is not None:
         abs_path = os.path.realpath(
             os.path.join(os.getcwd(), self._directory_path))
         list_.append(Makefile.make_with_exec_path(abs_path, name))
     return ListIterator.make(list_)
Exemplo n.º 4
0
 def __enter__(self) -> Iterator[Makefile]:
     list_ = []
     first_directory = True
     for dirpath, dirnames, filenames in os.walk(self._directory_path):
         name = self._parent._get_best_name(filenames)
         if name is not None:
             if not first_directory:
                 abs_path = os.path.realpath(
                     os.path.join(os.getcwd(), dirpath))
                 list_.append(
                     Makefile.make_with_exec_path(abs_path, name))
         else:
             dirnames.clear()
         if first_directory:
             first_directory = False
     return ListIterator.make(list_)
Exemplo n.º 5
0
 def recipe_lines(self) -> Iterator[str]:
     return ListIterator.make(self._recipe_lines)
Exemplo n.º 6
0
 def order_only_prerequisites(self) -> Iterator[str]:
     return ListIterator.make(self._order_only_prerequisites)
Exemplo n.º 7
0
 def prerequisites(self) -> Iterator[str]:
     return ListIterator.make(self._prerequisites)
Exemplo n.º 8
0
 def make_iterator_wrapper_empty() -> IteratorTestWrapper[Line]:
     condition = EmptyLineFilter.make()
     iterator = ListIterator.make([])  # type: ListIterator[Line]
     actual = ConditionFilter.make(iterator, condition)
     expected = []  # type: List[Line]
     return IteratorTestWrapper.make(actual, expected)