o
    h{                     @   sf   d dl mZmZmZ d dlmZmZmZ d dlm	Z	 d dl
mZmZmZ eedf ZG dd dZdS )    )AnyDictOptional)BLOCK_TYPESENTITY_TYPESINLINE_STYLES)ConfigException)	ConfigMapPropsRenderableTypeOptionsc                   @   s,  e Zd ZdZdZ			d)dededee dedee d	dfd
dZ	d	efddZ
d	efddZded	efddZded	efddZd	efddZedededed	d fddZededed	efddZeded	efddZed ed	efd!d"Zed#ed	efd$d%Zed&ededed	d fd'd(ZdS )*r   z?
    Facilitates querying configuration from a config map.
    typeelementpropswrapperwrapper_propsNtype_r   r   r   r   returnc                 C   s*   || _ || _|r
|ni | _|| _|| _d S Nr   )selfr   r   r   r   r    r   X/var/www/html/ndineBlogger/venv/lib/python3.10/site-packages/draftjs_exporter/options.py__init__   s
   
zOptions.__init__c                 C   s.   d| j  d| j d| j d| j d| j dS )Nz	<Options  >r   r   r   r   r   __str__    s   .zOptions.__str__c                 C   s   t | S r   strr   r   r   r   __repr__#   s   zOptions.__repr__otherc                 C   s   t | t |kS )zX
        Equality used in test code only, not to be relied on for the exporter.
        r   r   r!   r   r   r   __eq__&   s   zOptions.__eq__c                 C   s
   | |k S r   r   r"   r   r   r   __ne__,   s   
zOptions.__ne__c                 C   s   t t| S r   )hashr   r   r   r   r   __hash__/   s   zOptions.__hash__kind_mapfallback_keyc                 C   sv   || vr|| vrt d| d| | }n| | }t|tr4d|vr*t d| dt|fi |}|S t||}|S )z<
        Create an Options object from any mapping.
        "*" is not in the config and has no fallbackr   z" does not define an element)r   
isinstancedictr   )r'   r   r(   configoptsr   r   r   create2   s   



zOptions.createc                 C   s$   i }| D ]}t | ||||< q|S r   )r   r/   )r'   r(   optionsr   r   r   r   mapK   s   zOptions.map	block_mapc                 C      t | tjS r   )r   r1   r   FALLBACK)r2   r   r   r   
map_blocksS      zOptions.map_blocks	style_mapc                 C   r3   r   )r   r1   r   r4   )r7   r   r   r   
map_stylesW   r6   zOptions.map_styles
entity_mapc                 C   r3   r   )r   r1   r   r4   )r9   r   r   r   map_entities[   r6   zOptions.map_entitiesr0   c                 C   sH   z| | W S  t y#   z| | W  Y S  t y"   td| dw w )Nr)   r*   )KeyErrorr   )r0   r   r(   r   r   r   get_   s   

zOptions.get)NNN)__name__
__module____qualname____doc__	__slots__r   r   r   r
   r   r   r    r   boolr#   r$   intr&   staticmethodr	   r/   
OptionsMapr1   r5   r8   r:   r<   r   r   r   r   r      sH    
 N)typingr   r   r   draftjs_exporter.constantsr   r   r   draftjs_exporter.errorr   draftjs_exporter.typesr	   r
   r   r   rE   r   r   r   r   r   <module>   s    