You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Tue, 12 Apr 2022, 19:35 jrom99, ***@***.***> wrote:
The example code in docs page for Key Validator
<https://hitchdev.com/strictyaml/using/alpha/compound/mapping-with-slug-keys/>
:
from collections import OrderedDictfrom strictyaml import Map, Optional, Str, Seq, load, ScalarValidator
# This example uses slugify from the "python-slugify" packagefrom slugify import slugify
yaml_snippet = """Name: United Kingdomcountry-code: GBDIAL CODE: +44official languages:- English- Welsh"""
class Slug(ScalarValidator):
def validate_scalar(self, chunk):
return slugify(unicode(chunk.contents))
schema = Map({
"name": Str(),
Optional("country-code"): Str(),
"dial-code": Str(),
"official-languages": Seq(Str())
}, key_validator=Slug())
load(yaml_snippet, schema)
raises NameError: name 'unicode' is not defined
Is it supposed to happen? Where should unicode come from?
—
Reply to this email directly, view it on GitHub
<#178>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABOJKNNMJWOH3VZ4L2KK7Z3VEW7ATANCNFSM5TIFYUPQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
The example code in docs page for Key Validator:
raises
NameError: name 'unicode' is not defined
Is it supposed to happen? Where should
unicode
come from?The text was updated successfully, but these errors were encountered: