neulab/docprompting-conala huggingface dataset:
implicit_sequence_conversion = True  
if set to False accessing properties on the response object will not try to consume the response iterator and convert it into a list.  Changelog New in version 0.6.2: That attribute was previously called implicit_seqence_conversion. (Notice the typo). If you did use this feature, you have to adapt your code to the name change.
iter_encoded()  
Iter the response encoded with the encoding of the response. If the response object is invoked as WSGI application the return value of this method is used as application iterator unless direct_passthrough was activated.  Return type 
Iterator[bytes]
last_modified  
The Last-Modified entity-header field indicates the date and time at which the origin server believes the variant was last modified.  Changed in version 2.0: The datetime object is timezone-aware.
location  
The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource.
make_conditional(request_or_environ, accept_ranges=False, complete_length=None)  
Make the response conditional to the request. This method works best if an etag was defined for the response already. The add_etag method can be used to do that. If called without etag just the date header is set. This does nothing if the request method in the request or environ is anything but GET or HEAD. For optimal performance when handling range requests, it’s recommended that your response data object implements seekable, seek and tell methods as described by io.IOBase. Objects returned by wrap_file() automatically implement those methods. It does not remove the body of the response because that’s something the __call__() function does for us automatically. Returns self so that you can do return resp.make_conditional(req) but modifies the object in-place.  Parameters 
 
request_or_environ (WSGIEnvironment) – a request object or WSGI environment to be used to make the response conditional against. 
accept_ranges (Union[bool, str]) – This parameter dictates the value of Accept-Ranges header. If False (default), the header is not set. If True, it will be set to "bytes". If None, it will be set to "none". If it’s a string, it will use this value. 
complete_length (Optional[int]) – Will be used only in valid Range Requests. It will set Content-Range complete length value and compute Content-Length real value. This parameter is mandatory for successful Range Requests completion.   Raises 
RequestedRangeNotSatisfiable if Range header could not be parsed or satisfied.  Return type 
Response    Changed in version 2.0: Range processing is skipped if length is 0 instead of raising a 416 Range Not Satisfiable error.
make_sequence()  
Converts the response iterator in a list. By default this happens automatically if required. If implicit_sequence_conversion is disabled, this method is not automatically called and some properties might raise exceptions. This also encodes all the items.  Changelog New in version 0.6.   Return type 
None
response: Union[Iterable[str], Iterable[bytes]]  
The response body to send as the WSGI iterable. A list of strings or bytes represents a fixed-length response, any other iterable is a streaming response. Strings are encoded to bytes as UTF-8. Do not set to a plain string or bytes, that will cause sending the response to be very inefficient as it will iterate one byte at a time.
set_cookie(key, value='', max_age=None, expires=None, path='/', domain=None, secure=False, httponly=False, samesite=None)  
Sets a cookie. A warning is raised if the size of the cookie header exceeds max_cookie_size, but the header will still be set.  Parameters 
 
key (str) – the key (name) of the cookie to be set. 
value (str) – the value of the cookie. 
max_age (Optional[Union[datetime.timedelta, int]]) – should be a number of seconds, or None (default) if the cookie should last only as long as the client’s browser session. 
expires (Optional[Union[str, datetime.datetime, int, float]]) – should be a datetime object or UNIX timestamp. 
path (Optional[str]) – limits the cookie to a given path, per default it will span the whole domain. 
domain (Optional[str]) – if you want to set a cross-domain cookie. For example, domain=".example.com" will set a cookie that is readable by the domain www.example.com, foo.example.com etc. Otherwise, a cookie will only be readable by the domain that set it. 
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
set_data(value)  
Sets a new string as response. The value must be a string or bytes. If a string is set it’s encoded to the charset of the response (utf-8 by default).  Changelog New in version 0.9.   Parameters 
value (Union[bytes, str]) –   Return type 
None
set_etag(etag, weak=False)  
Set the etag, and override the old one if there was one.  Parameters 
 
