neulab/docprompting-conala huggingface dataset:
HttpResponse.__init__(content=b'', content_type=None, status=200, reason=None, charset=None, headers=None)  
Instantiates an HttpResponse object with the given page content, content type, and headers. content is most commonly an iterator, bytestring, memoryview, or string. Other types will be converted to a bytestring by encoding their string representation. Iterators should return strings or bytestrings and those will be joined together to form the content of the response. content_type is the MIME type optionally completed by a character set encoding and is used to fill the HTTP Content-Type header. If not specified, it is formed by 'text/html' and the DEFAULT_CHARSET settings, by default: "text/html; charset=utf-8". status is the HTTP status code for the response. You can use Python’s http.HTTPStatus for meaningful aliases, such as HTTPStatus.NO_CONTENT. reason is the HTTP response phrase. If not provided, a default phrase will be used. charset is the charset in which the response will be encoded. If not given it will be extracted from content_type, and if that is unsuccessful, the DEFAULT_CHARSET setting will be used. headers is a dict of HTTP headers for the response.  Changed in Django 3.2: The headers parameter was added.
HttpResponse.__setitem__(header, value)  
Sets the given header name to the given value. Both header and value should be strings.
HttpResponse.charset  
A string denoting the charset in which the response will be encoded. If not given at HttpResponse instantiation time, it will be extracted from content_type and if that is unsuccessful, the DEFAULT_CHARSET setting will be used.
HttpResponse.close()  
This method is called at the end of the request directly by the WSGI server.
HttpResponse.content  
A bytestring representing the content, encoded from a string if necessary.
HttpResponse.delete_cookie(key, path='/', domain=None, samesite=None)  
Deletes the cookie with the given key. Fails silently if the key doesn’t exist. Due to the way cookies work, path and domain should be the same values you used in set_cookie() – otherwise the cookie may not be deleted.
HttpResponse.get(header, alternate=None)  
Returns the value for the given header, or an alternate if the header doesn’t exist.
HttpResponse.getvalue()  
Returns the value of HttpResponse.content. This method makes an HttpResponse instance a stream-like object.
HttpResponse.has_header(header)  
Returns True or False based on a case-insensitive check for a header with the given name.
HttpResponse.headers  
 New in Django 3.2.  A case insensitive, dict-like object that provides an interface to all HTTP headers on the response. See Setting header fields.
