
    ijVN                     |   d Z ddlmZ ddlZddlZddlZddlmZmZm	Z	 ddl
mZ ddlmZ ddlmZ ddlmZ  e	d	      Z e	d
ej"                        Zej&                   G d dee                Z G d dee         Z G d dee         Z G d dee         Z G d dee   eee            Z G d dee         Zy)zContains Flag class - information about single command-line flag.

Do NOT import this module directly. Import the flags package and use the
aliases defined at the package level instead.
    )IterableN)AnyGenericTypeVar)minidom)_argument_parser)_exceptions)_helpers_T_ET)boundc                      e Zd ZU dZedz  ed<   edz  ed<   edz  ez  ed<   ej                  e   ed<   	 	 	 	 	 	 	 d/dej                  e   dej                  e   dz  dededz  ez  d	edz  d
edz  de
de
de
de
de
de
ddfdZededz  fd       Zej                  dedz  fd       Zd Zd Zd Zd Zd Zd Zdeeef   ddfdZdedz  dedz  fdZd eez  ddfd!Zd eez  dedz  fd"Zd0d#Zdefd$Zdedz  defd%Zdedz  ez  ddfd&Zdeez  dedz  fd'Z defd(Z!	 d1d)e"jF                  d*ed+e
de"jH                  fd,Z%dedz  defd-Z&d)e"jF                  de'e"jH                     fd.Z(y)2Flaga	  Information about a command-line flag.

  Attributes:
    name: the name for this flag
    default: the default value for this flag
    default_unparsed: the unparsed default value for this flag.
    default_as_str: default value as repr'd string, e.g., "'true'" (or None)
    value: the most recent parsed value of this flag set by :meth:`parse`
    help: a help string or None if no help is available
    short_name: the single letter alias for this flag (or None)
    boolean: if 'true', this flag does not accept arguments
    present: true if this flag was parsed from command line flags
    parser: an :class:`~absl.flags.ArgumentParser` object
    serializer: an ArgumentSerializer object
    allow_override: the flag may be redefined without raising an error, and
      newly defined flag overrides the old one.
    allow_override_cpp: use the flag from C++ if available the flag definition
      is replaced by the C++ flag after init
    allow_hide_cpp: use the Python flag despite having a C++ flag with the same
      name (ignore the C++ flag)
    using_default_value: the flag value has not been set by user
    allow_overwrite: the flag may be parsed more than once without raising an
      error, the last set value will be used
    allow_using_method_names: whether this flag can be defined even if it has a
      name that conflicts with a FlagValues method.
    validators: list of the flag validators.

  The only public method of a ``Flag`` object is :meth:`parse`, but it is
  typically only called by a :class:`~absl.flags.FlagValues` object.  The
  :meth:`parse` method is a thin wrapper around the
  :meth:`ArgumentParser.parse()<absl.flags.ArgumentParser.parse>` method.  The
  parsed value is saved in ``.value``, and the ``.present`` attribute is
  updated.  If this flag was already present, an Error is raised.

  :meth:`parse` is also called during ``__init__`` to parse the default value
  and initialize the ``.value`` attribute.  This enables other python modules to
  safely use flags even if the ``__main__`` module neglects to parse the
  command line arguments.  The ``.present`` attribute is cleared after
  ``__init__`` parsing.  If the default value is set to ``None``, then the
  ``__init__`` parsing step is skipped and the ``.value`` attribute is
  initialized to None.

  Note: The default value is also presented to the user in the help
  string, so it is important that it be a legal value for this flag.
  Ndefaultdefault_as_strdefault_unparsedparser
serializernamehelp_string
short_namebooleanallow_overrideallow_override_cppallow_hide_cppallow_overwriteallow_using_method_namesreturnc                 Z   || _         |sd}|| _        || _        || _        d| _        || _        || _        || _        |	| _        |
| _	        || _
        || _        d| _        d | _        g | _        | j                  r!| j                  rt        j                   d      | j#                  |       y )N(no help available)r   TzsCan't have both allow_hide_cpp (means use Python flag) and allow_override_cpp (means use C++ flag after InitGoogle))r   helpr   r   presentr   r   r   r   r   r   r   using_default_value_value
