File manager - Edit - /opt/gsutil/third_party/apitools/apitools/base/protorpclite/__pycache__/protojson.cpython-39.pyc
Back
a vyg�4 � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlmZ g d�Z dd� Z e � ZG d d � d ej�Z G dd� de�ZejZejZe�� jZe�� jZdS ) z�JSON support for message types. Public classes: MessageJSONEncoder: JSON encoder for message objects. Public functions: encode_message: Encodes a message in to a JSON string. decode_message: Merge from a JSON string in to a message. � N)� message_types)�messages)�util)�ALTERNATIVE_CONTENT_TYPES�CONTENT_TYPE�MessageJSONEncoder�encode_message�decode_message� ProtoJsonc C s� d} dD ]t}zBt |i i d�}t|d�sBd| }t�|� t|��n |W S W q tyz } z| sf|} W Y d}~qd}~0 0 qt�d� | �dS )a Try to load a valid json module. There are more than one json modules that might be installed. They are mostly compatible with one another but some versions may be different. This function attempts to load various json modules in a preferred order. It does a basic check to guess if a loaded version of json is compatible. Returns: Compatible json module. Raises: ImportError if there are no json modules or the loaded json module is not compatible with ProtoRPC. N)�jsonZ simplejsonr �JSONEncoderz1json library "%s" is not compatible with ProtoRPCz0Must use valid json library (json or simplejson))� __import__�hasattr�logging�warning�ImportError�error)Zfirst_import_error�module_name�module�message�err� r �H/opt/gsutil/third_party/apitools/apitools/base/protorpclite/protojson.py�_load_json_module/ s"