Skip to content

Commit

Permalink
style: code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amadejpapez committed Dec 26, 2022
1 parent 4a014d4 commit 793e434
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
15 changes: 8 additions & 7 deletions src/format_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def new_updates(releases: list) -> list:
if len(releases) == 1:
post_text.insert(0, ":collision: NEW UPDATE RELEASED :collision:\n\n")

# if there is only one release, add its notes as a link instead
if releases[0].get_security_content_link():
# if there is only one release, add its notes as a link
post_text.append(releases[0].get_security_content_link())
else:
post_text.insert(0, ":collision: NEW UPDATES RELEASED :collision:\n\n")
Expand All @@ -45,7 +45,7 @@ def new_updates(releases: list) -> list:

def top_ios_modules(releases: list) -> list:
"""
-----------------------------
-----
⚒ FIXED IN iOS 14.7 ⚒
- 4 bugs in WebKit
Expand All @@ -54,7 +54,7 @@ def top_ios_modules(releases: list) -> list:
- 2 bugs in CoreAudio
and 25 other vulnerabilities fixed
https://support.apple.com/kb/HT212601
-----------------------------
-----
"""
post_text = []

Expand All @@ -76,12 +76,13 @@ def top_ios_modules(releases: list) -> list:

for key, value in modules.items():
if len(post_text) < 5:
num_bugs += value
if value > 1:
post_text.append(f"- {value} bugs in {key}\n")
else:
post_text.append(f"- {value} bug in {key}\n")

num_bugs += value

num_bugs = release.get_num_of_bugs() - num_bugs

if num_bugs > 0:
Expand Down Expand Up @@ -226,15 +227,15 @@ def entry_changes(releases: list) -> list:
elif release.get_num_entries_updated() > 0:
post_text.append(f"{name} - {release.get_format_num_entries_updated()}\n")

if changes_count > 1:
if changes_count == 1:
post_text.insert(
0,
f":arrows_counterclockwise: {changes_count} ENTRY CHANGES :arrows_counterclockwise:\n\n",
":arrows_counterclockwise: 1 ENTRY CHANGE :arrows_counterclockwise:\n\n",
)
else:
post_text.insert(
0,
":arrows_counterclockwise: 1 ENTRY CHANGE :arrows_counterclockwise:\n\n",
f":arrows_counterclockwise: {changes_count} ENTRY CHANGES :arrows_counterclockwise:\n\n",
)

return post_text
Expand Down
1 change: 0 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def check_for_entry_changes(coll: dict, all_releases_rows: list) -> None:
Because of checking so many releases and to not make too much requests,
it is only doing this once per day.
"""

for row in all_releases_rows:
release = Release(row)

Expand Down
6 changes: 3 additions & 3 deletions src/posting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
return_type=type(dict),
)

MASTODON_API = {
MASTODON_KEYS = {
"access_token": ("Bearer " + KEYS["Mastodon_ApplSec"]["access_token"]),
}

Expand Down Expand Up @@ -87,7 +87,7 @@ def toot(results: list) -> None:
response = requests.post(
API_URL,
json={"status": emoji.emojize(text, language="alias")},
headers={"Authorization": MASTODON_API["access_token"]},
headers={"Authorization": MASTODON_KEYS["access_token"]},
timeout=60
)

Expand All @@ -100,7 +100,7 @@ def toot(results: list) -> None:
"status": emoji.emojize(text, language="alias"),
"in_reply_to_id": post_ids[-1],
},
headers={"Authorization": MASTODON_API["access_token"]},
headers={"Authorization": MASTODON_KEYS["access_token"]},
timeout=60
)

Expand Down

0 comments on commit 793e434

Please sign in to comment.