403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.189.143.114
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/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

/�SenO�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZm
Z
mZe�d�Ze�d�ZeefZdZye�eZWn:ek
r�yddlmZWnek
r�YnXYnXded	d
ddfd
d�Zdd�Zdd�ZdBdd�Zdd�Zdd�Zdd�Z dd�Z!e
Z"dd�Z#dd �Z$dCd!d"�Z%d#d$�Z&d%d&�Z'dDd'd(�Z(d)d*�Z)d+e)_*d,d-�Z+d+e+_*d.d/�Z,d0d1�Z-d2d3�Z.d4d5�Z/Gd6d7�d7e0�Z1d8d9�Z2d:d;�Z3dEd=d>�Z4d?d@�Z5e6dAk�r�ddl7Z7e7�8�dS)Fz7Utility functions and classes used by nose internally.
�N)�	ClassType�TypeType�isgenerator�ismethod�nosez^[A-Za-z_][A-Za-z0-9_.]*$zE(?:\.svn)|(?:[^.]+\.py[co])|(?:.*~)|(?:.*\$py\.class)|(?:__pycache__))�Set�z|-- z|   z`-- z    c	Csd�t||||||��S)N�
)�join�_ls_tree_lines)�dir_path�skip_pattern�indent�
branch_indent�last_indent�last_branch_indent�r�:/opt/alt/python37/lib/python3.7/site-packages/nose/util.py�ls_trees
rc#s �dkrt���g}t���}|��gg}}	xF|D]>}
t��|
�rHq6tj�tj��|
��rj|�	|
�q6|	�	|
�q6Wt
t�dd�|	D�dd�|D���}������fdd�}x6|dd�D]&\}
}
x||
|
���D]
}|Vq�Wq�W|�r|d\}
}
x||
|
���D]}|V�qWdS)NrcSsg|]}|df�qS)Fr)�.0�namerrr�
<listcomp><sz"_ls_tree_lines.<locals>.<listcomp>cSsg|]}|df�qS)Tr)rrrrrr=sc3sb|s||VnNtj��|�}tj�|�s^||Vt|������}x|D]}||VqLWdS)N)�os�pathr
�islinkr)r�is_dir�indZ
branch_indrZsubtree�x)rrrrrr
rr�ls_entry>s

z _ls_tree_lines.<locals>.ls_entry���)
r�getcwd�listdir�sort�re�matchr�isdirr
�append�list�	itertools�chain)rr
rrrr�lines�names�dirs�nondirsr�entriesrr�liner)rrrrrr
rr)s,


rcCsJtj�|�s.tj�tj�tj�t��|���}|dksBtj�|�sFdS|S)zUReturn absolute, normalized path to directory, if it exists; None
    otherwise.
    N)rr�isabs�normpath�abspathr
r r%)rrrr�absdirSs
r3cCs|}|dkrt��}t|t�s(t|t�rPx"|D]}t||�}|dk	r.|Sq.WdStj�|�sztj�tj�	tj�
||���}|dks�tj�|�s�|t��kr�tj�tj�	tj�
t��|���}|dks�tj�|�s�dStj�|��rtj�
|d�}tj�
|��r|Sntj�
|��r|SdS)z�Return absolute, normalized path to file (optionally in directory
    where), or None if the file can't be found either in where or the current
    working directory.
    Nz__init__.py)rr �
isinstancer'�tuple�absfilerr0r1r2r
�existsr%�isfile)r�where�origZ
maybe_pathZ	maybe_abs�initrrrr6_s0


r6cCsx|D]}||�rdSqWdS)NTFr)�	predicate�iterable�itemrrr�anyp�s
r?cCs:tj�|�p8tj�|�p8|�d�p8t�tj�|�d�S)z�A name is file-like if it is a path that exists, or it has a
    directory part, or it ends in .py, or it isn't a legal python
    identifier.
    z.pyr)rrr7�dirname�endswith�ident_rer$�splitext)rrrr�	file_like�s
rDcCs>y|jStk
r8y|jjStk
r2dSXYnXdS)zrGet the line number of a function. First looks for
    compat_co_firstlineno, then func_code.co_first_lineno.
    rN)Zcompat_co_firstlineno�AttributeError�__code__�co_firstlineno)�funcrrr�func_lineno�srIcCst|�}|tkpt|t�S)z|Is obj a class? Inspect's isclass is too liberal and returns True
    for objects that can't be subclasses of anything.
    )�type�class_types�
issubclass)�objZobj_typerrr�isclass�srNcCsttj�|�rptj�|�}t�|�rpx&dD]}tj�tj�||��r(dSq(Wtj	�
d�rptj�tj�|d��rpdSdS)z�
    Is this path a package directory?

    >>> ispackage('nose')
    True
    >>> ispackage('unit_tests')
    False
    >>> ispackage('nose/plugins')
    True
    >>> ispackage('nose/loader.py')
    False
    )z__init__.pyz__init__.pycz__init__.pyoT�javaz__init__$py.classF)rrr%�basenamerBr$r8r
�sys�platform�
startswith)r�endr;rrr�	ispackage�s


rUcCst|�tkS)a
    Is this a property?

    >>> class Foo:
    ...     def got(self):
    ...         return 2
    ...     def get(self):
    ...         return 1
    ...     get = property(get)

    >>> isproperty(Foo.got)
    False
    >>> isproperty(Foo.get)
    True
    )rJ�property)rMrrr�
isproperty�srWcCs\|dkrt��}tj�|tj�|�d���}tj�|d�r@|S|d}tj�|�rX|SdS)z�Find the python source file for a package, relative to a
    particular directory (defaults to current working directory if not
    given).
    N�.z/__init__.pyz.py)rr rr
�sep�splitr7)�packageZ
relativeTor�filenamerrr�getfilename�sr]cCs�t|�}tj�|�s|�d�s*t|�s*dStj�tj�|��\}}|dkrPg}n|g}tj�tj�|�d�\}}x8|r�ttj�	||��r�|�
|�nPtj�|�\}}qtW|��d�	|�S)a�
    Find the full dotted package name for a given python source file
    name. Returns None if the file is not a python source file.

    >>> getpackage('foo.py')
    'foo'
    >>> getpackage('biff/baf.py')
    'baf'
    >>> getpackage('nose/util.py')
    'nose.util'

    Works for directories too.

    >>> getpackage('nose')
    'nose'
    >>> getpackage('nose/plugins')
    'nose.plugins'

    And __init__ files stuck onto directories

    >>> getpackage('nose/plugins/__init__.py')
    'nose.plugins'

    Absolute paths also work.

    >>> path = os.path.abspath(os.path.join('nose', 'plugins'))
    >>> getpackage(path)
    'nose.plugins'
    z.pyN�__init__rrX)�srcrrr%rArUrCrPrZr
r&�reverse)r\Zsrc_file�base�extZ	mod_partsr�partrrr�
getpackage�srdcCsRt|�d}d|d}dd||d|f}dt|�}|dkrN|d|}|S)z�Draw a 70-char-wide divider, with label in the middle.

    >>> ln('hello there')
    '---------------------------- hello there -----------------------------'
    ��Fz%s %s %s�-r)�len)�labelZ	label_len�chunk�out�padrrr�lnsrmcCs�|�d�}|dd�}|dkrvxJ|rhy t�d|�td�|��}PWq tk
rd|d=|s`�Yq Xq W|dd�}|}t�d||||�x|D]}t||�}q�W|S)a8Resolve a dotted name to a module and its parts. This is stolen
    wholesale from unittest.TestLoader.loadTestByName.

    >>> resolve_name('nose.util') #doctest: +ELLIPSIS
    <module 'nose.util' from...>
    >>> resolve_name('nose.util.resolve_name') #doctest: +ELLIPSIS
    <function resolve_name at...>
    rXNz
