neulab/docprompting-conala huggingface dataset:
werkzeug.urls.url_decode(s, charset='utf-8', decode_keys=None, include_empty=True, errors='replace', separator='&', cls=None)  
Parse a query string and return it as a MultiDict.  Parameters 
 
s (AnyStr) – The query string to parse. 
charset (str) – Decode bytes to string with this charset. If not given, bytes are returned as-is. 
include_empty (bool) – Include keys with empty values in the dict. 
errors (str) – Error handling behavior when decoding bytes. 
separator (str) – Separator character between pairs. 
cls (Optional[Type[ds.MultiDict]]) – Container to hold result instead of MultiDict. 
decode_keys (None) –    Return type 
ds.MultiDict[str, str]    Changed in version 2.0: The decode_keys parameter is deprecated and will be removed in Werkzeug 2.1.   Changelog Changed in version 0.5: In previous versions “;” and “&” could be used for url decoding. Now only “&” is supported. If you want to use “;”, a different separator can be provided.   Changed in version 0.5: The cls parameter was added.
werkzeug.urls.url_decode_stream(stream, charset='utf-8', decode_keys=None, include_empty=True, errors='replace', separator=b'&', cls=None, limit=None, return_iterator=False)  
Works like url_decode() but decodes a stream. The behavior of stream and limit follows functions like make_line_iter(). The generator of pairs is directly fed to the cls so you can consume the data while it’s parsed.  Parameters 
 
stream (BinaryIO) – a stream with the encoded querystring 
charset (str) – the charset of the query string. If set to None no decoding will take place. 
include_empty (bool) – Set to False if you don’t want empty values to appear in the dict. 
errors (str) – the decoding error behavior. 
separator (bytes) – the pair separator to be used, defaults to &
 
cls (Optional[Type[ds.MultiDict]]) – an optional dict class to use. If this is not specified or None the default MultiDict is used. 
limit (Optional[int]) – the content length of the URL data. Not necessary if a limited stream is provided. 
decode_keys (None) –  
return_iterator (bool) –    Return type 
ds.MultiDict[str, str]    Changed in version 2.0: The decode_keys and return_iterator parameters are deprecated and will be removed in Werkzeug 2.1.   Changelog New in version 0.8.
werkzeug.urls.url_encode(obj, charset='utf-8', encode_keys=None, sort=False, key=None, separator='&')  
URL encode a dict/MultiDict. If a value is None it will not appear in the result string. Per default only values are encoded into the target charset strings.  Parameters 
 
obj (Union[Mapping[str, str], Iterable[Tuple[str, str]]]) – the object to encode into a query string. 
charset (str) – the charset of the query string. 
sort (bool) – set to True if you want parameters to be sorted by key. 
separator (str) – the separator to be used for the pairs. 
key (Optional[Callable[[Tuple[str, str]], Any]]) – an optional function to be used for sorting. For more details check out the sorted() documentation. 
encode_keys (None) –    Return type 
str    Changed in version 2.0: The encode_keys parameter is deprecated and will be removed in Werkzeug 2.1.   Changelog Changed in version 0.5: Added the sort, key, and separator parameters.
werkzeug.urls.url_encode_stream(obj, stream=None, charset='utf-8', encode_keys=None, sort=False, key=None, separator='&')  
Like url_encode() but writes the results to a stream object. If the stream is None a generator over all encoded pairs is returned.  Parameters 
 
obj (Union[Mapping[str, str], Iterable[Tuple[str, str]]]) – the object to encode into a query string. 
stream (Optional[TextIO]) – a stream to write the encoded object into or None if an iterator over the encoded pairs should be returned. In that case the separator argument is ignored. 
charset (str) – the charset of the query string. 
sort (bool) – set to True if you want parameters to be sorted by key. 
separator (str) – the separator to be used for the pairs. 
key (Optional[Callable[[Tuple[str, str]], Any]]) – an optional function to be used for sorting. For more details check out the sorted() documentation. 
encode_keys (None) –    Return type 
None    Changed in version 2.0: The encode_keys parameter is deprecated and will be removed in Werkzeug 2.1.   Changelog New in version 0.8.
werkzeug.urls.url_fix(s, charset='utf-8')  
Sometimes you get an URL by a user that just isn’t a real URL because it contains unsafe characters like ‘ ‘ and so on. This function can fix some of the problems in a similar way browsers handle data entered by the user: >>> url_fix('http://de.wikipedia.org/wiki/Elf (Begriffskl\xe4rung)')
'http://de.wikipedia.org/wiki/Elf%20(Begriffskl%C3%A4rung)'
  Parameters 
 
