aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/hrc
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2024-06-27 21:14:56 +0800
committer简律纯 <i@jyunko.cn>2024-06-27 21:14:56 +0800
commite8fc106776d066e4d8f36e6ea84e5cc98742abff (patch)
treed78b25f38261890abb397b9e588604d31e525ff4 /hrc
parenta0ebfdc2cf5f37c40caedcd1dfdcef9660b08f69 (diff)
downloadHydroRollCore-e8fc106776d066e4d8f36e6ea84e5cc98742abff.tar.gz
HydroRollCore-e8fc106776d066e4d8f36e6ea84e5cc98742abff.zip
feat(rules): add decorator: aliases for class attribute property
Diffstat (limited to 'hrc')
-rw-r--r--hrc/rules/__init__.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/hrc/rules/__init__.py b/hrc/rules/__init__.py
index a32b693..ff1c230 100644
--- a/hrc/rules/__init__.py
+++ b/hrc/rules/__init__.py
@@ -1,3 +1,4 @@
+import functools
from typing import Generic, Any, Type
from abc import ABC
@@ -8,5 +9,11 @@ from ..typing import RulesT
class Rules(ABC, Generic[RulesT]):
...
-
-
+
+
+def aliases(names, ignore_case=False):
+ def decorator(func):
+ func._aliases = names
+ func._ignore_case = ignore_case
+ return func
+ return decorator