Configure setup for Sphinx extension.

    :param app: Sphinx application context.
515457
def setup(app):
    
    app.add_config_value('sphinxmark_enable', False, 'html')
    app.add_config_value('sphinxmark_div', 'default', 'html')
    app.add_config_value('sphinxmark_border', None, 'html')
    app.add_config_value('sphinxmark_repeat', True, 'html')
    app.add_config_value('sphinxmark_fixed', False, 'html')
    app.add_config_value('sphinxmark_image', 'default', 'html')
    app.add_config_value('sphinxmark_text', 'default', 'html')
    app.add_config_value('sphinxmark_text_color', (255, 0, 0), 'html')
    app.add_config_value('sphinxmark_text_size', 100, 'html')
    app.add_config_value('sphinxmark_text_width', 1000, 'html')
    app.add_config_value('sphinxmark_text_opacity', 20, 'html')
    app.add_config_value('sphinxmark_text_spacing', 400, 'html')
    app.add_config_value('sphinxmark_text_rotation', 0, 'html')
    app.connect('env-updated', watermark)

    return {
        'version': '0.1.18',
        'parallel_read_safe': True,
        'parallel_write_safe': True,
    }
372898
def init_app(self, app):
        

        self.__app = app
        self.__app.before_first_request(self.__setup)

        self.tracer.enabled = self.__app.config.get('TRACE_ENABLED', self.tracer.enabled)
1045377
def init_app(self, app, decorators=None):
        
        self.decorators = decorators or self.decorators
        self.app = app

        self.load_config(app)
        # self.load_apispec(app)
        if self.template_file is not None:
            self.template = self.load_swagger_file(self.template_file)
        self.register_views(app)
        self.add_headers(app)

        if self.parse:
            if RequestParser is None:
                raise RuntimeError('Please install flask_restful')
            self.parsers = {}
            self.schemas = {}
            self.format_checker = jsonschema.FormatChecker()
            self.parse_request(app)

        self._configured = True
        app.swag = self
49627
def init_app(self, app):
        
        self.init_extension(app)

        if not hasattr(app, 'extensions'):
            app.extensions = {}
        classname = self.__class__.__name__
        extname = classname.replace('Flask', '').lower()
        app.extensions[extname] = self
218948
def setup(self, app):
        
        super().setup(app)

        self.handlers = OrderedDict()

        # Connect admin templates
        app.ps.jinja2.cfg.template_folders.append(op.join(PLUGIN_ROOT, 'templates'))

        @app.ps.jinja2.filter
        def admtest(value, a, b=None):
            return a if value else b

        @app.ps.jinja2.filter
        def admeq(a, b, result=True):
            return result if a == b else not result

        @app.ps.jinja2.register
        def admurl(request, prefix):
            qs = {k: v for k, v in request.query.items() if not k.startswith(prefix)}
            if not qs:
                qs = {'ap': 0}
            return "%s?%s" % (request.path, urlparse.urlencode(qs))

        if self.cfg.name is None:
            self.cfg.name = "%s admin" % app.name.title()

        # Register a base view
        if not callable(self.cfg.home):

            def admin_home(request):
                yield from self.authorize(request)
                return app.ps.jinja2.render(self.cfg.template_home, active=None)

            self.cfg.home = admin_home

        app.register(self.cfg.prefix)(self.cfg.home)

        if not self.cfg.i18n:
            app.ps.jinja2.env.globals.update({
                '_': lambda s: s,
                'gettext': lambda s: s,
                'ngettext': lambda s, p, n: (n != 1 and (p,) or (s,))[0],
            })

            return

        if 'babel' not in app.ps or not isinstance(app.ps.babel, BPlugin):
            raise PluginException(
                'Plugin `%s` requires for plugin `%s` to be installed to the application.' % (
                    self.name, BPlugin))

        # Connect admin locales
        app.ps.babel.cfg.locales_dirs.append(op.join(PLUGIN_ROOT, 'locales'))
        if not app.ps.babel.locale_selector_func:
            app.ps.babel.locale_selector_func = app.ps.babel.select_locale_by_request