HttpResponse.readable()  
Always False. This method makes an HttpResponse instance a stream-like object.
HttpResponse.reason_phrase  
The HTTP reason phrase for the response. It uses the HTTP standard’s default reason phrases. Unless explicitly set, reason_phrase is determined by the value of status_code.
HttpResponse.seekable()  
Always False. This method makes an HttpResponse instance a stream-like object.
HttpResponse.set_cookie(key, value='', max_age=None, expires=None, path='/', domain=None, secure=False, httponly=False, samesite=None)  
Sets a cookie. The parameters are the same as in the Morsel cookie object in the Python standard library.  
max_age should be an integer number of seconds, or None (default) if the cookie should last only as long as the client’s browser session. If expires is not specified, it will be calculated.  
expires should either be a string in the format "Wdy, DD-Mon-YY HH:MM:SS GMT" or a datetime.datetime object in UTC. If expires is a datetime object, the max_age will be calculated.  Use domain if you want to set a cross-domain cookie. For example, domain="example.com" will set a cookie that is readable by the domains www.example.com, blog.example.com, etc. Otherwise, a cookie will only be readable by the domain that set it.  Use secure=True if you want the cookie to be only sent to the server when a request is made with the https scheme.  
Use httponly=True if you want to prevent client-side JavaScript from having access to the cookie. HttpOnly is a flag included in a Set-Cookie HTTP response header. It’s part of the RFC 6265 standard for cookies and can be a useful way to mitigate the risk of a client-side script accessing the protected cookie data.  
Use samesite='Strict' or samesite='Lax' to tell the browser not to send this cookie when performing a cross-origin request. SameSite isn’t supported by all browsers, so it’s not a replacement for Django’s CSRF protection, but rather a defense in depth measure. Use samesite='None' (string) to explicitly state that this cookie is sent with all same-site and cross-site requests.    Warning RFC 6265 states that user agents should support cookies of at least 4096 bytes. For many browsers this is also the maximum size. Django will not raise an exception if there’s an attempt to store a cookie of more than 4096 bytes, but many browsers will not set the cookie correctly.
HttpResponse.set_signed_cookie(key, value, salt='', max_age=None, expires=None, path='/', domain=None, secure=False, httponly=False, samesite=None)  
Like set_cookie(), but cryptographic signing the cookie before setting it. Use in conjunction with HttpRequest.get_signed_cookie(). You can use the optional salt argument for added key strength, but you will need to remember to pass it to the corresponding HttpRequest.get_signed_cookie() call.
HttpResponse.setdefault(header, value)  
Sets a header unless it has already been set.
HttpResponse.status_code  
The HTTP status code for the response. Unless reason_phrase is explicitly set, modifying the value of status_code outside the constructor will also modify the value of reason_phrase.
HttpResponse.streaming  
This is always False. This attribute exists so middleware can treat streaming responses differently from regular responses.
HttpResponse.writable()  
Always True. This method makes an HttpResponse instance a stream-like object.
HttpResponse.write(content)  
This method makes an HttpResponse instance a file-like object.
HttpResponse.writelines(lines)  
Writes a list of lines to the response. Line separators are not added. This method makes an HttpResponse instance a stream-like object.
class HttpResponseBadRequest  
Acts just like HttpResponse but uses a 400 status code.
class HttpResponseForbidden  
Acts just like HttpResponse but uses a 403 status code.
class HttpResponseGone  
Acts just like HttpResponse but uses a 410 status code.
class HttpResponseNotAllowed  
Like HttpResponse, but uses a 405 status code. The first argument to the constructor is required: a list of permitted methods (e.g. ['GET', 'POST']).
class HttpResponseNotFound  
Acts just like HttpResponse but uses a 404 status code.
class HttpResponseNotModified  
The constructor doesn’t take any arguments and no content should be added to this response. Use this to designate that a page hasn’t been modified since the user’s last request (status code 304).
class HttpResponsePermanentRedirect  
Like HttpResponseRedirect, but it returns a permanent redirect (HTTP status code 301) instead of a “found” redirect (status code 302).
class HttpResponseRedirect  
The first argument to the constructor is required – the path to redirect to. This can be a fully qualified URL (e.g. 'https://www.yahoo.com/search/'), an absolute path with no domain (e.g. '/search/'), or even a relative path (e.g. 'search/'). In that last case, the client browser will reconstruct the full URL itself according to the current path. See HttpResponse for other optional constructor arguments. Note that this returns an HTTP status code 302.  
url  
This read-only attribute represents the URL the response will redirect to (equivalent to the Location response header).
url  
This read-only attribute represents the URL the response will redirect to (equivalent to the Location response header).
class HttpResponseServerError  
Acts just like HttpResponse but uses a 500 status code.
class JsonResponse(data, encoder=DjangoJSONEncoder, safe=True, json_dumps_params=None, **kwargs)  
An HttpResponse subclass that helps to create a JSON-encoded response. It inherits most behavior from its superclass with a couple differences: Its default Content-Type header is set to application/json. The first parameter, data, should be a dict instance. If the safe parameter is set to False (see below) it can be any JSON-serializable object. The encoder, which defaults to django.core.serializers.json.DjangoJSONEncoder, will be used to serialize the data. See JSON serialization for more details about this serializer. The safe boolean parameter defaults to True. If it’s set to False, any object can be passed for serialization (otherwise only dict instances are allowed). If safe is True and a non-dict object is passed as the first argument, a TypeError will be raised. The json_dumps_params parameter is a dictionary of keyword arguments to pass to the json.dumps() call used to generate the response.
QueryDict.__contains__(key)  
Returns True if the given key is set. This lets you do, e.g., if "foo"
in request.GET.
QueryDict.__getitem__(key)  
Returns the value for the given key. If the key has more than one value, it returns the last value. Raises django.utils.datastructures.MultiValueDictKeyError if the key does not exist. (This is a subclass of Python’s standard KeyError, so you can stick to catching KeyError.)
QueryDict.__init__(query_string=None, mutable=False, encoding=None)  
Instantiates a QueryDict object based on query_string. >>> QueryDict('a=1&a=2&c=3')
<QueryDict: {'a': ['1', '2'], 'c': ['3']}>
 If query_string is not passed in, the resulting QueryDict will be empty (it will have no keys or values). Most QueryDicts you encounter, and in particular those at request.POST and request.GET, will be immutable. If you are instantiating one yourself, you can make it mutable by passing mutable=True to its __init__(). Strings for setting both keys and values will be converted from encoding to str. If encoding is not set, it defaults to DEFAULT_CHARSET.
