2Rh d dl mZ d dlmZ d dlZd dlZd dlZd dlZd dlZd dl m Z d dlmZ d dlm Z d dlmZ d dlmZ d d lmZ d d lmZ d dlmZ d dlmZ d d lmZ d dlmZ d dlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ erddlmZ ddlm Z ddl!m"Z" ddl!m#Z# ddl$m%Z% d dl&m'Z' n # e($ r dZ'Y nw xY wee)ee) f Z* ej+ d Z, ej+ d Z- ej+ d Z. ej+ d Z/ ej+ d! Z0d"Z1 ej+ d# Z2 ej+ d$ Z3 G d% d& Z4 G d' d(ej% Z5dS )) )annotations)contextmanagerN) ModuleType)Any)cast)Iterator)List)Mapping)Optional)Sequence)Set)Tuple) TYPE_CHECKING)Union revision)write_hooks )util) migration)not_none)Config)MessagingOptions)RevisionStep) StampStep)Revision)tzz (?!\.\#|__init__)(.*\.py)(c|o)?$z(?!\.\#|__init__)(.*\.py)$z([a-f0-9]+)\.py$z(upgrade|downgrade)_([a-z0-9]+)z\w+z%(rev)s_%(slug)sz , *|(?: +)z , *|(?: +)|\:c e Zd ZdZeddddddd edej f dadZe dbd Z ej d ZdcdZ eddd Ze dedfd' Z dgdhd+Zdid/Zdjd2Zdkd4Zdld6Zdmd<Zdnd=Zdod?Zdnd@ZdodAZdpdEZdqdFZdrdIZdsdJZe dK Z dtdNZ!dudOZ"dvdQZ#dwdSZ$ dxdyd]Z%dzd`Z&dS ){ScriptDirectoryaH Provides operations upon an Alembic script directory. This object is useful to get information as to current revisions, most notably being able to get at the "head" revision, for schemes that want to test if the current revision in the database is the most recent:: from alembic.script import ScriptDirectory from alembic.config import Config config = Config() config.set_main_option("script_location", "myapp:migrations") script = ScriptDirectory.from_config(config) head_revision = script.get_current_head() ( NFutf-8r dirstr file_templatetruncate_slug_length Optional[int]version_locationsOptional[List[str]] sourcelessbooloutput_encodingtimezone Optional[str]hook_configOptional[Mapping[str, str]]recursive_version_locationsmessaging_optsreturnNonec x || _ || _ || _ |pd| _ || _ || _ t j | j | _ || _ || _ | | _ | | _ t j |t j s4t# j dt j | z d S )Nr! zVPath doesn't exist: %r. Please use the 'init' command to create a new scripts folder.)r# r% r( r&