File: //var/opt/nydus/ops/primordial/__pycache__/jsonutils.cpython-39.pyc
a
�,�h� � @ s d dl Z d dlZd dlmZmZ d dlZd dlZd dlmZ d dlm Z m
Z
mZ d dlm
Z d dlmZ d dlmZ dZd Ze�e�Zee e f ee e f ed
�dd�Zee e f ed
�dd�Ze
ed�dd�Zee
d�dd�ZG dd� de�Ze�d�Z G dd� de�Z!dS )� N)�JSONEncoder�JSONDecoder)�
import_module)�Any�Callable�Dict)�validate)�
exceptions)�CANONICAL_TIMESTRING_FORMATg �?� )� json_dict�schema_dict�returnc C sD | dusJ �|dusJ �zt | |� W dS tjy> Y dS 0 dS )a Test that json_dict dictionary conforms to the swagger schema provided.
:param json_dict: A dictionary of values
:param schema_dict: A dict representation of swagger schema
:returns: True or False
:raises AssertionError: if either is None
NTF)�
json_validate�json_exceptionsZValidationError)r r
� r �E/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/primordial/jsonutils.py�validate_swagger s
r )r r c C s t j| tddd�S )aY Return a pretty-formatted string containing the values in json_dict.
:param json_dict: A dictionary or other object that is serializable as a json string
:returns: a (unicode) string representation with a default format of sorted keys and indent of 4 spaces
:raises TypeError: if the thing in question cannot be json serialized
T)�,�:)�cls� sort_keys�
separators)�json�dumps�DateTimeEncoder)r r r r �pretty_json_str&