neulab/docprompting-conala huggingface dataset:
werkzeug.utils.redirect(location, code=302, Response=None)  
Returns a response object (a WSGI application) that, if called, redirects the client to the target location. Supported codes are 301, 302, 303, 305, 307, and 308. 300 is not supported because it’s not a real redirect and 304 because it’s the answer for a request with a request with defined If-Modified-Since headers.  Changelog New in version 0.10: The class used for the Response object can now be passed in.   New in version 0.6: The location can now be a unicode string that is encoded using the iri_to_uri() function.   Parameters 
 
location (str) – the location the response should redirect to. 
code (int) – the redirect status code. defaults to 302. 
Response (class) – a Response class to use when instantiating a response. The default is werkzeug.wrappers.Response if unspecified.   Return type 
Response
werkzeug.local.release_local(local)  
Releases the contents of the local for the current context. This makes it possible to use locals without a manager. Example: >>> loc = Local()
>>> loc.foo = 42
>>> release_local(loc)
>>> hasattr(loc, 'foo')
False
 With this function one can release Local objects as well as LocalStack objects. However it is not possible to release data held by proxies that way, one always has to retain a reference to the underlying local object in order to be able to release it.  Changelog New in version 0.6.1.   Parameters 
local (Union[werkzeug.local.Local, werkzeug.local.LocalStack]) –   Return type 
None
werkzeug.http.remove_entity_headers(headers, allowed=('expires', 'content-location'))  
Remove all entity headers from a list or Headers object. This operation works in-place. Expires and Content-Location headers are by default not removed. The reason for this is RFC 2616 section 10.3.5 which specifies some entity headers that should be sent.  Changelog Changed in version 0.5: added allowed parameter.   Parameters 
 
headers (Union[werkzeug.datastructures.Headers, List[Tuple[str, str]]]) – a list or Headers object. 
allowed (Iterable[str]) – a list of headers that should still be allowed even though they are entity headers.   Return type 
None
werkzeug.http.remove_hop_by_hop_headers(headers)  
Remove all HTTP/1.1 “Hop-by-Hop” headers from a list or Headers object. This operation works in-place.  Changelog New in version 0.5.   Parameters 
headers (Union[werkzeug.datastructures.Headers, List[Tuple[str, str]]]) – a list or Headers object.  Return type 
None
access_control_request_headers  
Sent with a preflight request to indicate which headers will be sent with the cross origin request. Set access_control_allow_headers on the response to indicate which headers are allowed.
access_control_request_method  
Sent with a preflight request to indicate which method will be used for the cross origin request. Set access_control_allow_methods on the response to indicate which methods are allowed.
classmethod application(f)  
Decorate a function as responder that accepts the request as the last argument. This works like the responder() decorator but the function is passed the request object as the last argument and the request object will be closed automatically: @Request.application
def my_wsgi_app(request):
    return Response('Hello World!')
 As of Werkzeug 0.14 HTTP exceptions are automatically caught and converted to responses instead of failing.  Parameters 
