
    (i                     R    d dl mZ d dlZd dlmZmZ dedefdZdedeeef   fdZy)    )import_moduleN)AnyTupledotted_pathreturnc                     	 | j                  dd      \  }}t        |      }	 t	        ||      S # t        $ r |  d}t        |      w xY w# t
        $ r d| d| d}t        |      w xY w)z
    Source: django.utils.module_loading
    Import a dotted module path and return the attribute/class designated by the
    last name in the path. Raise ImportError if the import failed.
    .   z  doesn't look like a module pathzModule "z" does not define a "z" attribute/class)rsplit
ValueErrorImportErrorr   getattrAttributeError)r   module_path
class_namemsgmodules        N/var/www/br/venv/lib/python3.12/site-packages/eth_keys/utils/module_loading.pyimport_stringr      s    "-"4"4S!"<Z
 ;'Fvz**  =>#  %::,FWX#s   / A A	A*c                 d   t        | j                  d            }t        d|      D ]Z  }| j                  d|      }|d   }dj	                  |dd        }	 t        |      }	  t        j                  |      |       ||fc S  d| fS # t        $ r Y lw xY w# t        $ r t        d|        w xY w)Nr	   r
   r   z-Unable to derive appropriate import path for  )
lensplitranger   joinr   r   operator
attrgetterr   )r   num_path_partsi
path_partsimport_part	remainderr   s          r    split_at_longest_importable_pathr#       s    **3/0N1n%  ''Q/
 mHHZ^,		";/F	**H	*62 	))#& ;  		
  	?}M 	s   B"B	BBB/)		importlibr   r   typingr   r   strr   r#        r   <module>r)      sB    s s *# %S/ r(   