etag (str) –  
weak (bool) –    Return type 
None
_ensure_sequence(mutable=False)  
This method can be called by methods that need a sequence. If mutable is true, it will also ensure that the response sequence is a standard Python list.  Changelog New in version 0.6.   Parameters 
mutable (bool) –   Return type 
None
__call__(environ, start_response)  
Process this response as WSGI application.  Parameters 
 
environ (WSGIEnvironment) – the WSGI environment. 
start_response (StartResponse) – the response callable provided by the WSGI server.   Returns 
an application iterator  Return type 
Iterable[bytes]
class werkzeug.datastructures.ResponseCacheControl(values=(), on_update=None)  
A cache control for responses. Unlike RequestCacheControl this is mutable and gives access to response-relevant cache control headers. To get a header of the ResponseCacheControl 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 immutable  
accessor for ‘immutable’ 
  
property must_revalidate  
accessor for ‘must-revalidate’ 
  
property private  
accessor for ‘private’ 
  
property proxy_revalidate  
accessor for ‘proxy-revalidate’ 
  
property public  
accessor for ‘public’ 
  
property s_maxage  
accessor for ‘s-maxage’
empty()  
Return an unbound copy of this rule. This can be useful if want to reuse an already bound URL for another map. See get_empty_kwargs to override what keyword arguments are provided to the new copy.  Return type 
werkzeug.routing.Rule
class werkzeug.routing.RuleFactory  
As soon as you have more complex URL setups it’s a good idea to use rule factories to avoid repetitive tasks. Some of them are builtin, others can be added by subclassing RuleFactory and overriding get_rules.  
get_rules(map)  
Subclasses of RuleFactory have to override this method and return an iterable of rules.  Parameters 
map (werkzeug.routing.Map) –   Return type 
Iterable[werkzeug.routing.Rule]
get_rules(map)  
Subclasses of RuleFactory have to override this method and return an iterable of rules.  Parameters 
map (werkzeug.routing.Map) –   Return type 
Iterable[werkzeug.routing.Rule]
class werkzeug.routing.RuleTemplate(rules)  
Returns copies of the rules wrapped and expands string templates in the endpoint, rule, defaults or subdomain sections. Here a small example for such a rule template: from werkzeug.routing import Map, Rule, RuleTemplate

resource = RuleTemplate([
    Rule('/$name/', endpoint='$name.list'),
    Rule('/$name/<int:id>', endpoint='$name.show')
])

url_map = Map([resource(name='user'), resource(name='page')])
 When a rule template is called the keyword arguments are used to replace the placeholders in all the string parameters.  Parameters 
rules (Iterable[Rule]) –   Return type 
None
werkzeug.test.run_wsgi_app(app, environ, buffered=False)  
Return a tuple in the form (app_iter, status, headers) of the application output. This works best if you pass it an application that returns an iterator 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. If passed an invalid WSGI application the behavior of this function is undefined. Never pass non-conforming WSGI applications to this function.  Parameters 
 
app (WSGIApplication) – the application to execute. 
buffered (bool) – set to True to enforce buffering. 
environ (WSGIEnvironment) –    Returns 
tuple in the form (app_iter, status, headers)  Return type 
Tuple[Iterable[bytes], str, werkzeug.datastructures.Headers]
werkzeug.security.safe_join(directory, *pathnames)  
Safely join zero or more untrusted path components to a base directory to avoid escaping the base directory.  Parameters 
 
directory (str) – The trusted base directory. 
pathnames (str) – The untrusted path components relative to the base directory.   Returns 
A safe path, otherwise None.  Return type 
Optional[str]
werkzeug.security.safe_str_cmp(a, b)  
This function compares strings in somewhat constant time. This requires that the length of at least one string is known in advance. Returns True if the two strings are equal, or False if they are not.  Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Use hmac.compare_digest() instead.   Changelog New in version 0.7.   Parameters 
 