f (Callable[[Request], WSGIApplication]) – the WSGI callable to decorate  Returns 
a new WSGI callable  Return type 
WSGIApplication
close()  
Closes associated resources of this request object. This closes all file handles explicitly. You can also use the request object in a with statement which will automatically close it.  Changelog New in version 0.9.   Return type 
None
content_encoding  
The Content-Encoding entity-header field is used as a modifier to the media-type. When present, its value indicates what additional content codings have been applied to the entity-body, and thus what decoding mechanisms must be applied in order to obtain the media-type referenced by the Content-Type header field.  Changelog New in version 0.9.
content_md5  
The Content-MD5 entity-header field, as defined in RFC 1864, is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body. (Note: a MIC is good for detecting accidental modification of the entity-body in transit, but is not proof against malicious attacks.)  Changelog New in version 0.9.
content_type  
The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET.
date  
The Date general-header field represents the date and time at which the message was originated, having the same semantics as orig-date in RFC 822.  Changed in version 2.0: The datetime object is timezone-aware.
dict_storage_class  
alias of werkzeug.datastructures.ImmutableMultiDict
disable_data_descriptor: Optional[bool] = None  
Disable the data property to avoid reading from the input stream.  Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Create the request with shallow=True instead.   Changelog New in version 0.9.
environ: WSGIEnvironment  
The WSGI environment containing HTTP headers and information from the WSGI server.
form_data_parser_class  
alias of werkzeug.formparser.FormDataParser
classmethod from_values(*args, **kwargs)  
Create a new request object based on the values provided. If environ is given missing values are filled from there. This method is useful for small scripts when you need to simulate a request from an URL. Do not use this method for unittesting, there is a full featured client object (Client) that allows to create multipart requests, support for cookies etc. This accepts the same options as the EnvironBuilder.  Changelog Changed in version 0.5: This method now accepts the same arguments as EnvironBuilder. Because of this the environ parameter is now called environ_overrides.   Returns 
request object  Parameters 
 
args (Any) –  
kwargs (Any) –    Return type 
werkzeug.wrappers.request.Request
get_data(cache=True, as_text=False, parse_form_data=False)  
This reads the buffered incoming data from the client into one bytes object. By default this is cached but that behavior can be changed by setting cache to False. Usually it’s a bad idea to call this method without checking the content length first as a client could send dozens of megabytes or more to cause memory problems on the server. Note that if the form data was already parsed this method will not return anything as form data parsing does not cache the data like this method does. To implicitly invoke form data parsing function set parse_form_data to True. When this is done the return value of this method will be an empty string if the form parser handles the data. This generally is not necessary as if the whole data is cached (which is the default) the form parser will used the cached data to parse the form data. Please be generally aware of checking the content length first in any case before calling this method to avoid exhausting server memory. If as_text is set to True the return value will be a decoded string.  Changelog New in version 0.9.   Parameters 
 
cache (bool) –  
as_text (bool) –  
parse_form_data (bool) –    Return type 
Union[bytes, str]
get_json(force=False, silent=False, cache=True)  
Parse data as JSON. If the mimetype does not indicate JSON (application/json, see is_json()), this returns None. If parsing fails, on_json_loading_failed() is called and its return value is used as the return value.  Parameters 
 
