Compare commits
13 commits
071bc8cc8d
...
001ab5edef
Author | SHA1 | Date | |
---|---|---|---|
![]() |
001ab5edef | ||
![]() |
532df976db | ||
![]() |
3c0960766c | ||
![]() |
ad579d79a6 | ||
![]() |
f3375348c9 | ||
![]() |
1320f6fcb3 | ||
![]() |
b9b025a316 | ||
![]() |
c71221f16c | ||
![]() |
a72ef99f78 | ||
![]() |
717811a888 | ||
![]() |
fb818b2c74 | ||
![]() |
885588910a | ||
![]() |
606a60b1c0 |
1 changed files with 5 additions and 3 deletions
8
nodes.py
8
nodes.py
|
@ -1,5 +1,6 @@
|
|||
from os import walk
|
||||
from os.path import join, basename, splitext
|
||||
from re import search
|
||||
|
||||
converters = {
|
||||
'32_random_bytes_as_base64_for': lambda x: vault.random_bytes_as_base64_for(x, length=32),
|
||||
|
@ -10,9 +11,10 @@ converters = {
|
|||
|
||||
def demagify(data):
|
||||
if isinstance(data, str):
|
||||
for name, converter in converters.items():
|
||||
if data.startswith(f'!{name}:'):
|
||||
return converter(data[len(name) + 2:])
|
||||
match = search(r'^\!([0-9a-zA-Z_-]{,255})\:(.*)$', data)
|
||||
if match:
|
||||
magicstring, content = match.groups()
|
||||
return converters[magicstring](content)
|
||||
else:
|
||||
return data
|
||||
elif isinstance(data, dict):
|
||||
|
|
Loading…
Reference in a new issue