
    	^cl                        d dl Z d dlZddlmZ dZddddd	ddd
Z	 ddlmZ ej        Zn# e	$ r Y nw xY wdej
        v rdZde j        v r e j        d                             d          Zd ZddddddZdddddZd Zd Zd ZddZdS )    N   )getattr   allow)cextN)r   pure)cffiN)r   r   )Nr   )   cr      cffis
   cffi-allows   pys   rust+cs   rust+c-allow)__modulepolicy____pypy__r
   HGMODULEPOLICYzutf-8c                     i }t          | t                      ||gd          }	 t          ||          x||<   }n # t          $ r t	          d|z            w xY wt          |dd            ||         S )Nr   )levelzcannot import name %s__doc__)
__import__globalsr   AttributeErrorImportError)pkgnamemodname
fakelocalspkgmods        2/usr/lib/python3/dist-packages/mercurial/policy.py_importfromr   <   s    J
WgiigYa
H
H
HC=$+C$9$99
7cc = = =1G;<<<= CD!!!gs	   ; A         ))r   base85)r   bdiff)r   mpatch)r   osutilr   parsersr#   )r   r   )r   
charencode)r   r$   ))r   r%   )r   r   )r   r%   )r   r$   c                     t                               | |f          }t          |dd           }||k    rt          d| |||fz            d S )Nversionz=cannot import module %s.%s (expected version: %d, actual: %r))_cextversionsgetr   r   )r   r   r   expectedactuals        r   	_checkmodr,   [   sf      '7!344HS)T**F1623
 
 	
     c                    	 t           t                   \  }}n%# t          $ r t          dt          z            w xY w|s|sJ |r_t                              || f|| f          \  }}	 t          ||          }||k    rt          |||           |S # t          $ r |s Y nw xY wt                              || f|| f          \  }}t          ||          S )z7Import module according to policy and check API versionzinvalid HGMODULEPOLICY %r)_packageprefspolicyKeyErrorr   _modredirectsr)   r   r,   )r   verpkgpurepkgpnmnr   s         r   	importmodr7   f   s    @'/ @ @ @5>???@W 	""FG#4vw6GHHB	b"%%CV||"b#&&&J 	 	 	  	 1GW3EFFFBr2s    ":((B B! B!c                  6    t                               d          S )z;Assuming the policy is a Rust one, tell if it's permissive.s   -allow)r0   endswith r-   r   _isrustpermissiver;   {   s    ??9%%%r-   c                 .   t                               d          s|S 	 t          d|           }n!# t          $ r t	                      r|cY S  w xY w||S 	 t          ||          S # t          $ r% t	                      r|cY S t          d|z            w xY w)a  Import Rust module according to policy and availability.

    If policy isn't a Rust one, this returns `default`.

    If either the module or its member is not available, this returns `default`
    if policy is permissive and raises `ImportError` if not.
    s   rustrustextNzCannot import name %s)r0   
startswithr   r   r;   r   r   )r   memberdefaultr   s       r   
importrustrA      s     W%% )W--    	NNN ~
<sF### < < < 	NNN1F:;;;<s!   / AAA% %BB)NN)ossyspycompatr   r0   r/    r   modulepolicyr   builtin_module_namesenvironencoder   r(   r2   r,   r7   r;   rA   r:   r-   r   <module>rJ      sf   
			 



        
 #%
 
	""""""*FF 	 	 	D	 )))F rz!!Z()0099F
 
 
   0*2,	 
 
 
  *& & &
< < < < < <s   * 22