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:
parent
1b8c096db6
commit
235fab19e6
2 changed files with 7 additions and 7 deletions
10
commands.py
10
commands.py
|
@ -120,7 +120,7 @@ async def info_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
|
||||||
"Date:",
|
"Date:",
|
||||||
HtmlFormat.hyperlink(
|
HtmlFormat.hyperlink(
|
||||||
created_at.strftime("%Y-%m-%d %X (%z)"),
|
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,
|
vote_post_count,
|
||||||
f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}",
|
f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}",
|
||||||
),
|
),
|
||||||
f"({' '.join([
|
f"""({' '.join([
|
||||||
HtmlFormat.hyperlink(
|
HtmlFormat.hyperlink(
|
||||||
f"up:{upvote_post_count}",
|
f"up:{upvote_post_count}",
|
||||||
f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}&search[score]=1",
|
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"down:{downvote_post_count}",
|
||||||
f"{config.app.protocol}://{config.app.hostname}/post_votes?search[user_name]={user_data['name']}&search[score]=-1",
|
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,
|
total_feedback_count,
|
||||||
f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}",
|
f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}",
|
||||||
),
|
),
|
||||||
f"({' '.join([
|
f"""({' '.join([
|
||||||
HtmlFormat.hyperlink(
|
HtmlFormat.hyperlink(
|
||||||
f"positive:{user_data['positive_feedback_count']}",
|
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",
|
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"negative:{user_data['negative_feedback_count']}",
|
||||||
f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}&search[category]=negative",
|
f"{config.app.protocol}://{config.app.hostname}/user_feedbacks?search[user_name]={user_data['name']}&search[category]=negative",
|
||||||
),
|
),
|
||||||
])})"
|
])})"""
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -11,7 +11,7 @@ _c.optionxform = str
|
||||||
|
|
||||||
|
|
||||||
def init_config() -> None:
|
def init_config() -> None:
|
||||||
if _validate_config() is False:
|
if not _validate_config():
|
||||||
print("Config is invalid.")
|
print("Config is invalid.")
|
||||||
exit(1)
|
exit(1)
|
||||||
_c.read("config.ini", "utf-8")
|
_c.read("config.ini", "utf-8")
|
||||||
|
@ -58,7 +58,7 @@ def _validate_config() -> bool:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
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:
|
if response.status_code != 200:
|
||||||
raise requests.exceptions.InvalidURL
|
raise requests.exceptions.InvalidURL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue