neulab/docprompting-conala huggingface dataset:
savepoint_commit(sid, using=None)  
Releases savepoint sid. The changes performed since the savepoint was created become part of the transaction.
savepoint_rollback(sid, using=None)  
Rolls back the transaction to savepoint sid.
receiver(signal) [source]
 
   
Parameters:

signal – A signal or a list of signals to connect a function to.
Signal.connect(receiver, sender=None, weak=True, dispatch_uid=None) [source]
 
   
Parameters:

 
receiver – The callback function which will be connected to this signal. See Receiver functions for more information. 
sender – Specifies a particular sender to receive signals from. See Connecting to signals sent by specific senders for more information. 
weak – Django stores signal handlers as weak references by default. Thus, if your receiver is a local function, it may be garbage collected. To prevent this, pass weak=False when you call the signal’s connect() method. 
dispatch_uid – A unique identifier for a signal receiver in cases where duplicate signals may be sent. See Preventing duplicate signals for more information.
Signal.disconnect(receiver=None, sender=None, dispatch_uid=None) [source]
django.contrib.postgres PostgreSQL has a number of features which are not shared by the other databases Django supports. This optional module contains model fields and form fields for a number of PostgreSQL specific data types.  Note Django is, and will continue to be, a database-agnostic web framework. We would encourage those writing reusable applications for the Django community to write database-agnostic code where practical. However, we recognize that real world projects written using Django need not be database-agnostic. In fact, once a project reaches a given size changing the underlying data store is already a significant challenge and is likely to require changing the code base in some ways to handle differences between the data stores. Django provides support for a number of data types which will only work with PostgreSQL. There is no fundamental reason why (for example) a contrib.mysql module does not exist, except that PostgreSQL has the richest feature set of the supported databases so its users have the most to gain.   
PostgreSQL specific aggregation functions General-purpose aggregation functions Aggregate functions for statistics Usage examples   
PostgreSQL specific database constraints ExclusionConstraint   
PostgreSQL specific query expressions ArraySubquery() expressions   
PostgreSQL specific model fields Indexing these fields ArrayField CIText fields HStoreField Range Fields   
PostgreSQL specific form fields and widgets Fields Widgets   
PostgreSQL specific database functions RandomUUID TransactionNow   
PostgreSQL specific model indexes BloomIndex BrinIndex BTreeIndex GinIndex GistIndex HashIndex SpGistIndex OpClass() expressions   
PostgreSQL specific lookups Trigram similarity Unaccent   
Database migration operations Creating extension using migrations CreateExtension BloomExtension BtreeGinExtension BtreeGistExtension CITextExtension CryptoExtension HStoreExtension TrigramExtension UnaccentExtension Managing collations using migrations Concurrent index operations Adding constraints without enforcing validation   
Full text search The search lookup SearchVector SearchQuery SearchRank SearchHeadline Changing the search configuration Weighting queries Performance Trigram similarity   
Validators KeysValidator Range validators
class FlatpageFallbackMiddleware  
Each time any Django application raises a 404 error, this middleware checks the flatpages database for the requested URL as a last resort. Specifically, it checks for a flatpage with the given URL with a site ID that corresponds to the SITE_ID setting. If it finds a match, it follows this algorithm:  If the flatpage has a custom template, it loads that template. Otherwise, it loads the template flatpages/default.html. It passes that template a single context variable, flatpage, which is the flatpage object. It uses RequestContext in rendering the template.  The middleware will only add a trailing slash and redirect (by looking at the APPEND_SLASH setting) if the resulting URL refers to a valid flatpage. Redirects are permanent (301 status code). If it doesn’t find a match, the request continues to be processed as usual. The middleware only gets activated for 404s – not for 500s or responses of any other status code.
class FlatPage  
Flatpages are represented by a standard Django model, which lives in django/contrib/flatpages/models.py. You can access flatpage objects via the Django database API.
class FlatPageSitemap  
The sitemaps.FlatPageSitemap class looks at all publicly visible flatpages defined for the current SITE_ID (see the sites documentation) and creates an entry in the sitemap. These entries include only the location attribute – not lastmod, changefreq or priority.
Forms Detailed form API reference. For introductory material, see the Working with forms topic guide.  
The Forms API Bound and unbound forms Using forms to validate data Initial form values Checking which form data has changed Accessing the fields from the form Accessing “clean” data Outputting forms as HTML More granular output Customizing BoundField Binding uploaded files to a form Subclassing forms Prefixes for forms   
Form fields Core field arguments Checking if the field data has changed Built-in Field classes Slightly complex built-in Field classes Fields which handle relationships Creating custom fields   
Model Form Functions modelform_factory modelformset_factory inlineformset_factory   
Formset Functions formset_factory   
The form rendering API The low-level render API Built-in-template form renderers Context available in formset templates Context available in form templates Context available in widget templates Overriding built-in formset templates Overriding built-in form templates Overriding built-in widget templates   
Widgets Specifying widgets Setting arguments for widgets Widgets inheriting from the Select widget Customizing widget instances Base widget classes Built-in widgets   
Form and field validation Raising ValidationError Using validation in practice
class BooleanField(**kwargs)  
 Default widget: CheckboxInput
 Empty value: False
 Normalizes to: A Python True or False value. Validates that the value is True (e.g. the check box is checked) if the field has required=True. Error message keys: required
   Note Since all Field subclasses have required=True by default, the validation condition here is important. If you want to include a boolean in your form that can be either True or False (e.g. a checked or unchecked checkbox), you must remember to pass in required=False when creating the BooleanField.