validatorsr	   Error_set_default)selfr   r   r   r   r   r   r   r   r   r   r   r   s                e/var/www/html/emotional.easysim.app/public_html/venv/lib/python3.12/site-packages/absl/flags/_flag.py__init__zFlag.__init__[   s     DI)kDI DODLDLDK DO(D0D(D*D$<D!#D!DK!#DOt66E 
 	g    c                     | j                   S Nr$   r(   s    r)   valuez
Flag.value   s    ;;r+   r0   c                     || _         y r-   r.   r(   r0   s     r)   r0   z
Flag.value   s	    DKr+   c                 *    t        t        |             S r-   )hashidr/   s    r)   __hash__zFlag.__hash__   s    4>r+   c                 
    | |u S r-    r(   others     r)   __eq__zFlag.__eq__   s    5=r+   c                 \    t        |t              rt        |       t        |      k  S t        S r-   )
isinstancer   r5   NotImplementedr9   s     r)   __lt__zFlag.__lt__   s%    %X5	!!r+   c                     t        d      )NzRA Flag instance would always be True. Did you mean to test the `.value` attribute?	TypeErrorr/   s    r)   __bool__zFlag.__bool__   s    
	7 r+   c                     t        d      )Nzcan't pickle Flag objectsrA   r/   s    r)   __getstate__zFlag.__getstate__   s    
/
00r+   c                 D    t        t        |       j                   d      )Nz< does not support shallow copies. Use copy.deepcopy instead.)rB   type__name__r/   s    r)   __copy__zFlag.__copy__   s)    
:
  " 	" r+   memozFlag[_T]c                     t         j                  t        |             }t        j                  | j
                  |      |_        |S r-   )object__new__rG   copydeepcopy__dict__)r(   rJ   results      r)   __deepcopy__zFlag.__deepcopy__   s/    ^^DJ'FmmDMM48FOMr+   c                     |y| j                   r$t        | j                   j                  |            S | j                  r|rt        d      S t        d      S t        t	        |            S )z$Returns parsed flag value as string.Ntruefalse)r   repr	serializer   strr2   s     r)   _get_parsed_value_as_stringz Flag._get_parsed_value_as_string   sX    }$//++E233||	F|G}E
r+   argumentc                     | j                   r>| j                  s2t        j                  d| j                   d| d| j
                         | j                  |      | _        | xj                   dz  c_         y)z}Parses string and sets flag value.

    Args:
      argument: str or the correct flag value type, argument to be parsed.
    flag --=z: already defined as    N)r"   r   r	   IllegalFlagValueErrorr   r0   _parse)r(   rZ   s     r)   parsez
Flag.parse   se     ||D00--DII;az)>tzzl
K  X&DJLLALr+   c           	          	 | j                   j                  |      S # t        t        t        f$ r-}t        j                  d| j                   d| d|       d}~ww xY w)zInternal parse function.

    It returns the parsed value, and does not modify class states.

    Args:
      argument: str or the correct flag value type, argument to be parsed.

    Returns:
      The parsed value.
    r\   r]   z: N)r   ra   rB   
ValueErrorOverflowErrorr	   r_   r   )r(   rZ   es      r)   r`   zFlag._parse   s`    [[x((z=1 --DII;azA3
/ s    A(AAc                 B    | j                   | _        d| _        d| _        y )NTr   )r   r0   r#   r"   r/   s    r)   unparsezFlag.unparse   s    DJ#DDLr+   c                 8    | j                  | j                        S )zSerializes the flag.)
_serializer0   r/   s    r)   rW   zFlag.serialize   s    ??4::&&r+   c                    |y| j                   r |rd| j                   S d| j                   S | j                  s"t        j                  d| j                         d| j                   d| j                  j                  |       S )zInternal serialize function. z--z--no Serializer not present for flag r]   )r   r   r   r	   r&   rW   r2   s     r)   ri   zFlag._serialize   s    }||	DII;dii[!!__"B499+ NOO$))Adoo77>?@@r+   c                     || _         |d| _        n| j                  |      | _        | j                  | j                        | _        | j
                  r| j                  | _        yy)z@Changes the default value (and current value too) for this Flag.N)r   r   _parse_from_defaultrY   r   r#   r0   r2   s     r)   r'   zFlag._set_default   sX    !D}dl--e4dl::4<<HD<<dj  r+   c                 $    | j                  |      S r-   )r`   r2   s     r)   rn   zFlag._parse_from_default   s    ;;ur+   c                 6    | j                   j                         S )a   Returns a str that describes the type of the flag.

    NOTE: we use strings, and not the types.*Type constants because
    our flags can have more exotic types, e.g., 'comma separated list
    of strings', 'whitespace separated list of strings', etc.
    r   	flag_typer/   s    r)   rr   zFlag.flag_type  s     ;;  ""r+   docmodule_nameis_keyc                 f   |j                  d      }|r&|j                  t        j                  |dd             |j                  t        j                  |d|             |j                  t        j                  |d| j                               | j
                  r0|j                  t        j                  |d| j
                               | j                  r0|j                  t        j                  |d| j                               | j                  rOt        | j                  t              s5| j                  &| j                  j                  | j                        }nd}n| j                  }|j                  t        j                  |d	|             | j                  | j                        }|j                  t        j                  |d
