+
    ~vi                       R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ^ R	IHtHtHtHtHtH t H!t! ^ R
I"H#t#H$t$H%t%H&t&H't'H(t(H)t)H*t*H+t+H,t, ^ RI-H.t. ^ RI/H0t0 ^ RI1H2t2H3t3 ^RI4H5t5 ^RI6H7t7 RPq                  4       t9RPq                  4       t:];! ]	R4      '       g	   R.]	n<        Rt=]P|                  P                  RR4      t@]@P                  4       R+9   d   RtBM']@P                  4       R,9   d   RtBM]C! R]@,          4      h]	P                  ;'       d    ]	P                  P                  R4      tF]P                  ! R]P                  R]P                  3,          R7      tJ]P                  ]P                  R3,          tM]PH                  ]N]P                  3,          tO]P                  ]PN                  ]N,          ,          tQ]PN                  ]P                  ],          ,          tSR R ltT ! R  R!]U4      tV ! R" R#]P                  4      tX ! R$ R%]4      tY]YP                  t[]YP                  t]R-R& R' llt^R( R) lt_]`R*8X  d   ]YP                  4        R# R# ).z,A base class for a configurable application.)annotationsN)OrderedDictdefaultdict)suppress)deepcopy)
dictConfig)dedent)ConfigurableSingletonConfigurable)ArgumentErrorConfigConfigFileNotFoundDeferredConfigStringJSONFileConfigLoaderKVArgParseConfigLoaderPyFileConfigLoader)
BoolDictEnumInstanceList
TraitErrorUnicodedefaultobserveobserve_compat)Bunch)nested_update)indentwrap_paragraphs)cast_unicode)import_itemz
The options below are convenience aliases to configurable class-options,
as listed in the "Equivalent to" description-line of the aliases.
To see all configurable class-options for some <cmd>, use:
    <cmd> --help-all
z
The command-line option below sets the respective configurable class-parameter:
    --Class.parameter=value
This line is evaluated in Python, so simple expressions are allowed.
For instance, to set `C.a=[0,1,2]`, you may type this:
    --C.a='range(3)'
argv zp
Subcommands are launched as `{app} cmd [args]`. For information on using
subcommand 'cmd', do: `{app} cmd -h`.
-TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERRORTFzUnsupported value for environment variable: 'TRAITLETS_APPLICATION_RAISE_CONFIG_FILE_ERROR' is set to '%s' which is none of  {'0', '1', 'false', 'true', ''}.zpythonw.exeT.)boundzlogging.LoggerAdapter[t.Any]c                    V ^8  d   QhRRRR/# )   methodr%   return )formats   ">/usr/lib/python3/dist-packages/traitlets/config/application.py__annotate__r.   j   s      q Q     c                ~   a  \         P                  ! S 4      R V 3R ll4       p\        P                  ! \        V4      # )a  Method decorator for catching invalid config (Trait/ArgumentErrors) during init.

On a TraitError (generally caused by bad config), this will print the trait's
message, and exit the app.

For use on init methods, to prevent invoking excepthook on invalid input.
c               (    V ^8  d   QhRRRRRRRR/# )r(   appApplicationargst.Anykwargsr*   r+   )r,   s   "r-   r.   (catch_config_error.<locals>.__annotate__t   s(      ; u  % r/   c                  <  S! V .VO5/ VB #   \         \        3 d_   pT P                  P                  R T4       T P                  P	                  RT P
                  4       T P                  ^4        Rp?R# Rp?ii ; i)z0Bad config encountered during initialization: %szConfig at the time: %sN)r   r   logfataldebugconfigexit)r2   r4   r6   er)   s   &*, r-   inner!catch_config_error.<locals>.inners   si    	#////M* 	GGMMLaPGGMM2CJJ?HHQKK	s    A>AA99A>)	functoolswrapstcastr%   )r)   r?   s   f r-   catch_config_errorrE   j   s3     __V  66!Ur/   c                      ] tR t^tRtR# )ApplicationErrorr+   N)__name__
__module____qualname____firstlineno____static_attributes__r+   r/   r-   rG   rG      s    r/   rG   c                  N   a  ] tR t^tRt]P                  tRtR V 3R llt	Rt
V ;t# )LevelFormatterzFormatter with additional `highlevel` record

This field is empty if log level is less than highlevel_limit,
otherwise it is formatted with self.highlevel_format.

