
    RpfM                        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	m
Z
mZmZmZ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!dS )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.
    )abcN)
AnyDictGenericIterableListOptionalTextTypeTypeVarUnion)minidom)_argument_parser)_exceptions)_helpers_T_ET)boundc                   L   e Zd ZU dZee         ed<   ee         ed<   eee         ef         ed<   	 	 	 	 	 	 	 d1de	j
        e         d	ee	j        e                  d
edeee         ef         dee         dee         dededededededdfdZedee         fd            Zej        dee         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e         dee         fd!Zd"eeee         f         ddfd#Zd"eeef         dee         fd$Zd2d%Zdefd&Zdee         defd'Z deee         ef         ddfd(Z!deeef         dee         fd)Z"defd*Z#	 d3d+e$j%        d,e&d-ede$j'        fd.Z(dee         defd/Z)d+e$j%        de*e$j'                 fd0Z+dS )4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.
  defaultdefault_as_strdefault_unparsedNFTparser
serializernamehelp_string
short_namebooleanallow_overrideallow_override_cppallow_hide_cppallow_overwriteallow_using_method_namesreturnc                 N   || _         |sd}|| _        || _        || _        d| _        || _        || _        || _        |	| _        |
| _	        || _
        || _        d| _        d | _        g | _        | j	        r| j        rt          j        d          |                     |           d S )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                P/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/absl/flags/_flag.py__init__zFlag.__init__Z   s     DI *)kDI DODLDLDK DO(D0D(D*D$<D!#DDKDO Ft6 FEF F F 	g    c                     | j         S Nr+   r/   s    r0   valuez
Flag.value   s
    ;r2   r7   c                     || _         d S r4   r5   r/   r7   s     r0   r7   z
Flag.value   s    DKKKr2   c                 :    t          t          |                     S r4   )hashidr6   s    r0   __hash__zFlag.__hash__   s    4>>r2   c                 
    | |u S r4    r/   others     r0   __eq__zFlag.__eq__   s    5=r2   c                 z    t          |t                    r t          |           t          |          k     S t          S r4   )
isinstancer   r<   NotImplementedr@   s     r0   __lt__zFlag.__lt__   s1    % "XX5		!!r2   c                      t          d          )NzRA Flag instance would always be True. Did you mean to test the `.value` attribute?	TypeErrorr6   s    r0   __bool__zFlag.__bool__   s    
 C D D Dr2   c                      t          d          )Nzcan't pickle Flag objectsrH   r6   s    r0   __getstate__zFlag.__getstate__   s    
/
0
00r2   c                 J    t          dt          |           j        z            )Nz>%s does not support shallow copies. Use copy.deepcopy instead.)rI   type__name__r6   s    r0   __copy__zFlag.__copy__   s.    
 137::3FG H H Hr2   memozFlag[_T]c                     t                               t          |                     }t          j        | j        |          |_        |S r4   )object__new__rN   copydeepcopy__dict__)r/   rQ   results      r0   __deepcopy__zFlag.__deepcopy__   s3    ^^DJJ''FmDM488FOMr2   c                     |dS | j         r't          | 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   strr9   s     r0   _get_parsed_value_as_stringz Flag._get_parsed_value_as_string   sr    }T 4$/++E22333| 	 F||G}}E

r2   argumentc                     | j         r.| j        s't          j        d| j        d|d| j                  |                     |          | _        | xj         dz  c_         dS )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   r7   _parse)r/   ra   s     r0   parsez
Flag.parse   ss     | 0D0 0--iii4::/0 0 0 X&&DJLLALLLLr2   c           	          	 | j                             |          S # 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.
    rc   rd   z: N)r   rh   rI   
