neulab/docprompting-conala huggingface dataset:
popitem()  
Removes a key or index and returns a (key, value) item.
remove(key)  
Remove a key.  Parameters 
key – The key to be removed.
set(_key, _value, **kw)  
Remove all header tuples for key and add a new one. The newly added key either appears at the end of the list if there was no entry or replaces the first one. Keyword arguments can specify additional parameters for the header value, with underscores converted to dashes. See add() for more information.  Changelog Changed in version 0.6.1: set() now accepts the same arguments as add().   Parameters 
 
key – The key to be inserted. 
value – The value to be inserted.
setdefault(key, default)  
Return the first value for the key if it is in the headers, otherwise set the header to the value given by default and return that.  Parameters 
 
key – The header key to get. 
default – The value to set for the key if it is not in the headers.
setlist(key, values)  
Remove any existing values for a header and add new ones.  Parameters 
 
key – The header key to set. 
values – An iterable of values to set for the key.     Changelog New in version 1.0.
setlistdefault(key, default)  
Return the list of values for the key if it is in the headers, otherwise set the header to the list of values given by default and return that. Unlike MultiDict.setlistdefault(), modifying the returned list will not affect the headers.  Parameters 
 
key – The header key to get. 
default – An iterable of values to set for the key if it is not in the headers.     Changelog New in version 1.0.
to_wsgi_list()  
Convert the headers into a list suitable for WSGI.  Returns 
list
update(*args, **kwargs)  
Replace headers in this object with items from another headers object and keyword arguments. To extend existing keys instead of replacing, use extend() instead. If provided, the first argument can be another Headers object, a MultiDict, dict, or iterable of pairs.  Changelog New in version 1.0.
class werkzeug.datastructures.HeaderSet(headers=None, on_update=None)  
Similar to the ETags class this implements a set-like structure. Unlike ETags this is case insensitive and used for vary, allow, and content-language headers. If not constructed using the parse_set_header() function the instantiation works like this: >>> hs = HeaderSet(['foo', 'bar', 'baz'])
>>> hs
HeaderSet(['foo', 'bar', 'baz'])
  
add(header)  
Add a new header to the set. 
  
as_set(preserve_casing=False)  
Return the set as real python set type. When calling this, all the items are converted to lowercase and the ordering is lost.  Parameters 
preserve_casing – if set to True the items in the set returned will have the original case like in the HeaderSet, otherwise they will be lowercase.   
  
clear()  
Clear the set. 
  
discard(header)  
Like remove() but ignores errors.  Parameters 
header – the header to be discarded.   
  
find(header)  
Return the index of the header in the set or return -1 if not found.  Parameters 
header – the header to be looked up.   
  
index(header)  
Return the index of the header in the set or raise an IndexError.  Parameters 
header – the header to be looked up.   
  
remove(header)  
Remove a header from the set. This raises an KeyError if the header is not in the set.  Changelog Changed in version 0.5: In older versions a IndexError was raised instead of a KeyError if the object was missing.   Parameters 
header – the header to be removed.   
  
to_header()  
Convert the header set into an HTTP header string. 
  
update(iterable)  
Add all the headers from the iterable to the set.  Parameters 
iterable – updates the set with the items from the iterable.
as_set(preserve_casing=False)  
Return the set as real python set type. When calling this, all the items are converted to lowercase and the ordering is lost.  Parameters 
preserve_casing – if set to True the items in the set returned will have the original case like in the HeaderSet, otherwise they will be lowercase.
discard(header)  
Like remove() but ignores errors.  Parameters 
header – the header to be discarded.
find(header)  
Return the index of the header in the set or return -1 if not found.  Parameters 
header – the header to be looked up.
index(header)  
Return the index of the header in the set or raise an IndexError.  Parameters 
header – the header to be looked up.
remove(header)  
Remove a header from the set. This raises an KeyError if the header is not in the set.  Changelog Changed in version 0.5: In older versions a IndexError was raised instead of a KeyError if the object was missing.   Parameters 
header – the header to be removed.
update(iterable)  
Add all the headers from the iterable to the set.  Parameters 
iterable – updates the set with the items from the iterable.
class werkzeug.utils.header_property(name, default=None, load_func=None, dump_func=None, read_only=None, doc=None)  
Like environ_property but for headers.
werkzeug.wsgi.host_is_trusted(hostname, trusted_list)  
Check if a host matches a list of trusted names.  Parameters 
 