class BoundField  
Used to display HTML or access attributes for a single field of a Form instance. The __str__() method of this object displays the HTML for this field.
BoundField.as_hidden(attrs=None, **kwargs)  
Returns a string of HTML for representing this as an <input type="hidden">. **kwargs are passed to as_widget(). This method is primarily used internally. You should use a widget instead.
BoundField.as_widget(widget=None, attrs=None, only_initial=False)  
Renders the field by rendering the passed widget, adding any HTML attributes passed as attrs. If no widget is specified, then the field’s default widget will be used. only_initial is used by Django internals and should not be set explicitly.
BoundField.auto_id  
The HTML ID attribute for this BoundField. Returns an empty string if Form.auto_id is False.
BoundField.css_classes(extra_classes=None)  
When you use Django’s rendering shortcuts, CSS classes are used to indicate required form fields or fields that contain errors. If you’re manually rendering a form, you can access these CSS classes using the css_classes method: >>> f = ContactForm(data={'message': ''})
>>> f['message'].css_classes()
'required'
 If you want to provide some additional classes in addition to the error and required classes that may be required, you can provide those classes as an argument: >>> f = ContactForm(data={'message': ''})
>>> f['message'].css_classes('foo bar')
'foo bar required'
BoundField.data  
This property returns the data for this BoundField extracted by the widget’s value_from_datadict() method, or None if it wasn’t given: >>> unbound_form = ContactForm()
>>> print(unbound_form['subject'].data)
None
>>> bound_form = ContactForm(data={'subject': 'My Subject'})
>>> print(bound_form['subject'].data)
My Subject
BoundField.errors  
A list-like object that is displayed as an HTML <ul class="errorlist"> when printed: >>> data = {'subject': 'hi', 'message': '', 'sender': '', 'cc_myself': ''}
>>> f = ContactForm(data, auto_id=False)
>>> print(f['message'])
<input type="text" name="message" required>
>>> f['message'].errors
['This field is required.']
>>> print(f['message'].errors)
<ul class="errorlist"><li>This field is required.</li></ul>
>>> f['subject'].errors
[]
>>> print(f['subject'].errors)

>>> str(f['subject'].errors)
''
BoundField.field  
The form Field instance from the form class that this BoundField wraps.
BoundField.html_name  
The name that will be used in the widget’s HTML name attribute. It takes the form prefix into account.
BoundField.id_for_label  
Use this property to render the ID of this field. For example, if you are manually constructing a <label> in your template (despite the fact that label_tag() will do this for you): <label for="{{ form.my_field.id_for_label }}">...</label>{{ my_field }}
 By default, this will be the field’s name prefixed by id_ (“id_my_field” for the example above). You may modify the ID by setting attrs on the field’s widget. For example, declaring a field like this: my_field = forms.CharField(widget=forms.TextInput(attrs={'id': 'myFIELD'}))
 and using the template above, would render something like: <label for="myFIELD">...</label><input id="myFIELD" type="text" name="my_field" required>
BoundField.initial  
Use BoundField.initial to retrieve initial data for a form field. It retrieves the data from Form.initial if present, otherwise trying Field.initial. Callable values are evaluated. See Initial form values for more examples. BoundField.initial caches its return value, which is useful especially when dealing with callables whose return values can change (e.g. datetime.now or uuid.uuid4): >>> from datetime import datetime
>>> class DatedCommentForm(CommentForm):
...     created = forms.DateTimeField(initial=datetime.now)
>>> f = DatedCommentForm()
>>> f['created'].initial
datetime.datetime(2021, 7, 27, 9, 5, 54)
>>> f['created'].initial
datetime.datetime(2021, 7, 27, 9, 5, 54)
 Using BoundField.initial is recommended over get_initial_for_field().
BoundField.is_hidden  
Returns True if this BoundField’s widget is hidden.
BoundField.label  
The label of the field. This is used in label_tag().
BoundField.label_tag(contents=None, attrs=None, label_suffix=None)  
Renders a label tag for the form field using the template specified by Form.template_name_label. The available context is:  
field: This instance of the BoundField. 
contents: By default a concatenated string of BoundField.label and Form.label_suffix (or Field.label_suffix, if set). This can be overridden by the contents and label_suffix arguments. 
attrs: A dict containing for, Form.required_css_class, and id. id is generated by the field’s widget attrs or BoundField.auto_id. Additional attributes can be provided by the attrs argument. 
use_tag: A boolean which is True if the label has an id. If False the default template omits the <label> tag.   Tip In your template field is the instance of the BoundField. Therefore field.field accesses BoundField.field being the field you declare, e.g. forms.CharField.  To separately render the label tag of a form field, you can call its label_tag() method: >>> f = ContactForm(data={'message': ''})
>>> print(f['message'].label_tag())
<label for="id_message">Message:</label>
 If you’d like to customize the rendering this can be achieved by overriding the Form.template_name_label attribute or more generally by overriding the default template, see also Overriding built-in form templates.  Changed in Django 4.0: The label is now rendered using the template engine.
BoundField.name  
The name of this field in the form: >>> f = ContactForm()
>>> print(f['subject'].name)
subject
>>> print(f['message'].name)
message
BoundField.value()  
Use this method to render the raw value of this field as it would be rendered by a Widget: >>> initial = {'subject': 'welcome'}
>>> unbound_form = ContactForm(initial=initial)
>>> bound_form = ContactForm(data={'subject': 'hi'}, initial=initial)
>>> print(unbound_form['subject'].value())
welcome
>>> print(bound_form['subject'].value())
hi
BoundField.widget_type  
Returns the lowercased class name of the wrapped field’s widget, with any trailing input or widget removed. This may be used when building forms where the layout is dependent upon the widget type. For example: {% for field in form %}
    {% if field.widget_type == 'checkbox' %}
        # render one way
    {% else %}
        # render another way
    {% endif %}
{% endfor %}
class CharField(**kwargs)  
 Default widget: TextInput
 Empty value: Whatever you’ve given as empty_value. Normalizes to: A string. Uses MaxLengthValidator and MinLengthValidator if max_length and min_length are provided. Otherwise, all inputs are valid. Error message keys: required, max_length, min_length
  Has four optional arguments for validation:  
max_length 
  
min_length  
If provided, these arguments ensure that the string is at most or at least the given length. 
  
strip  
If True (default), the value will be stripped of leading and trailing whitespace. 
  
