neulab/docprompting-conala huggingface dataset:
BaseCommand.add_arguments(parser)  
Entry point to add parser arguments to handle command line arguments passed to the command. Custom commands should override this method to add both positional and optional arguments accepted by the command. Calling super() is not needed when directly subclassing BaseCommand.
BaseCommand.check(app_configs=None, tags=None, display_num_errors=False)  
Uses the system check framework to inspect the entire Django project for potential problems. Serious problems are raised as a CommandError; warnings are output to stderr; minor notifications are output to stdout. If app_configs and tags are both None, all system checks are performed. tags can be a list of check tags, like compatibility or models.
BaseCommand.create_parser(prog_name, subcommand, **kwargs)  
Returns a CommandParser instance, which is an ArgumentParser subclass with a few customizations for Django. You can customize the instance by overriding this method and calling super() with kwargs of ArgumentParser parameters.
BaseCommand.execute(*args, **options)  
Tries to execute this command, performing system checks if needed (as controlled by the requires_system_checks attribute). If the command raises a CommandError, it’s intercepted and printed to stderr.
BaseCommand.get_version()  
Returns the Django version, which should be correct for all built-in Django commands. User-supplied commands can override this method to return their own version.
BaseCommand.handle(*args, **options)  
The actual logic of the command. Subclasses must implement this method. It may return a string which will be printed to stdout (wrapped by BEGIN; and COMMIT; if output_transaction is True).
BaseCommand.help  
A short description of the command, which will be printed in the help message when the user runs the command python manage.py help <command>.
BaseCommand.missing_args_message  
If your command defines mandatory positional arguments, you can customize the message error returned in the case of missing arguments. The default is output by argparse (“too few arguments”).
BaseCommand.output_transaction  
A boolean indicating whether the command outputs SQL statements; if True, the output will automatically be wrapped with BEGIN; and COMMIT;. Default value is False.
BaseCommand.requires_migrations_checks  
A boolean; if True, the command prints a warning if the set of migrations on disk don’t match the migrations in the database. A warning doesn’t prevent the command from executing. Default value is False.
BaseCommand.requires_system_checks  
A list or tuple of tags, e.g. [Tags.staticfiles, Tags.models]. System checks registered in the chosen tags will be checked for errors prior to executing the command. The value '__all__' can be used to specify that all system checks should be performed. Default value is '__all__'.  Changed in Django 3.2: In older versions, the requires_system_checks attribute expects a boolean value instead of a list or tuple of tags.
BaseCommand.style  
An instance attribute that helps create colored output when writing to stdout or stderr. For example: self.stdout.write(self.style.SUCCESS('...'))
 See Syntax coloring to learn how to modify the color palette and to see the available styles (use uppercased versions of the “roles” described in that section). If you pass the --no-color option when running your command, all self.style() calls will return the original string uncolored.
BaseCommand.suppressed_base_arguments  
 New in Django 4.0.  The default command options to suppress in the help output. This should be a set of option names (e.g. '--verbosity'). The default values for the suppressed options are still passed.
LabelCommand.handle_label(label, **options)  
Perform the command’s actions for label, which will be the string as given on the command line.
LabelCommand.label  
A string describing the arbitrary arguments passed to the command. The string is used in the usage text and error messages of the command. Defaults to 'label'.
class Page(object_list, number, paginator)  
A page acts like a sequence of Page.object_list when using len() or iterating it directly.
Page.end_index()  
Returns the 1-based index of the last object on the page, relative to all of the objects in the paginator’s list. For example, when paginating a list of 5 objects with 2 objects per page, the second page’s end_index() would return 4.
Page.has_other_pages()  
Returns True if there’s a next or previous page.
Page.next_page_number()  
Returns the next page number. Raises InvalidPage if next page doesn’t exist.
Page.previous_page_number()  
Returns the previous page number. Raises InvalidPage if previous page doesn’t exist.
Page.start_index()  
Returns the 1-based index of the first object on the page, relative to all of the objects in the paginator’s list. For example, when paginating a list of 5 objects with 2 objects per page, the second page’s start_index() would return 3.
class Paginator(object_list, per_page, orphans=0, allow_empty_first_page=True)  
A paginator acts like a sequence of Page when using len() or iterating it directly.
Paginator.allow_empty_first_page  
Optional. Whether or not the first page is allowed to be empty. If False and object_list is empty, then an EmptyPage error will be raised.
Paginator.count  
The total number of objects, across all pages.  Note When determining the number of objects contained in object_list, Paginator will first try calling object_list.count(). If object_list has no count() method, then Paginator will fall back to using len(object_list). This allows objects, such as QuerySet, to use a more efficient count() method when available.
Paginator.ELLIPSIS  
 New in Django 3.2.  A translatable string used as a substitute for elided page numbers in the page range returned by get_elided_page_range(). Default is '…'.
