diff options
| author | 2024-06-27 21:14:56 +0800 | |
|---|---|---|
| committer | 2024-06-27 21:14:56 +0800 | |
| commit | e8fc106776d066e4d8f36e6ea84e5cc98742abff (patch) | |
| tree | d78b25f38261890abb397b9e588604d31e525ff4 /hrc | |
| parent | a0ebfdc2cf5f37c40caedcd1dfdcef9660b08f69 (diff) | |
| download | HydroRollCore-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__.py | 11 |
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 |
