o
    Vh
                     @  s   d dl mZ d dlZd dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ er4d dlmZ e ZG d	d
 d
eZG dd deZejG dd dZdddZdS )    )annotationsN)ABC)abstractmethod)TYPE_CHECKING)Any)NullIO)IOc                   @  s   e Zd ZdS )PropertyNotFoundErrorN)__name__
__module____qualname__ r   r   o/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/poetry/config/config_source.pyr	      s    r	   c                   @  s6   e Zd ZedddZedd	d
ZedddZdS )ConfigSourcekeystrreturnr   c                 C     d S Nr   selfr   r   r   r   get_property      zConfigSource.get_propertyvalueNonec                 C  r   r   r   )r   r   r   r   r   r   add_property   r   zConfigSource.add_propertyc                 C  r   r   r   r   r   r   r   remove_property    r   zConfigSource.remove_propertyN)r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   )r
   r   r   r   r   r   r   r   r   r   r   r      s    r   c                   @  sH   e Zd ZU ded< ded< ejedZded< ddddZdddZ	dS )ConfigSourceMigrationr   old_keyz
str | Nonenew_key)default_factorydict[Any, Any]value_migrationNconfig_sourcer   io	IO | Noner   boolc                 C  s   |pt  }z|| j}W n
 ty   Y dS w | jr | j| n|}d| j dt| d}| jd urH|turH|d| j dt| d7 }n| jd u rR|d7 }n| jrb|tu rb|d| j d7 }|	| dS )	NFz<c1>z</c1> = <c2>z</c2>z -> <c1>z  -> <c1>Removed from config</c1>z!</c1> = <c2>Not explicit set</c2>T)
r   r   r   r	   r"   jsondumpsr   UNSET
write_line)r   r#   r$   	old_value	new_valuemsgr   r   r   dry_run*   s"   
 


zConfigSourceMigration.dry_runr   c                 C  sr   z| | j}W n
 ty   Y d S w | jr| j| n|}|| j | jd ur5|tur7|| j| d S d S d S r   )r   r   r	   r"   r   r   r)   r   )r   r#   r+   r,   r   r   r   applyC   s   zConfigSourceMigration.applyr   )r#   r   r$   r%   r   r&   )r#   r   r   r   )
r
   r   r   __annotations__dataclassesfielddictr"   r.   r/   r   r   r   r   r   $   s   
 r   keys	list[str]configr!   r   c                 C  sp   i }|  D ]/\}}| r|| d kr|||< q| r5|| d kr5t|tr-t| dd  |}|i kr5|||< q|S )Nr      )items
isinstancer3   drop_empty_config_category)r4   r6   config_r   r   r   r   r   r:   S   s   
r:   )r4   r5   r6   r!   r   r!   )
__future__r   r1   r'   abcr   r   typingr   r   cleo.io.null_ior   
cleo.io.ior   objectr)   
ValueErrorr	   r   	dataclassr   r:   r   r   r   r   <module>   s     .