hostname (str) – The name to check. 
trusted_list (Iterable[str]) – A list of valid names to match. If a name starts with a dot it will match all subdomains.   Return type 
bool    Changelog New in version 0.9.
class werkzeug.urls.Href(base='./', charset='utf-8', sort=False, key=None)  
Implements a callable that constructs URLs with the given base. The function can be called with any number of positional and keyword arguments which than are used to assemble the URL. Works with URLs and posix paths. Positional arguments are appended as individual segments to the path of the URL: >>> href = Href('/foo')
>>> href('bar', 23)
'/foo/bar/23'
>>> href('foo', bar=23)
'/foo/foo?bar=23'
 If any of the arguments (positional or keyword) evaluates to None it will be skipped. If no keyword arguments are given the last argument can be a dict or MultiDict (or any other dict subclass), otherwise the keyword arguments are used for the query parameters, cutting off the first trailing underscore of the parameter name: >>> href(is_=42)
'/foo?is=42'
>>> href({'foo': 'bar'})
'/foo?foo=bar'
 Combining of both methods is not allowed: >>> href({'foo': 'bar'}, bar=42)
Traceback (most recent call last):
  ...
TypeError: keyword arguments and query-dicts can't be combined
 Accessing attributes on the href object creates a new href object with the attribute name as prefix: >>> bar_href = href.bar
>>> bar_href("blub")
'/foo/bar/blub'
 If sort is set to True the items are sorted by key or the default sorting algorithm: >>> href = Href("/", sort=True)
>>> href(a=1, b=2, c=3)
'/?a=1&b=2&c=3'
  Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Use werkzeug.routing instead.   Changelog New in version 0.5: sort and key were added.
class werkzeug.utils.HTMLBuilder(dialect)  
Helper object for HTML generation. Per default there are two instances of that class. The html one, and the xhtml one for those two dialects. The class uses keyword parameters and positional parameters to generate small snippets of HTML. Keyword parameters are converted to XML/SGML attributes, positional arguments are used as children. Because Python accepts positional arguments before keyword arguments it’s a good idea to use a list with the star-syntax for some children: >>> html.p(class_='foo', *[html.a('foo', href='foo.html'), ' ',
...                        html.a('bar', href='bar.html')])
'<p class="foo"><a href="foo.html">foo</a> <a href="bar.html">bar</a></p>'
 This class works around some browser limitations and can not be used for arbitrary SGML/XML generation. For that purpose lxml and similar libraries exist. Calling the builder escapes the string passed: >>> html.p(html("<foo>"))
'<p>&lt;foo&gt;</p>'
  Deprecated since version 2.0: Will be removed in Werkzeug 2.1.
get_response(environ=None, scope=None)  
Get a response object. If one was passed to the exception it’s returned directly.  Parameters 
 
environ (Optional[WSGIEnvironment]) – the optional environ for the request. This can be used to modify the response depending on how the request looked like. 
scope (Optional[dict]) –    Returns 
a Response object or a subclass thereof.  Return type 
Response
__call__(environ, start_response)  
Call the exception as WSGI application.  Parameters 
 
environ (WSGIEnvironment) – the WSGI environment. 
start_response (StartResponse) – the response callable provided by the WSGI server.   Return type 
Iterable[bytes]
werkzeug.http.http_date(timestamp=None)  
Format a datetime object or timestamp into an RFC 2822 date string. This is a wrapper for email.utils.format_datetime(). It assumes naive datetime objects are in UTC instead of raising an exception.  Parameters 
timestamp (Optional[Union[datetime.datetime, datetime.date, int, float, time.struct_time]]) – The datetime or timestamp to format. Defaults to the current time.  Return type 
str    Changed in version 2.0: Use email.utils.format_datetime. Accept date objects.
class werkzeug.datastructures.IfRange(etag=None, date=None)  
Very simple object that represents the If-Range header in parsed form. It will either have neither a etag or date or one of either but never both.  Changelog New in version 0.7.   
date  
The date in parsed format or None. 
  
