§
    9ºJcÌ·  ã                   ód  — d Z eZg d¢ZddlmZ ddlmZ ddlm	Z	m
Z
 	 ddlmZmZmZmZmZ n# e$ r ddlmZmZmZ ddlmZmZ Y nw xY wdd	lZej        d         d
k    reZeZneZeZddlmZ ddlmZ ddlm Z m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z'  e(¦   «         Z) G d„ d¦  «        Z* G d„ d¦  «        Z+ G d„ de+¦  «        Z G d„ de¦  «        Z, G d„ de¦  «        Z- G d„ de¦  «        Z. G d„ de+¦  «        Z/ G d„ d e¦  «        Z0 G d!„ d"e¦  «        Z1 G d#„ d$e1¦  «        Z2 G d%„ 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)r   r   r   )r   r   Né   )r   )Ú__version__)ÚBrowserÚRestfulHttp)ÚDatetimeJSONEncoder)Ú	HTTPError)ÚURIc                   ó&   — e Zd ZdZd„ Zdd„Zd„ ZdS )Ú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                 ó   — || _         d S ©N)Úwrapped_dictionary)Úselfr   s     ú=/usr/lib/python3/dist-packages/lazr/restfulclient/resource.pyÚ__init__zHeaderDictionary.__init__K   s   € Ø"4ˆÔÐÐó    Nc                 óZ   — | j                              |                     ¦   «         ¦  «        S ©z2Retrieve a value, converting the key to lowercase.)r   ÚgetÚlower)r   ÚkeyÚdefaults      r   r$   zHeaderDictionary.getN   s!   € àÔ&×*Ò*¨3¯9ª9©;¬;Ñ7Ô7Ð7r!   c                 ól   — |                       |t          ¦  «        }|t          u rt          |¦  «        ‚|S r#   )r$   ÚmissingÚKeyError)r   r&   Úvalues      r   Ú__getitem__zHeaderDictionary.__getitem__R   s1   € à—’˜�gÑ&Ô&ˆØ•GÐÐÝ˜3‘-”-ÐØˆr!   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r    r$   r,   © r!   r   r   r   ?   sP   € € € € € ð	ð 	ð5ð 5ð 5ð8ð 8ð 8ð 8ðð ð ð ð r!   r   c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )ÚRestfulBasez=Base class for classes that know about lazr.restful services.úapplication/jsonc                 ó¦   — i }|                      ¦   «         D ]9\  }}t          |t          ¦  «        r|j        }|||                      |¦  «        <   Œ:|S r   )Ú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 )a  Turn 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     r   r9   z$RestfulBase._get_external_param_nameg   s
   € ð Ðr!   N)r-   r.   r/   r0   ÚJSON_MEDIA_TYPEr<   r9   r1   r!   r   r3   r3   Z   s=   € € € € € ØGÐGà(€Oðð ð ðð ð ð ð r!   r3   c                   ó&  — e Zd ZdZd„ Z e¦   «         Z e¦   «         Z e¦   «         Ze	d„ ¦   «         Z
e	d„ ¦   «         Ze	d„ ¦   «         Ze	d„ ¦   «         Ze	d„ ¦   «         ZeZd„ Zd	„ Zd
„ Zd„ Ze	 	 	 	 	 dd„¦   «         Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )r   z+Base class for lazr.restful HTTP resources.c                 ó6   — |€| }|| j         d<   || j         d<   dS )z5Initialize with respect to a wadllib Resource object.NÚ_rootÚ_wadl_resource)Ú__dict__)r   ÚrootÚwadl_resources      r   r    zResource.__init__u   s-   € àˆ<àˆDð "&ˆŒ�gÑØ*7ˆŒÐ&Ñ'Ð'Ð'r!   c                 ó6   — |                       | j        ¦  «        S )z,Name the collections this resource links to.)Ú_get_parameter_namesÚFIND_COLLECTIONS©r   s    r   Úlp_collectionszResource.lp_collectionsƒ   s   € ð ×(Ò(¨Ô)>Ñ?Ô?Ð?r!   c                 ó6   — |                       | j        ¦  «        S )z(Name the entries this resource links to.)rI   ÚFIND_ENTRIESrK   s    r   Ú
lp_entrieszResource.lp_entriesˆ   s   € ð ×(Ò(¨Ô):Ñ;Ô;Ð;r!   c                 ó6   — |                       | j        ¦  «        S )z'Name this resource's scalar attributes.)rI   ÚFIND_ATTRIBUTESrK   s    r   Úlp_attributeszResource.lp_attributes�   s   € ð ×(Ò(¨Ô)=Ñ>Ô>Ð>r!   c                 ó¦  — g }| j         j        D ]Á}|j                             ¦   «         }|dk    r|j                             ddg¦  «        }nW|dk    rQdD ]4}|j                             |¦  «        }|�|                     ¦   «         } nŒ5|                     | j         ¦  «        }|D ])}|j        dk    r|                     |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_operationszResource.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.)rI   rJ   rN   rQ   rK   s    r   Ú__members__zResource.__members__®   s,   € ð ×(Ò(ØÔ! 4Ô#4°dÔ6Jñ
ô 
ð 	
r!   c                 óŠ  — g }| j                              | j        ¦  «        D ] }|j        }|j        }|dk    rl|�j|j        rc|                     d¦  «        r'| j        |v r|                     |dd…         ¦  «         Œ[| j	        |v r|                     |dd…         ¦  «         Œ‚| j
        |v r|                     |¦  «         Œ¡|S )z2Retrieve some subset of the resource's parameters.r8   NÚ_collection_linkiðÿÿÿéûÿÿÿ)rD   Ú
parametersr@   r[   ÚlinkÚ
can_followÚendswithrJ   r`   rN   rQ   )r   Úkindsrb   Ú	parameterr[   rn   s         r   rI   zResource._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   — |                       |¦  «        duS )z8Does this resource have a parameter with the given name?N)r9   r>   s     r   Úlp_has_parameterzResource.lp_has_parameterÙ   s   € à×,Ò,¨ZÑ8Ô8ÀÐDÐDr!   c                 óÆ  — |                       ¦   «          dD ]‰}| j                             ||z   ¦  «        }|�h	 |                     ¦   «          n# t          $ r Y ŒCw xY w|                     ¦   «         € dS |j        }|                      | j        ||j        ¬¦  «        c S ŒŠ| 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.
        )Ú_linkrk   N)r?   zNo such parameter: %s)	Ú_ensure_representationrD   Úget_parameterÚ	get_valuer*   Úlinked_resourceÚ_create_bound_resourcerC   r[   )r   r?   Úsuffixrf   rz   s        r   Úlp_get_parameterzResource.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ÁAc                 óÒ   — d|i}| j                              d|¬¦  «        }|€| j                              d|¬¦  «        }|€t          d|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.
        rY   r$   )Úquery_paramsNrV   )Úrepresentation_paramszNo operation with name: %s)rD   Ú
get_methodr*   r   rC   )r   Úoperation_namer]   rc   s       r   Úlp_get_named_operationzResource.lp_get_named_operationü   s   € ð ˜>Ð*ˆØÔ$×/Ò/°ÀFÐ/ÑKÔKˆØˆ>ØÔ(×3Ò3Ø¨fð 4ñ ô ˆFð ˆ>ÝÐ7¸.ÑHÑIÔIÐIÝ˜dœj¨$°Ñ7Ô7Ð7r!   Nr4   Tc                 ó6  — |j         }t          |¦  «        d         }	t          }
|                     d¦  «        s|�|                     d¦  «        rt          }
|j                             |	|
¦  «        }|�|                     ||||¬¦  «        }n	  |||¦  «        S )a  Create 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_urlr   r   rp   r   ÚRESOURCE_TYPE_CLASSESr$   Úbind)ÚclsrF   ÚresourceÚrepresentationÚrepresentation_media_typeÚrepresentation_needs_processingr†   r?   r‡   Úresource_typer'   Úr_classs               r   r{   zResource._create_bound_resource  s¶   € ðH Ô$ˆÝ  Ñ*Ô*¨2Ô.ˆÝˆà×Ò˜WÑ%Ô%ð 	!ØÐ" z×':Ò':Ð;MÑ'NÔ'NÐ"å ˆGØÔ,×0Ò0°ÀÑHÔHˆØÐ%ð  —}’}ØØ)Ø/Ø*Cð	 %ñ ô ˆHˆHð Øˆw�t˜XÑ&Ô&Ð&r!   c                 óþ   — |�|| j         _        i }|�||d<   | j        j                             | j         |¬¦  «        }|| j        j        j        k    rdS | j                              || j        ¦  «        | j        d<   dS )ú&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_refreshzResource.lp_refreshH  s™   € àÐØ'.ˆDÔÔ$ØˆØÐØ'+ˆG�OÑ$ØœÔ,×0Ò0ØÔ¨ð 1ñ 
ô 
ˆð ˜TœZÔ0Ô=Ò=Ð=àˆFð +/Ô*=×*BÒ*BØ˜DÔ0ñ+
ô +
ˆŒÐ&Ñ'Ð'Ð'r!   c                 óÀ   — 	 |                       |¦  «        S # t          $ r Y nw xY w	 |                      |¦  «        S # t          $ r t          | ›d|›d�¦  «        ‚w xY w)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__zResource.__getattr__[  s‘   € ð	Ø×.Ò.¨tÑ4Ô4Ð4øÝð 	ð 	ð 	ØˆDð	øøøð	Ø×(Ò(¨Ñ.Ô.Ð.øÝð 	ð 	ð 	Ý Ø59°T°T¸4¸4¸4Ð@ñô ð ð	øøøs   ‚ —
$£$¨= ½ Ac                 ó’   — | j                              || j        ¦  «        }|j        }t	          |¦  «        dk    rd„ |D ¦   «         S dS )z0Find the set of possible values for a parameter.r   c                 ó   — g | ]	}|j         ‘Œ
S r1   )r+   )Ú.0Úoptions     r   ú
<listcomp>z*Resource.lp_values_for.<locals>.<listcomp>o  s   € Ð7Ð7Ð7 V�F”LÐ7Ð7Ð7r!   N)rD   rx   r@   ÚoptionsÚlen)r   r?   rr   r¤   s       r   Úlp_values_forzResource.lp_values_forh  sV   € àÔ'×5Ò5Ø˜Ô,ñ
ô 
ˆ	ð Ô#ˆÝˆw‰<Œ<˜!ÒÐØ7Ð7¨wÐ7Ñ7Ô7Ð7Øˆtr!   c                 óV   — dD ]%}||z   }| j                              |¦  «        r|c S Œ&dS )z>What's this parameter's name in the underlying representation?)rv   rk   Ú N)rD   rx   )r   r?   r|   r[   s       r   r9   z!Resource._get_external_param_namer  sG   € à7ð 	ð 	ˆFØ Ñ&ˆDØÔ"×0Ò0°Ñ6Ô6ð Ø���ðàˆtr!   c                 óî  — | j         j        €è| j        j                             | j         ¦  «        }t          |t          ¦  «        r|                     d¦  «        }t          |¦  «        }t          |t          ¦  «        rJ|d         }|�@|| j         j
        k    r0| j        j                             |¦  «        }|j        | j         _        | j                              || j        d¬¦  «        | j        d<   dS dS )z5Make sure this resource has a representation fetched.Núutf-8Úresource_type_linkF©rŽ   rD   )rD   rŒ   rC   r•   r$   r7   Úbinary_typeÚdecoder   Údictr‡   Ú_wadlÚget_resource_typeÚtagr‰   r@   rE   )r   rŒ   Ú	type_linkr�   s       r   rw   zResource._ensure_representationz  s   € àÔÔ-Ð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Ð*Ñ+Ð+Ð+ð3 6Ð5r!   c                 ó   — | |k     S )zInequality operator.r1   ©r   Úothers     r   Ú__ne__zResource.__ne__›  s   € à˜5’=Ð Ð r!   )Nr4   TNN©NN)r-   r.   r/   r0   r    ÚobjectrJ   rN   rQ   ÚpropertyrL   rO   rR   rg   ri   Ú__methods__rI   rt   r}   rƒ   Úclassmethodr{   r™   rž   r¦   r9   rw   r·   r1   r!   r   r   r   r   s®  € € € € € Ø5Ð5ð8ð 8ð 8ð �v‘x”xÐØ�6‘8”8€LØ�f‘h”h€Oàð@ð @ñ „Xð@ð ð<ð <ñ „Xð<ð ð?ð ?ñ „Xð?ð ðð ñ „Xðð6 ð
ð 
ñ „Xð
ð  €Kð ð  ð  ðDEð Eð Eð!ð !ð !ð>8ð 8ð 8ð  ð
 Ø"4Ø(,Ø"&Øð9'ð 9'ð 9'ñ „[ð9'ðv
ð 
ð 
ð 
ð&ð ð ðð ð ðð ð ðð ð ðB!ð !ð !ð !ð !r!   r   c                   ó(   — e Zd ZdZed„ ¦   «         ZdS )ÚScalarValuez.A resource representing a single scalar value.c                 óB   — |                       ¦   «          | j        j        S )zReturn the scalar value.)rw   rD   rŒ   rK   s    r   r+   zScalarValue.value£  s"   € ð 	×#Ò#Ñ%Ô%Ð%ØÔ"Ô1Ð1r!   N)r-   r.   r/   r0   rº   r+   r1   r!   r   r¾   r¾      s3   € € € € € Ø8Ð8àð2ð 2ñ „Xð2ð 2ð 2r!   r¾   c                   ó,   — e Zd ZdZdd„Zd„ Zd„ Zd„ ZdS )	Ú
HostedFilezAA resource representing a file managed by a lazr.restful service.ÚrNc                 óL   — |dv rt          | |||¦  «        S t          d¦  «        ‚)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   ÚopenzHostedFile.open­  s0   € à�:ÐÐÝ# D¨$°¸hÑGÔGÐGåÐFÑGÔGÐGr!   c                 óX   — | j         j                             | j        j        ¦  «         dS )z Delete the file from the server.N)rC   r•   ÚdeleterD   ÚurlrK   s    r   rÍ   zHostedFile.delete´  s'   € àŒ
Ô×"Ò" 4Ô#6Ô#:Ñ;Ô;Ð;Ð;Ð;r!   c                 ó   — g S )z4HostedFile objects define no web service parameters.r1   )r   rq   s     r   rI   zHostedFile._get_parameter_names¸  s   € àˆ	r!   c                 ó>   — |duo| j         j        |j         j        k    S )a  Equality 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)rD   rÎ   rµ   s     r   Ú__eq__zHostedFile.__eq__¼  s+   € ð ˜Ðð DØÔ#Ô'¨5Ô+?Ô+CÒCð	
r!   )rÂ   NN)r-   r.   r/   r0   rË   rÍ   rI   rÑ   r1   r!   r   rÁ   rÁ   ª  s_   € € € € € ØKÐKðHð Hð Hð Hð<ð <ð <ðð ð ð
ð 
ð 
ð 
ð 
r!   rÁ   c                   óf   ‡ — e Zd ZdZeedœZdddddej        fˆ fd„	Z	e
d„ ¦   «         Zd„ Zd„ Zˆ xZS )	r   z˜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|d         dk    r|dz  }|t          |¦  «        z  }|d         dk    r|dz  }t          |¦  «        | _        || _        || _        t          | ||||| j        |¦  «        | _        | j                             | j        ¦  «        | _	        | j	         
                    d¦  «        }	|	                     | j                             |	¦  «        d¦  «        }
t          t          | ¦  «                             d|
¦  «         dS )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$   Úsuperr   r    )r   Ú
authorizerÚservice_rootÚcacheÚtimeoutÚ
proxy_infoÚversionÚbase_client_nameÚmax_retriesÚroot_resourceÚ
bound_rootÚ	__class__s              €r   r    zServiceRoot.__init__Ø  s   ø€ ð" ÐØ˜BÔ 3Ò&Ð&Ø Ñ#�Ø�C ™LœLÑ(ˆLØ˜BÔ 3Ò&Ð&Ø Ñ#�Ý˜\Ñ*Ô*ˆŒð "2ˆÔð &ˆÔÝØØØØØØÔØñ
ô 
ˆŒð ”]×7Ò7¸¼ÑGÔGˆŒ
ð œ
×7Ò7¸Ñ;Ô;ˆØ"×'Ò'ØŒM×Ò˜mÑ,Ô,Ð.@ñ
ô 
ˆ
õ 	�k˜4Ñ Ô ×)Ò)¨$°
Ñ;Ô;Ð;Ð;Ð;r!   c                 ó
  — dt           z  }| j        dk    r| j        dz   |z   dz   }t          ¦   «         }||d<   | j        �=| j        j        }t          |¦  «        D ]!}||         }|                     ||d¦  «         Œ"|d         S )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).
        zlazr.restfulclient %sr¨   z (ú)z
User-Agent)r   r×   r	   rØ   Úuser_agent_paramsÚsortedÚ	set_param)r   Úbase_portionÚmessagerê   r&   r+   s         r   rÙ   zServiceRoot._user_agent  s£   € ð /µÑ<ˆØÔ! RÒ'Ð'ØÔ1°DÑ8¸<ÑGÈ#ÑMˆLå‘)”)ˆØ ,ˆ�ÑØÔÐ'Ø $Ô 0Ô BÐÝÐ/Ñ0Ô0ð <ð <�Ø)¨#Ô.�Ø×!Ò! # u¨lÑ;Ô;Ð;Ð;Ø�|Ô$Ð$r!   c                 ó&   — t          ||||¦  «        S r   )r   )r   rÝ   rß   rà   rá   s        r   ÚhttpFactoryzServiceRoot.httpFactory!  s   € Ý˜: u¨g°zÑBÔBÐBr!   c                 ó¬  — t          |¦  «        }|j        dk    r?|dd…         dk    r
|dd…         }t          | j                             |¦  «        ¦  «        }| j                             |¦  «        }t          |t          ¦  «        r| 	                    d¦  «        }	 t          |¦  «        }n # t          $ r t          d|z  ¦  «        ‚w xY w|                     d¦  «        }|€t          d|z  ¦  «        ‚| j        j                             |¦  «        }t          | j        j        ||j        ¦  «        }|                      | j        ||d	d
¬¦  «        S )zLoad 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.r4   Fr¬   )r   ÚschemerÕ   rÖ   r`   r•   r$   r7   r­   r®   r   rÇ   rC   r°   r±   ÚWadlResourcer²   r{   )r   rÎ   ÚparsedÚdocumentrŒ   r³   r�   rG   s           r   ÚloadzServiceRoot.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/   r0   rÁ   r¾   rˆ   r   ÚMAX_RETRIESr    rº   rÙ   rð   r÷   Ú__classcell__©rç   s   @r   r   r   Ë  s°   ø€ € € € € ðð ð !Ø"ðð Ðð ØØØØØÔ'ð.<ð .<ð .<ð .<ð .<ð .<ð` ð%ð %ñ „Xð%ð0Cð Cð Cð
ð 
ð 
ð 
ð 
ð 
ð 
r!   r   c                   ó0   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ ZdS )r   z=A class for a named operation to be invoked with GET or POST.c                 ó0   — || _         || _        || _        dS )z/Initialize with respect to a WADL Method objectN)rF   r‹   Úwadl_method)r   rF   r‹   rý   s       r   r    zNamedOperation.__init__G  s   € àˆŒ	Ø ˆŒØ&ˆÔÐÐr!   c                 ó  — t          |¦  «        dk    rt          d¦  «        ‚| j        j        }|                      |¦  «        }| j        j        }|dv r|j        }nW|                     d¦  «        }|€|                     d¦  «        }|€
J d¦   «         ‚|                     | j	        j
        ¦  «        }d„ |D ¦   «         }|                     ¦   «         D ]"\  }}	||vrt          |	t          ¬	¦  «        ||<   Œ#|dv r | j        j        di |¤Ž}