empty_value  
The value to use to represent “empty”. Defaults to an empty string.
empty_value  
The value to use to represent “empty”. Defaults to an empty string.
min_length  
If provided, these arguments ensure that the string is at most or at least the given length.
class CheckboxInput  
 
input_type: 'checkbox'
 
template_name: 'django/forms/widgets/checkbox.html'
 Renders as: <input type="checkbox" ...>
  Takes one optional argument:  
check_test  
A callable that takes the value of the CheckboxInput and returns True if the checkbox should be checked for that value.
check_test  
A callable that takes the value of the CheckboxInput and returns True if the checkbox should be checked for that value.
class CheckboxSelectMultiple  
 
template_name: 'django/forms/widgets/checkbox_select.html'
 
option_template_name: 'django/forms/widgets/checkbox_option.html'
  Similar to SelectMultiple, but rendered as a list of checkboxes: <div>
  <div><input type="checkbox" name="..." ></div>
  ...
</div>
 The outer <div> container receives the id attribute of the widget, if defined, or BoundField.auto_id otherwise.  Changed in Django 4.0: So they are announced more concisely by screen readers, checkboxes were changed to render in <div> tags.
class ChoiceField(**kwargs)  
 Default widget: Select
 Empty value: '' (an empty string) Normalizes to: A string. Validates that the given value exists in the list of choices. Error message keys: required, invalid_choice
  The invalid_choice error message may contain %(value)s, which will be replaced with the selected choice. Takes one extra argument:  
choices  
Either an iterable of 2-tuples to use as choices for this field, enumeration choices, or a callable that returns such an iterable. This argument accepts the same formats as the choices argument to a model field. See the model field reference documentation on choices for more details. If the argument is a callable, it is evaluated each time the field’s form is initialized, in addition to during rendering. Defaults to an empty list.
choices  
Either an iterable of 2-tuples to use as choices for this field, enumeration choices, or a callable that returns such an iterable. This argument accepts the same formats as the choices argument to a model field. See the model field reference documentation on choices for more details. If the argument is a callable, it is evaluated each time the field’s form is initialized, in addition to during rendering. Defaults to an empty list.
class ClearableFileInput  
 
template_name: 'django/forms/widgets/clearable_file_input.html'
 Renders as: <input type="file" ...> with an additional checkbox input to clear the field’s value, if the field is not required and has initial data.
class ComboField(**kwargs)  
 Default widget: TextInput
 Empty value: '' (an empty string) Normalizes to: A string. Validates the given value against each of the fields specified as an argument to the ComboField. Error message keys: required, invalid
  Takes one extra required argument:  
fields  
The list of fields that should be used to validate the field’s value (in the order in which they are provided). >>> from django.forms import ComboField
>>> f = ComboField(fields=[CharField(max_length=20), EmailField()])
>>> f.clean('test@example.com')
'test@example.com'
>>> f.clean('longemailaddress@example.com')
Traceback (most recent call last):
...
ValidationError: ['Ensure this value has at most 20 characters (it has 28).']
fields  
The list of fields that should be used to validate the field’s value (in the order in which they are provided). >>> from django.forms import ComboField
>>> f = ComboField(fields=[CharField(max_length=20), EmailField()])
>>> f.clean('test@example.com')
'test@example.com'
>>> f.clean('longemailaddress@example.com')
Traceback (most recent call last):
...
ValidationError: ['Ensure this value has at most 20 characters (it has 28).']
class DateField(**kwargs)  
 Default widget: DateInput
 Empty value: None
 Normalizes to: A Python datetime.date object. Validates that the given value is either a datetime.date, datetime.datetime or string formatted in a particular date format. Error message keys: required, invalid
  Takes one optional argument:  
input_formats  
A list of formats used to attempt to convert a string to a valid datetime.date object. 
 If no input_formats argument is provided, the default input formats are taken from DATE_INPUT_FORMATS if USE_L10N is False, or from the active locale format DATE_INPUT_FORMATS key if localization is enabled. See also format localization.
input_formats  
A list of formats used to attempt to convert a string to a valid datetime.date object.
class DateInput  
 
