Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 3, 2025
1 parent 1175ddc commit e27a1a8
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.9.9'
rev: 'v0.4.3'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
Expand Down
2 changes: 1 addition & 1 deletion app/commands/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get(key: str) -> str | None:
contacts = ""
if constants.CONTACTS:
contacts_list = "\n".join(
f'- {g("type")}: {a(g("text"), g("url"))}' # type: ignore[arg-type]
f"- {g('type')}: {a(g('text'), g('url'))}" # type: ignore[arg-type]
for c in constants.CONTACTS
if all(map(c.get, ("type", "text", "url")))
if (g := get_by_lang(c)) # type: ignore[arg-type]
Expand Down
2 changes: 1 addition & 1 deletion app/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
ENABLE_MONGO = MONGO_URL and MONGO_DB
if not ENABLE_MONGO:
print(
"Bot requires MongoDB to work.\n" "Please, set MONGO_URL and MONGO_DB envs.",
"Bot requires MongoDB to work.\nPlease, set MONGO_URL and MONGO_DB envs.",
file=sys.stderr,
)
exit(1)
Expand Down
4 changes: 1 addition & 3 deletions app/parsers/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

INSTAGRAM_RE = re.compile(r"(?:https?://)?(?:www\.)?instagram\.com/(?P<type>\w+)/(?P<id>[\w-]+)")

USER_AGENT = (
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/91.0.4472.114 Safari/537.36"
)
USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"

proxy_file = CONFIG_PATH / "http_proxies.txt"

Expand Down
12 changes: 5 additions & 7 deletions app/settings/user_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def check(language: str) -> str:
display_name=_("👤 Add author in media"),
template_str_answer=_("Add author in media are {}!"),
template_str_menu=_(
"Add author in media (video/audio/images):" "\n\n{}\n\n" "Example: So funny video by <code>@username</code>"
"Add author in media (video/audio/images):\n\n{}\n\nExample: So funny video by <code>@username</code>"
),
settings_data_default=False,
)
Expand All @@ -55,7 +55,7 @@ def check(language: str) -> str:
display_name=_("🔗 Add original link in media"),
template_str_answer=_("Add original link in media are {}!"),
template_str_menu=_(
"Add original link in media:" "\n\n{}\n\n" "<i>️📝 NOTE!</i> Twitter always add original link in media."
"Add original link in media:\n\n{}\n\n<i>️📝 NOTE!</i> Twitter always add original link in media."
),
settings_data_default=False,
)
Expand All @@ -65,7 +65,7 @@ def check(language: str) -> str:
display_name=_("🏳️ Add flag to TikTok videos/images"),
template_str_answer=_("Add flag to TikTok videos/images are {}!"),
template_str_menu=_(
"Adds the flag of the country from which the videos/images was " "uploaded (author's country):\n\n{}"
"Adds the flag of the country from which the videos/images was uploaded (author's country):\n\n{}"
),
settings_data_default=False,
)
Expand Down Expand Up @@ -130,9 +130,7 @@ def check(d: str) -> str:
display_name=_("📬 Add media source to videos/images"),
template_str_answer=_("Add media source to videos/images are {}!"),
template_str_menu=_(
"Add the social network where the videos/images were taken from:"
"\n\n{}\n\n"
"Example: So funny video from TikTok"
"Add the social network where the videos/images were taken from:\n\n{}\n\nExample: So funny video from TikTok"
),
settings_data_default=False,
)
Expand Down Expand Up @@ -184,7 +182,7 @@ def check(history: str) -> str:

await ctx.update_message(
text=_(
"Choose source to save in history. " "To see the history, use <i>Inline Query</i>.\n\n" "Current: <b>{}</b>"
"Choose source to save in history. To see the history, use <i>Inline Query</i>.\n\nCurrent: <b>{}</b>"
).format(HISTORY_DISPLAY[HistoryTypes[ctx.data]]),
buttons=[
ctx.btn(text=f"{history_name}{check(history_type)}", result=history_type)
Expand Down
4 changes: 2 additions & 2 deletions cli/comands.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def markdown_update_region(markdown: str, region: str, data: str) -> str:
end_rm = markdown.split(end, 1)[1]
logger.info("Update %r region in markdown", region)

return f"{start_rm.strip()}\n\n" f"{start}\n\n" f"{data.strip()}\n\n" f"{end}\n\n" f"{end_rm.strip()}"
return f"{start_rm.strip()}\n\n{start}\n\n{data.strip()}\n\n{end}\n\n{end_rm.strip()}"


add_command(
Expand Down Expand Up @@ -99,7 +99,7 @@ def generate_makefile() -> list[dict]:

# noinspection PyTypeChecker,PydanticTypeChecker
cmds = "\n".join(
f"{name}:{description}\n" f"\tpoetry run -- python -m cli {name}{extra}\n"
f"{name}:{description}\n\tpoetry run -- python -m cli {name}{extra}\n"
for name, description, extra in map(dict.values, data)
)

Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def _process_video(update: Update, ctx: CallbackContext, media: Video) ->
if update.effective_chat.type == ChatType.PRIVATE:
logger.info("Sending video as link: %s", media)
await update.effective_message.reply_text(
_("Error sending video: {title}\n" "\n\n" '<a href="{url}">Direct link to video</a>').format(
_('Error sending video: {title}\n\n\n<a href="{url}">Direct link to video</a>').format(
title=a(media_caption, media.original_url),
url=media.url,
),
Expand Down

0 comments on commit e27a1a8

Please sign in to comment.