437417
def setup(app: Sphinx):
    

    # Scan for directives, first in the system, second in the docs project
    importscan.scan(plugins)
    dectate.commit(kb)

    app.add_config_value('kaybee_settings', KaybeeSettings(), 'html')
    bridge = 'kaybee.plugins.postrenderer.config.KaybeeBridge'
    app.config.template_bridge = bridge

    app.connect('env-updated', flush_everything)
    app.connect(SphinxEvent.BI.value,
                # pragma nocover
                lambda sphinx_app: EventAction.call_builder_init(
                    kb, sphinx_app)
                )
    app.connect(SphinxEvent.EPD.value,
                # pragma nocover
                lambda sphinx_app, sphinx_env,
                       docname: EventAction.call_purge_doc(
                    kb, sphinx_app, sphinx_env, docname)
                )

    app.connect(SphinxEvent.EBRD.value,
                # pragma nocover
                lambda sphinx_app, sphinx_env,
                       docnames: EventAction.call_env_before_read_docs(
                    kb, sphinx_app, sphinx_env, docnames)
                )

    app.connect(SphinxEvent.DREAD.value,
                # pragma nocover
                lambda sphinx_app,
                       doctree: EventAction.call_env_doctree_read(
                    kb, sphinx_app, doctree)
                )

    app.connect(SphinxEvent.DRES.value,
                # pragma nocover
                lambda sphinx_app, doctree,
                       fromdocname: EventAction.call_doctree_resolved(
                    kb, sphinx_app, doctree, fromdocname)
                )

    app.connect(SphinxEvent.EU.value,
                # pragma nocover
                lambda sphinx_app, sphinx_env: EventAction.call_env_updated(
                    kb, sphinx_app, sphinx_env)
                )

    app.connect(SphinxEvent.HCP.value,
                # pragma nocover
                lambda sphinx_app: EventAction.call_html_collect_pages(
                    kb, sphinx_app)
                )

    app.connect(SphinxEvent.ECC.value,
                # pragma nocover
                lambda sphinx_builder,
                       sphinx_env: EventAction.call_env_check_consistency(
                    kb, sphinx_builder, sphinx_env)
                )

    app.connect(SphinxEvent.MR.value,
                # pragma nocover
                lambda sphinx_app, sphinx_env, node,
                       contnode: EventAction.call_missing_reference(
                    kb, sphinx_app, sphinx_env, node, contnode)
                )

    app.connect(SphinxEvent.HPC.value,
                # pragma nocover
                lambda sphinx_app, pagename, templatename, context,
                       doctree: EventAction.call_html_page_context(
                    kb, sphinx_app, pagename, templatename, context, doctree)
                )

    return dict(
        version=__version__,
        parallel_read_safe=False
    )
412780
def setup_application (self):
    
    # figure out precise method name, specific to this use
    name = 'configure_%s_app' % self.parent.name
    # call generic set up method
    getattr(self.method, 'configure_app', self._no_op_setup)(self, self.parser)
    # call specific set up method
    getattr(self.method, name, self._no_op_setup)(self, self.parser)
486164
def config_extensions(app):
    "  "

    cache.init_app(app)
    db.init_app(app)
    main.init_app(app)
    collect.init_app(app)

    config_babel(app)
319920
def setup_app(command, conf, vars):
    """"""
    load_environment(conf.global_conf, conf.local_conf)
    setup_schema(command, conf, vars)
    bootstrap.bootstrap(command, conf, vars)
399707
def setup(app):
    """"""
    sphinx_compatibility._app = app

    app.add_config_value('sphinx_gallery_conf', DEFAULT_GALLERY_CONF, 'html')
    for key in ['plot_gallery', 'abort_on_example_error']:
        app.add_config_value(key, get_default_config_value(key), 'html')

    try:
        app.add_css_file('gallery.css')
    except AttributeError:  # Sphinx < 1.8
        app.add_stylesheet('gallery.css')

    # Sphinx < 1.6 calls it `_extensions`, >= 1.6 is `extensions`.
    extensions_attr = '_extensions' if hasattr(
        app, '_extensions') else 'extensions'
    if 'sphinx.ext.autodoc' in getattr(app, extensions_attr):
        app.connect('autodoc-process-docstring', touch_empty_backreferences)

    app.connect('builder-inited', generate_gallery_rst)
    app.connect('build-finished', copy_binder_files)
    app.connect('build-finished', summarize_failing_examples)
    app.connect('build-finished', embed_code_links)
    metadata = {'parallel_read_safe': True,
                'parallel_write_safe': False,
                'version': _sg_version}
    return metadata
1296552
def setup_app(self, app, add_context_processor=True):  # pragma: no cover
        '''
        
        '''
        warnings.warn('Warning setup_app is deprecated. Please use init_app.',
                      DeprecationWarning)
        self.init_app(app, add_context_processor)
1037826
def setup(self, app: web.Application):
        
        if self.app is app:
            raise ValueError('The router is already configured '
                             'for this application')
        self.app = app
        routes = sorted(
            ((r.name, (r, r.url_for().human_repr())) for r in self.routes()),
            key=utils.sort_key)
        exists = set()  # type: Set[str]
        for name, (route, path) in routes:
            if name and name not in exists:
                exists.add(name)
            else:
                name = None
            app.router.add_route(
                route.method, path,
                route.handler, name=name)