|             |j                  t        j                  |d| j                                      | j                  |      D ]  }|j                  |        |S )a6  Returns an XML element that contains this flag's information.

    This is information that is relevant to all flags (e.g., name,
    meaning, etc.).  If you defined a flag that has some other pieces of
    info, then please override _ExtraXMLInfo.

    Please do NOT override this method.

    Args:
      doc: minidom.Document, the DOM document it should create nodes from.
      module_name: str,, the name of the module that defines this flag.
      is_key: boolean, True iff this flag is key for main module.

    Returns:
      A minidom.Element instance.
    flagkeyyesfiler   r   meaningrk   r   currentrG   )createElementappendChildr
   create_xml_dom_elementr   r   r!   r   r=   r   rX   rW   _serialize_value_for_xmlr0   rr   _extra_xml_dom_elements)r(   rs   rt   ru   elementdefault_serializedvalue_serializedre   s           r)   _create_xml_dom_elementzFlag._create_xml_dom_element
  s   & 'G(99#ueLM''V[A 77VTYYOP

)
)#|T__
M yy

)
)#y$))
D z$,,<		!!__66t||D<<''Y8JK 44TZZ@''Y8HI ''VT^^5EF ))#. !Nr+   c                     |S )z:Returns the serialized value, for use in an XML help text.r8   r2   s     r)   r   zFlag._serialize_value_for_xmlF  s    Lr+   c                 8    | j                   j                  |      S )a   Returns extra info about this flag in XML.

    "Extra" means "not already included by _create_xml_dom_element above."

    Args:
      doc: minidom.Document, the DOM document it should create nodes from.

    Returns:
      A list of minidom.Element.
    )r   _custom_xml_dom_elements)r(   rs   s     r)   r   zFlag._extra_xml_dom_elementsJ  s     ;;//44r+   )NFFFFTF)r   NF))rH   
