U
    T                     @   s   d Z eZdgZzddlmZ W n  ek
r>   ddlmZ Y nX ddlm	Z	m
Z
 G dd de	ZG dd de	ZG d	d de
Zd
S )z5Test client for the lazr.restful example web service.CookbookWebServiceClient    )quote)CollectionWithKeyBasedLookupServiceRootc                   @   s   e Zd ZdZdd ZdZdS )CookbookSetz>A custom subclass capable of cookbook lookup by cookbook name.c                 C   s    t | jj d tt | S )z>Transform a cookbook name into the URL to a cookbook resource.z
cookbooks/)str_root	_root_uriensureSlashr   selfid r   B/usr/lib/python3/dist-packages/lazr/restfulclient/tests/example.py_get_url_from_id%   s
    
zCookbookSet._get_url_from_idZcookbookN__name__
__module____qualname____doc__r   Zcollection_ofr   r   r   r   r   "   s   r   c                   @   s   e Zd ZdZdd ZdZdS )	RecipeSetz8A custom subclass capable of recipe lookup by recipe ID.c                 C   s   t | jj d t | S )z8Transform a recipe ID into the URL to a recipe resource.zrecipes/)r   r   r	   r
   r   r   r   r   r   0   s    zRecipeSet._get_url_from_idZrecipeNr   r   r   r   r   r   -   s   r   c                       sF   e Zd ZeejZeed< eed< dZdZ	ee	df fdd	Z
  ZS )r   ZrecipesZ	cookbookszhttp://cookbooks.dev/z1.0Nc                    s   t t| jd |||d d S )N)cacheversion)superr   __init__)r   Zservice_rootr   r   	__class__r   r   r   @   s    
   z!CookbookWebServiceClient.__init__)r   r   r   dictr   ZRESOURCE_TYPE_CLASSESr   r   ZDEFAULT_SERVICE_ROOTZDEFAULT_VERSIONr   __classcell__r   r   r   r   r   7   s   
 N)r   typeZ__metaclass____all__Zurllib.parser   ImportErrorZurllibZlazr.restfulclient.resourcer   r   r   r   r   r   r   r   r   <module>   s   