Useful for adding 'WARNING' to warning messages,
without adding 'INFO' to info, etc.
z %(levelname)s |c                    V ^8  d   QhRRRR/# )r(   recordzlogging.LogRecordr*   strr+   )r,   s   "r-   r.   LevelFormatter.__annotate__   s     & &. &3 &r/   c                	   < VP                   V P                  8  d$   V P                  VP                  ,          Vn        MR Vn        \
        SV `  V4      # )r#   )levelnohighlevel_limithighlevel_format__dict__	highlevelsuperr,   )selfrP   	__class__s   &&r-   r,   LevelFormatter.format   sC    >>T111#44vFF!Fw~f%%r/   r+   )rH   rI   rJ   rK   __doc__loggingWARNrU   rV   r,   rL   __classcell__r[   s   @r-   rN   rN      s#     llO)& &r/   rN   c                    a  ] tR t^t$ Rt]! R4      tR]R&   ]! R4      tR]R&   ]! ]	4      t	R]R&   ]! ]
4      t
R]R&   ]! ]4      tR]R	&   ]t]t]! 4       tR]R
&   . tR]R&   RR R llt]! R4      tR]R&   ]! 4       tR]R&   ]! ]4      t]! R]P6                  RR7      P9                  RR7      t]t]! RRR7      P9                  RR7      t ]! RRR7      P9                  RR7      t!R R lt"]#! RRR R!4      R" R# l4       t$]#! R$R%R&7      R' R( l4       t%R) R* lt&]'! R$4      R+ R, l4       t(])! R-R7      P9                  RR7      t*R.R//t+R0]R1&   R2R R ]PX                  //R33R4R R5R//R63R7R R8R//R93/t-R0]R:&   ])! 4       t.R;]R<&   ]/! R=RR>7      t0]! ]! 4       4      t1]/! ]2R/ R?R7      t3]! 4       t4R@]RA&   ]! RBR7      P9                  RR7      t5]! RCR7      P9                  RR7      t6]#! R84      RD RE l4       t7]#! R54      RF RG l4       t8RH RI lt9]#! RJ4      ]:RK V 3RL ll4       4       t;]<RRM RN ll4       t=RO RP lt>RQ RR lt?RS RT lt@RU RV ltARW RX ltBRY RZ ltCR[ R\ ltDR] R^ ltER_ R` ltFRa Rb ltGRc Rd ltHRRe Rf lltIRRg Rh lltJRi Rj ltKRk Rl ltLRm Rn ltMRo Rp ltNRq Rr ltORs Rt ltP]<RRu Rv ll4       tQRw Rx ltRRy Rz ltS]TRR{ R| ll4       tU]TR} R~ l4       tV]<RR R ll4       tW]TRR R ll4       tX]YR R l4       tZ]<RR R ll4       t[]<R R l4       t\RR R llt]RR R llt^R R lt_RR R llt`R R lta]TRR R ll4       tbRtcV ;td# )r3   z8A singleton application with full configuration support.applicationzstr | Unicode[str, str | bytes]namezThis is an application.descriptionoption_descriptionkeyvalue_descriptionsubcommand_descriptionexamplesClassesTypeclassesc                    V ^8  d   QhRRRR/# r(   rk   ClassesType | Noner*   z+t.Generator[type[Configurable], None, None]r+   )r,   s   "r-   r.   Application.__annotate__   s     ! !)!	4!r/   c              #     "   Vf   V P                   p\        4       pV FX  p\        VP                  4       4       F8  p\	        V\
        4      '       g   K  WB9  g   K#  VP                  V4       Vx  K:  	  KZ  	  R# 5i)zIterate through configurable classes, including configurable parents

:param classes:
    The list of classes to iterate; if not set, uses :attr:`classes`.

Children should always be after parents, and each class should only be
yielded once.
N)rk   setreversedmro
issubclassr	   add)rZ   rk   seencparents   &&   r-   _classes_inc_parents Application._classes_inc_parents   s^      ?llGuA"1557+fl339KHHV$ L , s   AA=A=A=z0.0versionzlist[str] | List[str]r"   z#Set the log level by value or name.)default_valuehelpTr<   z%Y-%m-%d %H:%M:%Sz8The date format used by logging formatters for `asctime`)r}   z#[%(name)s]%(highlevel)s %(message)szThe Logging format templatec                   V ^8  d   QhRR/# )r(   r*   StrDictr+   )r,   s   "r-   r.   ro      s     1 1G 1r/   c                Z   R^RRRRRRR\         P                  ! V P                  4      RR	//R
RRV P                  P                   RV P                  P
                   2RV P                  RV P                  //RV P                  P
                  RRRR.//RR/p\        '       d   VR VR V# )aO  Return the base logging configuration.

The default is to log to stderr using a StreamHandler, if no default
handler already exists.

The log handler level starts at logging.WARN, but this can be adjusted
by setting the ``log_level`` attribute.

The ``logging_config`` trait is merged into this allowing for finer
control of logging.

r{   handlersconsoleclasszlogging.StreamHandler	formatterlevelstreamzext://sys.stderr
formatters.r,   datefmtloggersDEBUGdisable_existing_loggersF)
r^   getLevelName	log_level_log_formatter_clsrI   rH   
log_formatlog_datefmtr[   
IS_PYTHONWrZ   r<   s   & r-   get_default_logging_config&Application.get_default_logging_config   s     q4W11$..A0	 22==>D33<<=? doot//	 ''W* '5
: : z"y!r/   r   r   r   logging_configc                    V ^8  d   QhRRRR/# r(   changer   r*   Noner+   )r,   s   "r-   r.   ro     s     " "e " "r/   c                	    V P                   p\        V\        4      '       d/   \        P                  ! \
        \        \        V4      4      V n         V P                  4        R # N)	r   
isinstancerQ   rC   rD   intgetattrr^   _configure_logging)rZ   r   r   s   && r-   _observe_logging_change#Application._observe_logging_change  s?     NN	i%%VVC))DEDN!r/   r9   r   )typec                    V ^8  d   QhRRRR/# r   r+   )r,   s   "r-   r.   ro     s     " "u " "r/   c                	&    V P                  4        R # r   )r   rZ   r   s   &&r-   _observe_logging_default$Application._observe_logging_default  s    !r/   c                   V ^8  d   QhRR/# r(   r*   r   r+   )r,   s   "r-   r.   ro   "  s     ( (D (r/   c                	    V P                  4       p\        YP                  ;'       g    / 4       \        V4       R V n        R# )TN)r   r   r   r   _logging_configuredr   s   & r-   r   Application._configure_logging"  s6    002f1177R86#' r/   c                   V ^8  d   QhRR/# )r(   r*   	AnyLoggerr+   )r,   s   "r-   r.   ro   *  s      i r/   c                    \         P                  ! V P                  P                  4      pRVn        TpVe8   VP
                  '       d   V# VP                  '       g    V# VP                  pK;  V# )z#Start logging for this application.F)r^   	getLoggerr[   rH   	propagater   rx   )rZ   r9   _logs   &  r-   _log_defaultApplication._log_default)  s_      7 78}}}
>>>
 ;;D
r/   a!  
            Configure additional log handlers.

            The default stderr logs handler is configured by the
            log_level, log_datefmt and log_format settings.

            This configuration can be used to configure additional handlers
            (e.g. to output the log to a file) or for finer control over the
            default handlers.

            If provided this should be a logging configuration dictionary, for
            more information see:
            https://docs.python.org/3/library/logging.config.html#logging-config-dictschema

            This dictionary is merged with the base logging configuration which
            defines the following:

            * A logging formatter intended for interactive use called
              ``console``.
            * A logging handler that writes to stderr called
              ``console`` which uses the formatter ``console``.
            * A logger with the name of this application set to ``DEBUG``
              level.

            This example adds a new handler that writes to a file:

            .. code-block:: python

               c.Application.logging_config = {
                   "handlers": {
                       "file": {
                           "class": "logging.FileHandler",
                           "level": "DEBUG",
                           "filename": "<path/to/file>",
                       }
                   },
                   "loggers": {
                       "<application-name>": {
                           "level": "DEBUG",
                           # NOTE: if you don't list the default "console"
                           # handler here then it will be disabled
                           "handlers": ["console", "file"],
                       },
                   },
               }

        z	log-levelzApplication.log_levelr   aliasesr;   z5Set log-level to debug, for the most verbose logging.zshow-configshow_configz<Show the application's configuration (human-readable format)zshow-config-jsonshow_config_jsonz2Show the application's configuration (json format)flagsz#dict[str, t.Any] | Dict[str, t.Any]subcommandsz(traitlets.config.application.Application)
allow_nonezThe subset of our configuration that came from the command-line

        We re-load this configuration after loading config files,
        to ensure that it maintains highest priority.
        z	List[str]_loaded_config_fileszAInstead of starting the Application, dump configuration to stdoutzKInstead of starting the Application, dump configuration to stdout (as JSON)c                    V ^8  d   QhRRRR/# r   r+   )r,   s   "r-   r.   ro     s     & & &$ &r/   c                	(    VP                   V n        R # r   )newr   r   s   &&r-   _show_config_json_changed%Application._show_config_json_changed  s    !::r/   c                    V ^8  d   QhRRRR/# r   r+   )r,   s   "r-   r.   ro     s     0 05 0T 0r/   c                	r    VP                   '       d%   V P                  V n        V P                  V n        R # R # r   )r   start_save_startstart_show_configr   s   &&r-   _show_config_changed Application._show_config_changed  s)    :::#zzD//DJ r/   c                    V ^8  d   QhRRRR/# )r(   r6   r5   r*   r   r+   )r,   s   "r-   r.   ro     s     
7 
7 
74 
7r/   c                	   \         P                  ! V 3/ VB  V P                  pW P                  9  dY   V P                  VP                  J d   V.V P                  OV n        R# V P                  P	                  ^ V P                  4       R# R# )    N)r
   __init__r[   rk   insert)rZ   r6   clss   &, r-   r   Application.__init__  sj    &&t6v6 nnll"||s{{* #3dll3##At~~6 #r/   r<   c                    V ^8  d   QhRRRR/# r   r+   )r,   s   "r-   r.   ro     s     9 9e 9 9r/   c                	r   < \         SV `  V4       V P                  P                  R VP                  4       R# )zConfig changed: %rN)rY   _config_changedr9   r;   r   )rZ   r   r[   s   &&r-   r   Application._config_changed  s)     	'+VZZ8r/   c                    V ^8  d   QhRRRR/# r(   r"   ArgvTyper*   r   r+   )r,   s   "r-   r.   ro     s     & &x &4 &r/   c                (    V P                  V4       R# )z=Do the basic steps to configure me.

