Skip to content

Commit

Permalink
style(config): refactor Enums and Serializers with region annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
MidnightCrowing committed Sep 28, 2024
1 parent 535a640 commit 6e5bbec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __str__(self):
def doubleValue(self):
return self.value / self.scaling_multiplier


# region Enums
# 语言
class Language(Enum):
""" Language enumeration """
Expand Down Expand Up @@ -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 """

Expand Down Expand Up @@ -214,6 +215,7 @@ def deserialize(self, value: str) -> UpscalerName:
return member
# 如果没有匹配的,抛出异常或返回一个默认值
raise ValueError(f"Unknown upscaler name: {value}")
# endregion


class Config(QConfig):
Expand Down

0 comments on commit 6e5bbec

Please sign in to comment.