d
}i }n2| j                             ¦   «         }
 | j        j        di |¤Ž\  }}d|i}| j        j                             |
||                     ¦   «         |¬¦  «        \  }}|j        dk    r|                      |
||¦  «        S |dk    rO|j        dk    r+|d         }
| j        j                             |
¦  «        \  }}n| j	                             ¦   «          |                      |
||¦  «        S )z)Invoke the method and process the result.r   z(Method must be called with keyword args.)r$   ÚheadrÍ   rX   NrW   zYA POST named operation must define a multipart or form-urlencoded request representation.c                 ób   — h | ],}|j         d k    st          |j        ¦  «        dk    ¯%|j        ’Œ-S )Úbinaryr   )Útyper¥   r¤   r[   )r¡   rf   s     r   ú	<setcomp>z*NamedOperation.__call__.<locals>.<setcomp>d  sE   € ð 
ð 
ð 
àØŒz˜XÒ%Ð%­¨U¬]Ñ);Ô);¸aÒ)?Ð)?ð ŒJà)?Ð)?Ð)?r!   )rŠ   r¨   zContent-type)Úextra_headerséÉ   rV   é-  Úlocationr1   )r¥   Ú	TypeErrorrý   r[   r<   r\   r   r^   r]   r‹   rD   r6   r   r   Úbuild_request_urlÚbuild_representationrF   r•   Ú_requestÚupperÚstatusÚ_handle_201_responser™   Ú_handle_200_response)r   ÚargsÚkwargsÚhttp_methodr\   r]   re   Úsend_as_is_paramsr&   r+   rÎ   Úin_representationr  rd   ÚresponseÚcontents                   r   Ú__call__zNamedOperation.__call__M  s|  € åˆ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  — | j         j                             t          |¦  «        ¦  «        }|                     d¦  «        }|j        }| j        j                             |j	        ¦  «        \  }}t                               | j        |||d         ¦  «        S )z5Handle the creation of a new resource by fetching it.ÚLocationúcontent-type)rý   r  r‰   r   rx   rz   rF   r•   r  rÎ   r   r{   )r   rÎ   r  r  Úwadl_responseÚwadl_parameterrG   s          r   r  z#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         }| j         j        }|                     |¦  «        }|€F|| j        k    r9t	          |t
          ¦  «        r|                     d¦  «        }t          |¦  «        S |S t	          |t
          ¦  «        r|                     d¦  «        }t          |¦  «        }|€|S d|v rRd|v rN|d         }| j        j	         
                    |d         ¦  «        }t          | j        j	        ||j        ¦  «        }	n4|                     ¦   «         }t          | j        j	        ||j        ¦  «        }	t                               | j        |	||d|¬¦  «        S )z)Process the return value of an operation.r  Nrª   r8   r«   F)rŽ   r†   )rý   r  r^   r@   r7   r­   r®   r   rF   r°   r±   rô   r²   r_   r   r{   )
