neulab/docprompting-conala huggingface dataset:
dispatch_request()  
Does the request dispatching. Matches the URL and returns the return value of the view or error handler. This does not have to be a response object. In order to convert the return value to a proper response object, call make_response().  Changelog Changed in version 0.7: This no longer does the exception handling, this code was moved to the new full_dispatch_request().   Return type 
Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], Union[Headers, Dict[str, Union[str, List[str], Tuple[str, …]]], List[Tuple[str, Union[str, List[str], Tuple[str, …]]]]]], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int, Union[Headers, Dict[str, Union[str, List[str], Tuple[str, …]]], List[Tuple[str, Union[str, List[str], Tuple[str, …]]]]]], WSGIApplication]
do_teardown_appcontext(exc=<object object>)  
Called right before the application context is popped. When handling a request, the application context is popped after the request context. See do_teardown_request(). This calls all functions decorated with teardown_appcontext(). Then the appcontext_tearing_down signal is sent. This is called by AppContext.pop().  Changelog New in version 0.9.   Parameters 
exc (Optional[BaseException]) –   Return type 
None
do_teardown_request(exc=<object object>)  
Called after the request is dispatched and the response is returned, right before the request context is popped. This calls all functions decorated with teardown_request(), and Blueprint.teardown_request() if a blueprint handled the request. Finally, the request_tearing_down signal is sent. This is called by RequestContext.pop(), which may be delayed during testing to maintain access to resources.  Parameters 
exc (Optional[BaseException]) – An unhandled exception raised while dispatching the request. Detected from the current exception information if not passed. Passed to each teardown function.  Return type 
None    Changelog Changed in version 0.9: Added the exc argument.
ensure_sync(func)  
Ensure that the function is synchronous for WSGI workers. Plain def functions are returned as-is. async def functions are wrapped to run and wait for the response. Override this method to change how the app runs async views.  New in version 2.0.   Parameters 
func (Callable) –   Return type 
Callable
env  
What environment the app is running in. Flask and extensions may enable behaviors based on the environment, such as enabling debug mode. This maps to the ENV config key. This is set by the FLASK_ENV environment variable and may not behave as expected if set in code. Do not enable development when deploying in production. Default: 'production'
extensions: dict  
a place where extensions can store application specific state. For example this is where an extension could store database engines and similar things. The key must match the name of the extension module. For example in case of a “Flask-Foo” extension in flask_foo, the key would be 'foo'.  Changelog New in version 0.7.
full_dispatch_request()  
Dispatches the request and on top of that performs request pre and postprocessing as well as HTTP exception catching and error handling.  Changelog New in version 0.7.   Return type 
flask.wrappers.Response
flask.g  
A namespace object that can store data during an application context. This is an instance of Flask.app_ctx_globals_class, which defaults to ctx._AppCtxGlobals. This is a good place to store resources during a request. During testing, you can use the Faking Resources and Context pattern to pre-configure such resources. This is a proxy. See Notes On Proxies for more information.  Changelog Changed in version 0.10: Bound to the application context instead of the request context.
flask.got_request_exception  
This signal is sent when an unhandled exception happens during request processing, including when debugging. The exception is passed to the subscriber as exception. This signal is not sent for HTTPException, or other exceptions that have error handlers registered, unless the exception was raised from an error handler. This example shows how to do some extra logging if a theoretical SecurityException was raised: from flask import got_request_exception

def log_security_exception(sender, exception, **extra):
    if not isinstance(exception, SecurityException):
        return

    security_logger.exception(
        f"SecurityException at {request.url!r}",
        exc_info=exception,
    )

got_request_exception.connect(log_security_exception, app)
handle_exception(e)  
Handle an exception that did not have an error handler associated with it, or that was raised from an error handler. This always causes a 500 InternalServerError. Always sends the got_request_exception signal. If propagate_exceptions is True, such as in debug mode, the error will be re-raised so that the debugger can display it. Otherwise, the original exception is logged, and an InternalServerError is returned. If an error handler is registered for InternalServerError or 500, it will be used. For consistency, the handler will always receive the InternalServerError. The original unhandled exception is available as e.original_exception.  Changelog Changed in version 1.1.0: Always passes the InternalServerError instance to the handler, setting original_exception to the unhandled error.   Changed in version 1.1.0: after_request functions and other finalization is done even for the default 500 response when there is no handler.   New in version 0.3.   Parameters 
e (Exception) –   Return type 
flask.wrappers.Response
handle_http_exception(e)  
Handles an HTTP exception. By default this will invoke the registered error handlers and fall back to returning the exception as response.  Changelog Changed in version 1.0.3: RoutingException, used internally for actions such as slash redirects during routing, is not passed to error handlers.   Changed in version 1.0: Exceptions are looked up by code and by MRO, so HTTPExcpetion subclasses can be handled with a catch-all handler for the base HTTPException.   New in version 0.3.   Parameters 
e (werkzeug.exceptions.HTTPException) –   Return type 
Union[werkzeug.exceptions.HTTPException, Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], Union[Headers, Dict[str, Union[str, List[str], Tuple[str, …]]], List[Tuple[str, Union[str, List[str], Tuple[str, …]]]]]], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int, Union[Headers, Dict[str, Union[str, List[str], Tuple[str, …]]], List[Tuple[str, Union[str, List[str], Tuple[str, …]]]]]], WSGIApplication]
handle_url_build_error(error, endpoint, values)  
Handle BuildError on url_for().  Parameters 
 
