%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/orca/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/orca/__pycache__/debug.cpython-312.pyc

�

g
f�I���dZdZdZdZdZdZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
m
Z
ddlZejd	d
�ddlmZdd
lmZddlmZdZdZdZdZdZdZdZdZdZeZdZ eZ!dZ"dgZ#gd�Z$gZ%gZ&gZ'dZ(dZ)d�Z*d�Z+d�Z,d,d�Z-d,d�Z.d-d�Z/d.d �Z0d/d!�Z1d0d"�Z2d1d#�Z3d2d$�Z4ddl5Z5d%�Z6d&�Z7d'�Z8d(�Z9d)�Z:d*�Z;d3d+�Z<y)4z�Provides debug utilities for Orca.  Debugging is managed by a debug
level, which is held in the debugLevel field.  All other methods take
a debug level, which is compared to the current debug level to
determine if the content should be output.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2008 Sun Microsystems Inc.�LGPL�N)�datetime�Atspiz2.0)r�)�AXObject)�AXUtilitiesi'i�i�i i�iXi�i��orca)
�	traceback�	linecache�locale�gettext�logging�UserDict�	encodings�	posixpath�genericpath�reTc�x�|tk\r1t|�tjdt�t|�yy)zrPrints out information regarding the current exception.

    Arguments:
    - level: the accepted debug level
    �dN)�
debugLevel�printlnr
�	print_exc�	debugFile��levels �,/usr/lib/python3/dist-packages/orca/debug.py�printExceptionr�s/��
�
��������C��+�����c�z�|tk\r2t|�tjddt�t|�yy)zXPrints out the current stack.

    Arguments:
    - level: the accepted debug level
    Nr)rrr
�print_stackrrs r�
printStackr!�s1��
�
��������d�C��3����rc
�&�t|tj�r?tj|�}tj
|�}|r	|d|�d�z
}|sd}d|�d�St|tj�r~|j�dt|j��dttj|j���d|j�d	|j�d	t|j��d
�St|tjtjtj tj"tj$f�r|j&St|tj(�r7d|j*�d|j,�d
|j.�d|j0�d
�	St|t2�r#dd	j5t7t|���d�St|t8�rt;|�dkDr
|dd�d�}|St|t<j>�rctA|d�r<|jB�d|jDjFjH�d|jH��S|jB�d|jH��St|t<jJ�rHtA|d�r/|jDjFjH�d|jH��S|jH�St|t<jL�rDtOjP|jRjT�}|�d|jRjV��St|tNjX�r0tOjP|jZ�}|�d|j\��St9|�S)Nz: '�'�DEAD�[�]z for z in z (z, �)z(x:z, y:z, width:z	, height:rrz (...)�__self__�.)/�
isinstancer�
Accessibler�
get_role_name�get_name�Event�type�	_asString�source�get_application�detail1�detail2�any_data�Role�	StateType�CollectionMatchType�TextBoundaryType�
ScrollType�
value_nick�Rect�x�y�width�height�list�join�map�str�len�types�FunctionType�hasattr�
__module__r(�	__class__�__name__�
MethodType�	FrameType�inspect�
getmodulename�f_code�co_filename�co_name�	FrameInfo�filename�function)�obj�result�name�module_names    rr0r0�s����#�u�'�'�(��'�'��,��� � ��%�����D�6��m�#�F���F��6�(�!�}���#�u�{�{�#��x�x�j��i��
�
�3�4�D���1�1�#�*�*�=�>�?�@����}�B�s�{�{�m�2�i����.E�-F�a�
I�	
��#��
�
�E�O�O�U�5N�5N��.�.��0@�0@�B�C��~�~���#�u�z�z�"��S�U�U�G�4����w�h�s�y�y�k��3�:�:�,�a�P�P��#�t���4�9�9�S��C�0�1�2�!�4�4��#�s���C��3���Q�s���F�#���
��#�u�)�)�*��3�
�#��n�n�%�Q�s�|�|�'=�'=�'F�'F�&G�q�����W�W��.�.�!��3�<�<�.�1�1��#�u�'�'�(��3�
�#��l�l�,�,�5�5�6�a����~�F�F��,�,�� ��#�u���'��+�+�C�J�J�,B�,B�C����a��
�
� 2� 2�3�4�4��#�w�(�(�)��+�+�C�L�L�9����a����~�.�.��s�8�Orc���|tkrydjtt|��}t	j
dd|�}t	j
dd|�}t
||||�y)N� z
[ \u00A0]+z (?=[,.:)])(?![\n])�)rrBrCr0r�subr)r�tokens�	timestamp�stack�texts     r�printTokensrb�sU���z����8�8�C�	�6�*�+�D�
�6�6�-��d�+�D�
�6�6�(�"�d�3�D��E�4��E�*rc�4�|tkryt||||�y�N)rr�rrar_r`s    r�printMessagerfs���z����E�4��E�*rc���g}tjtj��}tj�}t	dt|��D]e}||}tj|d�}||k(r�&|jdk(r�6|�|j��E|j|�t|�|k\s�en|j�djtt|��S)Nrr�mainz > )
rN�	getmodule�currentframer`�rangerErUrK�append�reverserBrCr0)�
max_frames�callers�current_moduler`�i�frame�modules       r�_stackAsStringrts����G��&�&�w�';�';�'=�>�N��M�M�O�E�
�1�c�%�j�
!����a����"�"�5��8�,���^�#���>�>�V�#���>�V�_�_�4�����u���w�<�:�%����O�O���:�:�c�)�W�-�.�.rc��|tk\r�|jdd�}|r=|jddd���}tj�j	d��d|��}|r|dt���z
}tr	tj|dg�y
	tjj|dg�y
