code: def _generate(self):
          
          doc_count = 0
          for fp in self.all_files:
              for doc in self._get_docs_for_path(fp):
                  yield doc
                  doc_count += 1
                  if doc_count >= self.max_docs:
                      return
docs: Parses a file or directory of files into a set of ``Document`` objects.