QueryDict.__setitem__(key, value)  
Sets the given key to [value] (a list whose single element is value). Note that this, as other dictionary functions that have side effects, can only be called on a mutable QueryDict (such as one that was created via QueryDict.copy()).
QueryDict.appendlist(key, item)  
Appends an item to the internal list associated with key.
QueryDict.copy()  
Returns a copy of the object using copy.deepcopy(). This copy will be mutable even if the original was not.
QueryDict.dict()  
Returns a dict representation of QueryDict. For every (key, list) pair in QueryDict, dict will have (key, item), where item is one element of the list, using the same logic as QueryDict.__getitem__(): >>> q = QueryDict('a=1&a=3&a=5')
>>> q.dict()
{'a': '5'}
QueryDict.get(key, default=None)  
Uses the same logic as __getitem__(), with a hook for returning a default value if the key doesn’t exist.
QueryDict.getlist(key, default=None)  
Returns a list of the data with the requested key. Returns an empty list if the key doesn’t exist and default is None. It’s guaranteed to return a list unless the default value provided isn’t a list.
QueryDict.items()  
Like dict.items(), except this uses the same last-value logic as __getitem__() and returns an iterator object instead of a view object. For example: >>> q = QueryDict('a=1&a=2&a=3')
>>> list(q.items())
[('a', '3')]
QueryDict.lists()  
Like items(), except it includes all values, as a list, for each member of the dictionary. For example: >>> q = QueryDict('a=1&a=2&a=3')
>>> q.lists()
[('a', ['1', '2', '3'])]
QueryDict.pop(key)  
Returns a list of values for the given key and removes them from the dictionary. Raises KeyError if the key does not exist. For example: >>> q = QueryDict('a=1&a=2&a=3', mutable=True)
>>> q.pop('a')
['1', '2', '3']
QueryDict.popitem()  
Removes an arbitrary member of the dictionary (since there’s no concept of ordering), and returns a two value tuple containing the key and a list of all values for the key. Raises KeyError when called on an empty dictionary. For example: >>> q = QueryDict('a=1&a=2&a=3', mutable=True)
>>> q.popitem()
('a', ['1', '2', '3'])
QueryDict.setdefault(key, default=None)  
Like dict.setdefault(), except it uses __setitem__() internally.
QueryDict.setlist(key, list_)  
Sets the given key to list_ (unlike __setitem__()).
QueryDict.setlistdefault(key, default_list=None)  
Like setdefault(), except it takes a list of values instead of a single value.
QueryDict.update(other_dict)  
Takes either a QueryDict or a dictionary. Like dict.update(), except it appends to the current dictionary items rather than replacing them. For example: >>> q = QueryDict('a=1', mutable=True)
>>> q.update({'a': '2'})
>>> q.getlist('a')
['1', '2']
>>> q['a'] # returns the last
'2'
QueryDict.urlencode(safe=None)  
Returns a string of the data in query string format. For example: >>> q = QueryDict('a=2&b=3&b=5')
>>> q.urlencode()
'a=2&b=3&b=5'
 Use the safe parameter to pass characters which don’t require encoding. For example: >>> q = QueryDict(mutable=True)
