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 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ target-version = "py310"
exclude = ["tenacity/_version.py"]

[tool.ruff.lint]
select = ["B", "C4", "E", "F", "FURB", "I", "PERF", "PGH", "PIE", "PYI", "RET", "RUF", "SIM", "TC", "UP", "W"]
select = ["ASYNC", "B", "C4", "DTZ", "E", "EXE", "F", "FLY", "FURB", "I", "ICN", "ISC", "LOG", "PERF", "PGH", "PIE", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "SLOT", "T10", "TC", "UP", "W"]
ignore = [
"B008", # function calls in default arguments (intentional API design)
"B905", # zip() without strict= (not needed in existing code)
Expand Down
2 changes: 1 addition & 1 deletion tenacity/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _portable_async_sleep(seconds: float) -> t.Awaitable[None]:
import trio

if sniffio.current_async_library() == "trio":
return trio.sleep(seconds)
return trio.sleep(seconds) # noqa: ASYNC105
# Otherwise, assume asyncio
# Lazy import asyncio as it's expensive (responsible for 25-50% of total import overhead).
import asyncio
Expand Down
10 changes: 5 additions & 5 deletions tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class CustomError(Exception):
stop=stop_after_attempt(1), reraise=True
):
with attempt:
raise CustomError()
raise CustomError
except CustomError:
pass
else:
Expand All @@ -246,7 +246,7 @@ async def test_sleeps(self) -> None:
stop=stop_after_attempt(1), wait=wait_fixed(1)
):
with attempt:
raise Exception()
raise Exception
except RetryError:
pass
t = current_time_ms() - start
Expand Down Expand Up @@ -312,7 +312,7 @@ async def is_exc(e: BaseException) -> bool:
with attempt:
attempts += 1
if attempts < 3:
raise CustomException()
raise CustomException

assert attempt.retry_state.outcome # help mypy
if not attempt.retry_state.outcome.failed:
Expand Down Expand Up @@ -343,7 +343,7 @@ def is_exc(e: BaseException) -> bool:
with attempt:
attempts += 1
if 2 < attempts < 4:
raise CustomException()
raise CustomException

assert attempt.retry_state.outcome # help mypy
if not attempt.retry_state.outcome.failed:
Expand Down Expand Up @@ -374,7 +374,7 @@ async def is_exc(e: BaseException) -> bool:
with attempt:
attempts += 1
if 2 < attempts < 4:
raise CustomException()
raise CustomException

assert attempt.retry_state.outcome # help mypy
if not attempt.retry_state.outcome.failed:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_tenacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ def go(self) -> typing.Any:
try:
self.go2()
except NameError as e:
raise OSError() from e
raise OSError from e

return True

Expand All @@ -936,7 +936,7 @@ def go(self) -> typing.Any:
try:
self.go2()
except OSError as e:
raise NameError() from e
raise NameError from e

return True

Expand Down Expand Up @@ -1994,7 +1994,7 @@ class TestMockingSleep:
}

def _fail(self) -> None:
raise NotImplementedError()
raise NotImplementedError

@retry(**RETRY_ARGS) # type: ignore[call-overload, untyped-decorator]
def _decorated_fail(self) -> None:
Expand Down
Loading