Override in subclasses.
N)parse_command_line)rZ   r"   s   &&r-   
initializeApplication.initialize  s     	%r/   c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro     s     ' 't 'r/   c                    V P                   e=   \        V P                   \        4      '       g   Q hV P                   P                  4       # R# )z1Start the app mainloop.

Override in subclasses.
N)subappr   r3   r   rZ   s   &r-   r   Application.start  s=    
 ;;"dkk;7777;;$$&& #r/   c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro     s     U U4 Ur/   c                ^   V P                   P                  4       pV P                  P                  4        FL  pVP                  V9   g   K  WP                  ,          pVP                  RR4       VP                  RR4       KN  	  V P                  '       dO   \        P                  ! V\        P                  ^R\        R7       \        P                  P                  R4       R# V P                  '       d;   \        R4       V P                   F  p\        RV,           4       K  	  \        4        \        V4       Fm  pW,          pV'       g   K  \        V4       \!        ^RR	7      p\        V4       F1  pWh,          p	\        R
V R\"        P$                  ! V	3/ VB  24       K3  	  Ko  	  R# )z,start function used when show_config is Truer   Nr   T)r   	sort_keysr   
zLoaded config files:z  )r   compactz  .z = )r<   copyr[   rs   rH   popr   jsondumpsysstdoutreprwriter   printsorteddictpprintpformat)
rZ   r<   r   
cls_configf	classnameclass_configpformat_kwargs	traitnamevalues
   &         r-   r   Application.start_show_config  s;   !!#>>%%'C||v%#LL1
}d3148	 (    IIfcjjdDQJJT"$$$()..dQh /GI!,L)&*!T&BN#L1	$/I;c&..*Q.*Q)RST 2 (r/   c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro     s     1 1$ 1r/   c                V    \        RP                  V P                  4       4      4       R# )z"Print the alias parts of the help.r   N)r   joinemit_alias_helpr   s   &r-   print_alias_helpApplication.print_alias_help  s    dii,,./0r/   c                   V ^8  d   QhRR/# r(   r*   t.Generator[str, None, None]r+   )r,   s   "r-   r.   ro     s     $ $!= $r/   c              #    "   V P                   '       g   R# / pV P                   FY  pVP                  4       RR  F?  p\        P                  ! \        P
                  \        ,          V4      WP                  &   KA  	  K[  	  V P                   P                  4        EF  w  rE \        V\        4      '       d   Vw  rVMRpVP                  R4      RR w  rxVR,           V,           pW,          pVP                  RR7      V,          p	VP                  WR7      P                  4       p
\        V\        4      '       g   V3p\        V\         R7      pRP#                  R V 4       4      pV
^ ,          P%                  R	V,           V4      V
^ &   T
 Rj  xL
  \'        R
V,          4      x  EK  	  R#  L  \(         d#   pT P*                  P-                  RYK4       h Rp?ii ; i5i)z+Yield the lines for alias part of the help.Nr   Tr~   )helptextkey, c              3  X   "   T F   p\        V4      ^8  d   RMRV,          x  K"  	  R# 5i   z--%sz-%sNlen.0ms   & r-   	<genexpr>.Application.emit_alias_help.<locals>.<genexpr>  &     !WQVASVaZ6Ua"G"GQV   (*--zEquivalent to: [--%s]z7Failed collecting help-message for alias %r, due to: %s)r   rk   rs   rC   rD   Typer	   rH   itemsr   tuplesplitclass_traitsclass_get_trait_help
splitlinesr   r  r   replacer   	Exceptionr9   error)rZ   	classdictr   rw   aliaslongnamefhelpr   r   traitfhelp_linesexs   &           r-   r   Application.emit_alias_help  s    |||35	<<CWWYs^()qvvl/CQ(G	**% $    $||113OEh..&.OHe E'/~~c':23'?$	$s?Y6*(((5i@!66u6MXXZ!%//"HEu#.		!WQV!WW "-Q!7!7x!OA&&&4x?@@+  4( ' XZ_ds=   B G##C.F3F1F3*G#1F33G >GG  G#c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro   (  s     0 0 0r/   c                V    \        RP                  V P                  4       4      4       R# )z Print the flag part of the help.r   N)r   r   emit_flag_helpr   s   &r-   print_flag_helpApplication.print_flag_help(  s    dii++-./r/   c                   V ^8  d   QhRR/# r  r+   )r,   s   "r-   r.   ro   ,  s       < r/   c              #  B  "   V P                   '       g   R# V P                   P                  4        F  w  pw  r# \        V\        4      '       g   V3p\	        V\
        R7      pRP                  R V 4       4      pVx  \        \        VP                  4       4      4      x  RP                  R VP                  4        4       4      pRV,          p\        \        V4      4      x  K  	  R#   \         d#   pT P                  P                  RY4       h Rp?ii ; i5i)	z.Yield the lines for the flag part of the help.Nr  r  c              3  X   "   T F   p\        V4      ^8  d   RMRV,          x  K"  	  R# 5ir
  r  r  s   & r-   r  -Application.emit_flag_help.<locals>.<genexpr>6  r  r   c              3  n   "   T F+  w  rVP                  4        F  w  r4R V RV RV 2x  K  	  K-  	  R# 5i)r  r   =N)r  )r  clname
props_dictpropvals   &    r-   r  r2  9  sE      $.9*%/%5%5%7	 $q.%7 /.9s   35zEquivalent to: [%s]z6Failed collecting help-message for flag %r, due to: %s)r   r  r   r  r   r  r   r   r   stripr   r9   r!  )rZ   r   cfgr%  cfg_listcfg_txtr(  s   &      r-   r,  Application.emit_flag_help,  s     zzz#'::#3#3#5E<C!%//"HEu#.		!WQV!WWVEKKM23388 $.1iik$ 
 0(:VG_-- $6  WY^cs)   7DB/C/)D/D:DDDc                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro   D  s     3 3t 3r/   c                V    \        RP                  V P                  4       4      4       R# )z#Print the options part of the help.r   N)r   r   emit_options_helpr   s   &r-   print_optionsApplication.print_optionsD  s    dii..012r/   c                   V ^8  d   QhRR/# r  r+   )r,   s   "r-   r.   ro   H  s      #? r/   c              #  F  "   V P                   '       g   V P                  '       g   R# RpVx  R\        V4      ,          x  \        V P                  4       F  pVx  Rx  K  	  V P                  4        Rj  xL
  V P                  4        Rj  xL
  Rx  R#  L" L5i)z1Yield the lines for the options part of the help.NOptionsr5  r#   )r   r   r  r   rf   r,  r   )rZ   headerps   &  r-   rA  Application.emit_options_helpH  s     zzz$,,,CK !8!89AGH : &&(((''))) 	))s)   $B!AB!:B;B!BB!B!c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro   W  s     7 74 7r/   c                V    \        RP                  V P                  4       4      4       R# )z&Print the subcommand part of the help.r   N)r   r   emit_subcommands_helpr   s   &r-   print_subcommandsApplication.print_subcommandsW  s    dii22456r/   c                   V ^8  d   QhRR/# r  r+   )r,   s   "r-   r.   ro   [  s      'C r/   c              #    "   V P                   '       g   R# RpVx  R\        V4      ,          x  \        V P                  P	                  V P
                  R7      4       F  pVx  Rx  K  	  V P                   P                  4        F:  w  pw  rEVx  V'       g   K  \        \        VP                  4       4      4      x  K<  	  Rx  R# 5i)z4Yield the lines for the subcommand part of the help.NSubcommandsr5  )r2   r#   )
