neulab/docprompting-conala huggingface dataset:
closest(x, y)[source]
 
Return index and pixel distance to closest handle.  Parameters 
 
x, yfloat


x, y position from which the distance will be calculated to determinate the closest handle    Returns 
 
index, distanceindex of the handle and its distance from


position x, y
set_data(positions)[source]
 
Set x or y positions of handles, depending if the lines are vertical of horizontal.  Parameters 
 
positionstuple of length 2


Set the positions of the handle in data coordinates
classmatplotlib.widgets.Widget[source]
 
Bases: object Abstract base class for GUI neutral widgets.   propertyactive
 
Is the widget active? 
   drawon=True

   eventson=True

   get_active()[source]
 
Get whether the widget is active. 
   ignore(event)[source]
 
Return whether event should be ignored. This method should be called at the beginning of any event callback. 
   set_active(active)[source]
 
Set whether the widget is active.
ignore(event)[source]
 
Return whether event should be ignored. This method should be called at the beginning of any event callback.
flask.abort(status, *args, **kwargs)  
Raises an HTTPException for the given status code or WSGI application. If a status code is given, it will be looked up in the list of exceptions and will raise that exception. If passed a WSGI application, it will wrap it in a proxy WSGI exception and raise that: abort(404)  # 404 Not Found
abort(Response('Hello World'))
  Parameters 
 
status (Union[int, Response]) –  
args (Any) –  
kwargs (Any) –    Return type 
NoReturn
flask.after_this_request(f)  
Executes a function after this request. This is useful to modify response objects. The function is passed the response object and has to return the same or a new one. Example: @app.route('/')
def index():
    @after_this_request
    def add_header(response):
        response.headers['X-Foo'] = 'Parachute'
        return response
    return 'Hello World!'
 This is more useful if a function other than the view function wants to modify a response. For instance think of a decorator that wants to add some headers without converting the return value into a response object.  Changelog New in version 0.9.   Parameters 
f (Callable[[Response], Response]) –   Return type 
Callable[[Response], Response]
class flask.ctx.AppContext(app)  
The application context binds an application object implicitly to the current thread or greenlet, similar to how the RequestContext binds request information. The application context is also implicitly created if a request context is created but the application is not on top of the individual application context.  Parameters 
app (Flask) –   Return type 
None    
pop(exc=<object object>)  
Pops the app context.  Parameters 
exc (Optional[BaseException]) –   Return type 
None   
  
push()  
Binds the app context to the current context.  Return type 
None
pop(exc=<object object>)  
Pops the app context.  Parameters 
exc (Optional[BaseException]) –   Return type 
None
push()  
Binds the app context to the current context.  Return type 
None
class flask.cli.AppGroup(name=None, commands=None, **attrs)  
This works similar to a regular click Group but it changes the behavior of the command() decorator so that it automatically wraps the functions in with_appcontext(). Not to be confused with FlaskGroup.  Parameters 
 
name (Optional[str]) –  
commands (Optional[Union[Dict[str, click.core.Command], Sequence[click.core.Command]]]) –  
attrs (Any) –    Return type 
None    
command(*args, **kwargs)  
This works exactly like the method of the same name on a regular click.Group but it wraps callbacks in with_appcontext() unless it’s disabled by passing with_appcontext=False. 
  
