HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //usr/lib/python3.6/site-packages/usb/__pycache__/libloader.cpython-36.opt-1.pyc
3

�~�V�@s�ddlZddlZddlZddlZdddddddd	gZejd
�ZGdd�de�ZGdd�de�Z	Gd
d�de	�Z
Gdd�de�ZGdd�de�Zej
jfdd�Zddd�Zddd	�ZdS)�N�LibaryException�LibraryNotFoundException�NoLibraryCandidatesException�LibraryNotLoadedException�LibraryMissingSymbolsException�locate_library�load_library�load_locate_libraryz
usb.libloaderc@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�/usr/lib/python3.6/libloader.pyr3sc@seZdZdS)rN)r
rrr
r
r
rr6sc@seZdZdS)rN)r
rrr
r
r
rr9sc@seZdZdS)rN)r
rrr
r
r
rr<sc@seZdZdS)rN)r
rrr
r
r
rr?scCsT|dkrtjj}tjdko$|tjjk}x(|D] }|r<|d7}||�}|r,|Sq,WdS)a�Tries to locate a library listed in candidates using the given
    find_library() function (or ctypes.util.find_library).
    Returns the first library found, which can be the library's name
    or the path to the library file, depending on find_library().
    Returns None if no library is found.

    arguments:
    * candidates   -- iterable with library names
    * find_library -- function that takes one positional arg (candidate)
                      and returns a non-empty str if a library has been found.
                      Any "false" value (None,False,empty str) is interpreted
                      as "library not found".
                      Defaults to ctypes.util.find_library if not given or
                      None.
    N�win32z.dll)�ctypes�util�find_library�sys�platform)�
candidatesrZuse_dll_workaround�	candidateZlibnamer
r
rrCs
cCsry|r||�Stj|�SWnRtk
rl|r<d||f}n|}|d7}tjdkrZ|d7}tj|dd�dSXdS)aOLoads a library. Catches and logs exceptions.

    Returns: the loaded library or None

    arguments:
    * lib        -- path to/name of the library to be loaded
    * name       -- the library's identifier (for logging)
                    Defaults to None.
    * lib_cls    -- library class. Defaults to None (-> ctypes.CDLL).
    z%s (%s)z could not be loaded�cygwinz
 in cygwinT)�exc_infoN)rZCDLL�	Exceptionrr�_LOGGER�error)�lib�nameZlib_clsZlib_msgr
r
rres
cs�tjdkr&|rt|||��q�t|��nZ|rxt||�}|r^tjdkrPt|||��qvt|||��q�tjd|pj|�t|��nt|���dkr�t|��nB|rЇfdd�|D�}	|	r�d||	f}
tj|
�t	|��qԈSn�SdS)ajLocates and loads a library.

    Returns: the loaded library

    arguments:
    * candidates    -- candidates list for locate_library()
    * cygwin_lib    -- name of the cygwin library
    * name          -- lib identifier (for logging). Defaults to None.
    * win_cls       -- class that is used to instantiate the library on
                       win32 platforms. Defaults to None (-> ctypes.CDLL).
    * other_cls     -- library class for cygwin platforms.
                       Defaults to None (-> ctypes.CDLL).
    * cygwin_cls    -- library class for all other platforms.
                       Defaults to None (-> ctypes.CDLL).
    * find_library  -- see locate_library(). Defaults to None.
    * check_symbols -- either None or a list of symbols that the loaded lib
                       must provide (hasattr(<>)) in order to be considered
                       valid. LibraryMissingSymbolsException is raised if
                       any symbol is missing.

    raises:
    * NoLibraryCandidatesException
    * LibraryNotFoundException
    * LibraryNotLoadedException
    * LibraryMissingSymbolsException
    rrz%r could not be foundNcsg|]}t�|�s|�qSr
)�hasattr)�.0�s)�
loaded_libr
r�
<listcomp>�sz'load_locate_library.<locals>.<listcomp>z%r, missing symbols: %r)
rrrrrrrrrr)rZ
cygwin_librZwin_clsZ
cygwin_clsZ
others_clsrZ
check_symbolsrZsymbols_missing�msgr
)r!rr	�s.








)NN)NNNNN)rZctypes.utilZloggingr�__all__Z	getLoggerr�OSErrorrrrrrrrrrr	r
r
r
r�<module>s*
"