
    Eh                       S SK Jr  S SKJr  S SKJr  S SKJr  S SKrS SKrS SK	J
r
  S SKrS SKrS SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ r    " S S5      r!\\"\"4   r# " S S\SS9r$ " S S\5      r% " S  S!5      r&  S$       S%S" jjr'\(S#:X  a  \'" 5         gg)&    )annotations)ArgumentParser)	Namespace)ConfigParserN)Path)Any)cast)Dict)Mapping)Optional)overload)Protocol)Sequence)TextIO)Union)	TypedDict   )__version__)command)util)compat)_preserving_path_as_strc                  \   \ rS rSr% SrSSSS\R                  S\R                  " 5       S4                 S+S jjr	Sr
S\S'    SrS	\S
'    SrS	\S'    \S,S j5       r\S,S j5       rSrS\S'    \R$                  S-S j5       rS.S jr\R$                  S/S j5       r\R$                  S0S j5       rS1S jrS2S jr\ S3     S4S jj5       r\      S5S j5       r\      S6S j5       r S7     S8S jjrS9S jrS:S jrS;S jr S7       S<S jjr\S=S j5       r\ S7     S>S jj5       r S7     S>S jjr\S=S  j5       r \ S7     S>S! jj5       r  S7     S?S" jjr S@S# jr! S7     SAS$ jjr"\R$                  SBS% j5       r#SCS& jr$SDS' jr%SDS( jr&SES) jr'S*r(g)FConfig   a?  Represent an Alembic configuration.

Within an ``env.py`` script, this is available
via the :attr:`.EnvironmentContext.config` attribute,
which in turn is available at ``alembic.context``::

    from alembic import context

    some_param = context.config.get_main_option("my option")

When invoking Alembic programmatically, a new
:class:`.Config` can be created by passing
the name of an .ini file to the constructor::

    from alembic.config import Config
    alembic_cfg = Config("/path/to/yourapp/alembic.ini")

With a :class:`.Config` object, you can then
run Alembic commands programmatically using the directives
in :mod:`alembic.command`.

The :class:`.Config` object can also be constructed without
a filename.   Values can be set programmatically, and
new sections will be created as needed::

    from alembic.config import Config
    alembic_cfg = Config()
    alembic_cfg.set_main_option("script_location", "myapp:migrations")
    alembic_cfg.set_main_option("sqlalchemy.url", "postgresql://foo/bar")
    alembic_cfg.set_section_option("mysection", "foo", "bar")

.. warning::

   When using programmatic configuration, make sure the
   ``env.py`` file in use is compatible with the target configuration;
   including that the call to Python ``logging.fileConfig()`` is
   omitted if the programmatic configuration doesn't actually include
   logging directives.

For passing non-string values to environments, such as connections and
engines, use the :attr:`.Config.attributes` dictionary::

    with engine.begin() as connection:
        alembic_cfg.attributes['connection'] = connection
        command.upgrade(alembic_cfg, "head")

:param file\_: name of the .ini file to open if an ``alembic.ini`` is
 to be used.    This should refer to the ``alembic.ini`` file, either as
 a filename or a full path to the file.  This filename if passed must refer
 to an **ini file in ConfigParser format** only.

:param toml\_file: name of the pyproject.toml file to open if a
 ``pyproject.toml`` file is to be used.  This should refer to the
 ``pyproject.toml`` file, either as a filename or a full path to the file.
 This file must be in toml format. Both :paramref:`.Config.file\_` and
 :paramref:`.Config.toml\_file` may be passed simultaneously, or
 exclusively.

 .. versionadded:: 1.16.0

:param ini_section: name of the main Alembic section within the
 .ini file
:param output_buffer: optional file-like input buffer which
 will be passed to the :class:`.MigrationContext` - used to redirect
 the output of "offline generation" when using Alembic programmatically.
:param stdout: buffer where the "print" output of commands will be sent.
 Defaults to ``sys.stdout``.

