Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure you want to rename?
File Manager
/
ALFA_DATA
/
alfasymlink
/
root
/
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
alembic
/
script
/
__pycache__
:
base.cpython-37.opt-1.pyc
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
B �M!V�i � @ s� d dl Z d dlZd dlZd dlZddlmZ ddlmZ ddlmZ ddlm Z d dl mZ e�d �Z e�d �Ze�d�Ze�d�Ze�d �ZdZe�d�ZG dd� de�ZG dd� dej�ZdS )� N� )�util)�compat� )�revision)� migration)�contextmanagerz(?!__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,|(?: +)c @ s e Zd ZdZeddddfdd�Zedd � �Zej d d� �Z dd � Zedd� �Z ed:dd��Zd;dd�Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zed.d/� �Zd0d1� Zd2d3� Zd4d5� Z d<d6d7�Z!d8d9� 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() �( NFzutf-8c C sV || _ || _|| _|pd| _|| _|| _t�| j�| _ t �|t j�sRt �d| ��d S )Nr zVPath doesn't exist: %r. Please use the 'init' command to create a new scripts folder.)�dir� file_template�version_locations�truncate_slug_length� sourceless�output_encodingr ZRevisionMap�_load_revisions�revision_map�os�access�F_OKr �CommandError)�selfr r r r r r � r �D/opt/alt/python37/lib/python3.7/site-packages/alembic/script/base.py�__init__* s zScriptDirectory.__init__c C s* | j }t|�dkrt�d��n|d S d S )Nr z"Multiple version_locations presentr )�_version_locations�lenr r )r Zlocr r r �versions; s zScriptDirectory.versionsc C s4 | j rdd� | j D �S tj�tj�| jd��fS d S )Nc S s g | ]}t j�t�|���qS r )r �path�abspathr �coerce_resource_to_filename)�.0�locationr r r � <listcomp>G s z6ScriptDirectory._version_locations.<locals>.<listcomp>r )r r r r �joinr )r r r r r C s z"ScriptDirectory._version_locationsc c sd | j rdd� | jD �}n| jg}x>|D ]6}x0t�|�D ]"}t�| ||�}|d krRq6|V q6W q&W d S )Nc S s g | ]}t j�|�r|�qS r )r r �exists)r! �versr r r r# P s z3ScriptDirectory._load_revisions.<locals>.<listcomp>)r r r r �listdir�Script�_from_filename)r �pathsr&