force (bool) – Ignore the mimetype and always try to parse JSON. 
silent (bool) – Silence parsing errors and return None instead. 
cache (bool) – Store the parsed JSON to return for subsequent calls.   Return type 
Optional[Any]
input_stream  
The WSGI input stream. In general it’s a bad idea to use this one because you can easily read past the boundary. Use the stream instead.
is_multiprocess  
boolean that is True if the application is served by a WSGI server that spawns multiple processes.
is_multithread  
boolean that is True if the application is served by a multithreaded WSGI server.
is_run_once  
boolean that is True if the application will be executed only once in a process lifetime. This is the case for CGI for example, but it’s not guaranteed that the execution only happens one time.
json_module = <module 'json' from '/home/docs/.pyenv/versions/3.7.9/lib/python3.7/json/__init__.py'>  
A module or other object that has dumps and loads functions that match the API of the built-in json module.
list_storage_class  
alias of werkzeug.datastructures.ImmutableList
make_form_data_parser()  
Creates the form data parser. Instantiates the form_data_parser_class with some parameters.  Changelog New in version 0.8.   Return type 
werkzeug.formparser.FormDataParser
max_content_length: Optional[int] = None  
the maximum content length. This is forwarded to the form data parsing function (parse_form_data()). When set and the form or files attribute is accessed and the parsing fails because more than the specified value is transmitted a RequestEntityTooLarge exception is raised. Have a look at Dealing with Request Data for more details.  Changelog New in version 0.5.
max_form_memory_size: Optional[int] = None  
the maximum form field size. This is forwarded to the form data parsing function (parse_form_data()). When set and the form or files attribute is accessed and the data in memory for post data is longer than the specified value a RequestEntityTooLarge exception is raised. Have a look at Dealing with Request Data for more details.  Changelog New in version 0.5.
max_forwards  
The Max-Forwards request-header field provides a mechanism with the TRACE and OPTIONS methods to limit the number of proxies or gateways that can forward the request to the next inbound server.
on_json_loading_failed(e)  
Called if get_json() parsing fails and isn’t silenced. If this method returns a value, it is used as the return value for get_json(). The default implementation raises BadRequest.  Parameters 
e (ValueError) –   Return type 
Any
origin  
The host that the request originated from. Set access_control_allow_origin on the response to indicate which origins are allowed.
parameter_storage_class  
alias of werkzeug.datastructures.ImmutableMultiDict
path  
The path part of the URL after root_path. This is the path used for routing within the application.
query_string  
The part of the URL after the “?”. This is the raw value, use args for the parsed values.
referrer  
The Referer[sic] request-header field allows the client to specify, for the server’s benefit, the address (URI) of the resource from which the Request-URI was obtained (the “referrer”, although the header field is misspelled).
remote_user  
If the server supports user authentication, and the script is protected, this attribute contains the username the user has authenticated as.
root_path  
The prefix that the application is mounted under, without a trailing slash. path comes after this.
server  
The address of the server. (host, port), (path, None) for unix sockets, or None if not known.
shallow: bool  
Set when creating the request object. If True, reading from the request body will cause a RuntimeException. Useful to prevent modifying the stream from middleware.
_get_file_stream(total_content_length, content_type, filename=None, content_length=None)  
Called to get a stream for the file upload. This must provide a file-like class with read(), readline() and seek() methods that is both writeable and readable. The default implementation returns a temporary file if the total content length is higher than 500KB. Because many browsers do not provide a content length for the files only the total content length matters.  Parameters 
 
total_content_length (Optional[int]) – the total content length of all the data in the request combined. This value is guaranteed to be there. 
content_type (Optional[str]) – the mimetype of the uploaded file. 
filename (Optional[str]) – the filename of the uploaded file. May be None. 
content_length (Optional[int]) – the length of this file. This value is usually not provided because webbrowsers do not provide this value.   Return type 
BinaryIO
class werkzeug.datastructures.RequestCacheControl(values=(), on_update=None)  
A cache control for requests. This is immutable and gives access to all the request-relevant cache control headers. To get a header of the RequestCacheControl object again you can convert the object into a string or call the to_header() method. If you plan to subclass it and add your own items have a look at the sourcecode for that class.  Changelog New in version 0.5: In previous versions a CacheControl class existed that was used both for request and response.   
no_cache  
accessor for ‘no-cache’ 
  
no_store  
accessor for ‘no-store’ 
  
max_age  
accessor for ‘max-age’ 
  
no_transform  
accessor for ‘no-transform’ 
  
property max_stale  
accessor for ‘max-stale’ 
  
property min_fresh  
accessor for ‘min-fresh’ 
  
property only_if_cached  
accessor for ‘only-if-cached’
werkzeug.wsgi.responder(f)  
Marks a function as responder. Decorate a function with it and it will automatically call the return value as WSGI application. Example: @responder
def application(environ, start_response):
    return Response('Hello World!')
  Parameters 
f (Callable[[...], WSGIApplication]) –   Return type 
WSGIApplication
accept_ranges  
The Accept-Ranges header. Even though the name would indicate that multiple values are supported, it must be one string token only. The values 'bytes' and 'none' are common.  Changelog New in version 0.7.
access_control_allow_origin  
The origin or ‘*’ for any origin that may make cross origin requests.
access_control_expose_headers  
Which headers can be shared by the browser to JavaScript code.
access_control_max_age  
The maximum age in seconds the access control settings can be cached for.
add_etag(overwrite=False, weak=False)  
Add an etag for the current response if there is none yet.  Changed in version 2.0: SHA-1 is used to generate the value. MD5 may not be available in some environments.   Parameters 
 