389692
def setup(app) -> Dict[str, Any]:
    
    app.add_config_value("uqbar_api_directory_name", "api", "env")
    app.add_config_value("uqbar_api_document_empty_modules", False, "env")
    app.add_config_value("uqbar_api_document_private_members", False, "env")
    app.add_config_value("uqbar_api_document_private_modules", False, "env")
    app.add_config_value("uqbar_api_member_documenter_classes", None, "env")
    app.add_config_value("uqbar_api_module_documenter_class", None, "env")
    app.add_config_value("uqbar_api_root_documenter_class", None, "env")
    app.add_config_value("uqbar_api_source_paths", None, "env")
    app.add_config_value("uqbar_api_title", "API", "html")
    app.connect("builder-inited", on_builder_inited)
    return {
        "version": uqbar.__version__,
        "parallel_read_safe": True,
        "parallel_write_safe": True,
    }
713218
def init_app(self, app):
        
        if (
            'SQLALCHEMY_DATABASE_URI' not in app.config and
            'SQLALCHEMY_BINDS' not in app.config
        ):
            warnings.warn(
                'Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. '
                'Defaulting SQLALCHEMY_DATABASE_URI to "sqlite:///:memory:".'
            )

        app.config.setdefault('SQLALCHEMY_DATABASE_URI', 'sqlite:///:memory:')
        app.config.setdefault('SQLALCHEMY_BINDS', None)
        app.config.setdefault('SQLALCHEMY_NATIVE_UNICODE', None)
        app.config.setdefault('SQLALCHEMY_ECHO', False)
        app.config.setdefault('SQLALCHEMY_RECORD_QUERIES', None)
        app.config.setdefault('SQLALCHEMY_POOL_SIZE', None)
        app.config.setdefault('SQLALCHEMY_POOL_TIMEOUT', None)
        app.config.setdefault('SQLALCHEMY_POOL_RECYCLE', None)
        app.config.setdefault('SQLALCHEMY_MAX_OVERFLOW', None)
        app.config.setdefault('SQLALCHEMY_COMMIT_ON_TEARDOWN', False)
        track_modifications = app.config.setdefault(
            'SQLALCHEMY_TRACK_MODIFICATIONS', None
        )
        app.config.setdefault('SQLALCHEMY_ENGINE_OPTIONS', {})

        if track_modifications is None:
            warnings.warn(FSADeprecationWarning(
                'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
                'will be disabled by default in the future.  Set it to True '
                'or False to suppress this warning.'
            ))

        # Deprecation warnings for config keys that should be replaced by SQLALCHEMY_ENGINE_OPTIONS.
        utils.engine_config_warning(app.config, '3.0', 'SQLALCHEMY_POOL_SIZE', 'pool_size')
        utils.engine_config_warning(app.config, '3.0', 'SQLALCHEMY_POOL_TIMEOUT', 'pool_timeout')
        utils.engine_config_warning(app.config, '3.0', 'SQLALCHEMY_POOL_RECYCLE', 'pool_recycle')
        utils.engine_config_warning(app.config, '3.0', 'SQLALCHEMY_MAX_OVERFLOW', 'max_overflow')

        app.extensions['sqlalchemy'] = _SQLAlchemyState(self)

        @app.teardown_appcontext
        def shutdown_session(response_or_exc):
            if app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN']:
                if response_or_exc is None:
                    self.session.commit()

            self.session.remove()
            return response_or_exc
662725
def init_app(self, app):
        
        if not hasattr(app, 'extensions'):
            app.extensions = {}

        service_name = app.config.get('GSSAPI_SERVICE_NAME', 'HTTP')
        hostname = app.config.get('GSSAPI_HOSTNAME', socket.getfqdn())
        principal = '{}@{}'.format(service_name, hostname)
        name = gssapi.Name(principal, gssapi.NameType.hostbased_service)

        app.extensions['gssapi'] = {
            'creds': gssapi.Credentials(name=name, usage='accept'),
        }
177948
def init_app(self, app):
        
        app.config.setdefault('PRETTIFY', False)

        if app.config['PRETTIFY']:
            app.after_request(self._prettify_response)
1315523
def setup(app):
    '''  '''

    # These two are deprecated and no longer have any effect, to be removed 2.0
    app.add_config_value('bokeh_plot_pyfile_include_dirs', [], 'html')
    app.add_config_value('bokeh_plot_use_relative_paths', False, 'html')

    app.add_directive('bokeh-plot', BokehPlotDirective)
    app.add_config_value('bokeh_missing_google_api_key_ok', True, 'html')
    app.connect('builder-inited', builder_inited)
    app.connect('build-finished', build_finished)