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੐)|#o0aڱ$I>}k&1`U#V?YsV x>{t1[I~D&(I$I/{H0fw"q"y%4 IXyE~M3 8XψL}qE$I[> nD?~sf ]o΁ cT6"?'_Ἣ $I>~.f|'!N?⟩0G KkXZE]ޡ;/&?k OۘH$IRۀwXӨ<7@PnS04aӶp.:@\IWQJ6sS%I$e5ڑv`3:x';wq_vpgHyXZ 3gЂ7{{EuԹn±}$I$8t;b|591nءQ"P6O5i }iR̈́%Q̄p!I䮢]O{H$IRϻ9s֧ a=`- aB\X0"+5"C1Hb?߮3x3&gşggl_hZ^,`5?ߎvĸ%̀M!OZC2#0x LJ0 Gw$I$I}<{Eb+y;iI,`ܚF:5ܛA8-O-|8K7s|#Z8a&><a&/VtbtLʌI$I$I$I$I$I$IRjDD%tEXtdate:create2022-05-31T04:40:26+00:00!Î%tEXtdate:modify2022-05-31T04:40:26+00:00|{2IENDB`Mini Shell

HOME


Mini Shell 1.0
DIR:/lib/python3/dist-packages/lazr/restfulclient/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/lazr/restfulclient/__pycache__/resource.cpython-311.pyc
�

9�Jc̷��d�dZeZgd�ZddlmZddlmZddlm	Z	m
Z
	ddlmZm
Z
mZmZmZn#e$rddlmZmZmZddlm
Z
mZYnwxYwdd	lZejdd
kreZeZneZeZddlmZddlmZdd
lm Z m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'e(��Z)Gd�d��Z*Gd�d��Z+Gd�de+��ZGd�de��Z,Gd�de��Z-Gd�de��Z.Gd�de+��Z/Gd�d e��Z0Gd!�d"e��Z1Gd#�d$e1��Z2Gd%�d&e��Z3d	S)'z)Common support for web service resources.)�
Collection�CollectionWithKeyBasedLookup�Entry�NamedOperation�Resource�ServiceRoot�)�Message)�BytesIO)�dumps�loads)�parse_qs�unquote�	urlencode�urljoin�urlparse)rrr
)rrN�)r)�__version__)�Browser�RestfulHttp)�DatetimeJSONEncoder)�	HTTPError)�URIc�&�eZdZdZd�Zdd�Zd�ZdS)�HeaderDictionarya�A dictionary that bridges httplib2's and wadllib's expectations.

    httplib2 expects all header dictionary access to give lowercase
    header names. wadllib expects to access the header exactly as it's
    specified in the WADL file, which means the official HTTP header name.

    This class transforms keys to lowercase before doing a lookup on
    the underlying dictionary. That way wadllib can pass in the
    official header name and httplib2 will get the lowercased name.
    c��||_dS�N)�wrapped_dictionary)�selfrs  �=/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py�__init__zHeaderDictionary.__init__Ks��"4�����Nc�Z�|j�|�����S�z2Retrieve a value, converting the key to lowercase.)r�get�lower)r�key�defaults   rr$zHeaderDictionary.getNs!���&�*�*�3�9�9�;�;�7�7�7r!c�l�|�|t��}|turt|���|Sr#)r$�missing�KeyError)rr&�values   r�__getitem__zHeaderDictionary.__getitem__Rs1������g�&�&���G����3�-�-���r!r)�__name__�
__module__�__qualname__�__doc__r r$r,�r!rrr?sP������	�	�5�5�5�8�8�8�8�����r!rc�"�eZdZdZdZd�Zd�ZdS)�RestfulBasez=Base class for classes that know about lazr.restful services.�application/jsonc��i}|���D]9\}}t|t��r|j}|||�|��<�:|Sr)�items�
isinstancer�	self_link�_get_external_param_name)r�
dictionary�new_dictionaryr&r+s     r�_transform_resources_to_linksz)RestfulBase._transform_resources_to_links_sb����$�*�*�,�,�	G�	G�J�C���%��*�*�
(����AF�N�4�8�8��=�=�>�>��r!c��|S)aTurn a lazr.restful name into something to be sent over HTTP.

        For resources this may involve sticking '_link' or
        '_collection_link' on the end of the parameter name. For
        arguments to named operations, the parameter name is returned
        as is.
        r1�r�
param_names  rr9z$RestfulBase._get_external_param_namegs
���r!N)r-r.r/r0�JSON_MEDIA_TYPEr<r9r1r!rr3r3Zs=������G�G�(�O��������r!r3c�&�eZdZdZd�Ze��Ze��Ze��Ze	d���Z
e	d���Ze	d���Ze	d���Z
e	d���Ze
Zd�Zd	�Zd
�Zd�Ze					dd���Zdd�Zd�Zd�Zd�Zd�Zd�ZdS)rz+Base class for lazr.restful HTTP resources.c�6�|�|}||jd<||jd<dS)z5Initialize with respect to a wadllib Resource object.N�_root�_wadl_resource)�__dict__)r�root�
wadl_resources   rr zResource.__init__us-���<��D�"&��
�g��*7��
�&�'�'�'r!c�6�|�|j��S)z,Name the collections this resource links to.)�_get_parameter_names�FIND_COLLECTIONS�rs r�lp_collectionszResource.lp_collections�s���(�(��)>�?�?�?r!c�6�|�|j��S)z(Name the entries this resource links to.)rI�FIND_ENTRIESrKs r�
lp_entrieszResource.lp_entries�s���(�(��):�;�;�;r!c�6�|�|j��S)z'Name this resource's scalar attributes.)rI�FIND_ATTRIBUTESrKs r�
lp_attributeszResource.lp_attributes�s���(�(��)=�>�>�>r!c��g}|jjD]�}|j���}|dkr|j�ddg��}nW|dkrQdD]4}|j�|��}|�|���}n�5|�|j��}|D])}|jdkr|�|j	��n�*��|S)z.Name all of this resource's custom operations.r$�query�plain�post)�!application/x-www-form-urlencoded�multipart/form-dataN�ws.op)
rD�method_iter�namer%�request�params�get_representation_definition�resolve_definition�append�fixed_value)r�names�methodr[r]�
media_type�
definition�params        r�
lp_operationszResource.lp_operations�s
��
���)�5�	�	�F��;�$�$�&�&�D��u�}�}���.�.���/A�B�B�������#�	�	�J�"(��!M�!M�"�"�"�J�"�-�%/�%B�%B�%D�%D�
���.�$�*�*�4�+>�?�?���
�
���:��(�(��L�L��!2�3�3�3��E�)���r!c�N�|�|j|j|j��S)z;A hook into dir() that returns web service-derived members.)rIrJrNrQrKs r�__members__zResource.__members__�s,���(�(��!�4�#4�d�6J�
�
�	
r!c��g}|j�|j��D]�}|j}|j}|dkrl|�j|jrc|�d��r'|j|vr|�|dd����[|j	|vr|�|dd�����|j
|vr|�|����|S)z2Retrieve some subset of the resource's parameters.r8N�_collection_linki����)rD�
parametersr@r[�link�
can_follow�endswithrJr`rNrQ)r�kindsrb�	parameterr[rns      rrIzResource._get_parameter_names�s������,�7�7��8L�M�M�	'�	'�I��>�D��>�D��{�"�"�t�'7�D�O�'7��=�=�!3�4�4�0��,��5�5����T�$�3�$�Z�0�0�0���(�E�1�1����T�#�2�#�Y�/�/�/���'�5�0�0��L�L��&�&�&���r!c�0�|�|��duS)z8Does this resource have a parameter with the given name?N)r9r>s  r�lp_has_parameterzResource.lp_has_parameter�s���,�,�Z�8�8��D�Dr!c���|���dD]�}|j�||z��}|�h	|���n#t$rY�CwxYw|����dS|j}|�|j||j���cS��|j�|��}|�t	d|z���|���S)z�Get the value of one of the resource's parameters.

        :return: A scalar value if the parameter is not a link. A new
                 Resource object, whose resource is bound to a
                 representation, if the parameter is a link.
        )�_linkrkN)r?zNo such parameter: %s)	�_ensure_representationrD�
get_parameter�	get_valuer*�linked_resource�_create_bound_resourcerCr[)rr?�suffixrfrzs     r�lp_get_parameterzResource.lp_get_parameter�s��	
�#�#�%�%�%�3�	�	�F��'�5�5�j�6�6I�J�J�E�� ���O�O�%�%�%�%�������H������?�?�$�$�,� �4�4�"'�"7���2�2��J��E�J�3������!� �#�1�1�*�=�=���=��2�Z�?�@�@�@���� � � s�A�
A�Ac���d|i}|j�d|���}|�|j�d|���}|�td|z���t|j||��S)z�Get a custom operation with the given name.

        :return: A NamedOperation instance that can be called with
                 appropriate arguments to invoke the operation.
        rYr$)�query_paramsNrV)�representation_paramszNo operation with name: %s)rD�
get_methodr*rrC)r�operation_namer]rcs    r�lp_get_named_operationzResource.lp_get_named_operation�s���>�*���$�/�/��F�/�K�K���>��(�3�3��f�4���F��>��7�.�H�I�I�I��d�j�$��7�7�7r!Nr4Tc�6�|j}t|��d}	t}
|�d��s|�|�d��rt}
|j�|	|
��}|�|�||||���}n	|||��S)aCreate a lazr.restful Resource subclass from a wadllib Resource.

        :param resource: The wadllib Resource to wrap.
        :param representation: A previously fetched representation of
            this resource, to be reused. If not provided, this method
            will act just like the Resource constructor.
        :param representation_media_type: The media type of any previously
            fetched representation.
        :param representation_needs_processing: Set to False if the
            'representation' parameter should be used as
            is.
        :param representation_definition: A wadllib
            RepresentationDefinition object describing the structure
            of this representation. Used in cases when the representation
            isn't the result of sending a standard GET to the resource.
        :param param_name: The name of the link that was followed to get
            to this resource.
        :return: An instance of the appropriate lazr.restful Resource
            subclass.
        ���z-pageNrk)�representation_definition)�type_urlrrrpr�RESOURCE_TYPE_CLASSESr$�bind)�clsrF�resource�representation�representation_media_type�representation_needs_processingr�r?r��
resource_typer'�r_classs            rr{zResource._create_bound_resources���H�$�� ��*�*�2�.�
������W�%�%�	!��"�z�':�':�;M�'N�'N�"� �G��,�0�0���H�H���%� �}�}��)�/�*C�	%���H�H�
��w�t�X�&�&�&r!c��|�||j_i}|�||d<|jj�|j|���}||jjjkrdS|j�||j��|jd<dS)�&Update this resource's representation.Nz
If-None-Match)�headersrD)	rD�_urlrC�_browserr$�NOT_MODIFIEDr�r@rE)r�new_url�etagr�r�s     r�
lp_refreshzResource.lp_refreshHs�����'.�D��$�����'+�G�O�$���,�0�0����1�
�
���T�Z�0�=�=�=��F�+/�*=�*B�*B��D�0�+
�+
��
�&�'�'�'r!c��	|�|��S#t$rYnwxYw	|�|��S#t$rt|�d|�d����wxYw)z@Try to retrive a named operation or parameter of the given name.z object has no attribute '�')r�r*r}�AttributeError)r�attrs  r�__getattr__zResource.__getattr__[s���	��.�.�t�4�4�4���	�	�	��D�	����	��(�(��.�.�.���	�	�	� �59�T�T�4�4�4�@���
�	���s��
$�$�=� Ac��|j�||j��}|j}t	|��dkrd�|D��SdS)z0Find the set of possible values for a parameter.rc��g|]	}|j��
Sr1)r+)�.0�options  r�
<listcomp>z*Resource.lp_values_for.<locals>.<listcomp>os��7�7�7�V�F�L�7�7�7r!N)rDrxr@�options�len)rr?rrr�s    r�
lp_values_forzResource.lp_values_forhsV���'�5�5���,�
�
�	��#���w�<�<�!���7�7�w�7�7�7�7��tr!c�V�dD]%}||z}|j�|��r|cS�&dS)z>What's this parameter's name in the underlying representation?)rvrk�N)rDrx)rr?r|r[s    rr9z!Resource._get_external_param_namersG��7�	�	�F���&�D��"�0�0��6�6�
�����
��tr!c���|jj��|jj�|j��}t|t��r|�d��}t|��}t|t��rJ|d}|�@||jj
kr0|jj�|��}|j
|j_
|j�||jd���|jd<dSdS)z5Make sure this resource has a representation fetched.N�utf-8�resource_type_linkF�r�rD)rDr�rCr�r$r7�binary_type�decoder�dictr��_wadl�get_resource_type�tagr�r@rE)rr��	type_linkr�s    rrwzResource._ensure_representationzs����-�5�!�Z�0�4�4�T�5H�I�I�N��.�+�6�6�
@�!/�!6�!6�w�!?�!?��"�>�2�2�N��.�$�/�/�	
@�*�+?�@�	��)�!�T�%8�%A�A�A�$(�J�$4�$F�$F�!�%�%�M�/<�.?�D�'�+�.2�.A�.F�.F���$�05�/G�/�/�D�M�*�+�+�+�36�5r!c��||kS)zInequality operator.r1�r�others  r�__ne__zResource.__ne__�s���5�=� � r!)Nr4TNN�NN)r-r.r/r0r �objectrJrNrQ�propertyrLrOrRrgri�__methods__rIrtr}r��classmethodr{r�r�r�r9rwr�r1r!rrrrs�������5�5�8�8�8��v�x�x���6�8�8�L��f�h�h�O�
�@�@��X�@��<�<��X�<��?�?��X�?�����X��6�
�
��X�
� �K� � � �DE�E�E�!�!�!�>8�8�8� �
�"4�(,�"&��9'�9'�9'��[�9'�v
�
�
�
�&������������B!�!�!�!�!r!rc�(�eZdZdZed���ZdS)�ScalarValuez.A resource representing a single scalar value.c�B�|���|jjS)zReturn the scalar value.)rwrDr�rKs rr+zScalarValue.value�s"��	
�#�#�%�%�%��"�1�1r!N)r-r.r/r0r�r+r1r!rr�r��s3������8�8�
�2�2��X�2�2�2r!r�c�,�eZdZdZdd�Zd�Zd�Zd�ZdS)	�
HostedFilezAA resource representing a file managed by a lazr.restful service.�rNc�L�|dvrt||||��Std���)z5Open the file on the server for read or write access.)r��w�'Invalid mode. Supported modes are: r, w)�HostedFileBuffer�
ValueError)r�mode�content_type�filenames    r�openzHostedFile.open�s0���:���#�D�$��h�G�G�G��F�G�G�Gr!c�X�|jj�|jj��dS)z Delete the file from the server.N)rCr��deleterD�urlrKs rr�zHostedFile.delete�s'���
��"�"�4�#6�#:�;�;�;�;�;r!c��gS)z4HostedFile objects define no web service parameters.r1)rrqs  rrIzHostedFile._get_parameter_names�s���	r!c�>�|duo|jj|jjkS)aEquality comparison.

        Two hosted files are the same if they have the same URL.

        There is no need to check the contents because the only way to
        retrieve or modify the hosted file contents is to open a
        filehandle, which goes direct to the server.
        N)rDr�r�s  r�__eq__zHostedFile.__eq__�s+��
���
D��#�'�5�+?�+C�C�	
r!)r�NN)r-r.r/r0r�r�rIr�r1r!rr�r��s_������K�K�H�H�H�H�<�<�<����
�
�
�
�
r!r�c�f��eZdZdZeed�Zdddddejf�fd�	Z	e
d���Zd�Zd�Z
�xZS)	rz�Entry point to the service. Subclass this for a service-specific client.

    :ivar credentials: The credentials instance used to access Launchpad.
    )r�r�Nr�c		� ��|�4|ddkr|dz
}|t|��z
}|ddkr|dz
}t|��|_||_||_t||||||j|��|_|j�|j��|_	|j	�
d��}	|	�|j�|	��d��}
tt|���d|
��dS)z�Root access to a lazr.restful API.

        :param credentials: The credentials used to access the service.
        :param service_root: The URL to the root of the web service.
        :type service_root: string
        Nr��/r�r4)�strr�	_root_uri�_base_client_name�credentialsr�_user_agentr��get_wadl_applicationr��get_resource_by_pathr�r$�superrr )r�
authorizer�service_root�cache�timeout�
proxy_info�version�base_client_name�max_retries�
root_resource�
bound_root�	__class__s           �rr zServiceRoot.__init__�s ���"���B��3�&�&���#���C��L�L�(�L��B��3�&�&���#���\�*�*���"2���&������������
�
��
��]�7�7���G�G��
��
�7�7��;�;�
�"�'�'��M���m�,�,�.@�
�
�
�	�k�4� � �)�)�$�
�;�;�;�;�;r!c�
�dtz}|jdkr|jdz|zdz}t��}||d<|j�=|jj}t|��D]!}||}|�||d���"|dS)a�The value for the User-Agent header.

        This will be something like:
        launchpadlib 1.6.1, lazr.restfulclient 1.0.0; application=apport

        That is, a string describing lazr.restfulclient and an
        optional custom client built on top, and parameters containing
        any authorization-specific information that identifies the
        user agent (such as the application name).
        zlazr.restfulclient %sr�z (�)z
User-Agent)rr�r	r��user_agent_params�sorted�	set_param)r�base_portion�messager�r&r+s      rr�zServiceRoot._user_agents���/��<���!�R�'�'��1�D�8�<�G�#�M�L��)�)�� ,������'� $� 0� B���/�0�0�
<�
<��)�#�.���!�!�#�u�l�;�;�;�;��|�$�$r!c�&�t||||��Sr)r)rr�r�r�r�s     r�httpFactoryzServiceRoot.httpFactory!s���:�u�g�z�B�B�Br!c��t|��}|jdkr?|dd�dkr
|dd�}t|j�|����}|j�|��}t|t��r|�	d��}	t|��}n #t$rtd|z���wxYw|�d��}|�td|z���|jj
�|��}t|jj
||j��}|�|j||d	d
���S)zLoad a resource given its URL.r�N�r�r�z!%s doesn't serve a JSON document.r�z+Couldn't determine the resource type of %s.r4Fr�)r�schemer�r�r`r�r$r7r�r�rr�rCr�r��WadlResourcer�r{)rr��parsed�documentr�r�r�rGs        r�loadzServiceRoot.load$sj���#�����=�B����2�A�2�w�#�~�~��!�"�"�g���d�n�+�+�C�0�0�1�1�C��=�$�$�S�)�)���h��,�,�	0����w�/�/�H�	H�"�8�_�_�N�N���	H�	H�	H��@�3�F�G�G�G�	H����"�&�&�';�<�<�	����=��C���
��
�(�:�:�9�E�E�
�$�T�Z�%5�s�M�<M�N�N�
��*�*��J����,1�+�
�
�	
s�B/�/C)r-r.r/r0r�r�r�r�MAX_RETRIESr r�r�r�r��
__classcell__�r�s@rrr�s����������!�"����������'�.<�.<�.<�.<�.<�.<�`�%�%��X�%�0C�C�C�
�
�
�
�
�
�
r!rc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)rz=A class for a named operation to be invoked with GET or POST.c�0�||_||_||_dS)z/Initialize with respect to a WADL Method objectN)rFr��wadl_method)rrFr�r�s    rr zNamedOperation.__init__Gs����	� ��
�&����r!c��t|��dkrtd���|jj}|�|��}|jj}|dvr|j}nW|�d��}|�|�d��}|�
Jd���|�|j	j
��}d�|D��}|���D]"\}}	||vrt|	t�	��||<�#|dvr|jjdi|��}
d
}i}n2|j���}
|jjdi|��\}
}d|
i}|jj�|
||���|���\}}|jd
kr|�|
||��S|dkrO|jdkr+|d}
|jj�|
��\}}n|j	���|�|
||��S)z)Invoke the method and process the result.rz(Method must be called with keyword args.)r$�headr�rXNrWzYA POST named operation must define a multipart or form-urlencoded request representation.c�b�h|],}|jdkst|j��dk�%|j��-S)�binaryr)�typer�r�r[)r�rfs  r�	<setcomp>z*NamedOperation.__call__.<locals>.<setcomp>dsE��
�
�
���z�X�%�%��U�]�);�);�a�)?�)?�
�J�)?�)?�)?r!)r�r�zContent-type)�
extra_headers��rV�-�locationr1)r��	TypeErrorr�r[r<r\rr^r]r�rDr6rr�build_request_url�build_representationrFr��_request�upper�status�_handle_201_responser��_handle_200_response)r�args�kwargs�http_methodr\r]re�send_as_is_paramsr&r+r��in_representationrrd�response�contents                r�__call__zNamedOperation.__call__Ms|���t�9�9�q�=�=��F�G�G�G��&�+���1�1�&�9�9���"�*���3�3�3��)�F�F� �>�>�%���J��!�$�B�B�7���
��)�)�:�*�)�)� �&�&�t�}�'C�D�D�F�
�
��
�
�
��
�*�*�,�,�	B�	B�J�C���+�+�+�!�%�-@�A�A�A��S�	���3�3�3�4�$�"�4�<�<�t�<�<�C� "���M�M��"�4�4�6�6�C�6�� �5�=�=��=�=�
��!�+�Z�8�M�!�I�.�7�7��������'�	8�
�
���'��?�c�!�!��,�,�S�(�G�D�D�D��f�$�$��?�c�)�)�"�:�.�C�(,�	�(:�(C�(C�C�(H�(H�%�H�g�g��M�,�,�.�.�.��,�,�S�(�G�D�D�Dr!c�0�|jj�t|����}|�d��}|j}|jj�|j	��\}}t�|j|||d��S)z5Handle the creation of a new resource by fetching it.�Location�content-type)r�rr�rrxrzrFr�rr�rr{)rr�rr�
wadl_response�wadl_parameterrGs       rrz#NamedOperation._handle_201_response�s����(�1�6�6��X�&�&�
�
�
�'�4�4�Z�@�@��&�6�
� �I�.�7�7�
�8I�J�J���'��.�.��I�}�g�x��/G�
�
�	
r!c��|d}|jj}|�|��}|�F||jkr9t	|t
��r|�d��}t|��S|St	|t
��r|�d��}t|��}|�|Sd|vrRd|vrN|d}|jj	�
|d��}t|jj	||j��}	n4|�
��}t|jj	||j��}	t�|j|	||d|���S)z)Process the return value of an operation.rNr�r8r�F)r�r�)r�rr^r@r7r�r�rrFr�r�r�r�r_rr{)
rr�rrr��response_definitionr�r�r�rGs
          rrz#NamedOperation._handle_200_response�s�����/��"�.�7���=�=�l�K�K�	"�%�,��t�3�3�3��g�{�3�3�6�%�n�n�W�5�5�G��W�~�~�%��N��g�{�+�+�	.��n�n�W�-�-�G���>�>�����O��(�"�"�';�x�'G�'G�
�;�'�C� �I�O�=�=��-�.���M�)��	���m�&7���M�M�*�<�<�>�>�
&�)��	���&?�&C���M��.�.��I����,1�&?�
/�
�
�	
r!c��|S)z/Named operation parameter names are sent as is.r1r>s  rr9z'NamedOperation._get_external_param_name�s���r!N)	r-r.r/r0r rrrr9r1r!rrrDsm������G�G�'�'�'�HE�HE�HE�T

�

�

�<
�<
�<
�|����r!rc�\��eZdZdZ�fd�Zd�Zd�Zd�Z�fd�Zd�Z	d�Z
d�fd
�	Zd�Z�xZ
S)
rzBA class for an entry-type resource that can be updated with PATCH.c���tt|���||��i|jd<tt|���||��dS)N�_dirty_attributes)r�rr rE�rrFrGr�s   �rr zEntry.__init__�sX���
�e�T���#�#�D�-�8�8�8�.0��
�)�*�
�e�T���#�#�D�-�8�8�8�8�8r!c�L�dt|j��j�d|j�d�S)z:Return the WADL resource type and the URL to the resource.�<z at �>)rr��fragmentr8rKs r�__repr__zEntry.__repr__�s0���
��'�(�(�1�1�1��N�N�N�
�	
r!c�d�|jj�t|j����S)zDelete the resource.)rCr�r�rr8rKs r�	lp_deletezEntry.lp_deletes%���z�"�)�)�#�d�n�*=�*=�>�>�>r!c��|jS)zReturn the URL to the resource.)r8rKs r�__str__z
Entry.__str__s
���~�r!c���|dkr||jvr
|j|Stt|���|��S)z-Try to retrive a parameter of the given name.r")r"r�rr�)rr[r�s  �rr�zEntry.__getattr__
sI����&�&�&��t�-�-�-��-�d�3�3��U�D�!�!�-�-�d�3�3�3r!c��|�|��s td|jj�d|�d����||j|<dS)z$Set the parameter of the given name.r�z' object has no attribute 'N)rtr�r�r-r")rr[r+s   r�__setattr__zEntry.__setattr__sZ���$�$�T�*�*�	� �.��>�*�*�*�D�D�D�2���
�(-���t�$�$�$r!c�j�|duo/|j|jko|j|jko|j|jkS)z�Equality operator.

        Two entries are the same if their self_link and http_etag
        attributes are the same, and if their dirty attribute dicts
        contain the same values.
        N)r8�	http_etagr"r�s  rr�zEntry.__eq__sK��
���
B���%�/�1�
B���%�/�1�
B��&�%�*A�A�		
r!Nc���t|dd��}tt|���||��|j���dS)r�r1N)�getattrr�rr�r"�clear)rr�r�r�s   �rr�zEntry.lp_refresh(sO����t�[�$�/�/��
�e�T���%�%�g�t�4�4�4���$�$�&�&�&�&�&r!c�>�|�|j��}i}t|dd��}|�||d<|jj�t
|j��||��\}}|jdkr|�	|d��|j�
��|d}|jdkr^||jkrUt|t��r|�d��}t|��}||j_||j_dSdSdS)	zSave changes to the entry.r1NzIf-Matchrrr��r�)r<r"r3rCr��patchrr8r
r�r4r@r7r�r�rrDr�rd)rr�r�r�rrr��new_representations        r�lp_savez
Entry.lp_save.s1���;�;��"�
�
�����t�[�$�/�/����"&�G�J��
!�J�/�5�5��������
�
���'��?�c�!�!��O�O�H�Z�0�1�1�1���$�$�&�&�&���/���?�c�!�!�l�d�6J�&J�&J��'�;�/�/�
2�!�.�.��1�1��!&�w����1C�D��.�-9�D��*�*�*�"�!�&J�&Jr!r)r-r.r/r0r r(r*r,r�r/r�r�r9r�r�s@rrr�s��������L�L�
9�
9�
9�
9�
9�
�
�
�?�?�?����4�4�4�4�4�-�-�-�
�
�
�'�'�'�'�'�'�:�:�:�:�:�:�:r!rc�F��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
�xZS)	rz4A collection-type resource that supports pagination.c�Z��tt|���||��dS)zCreate a collection object.N)r�rr r#s   �rr zCollection.__init__Ss)���
�j�$���(�(��}�=�=�=�=�=r!c��|j}t|t��r|St|t��r|jStd���)znThe number of items in the collection.

        :return: length of the collection
        :rtype: int
        z collection size is not available)�
total_sizer7�intr�r+r)rr=s  r�__len__zCollection.__len__WsS���_�
��j�#�&�&�		@���
�
�K�
0�
0�	@��#�#��>�?�?�?r!c#�K�|���|jj}	|�|�di����D]}|V��|�d��}|�dS|jj�t|����}t|t��r|�
d��}t|��}��)zqIterate over the items in the collection.

        :return: iterator
        :rtype: sequence of `Entry`
        T�entries�next_collection_linkNr�)rwrDr��_convert_dicts_to_entriesr$rCr�rr7r�r�r)r�current_pager��	next_link�next_gets     r�__iter__zCollection.__iter__is�����	
�#�#�%�%�%��*�9��	+� �:�:�� � ��B�/�/���
�
�������$�(�(�)?�@�@�I�� ����z�*�.�.�s�9�~�~�>�>�H��(�K�0�0�
4�#�?�?�7�3�3�� ��?�?�L�	+r!c��t|t��r|�|��S|�t||dz����}t|��dkrt	d���|dS)acLook up a slice, or a subordinate resource by index.

        To discourage situations where a lazr.restful client fetches
        all of an enormous list, all collection slices must have a
        definitive end point. For performance reasons, all collection
        slices must be indexed from the start of the list rather than
        the end.
        r�zlist index out of ranger)r7�slice�
_get_slicer��
IndexError)rr&�found_slices   rr,zCollection.__getitem__~su���c�5�!�!�	"��?�?�3�'�'�'��/�/�%��S�1�W�*=�*=�>�>�K��;���1�$�$� �!:�;�;�;��q�>�!r!c���|jpd}|j}|dkrtd���|dkrtd���|jj}|�P|t|d��kr7|d}t|��}|||�}|�d��}n%d}g}|�|jjd|��}||z
}	|	t|��z
}
|
dkr�|��|j	j
�|��}t|t��r|�
d��}t|��}|d}
||
d|
�z
}|	t|��z
}
|�d��}|�n<|�t|
��}|
dkr|
|kr|�|d	|
��}|
dkr|��|j�|dd|j�}d
�|�|��D��S)z!Retrieve a slice of a collection.rz6Collection slices must have a nonnegative start point.z>Collection slices must have a definite, nonnegative end point.NrArBzws.startr�zws.sizec��g|]}|��Sr1r1)r�r�s  rr�z)Collection._get_slice.<locals>.<listcomp>�s(��
�
�
��
�
�
�
r!)�start�stopr�rDr�r�r$�_with_url_query_variable_setr�rCr�r7r�r�r�steprC)rrIrOrP�existing_representation�
entry_page�first_page_size�entry_dicts�page_url�desired_size�more_needed�page_getr��current_page_entriess              rrJzCollection._get_slice�sU���� �q���z���1�9�9��K���
��!�8�8��)���
�
#'�"5�"D��"�.�5�3�#�I�.�<
�<
�4
�4
�&1��;�J�!�*�o�o�O�$�U�4�Z�0�K�.�2�2�3I�J�J�H�H�#�O��K��8�8��#�'��U���H��e�|��"�S��%5�%5�5���A�o�o�(�"6��z�*�.�.�x�8�8�H��(�K�0�0�
4�#�?�?�7�3�3��"�8�_�_�N�#1�)�#<� ��/����=�=�K�&��[�)9�)9�9�K�%�)�)�*@�A�A�H�����&�"%�&:�";�";���Q���;��#@�#@� �<�<��i�����1�A�o�o�(�"6�8�:�!�%�m�m���m�4�K�
�
� �:�:�;�G�G�
�
�
�	
r!c#�
K�|D]}}|d}|d}|jj}|�|��}t|jj||j��}t
�|j|||jd��V��~dS)aConvert dictionaries describing entries to Entry objects.

        The dictionaries come from the 'entries' field of the JSON
        dictionary you get when you GET a page of a collection. Each
        dictionary is the same as you'd get if you sent a GET request
        to the corresponding entry resource. So each of these
        dictionaries can be treated as a preprocessed representation
        of an entry resource, and turned into an Entry instance.

        :yield: A sequence of Entry instances.
        r8r�FN)	rD�applicationr�r�r�rr{rCr@)rrA�
entry_dict�resource_urlr��wadl_applicationr�r�s        rrCz$Collection._convert_dicts_to_entries�s�����"�	�	�J�%�k�2�L�!+�,@�!A��#�2�>��,�>�>�"���M�$��#�/���!���H�
�1�1��
�H�j�$�2F����
�
�
�
�	�	r!c���t|��}|j�i}nt|j��}t|��||<t	|d��|_t|��S)z1A helper method to set a query variable in a URL.NT)rrTr
r�r)rr��variable�	new_value�urir]s      rrQz'Collection._with_url_query_variable_set	sW���#�h�h���9���F�F��c�i�(�(�F��y�>�>��x���f�d�+�+��	��3�x�x�r!)r-r.r/r0r r?rGr,rJrCrQr�r�s@rrrPs��������>�>�>�>�>�>�>�@�@�@�$+�+�+�*"�"�"�$[
�[
�[
�z���8	�	�	�	�	�	�	r!rc�2��eZdZdZ�fd�Zd�ZdZd�Z�xZS)rz�A collection-type resource that supports key-based lookup.

    This collection can be sliced, but any single index passed into
    __getitem__ will be treated as a custom lookup key.
    c���t|t��r(tt|���|��S	|�|��}n#t$rtd���wxYw|�t|���||��}	|�	��n2#t$r%}|jjdkrt|����d}~wwxYw|S)z8Look up a slice, or a subordinate resource by unique ID.�unsubscriptable objectN�)
r7rIr�rr,�_get_url_from_id�NotImplementedErrorrr*rwrrr
)rr&r��
shim_resource�er�s     �rr,z(CollectionWithKeyBasedLookup.__getitem__s�����c�5�!�!�	N��5�t�<�<�H�H��M�M�M�	6��'�'��,�,�C�C��"�	6�	6�	6��4�5�5�5�	6�����;��3�-�-����S�	�	�
�	��0�0�2�2�2�2���	�	�	��z� �C�'�'��s�m�m�#������		����
�s$�A�A0�B%�%
C�/ C�Cc��	|�|��}n#t$rtd���wxYw|�t|���|j�*d}t|jjjd|jz��}n�	|jj	�
|��}t|t��r|�
d��}t|��}n2#t$r%}|jjdkrt%|����d}~wwxYw|d}t'|jj||��}|�|j||d���S)	z=Retrieve a member from this collection without looking it up.rgN�#r�rhr�F)r�r�)rirjrr��
collection_ofrrCr��
markup_urlr�r$r7r�r�rrrr
r*r�r{)rr&r�r�r��url_get�errorr�s        rrz%CollectionWithKeyBasedLookup.__call__2sj��	6��'�'��,�,�C�C��"�	6�	6�	6��4�5�5�5�	6�����;��S�/�/�!���)�"�N�!(��
� �+�S�4�3E�-E�"�"���	
��*�-�1�1�#�6�6���g�{�3�3�6�%�n�n�W�5�5�G�!&�w�������
�
�
��>�(�C�/�/�"�3�-�-�'������	
����"0�0D�!E����
� 0�#�7I�J�J���*�*��J��)�,1�	+�
�
�	
s!��2�8AC�
D� C;�;DNc��t���)z2Transform the unique ID of an object into its URL.)rj)rr&s  rriz-CollectionWithKeyBasedLookup._get_url_from_idhs��!�#�#�#r!)	r-r.r/r0r,rrorir�r�s@rrrsh��������������,0
�0
�0
�h�M�$�$�$�$�$�$�$r!rc�&�eZdZdZdd�Zd�Zd�ZdS)r�z8The contents of a file hosted by a lazr.restful service.Nc�x�|jj|_|dkr�|�td���|�td���|jj�|jd���\}}|d}|�d��}|d}t
|��d	}	t|	�d
��d��}n<|dkr'd
}|�td���|�td���d}ntd���||_	||_
||_||_||_
tj||��dS)Nr�z8Files opened for read access can't specify content_type.z4Files opened for read access can't specify filename.T)�return_responserz
last-modifiedzcontent-location�r�r�r�r!z8Files opened for write access must specify content_type.z4Files opened for write access must specify filename.r�)rDr�r�rCr�r$rr�split�hosted_filer�r�r��
last_modifiedr
r )
rryr�r�r�rr+rz�content_location�paths
          rr zHostedFileBuffer.__init__psz���-�1����3�;�;��'� �,�����#� �M����*�/�8�<�<���$�=���O�H�e�$�N�3�L�$�L�L��9�9�M� (�(:�;���,�-�-�a�0�D��t�z�z�#���r�2�3�3�H�H�
�S�[�[��E��#� �,������ �M����!�M�M��F�G�G�G�&�����	�(��� ��
�*������u�%�%�%�%�%r!c���|jdkrOd|jz}|jjj�|j|���|jd|i��tj
|��dS)Nr�zattachment; filename="%s"zContent-Disposition)r�r�ryrCr��putr��getvaluer�r
�close)r�dispositions  rr�zHostedFileBuffer.close�sr���9����5��
�E�K���"�+�/�/����
�
����!�&��4�	
�
�
�	�
�d�����r!c�0�tj||��dSr)r
�write)r�bs  rr�zHostedFileBuffer.write�s���
�d�A�����r!r�)r-r.r/r0r r�r�r1r!rr�r�msM������B�B�-&�-&�-&�-&�^	�	�	�����r!r�)4r0r�
__metaclass__�__all__�
email.messager	�ior
�jsonrr�urllib.parser
rrrr�ImportError�urllib�sys�version_infor��	text_type�bytesr��unicode�wadllib.applicationrr��lazr.restfulclientr�lazr.restfulclient._browserrr�lazr.restfulclient._jsonr�lazr.restfulclient.errorsr�lazr.urirr�r)rr3r�r�rrrrrr�r1r!r�<module>r�s���&0�/��
�����"�!�!�!�!�!���������������*�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L���*�*�*�4�4�4�4�4�4�4�4�4�4�)�)�)�)�)�)�)�)�)�)�*�����
�
�
���A��!����I��K�K��I��K�8�8�8�8�8�8�*�*�*�*�*�*�<�<�<�<�<�<�<�<�8�8�8�8�8�8�/�/�/�/�/�/�������
�&�(�(����������6��������0k!�k!�k!�k!�k!�{�k!�k!�k!�\	2�2�2�2�2�(�2�2�2�
�
�
�
�
��
�
�
�Bv
�v
�v
�v
�v
�(�v
�v
�v
�rb�b�b�b�b�[�b�b�b�Jd:�d:�d:�d:�d:�H�d:�d:�d:�NB�B�B�B�B��B�B�B�JU$�U$�U$�U$�U$�:�U$�U$�U$�p>�>�>�>�>�w�>�>�>�>�>s�-�A�A