__module____qualname____doc__r   __annotations__rX   r   ArgumentParserArgumentSerializerboolr*   propertyr0   setterr6   r;   r?   rC   rE   rI   dictintr   rR   rY   ra   r`   rg   rW   ri   r'   rn   rr   r   DocumentElementr   r   listr   r8   r+   r)   r   r   $   s   ,^ 9*IO#

)
)"
--  $"!&""',)--b1) #55b9D@) 	)
 Dy3) :) *) ) ) ) ) ) !%) )V R$Y   	<<d  
1tCH~ * 
rDy S4Z C"H  S2X "t) &
' 'Ab4i AC A	 T	C 	 D 	 sRx BI # # EJ:!!:03:=A::xBI # 5!!5GOO5r+   r   c                   T     e Zd ZdZ	 d	dededz  ez  dedz  dedz  ddf
 fdZ xZS )
BooleanFlaga  Basic boolean flag.

  Boolean flags do not take any arguments, and their value is either
  ``True`` (1) or ``False`` (0).  The false value is specified on the command
  line by prepending the word ``'no'`` to either the long or the short flag
  name.

  For example, if a Boolean flag was created whose long name was
  ``'update'`` and whose short name was ``'x'``, then this flag could be
  explicitly unset through either ``--noupdate`` or ``--nox``.
  Nr   r   r!   r   r   c           	      Z    t        j                         }t        |   |d ||||dfi | y NT)r   BooleanParsersuperr*   )r(   r   r   r!   r   argsp	__class__s          r)   r*   zBooleanFlag.__init__i  s1     	&&(A	GQdGT:tLtLr+   r-   )rH   r   r   r   rX   r   r*   __classcell__r   s   @r)   r   r   \  s_    
"  $	M	M d{S 	M $J		M
 *	M 	M 	Mr+   r   c                        e Zd ZU dZej
                  ed<   	 	 ddededz  dedz  dee   dedz  d	e	f fd
Z
dej                  deej                     fdZ xZS )EnumFlagzFBasic enum flag; its value can be any string from list of enum_values.r   Nr   r   r!   enum_valuesr   case_sensitivec                     t        j                  ||      }t        j                         }	t        |   ||	||||fi | || _        dj                  |j                        }
d|
 d| j                   | _        y )N|<>: )	r   
EnumParserr   r   r*   r   joinr   r!   )r(   r   r   r!   r   r   r   r   r   gjoined_valuesr   s              r)   r*   zEnumFlag.__init__z  sr     	##K@A++-A	GQ4$
CdCDKHHQ]]+MM?#dii[1DIr+   rs   r   c                     g }| j                   j                  D ](  }|j                  t        j                  |d|             * |S N
enum_value)r   r   appendr
   r   r(   rs   elementsr   s       r)   r   z EnumFlag._extra_xml_dom_elements  sG     Hkk-- 
oo

)
)#|Z
H Or+   r   )rH   r   r   r   r   r   r   rX   r   r   r*   r   r   r   r   r   r   r   s   @r)   r   r   u  s    N

%
%%  $!22 Tz2 $J	2
 C=2 *2 2$!!GOOr+   r   c                        e Zd ZU dZej
                  ed<   	 	 ddededz  ez  dedz  de	e   dedz  d	e
f fd
Zdej                  deej                     fdZ xZS )EnumClassFlagz5Basic enum flag; its value is an enum class's member.r   Nr   r   r!   
enum_classr   r   c                     t        j                  ||      }t        j                  |       }	t        |   ||	||||fi | || _        dj                  |j                        }
d|
 d| j                   | _        y )Nr   )	lowercaser   r   r   )	r   EnumClassParserEnumClassSerializerr   r*   r   r   member_namesr!   )r(   r   r   r!   r   r   r   r   r   r   joined_namesr   s              r)   r*   zEnumClassFlag.__init__  s|     	((>	A 	,,>7IJA	GQ4$
CdCDK88ANN+LL>TYYK0DIr+   rs   r   c                     g }| j                   j                  j                  j                         D ](  }|j	                  t        j                  |d|             * |S r   r   r   __members__keysr   r
   r   r   s       r)   r   z%EnumClassFlag._extra_xml_dom_elements  V     Hkk,,88==? 
oo

)
)#|Z
H Or+   )NF)rH   r   r   r   r   r   r   rX   r   rG   r   r*   r   r   r   r   r   r   r   s   @r)   r   r     s    =

*
**  $"11 TzC1 $J	1
 s)1 *1 1(!!GOOr+   r   c                        e Zd ZdZ fdZdeez  ee   z  fdZdeez  ee   z  de	e   f fdZ
de	e   dz  def fd	Zd
 Zdej                  de	ej                     fdZ xZS )	MultiFlagae  A flag that can appear multiple time on the command-line.

  The value of such a flag is a list that contains the individual values
  from all the appearances of that flag on the command-line.

  See the __doc__ for Flag for most behavior of this class.  Only
  differences in behavior are described here:

    * The default value may be either a single value or an iterable of values.
      A single value is transformed into a single-item list of that value.

    * The value of the flag is always a list, even if the option was
      only supplied once, and even if the default value is a single
      value
  c                 N    t        |   |i | | xj                  dz  c_        y )N4;
    repeat this option to specify a list of values)r   r*   r!   )r(   r   kwargsr   s      r)   r*   zMultiFlag.__init__  s$    	Gd%f%IIHHIr+   	argumentsc                     | j                  |      }| j                  r*| j                  J | j                  j                  |       n|| _        | xj                  t	        |      z  c_        y)a  Parses one or more arguments with the installed parser.

    Args:
      arguments: a single argument or a list of arguments (typically a list of
        default values); a single argument is converted internally into a list
        containing one item.
    N)r`   r"   r0   extendlen)r(   r   
