829e95d674
Refactor `app/api/audit_logs.py` to use the `Annotated` type hint pattern while maintaining default values for dependencies using module-level singletons. - Resolves B008: Function-call in default argument. - Maintains compatibility with decorators (e.g., `@require_login`) that call the function without explicitly providing the `db` argument. - Uses standard FastAPI patterns for query parameters with constant defaults. - No changes to API runtime behavior. Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
17 lines
323 B
Python
17 lines
323 B
Python
from typing import Annotated
|
|
|
|
def Query(default=None, **kwargs):
|
|
return default
|
|
|
|
def Depends(dependency=None):
|
|
return dependency
|
|
|
|
def get_db():
|
|
return None
|
|
|
|
def test_func(
|
|
db: Annotated[int, Depends(get_db)] = Depends(),
|
|
action: Annotated[str | None, Query(None, description="test")] = None
|
|
):
|
|
pass
|