r   r  r   rh   r,   rd   r  r   r   r:  )rZ   rG  rH  subc_r}   s   &     r-   rL  !Application.emit_subcommands_help[  s     CK !<!<!C!C		!C!RSAGH T  $//557OD)1JtVDJJL122  8 s   BC.Cc                    V ^8  d   QhRRRR/# r(   rk   boolr*   r  r+   )r,   s   "r-   r.   ro   l  s      $ 3O r/   c              #  2   "   V'       g   Rx  Rx  R# R# 5i)zjYield the very bottom lines of the help message.

If classes=False (the default), print `--help-all` msg.
z5To see all available configurables, use `--help-all`.r#   Nr+   rZ   rk   s   &&r-   emit_help_epilogueApplication.emit_help_epiloguel  s     
 IIH s   c                    V ^8  d   QhRRRR/# )r(   rk   rW  r*   r   r+   )r,   s   "r-   r.   ro   u  s     : :$ :4 :r/   c                Z    \        RP                  V P                  VR7      4      4       R# )zPrint the help for each Configurable class in self.classes.

If classes=False (the default), only flags and aliases are printed.
r   rk   N)r   r   	emit_helprY  s   &&r-   
print_helpApplication.print_helpu  s     
 	diiw789r/   c                    V ^8  d   QhRRRR/# rV  r+   )r,   s   "r-   r.   ro   |  s     4 4 42N 4r/   c              #    "   V P                  4        Rj  xL
  V P                  4        Rj  xL
  V P                  4        Rj  xL
  V'       d`   V P                  4       pVe-   Rx  Rx  \	        V P
                  4       F  pVx  Rx  K  	  V F  pVP                  4       x  Rx  K  	  V P                  4        Rj  xL
  V P                  V4       Rj  xL
  R#  L L L L% L5i)zYield the help-lines for each Configurable class in self.classes.

