# Path: alembic/util.py
# class CommandError(Exception):
# class memoized_property(object):
# class immutabledict(dict):
# def _safe_int(value):
# def requires_07(feature):
# def template_to_file(template_file, dest, **kw):
# def create_module_class_proxy(cls, globals_, locals_):
#     def _install_proxy(obj):
#     def _remove_proxy():
#     def _create_op_proxy(name):
#         def _name_error(name):
# def coerce_resource_to_filename(fname):
# def status(_statmsg, fn, *arg, **kw):
# def err(message):
# def obfuscate_url_pw(u):
# def asbool(value):
# def warn(msg):
# def msg(msg, newline=True):
# def load_python_file(dir_, filename):
# def pyc_file_from_path(path):
# def rev_id():
#     def __init__(self, fget, doc=None):
#     def __get__(self, obj, cls):
#     def _immutable(self, *arg, **kw):
#     def __new__(cls, *args):
#     def __init__(self, *args):
#     def __reduce__(self):
#     def union(self, d):
#     def __repr__(self):


import os
import shutil
import re
import inspect
import datetime
from alembic import util

        id_ = self.as_revision_number(id_)
        try:
            return self._revision_map[id_]
        except KeyError:
            # do a partial lookup
            revs = [x for x in self._revision_map
                    if x is not None and x.startswith(id_)]
            if not revs:
                raise util.CommandError("No such revision '%s'" % id_)
            elif len(revs) > 1:
                raise util.CommandError(
                            "Multiple revisions start "
                            "with '%s', %s..." % (
                                id_,
                                ", ".join("'%s'" % r for r in revs[0:3])
                            ))
            else:
                return self._revision_map[revs[0]]

    _get_rev = get_revision

    def as_revision_number(self, id_):
        """Convert a symbolic revision, i.e. 'head' or 'base', into
        an actual revision number."""

        if id_ == 'head':
            id_ = self.get_current_head()
        elif id_ == 'base':
            id_ = None

# Path: alembic/util.py
# class CommandError(Exception):
# class memoized_property(object):
# class immutabledict(dict):
# def _safe_int(value):
# def requires_07(feature):
# def template_to_file(template_file, dest, **kw):
# def create_module_class_proxy(cls, globals_, locals_):
#     def _install_proxy(obj):
#     def _remove_proxy():
#     def _create_op_proxy(name):
#         def _name_error(name):
# def coerce_resource_to_filename(fname):
# def status(_statmsg, fn, *arg, **kw):
# def err(message):
# def obfuscate_url_pw(u):
# def asbool(value):
# def warn(msg):
# def msg(msg, newline=True):
# def load_python_file(dir_, filename):
# def pyc_file_from_path(path):
# def rev_id():
#     def __init__(self, fget, doc=None):
#     def __get__(self, obj, cls):
#     def _immutable(self, *arg, **kw):
#     def __new__(cls, *args):
#     def __init__(self, *args):
#     def __reduce__(self):
#     def union(self, d):
#     def __repr__(self):


# Path: alembic/script.py
import os
import shutil
import re
import inspect
import datetime
from alembic import util


        id_ = self.as_revision_number(id_)
        try:
            return self._revision_map[id_]
        except KeyError:
            # do a partial lookup
            revs = [x for x in self._revision_map
                    if x is not None and x.startswith(id_)]
            if not revs:
                raise util.CommandError("No such revision '%s'" % id_)
            elif len(revs) > 1:
                raise util.CommandError(
                            "Multiple revisions start "
                            "with '%s', %s..." % (
                                id_,
                                ", ".join("'%s'" % r for r in revs[0:3])
                            ))
            else:
                return self._revision_map[revs[0]]

    _get_rev = get_revision

    def as_revision_number(self, id_):
        """Convert a symbolic revision, i.e. 'head' or 'base', into
        an actual revision number."""

        if id_ == 'head':
            id_ = self.get_current_head()
        elif id_ == 'base':
            id_ = None

        return id_