Paginator.get_elided_page_range(number, *, on_each_side=3, on_ends=2)  
 New in Django 3.2.  Returns a 1-based list of page numbers similar to Paginator.page_range, but may add an ellipsis to either or both sides of the current page number when Paginator.num_pages is large. The number of pages to include on each side of the current page number is determined by the on_each_side argument which defaults to 3. The number of pages to include at the beginning and end of page range is determined by the on_ends argument which defaults to 2. For example, with the default values for on_each_side and on_ends, if the current page is 10 and there are 50 pages, the page range will be [1, 2, '…', 7, 8, 9, 10, 11, 12, 13, '…', 49, 50]. This will result in pages 7, 8, and 9 to the left of and 11, 12, and 13 to the right of the current page as well as pages 1 and 2 at the start and 49 and 50 at the end. Raises InvalidPage if the given page number doesn’t exist.
Paginator.get_page(number)  
Returns a Page object with the given 1-based index, while also handling out of range and invalid page numbers. If the page isn’t a number, it returns the first page. If the page number is negative or greater than the number of pages, it returns the last page. Raises an EmptyPage exception only if you specify Paginator(..., allow_empty_first_page=False) and the object_list is empty.
Paginator.object_list  
Required. A list, tuple, QuerySet, or other sliceable object with a count() or __len__() method. For consistent pagination, QuerySets should be ordered, e.g. with an order_by() clause or with a default ordering on the model.  Performance issues paginating large QuerySets If you’re using a QuerySet with a very large number of items, requesting high page numbers might be slow on some databases, because the resulting LIMIT/OFFSET query needs to count the number of OFFSET records which takes longer as the page number gets higher.
Paginator.orphans  
Optional. Use this when you don’t want to have a last page with very few items. If the last page would normally have a number of items less than or equal to orphans, then those items will be added to the previous page (which becomes the last page) instead of leaving the items on a page by themselves. For example, with 23 items, per_page=10, and orphans=3, there will be two pages; the first page with 10 items and the second (and last) page with 13 items. orphans defaults to zero, which means pages are never combined and the last page may have one item.
Paginator.page(number)  
Returns a Page object with the given 1-based index. Raises PageNotAnInteger if the number cannot be converted to an integer by calling int(). Raises EmptyPage if the given page number doesn’t exist.
Paginator.page_range  
A 1-based range iterator of page numbers, e.g. yielding [1, 2, 3, 4].
Paginator.per_page  
Required. The maximum number of items to include on a page, not including orphans (see the orphans optional argument below).
dumps(obj, key=None, salt='django.core.signing', serializer=JSONSerializer, compress=False)  
Returns URL-safe, signed base64 compressed JSON string. Serialized object is signed using TimestampSigner.
loads(string, key=None, salt='django.core.signing', serializer=JSONSerializer, max_age=None)  
Reverse of dumps(), raises BadSignature if signature fails. Checks max_age (in seconds) if given.
class Signer(key=None, sep=':', salt=None, algorithm=None)  
Returns a signer which uses key to generate signatures and sep to separate values. sep cannot be in the URL safe base64 alphabet. This alphabet contains alphanumeric characters, hyphens, and underscores. algorithm must be an algorithm supported by hashlib, it defaults to 'sha256'.
class TimestampSigner(key=None, sep=':', salt=None, algorithm='sha256')  
 
sign(value)  
Sign value and append current timestamp to it. 
  
unsign(value, max_age=None)  
Checks if value was signed less than max_age seconds ago, otherwise raises SignatureExpired. The max_age parameter can accept an integer or a datetime.timedelta object. 
  