s (str) – the string with the URL to fix. 
charset (str) – The target charset for the URL if the url was given as a string.   Return type 
str
werkzeug.urls.url_join(base, url, allow_fragments=True)  
Join a base URL and a possibly relative URL to form an absolute interpretation of the latter.  Parameters 
 
base (Union[str, Tuple[str, str, str, str, str]]) – the base URL for the join operation. 
url (Union[str, Tuple[str, str, str, str, str]]) – the URL to join. 
allow_fragments (bool) – indicates whether fragments should be allowed.   Return type 
str
werkzeug.urls.url_parse(url, scheme=None, allow_fragments=True)  
Parses a URL from a string into a URL tuple. If the URL is lacking a scheme it can be provided as second argument. Otherwise, it is ignored. Optionally fragments can be stripped from the URL by setting allow_fragments to False. The inverse of this function is url_unparse().  Parameters 
 
url (str) – the URL to parse. 
scheme (Optional[str]) – the default schema to use if the URL is schemaless. 
allow_fragments (bool) – if set to False a fragment will be removed from the URL.   Return type 
werkzeug.urls.BaseURL
werkzeug.urls.url_quote(string, charset='utf-8', errors='strict', safe='/:', unsafe='')  
URL encode a single string with a given encoding.  Parameters 
 
s – the string to quote. 
charset (str) – the charset to be used. 
safe (Union[str, bytes]) – an optional sequence of safe characters. 
unsafe (Union[str, bytes]) – an optional sequence of unsafe characters. 
string (Union[str, bytes]) –  
errors (str) –    Return type 
str    Changelog New in version 0.9.2: The unsafe parameter was added.
werkzeug.urls.url_quote_plus(string, charset='utf-8', errors='strict', safe='')  
URL encode a single string with the given encoding and convert whitespace to “+”.  Parameters 
 
s – The string to quote. 
charset (str) – The charset to be used. 
safe (str) – An optional sequence of safe characters. 
string (str) –  
errors (str) –    Return type 
str
werkzeug.urls.url_unparse(components)  
The reverse operation to url_parse(). This accepts arbitrary as well as URL tuples and returns a URL as a string.  Parameters 
components (Tuple[str, str, str, str, str]) – the parsed URL as tuple which should be converted into a URL string.  Return type 
str
werkzeug.urls.url_unquote(s, charset='utf-8', errors='replace', unsafe='')  
URL decode a single string with a given encoding. If the charset is set to None no decoding is performed and raw bytes are returned.  Parameters 
 
s (Union[str, bytes]) – the string to unquote. 
charset (str) – the charset of the query string. If set to None no decoding will take place. 
errors (str) – the error handling for the charset decoding. 
unsafe (str) –    Return type 
str
werkzeug.urls.url_unquote_plus(s, charset='utf-8', errors='replace')  
URL decode a single string with the given charset and decode “+” to whitespace. Per default encoding errors are ignored. If you want a different behavior you can set errors to 'replace' or 'strict'.  Parameters 
 
s (Union[str, bytes]) – The string to unquote. 
charset (str) – the charset of the query string. If set to None no decoding will take place. 
errors (str) – The error handling for the charset decoding.   Return type 
str
class werkzeug.user_agent.UserAgent(string)  
Represents a parsed user agent header value. The default implementation does no parsing, only the string attribute is set. A subclass may parse the string to set the common attributes or expose other information. Set werkzeug.wrappers.Request.user_agent_class to use a subclass.  Parameters 
string (str) – The header value to parse.  Return type 
None    New in version 2.0: This replaces the previous useragents module, but does not provide a built-in parser.   
platform: Optional[str] = None  
The OS name, if it could be parsed from the string. 
  
browser: Optional[str] = None  
The browser name, if it could be parsed from the string. 
  
version: Optional[str] = None  
The browser version, if it could be parsed from the string. 
  
language: Optional[str] = None  
The browser language, if it could be parsed from the string. 
  
string: str  
The original header value. 
  
