refactor: explicitly define parameter types
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
20b8bf2432
commit
8b97a60a34
2 changed files with 6 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def humanize_tags_from_json(value, default):
|
def humanize_tags_from_json(value: str, default: str):
|
||||||
if value != "":
|
if value != "":
|
||||||
output = str()
|
output = str()
|
||||||
tags = value.split()
|
tags = value.split()
|
||||||
|
@ -14,7 +14,7 @@ def humanize_tags_from_json(value, default):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
def format_rating(value):
|
def format_rating(value: str):
|
||||||
match value:
|
match value:
|
||||||
case "g":
|
case "g":
|
||||||
# Negative Squared Latin Capital Letter G
|
# Negative Squared Latin Capital Letter G
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from configparser import ConfigParser
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
@ -31,7 +32,8 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
|
||||||
await answer_query(update, query, config, data)
|
await answer_query(update, query, config, data)
|
||||||
|
|
||||||
|
|
||||||
async def answer_query(update, query, config, data):
|
async def answer_query(update: Update, query: str,
|
||||||
|
config: ConfigParser, data):
|
||||||
characters = humanize_tags_from_json(data['tag_string_character'], "no characters")
|
characters = humanize_tags_from_json(data['tag_string_character'], "no characters")
|
||||||
copyrights = humanize_tags_from_json(data['tag_string_copyright'], "unknown copyright")
|
copyrights = humanize_tags_from_json(data['tag_string_copyright'], "unknown copyright")
|
||||||
artists = humanize_tags_from_json(data['tag_string_artist'], "unknown artist")
|
artists = humanize_tags_from_json(data['tag_string_artist'], "unknown artist")
|
||||||
|
@ -63,7 +65,7 @@ async def answer_query(update, query, config, data):
|
||||||
await update.inline_query.answer(results)
|
await update.inline_query.answer(results)
|
||||||
|
|
||||||
|
|
||||||
async def invalid_query(update, query):
|
async def invalid_query(update: Update, query: str):
|
||||||
results = [
|
results = [
|
||||||
InlineQueryResultArticle(
|
InlineQueryResultArticle(
|
||||||
id=str(uuid4()),
|
id=str(uuid4()),
|
||||||
|
|
Loading…
Add table
Reference in a new issue