From 5153a3bfdcec82324d67ff79862384288cf6afe6 Mon Sep 17 00:00:00 2001 From: Maxime Lorant Date: Mon, 31 Aug 2015 22:14:35 +0200 Subject: [PATCH] Fixed #25331 -- Removed trailing blank lines in docstrings. --- django/conf/urls/static.py | 1 - django/contrib/admin/utils.py | 5 ----- django/contrib/auth/forms.py | 1 - django/contrib/gis/maps/google/overlays.py | 1 - .../staticfiles/management/commands/runserver.py | 1 - .../contrib/staticfiles/templatetags/staticfiles.py | 1 - django/contrib/staticfiles/utils.py | 1 - django/core/cache/backends/base.py | 1 - django/core/checks/registry.py | 4 ++-- django/core/files/uploadhandler.py | 1 - django/core/management/base.py | 11 ----------- django/core/serializers/xml_serializer.py | 1 - django/core/urlresolvers.py | 1 - django/core/wsgi.py | 1 - django/db/backends/oracle/base.py | 5 +++-- django/db/models/deletion.py | 1 - django/db/models/fields/files.py | 1 - django/db/models/sql/aggregates.py | 1 - django/db/models/sql/datastructures.py | 1 - django/dispatch/dispatcher.py | 1 - django/http/request.py | 2 -- django/http/response.py | 1 - django/shortcuts.py | 1 - django/template/context_processors.py | 2 -- django/template/defaulttags.py | 6 ------ django/templatetags/future.py | 1 - django/templatetags/i18n.py | 1 - django/templatetags/l10n.py | 1 - django/templatetags/static.py | 3 --- django/templatetags/tz.py | 2 -- django/test/html.py | 1 - django/test/testcases.py | 1 - django/test/utils.py | 1 - django/utils/html.py | 1 - django/utils/ipv6.py | 4 ---- django/utils/jslex.py | 1 - django/utils/log.py | 1 - django/utils/lru_cache.py | 1 - django/utils/termcolors.py | 1 - django/views/decorators/clickjacking.py | 3 --- django/views/generic/dates.py | 1 - docs/ref/contrib/admin/admindocs.txt | 2 -- tests/admin_docs/models.py | 1 - tests/admin_docs/tests.py | 1 - tests/admin_inlines/tests.py | 1 - tests/admin_scripts/tests.py | 1 - tests/admin_views/tests.py | 5 ----- tests/apps/tests.py | 1 - tests/backends/tests.py | 2 -- tests/cache/tests.py | 3 --- tests/delete_regress/tests.py | 8 -------- tests/flatpages_tests/test_forms.py | 1 - tests/forms_tests/tests/test_regressions.py | 1 - tests/forms_tests/tests/test_widgets.py | 6 ------ tests/model_fields/tests.py | 5 ----- tests/model_formsets_regress/tests.py | 1 - tests/queries/tests.py | 6 ------ tests/serializers_regress/tests.py | 1 - tests/settings_tests/tests.py | 2 -- tests/wsgi/tests.py | 3 --- 60 files changed, 5 insertions(+), 123 deletions(-) diff --git a/django/conf/urls/static.py b/django/conf/urls/static.py index ab4270b0a5..e8f8a9e804 100644 --- a/django/conf/urls/static.py +++ b/django/conf/urls/static.py @@ -16,7 +16,6 @@ def static(prefix, view=serve, **kwargs): urlpatterns = [ # ... the rest of your URLconf goes here ... ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) - """ # No-op if not in debug mode or an non-local prefix if not settings.DEBUG or (prefix and '://' in prefix): diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py index 5dcaf3d8b3..88e422e40f 100644 --- a/django/contrib/admin/utils.py +++ b/django/contrib/admin/utils.py @@ -123,7 +123,6 @@ def get_deleted_objects(objs, opts, user, admin_site, using): Returns a nested list of strings suitable for display in the template with the ``unordered_list`` filter. - """ collector = NestedObjects(using=using) collector.collect(objs) @@ -216,7 +215,6 @@ class NestedObjects(Collector): def nested(self, format_callback=None): """ Return the graph as a nested list. - """ seen = set() roots = [] @@ -238,7 +236,6 @@ def model_format_dict(obj): typically for use with string formatting. `obj` may be a `Model` instance, `Model` subclass, or `QuerySet` instance. - """ if isinstance(obj, (models.Model, models.base.ModelBase)): opts = obj._meta @@ -260,7 +257,6 @@ def model_ngettext(obj, n=None): `obj` may be a `Model` instance, `Model` subclass, or `QuerySet` instance. If `obj` is a `QuerySet` instance, `n` is optional and the length of the `QuerySet` is used. - """ if isinstance(obj, models.query.QuerySet): if n is None: @@ -443,7 +439,6 @@ def reverse_field_path(model, path): return (Group, "user__order"). Final field must be a related model, not a data field. - """ reversed_path = [] parent = model diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index 050fc19beb..8d0dacb3bb 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -220,7 +220,6 @@ class PasswordResetForm(forms.Form): This allows subclasses to more easily customize the default policies that prevent inactive users and users with unusable passwords from resetting their password. - """ active_users = get_user_model()._default_manager.filter( email__iexact=email, is_active=True) diff --git a/django/contrib/gis/maps/google/overlays.py b/django/contrib/gis/maps/google/overlays.py index 42f41e3b8e..98ad97f770 100644 --- a/django/contrib/gis/maps/google/overlays.py +++ b/django/contrib/gis/maps/google/overlays.py @@ -239,7 +239,6 @@ class GIcon(object): infowindowanchor: The pixel coordinate relative to the top left corner of the icon image at which the info window is anchored to this icon. - """ def __init__(self, varname, image=None, iconsize=None, shadow=None, shadowsize=None, iconanchor=None, diff --git a/django/contrib/staticfiles/management/commands/runserver.py b/django/contrib/staticfiles/management/commands/runserver.py index d42c773457..64ef22818e 100644 --- a/django/contrib/staticfiles/management/commands/runserver.py +++ b/django/contrib/staticfiles/management/commands/runserver.py @@ -19,7 +19,6 @@ class Command(RunserverCommand): Returns the static files serving handler wrapping the default handler, if static files should be served. Otherwise just returns the default handler. - """ handler = super(Command, self).get_handler(*args, **options) use_static_handler = options.get('use_static_handler', True) diff --git a/django/contrib/staticfiles/templatetags/staticfiles.py b/django/contrib/staticfiles/templatetags/staticfiles.py index e666e3adba..e3bea9328f 100644 --- a/django/contrib/staticfiles/templatetags/staticfiles.py +++ b/django/contrib/staticfiles/templatetags/staticfiles.py @@ -32,6 +32,5 @@ def do_static(parser, token): {% static variable_with_path %} {% static "myapp/css/base.css" as admin_base_css %} {% static variable_with_path as varname %} - """ return StaticFilesNode.handle_token(parser, token) diff --git a/django/contrib/staticfiles/utils.py b/django/contrib/staticfiles/utils.py index 2c44bb7790..3a1e0ac646 100644 --- a/django/contrib/staticfiles/utils.py +++ b/django/contrib/staticfiles/utils.py @@ -44,7 +44,6 @@ def get_files(storage, ignore_patterns=None, location=''): def check_settings(base_url=None): """ Checks if the staticfiles settings have sane values. - """ if base_url is None: base_url = settings.STATIC_URL diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py index 0ffd47bc2a..e10149648a 100644 --- a/django/core/cache/backends/base.py +++ b/django/core/cache/backends/base.py @@ -232,7 +232,6 @@ class BaseCache(object): Warn about keys that would not be portable to the memcached backend. This encourages (but does not force) writing backend-portable cache code. - """ if len(key) > MEMCACHE_MAX_KEY_LENGTH: warnings.warn('Cache key will cause errors if used with memcached: ' diff --git a/django/core/checks/registry.py b/django/core/checks/registry.py index 98476bb917..dbd3a6d36f 100644 --- a/django/core/checks/registry.py +++ b/django/core/checks/registry.py @@ -39,7 +39,6 @@ class CheckRegistry(object): return errors # or registry.register(my_check, 'mytag', 'anothertag') - """ kwargs.setdefault('deploy', False) @@ -60,7 +59,8 @@ class CheckRegistry(object): return inner def run_checks(self, app_configs=None, tags=None, include_deployment_checks=False): - """ Run all registered checks and return list of Errors and Warnings. + """ + Run all registered checks and return list of Errors and Warnings. """ errors = [] checks = self.get_checks(include_deployment_checks) diff --git a/django/core/files/uploadhandler.py b/django/core/files/uploadhandler.py index 034b9985e2..05b431d05a 100644 --- a/django/core/files/uploadhandler.py +++ b/django/core/files/uploadhandler.py @@ -214,6 +214,5 @@ def load_handler(path, *args, **kwargs): >>> request = HttpRequest() >>> load_handler('django.core.files.uploadhandler.TemporaryFileUploadHandler', request) - """ return import_string(path)(*args, **kwargs) diff --git a/django/core/management/base.py b/django/core/management/base.py index e20944e277..a4fc3e953d 100644 --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -30,7 +30,6 @@ class CommandError(Exception): result, raising this exception (with a sensible description of the error) is the preferred way to indicate that something has gone wrong in the execution of a command. - """ pass @@ -71,7 +70,6 @@ def handle_default_options(options): Include any default options that all commands should accept here so that ManagementUtility can handle them before searching for user commands. - """ if options.settings: os.environ['DJANGO_SETTINGS_MODULE'] = options.settings @@ -237,7 +235,6 @@ class BaseCommand(object): Return the Django version, which should be correct for all built-in Django commands. User-supplied commands should override this method. - """ return django.get_version() @@ -245,7 +242,6 @@ class BaseCommand(object): """ Return a brief description of how to use this command, by default from the attribute ``self.help``. - """ usage = '%%prog %s [options] %s' % (subcommand, self.args) if self.help: @@ -257,7 +253,6 @@ class BaseCommand(object): """ Create and return the ``ArgumentParser`` which will be used to parse the arguments to this command. - """ if not self.use_argparse: def store_as_int(option, opt_str, value, parser): @@ -324,7 +319,6 @@ class BaseCommand(object): """ Print the help message for this command, derived from ``self.usage()``. - """ parser = self.create_parser(prog_name, subcommand) parser.print_help() @@ -488,7 +482,6 @@ class BaseCommand(object): """ The actual logic of the command. Subclasses must implement this method. - """ raise NotImplementedError('subclasses of BaseCommand must provide a handle() method') @@ -541,7 +534,6 @@ class LabelCommand(BaseCommand): If the arguments should be names of installed applications, use ``AppCommand`` instead. - """ label = 'label' missing_args_message = "Enter at least one %s." % label @@ -561,7 +553,6 @@ class LabelCommand(BaseCommand): """ Perform the command's actions for ``label``, which will be the string as given on the command line. - """ raise NotImplementedError('subclasses of LabelCommand must provide a handle_label() method') @@ -575,7 +566,6 @@ class NoArgsCommand(BaseCommand): no arguments are passed to the command. Attempting to pass arguments will raise ``CommandError``. - """ args = '' @@ -595,6 +585,5 @@ class NoArgsCommand(BaseCommand): def handle_noargs(self, **options): """ Perform this command's actions. - """ raise NotImplementedError('subclasses of NoArgsCommand must provide a handle_noargs() method') diff --git a/django/core/serializers/xml_serializer.py b/django/core/serializers/xml_serializer.py index 9dfd8e70b5..9bddda46da 100644 --- a/django/core/serializers/xml_serializer.py +++ b/django/core/serializers/xml_serializer.py @@ -317,7 +317,6 @@ class DefusedExpatParser(_ExpatParser): An expat parser hardened against XML bomb attacks. Forbids DTDs, external entity references - """ def __init__(self, *args, **kwargs): _ExpatParser.__init__(self, *args, **kwargs) diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index b7acab0606..e462c343dc 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -176,7 +176,6 @@ class LocaleRegexProvider(object): """ A mixin to provide a default regex property which can vary by active language. - """ def __init__(self, regex): # regex is either a string representing a regular expression, or a diff --git a/django/core/wsgi.py b/django/core/wsgi.py index 4ff41318d3..62aa43bda5 100644 --- a/django/core/wsgi.py +++ b/django/core/wsgi.py @@ -9,7 +9,6 @@ def get_wsgi_application(): Allows us to avoid making django.core.handlers.WSGIHandler public API, in case the internal WSGI implementation changes or moves in the future. - """ django.setup() return WSGIHandler() diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index ceec5d790a..cc9e6d7c18 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -542,8 +542,9 @@ class FormatStylePlaceholderCursor(object): class CursorIterator(six.Iterator): - - """Cursor iterator wrapper that invokes our custom row factory.""" + """ + Cursor iterator wrapper that invokes our custom row factory. + """ def __init__(self, cursor): self.cursor = cursor diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py index 61263b569e..c5febce623 100644 --- a/django/db/models/deletion.py +++ b/django/db/models/deletion.py @@ -241,7 +241,6 @@ class Collector(object): def related_objects(self, related, objs): """ Gets a QuerySet of objects related to ``objs`` via the relation ``related``. - """ return related.related_model._base_manager.using(self.using).filter( **{"%s__in" % related.field.name: objs} diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py index 7468b05efc..760c17b001 100644 --- a/django/db/models/fields/files.py +++ b/django/db/models/fields/files.py @@ -165,7 +165,6 @@ class FileDescriptor(object): >>> with open('/tmp/hello.world', 'r') as f: ... instance.file = File(f) - """ def __init__(self, field): self.field = field diff --git a/django/db/models/sql/aggregates.py b/django/db/models/sql/aggregates.py index 5e73e4fc6a..43d7ff1064 100644 --- a/django/db/models/sql/aggregates.py +++ b/django/db/models/sql/aggregates.py @@ -49,7 +49,6 @@ class Aggregate(RegisterLookupMixin): * is_computed, a boolean indicating if this output of this aggregate is a computed float (e.g., an average), regardless of the input type. - """ self.col = col self.source = source diff --git a/django/db/models/sql/datastructures.py b/django/db/models/sql/datastructures.py index 1880f4558f..42f2d8790d 100644 --- a/django/db/models/sql/datastructures.py +++ b/django/db/models/sql/datastructures.py @@ -41,7 +41,6 @@ class Join(object): to join_type) - as_sql() - relabeled_clone() - """ def __init__(self, table_name, parent_alias, table_alias, join_type, join_field, nullable): diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py index 4983f8f427..79fdb0bb99 100644 --- a/django/dispatch/dispatcher.py +++ b/django/dispatch/dispatcher.py @@ -306,7 +306,6 @@ def receiver(signal, **kwargs): @receiver([post_save, post_delete], sender=MyModel) def signals_receiver(sender, **kwargs): ... - """ def _decorator(func): if isinstance(signal, (list, tuple)): diff --git a/django/http/request.py b/django/http/request.py index 938d833551..b50392abd2 100644 --- a/django/http/request.py +++ b/django/http/request.py @@ -457,7 +457,6 @@ class QueryDict(MultiValueDict): 'next=%2Fa%26b%2F' >>> q.urlencode(safe='/') 'next=/a%26b/' - """ output = [] if safe: @@ -524,7 +523,6 @@ def validate_host(host, allowed_hosts): already had the port, if any, stripped off. Return ``True`` for a valid host, ``False`` otherwise. - """ host = host[:-1] if host.endswith('.') else host diff --git a/django/http/response.py b/django/http/response.py index b42f0b51d3..3365cdbdca 100644 --- a/django/http/response.py +++ b/django/http/response.py @@ -173,7 +173,6 @@ class HttpResponseBase(six.Iterator): - a naive ``datetime.datetime`` object in UTC, - an aware ``datetime.datetime`` object in any time zone. If it is a ``datetime.datetime`` object then ``max_age`` will be calculated. - """ value = force_str(value) self.cookies[key] = value diff --git a/django/shortcuts.py b/django/shortcuts.py index 1102aaa3dc..7c7e61fb5c 100644 --- a/django/shortcuts.py +++ b/django/shortcuts.py @@ -184,7 +184,6 @@ def resolve_url(to, *args, **kwargs): be used to reverse-resolve the name. * A URL, which will be returned as-is. - """ # If it's a model, use get_absolute_url() if hasattr(to, 'get_absolute_url'): diff --git a/django/template/context_processors.py b/django/template/context_processors.py index a81fe71829..c356b4cee5 100644 --- a/django/template/context_processors.py +++ b/django/template/context_processors.py @@ -67,7 +67,6 @@ def tz(request): def static(request): """ Adds static-related context variables to the context. - """ return {'STATIC_URL': settings.STATIC_URL} @@ -75,7 +74,6 @@ def static(request): def media(request): """ Adds media-related context variables to the context. - """ return {'MEDIA_URL': settings.MEDIA_URL} diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 6787e23bde..9a86279d38 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -642,7 +642,6 @@ def cycle(parser, token): {% cycle 'row1' 'row2' as rowcolors silent %} {% include "subtemplate.html " %} {% endfor %} - """ # Note: This returns the exact same node on each {% cycle name %} call; # that is, the node object returned from {% cycle a b c as name %} and the @@ -791,7 +790,6 @@ def firstof(parser, token): Or if only some variables should be escaped, you can use:: {% firstof var1 var2|safe var3 "fallback value"|safe %} - """ bits = token.split_contents()[1:] asvar = None @@ -866,7 +864,6 @@ def do_for(parser, token): ``forloop.parentloop`` For nested loops, this is the loop "above" the current one ========================== ================================================ - """ bits = token.split_contents() if len(bits) < 4: @@ -1177,7 +1174,6 @@ def load(parser, token): a library:: {% load byline from news %} - """ # token.split_contents() isn't useful here because this tag doesn't accept variable as arguments bits = token.contents.split() @@ -1310,7 +1306,6 @@ def regroup(parser, token): before using it, i.e.:: {% regroup people|dictsort:"gender" by gender as grouped %} - """ bits = token.split_contents() if len(bits) != 6: @@ -1462,7 +1457,6 @@ def url(parser, token): {% with url_name="client-detail-view" %} {% url url_name client.id %} {% endwith %} - """ bits = token.split_contents() if len(bits) < 2: diff --git a/django/templatetags/future.py b/django/templatetags/future.py index 5af0dcef72..ccc79b970d 100644 --- a/django/templatetags/future.py +++ b/django/templatetags/future.py @@ -58,7 +58,6 @@ def firstof(parser, token): Or if only some variables should be escaped, you can use:: {% firstof var1 var2|safe var3 "fallback value"|safe %} - """ warnings.warn( "Loading the `firstof` tag from the `future` library is deprecated and " diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py index 050ef2c741..9420ecd507 100644 --- a/django/templatetags/i18n.py +++ b/django/templatetags/i18n.py @@ -546,7 +546,6 @@ def language(parser, token): {% language "de" %} This is {{ bar }} and {{ boo }}. {% endlanguage %} - """ bits = token.split_contents() if len(bits) != 2: diff --git a/django/templatetags/l10n.py b/django/templatetags/l10n.py index cbc47bcb94..64c8ae64dc 100644 --- a/django/templatetags/l10n.py +++ b/django/templatetags/l10n.py @@ -50,7 +50,6 @@ def localize_tag(parser, token): {% localize off %} var pi = {{ 3.1415 }}; {% endlocalize %} - """ use_l10n = None bits = list(token.split_contents()) diff --git a/django/templatetags/static.py b/django/templatetags/static.py index 58aaf8f423..7541adb35e 100644 --- a/django/templatetags/static.py +++ b/django/templatetags/static.py @@ -65,7 +65,6 @@ def get_static_prefix(parser, token): {% get_static_prefix %} {% get_static_prefix as static_prefix %} - """ return PrefixNode.handle_token(parser, token, "STATIC_URL") @@ -84,7 +83,6 @@ def get_media_prefix(parser, token): {% get_media_prefix %} {% get_media_prefix as media_prefix %} - """ return PrefixNode.handle_token(parser, token, "MEDIA_URL") @@ -148,7 +146,6 @@ def do_static(parser, token): {% static variable_with_path %} {% static "myapp/css/base.css" as admin_base_css %} {% static variable_with_path as varname %} - """ return StaticNode.handle_token(parser, token) diff --git a/django/templatetags/tz.py b/django/templatetags/tz.py index 2af165e7ab..68e40ebb19 100644 --- a/django/templatetags/tz.py +++ b/django/templatetags/tz.py @@ -136,7 +136,6 @@ def localtime_tag(parser, token): Sample usage:: {% localtime off %}{{ value_in_utc }}{% endlocaltime %} - """ bits = token.split_contents() if len(bits) == 1: @@ -165,7 +164,6 @@ def timezone_tag(parser, token): {% timezone "Europe/Paris" %} It is {{ now }} in Paris. {% endtimezone %} - """ bits = token.split_contents() if len(bits) != 2: diff --git a/django/test/html.py b/django/test/html.py index 28db398cf7..79331a098e 100644 --- a/django/test/html.py +++ b/django/test/html.py @@ -223,7 +223,6 @@ def parse_html(html): structure that can be easily compared against other HTML on semantic equivalence. Syntactical differences like which quotation is used on arguments will be ignored. - """ parser = Parser() parser.feed(html) diff --git a/django/test/testcases.py b/django/test/testcases.py index c4ee8984a9..1ed3124d57 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -654,7 +654,6 @@ class SimpleTestCase(unittest.TestCase): field_args: the args passed to instantiate the field field_kwargs: the kwargs passed to instantiate the field empty_value: the expected clean output for inputs in empty_values - """ if field_args is None: field_args = [] diff --git a/django/test/utils.py b/django/test/utils.py index 415f17237b..95757dbf1b 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -121,7 +121,6 @@ def teardown_test_environment(): - Restoring the original test renderer - Restoring the email sending functions - """ Template._render = Template._original_render del Template._original_render diff --git a/django/utils/html.py b/django/utils/html.py index c038ac61f6..9387e712dc 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -114,7 +114,6 @@ def format_html_join(sep, format_string, args_generator): format_html_join('\n', "
  • {} {}
  • ", ((u.first_name, u.last_name) for u in users)) - """ return mark_safe(conditional_escape(sep).join( format_html(format_string, *tuple(args)) diff --git a/django/utils/ipv6.py b/django/utils/ipv6.py index 94e9dcf50e..ce37760fb3 100644 --- a/django/utils/ipv6.py +++ b/django/utils/ipv6.py @@ -25,7 +25,6 @@ def clean_ipv6_address(ip_str, unpack_ipv4=False, Returns: A compressed IPv6 address, or the same value - """ best_doublecolon_start = -1 best_doublecolon_len = 0 @@ -153,7 +152,6 @@ def is_valid_ipv6_address(ip_str): Returns: A boolean, True if this is a valid IPv6 address. - """ from django.core.validators import validate_ipv4_address @@ -218,7 +216,6 @@ def _explode_shorthand_ip_string(ip_str): Returns: A string, the expanded IPv6 address. - """ if not _is_shorthand_ip(ip_str): # We've already got a longhand ip_str. @@ -262,7 +259,6 @@ def _is_shorthand_ip(ip_str): Returns: A boolean, True if the address is shortened. - """ if ip_str.count('::') == 1: return True diff --git a/django/utils/jslex.py b/django/utils/jslex.py index cfc8654432..bef6129188 100644 --- a/django/utils/jslex.py +++ b/django/utils/jslex.py @@ -25,7 +25,6 @@ def literals(choices, prefix="", suffix=""): If provided, `prefix` and `suffix` will be attached to each choice individually. - """ return "|".join(prefix + re.escape(c) + suffix for c in choices.split()) diff --git a/django/utils/log.py b/django/utils/log.py index 44c861c34a..95824af7a5 100644 --- a/django/utils/log.py +++ b/django/utils/log.py @@ -135,7 +135,6 @@ class CallbackFilter(logging.Filter): A logging filter that checks the return value of a given callable (which takes the record-to-be-logged as its only parameter) to decide whether to log a record. - """ def __init__(self, callback): self.callback = callback diff --git a/django/utils/lru_cache.py b/django/utils/lru_cache.py index 3dae4507fc..543296e648 100644 --- a/django/utils/lru_cache.py +++ b/django/utils/lru_cache.py @@ -59,7 +59,6 @@ except ImportError: Access the underlying function with f.__wrapped__. See: https://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used - """ # Users should only access the lru_cache through its public API: diff --git a/django/utils/termcolors.py b/django/utils/termcolors.py index 47bce5244c..d7305f9d5a 100644 --- a/django/utils/termcolors.py +++ b/django/utils/termcolors.py @@ -166,7 +166,6 @@ def parse_color_setting(config_string): Valid options: 'bold', 'underscore', 'blink', 'reverse', 'conceal' - """ if not config_string: return PALETTES[DEFAULT_PALETTE] diff --git a/django/views/decorators/clickjacking.py b/django/views/decorators/clickjacking.py index 2a0c53d2a4..bb63c50096 100644 --- a/django/views/decorators/clickjacking.py +++ b/django/views/decorators/clickjacking.py @@ -14,7 +14,6 @@ def xframe_options_deny(view_func): @xframe_options_deny def some_view(request): ... - """ def wrapped_view(*args, **kwargs): resp = view_func(*args, **kwargs) @@ -35,7 +34,6 @@ def xframe_options_sameorigin(view_func): @xframe_options_sameorigin def some_view(request): ... - """ def wrapped_view(*args, **kwargs): resp = view_func(*args, **kwargs) @@ -55,7 +53,6 @@ def xframe_options_exempt(view_func): @xframe_options_exempt def some_view(request): ... - """ def wrapped_view(*args, **kwargs): resp = view_func(*args, **kwargs) diff --git a/django/views/generic/dates.py b/django/views/generic/dates.py index 2a63db2fe9..d403db8207 100644 --- a/django/views/generic/dates.py +++ b/django/views/generic/dates.py @@ -722,7 +722,6 @@ def _get_next_prev(generic_view, date, is_previous, period): * If allow_empty is false and allow_future is false, return the next date that contains a valid object. If that date is in the future, or if there are no next objects, return None. - """ date_field = generic_view.get_date_field() allow_empty = generic_view.get_allow_empty() diff --git a/docs/ref/contrib/admin/admindocs.txt b/docs/ref/contrib/admin/admindocs.txt index 09837a3550..2d76748e02 100644 --- a/docs/ref/contrib/admin/admindocs.txt +++ b/docs/ref/contrib/admin/admindocs.txt @@ -71,7 +71,6 @@ A model with useful documentation might look like this:: """ Stores a single blog entry, related to :model:`blog.Blog` and :model:`auth.User`. - """ slug = models.SlugField(help_text="A short label, generally used in URLs.") author = models.ForeignKey( @@ -115,7 +114,6 @@ For example:: **Template:** :template:`myapp/my_template.html` - """ context = {'mymodel': MyModel.objects.get(slug=slug)} return render(request, 'myapp/my_template.html', context) diff --git a/tests/admin_docs/models.py b/tests/admin_docs/models.py index 6dff4358c2..9ddcb762e1 100644 --- a/tests/admin_docs/models.py +++ b/tests/admin_docs/models.py @@ -34,7 +34,6 @@ class Person(models.Model): :file: admin_docs/evilfile.txt .. include:: admin_docs/evilfile.txt - """ first_name = models.CharField(max_length=200, help_text="The person's first name") last_name = models.CharField(max_length=200, help_text="The person's last name") diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py index b48d33301f..7619e01465 100644 --- a/tests/admin_docs/tests.py +++ b/tests/admin_docs/tests.py @@ -389,7 +389,6 @@ class TestUtils(AdminDocsTestCase): :template:`myapp/my_template.html` (DESCRIPTION) some_metadata: some data - """ def setUp(self): diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index 4ecee471c8..04bd2f06d7 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -477,7 +477,6 @@ class TestInlinePermissions(TestCase): """ Make sure the admin respects permissions for objects that are edited inline. Refs #8060. - """ def setUp(self): diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index c9faa82977..7ba2593e95 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1199,7 +1199,6 @@ class ManageCheck(AdminScriptTestCase): command should not raise `CommandError` exception. In this test we also test output format. - """ self.write_settings('settings.py', diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 12241ecb97..79db4a3712 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -2129,7 +2129,6 @@ class AdminViewDeletedObjectsTest(TestCase): """ Cyclic relationships should still cause each object to only be listed once. - """ one = '
  • Cyclic one: I am recursive' % ( reverse('admin:admin_views_cyclicone_change', args=(self.cy1.pk,)), @@ -2181,7 +2180,6 @@ class AdminViewDeletedObjectsTest(TestCase): If a deleted object has two relationships from another model, both of those should be followed in looking for related objects to delete. - """ should_contain = '
  • Plot: World Domination' % reverse( 'admin:admin_views_plot_change', args=(self.pl1.pk,) @@ -2196,7 +2194,6 @@ class AdminViewDeletedObjectsTest(TestCase): If a deleted object has two relationships pointing to it from another object, the other object should still only be listed once. - """ should_contain = '
  • Plot: World Peace
  • ' % reverse( 'admin:admin_views_plot_change', args=(self.pl2.pk,) @@ -2209,7 +2206,6 @@ class AdminViewDeletedObjectsTest(TestCase): In the case of an inherited model, if either the child or parent-model instance is deleted, both instances are listed for deletion, as well as any relationships they have. - """ should_contain = [ '
  • Villain: Bob' % reverse('admin:admin_views_villain_change', args=(self.sv1.pk,)), @@ -2228,7 +2224,6 @@ class AdminViewDeletedObjectsTest(TestCase): """ If a deleted object has GenericForeignKeys pointing to it, those objects should be listed for deletion. - """ plot = self.pl3 tag = FunkyTag.objects.create(content_object=plot, name='hott') diff --git a/tests/apps/tests.py b/tests/apps/tests.py index 3dfd88f136..ae8f0c6c92 100644 --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -391,7 +391,6 @@ class NamespacePackageAppTests(SimpleTestCase): (Because then we wouldn't know where to load its templates, static assets, etc from.) - """ # Temporarily add two directories to sys.path that both contain # components of the "nsapp" package. diff --git a/tests/backends/tests.py b/tests/backends/tests.py index b918be3e51..ed42d6317a 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -340,7 +340,6 @@ class DateQuotingTest(TestCase): #12818__. __: http://code.djangoproject.com/ticket/12818 - """ updated = datetime.datetime(2010, 2, 20) models.SchoolClass.objects.create(year=2009, last_updated=updated) @@ -353,7 +352,6 @@ class DateQuotingTest(TestCase): which clash with strings passed to it (e.g. 'day') - see #12818__. __: http://code.djangoproject.com/ticket/12818 - """ updated = datetime.datetime(2010, 2, 20) models.SchoolClass.objects.create(year=2009, last_updated=updated) diff --git a/tests/cache/tests.py b/tests/cache/tests.py index cb64dad97d..76becdd948 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -548,7 +548,6 @@ class BaseCacheTests(object): keys that would be refused by memcached. This encourages portable caching code without making it too difficult to use production backends with more liberal key rules. Refs #6447. - """ # mimic custom ``make_key`` method being defined since the default will # never show the below warnings @@ -1124,7 +1123,6 @@ class MemcachedCacheTests(BaseCacheTests, TestCase): In order to be memcached-API-library agnostic, we only assert that a generic exception of some kind is raised. - """ # memcached does not allow whitespace or control characters in keys self.assertRaises(Exception, cache.set, 'key with spaces', 'value') @@ -1234,7 +1232,6 @@ class CustomCacheKeyValidationTests(SimpleTestCase): Tests for the ability to mixin a custom ``validate_key`` method to a custom cache backend that otherwise inherits from a builtin backend, and override the default key validation. Refs #6447. - """ def test_custom_key_validation(self): # this key is both longer than 250 characters, and has spaces diff --git a/tests/delete_regress/tests.py b/tests/delete_regress/tests.py index d03ce3771f..7cbd94f427 100644 --- a/tests/delete_regress/tests.py +++ b/tests/delete_regress/tests.py @@ -63,7 +63,6 @@ class DeleteCascadeTests(TestCase): """ Django cascades deletes through generic-related objects to their reverse relations. - """ person = Person.objects.create(name='Nelson Mandela') award = Award.objects.create(name='Nobel', content_object=person) @@ -81,7 +80,6 @@ class DeleteCascadeTests(TestCase): some other model has an FK to that through model, deletion is cascaded from one of the participants in the M2M, to the through model, to its related model. - """ juan = Child.objects.create(name='Juan') paints = Toy.objects.create(name='Paints') @@ -126,7 +124,6 @@ class DeleteCascadeTransactionTests(TransactionTestCase): def test_to_field(self): """ Cascade deletion works with ForeignKey.to_field set to non-PK. - """ apple = Food.objects.create(name="apple") Eaten.objects.create(food=apple, meal="lunch") @@ -156,7 +153,6 @@ class ProxyDeleteTest(TestCase): Tests on_delete behavior for proxy models. See #16128. - """ def create_image(self): """Return an Image referenced by both a FooImage and a FooFile.""" @@ -177,7 +173,6 @@ class ProxyDeleteTest(TestCase): """ Deleting the *proxy* instance bubbles through to its non-proxy and *all* referring objects are deleted. - """ self.create_image() @@ -195,7 +190,6 @@ class ProxyDeleteTest(TestCase): """ Deleting a proxy-of-proxy instance should bubble through to its proxy and non-proxy parents, deleting *all* referring objects. - """ test_image = self.create_image() @@ -221,7 +215,6 @@ class ProxyDeleteTest(TestCase): """ Deleting an instance of a concrete model should also delete objects referencing its proxy subclass. - """ self.create_image() @@ -244,7 +237,6 @@ class ProxyDeleteTest(TestCase): IntegrityError on databases unable to defer integrity checks). Refs #17918. - """ # Create an Image (proxy of File) and FooFileProxy (proxy of FooFile, # which has an FK to File) diff --git a/tests/flatpages_tests/test_forms.py b/tests/flatpages_tests/test_forms.py index 6e6721494b..0ea706010b 100644 --- a/tests/flatpages_tests/test_forms.py +++ b/tests/flatpages_tests/test_forms.py @@ -80,7 +80,6 @@ class FlatpageAdminFormTests(TestCase): """ Existing flatpages can be edited in the admin form without triggering the url-uniqueness validation. - """ existing = FlatPage.objects.create( url="/myflatpage1/", title="Some page", content="The content") diff --git a/tests/forms_tests/tests/test_regressions.py b/tests/forms_tests/tests/test_regressions.py index 960fbc7e47..d2f86e1db9 100644 --- a/tests/forms_tests/tests/test_regressions.py +++ b/tests/forms_tests/tests/test_regressions.py @@ -134,7 +134,6 @@ class FormsRegressionsTestCase(TestCase): """ Re-cleaning an instance that was added via a ModelForm should not raise a pk uniqueness error. - """ class CheeseForm(ModelForm): class Meta: diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py index f680ff8dff..7c66c4c391 100644 --- a/tests/forms_tests/tests/test_widgets.py +++ b/tests/forms_tests/tests/test_widgets.py @@ -1295,7 +1295,6 @@ class FakeFieldFile(object): """ Quacks like a FieldFile (has a .url and unicode representation), but doesn't require us to care about storages etc. - """ url = 'something' @@ -1308,7 +1307,6 @@ class ClearableFileInputTests(SimpleTestCase): """ A ClearableFileInput with is_required False and rendered with an initial value that is a file renders a clear checkbox. - """ widget = ClearableFileInput() widget.is_required = False @@ -1368,7 +1366,6 @@ class ClearableFileInputTests(SimpleTestCase): """ A ClearableFileInput with is_required=False does not render a clear checkbox. - """ widget = ClearableFileInput() widget.is_required = True @@ -1384,7 +1381,6 @@ class ClearableFileInputTests(SimpleTestCase): """ A ClearableFileInput instantiated with no initial value does not render a clear checkbox. - """ widget = ClearableFileInput() widget.is_required = False @@ -1395,7 +1391,6 @@ class ClearableFileInputTests(SimpleTestCase): """ ClearableFileInput.value_from_datadict returns False if the clear checkbox is checked, if not required. - """ widget = ClearableFileInput() widget.is_required = False @@ -1408,7 +1403,6 @@ class ClearableFileInputTests(SimpleTestCase): """ ClearableFileInput.value_from_datadict never returns False if the field is required. - """ widget = ClearableFileInput() widget.is_required = True diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index bc183ba431..16d8b2fe2c 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -52,7 +52,6 @@ class BasicFieldTests(test.TestCase): """ Regression test for #13071: NullBooleanField should not throw a validation error when given a value of None. - """ nullboolean = NullBooleanModel(nbfield=None) try: @@ -691,7 +690,6 @@ class TypeCoercionTests(test.TestCase): Test that database lookups can accept the wrong types and convert them with no error: especially on Postgres 8.3+ which does not do automatic casting at the DB level. See #10015. - """ def test_lookup_integer_in_charfield(self): self.assertEqual(Post.objects.filter(title=9).count(), 0) @@ -705,7 +703,6 @@ class FileFieldTests(unittest.TestCase): """ Test that FileField.save_form_data will clear its instance attribute value if passed False. - """ d = Document(myfile='something.txt') self.assertEqual(d.myfile, 'something.txt') @@ -717,7 +714,6 @@ class FileFieldTests(unittest.TestCase): """ Test that FileField.save_form_data considers None to mean "no change" rather than "clear". - """ d = Document(myfile='something.txt') self.assertEqual(d.myfile, 'something.txt') @@ -729,7 +725,6 @@ class FileFieldTests(unittest.TestCase): """ Test that FileField.save_form_data, if passed a truthy value, updates its instance attribute. - """ d = Document(myfile='something.txt') self.assertEqual(d.myfile, 'something.txt') diff --git a/tests/model_formsets_regress/tests.py b/tests/model_formsets_regress/tests.py index d9e87ec046..bc42fd489c 100644 --- a/tests/model_formsets_regress/tests.py +++ b/tests/model_formsets_regress/tests.py @@ -214,7 +214,6 @@ class InlineFormsetTests(TestCase): Existing and new inlines are saved with save_as_new. Regression for #14938. - """ efnet = Network.objects.create(name="EFNet") host1 = Host.objects.create(hostname="irc.he.net", network=efnet) diff --git a/tests/queries/tests.py b/tests/queries/tests.py index c041669ae0..831990f099 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -2692,7 +2692,6 @@ class ExcludeTest17600(TestCase): def test_exclude_plain(self): """ This should exclude Orders which have some items with status 1 - """ self.assertQuerysetEqual( Order.objects.exclude(items__status=1), @@ -2701,7 +2700,6 @@ class ExcludeTest17600(TestCase): def test_exclude_plain_distinct(self): """ This should exclude Orders which have some items with status 1 - """ self.assertQuerysetEqual( Order.objects.exclude(items__status=1).distinct(), @@ -2710,7 +2708,6 @@ class ExcludeTest17600(TestCase): def test_exclude_with_q_object_distinct(self): """ This should exclude Orders which have some items with status 1 - """ self.assertQuerysetEqual( Order.objects.exclude(Q(items__status=1)).distinct(), @@ -2719,7 +2716,6 @@ class ExcludeTest17600(TestCase): def test_exclude_with_q_object_no_distinct(self): """ This should exclude Orders which have some items with status 1 - """ self.assertQuerysetEqual( Order.objects.exclude(Q(items__status=1)), @@ -2729,7 +2725,6 @@ class ExcludeTest17600(TestCase): """ Using exclude(condition) and exclude(Q(condition)) should yield the same QuerySet - """ self.assertEqual( list(Order.objects.exclude(items__status=1).distinct()), @@ -2739,7 +2734,6 @@ class ExcludeTest17600(TestCase): """ Using exclude(condition) and exclude(Q(condition)) should yield the same QuerySet - """ self.assertEqual( list(Order.objects.exclude(items__status=1)), diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index 6a83c88368..23837d17c0 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -592,7 +592,6 @@ class XmlDeserializerSecurityTests(SimpleTestCase): This is the most straightforward way to prevent all entity definitions and avoid both external entities and entity-expansion attacks. - """ xml = '' with self.assertRaises(DTDForbidden): diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py index ed5ae785ec..32b297b427 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -101,7 +101,6 @@ class ClassDecoratedTestCaseSuper(TestCase): """ Dummy class for testing max recursion error in child class call to super(). Refs #17011. - """ def test_max_recursion_error(self): pass @@ -130,7 +129,6 @@ class ClassDecoratedTestCase(ClassDecoratedTestCaseSuper): """ Overriding a method on a super class and then calling that method on the super class should not trigger infinite recursion. See #17011. - """ try: super(ClassDecoratedTestCase, self).test_max_recursion_error() diff --git a/tests/wsgi/tests.py b/tests/wsgi/tests.py index 13760d0b61..ea7112a03d 100644 --- a/tests/wsgi/tests.py +++ b/tests/wsgi/tests.py @@ -25,7 +25,6 @@ class WSGITest(TestCase): """ Verify that ``get_wsgi_application`` returns a functioning WSGI callable. - """ application = get_wsgi_application() @@ -80,7 +79,6 @@ class GetInternalWSGIApplicationTest(unittest.TestCase): """ If ``WSGI_APPLICATION`` is a dotted path, the referenced object is returned. - """ app = get_internal_wsgi_application() @@ -93,7 +91,6 @@ class GetInternalWSGIApplicationTest(unittest.TestCase): """ If ``WSGI_APPLICATION`` is ``None``, the return value of ``get_wsgi_application`` is returned. - """ # Mock out get_wsgi_application so we know its return value is used fake_app = object()