ValueErrorr   rf   r   )r/   ra   es      r0   rg   zFlag._parse   so    9[x(((z" 9 9 9-- $			888QQ
79 9 99s    A"AAc                 :    | j         | _        d| _        d| _        d S )NTr   )r   r7   r*   r)   r6   s    r0   unparsezFlag.unparse   s    DJ#DDLLLr2   c                 6    |                      | j                  S )zSerializes the flag.)
_serializer7   r6   s    r0   r^   zFlag.serialize   s    ??4:&&&r2   c                     |dS | j         r|r
d| j        z  S d| j        z  S | j        st          j        d| j        z            d| j        d| j                            |          S )zInternal serialize function.N z--%sz--no%s"Serializer not present for flag %sz--rd   )r   r   r   r   r-   r^   r9   s     r0   ro   zFlag._serialize   s    }R| 	G	 $	!!$)##_ >049<> > 	>> )))T_%>%>u%E%E%EFFr2   c                     || _         |d| _        n|                     |          | _        |                     | j                  | _        | j        r| j        | _        dS dS )z@Changes the default value (and current value too) for this Flag.N)r   r   _parse_from_defaultr`   r   r*   r7   r9   s     r0   r.   zFlag._set_default   sg    !D}dll--e44dl::4<HHD  <djjj   r2   c                 ,    |                      |          S r4   )rg   r9   s     r0   rt   zFlag._parse_from_default   s    ;;ur2   c                 4    | 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_typer6   s    r0   rx   zFlag.flag_type   s     ;  """r2   docmodule_nameis_keyc                 T   |                     d          }|r)|                    t          j        |dd                     |                    t          j        |d|                     |                    t          j        |d| j                             | j        r.|                    t          j        |d| j                             | j        r.|                    t          j        |d| j                             | j        rDt          | j	        t                    s*| j	         | j                            | j	                  }n
d	}n| j	        }|                    t          j        |d
|                     |                     | j                  }|                    t          j        |d|                     |                    t          j        |d|                                                      |                     |          D ]}|                    |           |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   meaningNrq   r   currentrN   )createElementappendChildr   create_xml_dom_elementr   r   r(   r   rD   r   r_   r^   _serialize_value_for_xmlr7   rx   _extra_xml_dom_elements)r/   ry   rz   r{   elementdefault_serializedvalue_serializedrk   s           r0   _create_xml_dom_elementzFlag._create_xml_dom_element  sF   & ''G N(9#ueLLMMM7V[" " # # # 7VTYOOPPP /(9
|T_. . / / /y &(9
y$)% % & & &
  (z$,<< (		!!_66t|DD<7Y*, , - - -44TZ@@7Y(* * + + +7VT^^%%' ' ( ( ( ))#..  !Nr2   c                     |S )z:Returns the serialized value, for use in an XML help text.r?   r9   s     r0   r   zFlag._serialize_value_for_xml9  s    Lr2   c                 6    | 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/   ry   s     r0   r   zFlag._extra_xml_dom_elements=  s     ;//444r2   )NFFFFTF)r%   NF),rO   
__module____qualname____doc__r	   r   __annotations__r
   r   r   ArgumentParserArgumentSerializerboolr1   propertyr7   setterr=   rB   rF   rJ   rL   rP   r   intr   rY   r`   rh   rg   rm   r^   ro   r.   rt   rx   r   Documentr_   Elementr   r   r   r   r?   r2   r0   r   r   $   s        - -` B<4.   (2,,---- $("!&""',( (-b1( +>rBC( 	(
 Xb\4'(( D>( 4.( ( ( ( ( ( !%( ( ( ( (T Xb\    8 	<"    <      
D D D1 1 1H H HtCH~ *    
x|     E$"45 $    9U48_ 9" 9 9 9 9"   
' ' ' ' 'Ghrl Gt G G G G	 hrlD&8 9 	 d 	  	  	  	 uT2X 8B<    # # # # # EJ4 4!4034=A44 4 4 4lHRL S    5!5GO5 5 5 5 5 5r2   r   c                   p     e Zd ZdZ	 d	dedeee         ef         dee         dee         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           	      |    t          j                    } t          t          |           j        |d ||||dfi | d S NT)r   BooleanParsersuperr   r1   )r/   r   r   r(   r   argsp	__class__s          r0   r1   zBooleanFlag.__init__\  sZ     	&((A%E+t%	4wj$ :>    r2   r4   )
rO   r   r   r   r
   r   r	   r   r1   __classcell__r   s   @r0   r   r   O  s        
 
" $(  Xd^T)* TN	
 4.          r2   r   c                        e Zd ZdZ	 	 ddedee         dee         dee         dee         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.NTr   r   r(   enum_valuesr   case_sensitivec                    t          j        ||          }t          j                    }	 t          t          |           j        ||	||||fi | || _        dd                    |j                  d| j	        | _	        d S )N<|>: )
r   
EnumParserr   r   r   r1   r   joinr   r(   )r/   r   r   r(   r   r   r   r   r   gr   s             r0   r1   zEnumFlag.__init__m  s     	#K@@A+--A"E(D"	1dGT:7 7157 7 7 DKK!hhq}5555tyyADIIIr2   ry   r%   c                 z    g }| j         j        D ]+}|                    t          j        |d|                     ,|S N
enum_value)r   r   appendr   r   r/   ry   elementsr   s       r0   r   z EnumFlag._extra_xml_dom_elements  sS     Hk- * *
ooh5
|Z) ) * * * *Or2   r   )rO   r   r   r   r
   r	   r   r   r1   r   r   r   r   r   r   r   s   @r0   r   r   j  s        NN $(!B BB ~B TN	B
 D>B 4.B B B B B B B&!GO       r2   r   c                        e Zd ZdZ	 	 ddedeee         ef         dee         dee         dee         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.NFr   r   r(   
enum_classr   r   c                    t          j        ||          }t          j        |           }	 t          t          |           j        ||	||||fi | || _        dd                    |j                  d| j	        | _	        d S )Nr   )	lowercaser   r   r   )
r   EnumClassParserEnumClassSerializerr   r   r1   r   r   member_namesr(   )r/   r   r   r(   r   r   r   r   r   r   r   s             r0   r1   zEnumClassFlag.__init__  s     	(>	3 	3 	3A,>7IJJJA'E-'	1dGT:7 7157 7 7 DKK!hhq~6666		BDIIIr2   ry   r%   c                     g }| j         j        j                                        D ]+}|                    t          j        |d|                     ,|S r   r   r   __members__keysr   r   r   r   s       r0   r   z%EnumClassFlag._extra_xml_dom_elements  b     Hk,8==?? * *
ooh5
|Z) ) * * * *Or2   )NF)rO   r   r   r   r
   r   r	   r   r   r   r1   r   r   r   r   r   r   r   s   @r0   r   r     s        == $("C CC Xc]D()C TN	C
 s)C 4.C C C C C C C(!GO       r2   r   c                        e Zd ZdZ fdZdeeeee         f         fdZ	deee
ee                  f         dee         f fdZde
ee                  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                 h     t          t          |           j        |i | | xj        dz  c_        d S )N4;
    repeat this option to specify a list of values)r   r   r1   r(   )r/   r   kwargsr   s      r0   r1   zMultiFlag.__init__  s:    #E)T#T4V444IIHHIIIIr2   	argumentsc                     |                      |          }| j        r| j                            |           n|| _        | xj        t	          |          z  c_        dS )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)rg   r)   r7   extendlen)r/   r   
