D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3.9
/
site-packages
/
ipalib
/
__pycache__
/
Filename :
ipajson.cpython-39.opt-1.pyc
back
Copy
a ��i � @ s� d dl Z d dlmZ d dlZd dlmZ d dlZd dlZd dl m Z d dlmZmZ d dl mZ d dlmZ d dlmZ d d lmZ ejr�eZG d d� de�Zdd d�Zejefdd�Zdd� ZdS )� N)�x509)�Decimal)�LDAP_GENERALIZED_TIME_FORMAT)�capabilitiesr )�Encoding)�DN)�DNSName)� Principalc s~ e Zd ZdZdZe� Zef� fdd� Zdd� Zefdd�Z d d � Z dd� Zd d� Zefdd�Z eejfdd�Zdd� Z� ZS )�_JSONPrimera� Fast JSON primer and pre-converter Prepare a data structure for JSON serialization. In an ideal world, priming could be handled by the default hook of json.dumps(). Unfortunately the hook treats Python 2 str as text while IPA considers str as bytes. The primer uses a couple of tricks to archive maximum performance: * O(1) type look instead of O(n) chain of costly isinstance() calls * __missing__ and __mro__ with caching to handle subclasses * inline code with minor code duplication (func lookup in enc_list/dict) * avoid surplus function calls (e.g. func is _identity, obj.__class__ instead if type(obj)) * function default arguments to turn global into local lookups * avoid re-creation of bound method objects (e.g. result.append) * on-demand lookup of client capabilities with cached values Depending on the client version number, the primer converts: * bytes -> {'__base64__': b64encode} * datetime -> {'__datetime__': LDAP_GENERALIZED_TIME} * DNSName -> {'__dns_name__': unicode} The _ipa_obj_hook() functions unserializes the marked JSON objects to bytes, datetime and DNSName. :see: _ipa_obj_hook )�version� _cap_datetime�_cap_dnsnamec "