
    gV                    l   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	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 " S S\SS9r " S S5      r  S       S S jjr\S:X  a  \" 5         gg)!    )annotations)ArgumentParser)	Namespace)ConfigParserN)Any)cast)Dict)Mapping)Optional)overload)Sequence)TextIO)Union)	TypedDict   )__version__)command)util)compatc                  N   \ rS rSr% Sr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'    \R                  SS j5       rSS jr\R                  S S j5       rS!S jr\ S"     S#S jj5       r\      S$S j5       r\      S%S j5       r S&     S'S jjrS(S jrS)S jrS*S jr S&       S+S jjr\S,S j5       r\ S&     S-S jj5       r S&     S-S jjr\R                  S.S j5       rSrg)/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.
: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.  The dictionary as given
 is **copied** to a new one, stored locally as the attribute
 ``.config_args``. When the :attr:`.Config.file_config` attribute is
 first invoked, the replacement variable ``here`` will be added to this
 dictionary before the dictionary is passed to ``ConfigParser()``
 to parse the .ini file.

: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"Union[str, os.PathLike[str], None]strcmd_optsOptional[Namespace]c                    Xl         X l        X0l        X@l        XPl        [        U5      U l        U(       a  U R                  R                  U5        gg)z Construct a new :class:`.Config`N)	config_file_nameconfig_ini_sectionoutput_bufferstdoutr   dictconfig_args
attributesupdate)selffile_ini_sectionr!   r"   r   r$   r%   s           V/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/alembic/config.py__init__Config.__init__d   sG     !&"-* ,OO"":.     r   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`

 r'   s    r*   r%   Config.attributes   s	    $ 	r-   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Nr-   c                   U R                   (       aG  [        R                  R                  [        R                  R	                  U R                   5      5      nOSnX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.

Direct 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)r   ospathabspathdirnamer$   r   r   read_config_parseradd_sectionr    )r'   r=   file_configs      r*   rD   Config.file_config   s       77??277??43H3H#IJDD#' "4#3#34  %%k4I4I3JK  ##D$;$;<r-   c                    SSK n[        R                  R                  [        R                  R	                  UR
                  5      5      n[        R                  R                  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>   r?   r@   rA   __file__join)r'   r   package_dirs      r*   get_template_directoryConfig.get_template_directory   sA     	ggoobggoog6F6F&GHww||K55r-   c                    g Nr/   r'   namedefaults      r*   get_sectionConfig.get_section   s     $'r-   c                    g rN   r/   rO   s      r*   rR   rS      s     r-   c                    g rN   r/   rO   s      r*   rR   rS      s     47r-   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.

)rD   has_sectionr#   itemsrO   s      r*   rR   rS      s<     ++D11ND$$**4011r-   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'   rP   values      r*   set_main_optionConfig.set_main_option   s     	 7 7Er-   c                P    U R                   R                  U R                  U5        g rN   )rD   remove_optionr    )r'   rP   s     r*   remove_main_optionConfig.remove_main_option  s    &&t'>'>Er-   c                    U R                   R                  U5      (       d  U R                   R                  U5        U R                   R                  XU5        g)aX  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.

: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)rD   rW   rC   set)r'   sectionrP   r[   s       r*   rZ   Config.set_section_option  sE    ( ++G44((1WE2r-   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)rD   rW   r   CommandErrorr   
has_optionget)r'   rd   rP   rQ   s       r*   get_section_optionConfig.get_section_option*  st     ++G44##$($9$97D  &&w55##''66Nr-   c                    g rN   r/   rO   s      r*   get_main_optionConfig.get_main_option8  s    ?Br-   c                    g rN   r/   rO   s      r*   rm   rn   ;  s     r-   c                :    U R                  U R                  X5      $ )zReturn 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.

)rj   r    rO   s      r*   rm   rn   @  s     &&t'>'>NNr-   c                x    [        [        [        R                  " S[	        U R
                  SS5      05      5      $ )zThe messaging options.quietF)r   MessagingOptionsr   immutabledictgetattrr   r0   s    r*   r5   Config.messaging_optsL  s7     '$--%@A
 	
r-   )r   r$   r   r    r!   r"   )r(   r   r)   r   r!   zOptional[TextIO]r"   r   r   r   r$   zMapping[str, Any]r%   zOptional[Dict[str, Any]]returnNone)rw   zDict[str, Any])r6   r   r7   r   rw   rx   )rw   r   )rw   r   ).)rP   r   rQ   rx   rw   zOptional[Dict[str, str]])rP   r   rQ   Dict[str, str]rw   ry   )rP   r   rQ   zMapping[str, str]rw   z(Union[Dict[str, str], Mapping[str, str]]rN   )rP   r   rQ   Optional[Mapping[str, str]]rw   rz   )rP   r   r[   r   rw   rx   )rP   r   rw   rx   )rd   r   rP   r   r[   r   rw   rx   )rd   r   rP   r   rQ   Optional[str]rw   r{   )rP   r   rQ   r   rw   r   )rP   r   rQ   r{   rw   r{   )rw   rs   )__name__
__module____qualname____firstlineno____doc__sysr"   r   rt   r+   r   __annotations__r   r    memoized_propertyr%   r9   rD   rK   r   rR   r\   r`   rZ   rj   rm   r5   __static_attributes__r/   r-   r*   r   r      sX   FT 59$*.(,)-););)=/3/1/ / (	/
 / &/ '/ -/ 
/( %)H!(	 <@8?2"" 
 &O. 
 ,
6 ),''"&'	!' ' "0	  77"37	17 7
 AE22"=2	$2F"F32 AE"%0=	 B B26"/	 
 37
O
O"/
O	
O 

 
r-   r   c                       \ rS rSr% S\S'   Srg)rs   iW  boolrr   r/   N)r|   r}   r~   r   r   r   r/   r-   r*   rs   rs   W  s    Kr-   rs   F)totalc                  D    \ rS rSrSS	S jjrS	S jrS
S jrSSS jjrSrg)CommandLinei[  Nc                &    U R                  U5        g rN   )_generate_args)r'   progs     r*   r+   CommandLine.__init__\  s    D!r-   c           	       ^^           S&UU4S jjn[        US9nUR                  SSS[        -  S9  UR                  SS[        [        R
                  R                  S	S
