neulab/docprompting-conala huggingface dataset:
class TimeInput  
 
input_type: 'text'
 
template_name: 'django/forms/widgets/time.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 TIME_INPUT_FORMATS and respects Format localization. For the treatment of microseconds, see DateTimeInput.
class TypedChoiceField(**kwargs)  
Just like a ChoiceField, except TypedChoiceField takes two extra arguments, coerce and empty_value.  Default widget: Select
 Empty value: Whatever you’ve given as empty_value. Normalizes to: A value of the type provided by the coerce argument. Validates that the given value exists in the list of choices and can be coerced. Error message keys: required, invalid_choice
  Takes extra arguments:  
coerce  
A function that takes one argument and returns a coerced value. Examples include the built-in int, float, bool and other types. Defaults to an identity function. Note that coercion happens after input validation, so it is possible to coerce to a value not present in choices. 
  
empty_value  
The value to use to represent “empty.” Defaults to the empty string; None is another common choice here. Note that this value will not be coerced by the function given in the coerce argument, so choose it accordingly.
coerce  
A function that takes one argument and returns a coerced value. Examples include the built-in int, float, bool and other types. Defaults to an identity function. Note that coercion happens after input validation, so it is possible to coerce to a value not present in choices.
empty_value  
The value to use to represent “empty.” Defaults to the empty string; None is another common choice here. Note that this value will not be coerced by the function given in the coerce argument, so choose it accordingly.
class TypedMultipleChoiceField(**kwargs)  
Just like a MultipleChoiceField, except TypedMultipleChoiceField takes two extra arguments, coerce and empty_value.  Default widget: SelectMultiple
 Empty value: Whatever you’ve given as empty_value
 Normalizes to: A list of values of the type provided by the coerce argument. Validates that the given values exists in the list of choices and can be coerced. Error message keys: required, invalid_choice
  The invalid_choice error message may contain %(value)s, which will be replaced with the selected choice. Takes two extra arguments, coerce and empty_value, as for TypedChoiceField.
class URLField(**kwargs)  
 Default widget: URLInput
 Empty value: Whatever you’ve given as empty_value. Normalizes to: A string. Uses URLValidator to validate that the given value is a valid URL. 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 URLInput  
 
input_type: 'url'
 
template_name: 'django/forms/widgets/url.html'
 Renders as: <input type="url" ...>
class UUIDField(**kwargs)  
 Default widget: TextInput
 Empty value: None
 Normalizes to: A UUID object. Error message keys: required, invalid
  This field will accept any string format accepted as the hex argument to the UUID constructor.
attrs  
A dictionary containing HTML attributes to be set on the rendered widget. >>> from django import forms
>>> name = forms.TextInput(attrs={'size': 10, 'title': 'Your name'})
>>> name.render('name', 'A name')
'<input title="Your name" type="text" name="name" value="A name" size="10">'
 If you assign a value of True or False to an attribute, it will be rendered as an HTML5 boolean attribute: >>> name = forms.TextInput(attrs={'required': True})
