neulab/docprompting-conala huggingface dataset:
form_valid(form)  
Saves the form instance, sets the current object for the view, and redirects to get_success_url().
get_form_class()  
Retrieve the form class to instantiate. If form_class is provided, that class will be used. Otherwise, a ModelForm will be instantiated using the model associated with the queryset, or with the model, depending on which attribute is provided.
get_form_kwargs()  
Add the current instance (self.object) to the standard get_form_kwargs().
get_success_url()  
Determine the URL to redirect to when the form is successfully validated. Returns django.views.generic.edit.ModelFormMixin.success_url if it is provided; otherwise, attempts to use the get_absolute_url() of the object.
model  
A model class. Can be explicitly provided, otherwise will be determined by examining self.object or queryset.
success_url  
The URL to redirect to when the form is successfully processed. success_url may contain dictionary string formatting, which will be interpolated against the object’s field attributes. For example, you could use success_url="/polls/{slug}/" to redirect to a URL composed out of the slug field on a model.
class django.views.generic.edit.ProcessFormView  
A mixin that provides basic HTTP GET and POST workflow.  Note This is named ‘ProcessFormView’ and inherits directly from django.views.generic.base.View, but breaks if used independently, so it is more of a mixin.  Extends  django.views.generic.base.View  Methods and Attributes  
get(request, *args, **kwargs)  
Renders a response using a context created with get_context_data(). 
  
post(request, *args, **kwargs)  
Constructs a form, checks the form for validity, and handles it accordingly. 
  
put(*args, **kwargs)  
The PUT action is also handled and passes all parameters through to post().
get(request, *args, **kwargs)  
Renders a response using a context created with get_context_data().
post(request, *args, **kwargs)  
Constructs a form, checks the form for validity, and handles it accordingly.
put(*args, **kwargs)  
The PUT action is also handled and passes all parameters through to post().
class django.views.generic.edit.UpdateView  
A view that displays a form for editing an existing object, redisplaying the form with validation errors (if there are any) and saving changes to the object. This uses a form automatically generated from the object’s model class (unless a form class is manually specified). Ancestors (MRO) This view inherits methods and attributes from the following views:  django.views.generic.detail.SingleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.edit.BaseUpdateView django.views.generic.edit.ModelFormMixin django.views.generic.edit.FormMixin django.views.generic.detail.SingleObjectMixin django.views.generic.edit.ProcessFormView django.views.generic.base.View  Attributes  
template_name_suffix  
The UpdateView page displayed to a GET request uses a template_name_suffix of '_form'. For example, changing this attribute to '_update_form' for a view updating objects for the example Author model would cause the default template_name to be 'myapp/author_update_form.html'. 
  
object  
When using UpdateView you have access to self.object, which is the object being updated. 
 Example myapp/views.py: from django.views.generic.edit import UpdateView
from myapp.models import Author

class AuthorUpdateView(UpdateView):
    model = Author
    fields = ['name']
    template_name_suffix = '_update_form'
 Example myapp/author_update_form.html: <form method="post">{% csrf_token %}
    {{ form.as_p }}
    <input type="submit" value="Update">
</form>
object  
When using UpdateView you have access to self.object, which is the object being updated.
template_name_suffix  
The UpdateView page displayed to a GET request uses a template_name_suffix of '_form'. For example, changing this attribute to '_update_form' for a view updating objects for the example Author model would cause the default template_name to be 'myapp/author_update_form.html'.
class django.views.generic.list.BaseListView  
A base view for displaying a list of objects. It is not intended to be used directly, but rather as a parent class of the django.views.generic.list.ListView or other views representing lists of objects. Ancestors (MRO) This view inherits methods and attributes from the following views:  django.views.generic.list.MultipleObjectMixin django.views.generic.base.View  Methods  
get(request, *args, **kwargs)  
Adds object_list to the context. If allow_empty is True then display an empty list. If allow_empty is False then raise a 404 error.
get(request, *args, **kwargs)  
Adds object_list to the context. If allow_empty is True then display an empty list. If allow_empty is False then raise a 404 error.
class django.views.generic.list.ListView  
A page representing a list of objects. While this view is executing, self.object_list will contain the list of objects (usually, but not necessarily a queryset) that the view is operating upon. Ancestors (MRO) This view inherits methods and attributes from the following views:  django.views.generic.list.MultipleObjectTemplateResponseMixin django.views.generic.base.TemplateResponseMixin django.views.generic.list.BaseListView django.views.generic.list.MultipleObjectMixin django.views.generic.base.View  Method Flowchart  setup() dispatch() http_method_not_allowed() get_template_names() get_queryset() get_context_object_name() get_context_data() get() render_to_response()  Example views.py: from django.utils import timezone
from django.views.generic.list import ListView