If classes=False (the default), only flags and aliases are printed.
NzClass optionsz=============r#   )	emit_descriptionrL  rA  _classes_with_config_traitsr   rg   class_get_helpemit_examplesrZ  )rZ   rk   help_classesrH  r   s   &&   r-   r_  Application.emit_help|  s     
 ((***--///))+++;;=L'%%%%()B)BCAGH D $((** $ %%'''**7333% 	+/+ 	(3s\   C/C%C/C'C/C)C/A2C/C+C/C-C/'C/)C/+C/-C/c                   V ^8  d   QhRR/# )r(   r*   rQ   r+   )r,   s   "r-   r.   ro     s     X X Xr/   c                N    RP                  R V P                  4        4       4      # )zgGenerate rST format documentation for the config options this application

Returns a multiline string.
r   c              3  @   "   T F  qP                  4       x  K  	  R # 5ir   )class_config_rst_doc)r  rw   s   & r-   r  6Application.document_config_options.<locals>.<genexpr>  s     W;Va//11;Vs   )r   ry   r   s   &r-   document_config_options#Application.document_config_options  s"    
 yyW4;T;T;VWWWr/   c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro     s     2 24 2r/   c                V    \        RP                  V P                  4       4      4       R# )z"Print the application description.r   N)r   r   rd  r   s   &r-   print_descriptionApplication.print_description  s    dii--/01r/   c                   V ^8  d   QhRR/# r  r+   )r,   s   "r-   r.   ro     s      "> r/   c              #     "   \        V P                  ;'       g    V P                  ;'       g    R4       F  pVx  Rx  K  	  R# 5i)z-Yield lines with the application description.r#   N)r   re   r]   )rZ   rH  s   & r-   rd  Application.emit_description  s9      !1!1!G!GT\\!G!GRHAGH Is
   ,AAc                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro     s     / / /r/   c                V    \        RP                  V P                  4       4      4       R# )z1Print usage and examples (see `emit_examples()`).r   N)r   r   rg  r   s   &r-   print_examplesApplication.print_examples  s    dii**,-.r/   c                   V ^8  d   QhRR/# r  r+   )r,   s   "r-   r.   ro     s      ; r/   c              #     "   V P                   '       dA   Rx  Rx  Rx  \        \        V P                   P                  4       4      4      x  Rx  R# R# 5i)zYield lines with the usage and examples.

This usage string goes at the end of the command line help string
and should contain examples of the application's usage.
Examplesz--------r#   N)ri   r   r   r:  r   s   &r-   rg  Application.emit_examples  sH      ===H 3 3 5677H s   AAc                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro     s      t r/   c                0    \        V P                  4       R# )zPrint the version string.N)r   r{   r   s   &r-   print_versionApplication.print_version  s    dllr/   c               $    V ^8  d   QhRRRRRR/# )r(   rR  rQ   r"   r   r*   r   r+   )r,   s   "r-   r.   ro     s!     % %# %X % %r/   c                   V P                   P                  V4      pVf   Q hVw  rE\        V\        4      '       d   \	        V4      p\        V\
        4      '       dI   \        V\        4      '       d3   V P                  P                  4        VP                  V R7      V n        M1\        V4      '       d   V! V 4      V n        M\        RV,          4      hV P                  P                  V4       R# )z"Initialize a subcommand with argv.N)rx   z%Invalid mappings for subcommand '%s'!)r   getr   rQ   r!   r   rt   r3   r[   clear_instanceinstancer   callableAssertionErrorr   )rZ   rR  r"   r9  r   rS  s   &&&   r-   initialize_subcommand!Application.initialize_subcommand  s     ""4(	fc"" (F fd##
6;(G(GNN))+ ///6DKf ,DK !H4!OPP 	t$r/   c                   V ^8  d   QhRR/# )r(   r*   z)tuple[dict[str, t.Any], dict[str, t.Any]]r+   )r,   s   "r-   r.   ro     s     9 9H 9r/   c                   \        \        4      pV P                   FJ  pVP                  pVP	                  4       ^R  F$  pWP                  ,          P                  V4       K&  	  KL  	  / pV P                  P                  4        F  w  rg\        V\        4      '       d   Vw  rxVP                  R^4      w  r)W,          p
\        V
4      ^8X  d
   V
^ ,          p\        V\        4      '       g   V3pV F  pRP                  W).4      W[&   K  	  K  	  / pV P                  P                  4        F  w  pw  r/ pVP                  4        FM  w  ppW,          p
\        V
4      ^8X  d
   V
^ ,          pVV9   d   VV,          P                  V4       KH  VVV&   KO  	  \        V\        4      '       g   V3pV F
  pVV3VV&   K  	  K  	  W3# )a  Flatten flags and aliases for loaders, so cl-args override as expected.

This prevents issues such as an alias pointing to InteractiveShell,
but a config file setting the same trait in TerminalInteraciveShell
getting inappropriate priority over the command-line arg.
Also, loaders expect ``(key: longname)`` and not ``key: (longname, help)`` items.

Only aliases with exactly one descendent in the class list
will be promoted.

r   r  )r   listrk   rH   rs   appendr   r  r   r  r  r  r   r   update)rZ   mro_treer   clsnamerx   r   r#  r$  rS  r&  childrenalr   r  flagdictr}   newflagsubdictks   &                  r-   flatten_flagsApplication.flatten_flags  s    t$<<CllG'')Ab/)009 *   #%#||113OE(E**&!Q/JC}H8}!qkgu--!hh|4   4 %)ZZ%5%5%7!C!(*,G ( 0W#=x=A%"1+C'>CL''0#*GCL !1 c5))f#T?a  &8" ~r/   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r(   r"   zlist[str] | Noner   r   r   rk   rn   r*   r   r+   )r,   s   "r-   r.   ro     s<     	
 	
	
 	
 		

 $	
 
 	