etag  
The etag parsed and unquoted. Ranges always operate on strong etags so the weakness information is not necessary. 
  
to_header()  
Converts the object back into an HTTP header.
etag  
The etag parsed and unquoted. Ranges always operate on strong etags so the weakness information is not necessary.
class werkzeug.datastructures.ImmutableDict  
An immutable dict.  Changelog New in version 0.5.   
copy()  
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple).
copy()  
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple).
class werkzeug.datastructures.ImmutableList(iterable=(), /)  
An immutable list.  Changelog New in version 0.5.   Private
class werkzeug.datastructures.ImmutableMultiDict(mapping=None)  
An immutable MultiDict.  Changelog New in version 0.5.   
copy()  
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple).
class werkzeug.datastructures.ImmutableOrderedMultiDict(mapping=None)  
An immutable OrderedMultiDict.  Changelog New in version 0.6.   
copy()  
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple).
class werkzeug.datastructures.ImmutableTypeConversionDict  
Works like a TypeConversionDict but does not support modifications.  Changelog New in version 0.5.   
copy()  
Return a shallow mutable copy of this object. Keep in mind that the standard library’s copy() function is a no-op for this class like for any other python immutable type (eg: tuple).
werkzeug.utils.import_string(import_name, silent=False)  
Imports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (xml.sax.saxutils.escape) or with a colon as object delimiter (xml.sax.saxutils:escape). If silent is True the return value will be None if the import fails.  Parameters 
 
import_name (str) – the dotted name for the object to import. 
silent (bool) – if set to True import errors are ignored and None is returned instead.   Returns 
imported object  Return type 
Any
Installation  Python Version We recommend using the latest version of Python. Werkzeug supports Python 3.6 and newer.   Dependencies Werkzeug does not have any direct dependencies.  Optional dependencies These distributions will not be installed automatically. Werkzeug will detect and use them if you install them.  
Colorama provides request log highlighting when using the development server on Windows. This works automatically on other systems. 
Watchdog provides a faster, more efficient reloader for the development server.     Virtual environments Use a virtual environment to manage the dependencies for your project, both in development and in production. What problem does a virtual environment solve? The more Python projects you have, the more likely it is that you need to work with different versions of Python libraries, or even Python itself. Newer versions of libraries for one project can break compatibility in another project. Virtual environments are independent groups of Python libraries, one for each project. Packages installed for one project will not affect other projects or the operating system’s packages. Python comes bundled with the venv module to create virtual environments.  Create an environment Create a project folder and a venv folder within: mkdir myproject
cd myproject
python3 -m venv venv
 On Windows: py -3 -m venv venv
   Activate the environment Before you work on your project, activate the corresponding environment: . venv/bin/activate
 On Windows: venv\Scripts\activate
 Your shell prompt will change to show the name of the activated environment.    Install Werkzeug Within the activated environment, use the following command to install Werkzeug: pip install Werkzeug
class werkzeug.routing.IntegerConverter(map, fixed_digits=0, min=None, max=None, signed=False)  
This converter only accepts integer values: Rule("/page/<int:page>")
 By default it only accepts unsigned, positive values. The signed parameter will enable signed, negative values. Rule("/page/<int(signed=True):page>")
  Parameters 
 
map (Map) – The Map. 
fixed_digits (int) – The number of fixed digits in the URL. If you set this to 4 for example, the rule will only match if the URL looks like /0001/. The default is variable length. 
min (Optional[int]) – The minimal value. 
max (Optional[int]) – The maximal value. 
signed (bool) – Allow signed (negative) values.   Return type 
None    Changelog New in version 0.15: The signed parameter.
original_exception  
The original exception that caused this 500 error. Can be used by frameworks to provide context when handling unexpected errors.
werkzeug.utils.invalidate_cached_property(obj, name)  
Invalidates the cache for a cached_property: >>> class Test(object):
...     @cached_property
...     def magic_number(self):
...         print("recalculating...")
...         return 42
...
>>> var = Test()
>>> var.magic_number
recalculating...
42
>>> var.magic_number
42
>>> invalidate_cached_property(var, "magic_number")
>>> var.magic_number
recalculating...
42
 You must pass the name of the cached property as the second argument.  Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Use del obj.name instead.   Parameters 
 