5      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       n[        R                  SS00m[        [        5       Vs/ s H  n[        [        U5      PM     sn GHm  n[        R                  " U5      (       d  M!  UR                  S   S:w  d  M6  UR                  S:X  d  MH  [         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	UT;   a$  U V
s/ s H  n
TU   R                  X5      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UR/                  UR                  S#R1                  U5      S$9mU" UTX5        TR3                  XhU	4S%9  GMp     X0l        g s  snf s  sn
f )'Nc           
     4  > 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+S,[        SS-S94_S.S/[        SS0S94_S1S2S3[        S4S5S94_S6S7S8[        SS9S94_S:S;[        SS<S94_S=S>[        SS?S94_nS@SASBSC.nU H)  nXd;   d  M
  XF   nUSDSE USE   pUR                  " U0 UD6  M+     U H[  nUSF:X  d  U T	;   a.  T	U    U   SF:X  a"  T
R                  SFSGUR                  SF5      SH9  M=  T
R                  XeR                  U5      SI9  M]     g )JNtemplatez-tz
--templategenericz"Setup template for use with 'init')rQ   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-onappendzNSpecify 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 directoryzrevision identifierz/one or more revisions, or 'heads' for all heads)	directoryrevision	revisionsr   r   +)nargsr   r   )r#   r   add_argumentri   )fnparser
positionalkwargskwargs_optspositional_helpr7   argskwpositional_translations	subparsers            r*   add_options/CommandLine._generate_args.<locals>.add_options`  sA   H  ) AH  'NH" +(#H4  15HD  3EHT +0UHd "'@eHt  )uHD $ '!EHT $ '!UHd 3LMeHn ',+J)oH| $+0!}HN !&2OH` #(+<%aHp +*qH@ +<AHKT =1NO
 %&+D#Abz48"''44	  ";&44/3C8KG**#!,00= +  **35H5H5M*N "r-   r   z	--versionversionz%%(prog)s %s)r   r   z-cz--configALEMBIC_CONFIGzalembic.inizaAlternate config file; defaults to value of ALEMBIC_CONFIG environment variable, or "alembic.ini")r   rQ   r   z-nz--namer   z6Name of section in .ini file to use for Alembic configz-xr   zlAdditional arguments consumed by custom env.py scripts, e.g. -x setting1=somesetting -x setting2=somesettingr   z
--raiseerrr   z!Raise a full stack trace on errorz-qz--quietzDo not log to std output.r   r   r   _zalembic.command   r   r3    r   )cmd)
r   r   r   r   r   r   r   r   rw   rx   )r   r   r   r   r>   environri   add_subparsersr   stampdirru   inspect
isfunctionr|   r}   r   inspect_getfullargspeclenr   splitstripr   
add_parserrI   set_defaultsr   )r'   r   r   r   
subparsersnr   specr   kwargrP   help_	help_textliner   r   s                 @@r*   r   CommandLine._generate_args_  s   c	Oc	O c	O.1c	O;>c	Oc	O c	OJ  T*	>K3O 	 	
 	JJNN#3]CD 	 	
 	L 	 	
 	; 	 	
 	4 	 	

 	,	 	 	
 **,
 MMJ43
 14G=177A&=B""2&&KKNc)MM%6644R87&!%ac$q'l]!;J GSa\MO4E!%aJE00 %/"$.D 0377C$.  " 

 "I %D 1#zz||!%,,TZZ\:	 !2 !#I&11KKchhy&9 2 	 B	:=&&BE+B&CG >H I >"s   ,J,J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rN   )r   ru   r   rg   raiseerrerrr   r5   )r'   configoptionsr   r   r   kes           r*   run_cmdCommandLine.run_cmdW  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                   R                  U5      n[        US5      (       d  U R                   R                  S5        g [	        UR
                  UR                  US9nU R                  X25        g )Nr   ztoo few arguments)r(   r)   r   )r   
parse_argshasattrerrorr   r   rP   r   )r'   argvr   cfgs       r*   mainCommandLine.mainf  sa    ++((.w&& KK12nn#LL C
 LL&r-   )r   rN   )r   r{   rw   rx   )r   r   r   r   rw   rx   )r   Optional[Sequence[str]]rw   rx   )	r|   r}   r~   r   r+   r   r   r   r   r/   r-   r*   r   r   [  s    "vp:' 'r-   r   c                0    [        US9R                  U S9  g)z(The console runner function for Alembic.r   )r   N)r   r   )r   r   r   s      r*   r   r   u  s     TT*r-   __main__)NN)r   r   r   r{   r   r   rw   rx   ) 
__future__r   argparser   r   configparserr   r   r>   r   typingr   r   r	   r
   r   r   r   r   r   typing_extensionsr   r<   r   r   r   r   r   rs   r   r   r|   r/   r-   r*   <module>r      s    " #  %  	 
          '    y
 y
x	y W' W'v %)+
!+
+ + 
	+ zF r-   