sign_object(obj, serializer=JSONSerializer, compress=False)  
 New in Django 3.2.  Encode, optionally compress, append current timestamp, and sign complex data structure (e.g. list, tuple, or dictionary). 
  
unsign_object(signed_obj, serializer=JSONSerializer, max_age=None)  
 New in Django 3.2.  Checks if signed_obj was signed less than max_age seconds ago, otherwise raises SignatureExpired. The max_age parameter can accept an integer or a datetime.timedelta object.
sign_object(obj, serializer=JSONSerializer, compress=False)  
 New in Django 3.2.  Encode, optionally compress, append current timestamp, and sign complex data structure (e.g. list, tuple, or dictionary).
unsign(value, max_age=None)  
Checks if value was signed less than max_age seconds ago, otherwise raises SignatureExpired. The max_age parameter can accept an integer or a datetime.timedelta object.
unsign_object(signed_obj, serializer=JSONSerializer, max_age=None)  
 New in Django 3.2.  Checks if signed_obj was signed less than max_age seconds ago, otherwise raises SignatureExpired. The max_age parameter can accept an integer or a datetime.timedelta object.
class DecimalValidator(max_digits, decimal_places)  
Raises ValidationError with the following codes:  
'max_digits' if the number of digits is larger than max_digits. 
'max_decimal_places' if the number of decimals is larger than decimal_places. 
'max_whole_digits' if the number of whole digits is larger than the difference between max_digits and decimal_places.
class EmailValidator(message=None, code=None, allowlist=None)  
   
Parameters:

 
message – If not None, overrides message. 
code – If not None, overrides code. 
allowlist – If not None, overrides allowlist.      
message  
The error message used by ValidationError if validation fails. Defaults to "Enter a valid email address". 
  
code  
The error code used by ValidationError if validation fails. Defaults to "invalid". 
  
allowlist  
Allowlist of email domains. By default, a regular expression (the domain_regex attribute) is used to validate whatever appears after the @ sign. However, if that string appears in the allowlist, this validation is bypassed. If not provided, the default allowlist is ['localhost']. Other domains that don’t contain a dot won’t pass validation, so you’d need to add them to the allowlist as necessary. 
  Deprecated since version 3.2: The whitelist parameter is deprecated. Use allowlist instead. The undocumented domain_whitelist attribute is deprecated. Use domain_allowlist instead.
allowlist  
Allowlist of email domains. By default, a regular expression (the domain_regex attribute) is used to validate whatever appears after the @ sign. However, if that string appears in the allowlist, this validation is bypassed. If not provided, the default allowlist is ['localhost']. Other domains that don’t contain a dot won’t pass validation, so you’d need to add them to the allowlist as necessary.
message  
The error message used by ValidationError if validation fails. Defaults to "Enter a valid email address".
class FileExtensionValidator(allowed_extensions, message, code)  
Raises a ValidationError with a code of 'invalid_extension' if the extension of value.name (value is a File) isn’t found in allowed_extensions. The extension is compared case-insensitively with allowed_extensions.  Warning Don’t rely on validation of the file extension to determine a file’s type. Files can be renamed to have any extension no matter what data they contain.
int_list_validator(sep=', ', message=None, code='invalid', allow_negative=False)  
Returns a RegexValidator instance that ensures a string consists of integers separated by sep. It allows negative integers when allow_negative is True.
class MaxLengthValidator(limit_value, message=None)  
Raises a ValidationError with a code of 'max_length' if the length of value is greater than limit_value, which may be a callable.
class MaxValueValidator(limit_value, message=None)  
Raises a ValidationError with a code of 'max_value' if value is greater than limit_value, which may be a callable.
class MinLengthValidator(limit_value, message=None)  
Raises a ValidationError with a code of 'min_length' if the length of value is less than limit_value, which may be a callable.
class MinValueValidator(limit_value, message=None)  
Raises a ValidationError with a code of 'min_value' if value is less than limit_value, which may be a callable.
class ProhibitNullCharactersValidator(message=None, code=None)  
Raises a ValidationError if str(value) contains one or more nulls characters ('\x00').    
Parameters:

 
message – If not None, overrides message. 
code – If not None, overrides code.      
message  
The error message used by ValidationError if validation fails. Defaults to "Null characters are not allowed.". 
  
