Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 12, 2024
1 parent 547abc0 commit 428be1f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions plugins/action/update_fact.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,24 @@ def _field_split(path):
que = path
fields = []
# regex match dotted values and square brackets
regex = re.compile(r'^[^\[\].]+|^\[[\'\"].+?[\'\"]\]|^\[.+?\]')
while (regex.match(que)):
regex = re.compile(r"^[^\[\].]+|^\[[\'\"].+?[\'\"]\]|^\[.+?\]")
while regex.match(que):
m = regex.match(que)
# remove outer square brackets
field = re.sub(r'(^\[)|(\]$)', "", que[m.start():m.end()])
field = re.sub(r"(^\[)|(\]$)", "", que[m.start() : m.end()])
try:
# make numbers numbers
fields.append(ast.literal_eval(field))
except Exception:
# or strip the quotes
fields.append(re.sub("['\"]", "", field))
try:
if que[m.end()] == '.':
que = que[m.end() + 1:]
if que[m.end()] == ".":
que = que[m.end() + 1 :]
else:
que = que[m.end():]
que = que[m.end() :]
except IndexError:
que = ''
que = ""
return fields

def set_value(self, obj, path, val):
Expand Down

0 comments on commit 428be1f

Please sign in to comment.