Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.14.14'
rev: 'v0.15.0'
hooks:
# Run the linter:
- id: ruff-check
Expand Down
5 changes: 5 additions & 0 deletions changes/unreleased/5122.8DXxjQycntr4ecdcrcWZ7f.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
internal = "Update Ruff to v0.15.0"
[[pull_requests]]
uid = "5122"
author_uids = ["renovate[bot]"]
closes_threads = []
5 changes: 5 additions & 0 deletions changes/unreleased/5122.EZ5hbq74CEoTbixKNcSmQz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
internal = "Update Ruff to v0.15.0"
[[pull_requests]]
uid = "5122"
author_uids = ["renovate[bot]"]
closes_threads = []
2 changes: 1 addition & 1 deletion docs/auxil/sphinx_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def autodoc_process_docstring(
"""

# 1) Insert the Keyword Args and "Shortcuts" admonitions for the Bot methods
method_name = name.split(".")[-1]
method_name = name.rsplit(".", maxsplit=1)
if (
name.startswith("telegram.Bot.")
and what == "method"
Expand Down
2 changes: 1 addition & 1 deletion docs/auxil/tg_const_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def process_link(
if (
isinstance(value, dtm.datetime)
and value == telegram.constants.ZERO_DATE
and target in ("telegram.constants.ZERO_DATE",)
and target == "telegram.constants.ZERO_DATE"
):
return repr(value), target
sphinx_logger.warning(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ docs = [
]
linting = [
"pre-commit",
"ruff==0.14.14",
"ruff==0.15.0",
"mypy==1.18.2",
"pylint==4.0.4"
]
Expand Down Expand Up @@ -165,7 +165,7 @@ show-fixes = true

[tool.ruff.lint]
typing-extensions = false
ignore = ["PLR2004", "PLR0911", "PLR0912", "PLR0913", "PLR0915", "PERF203"]
ignore = ["PLR2004", "PLR0911", "PLR0912", "PLR0913", "PLR0915", "PERF203", "ASYNC240"]
select = ["E", "F", "I", "PL", "UP", "RUF", "PTH", "C4", "B", "PIE", "SIM", "RET", "RSE",
"G", "ISC", "PT", "ASYNC", "TCH", "SLOT", "PERF", "PYI", "FLY", "AIR", "RUF022",
"RUF023", "Q", "INP", "W", "YTT", "DTZ", "ARG", "T20", "FURB", "DOC", "TRY",
Expand Down
4 changes: 2 additions & 2 deletions src/telegram/_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1462,8 +1462,8 @@ def link(self) -> str | None:
to the corresponding thread view.
"""
if self.chat.type not in [Chat.PRIVATE, Chat.GROUP]:
# the else block gets rid of leading -100 for supergroups:
to_link = self.chat.username if self.chat.username else f"c/{str(self.chat.id)[4:]}"
# if username doesn't exist, remove the leading -100 for supergroups in link
to_link = self.chat.username or f"c/{str(self.chat.id)[4:]}"
baselink = f"https://t.me/{to_link}/{self.message_id}"

# adds the thread for topics and replies
Expand Down
8 changes: 2 additions & 6 deletions src/telegram/request/_requestparameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,7 @@ def from_input(cls, key: str, value: object) -> "RequestParameter":
if param_value is not None:
param_values.append(param_value)
input_files.extend(input_file)
return RequestParameter(
name=key, value=param_values, input_files=input_files if input_files else None
)
return RequestParameter(name=key, value=param_values, input_files=input_files or None)

param_value, input_files = cls._value_and_input_files_from_input(value)
return RequestParameter(
name=key, value=param_value, input_files=input_files if input_files else None
)
return RequestParameter(name=key, value=param_value, input_files=input_files or None)
4 changes: 1 addition & 3 deletions tests/auxil/bot_method_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ async def check_shortcut_call(

shortcut_signature = inspect.signature(shortcut_method)
# auto_pagination: Special casing for InlineQuery.answer
kwargs = {
name: name for name in shortcut_signature.parameters if name not in ["auto_pagination"]
}
kwargs = {name: name for name in shortcut_signature.parameters if name != "auto_pagination"}
if "reply_parameters" in kwargs:
kwargs["reply_parameters"] = ReplyParameters(message_id=1)

Expand Down
2 changes: 1 addition & 1 deletion tests/auxil/pytest_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _get_bot_user(token: str) -> User:
# generate the correct user_id from the token (token from bot_info is random each test run).
# This is important in e.g. bot equality tests. The other parameters like first_name don't
# matter as much. In the future we may provide a way to get all the correct info from the token
user_id = int(token.split(":")[0])
user_id = int(token.split(":", maxsplit=1)[0])
first_name = bot_info.get(
"name",
)
Expand Down
47 changes: 23 additions & 24 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading