openapi-core/openapi_core/schema/schemas/util.py

15 lines
262 B
Python
Raw Normal View History

2018-04-17 12:18:40 +00:00
"""OpenAPI core schemas util module"""
from distutils.util import strtobool
2018-07-28 20:57:49 +00:00
from json import dumps
2018-04-17 12:18:40 +00:00
def forcebool(val):
if isinstance(val, str):
val = strtobool(val)
return bool(val)
2018-07-28 20:57:49 +00:00
def dicthash(d):
return hash(dumps(d, sort_keys=True))