-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NameError in docs example for KeyValidator #178
Comments
No, this seems like a bug. Thanks for reporting ill take a look.
…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: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: