~facundo/magicicada-server/better-settings-local

« back to all changes in this revision

Viewing changes to src/backends/db/tools/schema/__init__.py

  • Committer: Magicicada Bot
  • Author(s): Natalia
  • Date: 2016-05-23 12:25:55 UTC
  • mfrom: (60.1.4 clean-storms)
  • Revision ID: magicicada_bot-20160523122555-nol7mgyv60kmkty2
[r=facundo] - Remove all storm-related bits.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2008-2015 Canonical
2
 
# Copyright 2015 Chicharreros (https://launchpad.net/~chicharreros)
3
 
#
4
 
# This program is free software: you can redistribute it and/or modify
5
 
# it under the terms of the GNU Affero General Public License as
6
 
# published by the Free Software Foundation, either version 3 of the
7
 
# License, or (at your option) any later version.
8
 
#
9
 
# This program is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU Affero General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU Affero General Public License
15
 
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
 
#
17
 
# For further info, check  http://launchpad.net/magicicada-server
18
 
 
19
 
"""Support for Database Schemas"""
20
 
 
21
 
import sys
22
 
import time
23
 
 
24
 
from functools import wraps
25
 
 
26
 
 
27
 
def print_elapsed_time(f):
28
 
    """Decorator to print elapsed time.
29
 
 
30
 
    To format the output nicely, do a:
31
 
      sys.stderr.write("This is what I am doing... ")
32
 
 
33
 
    Note the missing newline at the end.
34
 
    """
35
 
    @wraps(f)
36
 
    def wrapper(*args, **kwargs):
37
 
        """Wrapper."""
38
 
        start = time.time()
39
 
        r = f(*args, **kwargs)
40
 
        end = time.time()
41
 
        sys.stderr.write(" %0.3f ms\n" % ((end - start) * 1000.0))
42
 
        return r
43
 
    return wrapper
44
 
 
45
 
from backends.db.tools.schema.patch import (  # NOQA
46
 
    PatchApplier, UnknownPatchError, BadPatchError)
47
 
from backends.db.tools.schema.schema import Schema  # NOQA