input_type: 'text'
 
template_name: 'django/forms/widgets/date.html'
 Renders as: <input type="text" ...>
  Takes same arguments as TextInput, with one more optional argument:  
format  
The format in which this field’s initial value will be displayed. 
 If no format argument is provided, the default format is the first format found in DATE_INPUT_FORMATS and respects Format localization.
class DateTimeField(**kwargs)  
 Default widget: DateTimeInput
 Empty value: None
 Normalizes to: A Python datetime.datetime object. Validates that the given value is either a datetime.datetime, datetime.date or string formatted in a particular datetime format. Error message keys: required, invalid
  Takes one optional argument:  
input_formats  
A list of formats used to attempt to convert a string to a valid datetime.datetime object, in addition to ISO 8601 formats. 
 The field always accepts strings in ISO 8601 formatted dates or similar recognized by parse_datetime(). Some examples are: * '2006-10-25 14:30:59'
* '2006-10-25T14:30:59'
* '2006-10-25 14:30'
* '2006-10-25T14:30'
* '2006-10-25T14:30Z'
* '2006-10-25T14:30+02:00'
* '2006-10-25'
 If no input_formats argument is provided, the default input formats are taken from DATETIME_INPUT_FORMATS and DATE_INPUT_FORMATS if USE_L10N is False, or from the active locale format DATETIME_INPUT_FORMATS and DATE_INPUT_FORMATS keys if localization is enabled. See also format localization.
input_formats  
A list of formats used to attempt to convert a string to a valid datetime.datetime object, in addition to ISO 8601 formats.
class DateTimeInput  
 
input_type: 'text'
 
template_name: 'django/forms/widgets/datetime.html'
 Renders as: <input type="text" ...>
  Takes same arguments as TextInput, with one more optional argument:  
format  
The format in which this field’s initial value will be displayed. 
 If no format argument is provided, the default format is the first format found in DATETIME_INPUT_FORMATS and respects Format localization. By default, the microseconds part of the time value is always set to 0. If microseconds are required, use a subclass with the supports_microseconds attribute set to True.
class DecimalField(**kwargs)  
 Default widget: NumberInput when Field.localize is False, else TextInput. Empty value: None
 Normalizes to: A Python decimal. Validates that the given value is a decimal. Uses MaxValueValidator and MinValueValidator if max_value and min_value are provided. Leading and trailing whitespace is ignored. Error message keys: required, invalid, max_value, min_value, max_digits, max_decimal_places, max_whole_digits
  The max_value and min_value error messages may contain %(limit_value)s, which will be substituted by the appropriate limit. Similarly, the max_digits, max_decimal_places and max_whole_digits error messages may contain %(max)s. Takes four optional arguments:  
max_value 
  
min_value  
These control the range of values permitted in the field, and should be given as decimal.Decimal values. 
  
max_digits  
The maximum number of digits (those before the decimal point plus those after the decimal point, with leading zeros stripped) permitted in the value. 
  
decimal_places  
The maximum number of decimal places permitted.
max_digits  
The maximum number of digits (those before the decimal point plus those after the decimal point, with leading zeros stripped) permitted in the value.
min_value  
These control the range of values permitted in the field, and should be given as decimal.Decimal values.
class DurationField(**kwargs)  
 Default widget: TextInput
 Empty value: None
 Normalizes to: A Python timedelta. Validates that the given value is a string which can be converted into a timedelta. The value must be between datetime.timedelta.min and datetime.timedelta.max. Error message keys: required, invalid, overflow.  Accepts any format understood by parse_duration().
class EmailField(**kwargs)  
 Default widget: EmailInput
 Empty value: Whatever you’ve given as empty_value. Normalizes to: A string. Uses EmailValidator to validate that the given value is a valid email address, using a moderately complex regular expression. Error message keys: required, invalid
  Has three optional arguments max_length, min_length, and empty_value which work just as they do for CharField.
class EmailInput  
 
input_type: 'email'
 
template_name: 'django/forms/widgets/email.html'
 Renders as: <input type="email" ...>