>>> q['next'] = '/a&b/'
>>> q.urlencode(safe='/')
'next=/a%26b/'
QueryDict.values()  
Like dict.values(), except this uses the same last-value logic as __getitem__() and returns an iterator instead of a view object. For example: >>> q = QueryDict('a=1&a=2&a=3')
>>> list(q.values())
['3']
StreamingHttpResponse.reason_phrase  
The HTTP reason phrase for the response. It uses the HTTP standard’s default reason phrases. Unless explicitly set, reason_phrase is determined by the value of status_code.
StreamingHttpResponse.status_code  
The HTTP status code for the response. Unless reason_phrase is explicitly set, modifying the value of status_code outside the constructor will also modify the value of reason_phrase.
StreamingHttpResponse.streaming_content  
An iterator of the response content, bytestring encoded according to HttpResponse.charset.
add_message(request, level, message, extra_tags='', fail_silently=False)
class storage.base.Message  
When you loop over the list of messages in a template, what you get are instances of the Message class. They have only a few attributes:  
message: The actual text of the message. 
level: An integer describing the type of the message (see the message levels section above). 
tags: A string combining all the message’s tags (extra_tags and level_tag) separated by spaces. 
extra_tags: A string containing custom tags for this message, separated by spaces. It’s empty by default. 
level_tag: The string representation of the level. By default, it’s the lowercase version of the name of the associated constant, but this can be changed if you need by using the MESSAGE_TAGS setting.
class storage.cookie.CookieStorage  
This class stores the message data in a cookie (signed with a secret hash to prevent manipulation) to persist notifications across requests. Old messages are dropped if the cookie data size would exceed 2048 bytes.  Changed in Django 3.2: Messages format was changed to the RFC 6265 compliant format.
class storage.fallback.FallbackStorage  
This class first uses CookieStorage, and falls back to using SessionStorage for the messages that could not fit in a single cookie. It also requires Django’s contrib.sessions application. This behavior avoids writing to the session whenever possible. It should provide the best performance in the general case.
class storage.session.SessionStorage  
This class stores all messages inside of the request’s session. Therefore it requires Django’s contrib.sessions application.
class views.SuccessMessageMixin  
Adds a success message attribute to FormView based classes  
get_success_message(cleaned_data)  
cleaned_data is the cleaned data from the form which is used for string formatting
get_success_message(cleaned_data)  
cleaned_data is the cleaned data from the form which is used for string formatting
Models Model API reference. For introductory material, see Models.  Model field reference Field attribute reference Model index reference Constraints reference Model _meta API Related objects reference Model class reference Model Meta options Model instance reference QuerySet API reference Lookup API reference Query Expressions Conditional Expressions Database Functions
class ArrayAgg(expression, distinct=False, filter=None, default=None, ordering=(), **extra)  
Returns a list of values, including nulls, concatenated into an array, or default if there are no values.  
distinct  
An optional boolean argument that determines if array values will be distinct. Defaults to False. 
  
ordering  
An optional string of a field name (with an optional "-" prefix which indicates descending order) or an expression (or a tuple or list of strings and/or expressions) that specifies the ordering of the elements in the result list. Examples: 'some_field'
'-some_field'
from django.db.models import F
F('some_field').desc()
 
  Deprecated since version 4.0: If there are no rows and default is not provided, ArrayAgg returns an empty list instead of None. This behavior is deprecated and will be removed in Django 5.0. If you need it, explicitly set default to Value([]).
distinct  
An optional boolean argument that determines if array values will be distinct. Defaults to False.
ordering  
An optional string of a field name (with an optional "-" prefix which indicates descending order) or an expression (or a tuple or list of strings and/or expressions) that specifies the ordering of the elements in the result list. Examples: 'some_field'
'-some_field'
from django.db.models import F
F('some_field').desc()
class BitAnd(expression, filter=None, default=None, **extra)  
Returns an int of the bitwise AND of all non-null input values, or default if all values are null.
class BitOr(expression, filter=None, default=None, **extra)  
Returns an int of the bitwise OR of all non-null input values, or default if all values are null.
class BoolAnd(expression, filter=None, default=None, **extra)  
Returns True, if all input values are true, default if all values are null or if there are no values, otherwise False. Usage example: class Comment(models.Model):
    body = models.TextField()
    published = models.BooleanField()
    rank = models.IntegerField()

>>> from django.db.models import Q
>>> from django.contrib.postgres.aggregates import BoolAnd
>>> Comment.objects.aggregate(booland=BoolAnd('published'))
{'booland': False}
>>> Comment.objects.aggregate(booland=BoolAnd(Q(rank__lt=100)))
{'booland': True}
class BoolOr(expression, filter=None, default=None, **extra)  
Returns True if at least one input value is true, default if all values are null or if there are no values, otherwise False. Usage example: class Comment(models.Model):
    body = models.TextField()
    published = models.BooleanField()
    rank = models.IntegerField()