:param config_args: A dictionary of keys and values that will be used
 for substitution in the alembic config file, as well as the pyproject.toml
 file, depending on which / both are used.  The dictionary as given is
 **copied** to two new, independent dictionaries, stored locally under the
 attributes ``.config_args`` and ``.toml_args``.   Both of these
 dictionaries will also be populated with the replacement variable
 ``%(here)s``, which refers to the location of the .ini and/or .toml file
 as appropriate.

:param attributes: optional dictionary of arbitrary Python keys/values,
 which will be populated into the :attr:`.Config.attributes` dictionary.

 .. seealso::

    :ref:`connection_sharing`

Nalembicstrcmd_optsOptional[Namespace]c	                   U(       a  [        U5      OSU l        U(       a  [        U5      OSU l        X0l        X@l        XPl        X`l        [        U5      U l        [        U5      U l	        U(       a  U R                  R                  U5        gg)z Construct a new :class:`.Config`N)r   config_file_nametoml_file_nameconfig_ini_sectionoutput_bufferstdoutr   dictconfig_args	toml_args
attributesupdate)	selffile_	toml_fileini_sectionr$   r%   r   r'   r)   s	            Q/home/kali/devsecops-assessor/venv/lib/python3.13/site-packages/alembic/config.py__init__Config.__init__v   s{     /4#E* 	 3<#I. 	 #.* ,k*OO"":.     Optional[str]r!   r"   c                H    U R                   c  g [        U R                   5      $ N)r!   r   r+   s    r/   _config_file_pathConfig._config_file_path   s"      (D))**r2   c                H    U R                   c  g [        U R                   5      $ r5   )r"   r   r6   s    r/   _toml_file_pathConfig._toml_file_path   s"    &D''((r2   r#   c                    0 $ )a  A Python dictionary for storage of additional state.


This is a utility dictionary which can include not just strings but
engines, connections, schema objects, or anything else.
Use this to pass objects into an env.py script, such as passing
a :class:`sqlalchemy.engine.base.Connection` when calling
commands from :mod:`alembic.command` programmatically.

.. seealso::

    :ref:`connection_sharing`

    :paramref:`.Config.attributes`

 r6   s    r/   r)   Config.attributes   s	    $ 	r2   c                    U(       a  [        U5      U-  nO[        U5      n[        R                  " U R                  US40 U R                  D6  g)ad  Render a message to standard out.

When :meth:`.Config.print_stdout` is called with additional args
those arguments will formatted against the provided text,
otherwise we simply output the provided text verbatim.

This is a no-op when the``quiet`` messaging option is enabled.

e.g.::

    >>> config.print_stdout('Some text %s', 'arg')
    Some Text arg


N)r   r   write_outstreamr%   messaging_opts)r+   textargoutputs       r/   print_stdoutConfig.print_stdout   s>      Y_FYFT[[&$N$:M:MNr2   c                   U R                   (       a%  U R                   R                  5       R                  nO
[        5       nUR	                  5       U R
                  S'   [        U R
                  5      nU R                   (       a#  [        R                  " X R                   /5        U$ UR                  U R                  5        U$ )zReturn the underlying ``ConfigParser`` object.

Dir*-ect access to the .ini file is available here,
though the :meth:`.Config.get_section` and
:meth:`.Config.get_main_option`
methods provide a possibly simpler interface.

here)r7   absoluteparentr   as_posixr'   r   r   read_config_parseradd_sectionr#   )r+   rI   file_configs      r/   rO   Config.file_config   s     !!))224;;D6D#'==? "4#3#34!!%%k4J4J3KL  ##D$;$;<r2   c                &   U R                   (       a  U R                   R                  5       (       a  U R                   R                  5       R                  nUR	                  5       U R
                  S'   [        U R                   S5       n[        R                  R                  U5      nUR                  S0 5      R                  S0 5      n[        U[        5      (       d  [        R                  " S5      eUsSSS5        $ 0 $ ! , (       d  f       g= f)zEReturn a dictionary of the [tool.alembic] section from
pyproject.tomlrI   rbtoolr   zIncorrect TOML formatN)r:   existsrJ   rK   rL   r(   openr   tomllibloadget
isinstancer&   r   CommandError)r+   rI   f	toml_datadatas        r/   toml_alembic_configConfig.toml_alembic_config   s    
 D$8$8$?$?$A$A''00299D%)]]_DNN6"d**D1Q"NN//2	 }}VR044YC!$--++,CDD 21 I 21s   A.D
Dc                    SSK n[        UR                  5      R                  5       R                  n[        US-  5      $ )zReturn the directory where Alembic setup templates are found.

This method is used by the alembic ``init`` and ``list_templates``
commands.

r   N	templates)r   r   __file__rJ   rK   r   )r+   r   package_dirs      r/   get_template_directoryConfig.get_template_directory  s6     	7++,557>>;,--r2   c                4    [        U R                  5       5      $ )zReturn the directory where Alembic setup templates are found.

This method is used by the alembic ``init`` and ``list_templates``
commands.

.. versionadded:: 1.16.0

)r   rd   r6   s    r/   _get_template_pathConfig._get_template_path  s     D//122r2   c                    g r5   r=   r+   namedefaults      r/   get_sectionConfig.get_section(  s     $'r2   c                    g r5   r=   rj   s      r/   rm   rn   0  s     r2   c                    g r5   r=   rj   s      r/   rm   rn   5  s     47r2   c                    U R                   R                  U5      (       d  U$ [        U R                   R                  U5      5      $ )zReturn all the configuration options from a given .ini file section
as a dictionary.

If the given section does not exist, the value of ``default``
is returned, which is expected to be a dictionary or other mapping.

)rO   has_sectionr&   itemsrj   s      r/   rm   rn   :  s<     ++D11ND$$**4011r2   c                <    U R                  U R                  X5        g)a  Set an option programmatically within the 'main' section.

This overrides whatever was in the .ini file.

:param name: name of the value

:param value: the value.  Note that this value is passed to
 ``ConfigParser.set``, which supports variable interpolation using
 pyformat (e.g. ``%(some_value)s``).   A raw percent sign not part of
 an interpolation symbol must therefore be escaped, e.g. ``%%``.
 The given value may refer to another value already in the file
 using the interpolation format.

N)set_section_optionr#   r+   rk   values      r/   set_main_optionConfig.set_main_optionI  s     	 7 7Er2   c                P    U R                   R                  U R                  U5        g r5   )rO   remove_optionr#   )r+   rk   s     r/   remove_main_optionConfig.remove_main_optionZ  s    &&t'>'>Er2   c                    U R                   R                  U5      (       d  U R                   R                  U5        U R                   R                  XU5        g)a  Set an option programmatically within the given section.

The section is created if it doesn't exist already.
The value here will override whatever was in the .ini
file.

Does **NOT** consume from the pyproject.toml file.

.. seealso::

    :meth:`.Config.get_alembic_option` - includes pyproject support

:param section: name of the section

:param name: name of the value

:param value: the value.  Note that this value is passed to
 ``ConfigParser.set``, which supports variable interpolation using
 pyformat (e.g. ``%(some_value)s``).   A raw percent sign not part of
 an interpolation symbol must therefore be escaped, e.g. ``%%``.
 The given value may refer to another value already in the file
 using the interpolation format.

N)rO   rr   rN   set)r+   sectionrk   rw   s       r/   ru   Config.set_section_option]  sE    4 ++G44((1WE2r2   c                   U R                   R                  U5      (       d)  [        R                  " SU R                  < SU< S35      eU R                   R                  X5      (       a  U R                   R                  X5      $ U$ )z9Return an option from the given section of the .ini file.zNo config file z found, or file has no '[z
]' section)rO   rr   r   rZ   r!   
has_optionrX   )r+   r   rk   rl   s       r/   get_section_optionConfig.get_section_option{  st     ++G44##$($9$97D  &&w55##''66Nr2   c                    g r5   r=   rj   s      r/   get_main_optionConfig.get_main_option  s    ?Br2   c                    g r5   r=   rj   s      r/   r   r          r2   c                :    U R                  U R                  X5      $ )aJ  Return an option from the 'main' section of the .ini file.

This defaults to being a key from the ``[alembic]``
section, unless the ``-n/--name`` flag were used to
indicate a different section.

Does **NOT** consume from the pyproject.toml file.

.. seealso::

    :meth:`.Config.get_alembic_option` - includes pyproject support

)r   r#   rj   s      r/   r   r     s      &&t'>'>NNr2   c                    g r5   r=   rj   s      r/   get_alembic_optionConfig.get_alembic_option  s    BEr2   c                    g r5   r=   rj   s      r/   r   r     r   r2   c                    U R                   R                  U R                  U5      (       a&  U R                   R                  U R                  U5      $ U R	                  XS9$ )aI  Return an option from the "[alembic]" or "[tool.alembic]" section
of the configparser-parsed .ini file (e.g. ``alembic.ini``) or
toml-parsed ``pyproject.toml`` file.

The value returned is expected to be None, string, list of strings,
or dictionary of strings.   Within each type of string value, the
``%(here)s`` token is substituted out with the absolute path of the
``pyproject.toml`` file, as are other tokens which are extracted from
the :paramref:`.Config.config_args` dictionary.

Searches always prioritize the configparser namespace first, before
searching in the toml namespace.

If Alembic was run using the ``-n/--name`` flag to indicate an
alternate main section name, this is taken into account **only** for
the configparser-parsed .ini file.  The section name in toml is always
``[tool.alembic]``.


.. versionadded:: 1.16.0

)rl   )rO   r   r#   rX   _get_toml_config_valuerj   s      r/   r   r     sV    8 &&t'>'>EE##''(?(?FF..t.EEr2   c                D   U R                   R                  U R                  U5      (       a)  U R                   R                  U R                  U5      S:H  $ U R                  R                  US5      n[        U[        5      (       d  [        R                  " SU< 35      eU$ )NtrueFz*boolean value expected for TOML parameter )	rO   r   r#   rX   r^   rY   boolr   rZ   rv   s      r/   get_alembic_boolean_option!Config.get_alembic_boolean_option  s    &&t'>'>EE  $$T%<%<dCvM ,,00u=EeT**''@I  Lr2   c                6   [        5       nU R                  R                  X5      nXCL a  U$ UGbQ  [        U[        5      (       a  X@R
                  -  nU$ [        U[        5      (       a  U(       a`  [        US   [        5      (       aH  U VVVs/ s H5  nUR                  5        VVs0 s H  u  pgXgU R
                  -  _M     snnPM7     nnnnU$ [        SU Vs/ s H  owU R
                  -  PM     sn5      n U$ [        U[        5      (       a>  [        SUR                  5        VVs0 s H  u  pgXgU R
                  -  _M     snn5      nU$ [        U[        5      (       a  U$ [        R                  " SU< 35      eU$ s  snnf s  snnnf s  snf s  snnf )Nr   	list[str]zdict[str, str]z%unsupported TOML value type for key: )objectr^   rX   rY   r   r(   listr&   rs   r	   intr   rZ   )r+   rk   rl   USE_DEFAULTrw   dvkvs           r/   r   Config._get_toml_config_value  s   
 h$$((; 	 N%%%0, + E4((Za$77 #("'B >@XXZHZTQ00ZH"'  &  !#E%JEq4>>&:E%JE  E4(($9>GQT^^,,G  E3'''';D8D  % I &K
 Hs$   F	(FF	F
+FF	c                x    [        [        [        R                  " S[	        U R
                  SS5      05      5      $ )zThe messaging options.quietF)r	   MessagingOptionsr   immutabledictgetattrr   r6   s    r/   rB   Config.messaging_opts  s7     '$--%@A
 	
r2   c                   U H  nU R                  U5      nUc  M    O   g SS[        R                  SSS.n XC   nUS:X  a  [        R                  " S5        U$ ! [
         a  n[        SU< S	U< S
35      UeS nAff = f)N r@   :;)spacenewlineosr   r   version_path_separatorz[The version_path_separator configuration parameter is deprecated; please use path_separator'z' is not a valid value for z-; expected 'space', 'newline', 'os', ':', ';')r   r   pathsepr   warn_deprecatedKeyError
ValueError)r+   namesrk   	separatorsplit_on_pathsepkes          r/   _get_file_separator_charConfig._get_file_separator_char  s    D,,T2I$ 
  **
	*C //$$? J  	 d$ 		s   A 
A>$A99A>c                   U R                   R                  U R                  SS S9nU(       a  U R                  SS5      nUc=  [        R
                  " S5        [        R                  " S5      nUR                  U5      $ UR                  U5       Vs/ s H  nU(       d  M  UR                  5       PM     sn$ [        SU R                  SS 5      5      $ s  snf )Nversion_locationsfallbackpath_separatorr   zNo path_separator found in configuration; falling back to legacy splitting on spaces/commas for version_locations.  Consider adding path_separator=os to Alembic config.
, *|(?: +)r   rO   rX   r#   r   r   r   recompilesplitstripr	   r   )r+   version_locations_str
split_char_split_on_space_commaxs        r/   get_version_locations_list!Config.get_version_locations_list(  s     $ 0 0 4 4##%84 !5 !
 !66 ":J ! $$; )+

=(A%,223HII 388DD AGGID  ++,?F s   C!Cc                   U R                   R                  U R                  SS S9nU(       a  U R                  S5      nUc=  [        R
                  " S5        [        R                  " S5      nUR                  U5      $ UR                  U5       Vs/ s H  nU(       d  M  UR                  5       PM     sn$ [        SU R                  SS 5      5      $ s  snf )Nprepend_sys_pathr   r   zNo path_separator found in configuration; falling back to legacy splitting on spaces, commas, and colons for prepend_sys_path.  Consider adding path_separator=os to Alembic config.z, *|(?: +)|\:r   r   )r+   prepend_sys_path_strr   _split_on_space_comma_colonr   s        r/   get_prepend_sys_paths_list!Config.get_prepend_sys_paths_listK  s    #//33##%7$  4  
  667GHJ! $$; /1jj9I.J+2889MNN 277
CC AGGIC  ++,>E s   C Cc                `   / nU R                   R                  S5      (       dW  [        SU R                  S/ 5      5      nU H3  n[	        U5      nUR                  S5      US'   UR                  U5        M5     U$ [        R                  " S5      nU R                  S0 5      nUR                  UR                  SS5      5      nU H`  nU(       d  M  U V	s0 s H2  n	U	R                  US-   5      (       d  M  U	[        U5      S	-   S  Xi   _M4     nn	XS'   UR                  U5        Mb     U$ s  sn	f )
Npost_write_hookszlist[dict[str, str]]rk   
_hook_namer   hooks .r   )rO   rr   r	   r   r&   popappendr   r   rm   r   rX   
startswithlen)
r+   r   toml_hook_configcfgoptsr   ini_hook_configr   rk   keys
             r/   get_hooks_listConfig.get_hooks_listk  s<   +-++,>??#&++,>C  (Cy%)XXf%5\"T" (0 % %'JJ}$=!"../A2FO)//##GR0E   /.~~dSj1 ?CD	A(/*>>.   &*\"T"  s   D+6D+)r   r'   r!   r#   r$   r%   r(   r"   )r,   "Union[str, os.PathLike[str], None]r-   r   r.   r   r$   zOptional[TextIO]r%   r   r   r   r'   Mapping[str, Any]r)   zOptional[Dict[str, Any]]returnNone)r   zOptional[Path])r   zDict[str, Any])rC   r   rD   r   r   r   )r   r   )r   r   )r   r   )r   r   ).)rk   r   rl   r   r   zOptional[Dict[str, str]])rk   r   rl   Dict[str, str]r   r   )rk   r   rl   zMapping[str, str]r   z(Union[Dict[str, str], Mapping[str, str]]r5   )rk   r   rl   Optional[Mapping[str, str]]r   r   )rk   r   rw   r   r   r   )rk   r   r   r   )r   r   rk   r   rw   r   r   r   )r   r   rk   r   rl   r3   r   r3   )rk   r   rl   r   r   r   )rk   r   rl   r3   r   r3   )rk   r   rl   r3   r   FUnion[None, str, list[str], dict[str, str], list[dict[str, str]], int])rk   r   r   r   )rk   r   rl   zOptional[Any]r   r   )r   r   )r   r   r   r3   )r   zOptional[list[str]])r   zlist[PostWriteHookConfig]))__name__
__module____qualname____firstlineno____doc__sysr%   r   r   r0   r   __annotations__r!   r"   propertyr7   r:   r#   memoized_propertyr)   rF   rO   r^   rd   rg   r   rm   rx   r|   ru   r   r   r   r   r   rB   r   r   r   r   __static_attributes__r=   r2   r/   r   r      sb   Tp 598<$*.(,)-););)=/3/1/ 6/ 	/
 (/ / &/ '/ -/ 
/6 %)H!(	 '+m*2$(NM( + +
 ) )
 #" 
 &O. 
 , 
 &
.	3 ),''"&'	!' ' "0	  77"37	17 7
 AE22"=2	$2F"F3> AE"%0=	 B B26"/	 
 37OO"/O	O$ E E26"/	 
 37FF"/F
FB 37##"/#
#J 

 
@!F@!r2   r   c                       \ rS rSr% S\S'   Srg)r   i  r   r   r=   N)r   r   r   r   r   r   r=   r2   r/   r   r     s    Kr2   r   F)totalc                  .    \ rS rSr% SrS\S'   SS jrSrg)	CommandFunctioni  zA function that may be registered in the CLI as an alembic command.
It must be a named function and it must accept a :class:`.Config` object
as the first argument.

.. versionadded:: 1.15.3

r   r   c                    g r5   r=   )r+   configargskwargss       r/   __call__CommandFunction.__call__  s    #r2   r=   N)r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r=   r2   r/   r   r     s     MMr2   r   c            
         \ rS rSr% SrSVSWS jjr0 SSS\" S\S	S
94_SSS\" \SS94_SS\" SSS94_SS\" \SS94_SS\" \SS94_SS\" SSS94_SS\" S S!S94_S"S#\" \S$S94_S%S&\" \S'S94_S(S)\" \S*S94_S+S,S-\" SS.S94_S/S0\" SS1S94_S2S3\" SS4S94_S5S6S7\" S8S9S94_S:S;S<\" SS=S94_S>S?\" SS@S94_SASB\" SSCS94_r\" SDSE9\" SFSE9\" SGSHSI9SJ.r	\
R                  SKSL00rSM\SN'   SWSO jrSXSP jrSYSQ jrSZSR jrS[SS jrSVS\ST jjrSUrg)]CommandLinei  z/Provides the command line interface to Alembic.Nc                &    U R                  U5        g r5   )_generate_args)r+   progs     r/   r0   CommandLine.__init__  s    D!r2   templatez-tz
--templategenericz"Setup template for use with 'init')rl   typehelpmessagez-mz	--messagez%Message string to use with 'revision')r  r  sqlz--sql
store_truez\Don't emit SQL to database - dump to standard output/file instead. See docs on offline mode.actionr  tagz--tagz<Arbitrary 'tag' name - can be used by custom env.py scripts.headz--headzCSpecify head revision or <branchname>@head to base new revision on.splicez--splicez6Allow a non-head revision as the 'head' to splice onto
depends_onz--depends-onr   zNSpecify one or more revision identifiers which this revision should depend on.rev_idz--rev-idz9Specify a hardcoded revision id instead of generating oneversion_pathz--version-pathz2Specify specific path from config for version filebranch_labelz--branch-labelz3Specify a branch label to apply to the new revisionverbosez-vz	--verbosezUse more verbose outputresolve_dependenciesz--resolve-dependenciesz+Treat dependency versions as down revisionsautogeneratez--autogeneratezgPopulate revision script with candidate migration operations, based on comparison of database to model.	rev_rangez-rz--rev-rangestorez1Specify a revision range; format is [start]:[end]indicate_currentz-iz--indicate-currentzIndicate the current revisionpurgez--purgez7Unconditionally erase the version table before stampingpackagez	--packagezFWrite empty __init__.py files to the environment and version locationszlocation of scripts directoryr  zrevision identifier+z/one or more revisions, or 'heads' for all heads)nargsr  )	directoryrevision	revisionsr   r!  zdict[Any, dict[str, str]]_POSITIONAL_TRANSLATIONSc                   [        US9nUR                  SSS[        -  S9  UR                  SSSS	S
9  UR                  SS[        SSS9  UR                  SSSS
9  UR                  SSSS
9  UR                  SSSSS
9  UR	                  5       U l        S S [        [        5       5        5       nU H  nU R                  U5        M     X l	        g )Nr  z	--versionversionz%%(prog)s %s)r  r%  z-cz--configr   zAlternate config file; defaults to value of ALEMBIC_CONFIG environment variable, or "alembic.ini". May also refer to pyproject.toml file.  May be specified twice to reference both files separatelyr  z-nz--namer   zfName of section in .ini file to use for Alembic config (only applies to configparser config, not toml))r  rl   r  z-xzlAdditional arguments consumed by custom env.py scripts, e.g. -x setting1=somesetting -x setting2=somesettingz
--raiseerrr
  z!Raise a full stack trace on errorz-qz--quietzDo not log to std output.c              3     #    U  HY  n[         R                  " U5      (       d  M   UR                  S    S:w  d  M5  UR                  S:X  d  MG  [	        [
        U5      v   M[     g7f)r   _zalembic.commandN)inspect
isfunctionr   r   r	   r   ).0fns     r/   	<genexpr>-CommandLine._generate_args.<locals>.<genexpr>e  s\      
G""2& & KKNc)	 &
 MM%66 &D"%%Gs   A#A#A#A#c              3  B   #    U  H  n[        [        U5      v   M     g 7fr5   )r   r   )r*  rk   s     r/   r,  r-  g  s     G,$ww--,s   )
r   add_argumentr   r   add_subparsers
subparsersdirr   register_commandparser)r+   r  r4  alembic_commandsr+  s        r/   r  CommandLine._generate_args:  s   T*	>K3O 	 	
 	1	 	 	
 	> 	 	
 	; 	 	
 	4 	 	

 	,	 	 	
 !//1
G#g,G
 #B!!"% # r2   c                   U R                  U5      u  p#nU R                  R                  UR                  US9nUR	                  XU4S9  U H>  nX`R
                  ;   d  M  U R
                  U   nUSS US   pUR                  " U0 U	D6  M@     U H2  nU R                  R                  U0 5      n	UR                  " U40 U	D6  M4     g)zRegisters a function as a CLI subcommand. The subcommand name
matches the function name, the arguments are extracted from the
signature and the help text is read from the docstring.

.. versionadded:: 1.15.3

.. seealso::

    :ref:`custom_commandline`
r  )cmdr   N)	_inspect_functionr1  
add_parserr   set_defaults_KWARGS_OPTSr/  _POSITIONAL_OPTSrX   )
r+   r+  
positionalkwarg	help_text	subparserrD   	kwarg_optr   r   s
             r/   r3  CommandLine.register_commandt  s     (,'='=b'A$
9OO..r{{.K	BE#:;C''' --c2	&q_imd&&55	  C((,,S"5D""3/$/ r2   c                   [         R                  " U5      nUS   b+  US   S[        US   5      *  nUS   [        US   5      * S  nO
US   SS  n/ nXR                  ;   a.  U Vs/ s H!  nU R                  U   R	                  XU5      PM#     nnUR
                  nU(       aQ  / nUR                  S5       H9  nUR                  5       (       d    O&UR                  UR                  5       5        M;     O/ nSR                  U5      n	X4U	4$ s  snf )N   r   r   r@   r   )
r   inspect_getfullargspecr   r"  rX   r   r   r   r   join)
r+   r+  specr?  r@  rk   help_
help_lineslinerA  s
             r/   r:  CommandLine._inspect_function  s   ,,R07ac$q'l]3JGSa\MO,EaJE... '&D --b155dA&   

JD)zz||%%djjl3	 * JHHZ(	)++'s   %(D
c                v   UR                   u  p4n U" U/U Vs/ s H  n[        X&S 5      PM     snQ70 U Vs0 s H  of[        X&S 5      _M     snD6  g s  snf s  snf ! [        R                   aF  nUR                  (       a  e [        R
                  " [        U5      40 UR                  D6   S nAg S nAff = fr5   )r8  r   r   rZ   raiseerrerrr   rB   )r+   r   optionsr+  r?  r@  r   es           r/   run_cmdCommandLine.run_cmd  s     '
	:5?@Z''d+Z@ :??Agg$//?@?   	:Q96#8#89		:s2   A A
	A AA 
A B82<B33B8c                   UR                   n[        R                  R                  S5      nU(       a(  [        R                  R                  U5      S:X  a  UnSnOU(       a  SnUnOSnSnU(       d  XE4$ S =pgU H^  n[        R                  R                  U5      S:X  a  Ub  [        R                  " S5      eUnMC  Ub  [        R                  " S5      eUnM`     U(       a  UOUU(       a  U4$ U4$ )NALEMBIC_CONFIGzpyproject.tomlzalembic.iniz'pyproject.toml indicated more than oncez"only one ini file may be indicated)r   r   environrX   pathbasenamer   rZ   )	r+   rQ  r   alembic_config_envdefault_pyproject_tomldefault_alembic_configtomlinirk   s	            r/   _inis_from_configCommandLine._inis_from_config  s   ZZ^^,<=  !348HH%7"%2"%5"%7"%2"%5")AADww%)99#++A  ?++<    t!7C
 	
2
 	
r2   c                   U R                   R                  U5      n[        US5      (       d  U R                   R                  S5        gU R	                  U5      u  p4[        UUUR                  US9nU R                  XR5        g)z6Executes the command line with the provided arguments.r8  ztoo few arguments)r,   r-   r.   r   N)r4  
parse_argshasattrerrorr_  r   rk   rS  )r+   argvrQ  r]  r^  r   s         r/   mainCommandLine.main  sr    ++((.w&& KK12..w7ID#LL 	C LL&r2   )r4  r1  r5   )r  r3   r   r   )r+  r   r   r   )r+  r   r   ztuple[Any, Any, str])r   r   rQ  r   r   r   )rQ  r   r   ztuple[str, str])re  Optional[Sequence[str]]r   r   )r   r   r   r   r   r0   r&   r   r=  r>  r   stampr"  r   r  r3  r:  rS  r_  rf  r   r=   r2   r/   r   r     s   9"A!9
A 	c GH
A 	# 
A0 	)
1A@ 	+
AAP 	#M
QA^ 	8
_An 	!
oA~ 	I
AL 	J
MAZ 	+DE
[Ad 	$#B!
eAr 	#(
sAD 	H
EAT 	 #4
UAd 	#N
eAr 	#4
sALF >?&
 B
	 	
K0;7 8t06,>:&
P' 'r2   r   c                0    [        US9R                  U S9  g)z(The console runner function for Alembic.r$  )re  N)r   rf  )re  r  r   s      r/   rf  rf    s     TT*r2   __main__)NN)re  rh  r  r3   r   r   r   r   ))
__future__r   argparser   r   configparserr   r(  r   pathlibr   r   r   typingr   r	   r
   r   r   r   r   r   r   r   typing_extensionsr   r   r   r   r   r   util.pyfilesr   r   r   PostWriteHookConfigr   r   r   rf  r   r=   r2   r/   <module>rt     s    " #  %  	  	 
           '     1m	 m	` c3h' y Nh NP' P'h
 %)+
!+
+ + 
	+ zF r2   