o
    %if
                     @  s   U d dl mZ d dlZd dlZd dlZd dlZd dlmZmZm	Z	m
Z
 d dlZd dlmZ e Zi Zded< daded< e dddZdddZdddZdddZdS )    )annotationsN)AnyCallableOptionalSequence)Encodingzdict[str, Encoding]	ENCODINGSz1Optional[dict[str, Callable[[], dict[str, Any]]]]ENCODING_CONSTRUCTORSreturnSequence[str]c                  C  s6   g } t tjtjd }|D ]
\}}}| | q| S )N.)pkgutiliter_modulestiktoken_ext__path____name__append)modsplugin_mods_mod_name r   J/var/www/html/corbot_env/lib/python3.10/site-packages/tiktoken/registry.py_available_plugin_modules   s
   r   Nonec                  C  s   t Y td ur	 W d    d S i at D ]=} t| }z|j}W n ty6 } z	td|  d|d }~ww | D ]\}}|tv rMtd| d|  |t|< q;qW d    d S 1 s^w   Y  d S )Nztiktoken plugin z& does not define ENCODING_CONSTRUCTORSzDuplicate encoding name z in tiktoken plugin )_lockr	   r   	importlibimport_moduleAttributeError
ValueErroritems)r   modconstructorseenc_nameconstructorr   r   r   _find_constructors    s4   




"r&   encoding_namestrr   c                 C  s   | t v rt |  S tE | t v rt |  W  d    S td u r't  td us'J | tvr6td|  dt  t|  }tdi | }|t | < |W  d    S 1 sRw   Y  d S )NzUnknown encoding z. Plugins found: r   )r   r   r	   r&   r   r   r   )r'   r%   encr   r   r   get_encoding7   s$   $r*   	list[str]c                   C  sJ   t  td u rt  td usJ ttW  d    S 1 sw   Y  d S )N)r   r	   r&   listr   r   r   r   list_encoding_namesN   s   $r-   )r
   r   )r
   r   )r'   r(   r
   r   )r
   r+   )
__future__r   	functoolsr   r   	threadingtypingr   r   r   r   r   tiktoken.corer   RLockr   r   __annotations__r	   	lru_cacher   r&   r*   r-   r   r   r   r   <module>   s     

