JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr gVlddlmZddlmZddlmZddlmZddlZddlZddl Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd l mZddl mZddlmZddlmZddlmZddlmZddlmZGddZGddedZGddZ d d dZedk(reyy)!) annotations)ArgumentParser) Namespace) ConfigParserN)Any)cast)Dict)Mapping)Optional)overload)Sequence)TextIO)Union) TypedDict) __version__)command)util)compatceZdZUdZdddej dejdf ddZdZ de d< dZ de d < dZ de d < ejdd Zdd Zejdd ZddZe d d!dZe d"dZe d#dZ d$ d%dZd&dZd'dZd(dZ d$ d)dZed*dZe d$ d+dZ d$ d+dZejd,dZy)-Configa` 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` Nalembic"Union[str, os.PathLike[str], None]strcmd_optsOptional[Namespace]c||_||_||_||_||_t ||_|r|jj|yy)z Construct a new :class:`.Config`N) config_file_nameconfig_ini_section output_bufferstdoutrdict config_args attributesupdate)selffile_ ini_sectionr r!rr#r$s =/opt/hc_python/lib/python3.12/site-packages/alembic/config.py__init__zConfig.__init__dsQ!&"-*    ,  OO " ": . rrciS)aA 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$zConfig.attributess $ r+c|rt||z}n t|}tj|j|dfi|jy)aRender 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)rrwrite_outstreamr!messaging_opts)r&textargoutputs r) print_stdoutzConfig.print_stdouts> Y_FYF T[[&$N$:M:MNr+c|jrGtjjtjj |j}nd}||j d<t |j }|jr#tj||jg|S|j|j|S)aReturn 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) rospathabspathdirnamer#rrread_config_parser add_sectionr)r&r9 file_configs r)r@zConfig.file_configs  77??277??43H3H#IJDD#' "4#3#34   % %kD4I4I3J K  # #D$;$; <r+cddl}tjjtjj |j }tjj |dS)zReturn the directory where Alembic setup templates are found. This method is used by the alembic ``init`` and ``list_templates`` commands. rN templates)rr:r;r<r=__file__join)r&r package_dirs r)get_template_directoryzConfig.get_template_directorysA ggoobggoog6F6F&GH ww||K55r+cyNr-r&namedefaults r) get_sectionzConfig.get_sections$'r+cyrHr-rIs r)rLzConfig.get_sectionsr+cyrHr-rIs r)rLzConfig.get_sections47r+c|jj|s|St|jj|S)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. )r@ has_sectionr"itemsrIs r)rLzConfig.get_sections9++D1ND$$**4011r+c>|j|j||y)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&rJvalues r)set_main_optionzConfig.set_main_options  7 7uEr+cP|jj|j|yrH)r@ remove_optionr)r&rJs r)remove_main_optionzConfig.remove_main_options &&t'>'>Er+c|jj|s|jj||jj|||y)aSet 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)r@rPr?set)r&sectionrJrTs r)rSzConfig.set_section_optionsD(++G4    ( ( 1 WdE2r+c|jj|s&tjd|jd|d|jj ||r|jj ||S|S)z9Return an option from the given section of the .ini file.zNo config file z found, or file has no '[z ]' section)r@rPr CommandErrorr has_optionget)r&r[rJrKs r)get_section_optionzConfig.get_section_option*sr++G4##$($9$97D     & &w 5##''6 6Nr+cyrHr-rIs r)get_main_optionzConfig.get_main_option8s?Br+cyrHr-rIs r)rbzConfig.get_main_option;sr+c<|j|j||S)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. )r`rrIs r)rbzConfig.get_main_option@s&&t'>'>gNNr+c vtttjdt |j ddiS)zThe messaging options.quietF)rMessagingOptionsr immutabledictgetattrrr.s r)r2zConfig.messaging_optsLs7    '$--%@A   r+)r'rr(rr zOptional[TextIO]r!rrrr#zMapping[str, Any]r$zOptional[Dict[str, Any]]returnNone)rjzDict[str, Any])r3rr4rrjrk)rjr)rjr).)rJrrKrkrjzOptional[Dict[str, str]])rJrrKDict[str, str]rjrl)rJrrKzMapping[str, str]rjz(Union[Dict[str, str], Mapping[str, str]]rH)rJrrKOptional[Mapping[str, str]]rjrm)rJrrTrrjrk)rJrrjrk)r[rrJrrTrrjrk)r[rrJrrK Optional[str]rjrn)rJrrKrrjr)rJrrKrnrjrn)rjrg)__name__ __module__ __qualname____doc__sysr!rrhr*r__annotations__rrmemoized_propertyr$r6r@rFr rLrUrXrSr`rbr2r-r+r)rrsZFT59$*.(,);););)=/3/1//( /  / & /'/-/ /(%)H!( <@8?2"" &O. , 6),''"&' !''"0 77"37 177 AE 2 2"= 2 $ 2F"F32AE  "% 0=   BB 26"/  37 O O"/ O  O   r+rceZdZUded<y)rgboolrfN)rorprqrtr-r+r)rgrgWs Kr+rgF)totalc0eZdZdddZddZddZdd dZy) CommandLineNc&|j|yrH)_generate_args)r&progs r)r*zCommandLine.__init__\s D!r+c   d&fd }t|}|jdddtz|jddttj j d d d |jd dtdd |jddd|jddd|jdddd|j}tjddiittDcgc]}tt|c}D]W}tj|s|jddk7s-|jdk(s=t!j"|}|d +|dd!t%|d  }|dt%|d  d} n |dd!d}g} |vr"|D cgc]} |j | | }} |j&} | rJg} | j)d"D]3} | j+sn$| j-| j+5ng} |j/|jd#j1| $|||| j3||| f%Z||_ycc}wcc} w)'Nc idddtdtdfddd ttd fd d tddfddttd fddttd fddtddfddtddfddttd fd!d"ttd# fd$d%ttd& fd'd(d)tdd*fd+d,tdd-fd.d/tdd0fd1d2d3td4d5fd6d7d8tdd9fd:d;tdd<fd=d>tdd?f}d@dAdBdC}|D](}||vs||}|dDdE|dE}}|j|i|*|D]\}|dFk(s| vr/ ||dFk(r$ jdFdG|jdFH; j||j|I^y)JNtemplatez-tz --templategenericz"Setup template for use with 'init')rKtypehelpmessagez-mz --messagez%Message string to use with 'revision')rrsqlz--sql store_truez\Don't emit SQL to database - dump to standard output/file instead. See docs on offline mode.actionrtagz--tagz@head to base new revision on.splicez--splicez6Allow a non-head revision as the 'head' to splice onto depends_onz --depends-onappendzNSpecify 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 revisionverbosez-vz --verbosezUse more verbose outputresolve_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-rangestorez1Specify a revision range; format is [start]:[end]indicate_currentz-iz--indicate-currentzIndicate the current revisionpurgez--purgez7Unconditionally erase the version table before stampingpackagez --packagezFWrite empty __init__.py files to the environment and version locationszlocation of scripts directoryzrevision identifierz/one or more revisions, or 'heads' for all heads) directoryrevision revisionsrr+)nargsrr)r"r add_argumentr_) fnparser positionalkwargs kwargs_optspositional_helpr4argskwpositional_translations subparsers r) add_optionsz/CommandLine._generate_args..add_options`sKH  ) AH 'NH"+(#H4 15HD 3EHT+0UHd"'@eHt )uHD$ '!EHT$ '!UHd 3LMeHn',+J)oH|$+0!}HN!&2OH`#(+<%aHp+*qH@+<AHKT=1NO +%&s+D#Abz48"D'F''44  ";&44/3C8KG**#!,00=+ **3_5H5H5M*N"r+r}z --versionversionz %%(prog)s %s)rrz-cz--configALEMBIC_CONFIGz alembic.inizaAlternate config file; defaults to value of ALEMBIC_CONFIG environment variable, or "alembic.ini")rrKrz-nz--namerz6Name of section in .ini file to use for Alembic configz-xrzlAdditional arguments consumed by custom env.py scripts, e.g. -x setting1=somesetting -x setting2=somesettingrz --raiseerrrz!Raise a full stack trace on errorz-qz--quietzDo not log to std output.rrr_zalembic.commandrr0 r)cmd) rrrrrrrrrjrk)rrrrr:environr_add_subparsersrstampdirriinspect isfunctionrorprinspect_getfullargspeclenrrsplitstripr add_parserrD set_defaultsr)r&r}rr subparsersnrspecrkwargrJhelp_ help_textlinerrs @@r)r|zCommandLine._generate_args_sc Oc O c O.1c O;>c O c OJ T*  >K3O     JJNN#3]CD     L    ;    4    ,  **,  MMJ 43 14G = 177A& =B""2&KKNc)MM%6644R87&!%ac$q'l]!;J GSa\MO4E!%aJE00%/"$.D0377dC$."   "I % D 1#zz|!%,,TZZ\: !2 !#I&11KKchhy&92 B :u=&&B E+B&CG>H I>"s ?I<-Jc d|j\}}} ||g|Dcgc]}t||dc}i|Dcic]}|t||dc}ycc}wcc}w#tj$r@}|jrtj t |fi|jYd}~yd}~wwxYwrH)rrirr]raiseerrerrrr2)r&configoptionsrrrkes r)run_cmdzCommandLine.run_cmdWs ' J :  5?@Z''1d+Z@ :??A1ggq$//? @?   :Q96#8#89  :s2AA AA A AB//6B**B/c|jj|}t|ds|jjdyt |j |j |}|j||y)Nrztoo few arguments)r'r(r)r parse_argshasattrerrorrrrJr)r&argvrcfgs r)mainzCommandLine.mainfs`++((.w& KK  1 2nn#LL C LLg &r+rH)r}rnrjrk)rrrrrjrk)rOptional[Sequence[str]]rjrk)rorprqr*r|rrr-r+r)rzrz[s"vp : 'r+rzc <t|j|y)z(The console runner function for Alembic.r)rN)rzr)rr}rs r)rrusTT*r+__main__)NN)rrr}rnrrrjrk) __future__rargparserr configparserrrr:rstypingrrr r r r r rrtyping_extensionsrr8rrrrrrgrzrror-r+r)rs"#% 'y y x yW'W'v%)+ !+ ++ + zFr+