code  
The error code used by ValidationError if validation fails. Defaults to "null_characters_not_allowed".
code  
The error code used by ValidationError if validation fails. Defaults to "null_characters_not_allowed".
message  
The error message used by ValidationError if validation fails. Defaults to "Null characters are not allowed.".
class RegexValidator(regex=None, message=None, code=None, inverse_match=None, flags=0)  
   
Parameters:

 
regex – If not None, overrides regex. Can be a regular expression string or a pre-compiled regular expression. 
message – If not None, overrides message. 
code – If not None, overrides code. 
inverse_match – If not None, overrides inverse_match. 
flags – If not None, overrides flags. In that case, regex must be a regular expression string, or TypeError is raised.     A RegexValidator searches the provided value for a given regular expression with re.search(). By default, raises a ValidationError with message and code if a match is not found. Its behavior can be inverted by setting inverse_match to True, in which case the ValidationError is raised when a match is found.  
regex  
The regular expression pattern to search for within the provided value, using re.search(). This may be a string or a pre-compiled regular expression created with re.compile(). Defaults to the empty string, which will be found in every possible value. 
  
message  
The error message used by ValidationError if validation fails. Defaults to "Enter a valid value". 
  
code  
The error code used by ValidationError if validation fails. Defaults to "invalid". 
  
inverse_match  
The match mode for regex. Defaults to False. 
  
