o
    †Q `¶  ã                   @   s:   d Z ddlmZ ddlZejrddlmZmZ dd„ ZdS )z$Tools to generate __repr__ strings.
é    )Úunicode_literalsN)ÚTextÚTuplec                 O   s<   dd„ |D ƒ}|  dd„ t| ¡ ƒD ƒ¡ d | d |¡¡S )a|  Generate a repr string.

    Positional arguments should be the positional arguments used to
    construct the class. Keyword arguments should consist of tuples of
    the attribute value and default. If the value is the default, then
    it won't be rendered in the output.

    Example:
        >>> class MyClass(object):
        ...     def __init__(self, name=None):
        ...         self.name = name
        ...     def __repr__(self):
        ...         return make_repr('MyClass', 'foo', name=(self.name, None))
        >>> MyClass('Will')
        MyClass('foo', name='Will')
        >>> MyClass(None)
        MyClass()

    c                 S   s   g | ]}t |ƒ‘qS © )Úrepr)Ú.0Úargr   r   ú*/usr/lib/python3/dist-packages/fs/_repr.pyÚ
<listcomp>!   s    zmake_repr.<locals>.<listcomp>c                 S   s(   g | ]\}\}}||krd   ||¡‘qS )z{}={!r})Úformat)r   ÚnameÚvalueÚdefaultr   r   r	   r
   #   s    
ý
ÿz{}({})z, )ÚextendÚsortedÚitemsr   Újoin)Ú
class_nameÚargsÚkwargsZ	argumentsr   r   r	   Ú	make_repr   s   
þÿr   )Ú__doc__Z
__future__r   ÚtypingZTYPE_CHECKINGr   r   r   r   r   r   r	   Ú<module>   s    