from articles.models import Article

class ArticleListView(ListView):

    model = Article
    paginate_by = 100  # if pagination is desired

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['now'] = timezone.now()
        return context
 Example myapp/urls.py: from django.urls import path

from article.views import ArticleListView

urlpatterns = [
    path('', ArticleListView.as_view(), name='article-list'),
]
 Example myapp/article_list.html: <h1>Articles</h1>
<ul>
{% for article in object_list %}
    <li>{{ article.pub_date|date }} - {{ article.headline }}</li>
{% empty %}
    <li>No articles yet.</li>
{% endfor %}
</ul>
 If you’re using pagination, you can adapt the example template from the pagination docs. Change instances of contacts in that example template to page_obj.
allow_empty  
A boolean specifying whether to display the page if no objects are available. If this is False and no objects are available, the view will raise a 404 instead of displaying an empty page. By default, this is True.
get_allow_empty()  
Return a boolean specifying whether to display the page if no objects are available. If this method returns False and no objects are available, the view will raise a 404 instead of displaying an empty page. By default, this is True.
get_context_object_name(object_list)  
Return the context variable name that will be used to contain the list of data that this view is manipulating. If object_list is a queryset of Django objects and context_object_name is not set, the context name will be the model_name of the model that the queryset is composed from, with postfix '_list' appended. For example, the model Article would have a context object named article_list.
get_ordering()  
Returns a string (or iterable of strings) that defines the ordering that will be applied to the queryset. Returns ordering by default.
get_paginate_by(queryset)  
Returns the number of items to paginate by, or None for no pagination. By default this returns the value of paginate_by.
get_paginate_orphans()  
An integer specifying the number of “overflow” objects the last page can contain. By default this returns the value of paginate_orphans.
get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True)  
Returns an instance of the paginator to use for this view. By default, instantiates an instance of paginator_class.
get_queryset()  
Get the list of items for this view. This must be an iterable and may be a queryset (in which queryset-specific behavior will be enabled).
ordering  
A string or list of strings specifying the ordering to apply to the queryset. Valid values are the same as those for order_by().
page_kwarg  
A string specifying the name to use for the page parameter. The view will expect this parameter to be available either as a query string parameter (via request.GET) or as a kwarg variable specified in the URLconf. Defaults to page.
paginate_by  
An integer specifying how many objects should be displayed per page. If this is given, the view will paginate objects with paginate_by objects per page. The view will expect either a page query string parameter (via request.GET) or a page variable specified in the URLconf.
paginate_orphans  
An integer specifying the number of “overflow” objects the last page can contain. This extends the paginate_by limit on the last page by up to paginate_orphans, in order to keep the last page from having a very small number of objects.
paginate_queryset(queryset, page_size)  
Returns a 4-tuple containing (paginator, page, object_list, is_paginated). Constructed by paginating queryset into pages of size page_size. If the request contains a page argument, either as a captured URL argument or as a GET argument, object_list will correspond to the objects from that page.
paginator_class  
The paginator class to be used for pagination. By default, django.core.paginator.Paginator is used. If the custom paginator class doesn’t have the same constructor interface as django.core.paginator.Paginator, you will also need to provide an implementation for get_paginator().
class django.views.generic.list.MultipleObjectTemplateResponseMixin  
A mixin class that performs template-based response rendering for views that operate upon a list of object instances. Requires that the view it is mixed with provides self.object_list, the list of object instances that the view is operating on. self.object_list may be, but is not required to be, a QuerySet. Extends  TemplateResponseMixin  Methods and Attributes  
template_name_suffix  
The suffix to append to the auto-generated candidate template name. Default suffix is _list. 
  
