Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
split_repr.cpython-313.pyc71 linesDownload Raw Back to __pycache__
1�

2��jr��P�SSKJr SSKJr SrSrSrSr\S:Xa\"5 gg)	�)�annotations)�getfullargspecc
���[SUR5R555nUR5nU(dU(d[UR3U]5$U(aU(aURS5 SUR4RSSRU5SRUVVs/sHup4USU3PM snn5-S3$s snnf)a�5Return a helpful description of the object using6self._repr_words() and self._repr_attrs() to add7to the description.  This function may be used by8adding code to your class like this:9 10>>> class Foo(object):11...     __repr__ = split_repr12...13...     def _repr_words(self):14...         return ["words", "here"]15...16...     def _repr_attrs(self):17...         return {"attrs": "appear too"}18>>> Foo()19<Foo words here attrs='appear too'>20>>> class Bar(Foo):21...     def _repr_words(self):22...         return Foo._repr_words(self) + ["too"]23...24...     def _repr_attrs(self):25...         return dict(Foo._repr_attrs(self), barttr=42)26>>> Bar()27<Bar words here too attrs='appear too' barttr=42>28c3�R# �UHup[U5[U54v� M g7f�N)�str�normalize_repr��.0�k�vs   �VD:\code\apps\devtools\python\user_packages\Python313\site-packages\urwid/split_repr.py�	<genexpr>�split_repr.<locals>.<genexpr>4s"���V�;U�4�1�C��F�N�1�-�.�;U���%'��<� �=�>)29�sorted�_repr_attrs�items�_repr_words�super�	__class__�__repr__�append�__name__�join)�self�alist�wordsrr
s     r�30split_reprr$s���4
�V�4�;K�;K�;M�;S�;S�;U�V�V�E�����E����T�^�^�T�3�5�5���
���R��
�t�~�~�&�&�'�q����%��3�8�8�\a�Db�\a�TX�TU��s�!�A�3�Z�\a�Db�;c�)c�(d�de�f�f��Dbs�<Cc��[U[5(a<[SUR555nSSR	SU55S3$[U5$)z�31Return dictionary repr sorted by keys, leave others unchanged32 33>>> normalize_repr({1: 2, 3: 4, 5: 6, 7: 8})34'{1: 2, 3: 4, 5: 6, 7: 8}'35>>> normalize_repr("foo")36"'foo'"37c3�R# �UHup[U5[U54v� M g7fr)�reprr38s   rr�!normalize_repr.<locals>.<genexpr>Js���@�i�d�a��Q���a��)�i�r�{z, c3�4# �UHupUSU3v� M g7f)z: N�r39s   rrr(Ls���<�e�d�a���2�a�S�k�e�s��})�40isinstance�dictrrr r')r
rs  rr	r	@sO���!�T����@�a�g�g�i�@�@���D�I�I�<�e�<�<�=�R�@�@���7�N�c	��[U5up#pE  nU(aUS	U(aUS	[[U[U5[U5-41SU55n[	UR55HnX�;dM42XxX:XdMX	M U$)ac43Remove keys in d that are set to the default values from44fn.  This method is used to unclutter the _repr_attrs()45return value.46 47d will be modified by this function.48 49Returns d.50 51>>> class Foo(object):52...     def __init__(self, a=1, b=2):53...         self.values = a, b54...55...     __repr__ = split_repr56...57...     def _repr_words(self):58...         return ["object"]59...60...     def _repr_attrs(self):61...         d = dict(a=self.values[0], b=self.values[1])62...         return remove_defaults(d, Foo.__init__)63>>> Foo(42, 100)64<Foo object a=42 b=100>65>>> Foo(10, 2)66<Foo object a=10>67>>> Foo()68<Foo object>69�����N)rr.�zip�len�list�keys)	�d�fn�args�varargs�varkw�defaults�_�ddictrs	         r�remove_defaultsr>Qs���:/=�R�.@�+�D�5�A�q�!�
���H����H�
��T�#�d�)�c�(�m�3�5�6��A�B�E�
�!�&�&�(�^���:�%�(�a�d�*����70
�Hr/c�,�SSKnUR5 g)Nr)�doctest�testmod)r@s r�_testrB�s����O�O�r/�__main__N)	�71__future__r�inspectrr$r	r>rBrr+r/r�<module>rFs8��*#�"�#g�L�"-
�`��z��	�G�r/
codekingpro/portable-devtools · Team Ai