obj (object) –  
name (str) –    Return type 
None
werkzeug.urls.iri_to_uri(iri, charset='utf-8', errors='strict', safe_conversion=False)  
Convert an IRI to a URI. All non-ASCII and unsafe characters are quoted. If the URL has a domain, it is encoded to Punycode. >>> iri_to_uri('http://\u2603.net/p\xe5th?q=\xe8ry%DF')
'http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF'
  Parameters 
 
iri (Union[str, Tuple[str, str, str, str, str]]) – The IRI to convert. 
charset (str) – The encoding of the IRI. 
errors (str) – Error handler to use during bytes.encode. 
safe_conversion (bool) – Return the URL unchanged if it only contains ASCII characters and no whitespace. See the explanation below.   Return type 
str   There is a general problem with IRI conversion with some protocols that are in violation of the URI specification. Consider the following two IRIs: magnet:?xt=uri:whatever
itms-services://?action=download-manifest
 After parsing, we don’t know if the scheme requires the //, which is dropped if empty, but conveys different meanings in the final URL if it’s present or not. In this case, you can use safe_conversion, which will return the URL unchanged if it only contains ASCII characters and no whitespace. This can result in a URI with unquoted characters if it was not already quoted correctly, but preserves the URL’s semantics. Werkzeug uses this for the Location header for redirects.  Changelog Changed in version 0.15: All reserved characters remain unquoted. Previously, only some reserved characters were left unquoted.   Changed in version 0.9.6: The safe_conversion parameter was added.   New in version 0.6.
werkzeug.http.is_byte_range_valid(start, stop, length)  
Checks if a given byte content range is valid for the given length.  Changelog New in version 0.7.   Parameters 
 
start (Optional[int]) –  
stop (Optional[int]) –  
length (Optional[int]) –    Return type 
bool
werkzeug.http.is_entity_header(header)  
Check if a header is an entity header.  Changelog New in version 0.5.   Parameters 
header (str) – the header to test.  Returns 
True if it’s an entity header, False otherwise.  Return type 
bool
werkzeug.http.is_hop_by_hop_header(header)  
Check if a header is an HTTP/1.1 “Hop-by-Hop” header.  Changelog New in version 0.5.   Parameters 
header (str) – the header to test.  Returns 
True if it’s an HTTP/1.1 “Hop-by-Hop” header, False otherwise.  Return type 
bool
werkzeug.http.is_resource_modified(environ, etag=None, data=None, last_modified=None, ignore_if_range=True)  
Convenience method for conditional requests.  Parameters 
 
environ (WSGIEnvironment) – the WSGI environment of the request to be checked. 
etag (Optional[str]) – the etag for the response for comparison. 
data (Optional[bytes]) – or alternatively the data of the response to automatically generate an etag using generate_etag(). 
last_modified (Optional[Union[datetime.datetime, str]]) – an optional date of the last modification. 
ignore_if_range (bool) – If False, If-Range header will be taken into account.   Returns 
True if the resource was modified, otherwise False.  Return type 
bool    Changed in version 2.0: SHA-1 is used to generate an etag value for the data. MD5 may not be available in some environments.   Changelog Changed in version 1.0.0: The check is run for methods other than GET and HEAD.
werkzeug.serving.is_running_from_reloader()  
Checks if the application is running from within the Werkzeug reloader subprocess.  Changelog New in version 0.10.   Return type 
bool
class werkzeug.datastructures.LanguageAccept(values=())  
Like Accept but with normalization for language tags.
class werkzeug.wsgi.LimitedStream(stream, limit)  
Wraps a stream so that it doesn’t read more than n bytes. If the stream is exhausted and the caller tries to get more bytes from it on_exhausted() is called which by default returns an empty string. The return value of that function is forwarded to the reader function. So if it returns an empty string read() will return an empty string as well. The limit however must never be higher than what the stream can output. Otherwise readlines() will try to read past the limit.  Note on WSGI compliance calls to readline() and readlines() are not WSGI compliant because it passes a size argument to the readline methods. Unfortunately the WSGI PEP is not safely implementable without a size argument to readline() because there is no EOF marker in the stream. As a result of that the use of readline() is discouraged. For the same reason iterating over the LimitedStream is not portable. It internally calls readline(). We strongly suggest using read() only or using the make_line_iter() which safely iterates line-based over a WSGI input stream.   Parameters 
 