get_template_names()  
Returns a list of candidate template names. Returns the following list:  the value of template_name on the view (if provided) <app_label>/<model_name><template_name_suffix>.html
get_template_names()  
Returns a list of candidate template names. Returns the following list:  the value of template_name on the view (if provided) <app_label>/<model_name><template_name_suffix>.html
template_name_suffix  
The suffix to append to the auto-generated candidate template name. Default suffix is _list.
class JavaScriptCatalog  
A view that produces a JavaScript code library with functions that mimic the gettext interface, plus an array of translation strings. Attributes  
domain  
Translation domain containing strings to add in the view output. Defaults to 'djangojs'. 
  
packages  
A list of application names among installed applications. Those apps should contain a locale directory. All those catalogs plus all catalogs found in LOCALE_PATHS (which are always included) are merged into one catalog. Defaults to None, which means that all available translations from all INSTALLED_APPS are provided in the JavaScript output. 
 Example with default values: from django.views.i18n import JavaScriptCatalog

urlpatterns = [
    path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
]
 Example with custom packages: urlpatterns = [
    path('jsi18n/myapp/',
         JavaScriptCatalog.as_view(packages=['your.app.label']),
         name='javascript-catalog'),
]
 If your root URLconf uses i18n_patterns(), JavaScriptCatalog must also be wrapped by i18n_patterns() for the catalog to be correctly generated. Example with i18n_patterns(): from django.conf.urls.i18n import i18n_patterns

urlpatterns = i18n_patterns(
    path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
)
domain  
Translation domain containing strings to add in the view output. Defaults to 'djangojs'.
packages  
A list of application names among installed applications. Those apps should contain a locale directory. All those catalogs plus all catalogs found in LOCALE_PATHS (which are always included) are merged into one catalog. Defaults to None, which means that all available translations from all INSTALLED_APPS are provided in the JavaScript output.
class JSONCatalog  
In order to use another client-side library to handle translations, you may want to take advantage of the JSONCatalog view. It’s similar to JavaScriptCatalog but returns a JSON response. See the documentation for JavaScriptCatalog to learn about possible values and use of the domain and packages attributes. The response format is as follows: {
    "catalog": {
        # Translations catalog
    },
    "formats": {
        # Language formats for date, time, etc.
    },
    "plural": "..."  # Expression for plural forms, or null.
}
add_data_dir(data_path)[source]
 
Recursively add files under data_path to data_files list. Recursively add files under data_path to the list of data_files to be installed (and distributed). The data_path can be either a relative path-name, or an absolute path-name, or a 2-tuple where the first argument shows where in the install directory the data directory should be installed to.  Parameters 
 
data_pathseq or str