a (str) –  
b (str) –    Return type 
bool
werkzeug.utils.secure_filename(filename)  
Pass it a filename and it will return a secure version of it. This filename can then safely be stored on a regular file system and passed to os.path.join(). The filename returned is an ASCII only string for maximum portability. On windows systems the function also makes sure that the file is not named after one of the special device files. >>> secure_filename("My cool movie.mov")
'My_cool_movie.mov'
>>> secure_filename("../../../etc/passwd")
'etc_passwd'
>>> secure_filename('i contain cool \xfcml\xe4uts.txt')
'i_contain_cool_umlauts.txt'
 The function might return an empty filename. It’s your responsibility to ensure that the filename is unique and that you abort or generate a random filename if the function returned an empty one.  Changelog New in version 0.5.   Parameters 
filename (str) – the filename to secure  Return type 
str
class werkzeug.middleware.shared_data.SharedDataMiddleware(app, exports, disallow=None, cache=True, cache_timeout=43200, fallback_mimetype='application/octet-stream')  
A WSGI middleware which provides static content for development environments or simple server setups. Its usage is quite simple: import os
from werkzeug.middleware.shared_data import SharedDataMiddleware

app = SharedDataMiddleware(app, {
    '/shared': os.path.join(os.path.dirname(__file__), 'shared')
})
 The contents of the folder ./shared will now be available on http://example.com/shared/. This is pretty useful during development because a standalone media server is not required. Files can also be mounted on the root folder and still continue to use the application because the shared data middleware forwards all unhandled requests to the application, even if the requests are below one of the shared folders. If pkg_resources is available you can also tell the middleware to serve files from package data: app = SharedDataMiddleware(app, {
    '/static': ('myapplication', 'static')
})
 This will then serve the static folder in the myapplication Python package. The optional disallow parameter can be a list of fnmatch() rules for files that are not accessible from the web. If cache is set to False no caching headers are sent. Currently the middleware does not support non-ASCII filenames. If the encoding on the file system happens to match the encoding of the URI it may work but this could also be by accident. We strongly suggest using ASCII only file names for static files. The middleware will guess the mimetype using the Python mimetype module. If it’s unable to figure out the charset it will fall back to fallback_mimetype.  Parameters 
 
app (WSGIApplication) – the application to wrap. If you don’t want to wrap an application you can pass it NotFound. 
exports (Union[Dict[str, Union[str, Tuple[str, str]]], Iterable[Tuple[str, Union[str, Tuple[str, str]]]]]) – a list or dict of exported files and folders. 
disallow (None) – a list of fnmatch() rules. 
cache (bool) – enable or disable caching headers. 
cache_timeout (int) – the cache timeout in seconds for the headers. 
fallback_mimetype (str) – The fallback mimetype for unknown files.   Return type 
None    Changelog Changed in version 1.0: The default fallback_mimetype is application/octet-stream. If a filename looks like a text mimetype, the utf-8 charset is added to it.   New in version 0.6: Added fallback_mimetype.   Changed in version 0.5: Added cache_timeout.   
is_allowed(filename)  
Subclasses can override this method to disallow the access to certain files. However by providing disallow in the constructor this method is overwritten.  Parameters 
filename (str) –   Return type 
bool
is_allowed(filename)  
Subclasses can override this method to disallow the access to certain files. However by providing disallow in the constructor this method is overwritten.  Parameters 
filename (str) –   Return type 
bool
class werkzeug.routing.Subdomain(subdomain, rules)  
All URLs provided by this factory have the subdomain set to a specific domain. For example if you want to use the subdomain for the current language this can be a good setup: url_map = Map([
    Rule('/', endpoint='#select_language'),
    Subdomain('<string(length=2):lang_code>', [
        Rule('/', endpoint='index'),
        Rule('/about', endpoint='about'),
        Rule('/help', endpoint='help')
    ])
])
 All the rules except for the '#select_language' endpoint will now listen on a two letter long subdomain that holds the language code for the current request.  Parameters 
 
subdomain (str) –  
rules (Iterable[Rule]) –    Return type 
None
class werkzeug.routing.Submount(path, rules)  
Like Subdomain but prefixes the URL rule with a given string: url_map = Map([
    Rule('/', endpoint='index'),
    Submount('/blog', [
        Rule('/', endpoint='blog/index'),
        Rule('/entry/<entry_slug>', endpoint='blog/show')
    ])
])
 Now the rule 'blog/show' matches /blog/entry/<entry_slug>.  Parameters 
 