>>> name.render('name', 'A name')
'<input name="name" type="text" value="A name" required>'
>>>
>>> name = forms.TextInput(attrs={'required': False})
>>> name.render('name', 'A name')
'<input name="name" type="text" value="A name">'
format_value(value)  
Cleans and returns a value for use in the widget template. value isn’t guaranteed to be valid input, therefore subclass implementations should program defensively.
get_context(name, value, attrs)  
Returns a dictionary of values to use when rendering the widget template. By default, the dictionary contains a single key, 'widget', which is a dictionary representation of the widget containing the following keys:  
'name': The name of the field from the name argument. 
'is_hidden': A boolean indicating whether or not this widget is hidden. 
'required': A boolean indicating whether or not the field for this widget is required. 
'value': The value as returned by format_value(). 
'attrs': HTML attributes to be set on the rendered widget. The combination of the attrs attribute and the attrs argument. 
'template_name': The value of self.template_name.  Widget subclasses can provide custom context values by overriding this method.
id_for_label(id_)  
Returns the HTML ID attribute of this widget for use by a <label>, given the ID of the field. Returns None if an ID isn’t available. This hook is necessary because some widgets have multiple HTML elements and, thus, multiple IDs. In that case, this method should return an ID value that corresponds to the first ID in the widget’s tags.
render(name, value, attrs=None, renderer=None)  
Renders a widget to HTML using the given renderer. If renderer is None, the renderer from the FORM_RENDERER setting is used.
supports_microseconds  
An attribute that defaults to True. If set to False, the microseconds part of datetime and time values will be set to 0.
use_required_attribute(initial)  
Given a form field’s initial value, returns whether or not the widget can be rendered with the required HTML attribute. Forms use this method along with Field.required and Form.use_required_attribute to determine whether or not to display the required attribute for each field. By default, returns False for hidden widgets and True otherwise. Special cases are FileInput and ClearableFileInput, which return False when initial is set, and CheckboxSelectMultiple, which always returns False because browser validation would require all checkboxes to be checked instead of at least one. Override this method in custom widgets that aren’t compatible with browser validation. For example, a WSYSIWG text editor widget backed by a hidden textarea element may want to always return False to avoid browser validation on the hidden field.
value_from_datadict(data, files, name)  
Given a dictionary of data and this widget’s name, returns the value of this widget. files may contain data coming from request.FILES. Returns None if a value wasn’t provided. Note also that value_from_datadict may be called more than once during handling of form data, so if you customize it and add expensive processing, you should implement some caching mechanism yourself.
value_omitted_from_data(data, files, name)  
Given data and files dictionaries and this widget’s name, returns whether or not there’s data or files for the widget. The method’s result affects whether or not a field in a model form falls back to its default. Special cases are CheckboxInput, CheckboxSelectMultiple, and SelectMultiple, which always return False because an unchecked checkbox and unselected <select multiple> don’t appear in the data of an HTML form submission, so it’s unknown whether or not the user submitted a value.
GeoDjango GeoDjango intends to be a world-class geographic web framework. Its goal is to make it as easy as possible to build GIS web applications and harness the power of spatially enabled data.  
GeoDjango Tutorial Introduction Setting Up Geographic Data Geographic Models Importing Spatial Data Spatial Queries Putting your data on the map   
GeoDjango Installation Overview Requirements Installation Troubleshooting Platform-specific instructions   
GeoDjango Model API Spatial Field Types Spatial Field Options Geometry Field Options   
GeoDjango Database API Spatial Backends Creating and Saving Models with Geometry Fields Creating and Saving Models with Raster Fields Spatial Lookups Distance Queries Compatibility Tables   
GeoDjango Forms API Field arguments Form field classes Form widgets   
GIS QuerySet API Reference Spatial Lookups Distance Lookups   
Geographic Database Functions Area AsGeoJSON AsGML AsKML AsSVG AsWKB AsWKT Azimuth BoundingCircle Centroid Difference Distance Envelope ForcePolygonCW GeoHash GeometryDistance Intersection IsValid Length LineLocatePoint MakeValid MemSize NumGeometries NumPoints Perimeter PointOnSurface Reverse Scale SnapToGrid SymDifference Transform Translate Union   
Measurement Objects Example Supported units Measurement API   
GEOS API Background Tutorial Geometry Objects Geometry Collections Prepared Geometries Geometry Factories I/O Objects Settings Exceptions   
GDAL API Overview Vector Data Source Objects OGR Geometries Coordinate System Objects Raster Data Objects Settings Exceptions   
Geolocation with GeoIP2 Example API Reference Methods Settings Exceptions   
GeoDjango Utilities LayerMapping data import utility OGR Inspection GeoJSON Serializer   
GeoDjango Management Commands inspectdb ogrinspect   
GeoDjango’s admin site GISModelAdmin GeoModelAdmin OSMGeoAdmin   
Geographic Feeds Example API Reference   
Geographic Sitemaps Example Reference   
Testing GeoDjango apps PostGIS GeoDjango tests   Deploying GeoDjango
class GeoModelAdmin  
 
default_lon 
 The default center longitude.  
default_lat 
 The default center latitude.  
default_zoom 
 The default zoom level to use. Defaults to 4.  
extra_js 
 Sequence of URLs to any extra JavaScript to include.  
map_template 
 Override the template used to generate the JavaScript slippy map. Default is 'gis/admin/openlayers.html'.  
map_width 
 Width of the map, in pixels. Defaults to 600.  
map_height 
 Height of the map, in pixels. Defaults to 400.  
openlayers_url 
 Link to the URL of the OpenLayers JavaScript. Defaults to 'https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js'.  
