a
    Cg{                     @   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%eeee eee ddddZ	eddd	Z
edd
dZeedddZeedddZedddZeeeed dddZeeeedddZeeedddZeeedddZeeedd d!Zeeeed d"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   W/var/www/lab.imftr.de/x/nb_venv/lib/python3.9/site-packages/draftjs_exporter/options.py__init__   s
    zOptions.__init__)r   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__)otherr   c                 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_mapr   fallback_keyr   c                 C   st   || vr*|| vr t d| d| | }n| | }t|trfd|vrTt d| dt|fi |}n
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.create)r'   r(   r   c                 C   s$   i }| D ]}t | ||||< q|S r   )r   r/   )r'   r(   optionsr   r   r   r   mapK   s    zOptions.map)	block_mapr   c                 C   s   t | tjS r   )r   r1   r   FALLBACK)r2   r   r   r   
map_blocksS   s    zOptions.map_blocks)	style_mapr   c                 C   s   t | tjS r   )r   r1   r   r3   )r5   r   r   r   
map_stylesW   s    zOptions.map_styles)
entity_mapr   c                 C   s   t | tjS r   )r   r1   r   r3   )r7   r   r   r   map_entities[   s    zOptions.map_entities)r0   r   r(   r   c                 C   sT   z
| | W S  t yN   z| | W  Y S  t yH   td| dY n0 Y n0 d S )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   r4   r6   r8   r:   r   r   r   r   r      s<      N)typingr   r   r   Zdraftjs_exporter.constantsr   r   r   Zdraftjs_exporter.errorr   Zdraftjs_exporter.typesr	   r
   r   r   rC   r   r   r   r   r   <module>   s
   