Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
pyclbr.cpython-314.pyc127 linesDownload Raw Back to __pycache__
1+
2��i�,����Rt^RIt^RIt^RIt.ROt/t!RR4t!RR]4t!RR]4t	RRlt3RR	ltRR4ltRRlt
RRlt!R
R]P4tRtRt]R8Xd5]!4R#R#)aParse a Python module and describe its classes and functions.6 7Parse enough of a Python file to recognize imports and class and8function definitions, and to find out the superclasses of a class.9 10The interface consists of a single function:11    readmodule_ex(module, path=None)12where module is the name of a Python module, and path is an optional13list of directories where the module is to be searched.  If present,14path is prepended to the system search path sys.path.  The return value15is a dictionary.  The keys of the dictionary are the names of the16classes and functions defined in the module (including classes that are17defined via the from XXX import YYY construct).  The values are18instances of classes Class and Function.  One special key/value pair is19present for packages: the key '__path__' has a list as its value which20contains the package search path.21 22Classes and Functions have a common superclass: _Object.  Every instance23has the following attributes:24    module  -- name of the module;25    name    -- name of the object;26    file    -- file in which the object is defined;27    lineno  -- line in the file where the object's definition starts;28    end_lineno -- line in the file where the object's definition ends;29    parent  -- parent of this object, if any;30    children -- nested objects contained in this object.31The 'children' attribute is a dictionary mapping names to objects.32 33Instances of Function describe functions with the attributes from _Object,34plus the following:35    is_async -- if a function is defined with an 'async' prefix36 37Instances of Class describe classes with the attributes from _Object,38plus the following:39    super   -- list of super classes (Class instances if possible);40    methods -- mapping of method names to beginning line numbers.41If the name of a super class is not recognized, the corresponding42entry in the list of super classes is not a class instance but a43string giving the name of the super class.  Since import statements44are recognized and imported modules are scanned as well, this45shouldn't happen often.46N�Class�Functionc�*a�]tRt^5toRtRtRtVtR#)�_Objectz+Information about Python class or function.c��WnW nW0nW@nWPnW`n/VnVeWPV&R#R#�N)�module�name�file�lineno�47end_lineno�parent�children)�selfrr	r48rrr
s&&&&&&&�
Lib\pyclbr.py�__init__�_Object.__init__7s>�����	��	���$������
���$(�O�O�D�!��)rrr49rrr	r
N)�__name__�50__module__�__qualname__�__firstlineno__�__doc__r�__static_attributes__�__classdictcell__��
__classdict__s@rrr5s����1�	)�	)rrc�Baa�]tRt^DtoRtRRR/V3RllltRtVtV;t#)rz7Information about a Python function, including methods.Nrc�<�\SV`WW4Wu4W`n\V\4'dWEP51V&R#R#r)�superr�is_async�52isinstancer�methods)	rrr	r53rr
r r�	__class__s	&&&&&&&$�rr�Function.__init__Fs7���
����t�Z�H� �
��f�e�$�$�#)�N�N�4� �%r�r )NF�	rrrrrrrr�
__classcell__�r#rs@@rrrDs����=�*�<@�*�*�*rc�Baa�]tRt^NtoRtRRR/V3RllltRtVtV;t#)rz!Information about a Python class.Nrc�Z<�\SV`WWEWv4T;'g.Vn/VnR#r)rrr")	rrr	�super_r54rr
rr#s	&&&&&&&$�rr�Class.__init__Ps(���
����t�Z�H��\�\�r��55���r)r"rrr&r(s@@rrrNs����'��,0���rc56�J�\VPWPVWVR7#)z*Return a Function after nesting within ob.)r
r r)rrr57)�ob�	func_namerrr s&&&&&r�_nest_functionr0Ys$���B�I�I�y�'�'�6��Z�I�Irc58�J�\VPWVPVWR7#)z'Return a Class after nesting within ob.�r
r)rrr59)r.�60class_namerrrs&&&&&r�_nest_classr4^s"������J�r�w�w���3�3rc��/p\Y;'g.4P4F!wr4\V\4'gKWBV&K#	V#)zxReturn Class objects for the top-level classes in module.61 62This is the original interface, before Functions were added.63)�_readmodule�itemsr!r)r�path�res�key�values&&   r�64readmoduler<dsD��
�C�!�&�*�*�"�5�;�;�=�65���e�U�#�#���H�>��Jrc�,�\Y;'g.4#)z�Return a dictionary with all functions and classes in module.66 67Search for module in PATH + sys.path.68If possible, include imported superclasses.69Do this by reading source, without importing (and executing) it.70)r6)rr8s&&r�
readmodule_exr>ps���v�z�z�r�*�*rc�D�VeV:RV:2pMTpV\9d\V,#/pV\P9dVfV\V&V#VPR4pV^8�d^VRVpW^,Rp\	WaV4pVe71V:RV:2pRV9g\RP
V44h\	WxR,V4#Rp	VeTp72MV\P,p73\PPW:4pVf\RV:2VR7hV\V&VPeVPVR&VPPV4pVfV#TPP!T4p
\#Y1Y�YB4# \\743dTu#i;i)aDo the hard work for readmodule[_ex].75 76If inpackage is given, it must be the dotted name of the package in77which we are searching for a submodule, and then PATH must be the78package search path; otherwise, we are searching for a top-level79module, and path is combined with sys.path.80N�.�__path__zNo package named {}zno module named )r	)�_modules�sys�builtin_module_names�rfindr6�ImportError�formatr8�	importlib�util�_find_spec_from_path�ModuleNotFoundError�submodule_search_locations�loader�81get_source�AttributeError�get_filename�_create_tree)rr8�	inpackage�82fullmodule�tree�i�package�	submoduler
�f�search_path�spec�source�fnames&&&           rr6r6zs����� )�6�2�83��84��X���85�#�#��D���)�)�)�i�.?�������	���S��A��A�v���!�*���Q�3�4�L�	��W�I�6��� �!*�G�4�G��V�#��3�:�:�7�C�D�D��9�Z�&8�'�B�B�	
�A������S�X�X�o���>�>�.�.�z�G�D��|�!�$4�Z�N�"C�*�U�U��H�Z���&�&�2��:�:��Z������'�'�86�3��87�>��K��
�K�K�$�$�Z�0�E��88�%��I�I��
�K�(�����s�?F	�	F�Fc�La�]tRt^�toRtRtRR/RltRtRtRt	R	t89VtR90#)�_ModuleBrowserc�P�W nW@nW0nWnWPn.VnR#r)r8rTr91rrR�stack)rrr8r92rTrRs&&&&&&rr�_ModuleBrowser.__init__�s"���	��	��	���"����93rc94�<�.pVPF�p\P!V4pW@P9d%VP	VPV,4KM\VP
R4;p4^8�d@VEvrgpV\9d.VP	\V,PW�44K�K�VP	V4K�	VP'dVPR,MRp	\VPVPW PVPW�PR7pV	fW�PVP&VPP	V4VP!V4VPP#4R#)r@Nr2�����)�bases�ast�unparserT�append�len�splitrB�getr`rrr	r95rr�
generic_visit�pop)96r�noderd�baser	�names�_r�class_r
s97&&        r�visit_ClassDef�_ModuleBrowser.visit_ClassDef�s$�����J�J�D��;�;�t�$�D��y�y� ����T�Y�Y�t�_�-��d�j�j��o�-�U�.��2�&+�"��F��X�%��L�L��&�!1�!5�!5�f�!C�D�&����T�"��$(�:�:�:����B��4���t�{�{�D�I�I�u�i�i����$���B���>�#)�I�I�d�i�i� ��98�99���&�!����4� ��100�101���rr Fc102��VP'dVPR,MRp\VPVPVPVP103W2VPR7pVfW@PVP&VPPV4VPV4VPP4R#)�N)rrc)r`rrr	r104rrrTrgrkrl)rrmr r
�functions&&$  r�visit_FunctionDef� _ModuleBrowser.visit_FunctionDef�s���#'�:�:�:����B��4���D�K�K����D�I�I�t�{�{�"����J���>�#+�I�I�d�i�i� ��105�106���(�#����4� ��107�108���rc�,�VPVRR7R#)Tr%N)rw)rrms&&r�visit_AsyncFunctionDef�%_ModuleBrowser.visit_AsyncFunctionDef�s�����t�d��3rc�,�VP^8wdR#VPF0p\VPVPVP1094K2	R# \d\TP.4KZi;i \\3dKri;i)�N)�110col_offsetror6r	r8rRrF�SyntaxError)rrmrs&& r�visit_Import�_ModuleBrowser.visit_Import�sx���?�?�a����j�j�F�
�1�����T�Y�Y����G�!��#�1�����R�0�1����-�
��
�s)�+A�!A;�7A>�:A;�;A>�>B�Bc�x�VP^8wdR#RVP,pVP'dW!P,
p\W PVP1114pTPF�pTPT9d@Y#P,TPTP;'g
TP&KSTPR8XgKfTP4F,wrETPR4'dKYPPT&K.	K�	R# \\3dR#i;i)r}Nr@�*rp)r~�levelrr6r8rRrFrror	rT�asnamer7�112startswith)rrmrr	�import_name�import_values&&    r�visit_ImportFrom�_ModuleBrowser.visit_ImportFrom�s����?�?�a���	��4�:�:�%�F��{�{�{��+�+�%�� ����D�N�N�C�F��J�J�D��y�y�F�"�6<�Y�Y�6G��	�	�$�+�+�2�2����3����c�!�17����-�K�"�-�-�c�2�2� �-9�I�I�k�*�2@�	���[�)�	��	�s�$D$�2D$�$D9�8D9)r113rRrr8r`rTN)rrrrrrrrwrzr�r�rrrs@rr^r^�s/������2�%��4�
�:�:rr^c�~�\WW$V4pVP\P!V44VP#r)r^�visitre�parserT)rSr8r\r[rTrR�mbrowsers&&&&&& rrQrQ
s/���j��Y�G�H��N�N�3�9�9�V�$�%��=�=�rc��^RIp\P^,pTPPT4'dcTPP
T4.pTPPT4pTP4PR4'dTRR114pM.p\Y4pRp\TP4TRR7p^pT'EdrTP4p\T\4'dK1\!TR4'g^Tn\T\$4'dY\TP&P4TRR7pTFp	TP"T,T	nK	TP)T4\T\*4'dP\-RP/RTP",TP0TP2TP444EK\T\64'gEK6\-R	P/RTP",TP0TP444EKzR# \pEL8;i)z?Print module output (default this file) for quick visual check.Nz.pyc��\VR^4#)r)�getattr)�as&r�<lambda>�_main.<locals>.<lambda>"s
��7�1�h��2rT)r:�reverse�indentz{}class {} {} {}� z{}def {} {}�����)�osrC�argv�__file__r8�exists�dirname�basename�lower�endswithr>�sorted�valuesrlr!�list�hasattrr�rr�extendr�printrGr	rrr)115r��modr8rT�116lineno_key�objs�indent_level�obj�new_objsr.s117          r�_mainr�s���
���h�h�q�k��118�w�w�~�~�c���������$�%���g�g���s�#���9�9�;����&�&��c�r�(�C������#�D�2�J��$�+�+�-�Z��>�D��L�119�$��h�h�j���c�4� � ���s�H�%�%��C�J��c�7�#�#��c�l�l�1�1�3�",�d�<�H����J�J��5��	���K�K��!��c�5�!�!��$��6�#��120�121�*�C�H�H�c�i�i����L�
N�
��X�
&�
&��-�&�&�s�S�Z�Z�'7����3�:�:�N�O�%�����s�I122�123I�__main__)r<r>rr)Fr)rrerC�importlib.utilrH�__all__rBrrrr0r4r<r>r6�NodeVisitorr^rQr�r�rr�<module>r�s���)�V�124��125>��
��)�)�*�w�*��G��I�1263�127�+�=J�@P:�S�_�_�P:�f�$P�L�z��	�G�r
codekingpro/portable-devtools · Team Ai