Argument can be either  2-sequence (<datadir suffix>, <path to data directory>) path to data directory where python datadir suffix defaults to package dir.      Notes Rules for installation paths: foo/bar -> (foo/bar, foo/bar) -> parent/foo/bar
(gun, foo/bar) -> parent/gun
foo/* -> (foo/a, foo/a), (foo/b, foo/b) -> parent/foo/a, parent/foo/b
(gun, foo/*) -> (gun, foo/a), (gun, foo/b) -> gun
(gun/*, foo/*) -> parent/gun/a, parent/gun/b
/foo/bar -> (bar, /foo/bar) -> parent/bar
(gun, /foo/bar) -> parent/gun
(fun/*/gun/*, sun/foo/bar) -> parent/fun/foo/gun/bar
 Examples For example suppose the source directory contains fun/foo.dat and fun/bar/car.dat: >>> self.add_data_dir('fun')                       
>>> self.add_data_dir(('sun', 'fun'))              
>>> self.add_data_dir(('gun', '/full/path/to/fun'))
 Will install data-files to the locations: <package install directory>/
  fun/
    foo.dat
    bar/
      car.dat
  sun/
    foo.dat
    bar/
      car.dat
  gun/
    foo.dat
    car.dat
add_extension(name, sources, **kw)[source]
 
Add extension to configuration. Create and add an Extension instance to the ext_modules list. This method also takes the following optional keyword arguments that are passed on to the Extension constructor.  Parameters 
 
namestr


name of the extension  
sourcesseq


list of the sources. The list of sources may contain functions (called source generators) which must take an extension instance and a build directory as inputs and return a source file or list of source files or None. If None is returned then no sources are generated. If the Extension instance has no sources after processing all source generators, then no extension module is built.  include_dirs :
define_macros :
undef_macros :
library_dirs :
libraries :
runtime_library_dirs :
extra_objects :
extra_compile_args :
extra_link_args :
extra_f77_compile_args :
extra_f90_compile_args :
export_symbols :
swig_opts :
depends :

The depends list contains paths to files or directories that the sources of the extension module depend on. If any path in the depends list is newer than the extension module, then the module will be rebuilt.  language :
f2py_options :
module_dirs :

extra_infodict or list


dict or list of dict of keywords to be appended to keywords.     Notes The self.paths(…) method is applied to all lists that may contain paths.
add_headers(*files)[source]
 
Add installable headers to configuration. Add the given sequence of files to the beginning of the headers list. By default, headers will be installed under <python- include>/<self.name.replace(‘.’,’/’)>/ directory. If an item of files is a tuple, then its first argument specifies the actual installation location relative to the <python-include> path.  Parameters 
 
filesstr or seq


Argument(s) can be either:  2-sequence (<includedir suffix>,<path to header file(s)>) path(s) to header file(s) where python includedir suffix will default to package name.
add_include_dirs(*paths)[source]
 
Add paths to configuration include directories. Add the given sequence of paths to the beginning of the include_dirs list. This list will be visible to all extension modules of the current package.
add_installed_library(name, sources, install_dir, build_info=None)[source]
 
Similar to add_library, but the specified library is installed. Most C libraries used with distutils are only used to build python extensions, but libraries built through this method will be installed so that they can be reused by third-party packages.  Parameters 
 
namestr


Name of the installed library.  
sourcessequence


List of the library’s source files. See add_library for details.  
install_dirstr


Path to install the library, relative to the current sub-package.  
build_infodict, optional


The following keys are allowed:  depends macros include_dirs extra_compiler_args extra_f77_compile_args extra_f90_compile_args f2py_options language     Returns 
 None
    See also  
add_library, add_npy_pkg_config, get_info

  Notes The best way to encode the options required to link against the specified C libraries is to use a “libname.ini” file, and use get_info to retrieve the required options (see add_npy_pkg_config for more information).
add_library(name, sources, **build_info)[source]
 
Add library to configuration.  Parameters 
 
namestr


Name of the extension.  
sourcessequence


List of the sources. The list of sources may contain functions (called source generators) which must take an extension instance and a build directory as inputs and return a source file or list of source files or None. If None is returned then no sources are generated. If the Extension instance has no sources after processing all source generators, then no extension module is built.  
build_infodict, optional


The following keys are allowed:  depends macros include_dirs extra_compiler_args extra_f77_compile_args extra_f90_compile_args f2py_options language
add_npy_pkg_config(template, install_dir, subst_dict=None)[source]
 
Generate and install a npy-pkg config file from a template. The config file generated from template is installed in the given install directory, using subst_dict for variable substitution.  Parameters 
 
templatestr


The path of the template, relatively to the current package path.  
install_dirstr


Where to install the npy-pkg config file, relatively to the current package path.  
subst_dictdict, optional


If given, any string of the form @key@ will be replaced by subst_dict[key] in the template file when installed. The install prefix is always available through the variable @prefix@, since the install prefix is not easy to get reliably from setup.py.      See also  
add_installed_library, get_info

  Notes This works for both standard installs and in-place builds, i.e. the @prefix@ refer to the source directory for in-place builds. Examples config.add_npy_pkg_config('foo.ini.in', 'lib', {'foo': bar})
 Assuming the foo.ini.in file has the following content: [meta]
Name=@foo@
Version=1.0
Description=dummy description

[default]
Cflags=-I@prefix@/include
Libs=
 The generated file will have the following content: [meta]
Name=bar
Version=1.0
Description=dummy description

[default]
Cflags=-Iprefix_dir/include
Libs=
 and will be installed as foo.ini in the ‘lib’ subpath. When cross-compiling with numpy distutils, it might be necessary to use modified npy-pkg-config files. Using the default/generated files will link with the host libraries (i.e. libnpymath.a). For cross-compilation you of-course need to link with target libraries, while using the host Python installation. You can copy out the numpy/core/lib/npy-pkg-config directory, add a pkgdir value to the .ini files and set NPY_PKG_CONFIG_PATH environment variable to point to the directory with the modified npy-pkg-config files. Example npymath.ini modified for cross-compilation: [meta]
Name=npymath
Description=Portable, core math library implementing C99 standard
Version=0.1

[variables]
pkgname=numpy.core
pkgdir=/build/arm-linux-gnueabi/sysroot/usr/lib/python3.7/site-packages/numpy/core
prefix=${pkgdir}
libdir=${prefix}/lib
includedir=${prefix}/include

[default]
Libs=-L${libdir} -lnpymath
Cflags=-I${includedir}
Requires=mlib

[msvc]
Libs=/LIBPATH:${libdir} npymath.lib
Cflags=/INCLUDE:${includedir}
Requires=mlib
add_scripts(*files)[source]
 
Add scripts to configuration. Add the sequence of files to the beginning of the scripts list. Scripts will be installed under the <prefix>/bin/ directory.
add_subpackage(subpackage_name, subpackage_path=None, standalone=False)[source]
 
Add a sub-package to the current Configuration instance. This is useful in a setup.py script for adding sub-packages to a package.  Parameters 
 
subpackage_namestr


name of the subpackage  
subpackage_pathstr


if given, the subpackage path such as the subpackage is in subpackage_path / subpackage_name. If None,the subpackage is assumed to be located in the local path / subpackage_name.  
standalonebool
numpy.broadcast.index attribute   broadcast.index
 
current index in broadcasted result Examples >>> x = np.array([[1], [2], [3]])
>>> y = np.array([4, 5, 6])
>>> b = np.broadcast(x, y)
>>> b.index
0
>>> next(b), next(b), next(b)
((1, 4), (1, 5), (1, 6))
>>> b.index
3
numpy.broadcast.iters attribute   broadcast.iters
 
tuple of iterators along self’s “components.” Returns a tuple of numpy.flatiter objects, one for each “component” of self.  See also  numpy.flatiter
  Examples >>> x = np.array([1, 2, 3])
>>> y = np.array([[4], [5], [6]])
>>> b = np.broadcast(x, y)
>>> row, col = b.iters
>>> next(row), next(col)
(1, 4)
numpy.broadcast.nd attribute   broadcast.nd
 
Number of dimensions of broadcasted result. For code intended for NumPy 1.12.0 and later the more consistent ndim is preferred. Examples >>> x = np.array([1, 2, 3])
>>> y = np.array([[4], [5], [6]])
>>> b = np.broadcast(x, y)
>>> b.nd
2
numpy.broadcast.ndim attribute   broadcast.ndim
 
Number of dimensions of broadcasted result. Alias for nd.  New in version 1.12.0.  Examples >>> x = np.array([1, 2, 3])
>>> y = np.array([[4], [5], [6]])
>>> b = np.broadcast(x, y)
>>> b.ndim
2
numpy.broadcast.numiter attribute   broadcast.numiter
 
Number of iterators possessed by the broadcasted result. Examples >>> x = np.array([1, 2, 3])
>>> y = np.array([[4], [5], [6]])
>>> b = np.broadcast(x, y)
>>> b.numiter
2
numpy.broadcast.reset method   broadcast.reset()
 
Reset the broadcasted result’s iterator(s).  Parameters 
 None
  Returns 
 None
   Examples >>> x = np.array([1, 2, 3])
>>> y = np.array([[4], [5], [6]])
>>> b = np.broadcast(x, y)
>>> b.index
0
>>> next(b), next(b), next(b)
((1, 4), (2, 4), (3, 4))
>>> b.index
3
>>> b.reset()
>>> b.index
0
numpy.broadcast.size attribute   broadcast.size
 
Total size of broadcasted result. Examples >>> x = np.array([1, 2, 3])
>>> y = np.array([[4], [5], [6]])
>>> b = np.broadcast(x, y)
>>> b.size
9