r   rÎ   r  r  rÉ   Úresponse_definitionr†   rö   r�   rG   s
             r   r  z#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.r1   r>   s     r   r9   z'NamedOperation._get_external_param_nameä  s   € àÐr!   N)	r-   r.   r/   r0   r    r  r  r  r9   r1   r!   r   r   r   D  sm   € € € € € ØGÐGð'ð 'ð 'ðHEð HEð HEðT
ð 
ð 
ð<
ð <
ð <
ð|ð ð ð ð r!   r   c                   ó\   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zˆ fd„Zd„ Z	d„ Z
dˆ fd
„	Zd„ Zˆ xZS )r   zBA class for an entry-type resource that can be updated with PATCH.c                 óÀ   •— t          t          | ¦  «                             ||¦  «         i | j        d<   t          t          | ¦  «                             ||¦  «         d S )NÚ_dirty_attributes)rÜ   r   r    rE   ©r   rF   rG   rç   s      €r   r    zEntry.__init__ì  sX   ø€ Ý�e�TÑÔ×#Ò# D¨-Ñ8Ô8Ð8ð .0ˆŒÐ)Ñ*Ý�e�TÑÔ×#Ò# D¨-Ñ8Ô8Ð8Ð8Ð8r!   c                 óL   — dt          | j        ¦  «        j        ›d| j        ›d�S )z:Return the WADL resource type and the URL to the resource.ú<z at ú>)r   r«   Úfragmentr8   rK   s    r   Ú__repr__zEntry.__repr__û  s0   € € õ �Ô'Ñ(Ô(Ô1Ð1Ð1ØŒNˆNˆNð
ð 	
r!   c                 ód   — | j         j                             t          | j        ¦  «        ¦  «        S )zDelete the resource.)rC   r•   rÍ   r   r8   rK   s    r   Ú	lp_deletezEntry.lp_delete  s%   € àŒzÔ"×)Ò)­#¨d¬nÑ*=Ô*=Ñ>Ô>Ð>r!   c                 ó   — | j         S )zReturn the URL to the resource.)r8   rK   s    r   Ú__str__zEntry.__str__  s
   € àŒ~Ðr!   c                 óŒ   •— |dk    r|| j         v r| j         |         S t          t          | ¦  «                             |¦  «        S )z-Try to retrive a parameter of the given name.r"  )r"  rÜ   r   rž   )r   r[   rç   s     €r   rž   zEntry.__getattr__
  sI   ø€ àÐ&Ò&Ð&Ø�tÔ-Ð-Ð-ØÔ-¨dÔ3Ð3Ý•U˜DÑ!Ô!×-Ò-¨dÑ3Ô3Ð3r!   c                 ó„   — |                       |¦  «        s t          d| j        j        ›d|›d�¦  «        ‚|| j        |<   dS )z$Set the parameter of the given name.r›   z' object has no attribute 'N)rt   rœ   rç   r-   r"  )r   r[   r+   s      r   Ú__setattr__zEntry.__setattr__  sZ   € à×$Ò$ TÑ*Ô*ð 	Ý �.à”>Ô*Ð*Ð*¨D¨D¨Dð2ñô ð ð (-ˆÔ˜tÑ$Ð$Ð$r!   c                 ój   — |duo/| j         |j         k    o| j        |j        k    o| j        |j        k    S )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     r   rÑ   zEntry.__eq__  sK   € ð ˜Ðð BØ” %¤/Ò1ðBà” %¤/Ò1ðBð Ô&¨%Ô*AÒAð		