overwrite (bool) –  
weak (bool) –    Return type 
None
age  
The Age response-header field conveys the sender’s estimate of the amount of time since the response (or its revalidation) was generated at the origin server. Age values are non-negative decimal integers, representing time in seconds.
autocorrect_location_header = True  
Should this response object correct the location header to be RFC conformant? This is true by default.  Changelog New in version 0.8.
automatically_set_content_length = True  
Should this response object automatically set the content-length header if possible? This is true by default.  Changelog New in version 0.8.
calculate_content_length()  
Returns the content length if available or None otherwise.  Return type 
Optional[int]
call_on_close(func)  
Adds a function to the internal list of functions that should be called as part of closing down the response. Since 0.7 this function also returns the function that was passed so that this can be used as a decorator.  Changelog New in version 0.6.   Parameters 
func (Callable[[], Any]) –   Return type 
Callable[[], Any]
close()  
Close the wrapped response if possible. You can also use the object in a with statement which will automatically close it.  Changelog New in version 0.9: Can now be used in a with statement.   Return type 
None
content_encoding  
The Content-Encoding entity-header field is used as a modifier to the media-type. When present, its value indicates what additional content codings have been applied to the entity-body, and thus what decoding mechanisms must be applied in order to obtain the media-type referenced by the Content-Type header field.
content_length  
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
content_location  
The Content-Location entity-header field MAY be used to supply the resource location for the entity enclosed in the message when that entity is accessible from a location separate from the requested resource’s URI.
content_md5  
The Content-MD5 entity-header field, as defined in RFC 1864, is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body. (Note: a MIC is good for detecting accidental modification of the entity-body in transit, but is not proof against malicious attacks.)
content_security_policy  
The Content-Security-Policy header adds an additional layer of security to help detect and mitigate certain types of attacks.
content_security_policy_report_only  
The Content-Security-Policy-Report-Only header adds a csp policy that is not enforced but is reported thereby helping detect certain types of attacks.
cross_origin_embedder_policy  
Prevents a document from loading any cross-origin resources that do not explicitly grant the document permission. Values must be a member of the werkzeug.http.COEP enum.
cross_origin_opener_policy  
Allows control over sharing of browsing context group with cross-origin documents. Values must be a member of the werkzeug.http.COOP enum.
delete_cookie(key, path='/', domain=None, secure=False, httponly=False, samesite=None)  
Delete a cookie. Fails silently if key doesn’t exist.  Parameters 
 
key (str) – the key (name) of the cookie to be deleted. 
path (str) – if the cookie that should be deleted was limited to a path, the path has to be defined here. 
domain (Optional[str]) – if the cookie that should be deleted was limited to a domain, that domain has to be defined here. 
secure (bool) – If True, the cookie will only be available via HTTPS. 
httponly (bool) – Disallow JavaScript access to the cookie. 
samesite (Optional[str]) – Limit the scope of the cookie to only be attached to requests that are “same-site”.   Return type 
None
direct_passthrough  
Pass the response body directly through as the WSGI iterable. This can be used when the body is a binary file or other iterator of bytes, to skip some unnecessary checks. Use send_file() instead of setting this manually.
expires  
The Expires entity-header field gives the date/time after which the response is considered stale. A stale cache entry may not normally be returned by a cache.  Changed in version 2.0: The datetime object is timezone-aware.
classmethod force_type(response, environ=None)  
Enforce that the WSGI response is a response object of the current type. Werkzeug will use the Response internally in many situations like the exceptions. If you call get_response() on an exception you will get back a regular Response object, even if you are using a custom subclass. This method can enforce a given response type, and it will also convert arbitrary WSGI callables into response objects if an environ is provided: # convert a Werkzeug response object into an instance of the
# MyResponseClass subclass.
response = MyResponseClass.force_type(response)

# convert any WSGI application into a response object
response = MyResponseClass.force_type(response, environ)
 This is especially useful if you want to post-process responses in the main dispatcher and use functionality provided by your subclass. Keep in mind that this will modify response objects in place if possible!  Parameters 
 
