Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
pykwalify.partial_schemas = {}
def setUp(self):
pykwalify.partial_schemas = {}
def setUp(self):
pykwalify.partial_schemas = {}
def setUp(self):
pykwalify.partial_schemas = {}
def _start_validate(self, value=None):
"""
"""
path = ""
self.errors = []
done = []
s = {}
# Look for schema; tags so they can be parsed before the root rule is parsed
for k, v in self.schema.items():
if k.startswith("schema;"):
log.debug(u"Found partial schema; : %s", v)
r = Rule(schema=v)
log.debug(u" Partial schema : %s", r)
pykwalify.partial_schemas[k.split(";", 1)[1]] = r
else:
# readd all items that is not schema; so they can be parsed
s[k] = v
self.schema = s
log.debug(u"Building root rule object")
root_rule = Rule(schema=self.schema)
self.root_rule = root_rule
log.debug(u"Done building root rule")
log.debug(u"Root rule: %s", self.root_rule)
self._validate(value, root_rule, path, done)
"map",
)
for k, rr in m.items():
# Handle if the value of the key contains a include keyword
if rr.include_name is not None:
include_name = rr.include_name
partial_schema_rule = pykwalify.partial_schemas.get(include_name)
if not partial_schema_rule:
self.errors.append(SchemaError.SchemaErrorEntry(
msg=u"Cannot find partial schema with name '{include_name}'. Existing partial schemas: '{existing_schemas}'. Path: '{path}'",
path=path,
value=value,
include_name=include_name,
existing_schemas=", ".join(sorted(pykwalify.partial_schemas.keys()))))
return
rr = partial_schema_rule
# Find out if this is a regex rule
is_regex_rule = False
required_regex = ""
for regex_rule in rule.regex_mappings:
if k == "regex;({})".format(regex_rule.map_regex_rule) or k == "re;({})".format(regex_rule.map_regex_rule):
is_regex_rule = True
required_regex = regex_rule.map_regex_rule
# Check for the presense of the required key
is_present = False
if not is_regex_rule:
is_present = k in value