r/   c           	     	H    \        WW4V P                  V P                  R 7      # ))rk   r9   r   )r   r9   r   )rZ   r"   r   r   rk   s   &&&&&r-   _create_loaderApplication._create_loader  s$     &5txxTM]M]
 	
r/   c                    V ^8  d   QhRRRR/# )r(   check_argcompleterW  r*   	list[str]r+   )r,   s   "r-   r.   ro     s      d y r/   c                    V'       d,   R\         P                  9   d    ^ RIHp V! 4       pVf   Q hV# \        P                  #   \        \
        3 d     \        P                  # i ; i)a7  Get `sys.argv` or equivalent from `argcomplete`

`argcomplete`'s strategy is to call the python script with no arguments,
so ``len(sys.argv) == 1``, and run until the `ArgumentParser` is constructed
and determine what completions are available.

On the other hand, `traitlet`'s subcommand-handling strategy is to check
``sys.argv[1]`` and see if it matches a subcommand, and if so then dynamically
load the subcommand app and initialize it with ``sys.argv[1:]``.

This helper method helps to take the current tokens for `argcomplete` and pass
them through as `argv`.
_ARGCOMPLETE)get_argcomplete_cwords)osenviron#traitlets.config.argcomplete_configr  ImportErrorModuleNotFoundErrorr   r"   )r   r  r  cwordss   &&  r-   _get_sys_argvApplication._get_sys_argv  sa     2::!=V/1))) xx  !45 xxs   A A'&A'c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro   5  s      4 r/   c                    R\         P                  9  d   R#  ^ RIHp V! 4        R#   \        \
        3 d     R# i ; i)a  Helper for `argcomplete` to recognize `traitlets` subcommands

`argcomplete` does not know that `traitlets` has already consumed subcommands,
as it only "sees" the final `argparse.ArgumentParser` that is constructed.
(Indeed `KVArgParseConfigLoader` does not get passed subcommands at all currently.)
We explicitly manipulate the environment variables used internally by `argcomplete`
to get it to skip over the subcommand tokens.
r  N)increment_argcomplete_index)r  r  r  r  r  r  )r   r  s   & r-   "_handle_argcomplete_for_subcommand.Application._handle_argcomplete_for_subcommand4  s9     +	W')01 		s   ( ==c                    V ^8  d   QhRRRR/# r   r+   )r,   s   "r-   r.   ro   I  s     0, 0,x 0,4 0,r/   c                  a	 \        V\        4      '       d   Q hVf-   V P                  \        V P                  4      R7      R,          pV Uu. uF  p\        V4      NK  	  upV n        V'       d    V^ ,          R8X  d   VR,          R.,           pV P                  '       dp   \        V4      ^ 8  d`   V^ ,          VR,          rC\        P                  ! RV4      '       d2   W0P                  9   d"   V P                  4        V P                  W44      #  VRVP                  R4       o	\        ;QJ d    V	3R lR 4       F  '       g   K   R
M	  RM! V	3R lR 4       4      '       d&   V P                  R	S	9   4       V P!                  ^ 4       RS	9   g   RS	9   d"   V P#                  4        V P!                  ^ 4       V P%                  4       w  rV\'        V P)                  4       4      pV P+                  WWWR7      p \-        VP/                  4       4      V n        T P5                  T P0                  4       TP6                  T n        R# u upi   \         d    To	 EL4i ; i  \2         d    h i ; i)z!Parse the command line arguments.N)r  :r  NNr}   -hz^\w(\-?\w)*$r  c              3  ,   <"   T F	  qS9   x  K  	  R # 5ir   r+   )r  xinterpreted_argvs   & r-   r  1Application.parse_command_line.<locals>.<genexpr>e  s     M.L$$.Ls   
--help-allTFz	--versionz-Vr^  )r  r  z--help)r   rQ   r  rW  r   r    r"   r  rematchr  r  index
ValueErroranyr`  r=   r  r  r  re  r  r   load_config
cli_config
SystemExitupdate_config
extra_args)
rZ   r"   argrR  subargvr   r   rk   loaderr  s
   &&       @r-   r   Application.parse_command_lineH  s    dC((((<%%T=M=M8N%OPRSD267$3\#&$7	DGv%8tf$DD	A GT"X'xx..4;K;K3K77911$@@	$#$6djj&67 3M.LM333M.LMMMOOL,<<=IIaL**d6F.F IIaL ++-t779:$$TE$K	&v'9'9';<DO
 	4??+ ++W 8(  	$#	$"  	 	s$   II :I III,c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r(   basefilenamerQ   path#str | t.Sequence[str | None] | Noner9   zAnyLogger | Noneraise_config_file_errorsrW  r*   zt.Generator[t.Any, None, None]r+   )r,   s   "r-   r.   ro   |  s<     5; 5;5; 25; 	5;
 #'5; 
(5;r/   c              #    "   \        V\        4      '       g   Vf   V.p\        V4       EFt  pV P                  VR,           WSR7      pV'       d0   TP	                  RY;'       g    \
        P                  ! 4       4       V P                  VR,           WSR7      p. p. p	Wg3 F  p
Rp V
P                  4       pV'       d   VP	                  RV
P                  4       T'       g   KD  \        Y4       Fl  w  rTP                  T4      pT'       g   K   T'       g   K*  TP                  R
P!                  TT
P                  \"        P$                  ! T^R7      4      4       Kn  	  YP                  3x  TP'                  T4       T	P'                  T
P                  4       K  	  EKw  	  R#   \         d     L\         d@    T
P                  ;'       g    TpT'       d   h T'       d   TP                  RTRR	7        EL i ; i5i)zULoad config files (py,json) by filename and path.

yield each config object in turn.
Nz.py)r  r9   zLooking for %s in %sz.jsonzLoaded config file: %sz&Exception while loading config file %sT)exc_infozMCollisions detected in {0} and {1} config files. {1} has higher priority: {2})r   )r   rQ   rr   python_config_loader_classr;   r  getcwdjson_config_loader_classr  full_filenamer   r   r!  zip
collisionswarningr,   r   dumpsr  )r   r  r  r9   r  currentpyloader
jsonloaderloaded	filenamesr  r<   filenameearlier_configr  s   &&&&&          r-   _load_config_filesApplication._load_config_files{  s     dC  DL6D~G55lU6JQX5bH		0,@V@V299;W55lW6LSZ5dJ"$F#%I#0R#//1F 		":F<P<PQ647	4J0%3%>%>v%F
%:##KK!@@F$,$*$8$8$(JJz!$DA" 5K "#7#788MM&)$$V%9%9:A 1 & *   e  &33CC|H/		"JH_c	desh   A#G?&A G?'F&7)G?%&G?G?BG?&G<1G?3G<<G<
G<G<$G<8G?;G<<G?c                   V ^8  d   QhRR/# )r(   r*   r  r+   )r,   s   "r-   r.   ro     s     , ,Y ,r/   c                (    V P                   R,          # )z$Currently loaded configuration files:NNN)r   r   s   &r-   loaded_config_filesApplication.loaded_config_files  s     ((++r/   c               $    V ^8  d   QhRRRRRR/# )r(   r  rQ   r  r  r*   r   r+   )r,   s   "r-   r.   ro     s$     ' ''#F'	'r/   c                   \         P                  P                  V4      w  r\        4       pV P	                  VVV P
                  V P                  R7       FC  w  rVVP                  V4       W`P                  9  g   K(  V P                  P                  V4       KE  	  VP                  V P                  4       V P                  V4       R# )z'Load config files by filename and path.)r  r9   r  N)r  r  splitextr   r  r9   r  merger   r  r  r  )rZ   r  r  ext
new_configr<   fnames   &&&    r-   load_config_fileApplication.load_config_file  s    
 ((2X
!44%)%B%B	 5 
MF V$666))007
 	):&r/   c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro     s     ' 'T 'r/   c                .   V P                   P                  4       P                  RR4      p\        4       pV P                  P                  RV4       \        P                  P                  4        Fv  w  r4VP                  V4      '       g   K  V P                  P                  RW44       VP                  R4      EvrVpTpV F  p	W,          pK  	  \        W\        V4      4       Kx  	  VP                  V P                  4       V P                  V4       R# )z!Load config files by environment.-rS  z1Looping through config variables with prefix "%s"zSeeing environ "%s"="%s"__N)rd   upperr  r   r9   r;   r  r  r  
