MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / get_new_doctest_files

Function get_new_doctest_files

diffusers/utils/tests_fetcher.py:379–403  ·  view source on GitHub ↗

Get the list of files that were removed from "utils/not_doctested.txt", between `base_commit` and `branching_commit`. Returns: `List[str]`: List of files that were removed from "utils/not_doctested.txt".

(repo, base_commit, branching_commit)

Source from the content-addressed store, hash-verified

377
378
379def get_new_doctest_files(repo, base_commit, branching_commit) -> List[str]:
380 """
381 Get the list of files that were removed from "utils/not_doctested.txt", between `base_commit` and
382 `branching_commit`.
383
384 Returns:
385 `List[str]`: List of files that were removed from "utils/not_doctested.txt".
386 """
387 for diff_obj in branching_commit.diff(base_commit):
388 # Ignores all but the "utils/not_doctested.txt" file.
389 if diff_obj.a_path != "utils/not_doctested.txt":
390 continue
391 # Loads the two versions
392 folder = Path(repo.working_dir)
393 with checkout_commit(repo, branching_commit):
394 with open(folder / "utils/not_doctested.txt", "r", encoding="utf-8") as f:
395 old_content = f.read()
396 with open(folder / "utils/not_doctested.txt", "r", encoding="utf-8") as f:
397 new_content = f.read()
398 # Compute the removed lines and return them
399 removed_content = {x.split(" ")[0] for x in old_content.split("\n")} - {
400 x.split(" ")[0] for x in new_content.split("\n")
401 }
402 return sorted(removed_content)
403 return []
404
405
406def get_doctest_files(diff_with_last_commit: bool = False) -> List[str]:

Callers 1

get_doctest_filesFunction · 0.85

Calls 1

checkout_commitFunction · 0.85

Tested by

no test coverage detected