
    2Bf                         d Z ddlZddlmZ ddlmZmZmZ ddl	m
Z
 e
dded	ed
edej                  eeef      dej                  eeef      f
dZe
fded	ed
edej                  e   def
dZy)z#Provide :func:`bidict.namedbidict`.    N)	_getframe   )BidirectionalMappingKTVT)bidict	base_typetypenamekeynamevalnamer
   returnc                R    t        t              rt        fddD              st               f}t        t	        t
        j                  |            rk(  rt        |       G  fdd      }j                  }dz   }dz   }  d| d d }	  d	| d d }
t        ||t        |j                  |	
             t        ||t        |j                  |

              |_         |_        t        d      j                  j!                  d      |_        |S )a\  Create a new subclass of *base_type* with custom accessors.

    Like :func:`collections.namedtuple` for bidicts.

    The new class's ``__name__`` and ``__qualname__`` will be set to *typename*,
    and its ``__module__`` will be set to the caller's module.

    Instances of the new class will provide access to their
    :attr:`inverse <BidirectionalMapping.inverse>` instances
    via the custom *keyname*\_for property,
    and access to themselves
    via the custom *valname*\_for property.

    *See also* the :ref:`namedbidict usage documentation
    <other-bidict-types:\:func\:\`~bidict.namedbidict\`>`

    :raises ValueError: if any of the *typename*, *keyname*, or *valname*
        strings is not a valid Python identifier, or if *keyname == valname*.

    :raises TypeError: if *base_type* is not a :class:`BidirectionalMapping` subclass
        that provides ``_isinv`` and :meth:`~object.__getstate__` attributes.
        (Any :class:`~bidict.BidictBase` subclass can be passed in, including all the
        concrete bidict types pictured in the :ref:`other-bidict-types:Bidict Types Diagram`.
    c              3   6   K   | ]  }t        |        y wN)hasattr).0ir
   s     M/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/bidict/_named.py	<genexpr>znamedbidict.<locals>.<genexpr>0   s     A|\]')UVBWA|s   )_isinv__getstate__c                   l    e Zd ZdZd	dZd	dZedeffd       Zedeffd       Z	d
 fdZ
y)namedbidict.<locals>._Named r   c                 6    | j                   r| j                  S | S r   r   inverseselfs    r   _getfwdz#namedbidict.<locals>._Named._getfwd:   s    #';;4<<8D8    c                 6    | j                   r| S | j                  S r   r   r   s    r   _getinvz#namedbidict.<locals>._Named._getinv=   s    ;;48DLL8r"   c                 $    | j                   rS S r   r   r    r   r   s    r   _keynamez$namedbidict.<locals>._Named._keyname@       "kk76w6r"   c                 $    | j                   rS S r   r&   r'   s    r   _valnamez$namedbidict.<locals>._Named._valnameD   r)   r"   c                 :    t         f| j                         fS r   )_make_emptyr   )r    r
   r   r   r   s    r   
__reduce__z&namedbidict.<locals>._Named.__reduce__H   s"    (GWi!H$J[J[J]^^r"   N)r   _Named)r   z_t.Tuple[_t.Callable[[str, str, str, _t.Type[BidirectionalMapping]], BidirectionalMapping], _t.Tuple[str, str, str, _t.Type[BidirectionalMapping]], dict])__name__
__module____qualname__	__slots__r!   r$   propertystrr(   r+   r.   )r
   r   r   r   s   r   r/   r   6   sT    		9	9 
	7c 	7 
	7 
	7c 	7 
	7	_ 	_r"   r/   _forz	 forward z: u    → z	 inverse )docr   r0   )
issubclassr   all	TypeErrormapr5   isidentifier
ValueErrorr0   setattrr4   r!   r$   r2   r   	f_globalsgetr1   )r   r   r   r
   namesr/   bnamefnameinamefdocidocs   ````       r   namedbidictrG      s(   > i!56cA|a{A|>|	""w(Es3##U+,70B_ _ _* EfEfEZyr'%yADZyr'%yADFE8FNN=>FE8FNN=>FO"F!!..22:>FMr"   c                 .    t        | |||      } |       S )zCreate a named bidict with the indicated arguments and return an empty instance.
    Used to make :func:`bidict.namedbidict` instances picklable.
    r	   )rG   )r   r   r   r
   clss        r   r-   r-   Y   s     hI
FC5Lr"   )__doc__typing_tsysr   _abcr   r   r   _bidictr   r5   TyperG   r-   r   r"   r   <module>rQ      s    *   . .  8>EEE E
 ww+BF34E WW!"b&)*EX 06	


 
 ww+,	

 
r"   