관리-도구
편집 파일: hooks.cpython-39.pyc
a ����"e;����������������������@���sH���d�dl�Z�d�dlmZ�d�dlmZ�i�ZG�dd��de�Zdd��Zdd ��Z dS�) �����N)� HOOKS_DIRS)�load_sourcec�������������������@���s ���e�Zd�ZdZdd��Zdd��ZdS�)� HooksObserverz� Provides interface for calling user hooks When initializing, loads all hooks located in HOOKS_DIRS. Then it can called with application name as argument. Observer ensures calling all hooks defined for the application. c�����������������C���s ���t����d�S��N)�_register_hooks)�self��r����0/usr/lib/python3.9/site-packages/tracer/hooks.py�__init__!���s����zHooksObserver.__init__c�����������������C���s"���|t�vrd�S�dd��t�|�D���d�S�)Nc�����������������S���s���g�|�] }|���qS�r���r���)�.0�fr���r���r ���� <listcomp>(��������z*HooksObserver.__call__.<locals>.<listcomp>)�_hooks)r����appr���r���r ����__call__$���s����zHooksObserver.__call__N)�__name__� __module__�__qualname__�__doc__r ���r���r���r���r���r ���r������s���r���c��������������������s�����fdd�}|S�)a��� Decorator for tracer hooks. Example:: from tracer import hooks @hooks.match("foo") def hook_app(): print("Hey, application foo was found") .. note:: You can match multiple applications by calling ``@hooks.match`` with list of them. c��������������������s>���t����tkr��n��gD�]"}|tvr*g�t|<�t|��|���q|�S�r���)�type�listr����append)r���r�����appsr���r ���� decorator;���s ����zmatch.<locals>.decoratorr���)r���r���r���r���r ����match+���s����r���c������������������C���sn���t�D�]d}�t�|��D�]T\}}}|D�]D}tj�|�d�}zt|tj�||���W�q �tyb���Y�q Y�q 0�q qqd�S�)Nr���)r����os�walk�path�splitextr����join� Exception)Zhook_dir�root�dirs�files�fname�modnamer���r���r ���r���D���s����r���) r���Ztracer.pathsr���Ztracer.resources.pycompr���r����objectr���r���r���r���r���r���r ����<module>���s���