+
    &j?                     F    ^ RI t ^ RIHt  ! R R]4      t ! R R]4      tR# )    N)Actionc                   P   a a ] tR t^t oRtRV3R lV 3R llltRR ltRtVtV ;t	# )envaL  
Get argument values from ``PET_{dest}`` before defaulting to the given ``default`` value.

For flags (e.g. ``--standalone``)
use ``check_env`` instead.

.. note:: when multiple option strings are specified, ``dest`` is
          the longest option string (e.g. for ``"-f", "--foo"``
          the env var to set is ``PET_FOO`` not ``PET_F``)

Example:
::

 parser.add_argument("-f", "--foo", action=env, default="bar")

 ./program                                      -> args.foo="bar"
 ./program -f baz                               -> args.foo="baz"
 ./program --foo baz                            -> args.foo="baz"
 PET_FOO="env_bar" ./program -f baz    -> args.foo="baz"
 PET_FOO="env_bar" ./program --foo baz -> args.foo="baz"
 PET_FOO="env_bar" ./program           -> args.foo="env_bar"

 parser.add_argument("-f", "--foo", action=env, required=True)

 ./program                                      -> fails
 ./program -f baz                               -> args.foo="baz"
 PET_FOO="env_bar" ./program           -> args.foo="env_bar"
 PET_FOO="env_bar" ./program -f baz    -> args.foo="baz"
c                   < V ^8  d   QhRR/#    returnN )format__classdict__s   "w/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/distributed/argparse_util.py__annotate__env.__annotate__,   s     R R R    c           	        < R VP                  4        2p\        P                  P                  WR4      pV'       d   Rp\        SV `  ! RRVRVRV/VB  R# )PET_FdestdefaultrequiredNr
   )upperosenvirongetsuper__init__)selfr   r   r   kwargsenv_name	__class__s   &&&&, r   r   env.__init__,   sP    $**,(**..3 HQdQGQhQ&Qr   c                2    \        W P                  V4       R # N)setattrr   r   parser	namespacevaluesoption_strings   &&&&&r   __call__env.__call__9   s    	99f-r   r
   )NFr"   
__name__
__module____qualname____firstlineno____doc__r   r)   __static_attributes____classdictcell____classcell__r   r   s   @@r   r   r      s      <R R. .r   r   c                   P   a a ] tR t^=t oRtRV3R lV 3R llltRR ltRtVtV ;t	# )	check_enva  
Check whether the env var ``PET_{dest}`` exists before defaulting to the given ``default`` value.

Equivalent to
``store_true`` argparse built-in action except that the argument can
be omitted from the commandline if the env var is present and has a
non-zero value.

.. note:: it is redundant to pass ``default=True`` for arguments
          that use this action because a flag should be ``True``
          when present and ``False`` otherwise.

Example:
::

 parser.add_argument("--verbose", action=check_env)

 ./program                                  -> args.verbose=False
 ./program --verbose                        -> args.verbose=True
 PET_VERBOSE=1 ./program           -> args.verbose=True
 PET_VERBOSE=0 ./program           -> args.verbose=False
 PET_VERBOSE=0 ./program --verbose -> args.verbose=True

Anti-pattern (don't do this):

::

 parser.add_argument("--verbose", action=check_env, default=True)

 ./program                                  -> args.verbose=True
 ./program --verbose                        -> args.verbose=True
 PET_VERBOSE=1 ./program           -> args.verbose=True
 PET_VERBOSE=0 ./program           -> args.verbose=False

c                   < V ^8  d   QhRR/# r   r
   )r   r   s   "r   r   check_env.__annotate__b   s     T T Tr   c                   < R VP                  4        2p\        \        \        P                  P                  YB'       d   RMR4      4      4      p\        SV `  ! R	RVRRRVR^ /VB  R# )
r   10r   constTr   nargsNr
   )r   boolintr   r   r   r   r   )r   r   r   r   r   r   s   &&&, r   r   check_env.__init__b   s[    $**,(s2::>>(7CLMNSdS$SSqSFSr   c                F    \        W P                  V P                  4       R # r"   )r#   r   r<   r$   s   &&&&&r   r)   check_env.__call__g   s    	99djj1r   r
   )Fr"   r+   r4   s   @@r   r6   r6   =   s!     "HT T
2 2r   r6   )r   argparser   r   r6   r
   r   r   <module>rD      s&    
 -.& -.`+2 +2r   