r!   Nc                 ó®   •— t          | dd¦  «        }t          t          | ¦  «                             ||¦  «         | j                             ¦   «          dS )r’   r1  N)ÚgetattrrÜ   r   r™   r"  Úclear)r   r—   r˜   rç   s      €r   r™   zEntry.lp_refresh(  sO   ø€ å�t˜[¨$Ñ/Ô/ˆÝ�e�TÑÔ×%Ò% g¨tÑ4Ô4Ð4ØÔ×$Ò$Ñ&Ô&Ð&Ð&Ð&r!   c                 ó>  — |                       | j        ¦  «        }i }t          | dd¦  «        }|�||d<   | j        j                             t          | j        ¦  «        ||¦  «        \  }}|j        dk    r|  	                    |d         ¦  «         | j         
                    ¦   «          |d         }|j        dk    r^|| j        k    rUt          |t          ¦  «        r|                     d¦  «        }t          |¦  «        }|| j        _        || j        _        dS dS dS )	zSave changes to the entry.r1  NzIf-Matchr  r  r  éÑ   rª   )r<   r"  r3  rC   r•   Úpatchr   r8   r  r™   r4  r@   r7   r­   r®   r   rD   rŒ   rd   )r   rŒ   r“   r˜   r  r  rÉ   Ú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/   r0   r    r(  r*  r,  rž   r/  rÑ   r™   r9  rù   rú   s   @r   r   r   é  sÏ   ø€ € € € € ØLÐLð9ð 9ð 9ð 9ð 9ð