response (Response) – a response object or wsgi application. 
environ (Optional[WSGIEnvironment]) – a WSGI environment object.   Returns 
a response object.  Return type 
Response
freeze(no_etag=None)  
Make the response object ready to be pickled. Does the following:  Buffer the response into a list, ignoring implicity_sequence_conversion and direct_passthrough. Set the Content-Length header. Generate an ETag header if one is not already set.   Changed in version 2.0: An ETag header is added, the no_etag parameter is deprecated and will be removed in Werkzeug 2.1.   Changelog Changed in version 0.6: The Content-Length header is set.   Parameters 
no_etag (None) –   Return type 
None
classmethod from_app(app, environ, buffered=False)  
Create a new response object from an application output. This works best if you pass it an application that returns a generator all the time. Sometimes applications may use the write() callable returned by the start_response function. This tries to resolve such edge cases automatically. But if you don’t get the expected output you should set buffered to True which enforces buffering.  Parameters 
 
app (WSGIApplication) – the WSGI application to execute. 
environ (WSGIEnvironment) – the WSGI environment to execute against. 
buffered (bool) – set to True to enforce buffering.   Returns 
a response object.  Return type 
Response
get_app_iter(environ)  
Returns the application iterator for the given environ. Depending on the request method and the current status code the return value might be an empty response rather than the one from the response. If the request method is HEAD or the status code is in a range where the HTTP specification requires an empty response, an empty iterable is returned.  Changelog New in version 0.6.   Parameters 
environ (WSGIEnvironment) – the WSGI environment of the request.  Returns 
a response iterable.  Return type 
Iterable[bytes]
get_data(as_text=False)  
The string representation of the response body. Whenever you call this property the response iterable is encoded and flattened. This can lead to unwanted behavior if you stream big data. This behavior can be disabled by setting implicit_sequence_conversion to False. If as_text is set to True the return value will be a decoded string.  Changelog New in version 0.9.   Parameters 
as_text (bool) –   Return type 
Union[bytes, str]
get_etag()  
Return a tuple in the form (etag, is_weak). If there is no ETag the return value is (None, None).  Return type 
Union[Tuple[str, bool], Tuple[None, None]]
get_json(force=False, silent=False)  
Parse data as JSON. Useful during testing. If the mimetype does not indicate JSON (application/json, see is_json()), this returns None. Unlike Request.get_json(), the result is not cached.  Parameters 
 
force (bool) – Ignore the mimetype and always try to parse JSON. 
silent (bool) – Silence parsing errors and return None instead.   Return type 
Optional[Any]
get_wsgi_headers(environ)  
This is automatically called right before the response is started and returns headers modified for the given environment. It returns a copy of the headers from the response with some modifications applied if necessary. For example the location header (if present) is joined with the root URL of the environment. Also the content length is automatically set to zero here for certain status codes.  Changelog Changed in version 0.6: Previously that function was called fix_headers and modified the response object in place. Also since 0.6, IRIs in location and content-location headers are handled properly. Also starting with 0.6, Werkzeug will attempt to set the content length if it is able to figure it out on its own. This is the case if all the strings in the response iterable are already encoded and the iterable is buffered.   Parameters 
environ (WSGIEnvironment) – the WSGI environment of the request.  Returns 
returns a new Headers object.  Return type 
werkzeug.datastructures.Headers
get_wsgi_response(environ)  
Returns the final WSGI response as tuple. The first item in the tuple is the application iterator, the second the status and the third the list of headers. The response returned is created specially for the given environment. For example if the request method in the WSGI environment is 'HEAD' the response will be empty and only the headers and status code will be present.  Changelog New in version 0.6.   Parameters 
environ (WSGIEnvironment) – the WSGI environment of the request.  Returns 
an (app_iter, status, headers) tuple.  Return type 
Tuple[Iterable[bytes], str, List[Tuple[str, str]]]