File manager - Edit - /snap/core22/2411/usr/lib/python3/dist-packages/urwid/__pycache__/split_repr.cpython-310.pyc
Back
o ��o_� � @ s| d dl mZmZ d dlmZmZ esd dlmZ nd dlmZ dd� Z dd� Z d d � Zdd� Zd d� Z edkr<e � dS dS )� )�division�print_function)�PYTHON3�bytes)� getargspec)�getfullargspecc C sz dd� | � � �� D �}|�� | �� }|s|st| j| ��� S |r(|r(|�d� d| jjd� |�d� dd� |D �� f S )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 S s g | ]\}}t |�t|�f�qS � )�str�normalize_repr��.0�k�vr r �2/usr/lib/python3/dist-packages/urwid/split_repr.py� <listcomp>5 s �zsplit_repr.<locals>.<listcomp>� z<%s %s>� c S � g | ]}d | �qS )z%s=%sr �r �itmr r r r @ s ) �_repr_attrs�items�sort�_repr_words�super� __class__�__repr__�append�__name__�join)�self�alist�wordsr r r � split_repr s ���r# c C sH t | t�r dd� | �� D �}|�� dd�dd� |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 S s g | ]\}}t |�t |�f�qS r )�reprr r r r r L s z"normalize_repr.<locals>.<listcomp>�{z, c S r )z%s: %sr r r r r r N s ��})� isinstance�dictr r r r$ )r r r r r r B s ��r c C s8 t | �}tst| t�rd| S |�d�r|dd� S |S )z� Return strings and byte strings as they appear in Python 3 >>> python3_repr(u"text") "'text'" >>> python3_repr(bytes()) "b''" �b�u� N)r$ r r'