to_header()  
Convert to a header value.  Return type 
str
class werkzeug.useragents.UserAgent(environ_or_string)  
Represents a parsed user agent header value. This uses a basic parser to try to extract some information from the header.  Parameters 
environ_or_string (t.Union[str, WSGIEnvironment]) – The header value to parse, or a WSGI environ containing the header.  Return type 
None    Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Subclass werkzeug.user_agent.UserAgent (note the new module name) to use a dedicated parser instead.   Changed in version 2.0: Passing a WSGI environ is deprecated and will be removed in 2.1.   
to_header()  
Convert to a header value.  Return type 
str
browser: Optional[str] = None  
The browser name, if it could be parsed from the string.
language: Optional[str] = None  
The browser language, if it could be parsed from the string.
platform: Optional[str] = None  
The OS name, if it could be parsed from the string.
version: Optional[str] = None  
The browser version, if it could be parsed from the string.
class werkzeug.routing.UUIDConverter(map, *args, **kwargs)  
This converter only accepts UUID strings: Rule('/object/<uuid:identifier>')
  Changelog New in version 0.10.   Parameters 
 
map (Map) – the Map. 
args (Any) –  
kwargs (Any) –    Return type 
None
werkzeug.utils.validate_arguments(func, args, kwargs, drop_extra=True)  
Checks if the function accepts the arguments and keyword arguments. Returns a new (args, kwargs) tuple that can safely be passed to the function without causing a TypeError because the function signature is incompatible. If drop_extra is set to True (which is the default) any extra positional or keyword arguments are dropped automatically. The exception raised provides three attributes:  
missing 

A set of argument names that the function expected but where missing.  
extra 

A dict of keyword arguments that the function can not handle but where provided.  
extra_positional 

A list of values that where given by positional argument but the function cannot accept.   This can be useful for decorators that forward user submitted data to a view function: from werkzeug.utils import ArgumentValidationError, validate_arguments

def sanitize(f):
    def proxy(request):
        data = request.values.to_dict()
        try:
            args, kwargs = validate_arguments(f, (request,), data)
        except ArgumentValidationError:
            raise BadRequest('The browser failed to transmit all '
                             'the data expected.')
        return f(*args, **kwargs)
    return proxy
  Parameters 
 
func – the function the validation is performed against. 
args – a tuple of positional arguments. 
kwargs – a dict of keyword arguments. 
drop_extra – set to False if you don’t want extra arguments to be silently dropped.   Returns 
tuple in the form (args, kwargs).    Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Use inspect.signature() instead.
werkzeug.wsgi.wrap_file(environ, file, buffer_size=8192)  
Wraps a file. This uses the WSGI server’s file wrapper if available or otherwise the generic FileWrapper.  Changelog New in version 0.5.  If the file wrapper from the WSGI server is used it’s important to not iterate over it from inside the application but to pass it through unchanged. If you want to pass out a file wrapper inside a response object you have to set Response.direct_passthrough to True. More information about file wrappers are available in PEP 333.  Parameters 
 
file (BinaryIO) – a file-like object with a read() method. 
buffer_size (int) – number of bytes for one iteration. 
environ (WSGIEnvironment) –    Return type 
Iterable[bytes]
class werkzeug.datastructures.WWWAuthenticate(auth_type=None, values=None, on_update=None)  
Provides simple access to WWW-Authenticate headers.  
property algorithm  
A string indicating a pair of algorithms used to produce the digest and a checksum. If this is not present it is assumed to be “MD5”. If the algorithm is not understood, the challenge should be ignored (and a different one used, if there is more than one). 
  
static auth_property(name, doc=None)  
A static helper function for Authentication subclasses to add extra authentication system properties onto a class: class FooAuthenticate(WWWAuthenticate):
    special_realm = auth_property('special_realm')
 For more information have a look at the sourcecode to see how the regular properties (realm etc.) are implemented. 
  
property domain  
A list of URIs that define the protection space. If a URI is an absolute path, it is relative to the canonical root URL of the server being accessed. 
  
property nonce  
A server-specified data string which should be uniquely generated each time a 401 response is made. It is recommended that this string be base64 or hexadecimal data. 
  
property opaque  
A string of data, specified by the server, which should be returned by the client unchanged in the Authorization header of subsequent requests with URIs in the same protection space. It is recommended that this string be base64 or hexadecimal data. 
  
