From c2d5baa34d74a203527f8623b75c356216373fa2 Mon Sep 17 00:00:00 2001 From: Tobias Leuschner Date: Sat, 7 Mar 2026 12:18:32 +0100 Subject: [PATCH] fix: move global declaration to top of main() in api.py --- fichero/api.py | 3 ++- fichero_printer/fichero/api.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fichero/api.py b/fichero/api.py index bc0f9ce..f916e2b 100644 --- a/fichero/api.py +++ b/fichero/api.py @@ -252,6 +252,8 @@ async def print_image( def main() -> None: """Start the Fichero HTTP API server.""" + global _DEFAULT_ADDRESS, _DEFAULT_CLASSIC, _DEFAULT_CHANNEL + try: import uvicorn # noqa: PLC0415 except ImportError: @@ -272,7 +274,6 @@ def main() -> None: args = parser.parse_args() # Push CLI overrides into module-level defaults so all handlers pick them up - global _DEFAULT_ADDRESS, _DEFAULT_CLASSIC, _DEFAULT_CHANNEL _DEFAULT_ADDRESS = args.address _DEFAULT_CLASSIC = args.classic _DEFAULT_CHANNEL = args.channel diff --git a/fichero_printer/fichero/api.py b/fichero_printer/fichero/api.py index bc0f9ce..f916e2b 100644 --- a/fichero_printer/fichero/api.py +++ b/fichero_printer/fichero/api.py @@ -252,6 +252,8 @@ async def print_image( def main() -> None: """Start the Fichero HTTP API server.""" + global _DEFAULT_ADDRESS, _DEFAULT_CLASSIC, _DEFAULT_CHANNEL + try: import uvicorn # noqa: PLC0415 except ImportError: @@ -272,7 +274,6 @@ def main() -> None: args = parser.parse_args() # Push CLI overrides into module-level defaults so all handlers pick them up - global _DEFAULT_ADDRESS, _DEFAULT_CLASSIC, _DEFAULT_CHANNEL _DEFAULT_ADDRESS = args.address _DEFAULT_CLASSIC = args.classic _DEFAULT_CHANNEL = args.channel