U
    pd+                     @   s@   d Z ddlZG dd deZG dd deZG dd deZdS )	z=
The objects used by the site module to add custom builtins.
    Nc                   @   s&   e Zd Zdd Zdd ZdddZdS )	Quitterc                 C   s   || _ || _d S Nnameeof)selfr   r    r   #/usr/lib/python3.8/_sitebuiltins.py__init__   s    zQuitter.__init__c                 C   s   d| j | jf S )NzUse %s() or %s to exitr   r   r   r   r	   __repr__   s    zQuitter.__repr__Nc                 C   s(   zt j  W n   Y nX t|d S r   )sysstdinclose
SystemExit)r   coder   r   r	   __call__   s
    zQuitter.__call__)N)__name__
__module____qualname__r
   r   r   r   r   r   r	   r      s   r   c                   @   s6   e Zd ZdZdZdddZdd Zdd	 Zd
d ZdS )_Printerzninteractive prompt objects for printing the license text, a list of
    contributors and the copyright notice.   r   c                    s4   dd l || _|| _d | _ fdd|D | _d S )Nr   c                    s$   g | ]} D ]}j ||qqS r   )pathjoin).0dirfilenamefilesosr   r	   
<listcomp>(   s    z%_Printer.__init__.<locals>.<listcomp>)r   _Printer__name_Printer__data_Printer__lines_Printer__filenames)r   r   datar   dirsr   r   r	   r
   #   s    z_Printer.__init__c              
   C   s~   | j r
d S d }| jD ]B}z(t|d}| }W 5 Q R X W  qXW q tk
rT   Y qX q|sb| j}|d| _ t| j | _d S )Nr
)	r#   r$   openreadOSErrorr"   splitlenZ_Printer__linecnt)r   r%   r   fpr   r   r	   Z__setup,   s    

z_Printer.__setupc                 C   s8   |    t| j| jkr$d| jS d| jfd  S d S )Nr(   z!Type %s() to see the full %s text   )_Printer__setupr-   r#   MAXLINESr   r!   r   r   r   r	   r   <   s    z_Printer.__repr__c                 C   s   |    d}d}z(t||| j D ]}t| j|  q"W n tk
rP   Y qY qX || j7 }d }|d kr~t|}|dkr`d }q`|dkrqqd S )Nz0Hit Return for more, or q (and Return) to quit: r   ) qr3   )r0   ranger1   printr#   
IndexErrorinput)r   Zpromptlinenoikeyr   r   r	   r   C   s     

z_Printer.__call__N)r   r   )	r   r   r   __doc__r1   r
   r0   r   r   r   r   r   r	   r      s   
	r   c                   @   s    e Zd ZdZdd Zdd ZdS )_Helpera3  Define the builtin 'help'.

    This is a wrapper around pydoc.help that provides a helpful message
    when 'help' is typed at the Python interactive prompt.

    Calling help() at the Python prompt starts an interactive help session.
    Calling help(thing) prints help for the python object 'thing'.
    c                 C   s   dS )NzHType help() for interactive help, or help(object) for help about object.r   r   r   r   r	   r   b   s    z_Helper.__repr__c                 O   s   dd l }|j||S )Nr   )pydochelp)r   argskwdsr=   r   r   r	   r   e   s    z_Helper.__call__N)r   r   r   r;   r   r   r   r   r   r	   r<   X   s   	r<   )r;   r   objectr   r   r<   r   r   r   r	   <module>   s   
;