MCPcopy Create free account
hub / github.com/pytorch/pytorch / main

Function main

scripts/release_notes/commitlist.py:521–581  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

519
520
521def main():
522 parser = argparse.ArgumentParser(description="Tool to create a commit list")
523
524 group = parser.add_mutually_exclusive_group(required=True)
525 group.add_argument("--create-new", "--create_new", nargs=2)
526 group.add_argument("--update-to", "--update_to")
527 # I found this flag useful when experimenting with adding new auto-categorizing filters.
528 # After running commitlist.py the first time, if you add any new filters in this file,
529 # re-running with "rerun_with_new_filters" will update the existing commitlist.csv file,
530 # but only affect the rows that were previously marked as "Uncategorized"
531 group.add_argument(
532 "--rerun-with-new-filters", "--rerun_with_new_filters", action="store_true"
533 )
534 group.add_argument("--stat", action="store_true")
535 group.add_argument("--export-markdown", "--export_markdown", action="store_true")
536 group.add_argument(
537 "--export-csv-categories", "--export_csv_categories", action="store_true"
538 )
539 parser.add_argument("--path", default="results/commitlist.csv")
540 args = parser.parse_args()
541
542 if args.create_new:
543 create_new(args.path, args.create_new[0], args.create_new[1])
544 print(
545 "Finished creating new commit list. Results have been saved to results/commitlist.csv"
546 )
547 return
548 if args.update_to:
549 update_existing(args.path, args.update_to)
550 return
551 if args.rerun_with_new_filters:
552 rerun_with_new_filters(args.path)
553 return
554 if args.stat:
555 commits = CommitList.from_existing(args.path)
556 stats = commits.stat()
557 pprint.pprint(stats)
558 return
559
560 if args.export_csv_categories:
561 commits = CommitList.from_existing(args.path)
562 categories = list(commits.stat().keys())
563 for category in categories:
564 print(f"Exporting {category}...")
565 filename = f"results/export/result_{category}.csv"
566 CommitList.write_to_disk_static(filename, commits.filter(category=category))
567 return
568
569 if args.export_markdown:
570 commits = CommitList.from_existing(args.path)
571 categories = list(commits.stat().keys())
572 for category in categories:
573 print(f"Exporting {category}...")
574 lines = get_markdown_header(category)
575 lines += to_markdown(commits, category)
576 filename = f"results/export/result_{category}.md"
577 os.makedirs(os.path.dirname(filename), exist_ok=True)
578 with open(filename, "w") as f:

Callers 1

commitlist.pyFile · 0.70

Calls 15

create_newFunction · 0.85
update_existingFunction · 0.85
rerun_with_new_filtersFunction · 0.85
listFunction · 0.85
get_markdown_headerFunction · 0.85
to_markdownFunction · 0.85
parse_argsMethod · 0.80
from_existingMethod · 0.80
statMethod · 0.80
pprintMethod · 0.80
write_to_disk_staticMethod · 0.80
makedirsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…