403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.15.238.90
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/nose/plugins/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/nose/plugins/__pycache__/manager.cpython-37.pyc
B

1�Se�<�@s�dZddlZddlZddlZddlZddlmZddlm	Z	ddl
Zddlm
Z
ddlmZddlmZyddlZWnddlZYnXyddlmZWnddlmZYnXd	d
ddd
gZe�e�ZGdd�de�ZGdd�de�ZGdd
�d
e�ZGdd�d�ZGdd�de�ZGdd�de�Zyddl Z Gdd	�d	ee�Z!Wn&e"k
�rnGdd	�d	e�Z!YnXGdd
�d
e!�Z#dS)a
Plugin Manager
--------------

A plugin manager class is used to load plugins, manage the list of
loaded plugins, and proxy calls to those plugins.

The plugin managers provided with nose are:

:class:`PluginManager`
    This manager doesn't implement loadPlugins, so it can only work
    with a static list of plugins.

:class:`BuiltinPluginManager`
    This manager loads plugins referenced in ``nose.plugins.builtin``.

:class:`EntryPointPluginManager`
    This manager uses setuptools entrypoints to load plugins.

:class:`ExtraPluginsPluginManager`
    This manager loads extra plugins specified with the keyword
    `addplugins`.

:class:`DefaultPluginMananger`
    This is the manager class that will be used by default. If
    setuptools is installed, it is a subclass of
    :class:`EntryPointPluginManager` and :class:`BuiltinPluginManager`;
    otherwise, an alias to :class:`BuiltinPluginManager`.

:class:`RestrictedPluginManager`
    This manager is for use in test runs where some plugin calls are
    not available, such as runs started with ``python setup.py test``,
    where the test runner is the default unittest :class:`TextTestRunner`. It
    is a subclass of :class:`DefaultPluginManager`.

Writing a plugin manager
========================

If you want to load plugins via some other means, you can write a
plugin manager and pass an instance of your plugin manager class when
instantiating the :class:`nose.config.Config` instance that you pass to
:class:`TestProgram` (or :func:`main` or :func:`run`).

To implement your plugin loading scheme, implement ``loadPlugins()``,
and in that method, call ``addPlugin()`` with an instance of each plugin
you wish to make available. Make sure to call
``super(self).loadPlugins()`` as well if have subclassed a manager
other than ``PluginManager``.