__import__ %sr�zresolve: %s, %s, %s, %s)rZ�log�debug�
__import__r
�ImportError�getattr)r�module�parts�
parts_copyrMrcrrr�resolve_name)s$	

rwcCs<tjj}|}d}d|kr8t|�r.||�ddfSd|dfStj�|�\}}|s�y$|�d�\}}t|�rn|d}}WnZtk
r�|�d�}t|d�dkr�d�|dd��|d}}ntd|f��YnXn6|s�|}n,d|kr�|�d�\}}n|}tj�||g�}|�r.t|��r"||�d|fSd||fSn
dd|fSdS)a3Split a test name into a 3-tuple containing file, module, and callable
    names, any of which (but not all) may be blank.

    Test names are in the form:

    file_or_module:callable

    Either side of the : may be dotted. To change the splitting behavior, you
    can alter nose.util.split_test_re.
    N�:rrnrzaTest name '%s' could not be parsed. Please format test names as path:callable or module:callable.)	rrr1rDrZ�
ValueErrorrhr
rY)�testZnormZfile_or_mod�fn�head�tailruZ	file_partrrr�split_test_nameFs<


r~FcCs�t|d�r|��St|�}d}}}|tjkrVt|dd�}t|dd�}t|�||fS|tjksrt|t�sr|tkr�t|dd�}|dk	r�t	j
|}t|dd�}|dk	r�tj�
|�}t|dd�}t|�||fS|tjk�rt|jj�}t|d�|dd|d	|jffSt|tj��r�t|d
��s,t|d��rTy
t|j�Stk
�rRt|j�SXt|j�}y
|j}Wntk
�r�|j}YnXt|d�|dd|d	|ffSt|d��r�|jjd
k�r�t|j�Std||f��dS)zfFind the test address for a test, which may be a module, filename,
    class, method or function.
    �addressN�__file__�__name__�
__module__rrnz%s.%sre�_FunctionTestCase__testFunc�	_testFunc�	__class__)�__builtin__�builtinszI don't know what %s is (%s))�hasattrrrJ�types�
ModuleTypersr_�FunctionTyperLrQ�modulesrrr2�
MethodType�test_address�__self__r�r�r4�unittest�TestCaser�rEr�Z_TestCase__testMethodName�_testMethodNamer��	TypeError)rz�t�filert�call�mZcls_adr�method_namerrrr��sN






r�c	Cs�x�|D]�}t||d�}|dk	rt|�tjkr�t|tj�rLt�|�\}}}}n`t|d�rft�	|�sf|j
}y t�|�\}}}}|�d�Wn$tk
r�td||f��YnXt
|�r�t�d|||�||�St�d||�|�SqWdS)z�Given a list of possible method names, try to run them with the
    provided object. Keep going until something works. Used to run
    setup/teardown methods for module, package, and function tests.
    N�__call__rzaAttribute %s of %r is not a python function. Only functions or callables may be used as fixtures.zcall fixture %s.%s(%s)zcall fixture %s.%s)rsrJr�r�r4r��inspect�
getargspecr�rr��popr�rhrorp)rMr+rrH�args�varargs�varkw�defaultsrrr�try_run�s&
r�cCsb|dkr|Stj�d�r8|�d�r8d�|dd�df�Stj�|�\}}|dkr^d�|df�S|S)z�Find the python source file for a .pyc, .pyo or $py.class file on
    jython. Returns the filename provided if it is not a python source
    file.
    NrOz	$py.classrXi�����py)z.pycz.pyoz.py)rQrRrSrAr
rrrC)r\rarbrrrr_�sr_cs�fdd�}|S)a�Sort key function factory that puts items that match a
    regular expression last.

    >>> from nose.config import Config
    >>> from nose.pyversion import sort_list
    >>> c = Config()
    >>> regex = c.testMatch
    >>> entries = ['.', '..', 'a_test', 'src', 'lib', 'test', 'foo.py']
    >>> sort_list(entries, regex_last_key(regex))
    >>> entries
    ['.', '..', 'foo.py', 'lib', 'src', 'a_test', 'test']
    cs��|�rd|fSd|fS)Nrnr)�search)rM)�regexrr�k�s
zregex_last_key.<locals>.kr)r�r�r)r�r�regex_last_key�s
r�cCsZ|dkrdSy|�g�|Stk
r.YnXyt�d|�Stk
rTt|�SXdS)awConvert a value that may be a list or a (possibly comma-separated)
    string into a list. The exception: None is returned as None, not [None].

    >>> tolist(["one", "two"])
    ['one', 'two']
    >>> tolist("hello")
    ['hello']
    >>> tolist("separate,values, with, commas,  spaces , are    ,ok")
    ['separate', 'values', 'with', 'commas', 'spaces', 'are', 'ok']
    Nz\s*,\s*)�extendrEr#rZr�r')�valrrr�tolist�s
r�cs�eZdZdZ�fdd�Z�fdd�Z�fdd�Zdd	�Z�fd
d�Z�fdd
�Z	dd�Z
dd�Zd�fdd�	Z�fdd�Z
dd�Z�ZS)�odictzvSimple ordered dict implementation, based on:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747
    csg|_tt|�j||�dS)N)�_keys�superr�r^)�self�arg�kw)r�rrr^szodict.__init__cs tt|��|�|j�|�dS)N)r�r��__delitem__r��remove)r��key)r�rrr�!szodict.__delitem__cs,tt|��||�||jkr(|j�|�dS)N)r�r��__setitem__r�r&)r�r�r>)r�rrr�%s
zodict.__setitem__cCs dd�dd�t|���D��S)Nz{%s}z, cSsg|]\}}d||f�qS)z%r: %rr)rr��vrrrr+sz!odict.__str__.<locals>.<listcomp>)r
r'�items)r�rrr�__str__*sz
odict.__str__cstt|���g|_dS)N)r�r��clearr�)r�)r�rrr�-szodict.clearcs"tt|���}|jdd�|_|S)N)r�r��copyr�)r��d)r�rrr�1sz
odict.copycCstt|jt|�����S)N)r'�zipr��values)r�rrrr�6szodict.itemscCs|jdd�S)N)r�)r�rrr�keys9sz
odict.keysNcs,tt|��||�}||jkr(|j�|�|S)N)r�r��
setdefaultr�r&)r�r��failobjr>)r�rrr�<s
zodict.setdefaultcs@tt|��|�x*t|���D]}||jkr|j�|�qWdS)N)r�r��updater'r�r�r&)r��dictr�)r�rrr�Bs
zodict.updatecCstt|j|j��S)N)r'�map�getr�)r�rrrr�Hszodict.values)N)r�r��__qualname__�__doc__r^r�r�r�r�r�r�r�r�r�r��
__classcell__rr)r�rr�sr�csDddlm}t��r"�fdd�}n�fdd�}|��|�}||_|S)a�
    Make a function imported from module A appear as if it is located
    in module B.

    >>> from pprint import pprint
    >>> pprint.__module__
    'pprint'
    >>> pp = transplant_func(pprint, __name__)
    >>> pp.__module__
    'nose.util'

    The original function is not modified.

    >>> pprint.__module__
    'pprint'

    Calling the transplanted function calls the original.

    >>> pp([1, 2])
    [1, 2]
    >>> pprint([1,2])
    [1, 2]

    r)�make_decoratorc?sx�||�D]
}|VqWdS)Nr)r�r�r�)rHrr�newfuncgsz transplant_func.<locals>.newfunccs
�||�S)Nr)r�r�)rHrrr�ks)Z
nose.toolsr�rr�)rHrtr�r�r)rHr�transplant_funcLsr�cCs"Gdd�d|�}||_|j|_|S)aB
    Make a class appear to reside in `module`, rather than the module in which
    it is actually defined.

    >>> from nose.failure import Failure
    >>> Failure.__module__
    'nose.failure'
    >>> Nf = transplant_class(Failure, __name__)
    >>> Nf.__module__
    'nose.util'
    >>> Nf.__name__
    'Failure'

    c@seZdZdS)ztransplant_class.<locals>.CN)r�r�r�rrrr�C�sr�)r�r�)�clsrtr�rrr�transplant_classssr��utf-8csNyt|�Stk
rHt|t�r:d��fdd�|D��St|����SXdS)N� csg|]}t|���qSr)�safe_str)rr�)�encodingrrr�szsafe_str.<locals>.<listcomp>)�str�UnicodeEncodeErrorr4�	Exceptionr
�encode)r�r�r)r�rr��s

r�cCs6tj�|�sdSt�|�}t|jtjtjBtjB@�S)NF)	rrr7�stat�bool�st_mode�S_IXUSR�S_IXGRP�S_IXOTH)r��strrr�
is_executable�s
r��__main__)N)N)N)r�)9r�r�r(�loggingr�rr#rQr�r�Znose.pyversionrrrr�	getLoggerro�compilerBrKr
�set�	NameErrorZsetsrrrrrr3r6r?rDrIrNZis_generatorrUrWr]rdrmrwr~Z__test__r�r�r_r�r�r�r�r�r�r�r�r��doctest�testmodrrrr�<module>sp

*
!
	
1
<1!4'




Youez - 2016 - github.com/yon3zu
LinuXploit