ð 
ð 
ð?ð ?ð ?ðð ð ð4ð 4ð 4ð 4ð 4ð-ð -ð -ð
ð 
ð 
ð'ð 'ð 'ð 'ð 'ð 'ð:ð :ð :ð :ð :ð :ð :r!   r   c                   óF   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
ˆ xZS )	r   z4A collection-type resource that supports pagination.c                 óZ   •— t          t          | ¦  «                             ||¦  «         dS )zCreate a collection object.N)rÜ   r   r    r#  s      €r   r    zCollection.__init__S  s)   ø€ å�j˜$ÑÔ×(Ò(¨¨}Ñ=Ô=Ð=Ð=Ð=r!   c                 ó”   — | j         }t          |t          ¦  «        r|S t          |t          ¦  «        r|j        S t          d¦  «        ‚)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  )r   r=  s     r   Ú__len__zCollection.__len__W  sS   € ð ”_ˆ
Ý�j¥#Ñ&Ô&ð 		@ð ÐÝ˜
¥KÑ0Ô0ð 	@ð Ô#Ð#åÐ>Ñ?Ô?Ð?r!   c              #   ó¦  K  — |                       ¦   «          | j        j        }	 |                      |                     di ¦  «        ¦  «        D ]}|V — Œ|                     d¦  «        }|€dS | j        j                             t          |¦  «        ¦  «        }t          |t          ¦  «        r| 
                    d¦  «        }t          |¦  «        }Œ¯)zqIterate over the items in the collection.

        :return: iterator
        :rtype: sequence of `Entry`
        TÚentriesÚnext_collection_linkNrª   )rw   rD   rŒ   Ú_convert_dicts_to_entriesr$   rC   r•   r   r7   r­   r®   r   )r   Úcurrent_pager‹   Ú	next_linkÚnext_gets        r   Ú__iter__zCollection.__iter__i  sÙ   è è € ð 	×#Ò#Ñ%Ô%Ð%ØÔ*Ô9ˆð	+Ø ×:Ò:Ø× Ò  ¨BÑ/Ô/ñô ð ð �ð ����Ø$×(Ò(Ð)?Ñ@Ô@ˆIØÐ Ø�Ø”zÔ*×.Ò.­s°9©~¬~Ñ>Ô>ˆHÝ˜(¥KÑ0Ô0ð 4Ø#Ÿ?š?¨7Ñ3Ô3�Ý  ™?œ?ˆLð	+r!   c                 óö   — t          |t          ¦  «        r|                      |¦  «        S |                      t          ||dz   ¦  «        ¦  «        }t          |¦  «        dk    rt	          d¦  «        ‚|d         S )ac  Look 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ò   zlist index out of ranger   )r7   ÚsliceÚ
