File: //usr/local/lib/python3.9/site-packages/click/__pycache__/parser.cpython-39.pyc
a
X>h{J � @ s~ d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ddlm
Z
dd lmZ dd
lmZ ej
r�ddlZddlmZ ddlmZ dd
lmZ ddlmZ e�d�Ze� Zeje eje ejejej eejej!e df ej"e f d�dd�Z#eejeef d�dd�Z$eej!d ed�dd�Z%eej"e d�dd�Z&G dd� d�ZG dd � d �ZG d!d"� d"�Z'G d#d$� d$�Z(dS )%a;
This module started out as largely a copy paste from the stdlib's
optparse module with the features removed that we do not need from
optparse because we implement them in Click on a higher level (for
instance type handling, help formatting and a lot more).
The plan is to remove more and more from here over time.
The reason this is a different module and not optparse from the stdlib
is that there are differences in 2.x and 3.x about the error messages
generated and optparse in the stdlib uses gettext for no good reason
and might cause us issues.
Click uses parts of optparse written by Gregory P. Ward and maintained
by the Python Software Foundation. This is limited to code in parser.py.
Copyright 2001-2006 Gregory P. Ward. All rights reserved.
Copyright 2002-2006 Python Software Foundation. All rights reserved.
� N)�deque)�gettext)�ngettext� )�BadArgumentUsage)�BadOptionUsage)�NoSuchOption)�
UsageError)�Argument)�Context)�Option)� Parameter�V)�args�
nargs_spec�returnc s t ���t |�}g }d�dtjt d��fdd�� |r̈ |�}|du rHq2|dkr`|�� ��� q2|dkr�� �fdd�t|�D �}�dur�|�� |�t|�� q2|d k r2�dur�td
��t |��|�d� q2�du�rt��|�<