From 6e5bbec74901856a24489e690e30303fab846cce Mon Sep 17 00:00:00 2001 From: MidnightCrowing <110297461+MidnightCrowing@users.noreply.github.com> Date: Sat, 28 Sep 2024 22:43:10 +0800 Subject: [PATCH] style(config): refactor Enums and Serializers with region annotations --- src/utils/config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/config.py b/src/utils/config.py index d75f23b..200de6b 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -59,7 +59,7 @@ def __str__(self): def doubleValue(self): return self.value / self.scaling_multiplier - +# region Enums # 语言 class Language(Enum): """ Language enumeration """ @@ -129,8 +129,9 @@ class UpscalerName(Enum): SCUNET = "ScuNet" SCUNET_PSNR = "ScuNet PSNR" SWINIR_4X = "SwinIR_4x" +# endregion - +# region Serializers class LanguageSerializer(ConfigSerializer): """ Language serializer """ @@ -214,6 +215,7 @@ def deserialize(self, value: str) -> UpscalerName: return member # 如果没有匹配的,抛出异常或返回一个默认值 raise ValueError(f"Unknown upscaler name: {value}") +# endregion class Config(QConfig):