property qop  
A set of quality-of-privacy directives such as auth and auth-int. 
  
property realm  
A string to be displayed to users so they know which username and password to use. This string should contain at least the name of the host performing the authentication and might additionally indicate the collection of users who might have access. 
  
set_basic(realm='authentication required')  
Clear the auth info and enable basic auth. 
  
set_digest(realm, nonce, qop=('auth'), opaque=None, algorithm=None, stale=False)  
Clear the auth info and enable digest auth. 
  
property stale  
A flag, indicating that the previous request from the client was rejected because the nonce value was stale. 
  
to_header()  
Convert the stored values into a WWW-Authenticate header. 
  
property type  
The type of the auth mechanism. HTTP currently specifies Basic and Digest.
static auth_property(name, doc=None)  
A static helper function for Authentication subclasses to add extra authentication system properties onto a class: class FooAuthenticate(WWWAuthenticate):
    special_realm = auth_property('special_realm')
 For more information have a look at the sourcecode to see how the regular properties (realm etc.) are implemented.
set_digest(realm, nonce, qop=('auth'), opaque=None, algorithm=None, stale=False)  
Clear the auth info and enable digest auth.
Caching  A certain woman had a very sharp consciousness but almost no memory ... She remembered enough to work, and she worked hard. - Lydia Davis  Caching in REST Framework works well with the cache utilities provided in Django. Using cache with apiview and viewsets Django provides a method_decorator to use decorators with class based views. This can be used with other cache decorators such as cache_page, vary_on_cookie and vary_on_headers. from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.decorators.vary import vary_on_cookie, vary_on_headers

from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import viewsets


class UserViewSet(viewsets.ViewSet):
    # With cookie: cache requested url for each user for 2 hours
    @method_decorator(cache_page(60*60*2))
    @method_decorator(vary_on_cookie)
    def list(self, request, format=None):
        content = {
            'user_feed': request.user.get_user_feed()
        }
        return Response(content)


class ProfileView(APIView):
    # With auth: cache requested url for each user for 2 hours
    @method_decorator(cache_page(60*60*2))
    @method_decorator(vary_on_headers("Authorization",))
    def get(self, request, format=None):
        content = {
            'user_feed': request.user.get_user_feed()
        }
        return Response(content)


class PostView(APIView):
    # Cache page for the requested url
    @method_decorator(cache_page(60*60*2))
    def get(self, request, format=None):
        content = {
            'title': 'Post title',
            'body': 'Post content'
        }
        return Response(content)
 NOTE: The cache_page decorator only caches the GET and HEAD responses with status 200.
sklearn.base.BaseEstimator  
class sklearn.base.BaseEstimator [source]
 
Base class for all estimators in scikit-learn. Notes All estimators should specify all the parameters that can be set at the class level in their __init__ as explicit keyword arguments (no *args or **kwargs). Methods  
get_params([deep]) Get parameters for this estimator.  
set_params(**params) Set the parameters of this estimator.    
get_params(deep=True) [source]
 
Get parameters for this estimator.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsdict 

Parameter names mapped to their values.     
  
set_params(**params) [source]
 
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.  Parameters 
 
**paramsdict 

Estimator parameters.    Returns 
 
selfestimator instance 

Estimator instance.     
 
 Examples using sklearn.base.BaseEstimator
 
  Inductive Clustering  

  Approximate nearest neighbors in TSNE
class sklearn.base.BaseEstimator [source]
 
Base class for all estimators in scikit-learn. Notes All estimators should specify all the parameters that can be set at the class level in their __init__ as explicit keyword arguments (no *args or **kwargs). Methods  
get_params([deep]) Get parameters for this estimator.  
set_params(**params) Set the parameters of this estimator.    
get_params(deep=True) [source]
 
Get parameters for this estimator.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsdict 

Parameter names mapped to their values.     
  
set_params(**params) [source]
 
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.  Parameters 
 
**paramsdict 

Estimator parameters.    Returns 
 
selfestimator instance 

Estimator instance.
get_params(deep=True) [source]
 
Get parameters for this estimator.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsdict 

Parameter names mapped to their values.
set_params(**params) [source]
 
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.  Parameters 
 
**paramsdict 

Estimator parameters.    Returns 
 
selfestimator instance 

