Skip to content

Commit

Permalink
Made code more tidy, according to PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
palsmo authored and Grokzen committed Oct 31, 2023
1 parent 4fb3b7b commit ba66b48
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pykwalify/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1154,20 +1154,19 @@ def init_mapping_value(self, v, rule, path):
if str(k).startswith("regex;") or str(k).startswith("re;"):
log.debug(u"Found regex map rule")
regex = k.split(";", 1)

if len(regex) != 2:
raise RuleError(
msg=u"Value: '{0}' for keyword regex is malformed".format(k),
error_key=u"mapping.regex.malformed",
path=path,
)

elif not regex[1].startswith('(') or not regex[1].endswith(')'):
raise RuleError(
msg=u"Regex '{0}' should start and end with parentheses".format(regex[1]),
error_key=u"mapping.regex.missing_parentheses",
path=path,
)

else:
regex = regex[1]
try:
Expand Down

0 comments on commit ba66b48

Please sign in to comment.