Skip to content

Commit 6abbf9a

Browse files
f
1 parent d48ba7f commit 6abbf9a

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

issues_parser.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
@dataclass(kw_only=True, frozen=True)
16-
class IssueDataWithComment:
16+
class IssueData:
1717
repository_name: str = ''
1818
number: int = 0
1919
title: str = ''
@@ -187,7 +187,7 @@ def get_info(obj, attr):
187187
):
188188
continue
189189

190-
issue_data = IssueDataWithComment(
190+
issue_data = IssueData(
191191
repository_name=repository.name,
192192
number=issue._id,
193193
title=issue.title,
@@ -216,16 +216,20 @@ def get_info(obj, attr):
216216
sleep(TIMEDELTA)
217217

218218

219-
def log_issue_and_comments(csv_name, issue_data: IssueDataWithComment, comments):
219+
def log_issue_and_comments(csv_name, issue_data: IssueData, comments):
220220
if comments:
221221
for comment in comments:
222-
comment_data = IssueDataWithComment(
223-
**asdict(issue_data),
224-
comment_body=comment.body,
225-
comment_created_at=str(comment.created_at),
226-
comment_author_name=comment.author.username,
227-
comment_author_login=comment.author.login,
228-
comment_author_email=comment.author.email,
222+
comment_data = IssueData(
223+
**(
224+
asdict(issue_data) |
225+
dict(
226+
comment_body=comment.body,
227+
comment_created_at=str(comment.created_at),
228+
comment_author_name=comment.author.username,
229+
comment_author_login=comment.author.login,
230+
comment_author_email=comment.author.email,
231+
)
232+
)
229233
)
230234
comment_data = asdict(comment_data)
231235

@@ -244,7 +248,7 @@ def log_issues(
244248
finish: datetime,
245249
fork_flag: bool,
246250
):
247-
info = asdict(IssueDataWithComment())
251+
info = asdict(IssueData())
248252
logger.log_to_csv(csv_name, list(info.keys()))
249253

250254
for client, repo, token in binded_repos:

pull_requests_parser.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,16 @@ def get_info(obj, attr):
161161
if comments:
162162
for comment in comments:
163163
comment_data = PullRequestData(
164-
**asdict(pr_data),
165-
comment_body=comment.body,
166-
comment_created_at=str(comment.created_at),
167-
comment_author_name=comment.author.name,
168-
comment_author_login=comment.author.login,
169-
comment_author_email=nvl(comment.author.email),
164+
**(
165+
asdict(pr_data) |
166+
dict(
167+
comment_body=comment.body,
168+
comment_created_at=str(comment.created_at),
169+
comment_author_name=comment.author.name,
170+
comment_author_login=comment.author.login,
171+
comment_author_email=nvl(comment.author.email),
172+
)
173+
)
170174
)
171175
comment_data = asdict(comment_data)
172176

0 commit comments

Comments
 (0)