diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6763e08a..32c3b58de 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,7 +62,7 @@ repos: - cachetools~=5.3.1 - . # this basically does `pip install -e .` - repo: https://github.com/asottile/pyupgrade - rev: v3.4.0 + rev: v3.8.0 hooks: - id: pyupgrade files: ^(telegram|examples|tests|docs)/.*\.py$ @@ -76,8 +76,8 @@ repos: args: - --diff - --check -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.275' +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: 'v0.0.277' hooks: - id: ruff name: ruff diff --git a/pyproject.toml b/pyproject.toml index 8a9dd971d..264f8c063 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ line_length = 99 line-length = 99 target-version = "py38" show-fixes = true -ignore = ["PLR2004", "PLR0911", "PLR0912", "PLR0913", "PLR0915"] +ignore = ["PLR2004", "PLR0911", "PLR0912", "PLR0913", "PLR0915", "PERF203"] select = ["E", "F", "I", "PL", "UP", "RUF", "PTH", "C4", "B", "PIE", "SIM", "RET", "RSE", "G", "ISC", "PT", "ASYNC", "TCH", "CPY", "SLOT", "PERF",] diff --git a/telegram/ext/_updater.py b/telegram/ext/_updater.py index 9c7081b3c..b876bbcd0 100644 --- a/telegram/ext/_updater.py +++ b/telegram/ext/_updater.py @@ -598,8 +598,8 @@ class Updater(AsyncContextManager["Updater"]): """ _LOGGER.debug("Start network loop retry %s", description) cur_interval = interval - while self.running: - try: + try: + while self.running: try: if not await action_cb(): break @@ -625,9 +625,8 @@ class Updater(AsyncContextManager["Updater"]): if cur_interval: await asyncio.sleep(cur_interval) - except asyncio.CancelledError: - _LOGGER.debug("Network loop retry %s was cancelled", description) - break + except asyncio.CancelledError: + _LOGGER.debug("Network loop retry %s was cancelled", description) async def _bootstrap( self, diff --git a/tests/test_official.py b/tests/test_official.py index a3cba293a..f959705cc 100644 --- a/tests/test_official.py +++ b/tests/test_official.py @@ -179,10 +179,7 @@ def parse_table(h4) -> List[List[str]]: table = find_next_sibling_until(h4, "table", h4.find_next_sibling("h4")) if not table: return [] - t = [] - for tr in table.find_all("tr")[1:]: - t.append([td.text for td in tr.find_all("td")]) - return t + return [[td.text for td in tr.find_all("td")] for tr in table.find_all("tr")[1:]] def check_method(h4):