o
    Vh	                     @  sJ   d dl mZ d dlZd dlmZ d dlmZ d dlmZ G dd dZdS )    )annotationsN)Any)CleoLogicError)CleoValueErrorc                   @  s   e Zd ZdZ						d(d)ddZed*ddZed+ddZed*ddZed,ddZ	d-ddZ
d-ddZd-d d!Zd-d"d#Zd.d/d$d%Zd*d&d'ZdS )0Optionz 
    A command line option.
    NTFnamestrshortcut
str | Noneflagboolrequires_valueis_listdescriptiondefault
Any | NonereturnNonec           	      C  s   | dr|dd  }|std|d ur,td|d}dtd |}|s,td|| _|| _|| _	|| _
|| _|p>d| _d | _| jrM| j	rMtd	| | d S )
Nz--   zAn option name cannot be emptyz\|-?-|z"An option shortcut cannot be empty z&A flag option cannot be a list as well)
startswithr   resplitlstripjoinfilter_name	_shortcut_flag_requires_value_is_list_description_defaultr   set_default)	selfr   r	   r   r   r   r   r   	shortcuts r(   i/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/cleo/io/inputs/option.py__init__   s&   


zOption.__init__c                 C     | j S Nr   r&   r(   r(   r)   r   4      zOption.namec                 C  r+   r,   )r   r.   r(   r(   r)   r	   8   r/   zOption.shortcutc                 C  r+   r,   )r#   r.   r(   r(   r)   r   <   r/   zOption.descriptionc                 C  r+   r,   )r$   r.   r(   r(   r)   r   @   r/   zOption.defaultc                 C  r+   r,   r    r.   r(   r(   r)   is_flagD      zOption.is_flagc                 C  s   | j  S r,   r0   r.   r(   r(   r)   accepts_valueG   s   zOption.accepts_valuec                 C  s   | j  o| jS r,   )r    r!   r.   r(   r(   r)   r   J      zOption.requires_valuec                 C  r+   r,   )r"   r.   r(   r(   r)   r   M   r2   zOption.is_listc                 C  sP   | j r|d urtd| jr|d u rg }n	t|tstd| j r#d}|| _d S )Nz)A flag option cannot have a default valuez0A default value for a list option must be a listF)r    r   r"   
isinstancelistr$   )r&   r   r(   r(   r)   r%   P   s   

zOption.set_defaultc                 C  s   d| j  dS )NzOption()r-   r.   r(   r(   r)   __repr___   r4   zOption.__repr__)NTTFNN)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   r   r   r   )__name__
__module____qualname____doc__r*   propertyr   r	   r   r   r1   r3   r   r   r%   r8   r(   r(   r(   r)   r      s.    $



r   )	
__future__r   r   typingr   cleo.exceptionsr   r   r   r(   r(   r(   r)   <module>   s    