error (Exception) –  
endpoint (str) –  
values (dict) –    Return type 
str
handle_user_exception(e)  
This method is called whenever an exception occurs that should be handled. A special case is HTTPException which is forwarded to the handle_http_exception() method. This function will either return a response value or reraise the exception with the same traceback.  Changelog Changed in version 1.0: Key errors raised from request data like form show the bad key in debug mode rather than a generic bad request message.   New in version 0.7.   Parameters 
e (Exception) –   Return type 
Union[werkzeug.exceptions.HTTPException, Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], Union[Headers, Dict[str, Union[str, List[str], Tuple[str, …]]], List[Tuple[str, Union[str, List[str], Tuple[str, …]]]]]], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int, Union[Headers, Dict[str, Union[str, List[str], Tuple[str, …]]], List[Tuple[str, Union[str, List[str], Tuple[str, …]]]]]], WSGIApplication]
inject_url_defaults(endpoint, values)  
Injects the URL defaults for the given endpoint directly into the values dictionary passed. This is used internally and automatically called on URL building.  Changelog New in version 0.7.   Parameters 
 
endpoint (str) –  
values (dict) –    Return type 
None
instance_path  
Holds the path to the instance folder.  Changelog New in version 0.8.
iter_blueprints()  
Iterates over all blueprints by the order they were registered.  Changelog New in version 0.11.   Return type 
ValuesView[Blueprint]
jinja_options: dict = {}  
Options that are passed to the Jinja environment in create_jinja_environment(). Changing these options after the environment is created (accessing jinja_env) will have no effect.  Changelog Changed in version 1.1.0: This is a dict instead of an ImmutableDict to allow easier configuration.
log_exception(exc_info)  
Logs an exception. This is called by handle_exception() if debugging is disabled and right before the handler is called. The default implementation logs the exception as error on the logger.  Changelog New in version 0.8.   Parameters 
exc_info (Union[Tuple[type, BaseException, types.TracebackType], Tuple[None, None, None]]) –   Return type 
None
make_config(instance_relative=False)  
Used to create the config attribute by the Flask constructor. The instance_relative parameter is passed in from the constructor of Flask (there named instance_relative_config) and indicates if the config should be relative to the instance path or the root path of the application.  Changelog New in version 0.8.   Parameters 
instance_relative (bool) –   Return type 
flask.config.Config
make_default_options_response()  
This method is called to create the default OPTIONS response. This can be changed through subclassing to change the default behavior of OPTIONS responses.  Changelog New in version 0.7.   Return type 
flask.wrappers.Response
make_response(rv)  
Convert the return value from a view function to an instance of response_class.  Parameters 
rv (Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], Union[Headers, Dict[str, Union[str, List[str], Tuple[str, ...]]], List[Tuple[str, Union[str, List[str], Tuple[str, ...]]]]]], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int, Union[Headers, Dict[str, Union[str, List[str], Tuple[str, ...]]], List[Tuple[str, Union[str, List[str], Tuple[str, ...]]]]]], WSGIApplication]) – 
the return value from the view function. The view function must return a response. Returning None, or the view ending without returning, is not allowed. The following types are allowed for view_rv:  
str 

A response object is created with the string encoded to UTF-8 as the body.  
bytes 

A response object is created with the bytes as the body.  
dict 

A dictionary that will be jsonify’d before being returned.  
tuple 

Either (body, status, headers), (body, status), or (body, headers), where body is any of the other types allowed here, status is a string or an integer, and headers is a dictionary or a list of (key, value) tuples. If body is a response_class instance, status overwrites the exiting value and headers are extended.  
response_class


The object is returned unchanged.  
other Response class 

The object is coerced to response_class.  
callable()


The function is called as a WSGI application. The result is used to create a response object.    Return type 
flask.wrappers.Response    Changelog Changed in version 0.9: Previously a tuple was interpreted as the arguments for the response object.
make_shell_context()  
Returns the shell context for an interactive shell for this application. This runs all the registered shell context processors.  Changelog New in version 0.11.   Return type 
dict
flask.message_flashed  
This signal is sent when the application is flashing a message. The messages is sent as message keyword argument and the category as category. Example subscriber: recorded = []
def record(sender, message, category, **extra):
    recorded.append((message, category))

