mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Enable implicit-return (RET503) rule in ruff (#122771)
This commit is contained in:
parent
0bb8c4832d
commit
e64ca7c274
@ -50,7 +50,8 @@ PLATFORMS = [Platform.LIGHT, Platform.MEDIA_PLAYER]
|
|||||||
|
|
||||||
async def call_c4_api_retry(func, *func_args):
|
async def call_c4_api_retry(func, *func_args):
|
||||||
"""Call C4 API function and retry on failure."""
|
"""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:
|
try:
|
||||||
return await func(*func_args)
|
return await func(*func_args)
|
||||||
except client_exceptions.ClientError as exception:
|
except client_exceptions.ClientError as exception:
|
||||||
|
@ -100,7 +100,7 @@ class RecorderPool(SingletonThreadPool, NullPool):
|
|||||||
# which is allowed but discouraged since its much slower
|
# which is allowed but discouraged since its much slower
|
||||||
return self._do_get_db_connection_protected()
|
return self._do_get_db_connection_protected()
|
||||||
# In the event loop, raise an exception
|
# In the event loop, raise an exception
|
||||||
raise_for_blocking_call(
|
raise_for_blocking_call( # noqa: RET503
|
||||||
self._do_get_db_connection_protected,
|
self._do_get_db_connection_protected,
|
||||||
strict=True,
|
strict=True,
|
||||||
advise_msg=ADVISE_MSG,
|
advise_msg=ADVISE_MSG,
|
||||||
|
@ -149,7 +149,8 @@ def get_codec_string(mp4_bytes: bytes) -> str:
|
|||||||
def find_moov(mp4_io: BufferedIOBase) -> int:
|
def find_moov(mp4_io: BufferedIOBase) -> int:
|
||||||
"""Find location of moov atom in a BufferedIOBase mp4."""
|
"""Find location of moov atom in a BufferedIOBase mp4."""
|
||||||
index = 0
|
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)
|
mp4_io.seek(index)
|
||||||
box_header = mp4_io.read(8)
|
box_header = mp4_io.read(8)
|
||||||
if len(box_header) != 8 or box_header[0:4] == b"\x00\x00\x00\x00":
|
if len(box_header) != 8 or box_header[0:4] == b"\x00\x00\x00\x00":
|
||||||
|
@ -818,10 +818,7 @@ ignore = [
|
|||||||
"ISC001",
|
"ISC001",
|
||||||
|
|
||||||
# Disabled because ruff does not understand type of __all__ generated by a function
|
# Disabled because ruff does not understand type of __all__ generated by a function
|
||||||
"PLE0605",
|
"PLE0605"
|
||||||
|
|
||||||
# temporarily disabled
|
|
||||||
"RET503"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
|
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user