Enable implicit-return (RET503) rule in ruff (#122771)

This commit is contained in:
epenet 2024-08-12 10:04:16 +02:00 committed by GitHub
parent 0bb8c4832d
commit e64ca7c274
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 7 deletions

View File

@ -50,7 +50,8 @@ PLATFORMS = [Platform.LIGHT, Platform.MEDIA_PLAYER]
async def call_c4_api_retry(func, *func_args):
"""Call C4 API function and retry on failure."""
for i in range(API_RETRY_TIMES):
# Ruff doesn't understand this loop - the exception is always raised after the retries
for i in range(API_RETRY_TIMES): # noqa: RET503
try:
return await func(*func_args)
except client_exceptions.ClientError as exception:

View File

@ -100,7 +100,7 @@ class RecorderPool(SingletonThreadPool, NullPool):
# which is allowed but discouraged since its much slower
return self._do_get_db_connection_protected()
# In the event loop, raise an exception
raise_for_blocking_call(
raise_for_blocking_call( # noqa: RET503
self._do_get_db_connection_protected,
strict=True,
advise_msg=ADVISE_MSG,

View File

@ -149,7 +149,8 @@ def get_codec_string(mp4_bytes: bytes) -> str:
def find_moov(mp4_io: BufferedIOBase) -> int:
"""Find location of moov atom in a BufferedIOBase mp4."""
index = 0
while 1:
# Ruff doesn't understand this loop - the exception is always raised at the end
while 1: # noqa: RET503
mp4_io.seek(index)
box_header = mp4_io.read(8)
if len(box_header) != 8 or box_header[0:4] == b"\x00\x00\x00\x00":

View File

@ -818,10 +818,7 @@ ignore = [
"ISC001",
# Disabled because ruff does not understand type of __all__ generated by a function
"PLE0605",
# temporarily disabled
"RET503"
"PLE0605"
]
[tool.ruff.lint.flake8-import-conventions.extend-aliases]