Ejemplo n.º 1
0
def parse_icon(d, path):
    check_allowed_properties(d, path, ("type", "name", "color"))
    check_required_properties(d, path, ("type", "name"))
    check_text(d['name'], path + ".name")

    if 'color' in d:
        check_color(d['color'], path + ".color")
Ejemplo n.º 2
0
def parse_document(d):
    check_allowed_properties(d, "#", ("version", "title", "elements"))
    check_required_properties(d, "#", ("version", "title", "elements"))

    check_version(d['version'], "#version")
    check_text(d['title'], "#title")
    parse_elements(d['elements'], "#elements")
Ejemplo n.º 3
0
def parse_text(d, path):
    check_allowed_properties(d, path, ("type", "text", "emphasis", "color"))
    check_required_properties(d, path, ("type", "text"))

    check_text(d['text'], path + ".text")

    if 'emphasis' in d:
        if d['emphasis'] not in ("bold", "italic"):
            raise ValidationError(path + ".emphasis", "not a valid value")

    if 'color' in d:
        check_color(d['color'], path + ".color")
Ejemplo n.º 4
0
def parse_pie(d, path):
    check_allowed_properties(d, path, ("type", "data", "name"))
    check_required_properties(d, path, ("type", "data", "name"))
    check_text(d['name'], path + ".name")

    for i in range(0, len(d['data'])):
        elem = d['data'][i]
        p = "%s.data[%s]" % (path, i)

        check_allowed_properties(elem, p, ("label", "value", "color"))
        check_required_properties(elem, p, ("label", "value", "color"))

        check_text(elem['label'], p + ".label")
        check_number(elem['value'], p + ".value")
        check_color(elem['color'], p + ".color")
Ejemplo n.º 5
0
def parse_heading(d, path):
    check_allowed_properties(d, path, ("type", "text"))
    check_required_properties(d, path, ("type", "text"))
    check_text(d['text'], path + ".text")