From 7e520e685a2c0ce3dda62d7f5c3a649b4ef1f2ab Mon Sep 17 00:00:00 2001 From: hofee Date: Tue, 2 Sep 2025 16:29:28 +0800 Subject: [PATCH] change PyappApplication to PyApplication --- pyapp/application.py | 8 ++++---- pyapp/boot.py | 8 ++++---- pyapp/ui/server/app.py | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pyapp/application.py b/pyapp/application.py index bc683f0..0ba10eb 100644 --- a/pyapp/application.py +++ b/pyapp/application.py @@ -1,11 +1,11 @@ from pyapp.utils.log import Log application_class = {} -def PyappApplication(arg=None): +def PyApplication(arg=None): if callable(arg): cls = arg if "default" in application_class: - Log.error("Multiple classes annotated with default @PyappApplication, require a 'name' parameter.", True) + Log.error("Multiple classes annotated with default @PyApplication, require a 'name' parameter.", True) application_class["default"] = cls return cls @@ -13,9 +13,9 @@ def PyappApplication(arg=None): name = arg def decorator(cls): if name is None: - raise Log.error("The 'name' parameter is required when using @PyappApplication with arguments.", True) + raise Log.error("The 'name' parameter is required when using @PyApplication with arguments.", True) if name in application_class: - raise Log.error(f"Multiple classes annotated with @PyappApplication with the same name '{name}' found.", True) + raise Log.error(f"Multiple classes annotated with @PyApplication with the same name '{name}' found.", True) application_class[name] = cls return cls return decorator diff --git a/pyapp/boot.py b/pyapp/boot.py index 709b1cc..06c9b7c 100644 --- a/pyapp/boot.py +++ b/pyapp/boot.py @@ -17,19 +17,19 @@ def run(): app_name = "default" if len(application_class) == 0: - Log.error("No class annotated with @PyappApplication found.", True) + Log.error("No class annotated with @PyApplication found.", True) if len(sys.argv) < 3 and "default" not in application_class: - Log.error("No default @PyappApplication found. Please specify the 'name' parameter.", True) + Log.error("No default @PyApplication found. Please specify the 'name' parameter.", True) if len(sys.argv) == 3: app_name = sys.argv[2] app_cls = application_class.get(app_name) if app_cls is None: - Log.error(f"No class annotated with @PyappApplication found with the name '{app_name}'.", True) + Log.error(f"No class annotated with @PyApplication found with the name '{app_name}'.", True) if not hasattr(app_cls, "start"): - Log.error("The class annotated with @PyappApplication should have a 'start' method.", True) + Log.error("The class annotated with @PyApplication should have a 'start' method.", True) Log.info(f"Application '{app_cls.__name__}' started.") timer = Timer(f"Application({app_name})") diff --git a/pyapp/ui/server/app.py b/pyapp/ui/server/app.py index fc8d82e..3a5d3d5 100644 --- a/pyapp/ui/server/app.py +++ b/pyapp/ui/server/app.py @@ -66,7 +66,7 @@ def run_application(): if app_cls is None: Log.error( - f"No class annotated with @PyappApplication found with the name '{app_name}'.", + f"No class annotated with @PyApplication found with the name '{app_name}'.", True, ) return jsonify( @@ -78,7 +78,7 @@ def run_application(): if not hasattr(app_cls, "start"): Log.error( - "The class annotated with @PyappApplication should have a 'start' method.", + "The class annotated with @PyApplication should have a 'start' method.", True, ) return jsonify(