Coverage for jsonsubschema/_constants.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1'''
2Created on June 7, 2019
3@author: Andrew Habib
4'''
6import operator
7from functools import reduce
10Jnumeric = set(["integer", "number"])
12Jtypes = Jnumeric.union(["string", "boolean", "null", "array", "object"])
14JtypesToKeywords = {
15 "string": ["minLength", "maxLength", "pattern"],
16 "number": ["minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "multipleOf"],
17 "integer": ["minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "multipleOf"],
18 "boolean": [],
19 "null": [],
20 "array": ["minItems", "maxItems", "items", "additionalItems", "uniqueItems"],
21 "object": ["properties", "additionalProperties", "required", "minProperties", "maxProperties", "dependencies", "patternProperties"]
22}
24Jconnectors = set(["anyOf", "allOf", "oneOf", "not"])
26Jcommonkw = Jconnectors.union(["enum", "type"])
28JNonValidation = set(["$schema", "$id", "definitions", "title", "description", "format"])
30Jkeywords = Jcommonkw.union(Jtypes,
31 reduce(operator.add, JtypesToKeywords.values())).union(["$ref"])
32 # .union(JNonValidation) # conflicts with canonicalize_connectors
34JtypesToPyTypes = {"integer": int, "number": float, "string": str,
35 "boolean": bool, "null": type(None), "array": list, "object": dict}
37PyTypesToJtypes = dict([(v, k) for k, v in JtypesToPyTypes.items()])