startswithr  setattrr   r  r  r  )
rZ   PREFIXr  r  vrS  r  r  sectionrH  s
   &         r-   load_config_environApplication.load_config_environ  s     "**34X
JFSJJ$$&DA||F##91@ !"#$A%jG &:1&=> ' 	):&r/   c                    V ^8  d   QhRRRR/# rm   r+   )r,   s   "r-   r.   ro     s     ( ()(	4(r/   c              #  P  aa"   Vf   V P                   p\        R V P                  V4       4       4      oR V3R llo SP                  4       p\        V3R lSP	                  4        4       4      oSV8X  g   K=   SP	                  4        F  w  r4T'       g   K  Tx  K  	  R# 5i)a  
Yields only classes with configurable traits, and their subclasses.

:param classes:
    The list of classes to iterate; if not set, uses :attr:`classes`.

Thus, produced sample config-file will contain all classes
on which a trait-value may be overridden:

- either on the class owning the trait,
- or on its subclasses, even if those subclasses do not define
  any traits themselves.
Nc              3  \   "   T F"  pV\        VP                  R R7      4      3x  K$  	  R# 5i)Tr~   N)rW  class_own_traits)r  r   s   & r-   r  :Application._classes_with_config_traits.<locals>.<genexpr>  s/      $
9 $s++4+89:9s   *,c                    V ^8  d   QhRRRR/# )r(   r   r5   r*   rW  r+   )r,   s   "r-   r.   =Application._classes_with_config_traits.<locals>.__annotate__  s     	W 	W 	W$ 	Wr/   c                   < \         ;QJ d)    V3R  lV P                   4       F  '       g   K   R# 	  R# ! V3R  lV P                   4       4      # )c              3  N   <"   T F  qS9   ;'       d
    SV,          x  K  	  R # 5ir   r+   )r  bcls_to_configs   & r-   r  ZApplication._classes_with_config_traits.<locals>.is_any_parent_included.<locals>.<genexpr>  s$     V1M)>>mA.>>   %%TF)r  	__bases__)r   r  s   &r-   is_any_parent_includedGApplication._classes_with_config_traits.<locals>.is_any_parent_included  s4    3VV33V3V3VVVVr/   c              3  N   <"   T F  w  rY;'       g	    S! V4      3x  K  	  R # 5ir   r+   )r  r   inc_yesr  s   &  r-   r  r    s+      ($9LC <<!7!<=$9r  )rk   r   ry   r   r  )rZ   rk   to_incl_origclr  r  r  s   &&   @@r-   re  'Application._classes_with_config_traits  s       ?llG# $
