
    jjr                    N    d dl mZ d dlmZ d Zd Zd Zd Zedk(  r e        yy)	    )annotations)getfullargspecc                   t        d | j                         j                         D              }| j                         }|s|st        | j
                  |          S |r|r|j                  d       d| j
                  j                   ddj                  |      dj                  |D cg c]  \  }}| d|  c}}      z    dS c c}}w )a  
    Return a helpful description of the object using
    self._repr_words() and self._repr_attrs() to add
    to the description.  This function may be used by
    adding code to your class like this:

    >>> class Foo(object):
    ...     __repr__ = split_repr
    ...
    ...     def _repr_words(self):
    ...         return ["words", "here"]
    ...
    ...     def _repr_attrs(self):
    ...         return {"attrs": "appear too"}
    >>> Foo()
    <Foo words here attrs='appear too'>
    >>> class Bar(Foo):
    ...     def _repr_words(self):
    ...         return Foo._repr_words(self) + ["too"]
    ...
    ...     def _repr_attrs(self):
    ...         return dict(Foo._repr_attrs(self), barttr=42)
    >>> Bar()
    <Bar words here too attrs='appear too' barttr=42>
    c              3  N   K   | ]  \  }}t        |      t        |      f  y wN)strnormalize_repr.0kvs      Y/home/ubuntu/.cache/pipx/cdb5059130eadca/lib/python3.12/site-packages/urwid/split_repr.py	<genexpr>zsplit_repr.<locals>.<genexpr>4   s"     V41aCFN1-.V   #% < =>)
sorted_repr_attrsitems_repr_wordssuper	__class____repr__append__name__join)selfalistwordsr   r   s        r   
split_reprr#      s    4 V4;K;K;M;S;S;UVVEE T^^T355Rt~~&&'q%388\aDbTXTUWXs!A3ZDb;c)c(ddeffDbs   (Cc                    t        | t              r<t        d | j                         D              }ddj	                  d |D               dS t        |       S )z
    Return dictionary repr sorted by keys, leave others unchanged

    >>> normalize_repr({1: 2, 3: 4, 5: 6, 7: 8})
    '{1: 2, 3: 4, 5: 6, 7: 8}'
    >>> normalize_repr("foo")
    "'foo'"
    c              3  N   K   | ]  \  }}t        |      t        |      f  y wr   )reprr
   s      r   r   z!normalize_repr.<locals>.<genexpr>J   s!     @daQa)@r   {z, c              3  0   K   | ]  \  }}| d |   yw)z: N r
   s      r   r   z!normalize_repr.<locals>.<genexpr>L   s     <da2aSk<s   })
isinstancedictr   r   r   r&   )r   r   s     r   r	   r	   @   sL     !T@aggi@@DII<e<<=R@@7N    c           	         t        |      \  }}}}}}}|r|d= |r|d= t        t        |t        |      t        |      z
  d |            }t	        | j                               D ]  }||v s||   | |   k(  s| |=  | S )a  
    Remove keys in d that are set to the default values from
    fn.  This method is used to unclutter the _repr_attrs()
    return value.

    d will be modified by this function.

    Returns d.

    >>> class Foo(object):
    ...     def __init__(self, a=1, b=2):
    ...         self.values = a, b
    ...
    ...     __repr__ = split_repr
    ...
    ...     def _repr_words(self):
    ...         return ["object"]
    ...
    ...     def _repr_attrs(self):
    ...         d = dict(a=self.values[0], b=self.values[1])
    ...         return remove_defaults(d, Foo.__init__)
    >>> Foo(42, 100)
    <Foo object a=42 b=100>
    >>> Foo(10, 2)
    <Foo object a=10>
    >>> Foo()
    <Foo object>
    N)r   r,   ziplenlistkeys)	dfnargsvarargsvarkwdefaults_ddictr   s	            r   remove_defaultsr<   Q   s    : /=R.@+D'5(Aq! HH T#d)c(m356ABE!&&(^ :%(ad*!
 Hr-   c                 ,    dd l } | j                          y )Nr   )doctesttestmod)r>   s    r   _testr@      s    OOr-   __main__N)	
__future__r   inspectr   r#   r	   r<   r@   r   r)   r-   r   <module>rD      s8   * # "#gL"-` z	G r-   