in analytics/github_analyze.py [0:0]
def get_monthly_stats(commits: List[GitCommit]) -> Iterable[PeriodStats]:
y, m, total, reverts, authors = None, None, 0, 0, set()
for commit in commits:
commit_date = commit.commit_date if commit.commit_date is not None else commit.author_date
if y != commit_date.year or m != commit_date.month:
if y is not None:
yield PeriodStats(datetime(y, m, 1), total, reverts, len(authors))
y, m, total, reverts, authors = commit_date.year, commit_date.month, 0, 0, set()
if is_revert(commit):
reverts += 1
total += 1
authors.add(commit.author)