|L iptUddlmZddlZddlZddlZddlZddlZddlm Z ddlm Z ddlm Z ddl m Z ddl mZdd lmZe rdd lmZd ZiZd ed <ddZ ddZ ddZddZddZ ddZed d d!dZedd d!dZedd d!dZy)") annotationsN)Any)Callable) TYPE_CHECKING)util)compat)_preserving_path_as_str)PostWriteHookConfigREVISION_SCRIPT_FILENAMEdict _registrycfd}|S)zA function decorator that will register that function as a write hook. See the documentation linked below for an example. .. seealso:: :ref:`post_write_hooks_custom` c|t<|S)N)r)fnnames `/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/alembic/script/write_hooks.pydecoratezregister..decorate's $ )rrs` rregisterrs Orct|} t|}|||S#t$r}tjd|d|d}~wwxYw)a1Invokes the formatter registered for the given name. :param name: The name of a formatter in the registry :param revision: string path to the revision file :param options: A dict containing kwargs passed to the specified formatter. :raises: :class:`alembic.util.CommandError` zNo formatter with name 'z ' registeredN)r rKeyErrorr CommandError)r revision_pathoptionshookkes r_invoker.s_,M:M, M7++ &tfL 9  s  AAAc|D]=}|d} |d}tjd|d5t|||ddd?y#1swYJxYw#t$r!}tjd|d||d}~wwxYw) z&Invoke hooks for a generated revision. _hook_nametypezRunning post write hook T)newlineNzKey 'z;.type' (or 'type' in toml) is required for post write hook )rstatusrrr)pathhooksrrtype_rs r _run_hooksr(Fs  +L! +LE*4(3T +tT* + + + + +  ##v''+h0  s"AAA  A:A55A:ct|vr tdz|z}tj|tj}|Dcgc]}|j t|}}|Scc}w)zParse options from a string into a list. Also substitutes the revision script token with the actual filename of the revision script. If the revision script token doesn't occur in the options string, it is automatically prepended.  )posix)REVISION_SCRIPT_TOKENshlexsplitr is_posixreplace)cmdline_options_strr%cmdline_options_listoptions r_parse_cmdline_optionsr4[so$773c9rItypingrrrr:rr util.pyfilesr configr r,r__annotations__rrr(r4r7rDrErRrKrrrrds:#   2,2 4&, ,),!, ,0+ +)B+ +* * E  E E-1 E