mercurial/registrar.py
author timeless <timeless@mozdev.org>
Tue, 01 Mar 2016 09:48:11 +0000
changeset 28300 15c5f50e7e13
parent 27585 60bf90eb8bf8
child 28392 b983a2f04987
permissions -rw-r--r--
zeroconf: add whitespace around operator
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27583
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     1
# registrar.py - utilities to register function for specific purpose
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     2
#
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     3
#  Copyright FUJIWARA Katsunori <foozy@lares.dti.ne.jp> and others
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     4
#
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     5
# This software may be used and distributed according to the terms of the
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     6
# GNU General Public License version 2 or any later version.
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     7
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     8
from __future__ import absolute_import
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
     9
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    10
from . import (
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    11
    util,
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    12
)
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    13
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    14
class funcregistrar(object):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    15
    """Base of decorator to register a fuction for specific purpose
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    16
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    17
    The least derived class can be defined by overriding 'table' and
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    18
    'formatdoc', for example::
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    19
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    20
        symbols = {}
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    21
        class keyword(funcregistrar):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    22
            table = symbols
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    23
            formatdoc = ":%s: %s"
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    24
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    25
        @keyword('bar')
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    26
        def barfunc(*args, **kwargs):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    27
            '''Explanation of bar keyword ....
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    28
            '''
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    29
            pass
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    30
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    31
    In this case:
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    32
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    33
    - 'barfunc' is registered as 'bar' in 'symbols'
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    34
    - online help uses ":bar: Explanation of bar keyword"
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    35
    """
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    36
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    37
    def __init__(self, decl):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    38
        """'decl' is a name or more descriptive string of a function
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    39
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    40
        Specification of 'decl' depends on registration purpose.
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    41
        """
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    42
        self.decl = decl
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    43
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    44
    table = None
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    45
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    46
    def __call__(self, func):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    47
        """Execute actual registration for specified function
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    48
        """
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    49
        name = self.getname()
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    50
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    51
        if func.__doc__ and not util.safehasattr(func, '_origdoc'):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    52
            doc = func.__doc__.strip()
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    53
            func._origdoc = doc
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    54
            if callable(self.formatdoc):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    55
                func.__doc__ = self.formatdoc(doc)
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    56
            else:
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    57
                # convenient shortcut for simple format
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    58
                func.__doc__ = self.formatdoc % (self.decl, doc)
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    59
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    60
        self.table[name] = func
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    61
        self.extraaction(name, func)
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    62
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    63
        return func
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    64
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    65
    def getname(self):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    66
        """Return the name of the registered function from self.decl
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    67
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    68
        Derived class should override this, if it allows more
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    69
        descriptive 'decl' string than just a name.
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    70
        """
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    71
        return self.decl
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    72
27584
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    73
    def parsefuncdecl(self):
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    74
        """Parse function declaration and return the name of function in it
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    75
        """
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    76
        i = self.decl.find('(')
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    77
        if i > 0:
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    78
            return self.decl[:i]
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    79
        else:
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    80
            return self.decl
fc7c8cac6a4b revset: use decorator to register a function as revset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27583
diff changeset
    81
27583
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    82
    def formatdoc(self, doc):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    83
        """Return formatted document of the registered function for help
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    84
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    85
        'doc' is '__doc__.strip()' of the registered function.
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    86
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    87
        If this is overridden by non-callable object in derived class,
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    88
        such value is treated as "format string" and used to format
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    89
        document by 'self.formatdoc % (self.decl, doc)' for convenience.
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    90
        """
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    91
        raise NotImplementedError()
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    92
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    93
    def extraaction(self, name, func):
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    94
        """Execute exra action for registered function, if needed
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    95
        """
37d50250b696 registrar: add funcregistrar class to register function for specific purpose
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff changeset
    96
        pass
27585
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
    97
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
    98
class delayregistrar(object):
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
    99
    """Decorator to delay actual registration until uisetup or so
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   100
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   101
    For example, the decorator class to delay registration by
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   102
    'keyword' funcregistrar can be defined as below::
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   103
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   104
        class extkeyword(delayregistrar):
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   105
            registrar = keyword
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   106
    """
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   107
    def __init__(self):
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   108
        self._list = []
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   109
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   110
    registrar = None
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   111
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   112
    def __call__(self, *args, **kwargs):
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   113
        """Return the decorator to delay actual registration until setup
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   114
        """
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   115
        assert self.registrar is not None
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   116
        def decorator(func):
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   117
            # invocation of self.registrar() here can detect argument
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   118
            # mismatching immediately
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   119
            self._list.append((func, self.registrar(*args, **kwargs)))
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   120
            return func
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   121
        return decorator
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   122
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   123
    def setup(self):
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   124
        """Execute actual registration
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   125
        """
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   126
        while self._list:
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   127
            func, decorator = self._list.pop(0)
60bf90eb8bf8 registrar: add delayregistrar class to register function in extensions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27584
diff changeset
   128
            decorator(func)