
    wip                        S SK r S SKr S SKrS SKrS SKrS SKr/ SQr\R                  " S5      r	 " S S\
5      r " S S\5      r " S S	\5      r " S
 S\5      r " S S\5      r\ R                   R"                  4S jrSS jr  SS jrg)    N)LibraryExceptionLibraryNotFoundExceptionNoLibraryCandidatesExceptionLibraryNotLoadedExceptionLibraryMissingSymbolsExceptionlocate_libraryload_libraryload_locate_libraryzusb.libloaderc                       \ rS rSrSrg)r   7    N__name__
__module____qualname____firstlineno____static_attributes__r       G/home/james-whalen/.local/lib/python3.13/site-packages/usb/libloader.pyr   r   7       r   r   c                       \ rS rSrSrg)r   :   r   Nr   r   r   r   r   r   :   r   r   r   c                       \ rS rSrSrg)r   =   r   Nr   r   r   r   r   r   =   r   r   r   c                       \ rS rSrSrg)r   @   r   Nr   r   r   r   r   r   @   r   r   r   c                       \ rS rSrSrg)r   C   r   Nr   r   r   r   r   r   C   r   r   r   c                    Uc  [         R                  R                  n[        R                  S:H  =(       a    U[         R                  R                  L n[        R                  S:H  =(       a;    [        R
                  " 5       S:H  =(       a    U[         R                  R                  L nU  H[  nU(       a  US-  nU" U5      nU(       a  Us  $ U(       d  M+  SU-   S-   n[        R                  R                  U5      (       d  MY  Us  $    g)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win32darwinarm64z.dllz/opt/homebrew/lib/z.dylib)	ctypesutilfind_librarysysplatformmachineospathisfile)
candidatesr%   use_dll_workarounduse_apple_silicon_workaround	candidatelibnames         r   r   r   G   s      {{// 	LLFKK4L4L$L 
 	  	9X%5%5%77%B 	9 8 88 !
  	Iy)N
 ('*Y6AGww~~g&&  " r   c                      U(       a  U" U 5      $ [         R                  " U 5      $ ! [         aI    U(       a  U< SU < S3nOU nUS-  n[        R                  S:X  a  US-  n[
        R                  USS9   gf = f)	a3  Loads 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 ()z could not be loadedcygwinz
 in cygwinT)exc_infoN)r#   CDLL	Exceptionr&   r'   _LOGGERerror)libnamelib_clslib_msgs       r   r	   r	   v   sx    3<;;s## #'-GG))<<8#|#Gg-s   ' ' AA:9A:c                 |   [         R                  S:X  a  U(       a  [        XU5      nO[        U5      eU (       a  [	        X5      n	U	(       aN  [
        R                  SU=(       d    U U	5        [         R                  S:X  a  [        XU5      nOB[        XU5      nO5[
        R                  SU=(       d    U 5        [        U5      e[        U5      eUc  [        U5      eU(       aR  U V
s/ s H  n
[        X5      (       a  M  U
PM     nn
U(       a%  SW	U4n[
        R                  U5        [        U	5      eU$ U$ s  sn
f )a  Locates 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
r3   z%r found as %sr    z%r could not be foundz%r, missing symbols: %r)r&   r'   r	   r   r   r7   debugr8   r   r   hasattrr   )r,   
cygwin_libr:   win_cls
cygwin_cls
others_clsr%   check_symbols
loaded_libr9   ssymbols_missingmsgs                r   r
   r
      s   : ||x%j
CJ.t44	Z6MM*T-?Z#F||w&)#W=
)#Z@
MM1D4FJH*400*400'--	,
,!GJ4JA} 	 
 ,c?DCMM#055
s   )D9D9)NN)NNNNN)r#   ctypes.utilloggingos.pathr)   r'   r&   __all__	getLoggerr7   OSErrorr   r   r   r   r   r$   r%   r   r	   r
   r   r   r   <module>rO      s   B      
	 

O
,	w 		/ 		#; 		 0 		%5 	 -3KK,D,D -^< CG9==r   