관리-도구
편집 파일: serialize.cpython-35.pyc
��Re� � @ s� d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z m Z m Z d d � Z d d � Z Gd d � d e � Z d S)� N)�msgpack)�CaseInsensitiveDict� )�HTTPResponse�pickle� text_typec C s t j | j d � � S)N�ascii)�base64� b64decode�encode)�b� r ��/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/serialize.py�_b64_decode_bytes s r c C s t | � j d � S)N�utf8)r �decode)�sr r r �_b64_decode_str s r c @ ss e Z d Z d d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d S)� SerializerNc C sO t | j � } | d k r? | j d d � } t j | � | _ d d | d t d d � | j j � D� � d | j d | j d t | j � d | j d | j i i } i | d <d | k r-| d j d � } x[ | D]S } t | � j � } | j j | d � } | d k rt | � } | | d | <q� Wd j d t j | d d �g � S)N�decode_contentF�response�body�headersc s s- | ]# \ } } t | � t | � f Vq d S)N)r )�.0�k�vr r r � <genexpr>3 s z#Serializer.dumps.<locals>.<genexpr>�status�version�reason�strict�vary�,� ,s cc=4�use_bin_typeT)r r �read�io�BytesIO�_fp�dict�itemsr r r r r r �split�strip�get�joinr �dumps) �self�requestr r �response_headers�data�varied_headers�header�header_valuer r r r/ s. zSerializer.dumpsc C s� | s d Sy | j d d � \ } } Wn t k r@ d } Yn X| d d � d k rg | | } d } | j d d � d j d � } y# t | d j | � � | | � SWn t k r� d SYn Xd S) Nr# r s cc=0� s cc=� =r z _loads_v{}���)r+ � ValueErrorr �getattr�format�AttributeError)r0 r1 r3 �verr r r �loadsJ s # zSerializer.loadsc C s d | j d i � k r d SxE | j d i � j � D]+ \ } } | j j | d � | k r5 d Sq5 W| d j d � } t d | d d � } | j d d � d k r� | j d � | | d d <y t j | � } Wn* t k r t j | j d � � } Yn Xt d | d d | d � S)z`Verify our vary headers match and construct a real urllib3 HTTPResponse object. �*r! Nr r r3 r ztransfer-encoding� �chunkedr �preload_contentF) r- r* r �popr r&