Estimator instance.
sklearn.base.BiclusterMixin  
class sklearn.base.BiclusterMixin [source]
 
Mixin class for all bicluster estimators in scikit-learn.  Attributes 
 
biclusters_


Convenient way to get row and column indicators together.     Methods  
get_indices(i) Row and column indices of the i’th bicluster.  
get_shape(i) Shape of the i’th bicluster.  
get_submatrix(i, data) Return the submatrix corresponding to bicluster i.    
property biclusters_  
Convenient way to get row and column indicators together. Returns the rows_ and columns_ members. 
  
get_indices(i) [source]
 
Row and column indices of the i’th bicluster. Only works if rows_ and columns_ attributes exist.  Parameters 
 
iint 

The index of the cluster.    Returns 
 
row_indndarray, dtype=np.intp 

Indices of rows in the dataset that belong to the bicluster.  
col_indndarray, dtype=np.intp 

Indices of columns in the dataset that belong to the bicluster.     
  
get_shape(i) [source]
 
Shape of the i’th bicluster.  Parameters 
 
iint 

The index of the cluster.    Returns 
 
n_rowsint 

Number of rows in the bicluster.  
n_colsint 

Number of columns in the bicluster.     
  
get_submatrix(i, data) [source]
 
Return the submatrix corresponding to bicluster i.  Parameters 
 
iint 

The index of the cluster.  
dataarray-like of shape (n_samples, n_features) 

The data.    Returns 
 
submatrixndarray of shape (n_rows, n_cols) 

The submatrix corresponding to bicluster i.     Notes Works with sparse matrices. Only works if rows_ and columns_ attributes exist.
class sklearn.base.BiclusterMixin [source]
 
Mixin class for all bicluster estimators in scikit-learn.  Attributes 
 
biclusters_


Convenient way to get row and column indicators together.     Methods  
get_indices(i) Row and column indices of the i’th bicluster.  
get_shape(i) Shape of the i’th bicluster.  
get_submatrix(i, data) Return the submatrix corresponding to bicluster i.    
property biclusters_  
Convenient way to get row and column indicators together. Returns the rows_ and columns_ members. 
  
get_indices(i) [source]
 
Row and column indices of the i’th bicluster. Only works if rows_ and columns_ attributes exist.  Parameters 
 
iint 

The index of the cluster.    Returns 
 
row_indndarray, dtype=np.intp 

Indices of rows in the dataset that belong to the bicluster.  
col_indndarray, dtype=np.intp 

Indices of columns in the dataset that belong to the bicluster.     
  
get_shape(i) [source]
 
Shape of the i’th bicluster.  Parameters 
 
iint 

The index of the cluster.    Returns 
 
n_rowsint 

Number of rows in the bicluster.  
n_colsint 

Number of columns in the bicluster.     
  
get_submatrix(i, data) [source]
 
Return the submatrix corresponding to bicluster i.  Parameters 
 
iint 

The index of the cluster.  
dataarray-like of shape (n_samples, n_features) 

The data.    Returns 
 
submatrixndarray of shape (n_rows, n_cols) 

The submatrix corresponding to bicluster i.     Notes Works with sparse matrices. Only works if rows_ and columns_ attributes exist.
property biclusters_  
Convenient way to get row and column indicators together. Returns the rows_ and columns_ members.
get_indices(i) [source]
 
Row and column indices of the i’th bicluster. Only works if rows_ and columns_ attributes exist.  Parameters 
 
iint 

The index of the cluster.    Returns 
 
row_indndarray, dtype=np.intp 

Indices of rows in the dataset that belong to the bicluster.  
col_indndarray, dtype=np.intp 

Indices of columns in the dataset that belong to the bicluster.
get_shape(i) [source]
 
Shape of the i’th bicluster.  Parameters 
 
iint 

The index of the cluster.    Returns 
 
n_rowsint 

Number of rows in the bicluster.  
n_colsint 

Number of columns in the bicluster.
get_submatrix(i, data) [source]
 
Return the submatrix corresponding to bicluster i.  Parameters 
 
iint 

The index of the cluster.  
dataarray-like of shape (n_samples, n_features) 

The data.    Returns 
 
submatrixndarray of shape (n_rows, n_cols) 

The submatrix corresponding to bicluster i.     Notes Works with sparse matrices. Only works if rows_ and columns_ attributes exist.