new_valuess      r0   rh   zMultiFlag.parse  sY     Y''J| 
j
####djLLC
OO#LLLLr2   r%   c                      t          |t          j                  r$t          |t                    st	          |          }t          |t                    s|g} fd|D             S )Nc                 `    g | ]*}t          t                                        |          +S r?   )r   r   rg   ).0itemr   r/   s     r0   
<listcomp>z$MultiFlag._parse.<locals>.<listcomp>  s1    FFFDE)T""))$//FFFr2   )rD   r   r   r_   list)r/   r   r   s   ` r0   rg   zMultiFlag._parse  sm    9cl++ "y#&&"y//ii&&  +iFFFFFIFFFFr2   r7   c                       j         st          j        d j        z            |dS  fd|D             }d                    |          S )See base class.rr   Nrq   c                 `    g | ]*}t          t                                        |          +S r?   )r   r   ro   )r   
value_itemr   r/   s     r0   r   z(MultiFlag._serialize.<locals>.<listcomp>  s>       :Di))*55  r2   
)r   r   r-   r   r   )r/   r7   serialized_itemsr   s   `  r0   ro   zMultiFlag._serialize  sz    ? <
.
:< < <}R    HM   99%&&&r2   c                 :    d| j                                         z   S )r   zmulti rw   r6   s    r0   rx   zMultiFlag.flag_type  s    dk++----r2   ry   c                     g }t          | j        d          r8| j        j        D ]+}|                    t	          j        |d|                     ,|S )Nr   r   )hasattrr   r   r   r   r   r   s       r0   r   z!MultiFlag._extra_xml_dom_elements  sg     Ht{M** ,/ , ,*7z+ + 	, 	, 	, 	,Or2   )rO   r   r   r   r1   r   r
   r   r   rh   r	   r   rg   ro   rx   r   r   r   r   r   r   s   @r0   r   r     s/         I I I I I$U4Xb\#9: $ $ $ $GeD(8B<*@$@A Gd2h G G G G G G'htBx0 'T ' ' ' ' ' '. . .!GO       r2   r   c                        e Zd ZdZ	 ddededee         eee         ef         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.
  Fr   r   Nr   r   r   c                    t          j        ||          }t          j        d|           } t          t          |           j        |||||fi | || _        || _        dd                    |j	                  d|pdd| _
        d S )	Nr   ,)list_sepr   r   r   r   r'   r   )r   r   EnumClassListSerializerr   r   r1   r   r   r   r   r(   )
r/   r   r   r   r   r   r   r   r   r   s
            r0   r1   zMultiEnumClassFlag.__init__  s     	(>	3 	3 	3A0N 2	4 	4 	4A,E
d##,	1dG[2 2,02 2 2 DKDOO 
!.	!	!	!	!;#G2G#G#G	I 	IIIr2   ry   r%   c                     g }| j         j        j                                        D ]+}|                    t          j        |d|                     ,|S r   r   r   s       r0   r   z*MultiEnumClassFlag._extra_xml_dom_elements  r   r2   c                     |>| j         st          j        d| j        z            | j                             |          }nd}|S )r   Nrr   rq   )r   r   r-   r   r^   )r/   r7   r   s      r0   r   z+MultiEnumClassFlag._serialize_value_for_xml"  sX    _ 
049<
 
 	
 22599r2   r   )rO   r   r   r   r_   r   r   r   r
   r   r   r1   r   r   r   r   r   r   r   r   s   @r0   r   r     s          #J JJ T8C=#x~tCDJ 	J
 s)J J J J J J J0!GO   
 
 
 
 
 
 
r2   r   )"r   collectionsr   rU   enum	functoolstypingr   r   r   r   r   r	   r
   r   r   r   xml.domr   
absl.flagsr   r   r   r   Enumr   total_orderingr   r   r   r   r   r   r   r?   r2   r0   <module>r      s@                [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [       ' ' ' ' ' ' " " " " " "      WT]]ge49%%% g5 g5 g5 g5 g572; g5 g5 g5T	    $t*   6    tDz   @    DI   BK K K K KT$r(^ K K K\3 3 3 3 33 3 3 3 3 3r2   