fix: all my homies hate python 3.11

this commit fixes some issues for 3.11 by using triple-quoted f-strings and avoiding same quote type when nesting inside f-strings

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
mctaylors 2025-07-23 02:23:45 +03:00
parent 1b8c096db6
commit 235fab19e6
Signed by: mctaylors
GPG key ID: 9CF54A3ADF697D43
2 changed files with 7 additions and 7 deletions

View file

@ -120,7 +120,7 @@ async def info_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
"Date:",
HtmlFormat.hyperlink(
created_at.strftime("%Y-%m-%d %X (%z)"),
f"{config.app.protocol}://{config.app.hostname}/posts?tags=date:{created_at.strftime("%Y-%m-%d")}",
f"{config.app.protocol}://{config.app.hostname}/posts?tags=date:{created_at.strftime('%Y-%m-%d')}",
),
]
)
@ -295,7 +295,7 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
vote_post_count,
f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}",
),
f"({' '.join([
f"""({' '.join([
HtmlFormat.hyperlink(
f"up:{upvote_post_count}",
f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}&search[score]=1",
@ -304,7 +304,7 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
f"down:{downvote_post_count}",
f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}&search[score]=-1",
),
])})",
])})""",
]
)
)
@ -438,7 +438,7 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
total_feedback_count,
f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}",
),
f"({' '.join([
f"""({' '.join([
HtmlFormat.hyperlink(
f"positive:{user_data['positive_feedback_count']}",
f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}&search[category]=positive",
@ -451,7 +451,7 @@ async def user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
f"negative:{user_data['negative_feedback_count']}",
f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}&search[category]=negative",
),
])})"
])})"""
]
)
)

View file

@ -11,7 +11,7 @@ _c.optionxform = str
def init_config() -> None:
if _validate_config() is False:
if not _validate_config():
print("Config is invalid.")
exit(1)
_c.read("config.ini", "utf-8")
@ -58,7 +58,7 @@ def _validate_config() -> bool:
try:
response = requests.get(
f"http://{_c.get("App", "Host")}/status.json", timeout=10
f"http://{_c.get('App', 'Host')}/status.json", timeout=10
)
if response.status_code != 200:
raise requests.exceptions.InvalidURL