Skip to content

Commit d99b485

Browse files
committed
Rework code that changed variable type through reuse
Some of the code uses practice of reusing a variable through a chain of processing its contents in some cases the variable type was changed over the course of the processing. This caused the type checking via mypy to fail. The code is reworked to avoid any changing of variable type.
1 parent 5a6a712 commit d99b485

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

reportsizedeltas/reportsizedeltas.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,7 @@ def comment_report(self, pr_number: int, report_markdown: str) -> None:
516516
report_markdown -- Markdown formatted report
517517
"""
518518
print("::debug::Adding deltas report comment to pull request")
519-
report_data = {"body": report_markdown}
520-
report_data = json.dumps(obj=report_data)
521-
report_data = report_data.encode(encoding="utf-8")
519+
report_data = json.dumps(obj={"body": report_markdown}).encode(encoding="utf-8")
522520
url = "https://api.github.com/repos/" + self.repository_name + "/issues/" + str(pr_number) + "/comments"
523521

524522
self.http_request(url=url, data=report_data)
@@ -710,8 +708,7 @@ def get_page_count(link_header: str | None) -> int:
710708
# Get the pagination data
711709
for link in link_header.split(","):
712710
if link[-13:] == '>; rel="last"':
713-
link = re.split("[?&>]", link)
714-
for parameter in link:
711+
for parameter in re.split("[?&>]", link):
715712
if parameter[:5] == "page=":
716713
page_count = int(parameter.split("=")[1])
717714
break

0 commit comments

Comments
 (0)