new_valuess      r)   ra   zMultiFlag.parse  sT     Y'J||ZZ###
jj
#djLLC
O#Lr+   r   c                     |xt         d x\    |g}n t        d x\   t        |      }n 	 |g}|D cg c]  }t        t        |   |       c}S c c}w )Nr8   )rX   r   r   r   r   r`   )r(   r   arguments_listitemr   s       r)   r`   zMultiFlag._parse  sZ     35# :i  $<JKDE)T)$/KKKs   Ar0   Nc                     | j                   s"t        j                  d| j                         |y|D cg c]  }t        t
        |   |       }}dj                  |      S c c}w )See base class.rl   rk   
)r   r	   r&   r   r   r   ri   r   )r(   r0   
value_itemserialized_itemsr   s       r)   ri   zMultiFlag._serialize  sr    ?? @LMM}   	i)*5 
 99%&&s   A$c                 <    d| j                   j                         z   S )r   zmulti rq   r/   s    r)   rr   zMultiFlag.flag_type  s    dkk++---r+   rs   c                     g }t        | j                  d      rA| j                  j                  D ](  }|j                  t	        j
                  |d|             * |S )Nr   r   )hasattrr   r   r   r
   r   r   s       r)   r   z!MultiFlag._extra_xml_dom_elements  sU     Ht{{M*// 
*++CzJ	

 Or+   )rH   r   r   r   r*   rX   r   r   ra   r   r`   ri   rr   r   r   r   r   r   r   s   @r)   r   r     s     I$S2X4 $ LcBh"5 L$r( L 'd2ho '# '.	!!	GOO	r+   r   c                        e Zd ZU dZej
                  e   ed<   	 ddedde	e   z  ez  e	e   z  ez  dede
e   def
 fd	Zd
ej                  deej                      fdZd Z xZS )MultiEnumClassFlagzA multi_enum_class flag.

  See the __doc__ for MultiFlag for most behaviors of this class.  In addition,
  this class knows how to handle enum.Enum instances as values for this flag
  type.
  r   r   r   Nr   r   r   c                    t        j                  ||      }t        j                  d|       }t        
|   |||||fi | || _        || _        dj                  |j                        }	d|	 d|xs d d| _	        y )	Nr   ,)list_sepr   r   r   r   r    r   )
r   r   EnumClassListSerializerr   r*   r   r   r   r   r!   )r(   r   r   r   r   r   r   r   r   r   r   s             r)   r*   zMultiEnumClassFlag.__init__  s     	((>	A 	00N 2	A 
GQ4+>> DKDO88ANN+L
L>//
0 1=	= 	Ir+   rs   r   c                     g }| j                   j                  j                  j                         D ](  }|j	                  t        j                  |d|             * |S r   r   r   s       r)   r   z*MultiEnumClassFlag._extra_xml_dom_elements5  r   r+   c                     |K| j                   s"t        j                  d| j                         | j                   j	                  |      }|S d}|S )r   rl   rk   )r   r	   r&   r   rW   )r(   r0   r   s      r)   r   z+MultiEnumClassFlag._serialize_value_for_xml?  sW    __"B499+ NOO2259  r+   r   )rH   r   r   r   r   r   r   r   rX   r   rG   r   r*   r   r   r   r   r   r   r   r   s   @r)   r   r     s     
*
*3
// # hsm#c)HSM9C? 	
 s) :!!GOOr+   r   )r   collections.abcr   rN   enum	functoolstypingr   r   r   xml.domr   
absl.flagsr   r	   r
   r   Enumr   total_orderingr   r   r   rX   r   r   r   r   r   r8   r+   r)   <module>r      s    %    ( (  ' " T]e499% t572; t5 t5n	M$t* M2tCy D!DI !HPT$r(^ Pf93 9r+   