HEX
Server: LiteSpeed
System: Linux shams.tasjeel.ae 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64
User: infowars (1469)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //usr/lib/python3.9/site-packages/usb/__pycache__/libloader.cpython-39.pyc
a

j��Y��@s�ddlZddlZddlZddlZgd�Ze�d�ZGdd�de�ZGdd�de�Z	Gdd	�d	e	�Z
Gd
d�de�ZGdd
�d
e�Zej
jfdd�Zddd�Zddd�ZdS)�N)�LibraryException�LibraryNotFoundException�NoLibraryCandidatesException�LibraryNotLoadedException�LibraryMissingSymbolsException�locate_library�load_library�load_locate_libraryz
usb.libloaderc@seZdZdS)rN��__name__�
__module__�__qualname__�rr�1/usr/lib/python3.9/site-packages/usb/libloader.pyr3src@seZdZdS)rNr
rrrrr6src@seZdZdS)rNr
rrrrr9src@seZdZdS)rNr
rrrrr<src@seZdZdS)rNr
rrrrr?srcCsT|durtjj}tjdko$|tjju}|D]$}|r:|d7}||�}|r*|Sq*dS)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�	candidateZlibnamerrrrCs�
rcCsvz|r||�WSt�|�WSWnRtyp|r>d||f}n|}|d7}tjdkr\|d7}tj|dd�YdS0dS)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_msgrrrres

rcs�tjdkr&|rt|||��q�t|��nZ|rxt||�}|r^tjdkrPt|||��qvt|||��q�t�d|pj|�t|��nt|���dur�t|��nB|rЇfdd�|D�}	|	r�d||	f}
t�|
�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).
    * cygwin_cls    -- library class for cygwin platforms.
                       Defaults to None (-> ctypes.CDLL).
    * others_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�Z
loaded_librr�
<listcomp>�sz'load_locate_library.<locals>.<listcomp>z%r, missing symbols: %r)
rrrrrrrrrr)rZ
cygwin_librZwin_clsZ
cygwin_clsZ
others_clsrZ
check_symbolsrZsymbols_missing�msgrr"rr	�s2






�


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