_get_slicer¥   Ú
IndexError)r   r&   Úfound_slices      r   r,   zCollection.__getitem__~  su   € õ �c�5Ñ!Ô!ð 	"Ø—?’? 3Ñ'Ô'Ð'ð Ÿ/š/­%°°S¸1±WÑ*=Ô*=Ñ>Ô>ˆKÝ�;ÑÔ 1Ò$Ð$Ý Ð!:Ñ;Ô;Ð;Ø˜q”>Ð!r!   c                 óÌ  — |j         pd}|j        }|dk     rt          d¦  «        ‚|dk     rt          d¦  «        ‚| j        j        }|�P|t          |d         ¦  «        k     r7|d         }t          |¦  «        }|||…         }|                     d¦  «        }n%d}g }|                      | j        j        d|¦  «        }||z
  }	|	t          |¦  «        z
  }
|
dk    rÕ|�Ó| j	        j
                             |¦  «        }t          |t          ¦  «        r|                     d¦  «        }t          |¦  «        }|d         }||d|
…         z  }|	t          |¦  «        z
  }
|                     d¦  «        }|€n<|€t          |¦  «        }|
dk    r|
|k     r|                      |d	|
¦  «        }|
dk    r|­Ó|j        �|dd|j        …         }d
„ |                      |¦  «        D ¦   «         S )z!Retrieve a slice of a collection.r   z6Collection slices must have a nonnegative start point.z>Collection slices must have a definite, nonnegative end point.NrA  rB  zws.startrª   zws.sizec                 ó   — g | ]}|‘ŒS r1   r1   )r¡   r‹   s     r   r£   z)Collection._get_slice.<locals>.<listcomp>è  s(   € ð 
ð 
ð 
àð ð
ð 
ð 
r!   )ÚstartÚstoprÇ   rD   rŒ   r¥   r$   Ú_with_url_query_variable_setrÎ   rC   r•   r7   r­   r®   r   ÚsteprC  )r   rI  rO  rP  Úexisting_representationÚ
entry_pageÚfirst_page_sizeÚentry_dictsÚpage_urlÚdesired_sizeÚmore_neededÚpage_getrŒ   Úcurrent_page_entriess                 r   rJ  zCollection._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         }| j         j        }|                     |¦  «        }t          | j         j        ||j        ¦  «        }t
                               | j        ||| j        d¦  «        V — Œ~dS )a  Convert 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.
        r8   r«   FN)	rD   Úapplicationr±   rô   r²   r   r{   rC   r@   )r   rA  Ú
entry_dictÚresource_urlr«   Úwadl_applicationr�   r‹   s           r   rC  z$Collection._convert_dicts_to_entriesí  s·   è è € ð "ð 	ð 	ˆJØ% kÔ2ˆLØ!+Ð,@Ô!AÐØ#Ô2Ô>ÐØ,×>Ò>Ø"ñô ˆMõ $ØÔ#Ô/ØØÔ!ñô ˆHõ
 ×1Ò1Ø”
˜H j°$Ô2FÈñô ð ð ð ð ð	ð 	r!   c                 óÈ   — t          |¦  «        }|j        €i }nt          |j        ¦  «        }t          |¦  «        ||<   t	          |d¦  «        |_        t          |¦  «        S )z1A helper method to set a query variable in a URL.NT)r   rT   r   rÕ   r   )r   rÎ   ÚvariableÚ	new_valueÚurir]   s         r   rQ  z'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/   r0   r    r?  rG  r,   rJ  rC  rQ  rù   rú   s   @r   r   r   P  sŸ   ø€ € € € € Ø>Ð>ð>ð >ð >ð >ð >ð@ð @ð @ð$+ð +ð +ð*"ð "ð "ð$[
ð [
ð [
ðzð ð ð8	ð 	ð 	ð 	ð 	ð 	ð 	r!   r   c                   ó2   ‡ — e Zd ZdZˆ fd„Zd„ ZdZd„ Zˆ xZS )r   z¼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(t          t          | ¦  «                             |¦  «        S 	 |                      |¦  «        }n# t          $ r t          d¦  «        ‚w xY w|€t          |¦  «        ‚ | |¦  «        }	 | 	                    ¦   «          n2# t          $ r%}|j        j        dk    rt          |¦  «        ‚‚ d}~ww xY w|S )z8Look up a slice, or a subordinate resource by unique ID.úunsubscriptable objectNé”  )r7   rI  rÜ   r   r,   Ú_get_url_from_idÚNotImplementedErrorr  r*   rw   r   r  r  )r   r&   rÎ   Úshim_resourceÚerç   s        €r   r,   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ÃCc                 óˆ  — 	 |                       |¦  «        }n# t          $ r t          d¦  «        ‚w xY w|€t          |¦  «        ‚| j        �*d}t          | j        j        j        d| j        z   ¦  «        }n”	 | j        j	         
                    |¦  «        }t          |t          ¦  «        r|                     d¦  «        }t          |¦  «        }n2# t          $ r%}|j        j        dk    rt%          |¦  «        ‚‚ d}~ww xY w|d         }t'          | j        j        ||¦  «        }|                      | j        ||d¬¦  «        S )	z=Retrieve a member from this collection without looking it up.rg  Nú#rª   rh  r«   F)rŒ   rŽ   )ri  rj  r  rÇ   Úcollection_ofr   rC   r°   Ú
