fix: move global declaration to top of main() in api.py
This commit is contained in:
@@ -252,6 +252,8 @@ async def print_image(
|
|||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
"""Start the Fichero HTTP API server."""
|
"""Start the Fichero HTTP API server."""
|
||||||
|
global _DEFAULT_ADDRESS, _DEFAULT_CLASSIC, _DEFAULT_CHANNEL
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import uvicorn # noqa: PLC0415
|
import uvicorn # noqa: PLC0415
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -272,7 +274,6 @@ def main() -> None:
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Push CLI overrides into module-level defaults so all handlers pick them up
|
# 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_ADDRESS = args.address
|
||||||
_DEFAULT_CLASSIC = args.classic
|
_DEFAULT_CLASSIC = args.classic
|
||||||
_DEFAULT_CHANNEL = args.channel
|
_DEFAULT_CHANNEL = args.channel
|
||||||
|
|||||||
@@ -252,6 +252,8 @@ async def print_image(
|
|||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
"""Start the Fichero HTTP API server."""
|
"""Start the Fichero HTTP API server."""
|
||||||
|
global _DEFAULT_ADDRESS, _DEFAULT_CLASSIC, _DEFAULT_CHANNEL
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import uvicorn # noqa: PLC0415
|
import uvicorn # noqa: PLC0415
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -272,7 +274,6 @@ def main() -> None:
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Push CLI overrides into module-level defaults so all handlers pick them up
|
# 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_ADDRESS = args.address
|
||||||
_DEFAULT_CLASSIC = args.classic
|
_DEFAULT_CLASSIC = args.classic
|
||||||
_DEFAULT_CHANNEL = args.channel
|
_DEFAULT_CHANNEL = args.channel
|
||||||
|
|||||||
Reference in New Issue
Block a user