>>> from django.db.models import Q
>>> from django.contrib.postgres.aggregates import BoolOr
>>> Comment.objects.aggregate(boolor=BoolOr('published'))
{'boolor': True}
>>> Comment.objects.aggregate(boolor=BoolOr(Q(rank__gt=2)))
{'boolor': False}
class Corr(y, x, filter=None, default=None)  
Returns the correlation coefficient as a float, or default if there aren’t any matching rows.
class CovarPop(y, x, sample=False, filter=None, default=None)  
Returns the population covariance as a float, or default if there aren’t any matching rows. Has one optional argument:  
sample  
By default CovarPop returns the general population covariance. However, if sample=True, the return value will be the sample population covariance.
sample  
By default CovarPop returns the general population covariance. However, if sample=True, the return value will be the sample population covariance.
class JSONBAgg(expressions, distinct=False, filter=None, default=None, ordering=(), **extra)  
Returns the input values as a JSON array, or default if there are no values. You can query the result using key and index lookups.  
distinct  
 New in Django 3.2.  An optional boolean argument that determines if array values will be distinct. Defaults to False. 
  
ordering  
 New in Django 3.2.  An optional string of a field name (with an optional "-" prefix which indicates descending order) or an expression (or a tuple or list of strings and/or expressions) that specifies the ordering of the elements in the result list. Examples are the same as for ArrayAgg.ordering. 
 Usage example: class Room(models.Model):
    number = models.IntegerField(unique=True)

class HotelReservation(model.Model):
    room = models.ForeignKey('Room', on_delete=models.CASCADE)
    start = models.DateTimeField()
    end = models.DateTimeField()
    requirements = models.JSONField(blank=True, null=True)

>>> from django.contrib.postgres.aggregates import JSONBAgg
>>> Room.objects.annotate(
...     requirements=JSONBAgg(
...         'hotelreservation__requirements',
...         ordering='-hotelreservation__start',
...     )
... ).filter(requirements__0__sea_view=True).values('number', 'requirements')
<QuerySet [{'number': 102, 'requirements': [
    {'parking': False, 'sea_view': True, 'double_bed': False},
    {'parking': True, 'double_bed': True}
]}]>
  Deprecated since version 4.0: If there are no rows and default is not provided, JSONBAgg returns an empty list instead of None. This behavior is deprecated and will be removed in Django 5.0. If you need it, explicitly set default to Value('[]').
distinct  
 New in Django 3.2.  An optional boolean argument that determines if array values will be distinct. Defaults to False.
ordering  
 New in Django 3.2.  An optional string of a field name (with an optional "-" prefix which indicates descending order) or an expression (or a tuple or list of strings and/or expressions) that specifies the ordering of the elements in the result list. Examples are the same as for ArrayAgg.ordering.
class RegrAvgX(y, x, filter=None, default=None)  
Returns the average of the independent variable (sum(x)/N) as a float, or default if there aren’t any matching rows.
class RegrAvgY(y, x, filter=None, default=None)  
Returns the average of the dependent variable (sum(y)/N) as a float, or default if there aren’t any matching rows.
class RegrCount(y, x, filter=None)  
Returns an int of the number of input rows in which both expressions are not null.  Note The default argument is not supported.
class RegrIntercept(y, x, filter=None, default=None)  
Returns the y-intercept of the least-squares-fit linear equation determined by the (x, y) pairs as a float, or default if there aren’t any matching rows.
class RegrR2(y, x, filter=None, default=None)  
Returns the square of the correlation coefficient as a float, or default if there aren’t any matching rows.
class RegrSlope(y, x, filter=None, default=None)  
Returns the slope of the least-squares-fit linear equation determined by the (x, y) pairs as a float, or default if there aren’t any matching rows.
class RegrSXX(y, x, filter=None, default=None)  
Returns sum(x^2) - sum(x)^2/N (“sum of squares” of the independent variable) as a float, or default if there aren’t any matching rows.
class RegrSXY(y, x, filter=None, default=None)  
Returns sum(x*y) - sum(x) * sum(y)/N (“sum of products” of independent times dependent variable) as a float, or default if there aren’t any matching rows.
class RegrSYY(y, x, filter=None, default=None)  
Returns sum(y^2) - sum(y)^2/N (“sum of squares” of the dependent variable) as a float, or default if there aren’t any matching rows.