path (str) –  
rules (Iterable[Rule]) –    Return type 
None
class werkzeug.test.TestResponse(response, status, headers, request, history=(), **kwargs)  
Response subclass that provides extra information about requests made with the test Client. Test client requests will always return an instance of this class. If a custom response class is passed to the client, it is subclassed along with this to support test information. If the test request included large files, or if the application is serving a file, call close() to close any open files and prevent Python showing a ResourceWarning.  Parameters 
 
response (Union[Iterable[str], Iterable[bytes]]) –  
status (str) –  
headers (werkzeug.datastructures.Headers) –  
request (werkzeug.wrappers.request.Request) –  
history (Tuple[werkzeug.test.TestResponse, ...]) –  
kwargs (Any) –    Return type 
None    
request: werkzeug.wrappers.request.Request  
A request object with the environ used to make the request that resulted in this response. 
  
history: Tuple[werkzeug.test.TestResponse, ...]  
A list of intermediate responses. Populated when the test request is made with follow_redirects enabled.
history: Tuple[werkzeug.test.TestResponse, ...]  
A list of intermediate responses. Populated when the test request is made with follow_redirects enabled.
request: werkzeug.wrappers.request.Request  
A request object with the environ used to make the request that resulted in this response.
werkzeug.testapp.test_app(environ, start_response)  
Simple test application that dumps the environment. You can use it to check if Werkzeug is working properly: >>> from werkzeug.serving import run_simple
>>> from werkzeug.testapp import test_app
>>> run_simple('localhost', 3000, test_app)
 * Running on http://localhost:3000/
 The application displays important information from the WSGI environment, the Python interpreter and the installed libraries.  Parameters 
 
environ (WSGIEnvironment) –  
start_response (StartResponse) –    Return type 
Iterable[bytes]
class werkzeug.datastructures.TypeConversionDict  
Works like a regular dict but the get() method can perform type conversions. MultiDict and CombinedMultiDict are subclasses of this class and provide the same feature.  Changelog New in version 0.5.   
get(key, default=None, type=None)  
Return the default value if the requested data doesn’t exist. If type is provided and is a callable it should convert the value, return it or raise a ValueError if that is not possible. In this case the function will return the default as if the value was not found: >>> d = TypeConversionDict(foo='42', bar='blub')
>>> d.get('foo', type=int)
42
>>> d.get('bar', -1, type=int)
-1
  Parameters 
 
key – The key to be looked up. 
default – The default value to be returned if the key can’t be looked up. If not further specified None is returned. 
type – A callable that is used to cast the value in the MultiDict. If a ValueError is raised by this callable the default value is returned.
werkzeug.utils.unescape(s)  
The reverse of escape(). This unescapes all the HTML entities, not only those inserted by escape.  Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Use MarkupSafe instead.   Parameters 
s (str) –   Return type 
str
Unicode Werkzeug uses strings internally everwhere text data is assumed, even if the HTTP standard is not Unicode aware. Basically all incoming data is decoded from the charset (UTF-8 by default) so that you don’t work with bytes directly. Outgoing data is encoded into the target charset.  Unicode in Python Imagine you have the German Umlaut ö. In ASCII you cannot represent that character, but in the latin-1 and utf-8 character sets you can represent it, but they look different when encoded: >>> "ö".encode("latin1")
b'\xf6'
>>> "ö".encode("utf-8")
b'\xc3\xb6'
 An ö looks different depending on the encoding which makes it hard to work with it as bytes. Instead, Python treats strings as Unicode text and stores the information LATIN SMALL LETTER O WITH DIAERESIS instead of the bytes for ö in a specific encoding. The length of a string with 1 character will be 1, where the length of the bytes might be some other value.   Unicode in HTTP However, the HTTP spec was written in a time where ASCII bytes were the common way data was represented. To work around this for the modern web, Werkzeug decodes and encodes incoming and outgoing data automatically. Data sent from the browser to the web application is decoded from UTF-8 bytes into a string. Data sent from the application back to the browser is encoded back to UTF-8.   Error Handling Functions that do internal encoding or decoding accept an errors keyword argument that is passed to str.decode() and str.encode(). The default is 'replace' so that errors are easy to spot. It might be useful to set it to 'strict' in order to catch the error and report the bad data to the client.   Request and Response Objects In most cases, you should stick with Werkzeug’s default encoding of UTF-8. If you have a specific reason to, you can subclass wrappers.Request and wrappers.Response to change the encoding and error handling. from werkzeug.wrappers.request import Request