�N)�chain)�warn)�Failure)�IPluginInterface)�	sort_list)�StringIO�DefaultPluginManager�
PluginManager�EntryPointPluginManager�BuiltinPluginManager�RestrictedPluginManagerc@sVeZdZdZeZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zddd�Z
dS)�PluginProxya#Proxy for plugin calls. Essentially a closure bound to the
    given call and plugin list.

    The plugin proxy also must be bound to a particular plugin
    interface specification, so that it knows what calls are available
    and any special handling that is required for each call.
    cCslyt|j|�|_Wn(tk
r:td||jjf��YnX|�|�|_g|_x|D]}|�||�qTWdS)Nz%s is not a valid %s method)	�getattr�	interface�method�AttributeError�__name__�makeCall�call�plugins�	addPlugin)�selfrr�p�r�E/opt/alt/python37/lib/python3.7/site-packages/nose/plugins/manager.py�__init__Ws
zPluginProxy.__init__cOs|j||�S)N)r)r�arg�kwrrr�__call__bszPluginProxy.__call__csVt||d�}|dk	rR|dkrBtt�|�d�dkrB|��fdd�}|j�||f�dS)z`Add plugin to my list of plugins to call, if it has the attribute
        I'm bound to.
        N�loadTestsFromModuler�cs�|�S)Nr)�module�path�kwargs)�	orig_methrr�<lambda>n�z'PluginProxy.addPlugin.<locals>.<lambda>)r�len�inspect�
getargspecr�append)r�pluginr�methr)r$rreszPluginProxy.addPlugincsH|dkr�jS�j}t|dd�r,�fdd�St|dd�r>�jS�jSdS)N�loadTestsFromNames�
generativeFcst�j||��S)N)�list�generate)rr)rrrr%{r&z&PluginProxy.makeCall.<locals>.<lambda>Z	chainable)�_loadTestsFromNamesrrr�simple)rrr,r)rrrqszPluginProxy.makeCallcOsZd}dd�tt|jdg�|�D�}x2|jD](\}}|||�}|dd�}|�|�q*W|S)z�Call plugins in a chain, where the result of each plugin call is
        sent to the next plugin as input. The final output result is returned.
        NcSsg|]\}}|r|�qSrr)�.0�static�arrr�
<listcomp>�sz%PluginProxy.chain.<locals>.<listcomp>Zstatic_args)�ziprrrr*)rrr�resultr4rr,rrrr�s
zPluginProxy.chainc
os�xz|jD]p\}}d}y*|||�}|dk	r<x|D]
}|Vq.WWqttfk
rX�Yqt��}t|�VwYqXqWdS)zFCall all plugins, yielding each item in each non-None result.
        N)r�KeyboardInterrupt�
SystemExit�sys�exc_infor)rrrrr,r8�r�excrrrr0�s


zPluginProxy.generatecOs.x(|jD]\}}|||�}|dk	r|SqWdS)z?Call all plugins, returning the first non-None result.
        N)r)rrrrr,r8rrrr2�s
zPluginProxy.simpleNcCsJg}x<|jD]2\}}|||d�}|dk	r|\}}|r|�|�qW||fS)a
Chainable but not quite normal. Plugins return a tuple of
        (tests, names) after processing the names. The tests are added
        to a suite that is accumulated throughout the full call, while
        names are input for the next plugin in the chain.
        )r!N)r�extend)r�namesr!�suiterr,r8Z
suite_partrrrr1�szPluginProxy._loadTestsFromNames)N)r�
__module__�__qualname__�__doc__rrrrrrrr0r2r1rrrrr
Nsr
c@sdeZdZdZeZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�ZdS)�	NoPluginsz(Null Plugin manager that has no plugins.cCsd|_|_dS)Nr)�_pluginsr)rrrrr�szNoPlugins.__init__cCsdS)Nrr)rrrr�__iter__�szNoPlugins.__iter__cOsdS)Nr)r�args�kwdsrrr�
_doNothing�szNoPlugins._doNothingcOsdS)Nrr)rrHrIrrr�_emptyIterator�szNoPlugins._emptyIteratorcCs(t|j|�}t|dd�r|jS|jSdS)Nr.F)rrrKrJ)rrrrrr�__getattr__�szNoPlugins.__getattr__cCs
t��dS)N)�NotImplementedError)r�plugrrrr�szNoPlugins.addPlugincCs
t��dS)N)rM)rrrrr�
addPlugins�szNoPlugins.addPluginscCsdS)Nr)r�options�configrrr�	configure�szNoPlugins.configurecCsdS)Nr)rrrr�loadPlugins�szNoPlugins.loadPluginscCsdS)Nr)rrrr�sort�szNoPlugins.sortN)rrBrCrDrrrrGrJrKrLrrOrRrSrTrrrrrE�srEc@sveZdZdZeZddd�Zdd�Zdd	�Zd
d�Z	ddd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zeeedd�ZdS)r	a�Base class for plugin managers. PluginManager is intended to be
    used only with a static list of plugins. The loadPlugins() implementation
    only reloads plugins from _extraplugins to prevent those from being
    overridden by a subclass.

    The basic functionality of a plugin manager is to proxy all unknown
    attributes through a ``PluginProxy`` to a list of plugins.

    Note that the list of plugins *may not* be changed after the first plugin
    call.
    rNcCs2g|_d|_i|_|r |�|�|dk	r.||_dS)Nr)rF�
_extraplugins�_proxiesrO�
proxyClass)rrrWrrrr�s
zPluginManager.__init__cCs<y
|j|Stk
r6|�||j�}||j|<YnX|S)N)rV�KeyErrorrWrF)rr�proxyrrrrL�s
zPluginManager.__getattr__cCs
t|j�S)N)�iterr)rrrrrGszPluginManager.__iter__cs<t|dt����fdd�|jD�|jdd�<|j�|�dS)N�namecs g|]}t|dd��kr|�qS)r[N)r)r3r)�new_namerrr6sz+PluginManager.addPlugin.<locals>.<listcomp>)r�objectrFr*)rrNr)r\rrszPluginManager.addPlugincCs(||_xt||�D]}|�|�qWdS)z�extraplugins are maintained in a separate list and
        re-added by loadPlugins() to prevent their being overwritten
        by plugins added by a subclass of PluginManager
        N)rU�	iterchainr)rrZextrapluginsrNrrrrOszPluginManager.addPluginscCsTt�d�||_td|j�}|||�dd�|jD�}||_|��t�d|�dS)z�Configure the set of plugins with the given options
        and config instance. After configuration, disabled plugins
        are removed from the plugins list.
        zConfiguring pluginsrRcSsg|]}|jr|�qSr)�enabled)r3rNrrrr6sz+PluginManager.configure.<locals>.<listcomp>zPlugins enabled: %sN)�log�debugrQr
rFrrT)rrPrQZcfgr_rrrrRs

zPluginManager.configurecCsx|jD]}|�|�qWdS)N)rUr)rrNrrrrS"szPluginManager.loadPluginscCst|jdd�dd�S)NcSst|dd�S)N�score�)r)�xrrrr%'r&z$PluginManager.sort.<locals>.<lambda>T)�reverse)rrF)rrrrrT&szPluginManager.sortcCs|jS)N)rF)rrrr�_get_plugins)szPluginManager._get_pluginscCsg|_|�|�dS)N)rFrO)rrrrr�_set_plugins,szPluginManager._set_pluginszPAccess the list of plugins managed by
                       this plugin manager)rN)rr)rrBrCrDr
rWrrLrGrrOrRrSrTrfrg�propertyrrrrrr	�s
	
	c@s^eZdZdZdd�Zejfdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�ZdS)�ZeroNinePluginz>Proxy for 0.9 plugins, adapts 0.10 calls to 0.9 standard.
    cCs
||_dS)N)r+)rr+rrrr8szZeroNinePlugin.__init__cCs|j�||�dS)N)r+Zadd_options)r�parser�envrrrrP;szZeroNinePlugin.optionsc	Cs�t|jd�sdSddlm}m}|\}}}t||�rRt|jd�sDdS|j�|j�St||�rzt|jd�sldS|j�|j�S|j	}|j�
|j||�S)N�addErrorr)�SkipTest�DeprecatedTest�addSkip�
addDeprecated)�hasattrr+Znose.excrmrn�
issubclassro�testrp�capturedOutputrl)	rrs�errrmrnZecZev�tb�captrrrrl>s


zZeroNinePlugin.addErrorcCst|jd�r|j�|�SdS)N�loadTestsFromPath)rqr+rx)r�filenamerrr�loadTestsFromFilePsz ZeroNinePlugin.loadTestsFromFilecCs0t|jd�sdS|j}|j}|j�|j|||�S)N�
addFailure)rqr+rt�tbinfor{rs)rrsrurwr|rrrr{Ts
zZeroNinePlugin.addFailurecCs*t|jd�sdS|j}|j�|j|�dS)N�
addSuccess)rqr+rtr}rs)rrsrwrrrr}\szZeroNinePlugin.addSuccesscCst|jd�sdS|j�|j�S)N�	startTest)rqr+r~rs)rrsrrrr~bszZeroNinePlugin.startTestcCst|jd�sdS|j�|j�S)N�stopTest)rqr+rrs)rrsrrrrgszZeroNinePlugin.stopTestcCst|j|�S)N)rr+)r�valrrrrLlszZeroNinePlugin.__getattr__N)rrBrCrDr�os�environrPrlrzr{r}r~rrLrrrrri5srics,eZdZdZddeffZ�fdd�Z�ZS)r
zhPlugin manager that loads plugins from the `nose.plugins` and
    `nose.plugins.0.10` entry points.
    )znose.plugins.0.10Nznose.pluginsc	s�ddlm}i}x�|jD]�\}}x�||�D]�}|j|kr:q*d||j<t�d|jj|�y|��}WnJt	k
rx�Yn6t
k
r�}ztd||ft�w*Wdd}~XYnX|r�||��}n|�}|�
|�q*WqWtt|���dS)zBLoad plugins by iterating the `nose.plugins` entry point.
        r)�iter_entry_pointsTz%s load plugin %szUnable to load plugin %s: %sN)�
pkg_resourcesr��entry_pointsr[r`ra�	__class__r�loadr9�	Exceptionr�RuntimeWarningr�superr
rS)	rr�ZloadedZentry_pointZadapt�epZplugcls�erN)r�rrrSws*