from flask import message_flashed
message_flashed.connect(record, app)
  Changelog New in version 0.10.
open_instance_resource(resource, mode='rb')  
Opens a resource from the application’s instance folder (instance_path). Otherwise works like open_resource(). Instance resources can also be opened for writing.  Parameters 
 
resource (str) – the name of the resource. To access resources within subfolders use forward slashes as separator. 
mode (str) – resource file opening mode, default is ‘rb’.   Return type 
IO
permanent_session_lifetime  
A timedelta which is used to set the expiration date of a permanent session. The default is 31 days which makes a permanent session survive for roughly one month. This attribute can also be configured from the config with the PERMANENT_SESSION_LIFETIME configuration key. Defaults to timedelta(days=31)
preprocess_request()  
Called before the request is dispatched. Calls url_value_preprocessors registered with the app and the current blueprint (if any). Then calls before_request_funcs registered with the app and the blueprint. If any before_request() handler returns a non-None value, the value is handled as if it was the return value from the view, and further request handling is stopped.  Return type 
Optional[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], Union[Headers, Dict[str, Union[str, List[str], Tuple[str, …]]], List[Tuple[str, Union[str, List[str], Tuple[str, …]]]]]], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int], Tuple[Union[Response, AnyStr, Dict[str, Any], Generator[AnyStr, None, None]], int, Union[Headers, Dict[str, Union[str, List[str], Tuple[str, …]]], List[Tuple[str, Union[str, List[str], Tuple[str, …]]]]]], WSGIApplication]]
process_response(response)  
Can be overridden in order to modify the response object before it’s sent to the WSGI server. By default this will call all the after_request() decorated functions.  Changelog Changed in version 0.5: As of Flask 0.5 the functions registered for after request execution are called in reverse order of registration.   Parameters 
response (flask.wrappers.Response) – a response_class object.  Returns 
a new response object or the same, has to be an instance of response_class.  Return type 
flask.wrappers.Response
register_blueprint(blueprint, **options)  
Register a Blueprint on the application. Keyword arguments passed to this method will override the defaults set on the blueprint. Calls the blueprint’s register() method after recording the blueprint in the application’s blueprints.  Parameters 
 
blueprint (Blueprint) – The blueprint to register. 
url_prefix – Blueprint routes will be prefixed with this. 
subdomain – Blueprint routes will match on this subdomain. 
url_defaults – Blueprint routes will use these default values for view arguments. 
options (Any) – Additional keyword arguments are passed to BlueprintSetupState. They can be accessed in record() callbacks.   Return type 
None    Changelog New in version 0.7.
flask.request  
To access incoming request data, you can use the global request object. Flask parses incoming request data for you and gives you access to it through that global object. Internally Flask makes sure that you always get the correct data for the active thread if you are in a multithreaded environment. This is a proxy. See Notes On Proxies for more information. The request object is an instance of a Request.
request_context(environ)  
Create a RequestContext representing a WSGI environment. Use a with block to push the context, which will make request point at this request. See The Request Context. Typically you should not call this from your own code. A request context is automatically pushed by the wsgi_app() when handling a request. Use test_request_context() to create an environment and context instead of this method.  Parameters 
environ (dict) – a WSGI environment  Return type 
flask.ctx.RequestContext
flask.request_finished  
This signal is sent right before the response is sent to the client. It is passed the response to be sent named response. Example subscriber: def log_response(sender, response, **extra):
    sender.logger.debug('Request context is about to close down.  '
                        'Response: %s', response)

from flask import request_finished
request_finished.connect(log_response, app)
flask.request_started  
This signal is sent when the request context is set up, before any request processing happens. Because the request context is already bound, the subscriber can access the request with the standard global proxies such as request. Example subscriber: def log_request(sender, **extra):
    sender.logger.debug('Request context is set up')

from flask import request_started
request_started.connect(log_request, app)
flask.request_tearing_down  
This signal is sent when the request is tearing down. This is always called, even if an exception is caused. Currently functions listening to this signal are called after the regular teardown handlers, but this is not something you can rely on. Example subscriber: def close_db_connection(sender, **extra):
    session.close()

from flask import request_tearing_down
request_tearing_down.connect(close_db_connection, app)
 As of Flask 0.9, this will also be passed an exc keyword argument that has a reference to the exception that caused the teardown if there was one.