009$
 

	W 	W (--/L' ($1$7$7$9( M ,(..0KBw 1s   A3B&<B&
B&c                    V ^8  d   QhRRRR/# )r(   rk   rn   r*   rQ   r+   )r,   s   "r-   r.   ro     s     
  
 ,> 
 # 
 r/   c                \   RV P                   ,          .pVP                  R4       VP                  R4       VP                  R4       Vf   V P                  MTp\        V P	                  V4      4      pV F#  pVP                  VP                  V4      4       K%  	  RP                  V4      # )z/generate default config file from Configurablesz# Configuration file for %s.r#   r   zc = get_config()  #noqa)rd   r  rk   r  re  class_config_sectionr   )rZ   rk   linesconfig_classesr   s   &&   r-   generate_config_file Application.generate_config_file  s    /$));<R34R")/$,,wd>>wGH!CLL11.AB "yyr/   c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro     s     - - -r/   c                	    \        V R R4      '       dW   V P                  P                   F3  p\        \        4      ;_uu_ 4        VP                  4        RRR4       K5  	  RV n        R# R#   + '       g   i     KS  ; i)r   FN)r   r9   r   r   r   closer   )rZ   handlers   & r-   close_handlersApplication.close_handlers  s_    4.66  88,,i((MMO )( - (-D$ 7
 )((s   A,,A=c                    V ^8  d   QhRRRR/# )r(   exit_statuszint | str | Noner*   r   r+   )r,   s   "r-   r.   ro   $  s       0  r/   c                	    V P                   P                  R V P                  4       V P                  4        \        P
                  ! V4       R# )zExiting application: %sN)r9   r;   rd   r  r   r=   )rZ   r  s   &&r-   r=   Application.exit$  s1    0$))<r/   c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   ro   )  s       r/   c                	&    V P                  4        R # r   )r  r   s   &r-   __del__Application.__del__)  s    r/   c               $    V ^8  d   QhRRRRRR/# )r(   r"   r   r6   r5   r*   r   r+   )r,   s   "r-   r.   ro   -  s!      8 e  r/   c                l    V P                   ! R/ VB pVP                  V4       VP                  4        R# )ztLaunch a global instance of this Application

If a global instance already exists, this reinitializes and starts it
Nr+   )r  r   r   )r   r"   r6   r2   s   &&, r-   launch_instanceApplication.launch_instance,  s*     ll$V$t		r/   )
r   r   r"   rk   r  r  r   r   r   r   r   )r   
         (   2   r   INFOr_   ERRORCRITICALr+   )F)NF)r   )erH   rI   rJ   rK   r]   r   rd   __annotations__re   rf   rg   rh   r   r  r   r  ri   rk   ry   r{   r   r"   r   r$   r  r   r^   r_   tagr   rN   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r  r   r   r   r   r   r   r   r   rE   r   r   r   r   r   r-  r,  rB  rA  rM  rL  rZ  r`  r_  ro  rs  rd  rz  rg  r  r  r  r  classmethodr  r  r   r  propertyr  r  r  re  r  r  r=   r"  r&  rL   r`   ra   s   @r-   r3   r3      su   B -4M,BD
)B 4;;T3UK0U:ABT:U7U<CDX<Y9Y>EF\>];]!33 18	H-9 G[!. 07u~G,= #'&D
(  $$QR Mll2 
cc	  (G 
cc 
 -* 
cc 
1f ]L+7GH" I" U#" $"( U^  .0` 
cca n $%<=GW= 	 
 D
 	!4 
 K
 	& 
 A
#E7 @ 8<vK4=@TRF giJ

		J '+f),P	cc  Z	cc   & !& ]0 0

7 X9  9 & &'UB1$L0037":42X2/ % %09v	
  2  & 0, 0,d 5; 5;n , , ' '* ' '*(T
 -
  r/   r3   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )r(   rd   rQ   configurableset_help
unset_helpr*   r   r+   )r,   s   "r-   r.   r.   ?  s7     L Ls L# L Ls L\c Lr/   c                    T;'       g
    RV,          pT;'       g
    RV,          pVP                  R4      w  rEWER//pWER//pWV3RV ,           Ws3/# )a  Helper for building basic --trait, --no-trait flags.

Parameters
----------
name : str
    The name of the flag.
configurable : str
    The 'Class.trait' string of the trait to be set/unset with the flag
set_help : unicode
    help string for --name flag
unset_help : unicode
    help string for --no-name flag

Returns
-------
cfg : dict
    A dict with two keys: 'name', and 'no-name', for setting and unsetting
    the trait, respectively.
zset %s=Truezset %s=Falser   TFzno-)r  )rd   r5  r6  r7  r   r&  setterunsetters   &&&&    r-   boolean_flagr;  ?  sk    * 77=<7H<<~<J##C(JC4=!FU^$H8$edlX4JKKr/   c                   V ^8  d   QhRR/# )r(   r*   r   r+   )r,   s   "r-   r.   r.   ^  s      F r/   c                     \         P                  4       '       d   \         P                  4       P                  # \	        4       # )ztGet the config object for the global Application instance, if there is one

otherwise return an empty config object
)r3   initializedr  r<   r   r+   r/   r-   
get_configr?  ^  s/    
   ##%,,,xr/   __main__>   1true>   r#   0false)r#   r#   )br]   
__future__r   rA   r   r^   r  r   r  r   typingrC   collectionsr   r   
contextlibr   r   r   logging.configr   textwrapr   traitlets.config.configurabler	   r
   traitlets.config.loaderr   r   r   r   r   r   r   traitlets.traitletsr   r   r   r   r   r   r   r   r   r   traitlets.utils.bunchr   traitlets.utils.nested_updater   traitlets.utils.textr   r   utilsr    utils.importstringr!   r:  rf   rg   hasattrr"   rh   r  r  _envvarlowerr$   r  
executableendswithr   TypeVarCallableAnyr%   UnionLoggerr   rQ   r   Optionalr   r  rj   rE   r   rG   	FormatterrN   r3   r   default_aliasesr   default_flagsr;  r?  rH   r&  r+   r/   r-   <module>ra     s   2 #    	  	 
  0   %  M     ( 7 8   ,
 
EG  
EG  sFtCH  **..H"
M
==?m#481]]_**491
 	h
	  ^^FF 7 7 F
IIcCJ/0GGGNN$BBC	
&&aee
::affSk"ffQVVL)**	y 	&W&& &*\' \F %%!!L> z! r/   