z#EntryPointPluginManager.loadPlugins)rrBrCrDrir�rS�
__classcell__rr)r�rr
ps
cs eZdZdZ�fdd�Z�ZS)rzSPlugin manager that loads plugins from the list in
    `nose.plugins.builtin`.
    cs:ddlm}x|jD]}|�|��qWtt|���dS)z-Load plugins in nose.plugins.builtin
        r)�builtinN)Znose.pluginsr�rrr�rrS)rr�rN)r�rrrS�sz BuiltinPluginManager.loadPlugins)rrBrCrDrSr�rr)r�rr�sc@seZdZdS)rN)rrBrCrrrrr�sc@seZdZdS)rN)rrBrCrrrrr�sc@s*eZdZdZddd�Zdd�Zdd	�Zd
S)rz�Plugin manager that restricts the plugin list to those not
    excluded by a list of exclude methods. Any plugin that implements
    an excluded method will be removed from the manager's plugin list
    after plugins are loaded.
    rTcCs(t�||�||_||_g|_d|_dS)N)rrr��exclude�excluded�
_excludedOpts)rrr�r�rrrr�s
z RestrictedPluginManager.__init__cCsR|jdkrBddlm}|dd�|_x|jD]}|j|jid�q*W|j�d|�S)Nr)�OptionParserF)Zadd_help_option)rkz--)r��optparser�r�rPZ
get_option)rr[r�r+rrr�excludedOption�s
z&RestrictedPluginManager.excludedOptioncCsl|jrt�|�g}xL|jD]B}d}x*|jD] }t||�r,d}|j�|�Pq,W|r|�|�qW||_dS)NTF)r�rrSrr�rqr�r*)rZallowr+�okrrrrrS�s

z#RestrictedPluginManager.loadPluginsN)rrT)rrBrCrDrr�rSrrrrr�s
)$rDr(�loggingr�r;�	itertoolsrr^�warningsrZnose.config�noseZnose.failurerZnose.plugins.baserZnose.pyversionr�pickle�ior�__all__�	getLoggerrr`r]r
rEr	rir
rr�r�ImportErrorrrrrr�<module>2sB
m&T;%

Youez - 2016 - github.com/yon3zu
LinuXploit