from werkzeug.wrappers.response import Response

class Latin1Request(Request):
    charset = "latin1"
    encoding_errors = "strict"

class Latin1Response(Response):
    charset = "latin1"
 The error handling can only be changed for the request. Werkzeug will always raise errors when encoding to bytes in the response. It’s your responsibility to not create data that is not present in the target charset. This is not an issue for UTF-8.
class werkzeug.routing.UnicodeConverter(map, minlength=1, maxlength=None, length=None)  
This converter is the default converter and accepts any string but only one path segment. Thus the string can not include a slash. This is the default validator. Example: Rule('/pages/<page>'),
Rule('/<string(length=2):lang_code>')
  Parameters 
 
map (Map) – the Map. 
minlength (int) – the minimum length of the string. Must be greater or equal 1. 
maxlength (Optional[int]) – the maximum length of the string. 
length (Optional[int]) – the exact length of the string.   Return type 
None
werkzeug.http.unquote_etag(etag)  
Unquote a single etag: >>> unquote_etag('W/"bar"')
('bar', True)
>>> unquote_etag('"bar"')
('bar', False)
  Parameters 
etag (Optional[str]) – the etag identifier to unquote.  Returns 
a (etag, weak) tuple.  Return type 
Union[Tuple[str, bool], Tuple[None, None]]
werkzeug.http.unquote_header_value(value, is_filename=False)  
Unquotes a header value. (Reversal of quote_header_value()). This does not use the real unquoting but what browsers are actually using for quoting.  Changelog New in version 0.5.   Parameters 
 
value (str) – the header value to unquote. 
is_filename (bool) – The value represents a filename or path.   Return type 
str
werkzeug.urls.uri_to_iri(uri, charset='utf-8', errors='werkzeug.url_quote')  
Convert a URI to an IRI. All valid UTF-8 characters are unquoted, leaving all reserved and invalid characters quoted. If the URL has a domain, it is decoded from Punycode. >>> uri_to_iri("http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF")
'http://\u2603.net/p\xe5th?q=\xe8ry%DF'
  Parameters 
 
uri (Union[str, Tuple[str, str, str, str, str]]) – The URI to convert. 
charset (str) – The encoding to encode unquoted bytes with. 
errors (str) – Error handler to use during bytes.encode. By default, invalid bytes are left quoted.   Return type 
str    Changelog Changed in version 0.15: All reserved and invalid characters remain quoted. Previously, only some reserved characters were preserved, and invalid bytes were replaced instead of left quoted.   New in version 0.6.
class werkzeug.urls.URL(scheme, netloc, path, query, fragment)  
Represents a parsed URL. This behaves like a regular tuple but also has some extra attributes that give further insight into the URL. Create new instance of _URLTuple(scheme, netloc, path, query, fragment)  Parameters 
 
scheme (str) –  
netloc (str) –  
path (str) –  
query (str) –  
fragment (str) –      
encode(charset='utf-8', errors='replace')  
Encodes the URL to a tuple made out of bytes. The charset is only being used for the path, query and fragment.  Parameters 
 
charset (str) –  
errors (str) –    Return type 
werkzeug.urls.BytesURL
encode(charset='utf-8', errors='replace')  
Encodes the URL to a tuple made out of bytes. The charset is only being used for the path, query and fragment.  Parameters 
 
charset (str) –  
errors (str) –    Return type 
werkzeug.urls.BytesURL