y
#t$rd}tj|dg�Yy
t$rd	}tj|dg�Yy
wxYw#t$r&d}tjj|dg�Yy
t$r&d	}tjj|dg�Yy
wxYw)z�Prints the text to stderr unless debug is enabled.

    If debug is enabled the text will be redirected to the
    file debugFile.

    Arguments:
    - level: the accepted debug level
    - text: the text to print (default is a blank line)
    uz[OBJ]�
�                  z%H:%M:%S.%fz - r[z#TypeError when trying to write textz#Exception when trying to write textN)r�replacer�now�strftimertr�
writelines�	TypeError�	Exception�sys�stderrres    rrrs>��
�
���|�|�H�g�.����<�<���8�*�o�6�D��l�l�n�-�-�m�<�=�S���G�D���a��(�)�*�*�D��
3��$�$�d�D�\�2�
4��
�
�%�%�t�T�l�3�'���
3�<���$�$�d�D�\�2��
3�<���$�$�d�D�\�2�
3���
4�<���
�
�%�%�t�T�l�3��
4�<���
�
�%�%�t�T�l�3�
4�s0�4B0�
!C;�0"C8�!C8�7C8�;,E�)+E�Ec��|tkrytj�}|d|d}}|d}tj|�}t	|j
j
��D]\}}t|�|j
|<�tjtj|�dd�}	dtj|d��d|d	�d
|d�dtj|d��d|d	�|	��}
|
�d|��}t||��y)
zmPrints the return result, along with information about the
    method, arguments, and any errors encountered.Nr�rr#r\zCALL:   r)�z (line z) -> z	
RESULT: )rrNr`�getargvaluesrA�locals�itemsrDrx�formatargvaluesrOr)rrWr`�current�prevrr�args�key�value�fArgs�
callString�strings            r�printResultr�Es��
�z����M�M�O�E��!�H�e�A�h�T�G��A�J�E�����&�D��4�;�;�,�,�.�/�&�
��U��u�:����C��&��K�K��/�/��6��R�@�E��7�(�(��a��1�2�!�D��G�9�G�D��G�9�M��$�$�W�Q�Z�0�1��7�1�:�,�u�g�	G���|�:�f�X�
.�F��E�f�X�rc��tr tj|j�syt|t�}d|g}t|||�|rt
|d�|��|�yy)atPrints out an Python Event object.  The given level may be
    overridden if the eventDebugLevel is greater.  Furthermore, only
    events with event types matching the eventDebugFilter regular
    expression will be printed.

    Arguments:
    - level: the accepted debug level
    - event: the Python Event to print
    - sourceInfo: additional string to print out
    Nz
OBJECT EVENT:rw)�eventDebugFilter�matchr/�max�eventDebugLevelrbr)r�event�
sourceInfor_r^s     r�printObjectEventr�]s[��� 0� 6� 6�u�z�z� B�����'�E��u�
%�F���v�y�)����(��J�<�0�)�<�rc	�P�|tk\r|rt|t||||�|�yyy)a:Lists the details of the given accessible with the given
    indentation.

    Arguments:
    - level: the accepted debug level
    - indent: a string containing spaces for indentation
    - accessible: the accessible whose details are to be listed
    - includeApp: if True, include information about the app
    N)rr�getAccessibleDetails)r�indent�
accessible�
includeAppr_s     r�printDetailsr�ss1��
�
��z���$�U�J��
�K��	� *�rc���|tkry|r|dtj|��d�z}n|}tj|�r|dz
}|Sdj	dd�tj
|�z}dj	dd�|tj|�fz}d	tj|��d
�}|�dtj|���}|�dtj|��d
�}	|�d
tj|��d
�}
|�dtj|��d
�}|�dtj|��d
�}|�dtj|��d
�}
||�d|�d|�d|	�d|
�d|�d|�d|
�d|�d�z
}|S)z�Returns a string, suitable for printing, that describes the
    given accessible.

    Arguments:
    - indent: A string to prefix the output with
    - includeApp: If True, include information about the app
                  for this accessible.
    r\zapp='z' z(exception fetching data)z	name='%s'rvz\nz%sdescription='%s'zrole='r#zpath=zstates='zrelations='z	actions='zinterfaces='zattributes='r[)rr�application_as_string�is_deadrxr-�get_descriptionr,�get_path�state_set_as_string�relations_as_string�actions_as_string�supported_interfaces_as_string�attributes_as_string)r�accr�r�r��name_string�desc_string�role_string�path_string�state_string�
rel_string�actions_string�iface_string�attr_strings              rr�r��s���
�z�����E�(�"@�"@��"E�!F�b�I�I����������-�-���
��%�%�d�E�2�X�5F�5F�s�5K�K�K�&�.�.�t�U�;�	��)�)�#�.�/�0�K��8�1�1�#�6�7�q�9�K��H�E�(�"3�"3�C�"8�!9�:�K��X�X�h�&B�&B�3�&G�%H��J�L��8�;�x�'C�'C�C�'H�&I��K�J��x�y��)C�)C�C�)H�(I��K�N��X�\�(�*Q�*Q�RU�*V�)W�WX�Y�L��H�L��)F�)F�s�)K�(L�A�N�K�
��-�q��
�R��-�r��.���,�b��
�"��.���-�r��-�r�	�	�F��Mrc���d\}}	|jd}|jd}|jd�s|jd�r|dd}||fS#t$rY||fSwxYw)N)NN�__file__rKz.pycz.pyo���)�	f_globals�endswithr})rrrTrss   r�_getFileAndModuler��s���!��H�f�%��?�?�:�.������,��
���f�%��):�):�6�)B����}�H��V����
�
��
�V���

�s�A�	A�Ac�z�tstStj}tr1t	j
|�}t	j|�tvrytrt	j|�tvrytr:ttjjt�D�cgc]}|s�|��	c}syycc}w)NFT)
�objEvent�TRACE_ONLY_PROCESSING_EVENTSr1�
TRACE_APPSrr2r-�TRACE_ROLES�get_role�TRACE_EVENTSrCr/�
startswith)�eventSource�appr=s   r�_shouldTraceItr��s����/�/�/��/�/�K���&�&�{�3�����S�!��3���x�(�(��5�[�H����8�=�=�3�3�\�B�H�!�a�A�H����Is�'B8�/B8c��t�syt|�\}}|r|stS|tvrtStr |jd�dtvrtS|dvrtS|j}tj||�j�}d|�d|�d|��}|dk(rqtj|�}|dD�	cgc]
}	|	d	k7s�	|	��}
}		tt|d
j|
��}t%|
�D]\}}
|d|
�d
||��z
}�|j'�j�}|r|ddk(r|dk(rtS|�d|�d�}t)t*|�tScc}	w#t$rRt!|
�dk(r9t#|
dt�r&tt|d
j|
d��}ntcYSY��wxYw)a�Line tracing utility to output all lines as they are executed by
    the interpreter.  This is to be used by sys.settrace and is for
    debugging purposes.

    Arguments:
    - frame: is the current stack frame
    - event: 'call', 'line', 'return', 'exception', 'c_call', 'c_return',
             or 'c_exception'
    - arg:   depends on the event type (see docs for sys.settrace)
    Nr)r)�call�line�returnzTRACE �:z: r��selfr�rz
  ARG �=r�r�z (rv: r')r�r��traceit�TRACE_IGNORE_MODULES�
TRACE_MODULES�split�f_linenor�getline�rstriprNr�rArC�getr|rEr*�	enumerate�stripr�	LEVEL_ALL)rrr��argrTrs�linenor��output�argvalsr=�keys�valuesrqr��lineElementss               rr�r��s������(��/��H�f�����
�%�%�������c�*�1�-�]�B����.�.���
�^�^�F����X�v�.�5�5�7�D��f�X�Q�v�h�b���
/�F�����&�&�u�-��"�1�:�5�a��f���5��5�	��#�g�a�j�n�n�d�3�4�F� ��o�	3�F�A�s�����Q�v�a�y�k�2�2�F�	3��:�:�<�%�%�'�L���Q��8�3��F�?��N��8�6�#��a�(���I�v���N��'6���	��4�y�A�~�*�T�!�W�d�";��c�'�!�*�.�.�$�q�'�:�;�����	�s�>
E$�	E$�"E)�)AG�Gc	���tjddddt|�g�}|jd�j	d�}tt
d�|��}t|�S)N�lsofz-wz-Ffz-pzUTF-8rvc�D�|xr|ddk(xr|ddj�S)Nr�fr)�isdigit)�ss r�<lambda>z getOpenFDCount.<locals>.<lambda>
s$��!�"G��!����"G��!�"��
�
��r)�
subprocess�check_outputrD�decoder�rA�filterrE)�pid�procs�filess   r�getOpenFDCountr�
sV���#�#�f�d�E�4��S��$J�K�E��L�L��!�'�'��-�E���G��O�P�E��u�:�rc��	tjd|�d��}|j�}|j�|jdd�}|S#t$rd}Y�!wxYw)Nz
cat /proc/z/cmdlinez(Could not obtain cmdline)�r[)�os�popen�read�closer}rx)r��openFile�cmdlines   r�
getCmdliner�s`��/��8�8�j���X�6�7���-�-�/�������o�o�f�c�*�G��N��	�/�.��/�s�9A�A�Ac��tjd|��dtj��j}|j	�}|j�|j
�D�cgc]
}t|���c}Scc}w)Nzpgrep T)�shell�stdout)r��Popen�PIPEr�r�r�r��int)�procNamer��pids�ps    r�pidOfr�sb�����&��
� 3�&*�'1���8�8>��
��=�=�?�D��N�N�� �J�J�L�)�q�C��F�)�)��)s�&A;c
�L�|rt}nt}tj�}t	|dtj|�zd�ttj|��D]d\}}tj|�}t|�}t|�}tj|�}|dk(rd}t	|d|dz||||fzd��fdg}	|	D]Q}t|�}
|
st	|d|��d��!|
D],}t|�}t|�}t	|d	||||fzd��.�Sy)
NzINFO: Desktop has %i apps:Tr\z"WARNING: Possible hang or dead appz)%3i. %s (pid: %s) %s file descriptors: %ir�apportzINFO: no pid for z*INFO: %s (pid: %s) %s file descriptors: %i)�	LEVEL_OFFr�r�get_desktoprr�get_child_countr��
iter_children�get_process_idr�r�r-r�)�forcer�desktoprqr�r��cmd�fdsrX�	otherAppsr�s           r�examineProcessesr
$sB��������%�%�'�G��E�/�(�2J�2J�7�2S�S�UY�Z��H�2�2�7�;�<�8���3��%�%�c�*����o���S�!��� � ��%���2�:�7�D���B���s�D�#�s�C�0�1�26�	8�8��
�I��
6���S�z����E�.�s�e�4�d�;���	6�C��S�/�C� ��%�C��E�G���S�#�.�/�04�
6�	6�
6r)FF)�)r\FFrd)NF)TF)r\T)F)=�__doc__�__id__�__version__�__date__�
__copyright__�__license__rNr
r�rr�r~rFr�gi�require_version�
gi.repositoryr�	ax_objectr�ax_utilitiesrr�LEVEL_SEVERE�
LEVEL_WARNING�
LEVEL_INFO�LEVEL_CONFIGURATION�
LEVEL_FINE�LEVEL_FINER�LEVEL_FINESTr�rrr�r�r�r�r�r�r�r�r�rr!r0rbrfrtrr�r�r�r�rr�r�r�r�r�r�r
�rr�<module>rsJ��(.�
������?�
�����	�	��
���	�����7�E�"���%�
�	�
��
�
��
����
�����
�	�
�
�
�	� ������
�-���
����� $����
�
�2�h+�+�/�($4�L �0=�,� *�b���&2�h�	�*�6r

Zerion Mini Shell 1.0