stream (BinaryIO) – the stream to wrap. 
limit (int) – the limit for the stream, must not be longer than what the string can provide if the stream does not end with EOF (like wsgi.input)   Return type 
None    
exhaust(chunk_size=65536)  
Exhaust the stream. This consumes all the data left until the limit is reached.  Parameters 
chunk_size (int) – the size for a chunk. It will read the chunk until the stream is exhausted and throw away the results.  Return type 
None   
  
property is_exhausted: bool  
If the stream is exhausted this attribute is True. 
  
on_disconnect()  
What should happen if a disconnect is detected? The return value of this function is returned from read functions in case the client went away. By default a ClientDisconnected exception is raised.  Return type 
bytes   
  
on_exhausted()  
This is called when the stream tries to read past the limit. The return value of this function is returned from the reading function.  Return type 
bytes   
  
read(size=None)  
Read size bytes or if size is not provided everything is read.  Parameters 
size (Optional[int]) – the number of bytes read.  Return type 
bytes   
  
readable()  
Return whether object was opened for reading. If False, read() will raise OSError.  Return type 
bool   
  
readline(size=None)  
Reads one line from the stream.  Parameters 
size (Optional[int]) –   Return type 
bytes   
  
readlines(size=None)  
Reads a file into a list of strings. It calls readline() until the file is read to the end. It does support the optional size argument if the underlying stream supports it for readline.  Parameters 
size (Optional[int]) –   Return type 
List[bytes]   
  
tell()  
Returns the position of the stream.  Changelog New in version 0.9.   Return type 
int
exhaust(chunk_size=65536)  
Exhaust the stream. This consumes all the data left until the limit is reached.  Parameters 
chunk_size (int) – the size for a chunk. It will read the chunk until the stream is exhausted and throw away the results.  Return type 
None
on_disconnect()  
What should happen if a disconnect is detected? The return value of this function is returned from read functions in case the client went away. By default a ClientDisconnected exception is raised.  Return type 
bytes
on_exhausted()  
This is called when the stream tries to read past the limit. The return value of this function is returned from the reading function.  Return type 
bytes
read(size=None)  
Read size bytes or if size is not provided everything is read.  Parameters 
size (Optional[int]) – the number of bytes read.  Return type 
bytes
readable()  
Return whether object was opened for reading. If False, read() will raise OSError.  Return type 
bool
readline(size=None)  
Reads one line from the stream.  Parameters 
size (Optional[int]) –   Return type 
bytes
readlines(size=None)  
Reads a file into a list of strings. It calls readline() until the file is read to the end. It does support the optional size argument if the underlying stream supports it for readline.  Parameters 
size (Optional[int]) –   Return type 
List[bytes]
tell()  
Returns the position of the stream.  Changelog New in version 0.9.   Return type 
int
class werkzeug.middleware.lint.LintMiddleware(app)  
Warns about common errors in the WSGI and HTTP behavior of the server and wrapped application. Some of the issues it checks are:  invalid status codes non-bytes sent to the WSGI server strings returned from the WSGI application non-empty conditional responses unquoted etags relative URLs in the Location header unsafe calls to wsgi.input unclosed iterators  Error information is emitted using the warnings module.  Parameters 
app (WSGIApplication) – The WSGI application to wrap.  Return type 
None   from werkzeug.middleware.lint import LintMiddleware
app = LintMiddleware(app)