2018-04-17 12:18:40 +00:00
|
|
|
"""OpenAPI core schemas util module"""
|
|
|
|
from distutils.util import strtobool
|
2019-10-25 23:34:42 +00:00
|
|
|
from six import string_types
|
2018-07-28 20:57:49 +00:00
|
|
|
from json import dumps
|
2018-04-17 12:18:40 +00:00
|
|
|
|
2019-07-14 03:25:40 +00:00
|
|
|
from openapi_core.schema.schemas.enums import UnmarshalContext
|
|
|
|
from openapi_core.schema.schemas.exceptions import UnmarshalContextNotSet
|
|
|
|
|
2018-04-17 12:18:40 +00:00
|
|
|
|
|
|
|
def forcebool(val):
|
2018-07-15 21:21:15 +00:00
|
|
|
if isinstance(val, string_types):
|
2018-04-17 12:18:40 +00:00
|
|
|
val = strtobool(val)
|
|
|
|
|
|
|
|
return bool(val)
|
2018-07-28 20:57:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
def dicthash(d):
|
|
|
|
return hash(dumps(d, sort_keys=True))
|