

def __call__(self, *args, **kw):
    'Call instance class.'
    if args:
        if (not hasattr(self, '_configured')):
            self._configure_django(DEBUG=True)
        if (isinstance(args[0], dict) and (len(args) == 2)):
            for bp in self.blueprint_list:
                self.apply_blueprint(bp)
            return self.wsgi_application(*args)
        if self._is_management_command(args[0]):
            self._handle_management_command(*args, **kw)
            return self
        if isinstance(args[0], list):
            self.update_urls(args[0])
            return self
        if isinstance(args[0], Callable):
            self.add_view('/{}/'.format(args[0].__name__), args[0])
            return args[0]

        def ddecorator(candidate):
            from django.forms import forms
            if isinstance(candidate, forms.DeclarativeFieldsMetaclass):
                self.add_form(args[0], candidate, *args[1:], **kw)
                return candidate
            self.add_view(args[0], candidate, *args[1:], **kw)
            return candidate
        return ddecorator
    else:
        self._configure_django(**kw)
    return self

dataset/ETHPy150Open amitu/importd/importd/__init__.py D.__call__/original