o
    Vh                     @  sx   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	 d dl
mZ er2d dlmZ d dlmZ G d	d
 d
e	ZdS )    )annotations)defaultdict)TYPE_CHECKINGoption)Command)GroupNotFoundError)Option)ProjectPackagec                   @  sf   e Zd Ze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S )GroupCommandreturnlist[Option]c                	   C  s4   t dd ddddt dd ddddt dd d	dddgS )
Nwithoutz The dependency groups to ignore.FT)flagmultiplewithz*The optional dependency groups to include.onlyz&The only dependency groups to include.r    r   r   y/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/poetry/console/commands/group_command.py_group_dependency_options   s,   z&GroupCommand._group_dependency_optionsset[str]c                 C  s   dd | j jj D S )Nc                 S  s   h | ]	}|  s|jqS r   )is_optionalname).0groupr   r   r   	<setcomp>/   s    z3GroupCommand.non_optional_groups.<locals>.<setcomp>)poetrypackage_dependency_groupsvaluesselfr   r   r   non_optional_groups,   s   z GroupCommand.non_optional_groups
str | Nonec                 C  s   dS )z
        The default group to use when no group is specified. This is useful
        for command that have the `--group` option, eg: add, remove.

        Can be overridden to adapt behavior.
        Nr   r    r   r   r   default_group5   s   zGroupCommand.default_groupc                 C  s   | j S )zy
        The groups that are considered by the command by default.

        Can be overridden to adapt behavior.
        )r"   r    r   r   r   default_groups?   s   zGroupCommand.default_groupsc                 C  s   i }dD ]}dd |  |dD ||< q|  dr#| jjjdd|d< | | |d	 r9|d s4|d
 r9| d |d	 pI| j|d |d
 S )N>   r   r   r   c                 S  s$   h | ]}| d D ]}| q	qS ),)splitstrip)r   groupsr   r   r   r   r   M   s    z0GroupCommand.activated_groups.<locals>.<setcomp> z
all-groupsT)include_optionalr   r   r   z<warning>The `<fg=yellow;options=bold>--with</>` and `<fg=yellow;options=bold>--without</>` options are ignored when used along with the `<fg=yellow;options=bold>--only</>` option.</warning>)	r   r   r   dependency_group_names_validate_group_options
line_errorr%   union
difference)r!   r)   keyr   r   r   activated_groupsH   s"   



zGroupCommand.activated_groupsr
   c                 C  s   | j jjt| jddS )NT)r   )r   r   with_dependency_groupslistr2   r    r   r   r   "project_with_activated_groups_onlyf   s   
z/GroupCommand.project_with_activated_groups_onlygroup_optionsdict[str, set[str]]Nonec                 C  s   t t}| D ]\}}|D ]}| jj|s|| | qq|rNg }t|D ]}ddd t|| D }|	| d| d q(t
dd| dS )zZ
        Raises an error if it detects that a group is not part of pyproject.toml
        z, c                 s  s    | ]	}d | dV  qdS )z<fg=yellow;options=bold>--z</>Nr   )r   optr   r   r   	<genexpr>w   s
    

z7GroupCommand._validate_group_options.<locals>.<genexpr>z (via )zGroup(s) not found: N)r   setitemsr   r   has_dependency_groupaddsortedjoinappendr   )r!   r6   invalid_optionsr9   r)   r   message_partsoptsr   r   r   r-   k   s    

z$GroupCommand._validate_group_optionsN)r   r   )r   r   )r   r#   )r   r
   )r6   r7   r   r8   )__name__
__module____qualname__staticmethodr   propertyr"   r$   r%   r2   r5   r-   r   r   r   r   r      s    	
r   N)
__future__r   collectionsr   typingr   cleo.helpersr   poetry.console.commands.commandr   poetry.console.exceptionsr   cleo.io.inputs.optionr	   $poetry.core.packages.project_packager
   r   r   r   r   r   <module>   s    