U
    N8c@                     @   st   d dl mZ d dlmZ d dlmZ d dlmZ G dd deZ	G dd de	Z
G d	d
 d
e	ZG dd de	ZdS )    )DocumentStructuredocument_model_driven_methoddocument_paginate_methoddocument_wait_methodc                       sZ   e Zd ZdZ fddZ fddZdd Zdd	d
Zdd ZeZ	dd Z
dd Z  ZS )LazyLoadedDocstringa0  Used for lazily loading docstrings

    You can instantiate this class and assign it to a __doc__ value.
    The docstring will not be generated till accessed via __doc__ or
    help(). Note that all docstring classes **must** subclass from
    this class. It cannot be used directly as a docstring.
    c                    s    t    || _|| _d| _dS )z
        The args and kwargs are the same as the underlying document
        generation function. These just get proxied to the underlying
        function.
        N)super__init__	_gen_args_gen_kwargs
_docstringselfargskwargs	__class__ ;/tmp/pip-unpacked-wheel-ozje0y8b/botocore/docs/docstring.pyr      s    
zLazyLoadedDocstring.__init__c                    s   t  | S N)r
   __new__)clsr   r   r   r   r   r   '   s    zLazyLoadedDocstring.__new__c                 O   s   t dd S )Nzq_write_docstring is not implemented. Please subclass from this class and provide your own _write_docstring method)NotImplementedErrorr   r   r   r   _write_docstring+   s    z$LazyLoadedDocstring._write_docstring   c                 C   s   | j dkr|   | j |S )a  Expands tabs to spaces

        So this is a big hack in order to get lazy loaded docstring work
        for the ``help()``. In the ``help()`` function, ``pydoc`` and
        ``inspect`` are used. At some point the ``inspect.cleandoc``
        method is called. To clean the docs ``expandtabs`` is called
        and that is where we override the method to generate and return the
        docstrings.
        N)r   	_generate
expandtabs)r   tabsizer   r   r   r   1   s    

zLazyLoadedDocstring.expandtabsc                 C   s   |   S r   )r   r   r   r   r   __str__?   s    zLazyLoadedDocstring.__str__c                 C   s   | j d kr|  | _ | j S r   )r   _create_docstringr    r   r   r   r   E   s    

zLazyLoadedDocstring._generatec                 C   s0   t ddd}| j|f| j| j | dS )NZ	docstringhtml)targetzutf-8)r   r   r   r   Zflush_structuredecode)r   Zdocstring_structurer   r   r   r"   K   s    z%LazyLoadedDocstring._create_docstring)r   )__name__
__module____qualname____doc__r   r   r   r   r!   __repr__r   r"   __classcell__r   r   r   r   r	      s   
r	   c                   @   s   e Zd Zdd ZdS )ClientMethodDocstringc                 O   s   t || d S r   r   r   r   r   r   r   V   s    z&ClientMethodDocstring._write_docstringNr&   r'   r(   r   r   r   r   r   r,   U   s   r,   c                   @   s   e Zd Zdd ZdS )WaiterDocstringc                 O   s   t || d S r   r   r   r   r   r   r   [   s    z WaiterDocstring._write_docstringNr-   r   r   r   r   r.   Z   s   r.   c                   @   s   e Zd Zdd ZdS )PaginatorDocstringc                 O   s   t || d S r   r   r   r   r   r   r   `   s    z#PaginatorDocstring._write_docstringNr-   r   r   r   r   r/   _   s   r/   N)Zbotocore.docs.bcdoc.restdocr   Zbotocore.docs.methodr   Zbotocore.docs.paginatorr   Zbotocore.docs.waiterr   strr	   r,   r.   r/   r   r   r   r   <module>   s   B