def register(self, collection=None, flags=None):
        def decorate(func):
            funcname = func.__name__
            module = collection
            myflags = flags
            if module is None:
                module = func.__module__.split('.')[-1]

            if module not in self.registry:
                self.registry[module] = {}
            if module not in self.defs:
                self.defs[module] = []

            if myflags is None:
                myflags = {}

            args = inspect.getargspec(func)[0]
            infos = {'name': funcname, 'len': len(args)}
            infos.update(myflags)
            self.defs[module].append(infos)
            self.registry[module][funcname] = func

            return func
        return decorate
dataset/ETHPy150Open paparent/Flask-ExtDirect/flaskext/extdirect.py/ExtDirect.register/original