flags  
The regex flags used when compiling the regular expression string regex. If regex is a pre-compiled regular expression, and flags is overridden, TypeError is raised. Defaults to 0.
flags  
The regex flags used when compiling the regular expression string regex. If regex is a pre-compiled regular expression, and flags is overridden, TypeError is raised. Defaults to 0.
message  
The error message used by ValidationError if validation fails. Defaults to "Enter a valid value".
regex  
The regular expression pattern to search for within the provided value, using re.search(). This may be a string or a pre-compiled regular expression created with re.compile(). Defaults to the empty string, which will be found in every possible value.
class URLValidator(schemes=None, regex=None, message=None, code=None)  
A RegexValidator subclass that ensures a value looks like a URL, and raises an error code of 'invalid' if it doesn’t. Loopback addresses and reserved IP spaces are considered valid. Literal IPv6 addresses (RFC 3986#section-3.2.2) and Unicode domains are both supported. In addition to the optional arguments of its parent RegexValidator class, URLValidator accepts an extra optional attribute:  
schemes  
URL/URI scheme list to validate against. If not provided, the default list is ['http', 'https', 'ftp', 'ftps']. As a reference, the IANA website provides a full list of valid URI schemes.
schemes  
URL/URI scheme list to validate against. If not provided, the default list is ['http', 'https', 'ftp', 'ftps']. As a reference, the IANA website provides a full list of valid URI schemes.
validate_comma_separated_integer_list  
A RegexValidator instance that ensures a value is a comma-separated list of integers.
validate_image_file_extension  
Uses Pillow to ensure that value.name (value is a File) has a valid image extension.
validate_ipv46_address  
Uses both validate_ipv4_address and validate_ipv6_address to ensure a value is either a valid IPv4 or IPv6 address.
validate_ipv4_address  
A RegexValidator instance that ensures a value looks like an IPv4 address.
validate_ipv6_address  
Uses django.utils.ipv6 to check the validity of an IPv6 address.
validate_slug  
A RegexValidator instance that ensures a value consists of only letters, numbers, underscores or hyphens.
validate_unicode_slug  
A RegexValidator instance that ensures a value consists of only Unicode letters, numbers, underscores, or hyphens.
BaseDatabaseSchemaEditor.alter_db_table(model, old_db_table, new_db_table)
BaseDatabaseSchemaEditor.alter_db_tablespace(model, old_db_tablespace, new_db_tablespace)
BaseDatabaseSchemaEditor.alter_field(model, old_field, new_field, strict=False)
BaseDatabaseSchemaEditor.alter_index_together(model, old_index_together, new_index_together)
BaseDatabaseSchemaEditor.alter_unique_together(model, old_unique_together, new_unique_together)
create_test_db(verbosity=1, autoclobber=False, serialize=True, keepdb=False)  
Creates a new test database and runs migrate against it. verbosity has the same behavior as in run_tests(). autoclobber describes the behavior that will occur if a database with the same name as the test database is discovered:  If autoclobber is False, the user will be asked to approve destroying the existing database. sys.exit is called if the user does not approve. If autoclobber is True, the database will be destroyed without consulting the user.  serialize determines if Django serializes the database into an in-memory JSON string before running tests (used to restore the database state between tests if you don’t have transactions). You can set this to False to speed up creation time if you don’t have any test classes with serialized_rollback=True. If you are using the default test runner, you can control this with the the SERIALIZE entry in the TEST dictionary. keepdb determines if the test run should use an existing database, or create a new one. If True, the existing database will be used, or created if not present. If False, a new database will be created, prompting the user to remove the existing one, if present. Returns the name of the test database that it created. create_test_db() has the side effect of modifying the value of NAME in DATABASES to match the name of the test database.
destroy_test_db(old_database_name, verbosity=1, keepdb=False)  
Destroys the database whose name is the value of NAME in DATABASES, and sets NAME to the value of old_database_name. The verbosity argument has the same behavior as for DiscoverRunner. If the keepdb argument is True, then the connection to the database will be closed, but the database will not be destroyed.
class RunPython(code, reverse_code=None, atomic=None, hints=None, elidable=False)
class RunSQL(sql, reverse_sql=None, state_operations=None, hints=None, elidable=False)
RunSQL.noop  
Pass the RunSQL.noop attribute to sql or reverse_sql when you want the operation not to do anything in the given direction. This is especially useful in making the operation reversible.
class SeparateDatabaseAndState(database_operations=None, state_operations=None)
class Aggregate(*expressions, output_field=None, distinct=False, filter=None, default=None, **extra)  
 
template  
A class attribute, as a format string, that describes the SQL that is generated for this aggregate. Defaults to '%(function)s(%(distinct)s%(expressions)s)'. 
  
function  
A class attribute describing the aggregate function that will be generated. Specifically, the function will be interpolated as the function placeholder within template. Defaults to None. 
  
window_compatible  
Defaults to True since most aggregate functions can be used as the source expression in Window. 
  
allow_distinct  
A class attribute determining whether or not this aggregate function allows passing a distinct keyword argument. If set to False (default), TypeError is raised if distinct=True is passed. 
  
empty_result_set_value  
 New in Django 4.0.  Override empty_result_set_value to None since most aggregate functions result in NULL when applied to an empty result set.
allow_distinct  
A class attribute determining whether or not this aggregate function allows passing a distinct keyword argument. If set to False (default), TypeError is raised if distinct=True is passed.
empty_result_set_value  
 New in Django 4.0.  Override empty_result_set_value to None since most aggregate functions result in NULL when applied to an empty result set.
function  
A class attribute describing the aggregate function that will be generated. Specifically, the function will be interpolated as the function placeholder within template. Defaults to None.
template  
A class attribute, as a format string, that describes the SQL that is generated for this aggregate. Defaults to '%(function)s(%(distinct)s%(expressions)s)'.
window_compatible  
Defaults to True since most aggregate functions can be used as the source expression in Window.
as_sql(compiler, connection)  
Generates the SQL fragment for the expression. Returns a tuple (sql, params), where sql is the SQL string, and params is the list or tuple of query parameters. The compiler is an SQLCompiler object, which has a compile() method that can be used to compile other expressions. The connection is the connection used to execute the query. Calling expression.as_sql() is usually incorrect - instead compiler.compile(expression) should be used. The compiler.compile() method will take care of calling vendor-specific methods of the expression. Custom keyword arguments may be defined on this method if it’s likely that as_vendorname() methods or subclasses will need to supply data to override the generation of the SQL string. See Func.as_sql() for example usage.
as_vendorname(compiler, connection)  
Works like as_sql() method. When an expression is compiled by compiler.compile(), Django will first try to call as_vendorname(), where vendorname is the vendor name of the backend used for executing the query. The vendorname is one of postgresql, oracle, sqlite, or mysql for Django’s built-in backends.