a
    jCi+  ã                   @   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/local/lib/python3.9/_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0 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 ]T}z<t|dƒ�}| ¡ }W d   ƒ n1 sB0    Y  W  qjW q tyf   Y q0 q|st| 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yN   Y qˆY q0 || j7 }d }|d u r|t|ƒ}|dvr^d }q^|dkrqˆq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|i |¤Ž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   
;