mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 05:28:13 +02:00
made the has_only_1_comment function potentially
verbose
This commit is contained in:
5
utils.py
5
utils.py
@ -37,14 +37,16 @@ def has_only_1_round_of_comments(commits: PaginatedList[Commit], comments: Pagin
|
|||||||
|
|
||||||
return n_before >= 1 and n_after >= 1
|
return n_before >= 1 and n_after >= 1
|
||||||
|
|
||||||
def has_only_1_comment(commits: PaginatedList[Commit], comments: PaginatedList[PullRequestComment]):
|
def has_only_1_comment(commits: PaginatedList[Commit], comments: PaginatedList[PullRequestComment], verbose: bool = False):
|
||||||
if (
|
if (
|
||||||
comments is None or commits is None
|
comments is None or commits is None
|
||||||
or comments.totalCount == 0 or commits.totalCount == 0
|
or comments.totalCount == 0 or commits.totalCount == 0
|
||||||
):
|
):
|
||||||
|
if verbose: print(f"No comments or commits: {comments.totalCount} comments, {commits.totalCount} commits")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if comments.totalCount != 1:
|
if comments.totalCount != 1:
|
||||||
|
if verbose: print(f"More than 1 comment: {comments.totalCount} comments")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
commit_dates = [commit.commit.author.date for commit in tqdm(commits, total=commits.totalCount, desc="Extracting date from commits", leave=False)]
|
commit_dates = [commit.commit.author.date for commit in tqdm(commits, total=commits.totalCount, desc="Extracting date from commits", leave=False)]
|
||||||
@ -59,4 +61,5 @@ def has_only_1_comment(commits: PaginatedList[Commit], comments: PaginatedList[P
|
|||||||
if commit_date > comment_date:
|
if commit_date > comment_date:
|
||||||
n_after += 1
|
n_after += 1
|
||||||
continue
|
continue
|
||||||
|
if verbose: print(f"n_before: {n_before}, n_after: {n_after}")
|
||||||
return n_before >= 1 and n_after >= 1
|
return n_before >= 1 and n_after >= 1
|
||||||
|
Reference in New Issue
Block a user