# Path: spanner_orm/error.py
# class SpannerError(Exception):
# class ValidationError(Exception):
# 
# Path: spanner_orm/admin/migration.py
# def no_update_callable() -> update.MigrationUpdate:
#   def __init__(
#       self,
#       migration_id: str,
#       prev_migration_id: Optional[str],
#       upgrade: Optional[Callable[[], update.MigrationUpdate]] = None,
#       downgrade: Optional[Callable[[], update.MigrationUpdate]] = None,
#   ):
#   def migration_id(self) -> str:
#   def prev_migration_id(self) -> Optional[str]:
#   def upgrade(self) -> Optional[Callable[[], update.MigrationUpdate]]:
#   def downgrade(self) -> Optional[Callable[[], update.MigrationUpdate]]:
# class Migration:


import datetime
import importlib
import os
import re
import string
import uuid
from typing import Iterable, List, Optional
from spanner_orm import error
from spanner_orm.admin import migration
      migration_skeleton = string.Template(skeleton.read())
    migration_content = migration_skeleton.substitute(
        migration_name=migration_name,
        migration_id=repr(migration_id),
        prev_migration_id=repr(prev_id),
        current_date=now)

    filename = '{name}_{migration_id}.py'.format(
        name=re.sub(r'\W', '_', migration_name), migration_id=migration_id)
    filepath = os.path.join(self.basedir, filename)
    with open(filepath, 'w') as f:
      f.write(migration_content)
    return filepath

  @property
  def migrations(self) -> List[migration.Migration]:
    """Loads and orders all migrations in the base dir."""
    if self._migrations is None:
      unordered_migrations = self._all_migrations()
      self._migrations = self._order_migrations(unordered_migrations)
    return self._migrations

  def _migration_from_file(self, filename: str) -> migration.Migration:
    """Loads a single migration from the given filename in the base dir."""
    module_name = re.sub(r'\W', '_', filename)
    path = os.path.join(self.basedir, filename)
    module = importlib.util.module_from_spec(
        importlib.util.spec_from_file_location(module_name, path))
    importlib.machinery.SourceFileLoader(module_name, path).exec_module(module)
    try:

# Path: spanner_orm/error.py
# class SpannerError(Exception):
# class ValidationError(Exception):
# 
# Path: spanner_orm/admin/migration.py
# def no_update_callable() -> update.MigrationUpdate:
#   def __init__(
#       self,
#       migration_id: str,
#       prev_migration_id: Optional[str],
#       upgrade: Optional[Callable[[], update.MigrationUpdate]] = None,
#       downgrade: Optional[Callable[[], update.MigrationUpdate]] = None,
#   ):
#   def migration_id(self) -> str:
#   def prev_migration_id(self) -> Optional[str]:
#   def upgrade(self) -> Optional[Callable[[], update.MigrationUpdate]]:
#   def downgrade(self) -> Optional[Callable[[], update.MigrationUpdate]]:
# class Migration:


# Path: spanner_orm/admin/migration_manager.py
import datetime
import importlib
import os
import re
import string
import uuid
from typing import Iterable, List, Optional
from spanner_orm import error
from spanner_orm.admin import migration

      migration_skeleton = string.Template(skeleton.read())
    migration_content = migration_skeleton.substitute(
        migration_name=migration_name,
        migration_id=repr(migration_id),
        prev_migration_id=repr(prev_id),
        current_date=now)

    filename = '{name}_{migration_id}.py'.format(
        name=re.sub(r'\W', '_', migration_name), migration_id=migration_id)
    filepath = os.path.join(self.basedir, filename)
    with open(filepath, 'w') as f:
      f.write(migration_content)
    return filepath

  @property
  def migrations(self) -> List[migration.Migration]:
    """Loads and orders all migrations in the base dir."""
    if self._migrations is None:
      unordered_migrations = self._all_migrations()
      self._migrations = self._order_migrations(unordered_migrations)
    return self._migrations

  def _migration_from_file(self, filename: str) -> migration.Migration:
    """Loads a single migration from the given filename in the base dir."""
    module_name = re.sub(r'\W', '_', filename)
    path = os.path.join(self.basedir, filename)
    module = importlib.util.module_from_spec(
        importlib.util.spec_from_file_location(module_name, path))
    importlib.machinery.SourceFileLoader(module_name, path).exec_module(module)
    try:

      result = migration.Migration(module.migration_id,