HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/sphinx/pycode/__pycache__/__init__.cpython-310.pyc
o

�$�a�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZmZmZmZdd	lmZdd
lmZddlmZddlmZGd
d�d�ZdS)z�
    sphinx.pycode
    ~~~~~~~~~~~~~

    Utilities parsing and analyzing Python code.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�OrderedDict)�
import_module)�	Signature��StringIO)�path)�IO�Any�Dict�List�Optional�Tuple)�ZipFile)�RemovedInSphinx50Warning)�PycodeError)�Parserc
@s�eZdZUeeeefefed<eeeefeefed<eeed<eeeefed<eee	fed<eeeee	e	ffed<iZ
eeeefefed<eded	ee
ee
effd
d��Zed$d
ededed	dfdd��Zededed	dfdd��Zededed	dfdd��Zeded	dfdd��Zdededed	dfdd�Zd%dd�Zd%dd�Zd	eeeefeeffd d!�Zd	eeeee	e	fffd"d#�ZdS)&�ModuleAnalyzer�annotations�	attr_docs�finals�	overloads�tagorder�tags�cache�modname�returnc	
Cs�zt|�}Wnty}ztd||�|�d}~wwt|dd�}t|dd�}|rGt|dd�rGz|�|�}|r<||fWSWn	tyFYnw|duro|rot|dd�roz|�|�}Wntyn}ztd||�|�d}~ww|durytd|��t�t�	|��}|�
��d	�r�|dd
�}t�|�s�t�|d�r�|d7}n.|�
��d�s�td
|��dtj
|vr�dt�tj
�}t�||d�\}}t�|�r�|dfSt�|�s�td|��|dfS)z�Try to find the source code for a module.

        Returns ('filename', 'source'). One of it can be None if
        no filename or source found
        zerror importing %rN�
__loader__�__file__�
get_source�get_filenamezerror getting filename for %rzno source found for module %r)z.pyoz.pyc����w)z.pyz.pywzsource is not a .py file: %r�.egg�
(?<=\.egg)�zsource file is not present: %r)r�	Exceptionr�getattrr�ImportErrorrr�normpath�abspath�lower�endswith�isfile�sep�re�escape�split)	r�mod�err�loader�filename�source�pat�eggpath�_�r9�8/usr/lib/python3/dist-packages/sphinx/pycode/__init__.py�get_module_source&sT��

�����

z ModuleAnalyzer.get_module_source�<string>�string�srcnamecCs|t|�||�S)Nr)�clsr=rr>r9r9r:�
for_stringVszModuleAnalyzer.for_stringr4c
Cs�d|f|jvr|jd|fSz't�|��}||||�}||jd|f<Wd�W|S1s.wYW|Stye}z$dtj|vrR|�||�}|jd|f<ntd||�|�WYd}~|Sd}~ww)N�filer"�error opening %r)r�tokenize�openr%rr-�for_eggr)r?r4r�f�objr2r9r9r:�for_file[s$���
���zModuleAnalyzer.for_filec	
Cs�t�tj�}t�d||�\}}z&t|��}|�|���}|�|||�Wd�WS1s/wYWdSt	yJ}zt
d||�|�d}~ww)Nr#rB)r.r/rr-r0r�read�decoder@r%r)	r?r4r�SEPr7�relpath�egg�code�excr9r9r:rEjs
(���zModuleAnalyzer.for_eggc
Cs�d|f|jvr|jd|f}t|t�r|�|Sz!|�|�\}}|dur-|�|||p*d�}n
|dur7|�||�}WntyL}z||jd|f<�d}~ww||jd|f<|S)N�moduler<)r�
isinstancerr;r@rH)r?r�entryr4r5rGr2r9r9r:�
for_moduleus&
���zModuleAnalyzer.for_moduler5NcCs ||_||_|��|_d|_dS)NF)rr>rIrN�	_analyzed)�selfr5rr>r9r9r:�__init__�s

zModuleAnalyzer.__init__cCstjdtdd�|��dS)zParse the source code.z%ModuleAnalyzer.parse() is deprecated.�)�
stacklevelN)�warnings�warnr�analyze�rUr9r9r:�parse�s�zModuleAnalyzer.parsec
Cs�|jrdSzDt|j�}|��t�|_|j��D]\}}|r)|��dg|j|<qdg|j|<q|j	|_	|j
|_
|j|_|j|_
|j|_d|_WdSty_}z
td|j|f�|�d}~ww)zAnalyze the source code.N�Tzparsing %r failed: %r)rTrrNr]rr�comments�items�
splitlinesrrr�definitionsr�	defordersrr%rr>)rU�parser�scope�commentrOr9r9r:r[�s(
��zModuleAnalyzer.analyzecC�|��|jS)z?Find class and module-level attributes and their documentation.)r[rr\r9r9r:�find_attr_docs��zModuleAnalyzer.find_attr_docscCrg)z?Find class, function and method definitions and their location.)r[rr\r9r9r:�	find_tags�rizModuleAnalyzer.find_tags)r<)rN)�__name__�
__module__�__qualname__r
r
�str�__annotations__rr�intrr	�staticmethodrr;�classmethodr@rHrErSrrVr]r[rhrjr9r9r9r:rs2
$/�

	
"$r)�__doc__r.rCrY�collectionsr�	importlibr�inspectr�ior�osr�typingrr	r
rrr
�zipfiler�sphinx.deprecationr�
sphinx.errorsr�sphinx.pycode.parserrrr9r9r9r:�<module>s