
    "ShoN                        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 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TypeTypeVarUnion)minidom)_argument_parser)_exceptions)_helpers_T_ET)boundc                   `   e Zd ZU dZee         ed<   ee         ed<   eee         ef         ed<   e	j
        e         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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_unparsedparserNFT
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                V/var/www/html/movieo_spanner_bot/venv/lib/python3.11/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 Ft6 FEF F F 	g    c                     | j         S Nr*   r.   s    r/   valuez
Flag.value   s
    ;r1   r6   c                     || _         d S r3   r4   r.   r6   s     r/   r6   z
Flag.value   s    DKKKr1   c                 :    t          t          |                     S r3   )hashidr5   s    r/   __hash__zFlag.__hash__   s    4>>r1   c                 
    | |u S r3    r.   others     r/   __eq__zFlag.__eq__   s    5=r1   c                 z    t          |t                    r t          |           t          |          k     S t          S r3   )
isinstancer   r;   NotImplementedr?   s     r/   __lt__zFlag.__lt__   s1    % "XX5		!!r1   c                      t          d          )NzRA Flag instance would always be True. Did you mean to test the `.value` attribute?	TypeErrorr5   s    r/   __bool__zFlag.__bool__   s    
 C D D Dr1   c                      t          d          )Nzcan't pickle Flag objectsrG   r5   s    r/   __getstate__zFlag.__getstate__   s    
/
0
00r1   c                 J    t          dt          |           j        z            )Nz>%s does not support shallow copies. Use copy.deepcopy instead.)rH   type__name__r5   s    r/   __copy__zFlag.__copy__   s.    
 137::3FG H H Hr1   memozFlag[_T]c                     t                               t          |                     }t          j        | j        |          |_        |S r3   )object__new__rM   copydeepcopy__dict__)r.   rP   results      r/   __deepcopy__zFlag.__deepcopy__   s3    ^^DJJ''FmDM488FOMr1   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   strr8   s     r/   _get_parsed_value_as_stringz Flag._get_parsed_value_as_string   sr    }T 4$/++E22333| 	 F||G}}E