markup_urlr•   r$   r7   r­   r®   r   r   r  r  r*   rô   r{   )r   r&   rÎ   rŒ   r«   Úurl_getÚerrorr‹   s           r   r  z%CollectionWithKeyBasedLookup.__call__2  sj  € ð	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Á8AC Ã
D Ã C;Ã;D Nc                 ó   — t          ¦   «         ‚)z2Transform the unique ID of an object into its URL.)rj  )r   r&   s     r   ri  z-CollectionWithKeyBasedLookup._get_url_from_idh  s   € å!Ñ#Ô#Ð#r!   )	r-   r.   r/   r0   r,   r  ro  ri  rù   rú   s   @r   r   r     sh   ø€ € € € € ðð ðð ð ð ð ð,0
ð 0
ð 0
ðh €Mð$ð $ð $ð $ð $ð $ð $r!   r   c                   ó&   — e Zd ZdZdd„Zd„ Zd„ ZdS )rÆ   z8The contents of a file hosted by a lazr.restful service.Nc                 óx  — |j         j        | _        |dk    r®|�t          d¦  «        ‚|�t          d¦  «        ‚|j        j                             | j        d¬¦  «        \  }}|d         }|                     d¦  «        }|d         }t          |¦  «        d	         }	t          |	                     d
¦  «        d         ¦  «        }n<|dk    r'd}|€t          d¦  «        ‚|€t          d¦  «        ‚d }nt          d¦  «        ‚|| _	        || _
        || _        || _        || _        t          j        | |¦  «         d S )NrÂ   z8Files opened for read access can't specify content_type.z4Files opened for read access can't specify filename.T)Úreturn_responser  zlast-modifiedzcontent-locationé   rÔ   r…   rÄ   r!   z8Files opened for write access must specify content_type.z4Files opened for write access must specify filename.rÅ   )rD   rÎ   rÇ   rC   r•   r$   r   r   ÚsplitÚhosted_filerÈ   rÉ   rÊ   Úlast_modifiedr
   r    )
r   ry  rÈ   rÉ   rÊ   r  r+   rz  Úcontent_locationÚpaths
             r   r    zHostedFileBuffer.__init__p  sz  € ØÔ-Ô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                 óâ   — | j         dk    rOd| j        z  }| j        j        j                             | j        |                      ¦   «         | j        d|i¦  «         t          j
        | ¦  «         d S )NrÄ   zattachment; filename="%s"zContent-Disposition)rÈ   rÊ   ry  rC   r•   ÚputrÎ   ÚgetvaluerÉ   r
   Úclose)r   Údispositions     r   r€  zHostedFileBuffer.closeŸ  sr   € ØŒ9˜ÒÐØ5¸¼ÑEˆKØÔÔ"Ô+×/Ò/Ø”Ø—’‘”ØÔ!Ø&¨Ð4ñ	ô ð õ 	Œ�dÑÔÐÐÐr!   c                 ó0   — t          j        | |¦  «         d S r   )r
   Úwrite)r   Úbs     r   rƒ  zHostedFileBuffer.writeª  s   € ÝŒ�d˜AÑÔÐÐÐr!   r¸   )r-   r.   r/   r0   r    r€  rƒ  r1   r!   r   rÆ   rÆ   m  sM   € € € € € ØBÐBð-&ð -&ð -&ð -&ð^	ð 	ð 	ðð ð ð ð r!   rÆ   )4r0   r  Ú__metaclass__Ú__all__Úemail.messager	   Úior
   Újsonr   r   Úurllib.parser   r   r   r   r   ÚImportErrorÚurllibÚsysÚversion_inforÕ   Ú	text_typeÚbytesr­   ÚunicodeÚwadllib.applicationr   rô   Úlazr.restfulclientr   Úlazr.restfulclient._browserr   r   Úlazr.restfulclient._jsonr   Úlazr.restfulclient.errorsr   Úlazr.urir   r¹   r)   r   r3   r¾   rÁ   r   r   r   r   r   rÆ   r1   r!   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ð
ð 
ð 
ð 
ð 
�ñ 
ô 
ð 
ðBv
ð v
ð v
ð v
ð v
�(ñ v
ô v
ð v
ðrbð bð bð bð b�[ñ bô bð bðJd:ð d:ð d:ð d:ð d:ˆHñ d:ô d:ð d:ðNBð Bð Bð Bð B�ñ Bô Bð BðJU$ð U$ð U$ð U$ð U$ :ñ U$ô U$ð U$ðp>ð >ð >ð >ð >�wñ >ô >ð >ð >ð >s   ž- ­AÁA