run(host=None, port=None, debug=None, load_dotenv=True, **options)  
Runs the application on a local development server. Do not use run() in a production setting. It is not intended to meet security and performance requirements for a production server. Instead, see Deployment Options for WSGI server recommendations. If the debug flag is set the server will automatically reload for code changes and show a debugger in case an exception happened. If you want to run the application in debug mode, but disable the code execution on the interactive debugger, you can pass use_evalex=False as parameter. This will keep the debugger’s traceback screen active, but disable code execution. It is not recommended to use this function for development with automatic reloading as this is badly supported. Instead you should be using the flask command line script’s run support.  Keep in Mind Flask will suppress any server error with a generic error page unless it is in debug mode. As such to enable just the interactive debugger without the code reloading, you have to invoke run() with debug=True and use_reloader=False. Setting use_debugger to True without being in debug mode won’t catch any exceptions because there won’t be any to catch.   Parameters 
 
host (Optional[str]) – the hostname to listen on. Set this to '0.0.0.0' to have the server available externally as well. Defaults to '127.0.0.1' or the host in the SERVER_NAME config variable if present. 
port (Optional[int]) – the port of the webserver. Defaults to 5000 or the port defined in the SERVER_NAME config variable if present. 
debug (Optional[bool]) – if given, enable or disable debug mode. See debug. 
load_dotenv (bool) – Load the nearest .env and .flaskenv files to set environment variables. Will also change the working directory to the directory containing the first file found. 
options (Any) – the options to be forwarded to the underlying Werkzeug server. See werkzeug.serving.run_simple() for more information.   Return type 
None    Changelog Changed in version 1.0: If installed, python-dotenv will be used to load environment variables from .env and .flaskenv files. If set, the FLASK_ENV and FLASK_DEBUG environment variables will override env and debug. Threaded mode is enabled by default.   Changed in version 0.10: The default port is now picked from the SERVER_NAME variable.
secret_key  
If a secret key is set, cryptographic components can use this to sign cookies and other things. Set this to a complex random value when you want to use the secure cookie for instance. This attribute can also be configured from the config with the SECRET_KEY configuration key. Defaults to None.
select_jinja_autoescape(filename)  
Returns True if autoescaping should be active for the given template name. If no template name is given, returns True.  Changelog New in version 0.5.   Parameters 
filename (str) –   Return type 
bool
send_file_max_age_default  
A timedelta or number of seconds which is used as the default max_age for send_file(). The default is None, which tells the browser to use conditional requests instead of a timed cache. Configured with the SEND_FILE_MAX_AGE_DEFAULT configuration key.  Changed in version 2.0: Defaults to None instead of 12 hours.
session_cookie_name  
The secure cookie uses this for the name of the session cookie. This attribute can also be configured from the config with the SESSION_COOKIE_NAME configuration key. Defaults to 'session'
session_interface = <flask.sessions.SecureCookieSessionInterface object>  
the session interface to use. By default an instance of SecureCookieSessionInterface is used here.  Changelog New in version 0.8.
shell_context_processor(f)  
Registers a shell context processor function.  Changelog New in version 0.11.   Parameters 
f (Callable) –   Return type 
Callable
shell_context_processors: t.List[t.Callable[], t.Dict[str, t.Any]]]  
A list of shell context processor functions that should be run when a shell context is created.  Changelog New in version 0.11.
should_ignore_error(error)  
This is called to figure out if an error should be ignored or not as far as the teardown system is concerned. If this function returns True then the teardown handlers will not be passed the error.  Changelog New in version 0.10.   Parameters 
error (Optional[BaseException]) –   Return type 
bool
signals.signals_available  
True if the signaling system is available. This is the case when blinker is installed.
teardown_appcontext(f)  
Registers a function to be called when the application context ends. These functions are typically also called when the request context is popped. Example: ctx = app.app_context()
ctx.push()
...
ctx.pop()
 When ctx.pop() is executed in the above example, the teardown functions are called just before the app context moves from the stack of active contexts. This becomes relevant if you are using such constructs in tests. Since a request context typically also manages an application context it would also be called when you pop a request context. When a teardown function was called because of an unhandled exception it will be passed an error object. If an errorhandler() is registered, it will handle the exception and the teardown will not receive it. The return values of teardown functions are ignored.  Changelog New in version 0.9.   Parameters 
f (Callable[[Optional[BaseException]], flask.wrappers.Response]) –   Return type 
Callable[[Optional[BaseException]], flask.wrappers.Response]
teardown_appcontext_funcs: t.List[TeardownCallable]  
A list of functions that are called when the application context is destroyed. Since the application context is also torn down if the request ends this is the place to store code that disconnects from databases.  Changelog New in version 0.9.
template_filter(name=None)  
A decorator that is used to register custom template filter. You can specify a name for the filter, otherwise the function name will be used. Example: @app.template_filter()
def reverse(s):
    return s[::-1]
  Parameters 
name (Optional[str]) – the optional name of the filter, otherwise the function name will be used.  Return type 
Callable