r1   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   r6   _parse)r.   r`   s     r/   parsez
Flag.parse   ss     | 0D0 0--iii4::/0 0 0 X&&DJLLALLLLr1   c           	          	 | 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.
    rb   rc   z: N)r   rg   rH   
ValueErrorOverflowErrorr   re   r   )r.   r`   es      r/   rf   zFlag._parse   sq    9[x(((z=1 9 9 9-- $			888QQ
79 9 99s    A"AAc                 :    | j         | _        d| _        d| _        d S )NTr   )r   r6   r)   r(   r5   s    r/   unparsezFlag.unparse   s    DJ#DDLLLr1   c                 6    |                      | j                  S )zSerializes the flag.)
_serializer6   r5   s    r/   r]   zFlag.serialize   s    ??4:&&&r1   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--rc   )r   r   r   r   r,   r]   r8   s     r/   ro   zFlag._serialize   s    }R| 	G	 $	!!$)##_ >049<> > 	>> )))T_%>%>u%E%E%EFFr1   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)   r6   r8   s     r/   r-   zFlag._set_default   sg    !D}dll--e44dl::4<HHD  <djjj   r1   c                 ,    |                      |          S r3   )rf   r8   s     r/   rt   zFlag._parse_from_default   s    ;;ur1   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_typer5   s    r/   rx   zFlag.flag_type   s     ;  """r1   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   currentrM   )createElementappendChildr   create_xml_dom_elementr   r   r'   r   rC   r   r^   r]   _serialize_value_for_xmlr6   rx   _extra_xml_dom_elements)r.   ry   rz   r{   elementdefault_serializedvalue_serializedrk   s           r/   _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^^%%' ' ( ( ( ))#..  !Nr1   c                     |S )z:Returns the serialized value, for use in an XML help text.r>   r8   s     r/   r   zFlag._serialize_value_for_xml<  s    Lr1   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     r/   r   zFlag._extra_xml_dom_elements@  s     ;//444r1   )NFFFFTF)r$   NF)+rN   
__module____qualname____doc__r	   r   __annotations__r^   r   r   ArgumentParserArgumentSerializerboolr0   propertyr6   setterr<   rA   rE   rI   rK   rO   r   intr   rX   r_   rg   rf   rm   r]   ro   r-   rt   rx   r   DocumentElementr   r   r   r   r>   r1   r/   r   r   $   s         - -` B<3-(2,+,,,,

)"
---- #'"!&""',( (-b1( +>rBC( 	(
 Xb\3&'( C=( 3-( ( ( ( ( ( !%( ( ( ( (T Xb\    8 	<"    <      
D D D1 1 1H H HtCH~ *    
x|     E#r'N t    9U37^ 9 9 9 9 9$   
' ' ' ' 'Ghrl Gs G G G G	 hrlC&7 8 	 T 	  	  	  	 uS"W~ (2,    # # # # # EJ4 4!4034=A44 4 4 4lHRL S    5!5GO5 5 5 5 5 5r1   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           	      n    t          j                    } t                      j        |d ||||dfi | d S NT)r   BooleanParsersuperr0   )r.   r   r   r'   r   argsp	__class__s          r/   r0   zBooleanFlag.__init___  sD     	&((AEGGQdGT:tLLtLLLLLr1   r3   )
rN   r   r   r   r^   r   r	   r   r0   __classcell__r   s   @r/   r   r   R  s        
 
" #'	M 	M	M Xd^S()	M SM		M
 3-	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	Mr1   r   c                        e Zd ZU dZej        ed<   	 	 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.r   NTr   r   r'   enum_valuesr   case_sensitivec                     t          j        ||          }t          j                    }	 t                      j        ||	||||fi | || _        dd                    |j                  d| j        | _        d S )N<|>: )	r   
EnumParserr   r   r0   r   joinr   r'   )r.   r   r   r'   r   r   r   r   r   gr   s             r/   r0   zEnumFlag.__init__p  s     	#K@@A+--AEGGQ4$
CCdCCCDKK!hhq}5555tyyADIIIr1   ry   r$   c                 z    g }| j         j        D ]+}|                    t          j        |d|                     ,|S N
enum_value)r   r   appendr   r   r.   ry   elementsr   s       r/   r   z EnumFlag._extra_xml_dom_elements  sS     Hk- * *
ooh5
|Z) ) * * * *Or1   r   )rN   r   r   r   r   r   r   r^   r	   r   r   r0   r   r   r   r   r   r   r   s   @r/   r   r   k  s         NN

%%%% #'!B BB }B SM	B
 C=B 3-B B B B B B B"!GO       r1   r   c                        e Zd ZU dZej        ed<   	 	 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.r   NFr   r   r'   
enum_classr   r   c                     t          j        ||          }t          j        |           }	 t                      j        ||	||||fi | || _        dd                    |j                  d| j        | _        d S )Nr   )	lowercaser   r   r   )	r   EnumClassParserEnumClassSerializerr   r0   r   r   member_namesr'   )r.   r   r   r'   r   r   r   r   r   r   r   s             r/   r0   zEnumClassFlag.__init__  s     	(>	 	 	A 	,>7IJJJAEGGQ4$
CCdCCCDKK!hhq~6666		BDIIIr1   ry   r$   c                     g }| j         j        j                                        D ]+}|                    t          j        |d|                     ,|S r   r   r   __members__keysr   r   r   r   s       r/   r   z%EnumClassFlag._extra_xml_dom_elements  b     Hk,8==?? * *
ooh5
|Z) ) * * * *Or1   )NF)rN   r   r   r   r   r   r   r^   r   r	   r   r
   r   r0   r   r   r   r   r   r   r   s   @r/   r   r     s         ==

**** #'"C CC Xc]C'(C SM	C
 s)C 3-C C C C C C C&!GO       r1   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                 Z     t                      j        |i | | xj        dz  c_        d S )N4;
    repeat this option to specify a list of values)r   r0   r'   )r.   r   kwargsr   s      r/   r0   zMultiFlag.__init__  s4    EGGd%f%%%IIHHIIIIr1   	argumentsc                     |                      |          }| j        r$| j        J | 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)rf   r(   r6   extendlen)r.   r   
new_valuess      r/   rg   zMultiFlag.parse  sg     Y''J| Z###
j
####djLLC
OO#LLLLr1   r$   c                      t          |t                    r|g}n-t          |t          j                  rt	          |          }n|g} fd|D             S )Nc                 `    g | ]*}t          t                                        |          +S r>   )r   r   rf   ).0itemr   r.   s     r/   
<listcomp>z$MultiFlag._parse.<locals>.<listcomp>  s1    KKKDE)T""))$//KKKr1   )rC   r^   r   r   list)r.   r   arguments_listr   s   `  r/   rf   zMultiFlag._parse  sh     )S!! 
#!{nn	Is|	,	, #Inn "{nKKKKKNKKKKr1   r6   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     r/   r   z(MultiFlag._serialize.<locals>.<listcomp>  sA        	i))*55  r1   
)r   r   r,   r   r   )r.   r6   serialized_itemsr   s   `  r/   ro   zMultiFlag._serialize  sz    ? <
.
:< < <}R      
 99%&&&r1   c                 :    d| j                                         z   S )r   zmulti rw   r5   s    r/   rx   zMultiFlag.flag_type  s    dk++----r1   ry   c                     g }t          | j        d          r8| j        j        D ]+}|                    t	          j        |d|                     ,|S )Nr   r   )hasattrr   r   r   r   r   r   s       r/   r   z!MultiFlag._extra_xml_dom_elements  sg     Ht{M** ,/ , ,*7z+ + 	, 	, 	, 	,Or1   )rN   r   r   r   r0   r   r^   r   r   rg   r   rf   r	   ro   rx   r   r   r   r   r   r   s   @r/   r   r     s,         I I I I I$U3HRL#89 $ $ $ $ LeCXb\$9: LtBx L L L L L L"'htBx0 'S ' ' ' ' ' '. . .!GO       r1   r   c                        e Zd ZU dZej        e         ed<   	 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.
  r   Fr   r   Nr   r   r   c                 
   t          j        ||          }t          j        d|           } t                      j        |||||fi | || _        || _        dd                    |j                  d|pdd| _	        d S )	Nr   ,)list_sepr   r   r   r   r&   r   )
r   r   EnumClassListSerializerr   r0   r   r   r   r   r'   )
r.   r   r   r   r   r   r   r   r   r   s
            r/   r0   zMultiEnumClassFlag.__init__  s     	(>	3 	3 	3A 	0N 2	4 	4 	4AEGGQ4+>>>>> DKDOO 
!.	!	!	!	!;#G2G#G#G	I 	IIIr1   ry   r$   c                     g }| j         j        j                                        D ]+}|                    t          j        |d|                     ,|S r   r   r   s       r/   r   z*MultiEnumClassFlag._extra_xml_dom_elements#  r   r1   c                     |>| j         st          j        d| j        z            | j                             |          }nd}|S )r   Nrr   rq   )r   r   r,   r   r]   )r.   r6   r   s      r/   r   z+MultiEnumClassFlag._serialize_value_for_xml,  sX    _ 
049<
 
 	
 22599r1   r   )rN   r   r   r   r   r   r   r   r^   r   r   r
   r   r0   r   r   r   r   r   r   r   r   s   @r/   r   r     s           
*3
//// #J JJ T8C=#x}cABJ 	J
 s)J J J J J J J0!GO   
 
 
 
 
 
 
r1   r   )"r   collectionsr   rT   enum	functoolstypingr   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   r>   r1   r/   <module>r      sB                U U U U U U U U U U U U U U U U U U U U U U       ' ' ' ' ' ' " " " " " "      WT]]ge49%%% j5 j5 j5 j5 j572; j5 j5 j5Z	M M M M M$t* M M M2    tCy   @    DI   DQ Q Q Q QT$r(^ Q Q Qh5 5 5 5 53 5 5 5 5 5r1   