modifiable 
 Defaults to True. When set to False, disables editing of existing geometry fields in the admin.  Note This is different from adding the geometry field to readonly_fields, which will only display the WKT of the geometry. Setting modifiable=False, actually displays the geometry in a map, but disables the ability to edit its vertices.   Deprecated since version 4.0: This class is deprecated. Use ModelAdmin instead.
class GISModelAdmin  
 
gis_widget  
The widget class to be used for GeometryField. Defaults to OSMWidget. 
  
gis_widget_kwargs  
The keyword arguments that would be passed to the gis_widget. Defaults to an empty dictionary.
gis_widget  
The widget class to be used for GeometryField. Defaults to OSMWidget.
gis_widget_kwargs  
The keyword arguments that would be passed to the gis_widget. Defaults to an empty dictionary.
class OSMGeoAdmin  
A subclass of GeoModelAdmin that uses a Spherical Mercator projection with OpenStreetMap street data tiles.  Deprecated since version 4.0: This class is deprecated. Use GISModelAdmin instead.
class AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra)
class Feed  
In addition to methods provided by the django.contrib.syndication.views.Feed base class, GeoDjango’s Feed class provides the following overrides. Note that these overrides may be done in multiple ways: from django.contrib.gis.feeds import Feed

class MyFeed(Feed):

    # First, as a class attribute.
    geometry = ...
    item_geometry = ...

    # Also a function with no arguments
    def geometry(self):
        ...

    def item_geometry(self):
        ...

    # And as a function with a single argument
    def geometry(self, obj):
        ...

    def item_geometry(self, item):
        ...
  
geometry(obj) 
 Takes the object returned by get_object() and returns the feed’s geometry. Typically this is a GEOSGeometry instance, or can be a tuple to represent a point or a box. For example: class ZipcodeFeed(Feed):

    def geometry(self, obj):
        # Can also return: `obj.poly`, and `obj.poly.centroid`.
        return obj.poly.extent # tuple like: (X0, Y0, X1, Y1).
  
item_geometry(item) 
 Set this to return the geometry for each item in the feed. This can be a GEOSGeometry instance, or a tuple that represents a point coordinate or bounding box. For example: class ZipcodeFeed(Feed):

    def item_geometry(self, obj):
        # Returns the polygon.
        return obj.poly
Field.geom_type  
You generally shouldn’t have to set or change that attribute which should be set up depending on the field class. It matches the OpenGIS standard geometry name.
Field.srid  
This is the SRID code that the field value should be transformed to. For example, if the map widget SRID is different from the SRID more generally used by your application or database, the field will automatically convert input values into that SRID.
class BaseGeometryWidget  
This is an abstract base widget containing the logic needed by subclasses. You cannot directly use this widget for a geometry field. Note that the rendering of GeoDjango widgets is based on a template, identified by the template_name class attribute.
BaseGeometryWidget.display_raw  
Boolean value specifying if a textarea input showing the serialized representation of the current geometry is visible, mainly for debugging purposes (default is False).
BaseGeometryWidget.geom_type  
The OpenGIS geometry type, generally set by the form field.
BaseGeometryWidget.map_srid  
SRID code used by the map (default is 4326).
BaseGeometryWidget.map_width  
Height and width of the widget map (default is 400x600).
BaseGeometryWidget.supports_3d  
Indicates if the widget supports edition of 3D data (default is False).
class OpenLayersWidget  
This is the default widget used by all GeoDjango form fields. template_name is gis/openlayers.html. OpenLayersWidget and OSMWidget use the openlayers.js file hosted on the cdnjs.cloudflare.com content-delivery network. You can subclass these widgets in order to specify your own version of the OpenLayers.js file in the js property of the inner Media class (see Assets as a static definition).
class OSMWidget  
This widget uses an OpenStreetMap base layer to display geographic objects on. Attributes are:  
template_name  
gis/openlayers-osm.html 
  
default_lat 
  
default_lon  
The default center latitude and longitude are 47 and 5, respectively, which is a location in eastern France. 
  
default_zoom  
The default map zoom is 12. 
 The OpenLayersWidget note about JavaScript file hosting above also applies here. See also this FAQ answer about https access to map tiles.
default_lon  
The default center latitude and longitude are 47 and 5, respectively, which is a location in eastern France.
class DataSource(ds_input, encoding='utf-8')  
The constructor for DataSource only requires one parameter: the path of the file you want to read. However, OGR also supports a variety of more complex data sources, including databases, that may be accessed by passing a special name string instead of a path. For more information, see the OGR Vector Formats documentation. The name property of a DataSource instance gives the OGR name of the underlying data source that it is using. The optional encoding parameter allows you to specify a non-standard encoding of the strings in the source. This is typically useful when you obtain DjangoUnicodeDecodeError exceptions while reading field values. Once you’ve created your DataSource, you can find out how many layers of data it contains by accessing the layer_count property, or (equivalently) by using the len() function. For information on accessing the layers of data themselves, see the next section: >>> from django.contrib.gis.gdal import DataSource
>>> ds = DataSource('/path/to/your/cities.shp')
>>> ds.name
'/path/to/your/cities.shp'
>>> ds.layer_count                  # This file only contains one layer
1
  
layer_count 
 Returns the number of layers in the data source.  
name 
 Returns the name of the data source.  Changed in Django 3.2: Support for pathlib.Path ds_input was added.
class Driver(dr_input)  
The Driver class is used internally to wrap an OGR DataSource driver.  
driver_count 
 Returns the number of OGR vector drivers currently registered.
class Envelope(*args)  
Represents an OGR Envelope structure that contains the minimum and maximum X, Y coordinates for a rectangle bounding box. The naming of the variables is compatible with the OGR Envelope C structure.  
min_x 
 The value of the minimum X coordinate.  
min_y 
 The value of the maximum X coordinate.  
max_x 
 The value of the minimum Y coordinate.  
max_y 
 The value of the maximum Y coordinate.  
ur 
 The upper-right coordinate, as a tuple.  
ll 
 The lower-left coordinate, as a tuple.  
tuple 
 A tuple representing the envelope.  
wkt 
 A string representing this envelope as a polygon in WKT format.  
expand_to_include(*args)
class Feature  
Feature wraps an OGR feature. You never create a Feature object directly. Instead, you retrieve them from a Layer object. Each feature consists of a geometry and a set of fields containing additional properties. The geometry of a field is accessible via its geom property, which returns an OGRGeometry object. A Feature behaves like a standard Python container for its fields, which it returns as Field objects: you can access a field directly by its index or name, or you can iterate over a feature’s fields, e.g. in a for loop.  
geom 
 Returns the geometry for this feature, as an OGRGeometry object: >>> city.geom.tuple
(-104.609252, 38.255001)
  
get 
 A method that returns the value of the given field (specified by name) for this feature, not a Field wrapper object: >>> city.get('Population')
102121
  
geom_type 
 Returns the type of geometry for this feature, as an OGRGeomType object. This will be the same for all features in a given layer and is equivalent to the Layer.geom_type property of the Layer object the feature came from.  
num_fields 
 Returns the number of fields of data associated with the feature. This will be the same for all features in a given layer and is equivalent to the Layer.num_fields property of the Layer object the feature came from.  
fields 
 Returns a list of the names of the fields of data associated with the feature. This will be the same for all features in a given layer and is equivalent to the Layer.fields property of the Layer object the feature came from.  
fid 
 Returns the feature identifier within the layer: >>> city.fid
0
  
layer_name 
 Returns the name of the Layer that the feature came from. This will be the same for all features in a given layer: >>> city.layer_name
'cities'
  
index 
 A method that returns the index of the given field name. This will be the same for all features in a given layer: >>> city.index('Population')
1
class Field  
 
name 
 Returns the name of this field: >>> city['Name'].name
'Name'
  
type 
 Returns the OGR type of this field, as an integer. The FIELD_CLASSES dictionary maps these values onto subclasses of Field: >>> city['Density'].type
2
  
type_name 
 Returns a string with the name of the data type of this field: >>> city['Name'].type_name
'String'
  
value 
 Returns the value of this field. The Field class itself returns the value as a string, but each subclass returns the value in the most appropriate form: >>> city['Population'].value
102121
  
width 
 Returns the width of this field: >>> city['Name'].width
80
  
precision 
 Returns the numeric precision of this field. This is meaningless (and set to zero) for non-numeric fields: >>> city['Density'].precision
15
  
as_double() 
 Returns the value of the field as a double (float): >>> city['Density'].as_double()
874.7
  
as_int() 
 Returns the value of the field as an integer: >>> city['Population'].as_int()
102121
  