group(*args, **kwargs)  
This works exactly like the method of the same name on a regular click.Group but it defaults the group class to AppGroup.
command(*args, **kwargs)  
This works exactly like the method of the same name on a regular click.Group but it wraps callbacks in with_appcontext() unless it’s disabled by passing with_appcontext=False.
group(*args, **kwargs)  
This works exactly like the method of the same name on a regular click.Group but it defaults the group class to AppGroup.
APPLICATION_ROOT  
Inform the application what path it is mounted under by the application / web server. This is used for generating URLs outside the context of a request (inside a request, the dispatcher is responsible for setting SCRIPT_NAME instead; see Application Dispatching for examples of dispatch configuration). Will be used for the session cookie path if SESSION_COOKIE_PATH is not set. Default: '/'
ASGI If you’d like to use an ASGI server you will need to utilise WSGI to ASGI middleware. The asgiref [WsgiToAsgi](https://github.com/django/asgiref#wsgi-to-asgi-adapter) adapter is recommended as it integrates with the event loop used for Flask’s Using async and await support. You can use the adapter by wrapping the Flask app, from asgiref.wsgi import WsgiToAsgi
from flask import Flask

app = Flask(__name__)

...

asgi_app = WsgiToAsgi(app)
 and then serving the asgi_app with the asgi server, e.g. using Hypercorn, $ hypercorn module:asgi_app
add_app_template_filter(f, name=None)  
Register a custom template filter, available application wide. Like Flask.add_template_filter() but for a blueprint. Works exactly like the app_template_filter() decorator.  Parameters 
 
name (Optional[str]) – the optional name of the filter, otherwise the function name will be used. 
f (Callable[[Any], str]) –    Return type 
None
add_app_template_global(f, name=None)  
Register a custom template global, available application wide. Like Flask.add_template_global() but for a blueprint. Works exactly like the app_template_global() decorator.  Changelog New in version 0.10.   Parameters 
 
name (Optional[str]) – the optional name of the global, otherwise the function name will be used. 
f (Callable[[], Any]) –    Return type 
None
add_app_template_test(f, name=None)  
Register a custom template test, available application wide. Like Flask.add_template_test() but for a blueprint. Works exactly like the app_template_test() decorator.  Changelog New in version 0.10.   Parameters 
 
name (Optional[str]) – the optional name of the test, otherwise the function name will be used. 
f (Callable[[Any], bool]) –    Return type 
None
add_url_rule(rule, endpoint=None, view_func=None, **options)  
Like Flask.add_url_rule() but for a blueprint. The endpoint for the url_for() function is prefixed with the name of the blueprint.  Parameters 
 
rule (str) –  
endpoint (Optional[str]) –  
view_func (Optional[Callable]) –  
options (Any) –    Return type 
None
after_app_request(f)  
Like Flask.after_request() but for a blueprint. Such a function is executed after each request, even if outside of the blueprint.  Parameters 
f (Callable[[Response], Response]) –   Return type 
Callable[[Response], Response]
after_request(f)  
Register a function to run after each request to this object. The function is called with the response object, and must return a response object. This allows the functions to modify or replace the response before it is sent. If a function raises an exception, any remaining after_request functions will not be called. Therefore, this should not be used for actions that must execute, such as to close resources. Use teardown_request() for that.  Parameters 
f (Callable[[Response], Response]) –   Return type 
Callable[[Response], Response]
after_request_funcs: t.Dict[AppOrBlueprintKey, t.List[AfterRequestCallable]]  
A data structure of functions to call at the end of each request, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests. To register a function, use the after_request() decorator. This data structure is internal. It should not be modified directly and its format may change at any time.
app_context_processor(f)  
Like Flask.context_processor() but for a blueprint. Such a function is executed each request, even if outside of the blueprint.  Parameters 
f (Callable[[], Dict[str, Any]]) –   Return type 
Callable[[], Dict[str, Any]]
app_errorhandler(code)  
Like Flask.errorhandler() but for a blueprint. This handler is used for all requests, even if outside of the blueprint.  Parameters 
code (Union[Type[Exception], int]) –   Return type 
Callable
app_template_filter(name=None)  
Register a custom template filter, available application wide. Like Flask.template_filter() but for a blueprint.  Parameters 
name (Optional[str]) – the optional name of the filter, otherwise the function name will be used.  Return type 
Callable
app_template_global(name=None)  
Register a custom template global, available application wide. Like Flask.template_global() but for a blueprint.  Changelog New in version 0.10.   Parameters 
name (Optional[str]) – the optional name of the global, otherwise the function name will be used.  Return type 
Callable
app_template_test(name=None)  
Register a custom template test, available application wide. Like Flask.template_test() but for a blueprint.  Changelog New in version 0.10.   Parameters 
name (Optional[str]) – the optional name of the test, otherwise the function name will be used.  Return type 
Callable
app_url_defaults(f)  
Same as url_defaults() but application wide.  Parameters 
f (Callable[[str, dict], None]) –   Return type 
Callable[[str, dict], None]
app_url_value_preprocessor(f)  
Same as url_value_preprocessor() but application wide.  Parameters 
f (Callable[[Optional[str], Optional[dict]], None]) –   Return type 
Callable[[Optional[str], Optional[dict]], None]
before_app_first_request(f)  
Like Flask.before_first_request(). Such a function is executed before the first request to the application.  Parameters 
f (Callable[[], None]) –   Return type 
Callable[[], None]
before_app_request(f)  
Like Flask.before_request(). Such a function is executed before each request, even if outside of a blueprint.  Parameters 
f (Callable[[], None]) –   Return type 
Callable[[], None]
before_request(f)  
Register a function to run before each request. For example, this can be used to open a database connection, or to load the logged in user from the session. @app.before_request
def load_user():
    if "user_id" in session:
        g.user = db.session.get(session["user_id"])
 The function will be called without any arguments. If it 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.  Parameters 
f (Callable[[], None]) –   Return type 
Callable[[], None]
before_request_funcs: t.Dict[AppOrBlueprintKey, t.List[BeforeRequestCallable]]  
A data structure of functions to call at the beginning of each request, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests. To register a function, use the before_request() decorator. This data structure is internal. It should not be modified directly and its format may change at any time.
cli  
The Click command group for registering CLI commands for this object. The commands are available from the flask command once the application has been discovered and blueprints have been registered.
context_processor(f)  
Registers a template context processor function.  Parameters 
f (Callable[[], Dict[str, Any]]) –   Return type 
Callable[[], Dict[str, Any]]
delete(rule, **options)  
Shortcut for route() with methods=["DELETE"].  New in version 2.0.   Parameters 
 
rule (str) –  
options (Any) –    Return type 
Callable
endpoint(endpoint)  
Decorate a view function to register it for the given endpoint. Used if a rule is added without a view_func with add_url_rule(). app.add_url_rule("/ex", endpoint="example")

@app.endpoint("example")
def example():
    ...
  Parameters 
endpoint (str) – The endpoint name to associate with the view function.  Return type 
Callable
errorhandler(code_or_exception)  
Register a function to handle errors by code or exception class. A decorator that is used to register a function given an error code. Example: @app.errorhandler(404)
def page_not_found(error):
    return 'This page does not exist', 404
 You can also register handlers for arbitrary exceptions: @app.errorhandler(DatabaseError)
def special_exception_handler(error):
    return 'Database connection failed', 500
  Changelog New in version 0.7: Use register_error_handler() instead of modifying error_handler_spec directly, for application wide error handlers.   New in version 0.7: One can now additionally also register custom exception types that do not necessarily have to be a subclass of the HTTPException class.   Parameters 
code_or_exception (Union[Type[Exception], int]) – the code as integer for the handler, or an arbitrary exception  Return type 
Callable
error_handler_spec: t.Dict[AppOrBlueprintKey, t.Dict[t.Optional[int], t.Dict[t.Type[Exception], ErrorHandlerCallable]]]  
A data structure of registered error handlers, in the format {scope: {code: {class: handler}}}`. The scope key is the name of a blueprint the handlers are active for, or None for all requests. The code key is the HTTP status code for HTTPException, or None for other exceptions. The innermost dictionary maps exception classes to handler functions. To register an error handler, use the errorhandler() decorator. This data structure is internal. It should not be modified directly and its format may change at any time.
get(rule, **options)  
Shortcut for route() with methods=["GET"].  New in version 2.0.   Parameters 
 
rule (str) –  
options (Any) –    Return type 
Callable
get_send_file_max_age(filename)  
Used by send_file() to determine the max_age cache value for a given file path if it wasn’t passed. By default, this returns SEND_FILE_MAX_AGE_DEFAULT from the configuration of current_app. This defaults to None, which tells the browser to use conditional requests instead of a timed cache, which is usually preferable.  Changed in version 2.0: The default configuration is None instead of 12 hours.   Changelog New in version 0.9.   Parameters 
filename (str) –   Return type 
Optional[int]
import_name  
The name of the package or module that this object belongs to. Do not change this once it is set by the constructor.
json_decoder: Optional[Type[json.decoder.JSONDecoder]] = None  
Blueprint local JSON decoder class to use. Set to None to use the app’s json_decoder.
json_encoder: Optional[Type[json.encoder.JSONEncoder]] = None  
Blueprint local JSON encoder class to use. Set to None to use the app’s json_encoder.
make_setup_state(app, options, first_registration=False)  
Creates an instance of BlueprintSetupState() object that is later passed to the register callback functions. Subclasses can override this to return a subclass of the setup state.  Parameters 
 
app (Flask) –  
options (dict) –  
first_registration (bool) –    Return type 
flask.blueprints.BlueprintSetupState
open_resource(resource, mode='rb')  
Open a resource file relative to root_path for reading. For example, if the file schema.sql is next to the file app.py where the Flask app is defined, it can be opened with: with app.open_resource("schema.sql") as f:
    conn.executescript(f.read())
  Parameters 
 
resource (str) – Path to the resource relative to root_path. 
mode (str) – Open the file in this mode. Only reading is supported, valid values are “r” (or “rt”) and “rb”.   Return type 
IO
patch(rule, **options)  
Shortcut for route() with methods=["PATCH"].  New in version 2.0.   Parameters 
 
rule (str) –  
options (Any) –    Return type 
Callable
post(rule, **options)  
Shortcut for route() with methods=["POST"].  New in version 2.0.   Parameters 
 
rule (str) –  
options (Any) –    Return type 
Callable
put(rule, **options)  
Shortcut for route() with methods=["PUT"].  New in version 2.0.   Parameters 
 
rule (str) –  
options (Any) –    Return type 
Callable
record(func)  
Registers a function that is called when the blueprint is registered on the application. This function is called with the state as argument as returned by the make_setup_state() method.  Parameters 
func (Callable) –   Return type 
None
record_once(func)  
Works like record() but wraps the function in another function that will ensure the function is only called once. If the blueprint is registered a second time on the application, the function passed is not called.  Parameters 
func (Callable) –   Return type 
None
register(app, options)  
Called by Flask.register_blueprint() to register all views and callbacks registered on the blueprint with the application. Creates a BlueprintSetupState and calls each record() callbackwith it.  Parameters 
 
app (Flask) – The application this blueprint is being registered with. 
options (dict) – Keyword arguments forwarded from register_blueprint(). 
first_registration – Whether this is the first time this blueprint has been registered on the application.   Return type 
None
register_blueprint(blueprint, **options)  
Register a Blueprint on this blueprint. Keyword arguments passed to this method will override the defaults set on the blueprint.  New in version 2.0.   Parameters 
 
blueprint (flask.blueprints.Blueprint) –  
options (Any) –    Return type 
None
register_error_handler(code_or_exception, f)  
Alternative error attach function to the errorhandler() decorator that is more straightforward to use for non decorator usage.  Changelog New in version 0.7.   Parameters 
 
code_or_exception (Union[Type[Exception], int]) –  
f (Callable[[Exception], 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]]) –    Return type 
None
root_path  
Absolute path to the package on the filesystem. Used to look up resources contained in the package.
route(rule, **options)  
Decorate a view function to register it with the given URL rule and options. Calls add_url_rule(), which has more details about the implementation. @app.route("/")
def index():
    return "Hello, World!"
 See URL Route Registrations. The endpoint name for the route defaults to the name of the view function if the endpoint parameter isn’t passed. The methods parameter defaults to ["GET"]. HEAD and OPTIONS are added automatically.  Parameters 
 
rule (str) – The URL rule string. 
options (Any) – Extra options passed to the Rule object.   Return type 
Callable
send_static_file(filename)  
The view function used to serve files from static_folder. A route is automatically registered for this view at static_url_path if static_folder is set.  Changelog New in version 0.5.   Parameters 
filename (str) –   Return type 
Response
teardown_app_request(f)  
Like Flask.teardown_request() but for a blueprint. Such a function is executed when tearing down each request, even if outside of the blueprint.  Parameters 
f (Callable[[Optional[BaseException]], Response]) –   Return type 
Callable[[Optional[BaseException]], Response]
teardown_request(f)  
Register a function to be run at the end of each request, regardless of whether there was an exception or not. These functions are executed when the request context is popped, even if not an actual request was performed. Example: ctx = app.test_request_context()
ctx.push()
...
ctx.pop()
 When ctx.pop() is executed in the above example, the teardown functions are called just before the request context moves from the stack of active contexts. This becomes relevant if you are using such constructs in tests. Teardown functions must avoid raising exceptions, since they . If they execute code that might fail they will have to surround the execution of these code by try/except statements and log occurring errors. When a teardown function was called because of an exception it will be passed an error object. The return values of teardown functions are ignored.  Debug Note In debug mode Flask will not tear down a request on an exception immediately. Instead it will keep it alive so that the interactive debugger can still access it. This behavior can be controlled by the PRESERVE_CONTEXT_ON_EXCEPTION configuration variable.   Parameters 
f (Callable[[Optional[BaseException]], Response]) –   Return type 
Callable[[Optional[BaseException]], Response]
teardown_request_funcs: t.Dict[AppOrBlueprintKey, t.List[TeardownCallable]]  
A data structure of functions to call at the end of each request even if an exception is raised, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests. To register a function, use the teardown_request() decorator. This data structure is internal. It should not be modified directly and its format may change at any time.
template_context_processors: t.Dict[AppOrBlueprintKey, t.List[TemplateContextProcessorCallable]]  
A data structure of functions to call to pass extra context values when rendering templates, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests. To register a function, use the context_processor() decorator. This data structure is internal. It should not be modified directly and its format may change at any time.
template_folder  
The path to the templates folder, relative to root_path, to add to the template loader. None if templates should not be added.
url_defaults(f)  
Callback function for URL defaults for all view functions of the application. It’s called with the endpoint and values and should update the values passed in place.  Parameters 
f (Callable[[str, dict], None]) –   Return type 
Callable[[str, dict], None]
url_default_functions: t.Dict[AppOrBlueprintKey, t.List[URLDefaultCallable]]  
A data structure of functions to call to modify the keyword arguments when generating URLs, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests. To register a function, use the url_defaults() decorator. This data structure is internal. It should not be modified directly and its format may change at any time.
url_value_preprocessor(f)  
Register a URL value preprocessor function for all view functions in the application. These functions will be called before the before_request() functions. The function can modify the values captured from the matched url before they are passed to the view. For example, this can be used to pop a common language code value and place it in g rather than pass it to every view. The function is passed the endpoint name and values dict. The return value is ignored.  Parameters 
f (Callable[[Optional[str], Optional[dict]], None]) –   Return type 
Callable[[Optional[str], Optional[dict]], None]
url_value_preprocessors: t.Dict[AppOrBlueprintKey, t.List[URLValuePreprocessorCallable]]  
A data structure of functions to call to modify the keyword arguments passed to the view function, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests. To register a function, use the url_value_preprocessor() decorator. This data structure is internal. It should not be modified directly and its format may change at any time.
view_functions: t.Dict[str, t.Callable]  
A dictionary mapping endpoint names to view functions. To register a view function, use the route() decorator. This data structure is internal. It should not be modified directly and its format may change at any time.