aboutsummaryrefslogtreecommitdiff
path: root/api/ruleset.py
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-04-11 17:50:58 +0200
committerlonkaars <l.leblansch@gmail.com>2021-04-11 17:50:58 +0200
commit28f104de9ae9abe4b42abafbf3865ede5687996c (patch)
tree65e651f09d8fbf81380384692e45803cb4f9d61c /api/ruleset.py
parent7b4859059b3bbabf4139ccdf3270a82c094f5d8e (diff)
dprint yapf python formatting
Diffstat (limited to 'api/ruleset.py')
-rw-r--r--api/ruleset.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/api/ruleset.py b/api/ruleset.py
index b42b4e9..92c7077 100644
--- a/api/ruleset.py
+++ b/api/ruleset.py
@@ -15,23 +15,23 @@ rulesets = {
}
}
+
# resolve ruleset from ruleset name or dict
def resolve_ruleset(ruleset):
- # create return variable
- export = {}
- try:
- # try to parse the ruleset as json
- export = json.loads(ruleset)
- merged = dict(rulesets["default"])
-
- # fill missing keys in dict
- merge(merged, export)
- export = merged
- except ValueError as e:
- # if the ruleset is a name like 'default' or 'columns+2', read it from the predefined rulesets
- if ruleset in rulesets:
- export = rulesets[ruleset]
- if not export:
- export = rulesets["default"]
- return export
+ # create return variable
+ export = {}
+ try:
+ # try to parse the ruleset as json
+ export = json.loads(ruleset)
+ merged = dict(rulesets["default"])
+ # fill missing keys in dict
+ merge(merged, export)
+ export = merged
+ except ValueError as e:
+ # if the ruleset is a name like 'default' or 'columns+2', read it from the predefined rulesets
+ if ruleset in rulesets:
+ export = rulesets[ruleset]
+ if not export:
+ export = rulesets["default"]
+ return export