as_string() 
 Returns the value of the field as a string: >>> city['Name'].as_string()
'Pueblo'
  
as_datetime() 
 Returns the value of the field as a tuple of date and time components: >>> city['Created'].as_datetime()
(c_long(1999), c_long(5), c_long(23), c_long(0), c_long(0), c_long(0), c_long(0))
color_interp(as_string=False)  
The color interpretation for the band, as an integer between 0and 16. If as_string is True, the data type is returned as a string with the following possible values: GCI_Undefined, GCI_GrayIndex, GCI_PaletteIndex, GCI_RedBand, GCI_GreenBand, GCI_BlueBand, GCI_AlphaBand, GCI_HueBand, GCI_SaturationBand, GCI_LightnessBand, GCI_CyanBand, GCI_MagentaBand, GCI_YellowBand, GCI_BlackBand, GCI_YCbCr_YBand, GCI_YCbCr_CbBand, and GCI_YCbCr_CrBand. GCI_YCbCr_CrBand also represents GCI_Max because both correspond to the integer 16, but only GCI_YCbCr_CrBand is returned as a string.
data(data=None, offset=None, size=None, shape=None)  
The accessor to the pixel values of the GDALBand. Returns the complete data array if no parameters are provided. A subset of the pixel array can be requested by specifying an offset and block size as tuples. If NumPy is available, the data is returned as NumPy array. For performance reasons, it is highly recommended to use NumPy. Data is written to the GDALBand if the data parameter is provided. The input can be of one of the following types - packed string, buffer, list, array, and NumPy array. The number of items in the input should normally correspond to the total number of pixels in the band, or to the number of pixels for a specific block of pixel values if the offset and size parameters are provided. If the number of items in the input is different from the target pixel block, the shape parameter must be specified. The shape is a tuple that specifies the width and height of the input data in pixels. The data is then replicated to update the pixel values of the selected block. This is useful to fill an entire band with a single value, for instance. For example: >>> rst = GDALRaster({'width': 4, 'height': 4, 'srid': 4326, 'datatype': 1, 'nr_of_bands': 1})
>>> bnd = rst.bands[0]
>>> bnd.data(range(16))
>>> bnd.data()
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11],
       [12, 13, 14, 15]], dtype=int8)
>>> bnd.data(offset=(1, 1), size=(2, 2))
array([[ 5,  6],
       [ 9, 10]], dtype=int8)
>>> bnd.data(data=[-1, -2, -3, -4], offset=(1, 1), size=(2, 2))
>>> bnd.data()
array([[ 0,  1,  2,  3],
       [ 4, -1, -2,  7],
       [ 8, -3, -4, 11],
       [12, 13, 14, 15]], dtype=int8)
>>> bnd.data(data='\x9d\xa8\xb3\xbe', offset=(1, 1), size=(2, 2))
>>> bnd.data()
array([[  0,   1,   2,   3],
       [  4, -99, -88,   7],
       [  8, -77, -66,  11],
       [ 12,  13,  14,  15]], dtype=int8)
>>> bnd.data([1], shape=(1, 1))
>>> bnd.data()
array([[1, 1, 1, 1],
       [1, 1, 1, 1],
       [1, 1, 1, 1],
       [1, 1, 1, 1]], dtype=uint8)
>>> bnd.data(range(4), shape=(1, 4))
array([[0, 0, 0, 0],
       [1, 1, 1, 1],
       [2, 2, 2, 2],
       [3, 3, 3, 3]], dtype=uint8)
datatype(as_string=False)  
The data type contained in the band, as an integer constant between 0 (Unknown) and 11. If as_string is True, the data type is returned as a string with the following possible values: GDT_Unknown, GDT_Byte, GDT_UInt16, GDT_Int16, GDT_UInt32, GDT_Int32, GDT_Float32, GDT_Float64, GDT_CInt16, GDT_CInt32, GDT_CFloat32, and GDT_CFloat64.
mean  
The mean of all pixel values of the band (excluding the “no data” value).
metadata  
The metadata of this band. The functionality is identical to GDALRaster.metadata.
nodata_value  
The “no data” value for a band is generally a special marker value used to mark pixels that are not valid data. Such pixels should generally not be displayed, nor contribute to analysis operations. To delete an existing “no data” value, set this property to None (requires GDAL ≥ 2.1).
pixel_count  
The total number of pixels in this band. Is equal to width * height.