core: Add ruff rule FBT003 (boolean-trap) (#29424)

See
https://docs.astral.sh/ruff/rules/boolean-positional-value-in-call/#boolean-positional-value-in-call-fbt003
This PR also fixes some FBT001/002 in private methods but does not
enforce these rules globally atm.

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
Christophe Bornet
2025-04-01 19:40:12 +02:00
committed by GitHub
parent 4f8ea13cea
commit 558191198f
15 changed files with 63 additions and 45 deletions

View File

@@ -41,7 +41,7 @@ async def test_inline_handlers_share_parent_context() -> None:
called.
"""
def __init__(self, run_inline: bool) -> None:
def __init__(self, *, run_inline: bool) -> None:
"""Initialize the handler."""
self.run_inline = run_inline
@@ -91,7 +91,7 @@ async def test_inline_handlers_share_parent_context_multiple() -> None:
counter_var.reset(token)
class StatefulAsyncCallbackHandler(AsyncCallbackHandler):
def __init__(self, name: str, run_inline: bool = True):
def __init__(self, name: str, *, run_inline: bool = True):
self.name = name
self.run_inline = run_inline