Closed
Description
I've noticed that with PyYAML 5.1 implicit resolvers do not seem to work at all. Using this example script:
import re
import uuid
import yaml
regex = re.compile(r'^UUID\((.+)\)$')
yaml.add_implicit_resolver('!uuid', regex)
def convert_uuid(loader, node):
value = loader.construct_scalar(node)
str_value = regex.match(value).group(1)
return uuid.UUID(str_value)
yaml.add_constructor('!uuid', convert_uuid)
print(yaml.load('''
config:
abc: UUID(6a02171e-6482-11e9-ab43-f2189845f1cc)
def: abc
'''))
I confirmed that w/ 3.13 we correctly get the uuid.UUID
object, while it is a string with 5.1 is it just the string 'UUID(6a02171e-6482-11e9-ab43-f2189845f1cc)'
. The way I found this was that it broke the environment variable interpolation that elasticsearch-curator
provides.
Sorry if this is a duplicate, I searched around and could not find an equivalent issue.
Metadata
Metadata
Assignees
Labels
No labels