1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Whitespace cleanup.

* Removed trailing whitespace.
* Added newline to EOF if missing.
* Removed blank lines at EOF.
* Removed some stray tabs.
This commit is contained in:
Tim Graham 2013-10-10 16:42:30 -04:00
parent ca874b2fe6
commit 1dae4ac177
173 changed files with 602 additions and 678 deletions

View File

@ -7,4 +7,3 @@ import sys
from lib2to3.main import main from lib2to3.main import main
sys.exit(main("django.utils.2to3_fixes")) sys.exit(main("django.utils.2to3_fixes"))

View File

@ -31,4 +31,3 @@ DATETIME_INPUT_FORMATS = (
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.' THOUSAND_SEPARATOR = '.'
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -41,4 +41,3 @@ DATETIME_INPUT_FORMATS = (
DECIMAL_SEPARATOR = '.' DECIMAL_SEPARATOR = '.'
THOUSAND_SEPARATOR = ',' THOUSAND_SEPARATOR = ','
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -40,4 +40,3 @@ DATETIME_INPUT_FORMATS = (
DECIMAL_SEPARATOR = '.' DECIMAL_SEPARATOR = '.'
THOUSAND_SEPARATOR = ',' THOUSAND_SEPARATOR = ','
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -31,4 +31,3 @@ DATETIME_INPUT_FORMATS = (
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.' THOUSAND_SEPARATOR = '.'
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -27,4 +27,3 @@ DATETIME_INPUT_FORMATS = (
DECIMAL_SEPARATOR = '.' DECIMAL_SEPARATOR = '.'
THOUSAND_SEPARATOR = ',' THOUSAND_SEPARATOR = ','
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -41,4 +41,3 @@ DATETIME_INPUT_FORMATS = (
DECIMAL_SEPARATOR = '.' DECIMAL_SEPARATOR = '.'
THOUSAND_SEPARATOR = ',' THOUSAND_SEPARATOR = ','
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -61,4 +61,3 @@ def url(regex, view, kwargs=None, name=None, prefix=''):
if prefix: if prefix:
view = prefix + '.' + view view = prefix + '.' + view
return RegexURLPattern(regex, view, kwargs, name) return RegexURLPattern(regex, view, kwargs, name)

View File

@ -501,4 +501,3 @@ class CryptPasswordHasher(BasePasswordHasher):
(_('salt'), salt), (_('salt'), salt),
(_('hash'), mask_hash(data, show=3)), (_('hash'), mask_hash(data, show=3)),
]) ])

View File

@ -96,4 +96,3 @@ class FlatpageAdminFormTests(TestCase):
self.assertEqual( self.assertEqual(
f.errors, f.errors,
{'sites': [translation.ugettext('This field is required.')]}) {'sites': [translation.ugettext('This field is required.')]})

View File

@ -154,5 +154,3 @@ class FlatpageMiddlewareAppendSlashTests(TestCase):
response = self.client.get('/') response = self.client.get('/')
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertContains(response, "<p>Root</p>") self.assertContains(response, "<p>Root</p>")

View File

@ -133,4 +133,3 @@ class FlatpageTemplateTagTests(TestCase):
"{% load flatpages %}{% get_flatpages for user as flatpages asdf%}") "{% load flatpages %}{% get_flatpages for user as flatpages asdf%}")
self.assertRaises(TemplateSyntaxError, render, self.assertRaises(TemplateSyntaxError, render,
"{% load flatpages %}{% get_flatpages prefix for user as flatpages asdf%}") "{% load flatpages %}{% get_flatpages prefix for user as flatpages asdf%}")

View File

@ -5,4 +5,3 @@ urlpatterns = patterns('',
(r'^flatpage_root', include('django.contrib.flatpages.urls')), (r'^flatpage_root', include('django.contrib.flatpages.urls')),
(r'^accounts/', include('django.contrib.auth.urls')), (r'^accounts/', include('django.contrib.auth.urls')),
) )

View File

@ -49,4 +49,3 @@ class SessionContactWizard(ContactWizard):
class CookieContactWizard(ContactWizard): class CookieContactWizard(ContactWizard):
storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage' storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'

View File

@ -15,4 +15,3 @@ class TestLoadStorage(TestCase):
'django.contrib.formtools.wizard.storage.idontexist.IDontExistStorage', 'wizard1') 'django.contrib.formtools.wizard.storage.idontexist.IDontExistStorage', 'wizard1')
self.assertRaises(MissingStorage, get_storage, self.assertRaises(MissingStorage, get_storage,
'django.contrib.formtools.wizard.storage.base.IDontExistStorage', 'wizard1') 'django.contrib.formtools.wizard.storage.base.IDontExistStorage', 'wizard1')

View File

@ -63,4 +63,3 @@ class SessionContactWizard(ContactWizard):
class CookieContactWizard(ContactWizard): class CookieContactWizard(ContactWizard):
storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage' storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'

View File

@ -2,4 +2,3 @@ from django.db.backends.sqlite3.client import DatabaseClient
class SpatiaLiteClient(DatabaseClient): class SpatiaLiteClient(DatabaseClient):
executable_name = 'spatialite' executable_name = 'spatialite'

View File

@ -52,4 +52,3 @@ try:
except ImportError: except ImportError:
# No ctypes, but don't raise an exception. # No ctypes, but don't raise an exception.
pass pass

View File

@ -33,4 +33,3 @@ class GDALBase(object):
raise TypeError('Incompatible pointer type') raise TypeError('Incompatible pointer type')
ptr = property(_get_ptr, _set_ptr) ptr = property(_get_ptr, _set_ptr)

View File

@ -95,4 +95,3 @@ geom_transform_to = void_output(lgdal.OGR_G_TransformTo, [c_void_p, c_void_p])
# For retrieving the envelope of the geometry. # For retrieving the envelope of the geometry.
get_envelope = env_func(lgdal.OGR_G_GetEnvelope, [c_void_p, POINTER(OGREnvelope)]) get_envelope = env_func(lgdal.OGR_G_GetEnvelope, [c_void_p, POINTER(OGREnvelope)])

View File

@ -16,5 +16,3 @@ class WKTReader(_WKTReader):
def read(self, wkt): def read(self, wkt):
"Returns a GEOSGeometry for the given WKT string." "Returns a GEOSGeometry for the given WKT string."
return GEOSGeometry(super(WKTReader, self).read(wkt)) return GEOSGeometry(super(WKTReader, self).read(wkt))

View File

@ -1,4 +1,3 @@
# Geo-enabled Sitemap classes. # Geo-enabled Sitemap classes.
from django.contrib.gis.sitemaps.georss import GeoRSSSitemap from django.contrib.gis.sitemaps.georss import GeoRSSSitemap
from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap

View File

@ -50,4 +50,3 @@ class GeoRSSSitemap(Sitemap):
def location(self, obj): def location(self, obj):
return urlresolvers.reverse('django.contrib.gis.views.feed', args=(obj,)) return urlresolvers.reverse('django.contrib.gis.views.feed', args=(obj,))

View File

@ -1,7 +1,7 @@
from django.contrib import admin from django.contrib import admin
from django.contrib.redirects.models import Redirect from django.contrib.redirects.models import Redirect
class RedirectAdmin(admin.ModelAdmin): class RedirectAdmin(admin.ModelAdmin):
list_display = ('old_path', 'new_path') list_display = ('old_path', 'new_path')
list_filter = ('site',) list_filter = ('site',)

View File

@ -11,4 +11,3 @@ class Command(BaseCommand):
else: else:
sitemap_url = None sitemap_url = None
ping_google(sitemap_url=sitemap_url) ping_google(sitemap_url=sitemap_url)

View File

@ -57,4 +57,3 @@ class EmailBackend(ConsoleEmailBackend):
self.stream.close() self.stream.close()
finally: finally:
self.stream = None self.stream = None

View File

@ -20,4 +20,3 @@ class Command(AppCommand):
def handle_app(self, app, **options): def handle_app(self, app, **options):
return '\n'.join(sql_destroy_indexes(app, self.style, connections[options.get('database')])) return '\n'.join(sql_destroy_indexes(app, self.style, connections[options.get('database')]))

View File

@ -109,4 +109,3 @@ class DjangoJSONEncoder(json.JSONEncoder):
# Older, deprecated class name (for backwards compatibility purposes). # Older, deprecated class name (for backwards compatibility purposes).
DateTimeAwareJSONEncoder = DjangoJSONEncoder DateTimeAwareJSONEncoder = DjangoJSONEncoder

View File

@ -179,4 +179,3 @@ def main(main_func, args=None, kwargs=None):
wrapped_main_func = check_errors(main_func) wrapped_main_func = check_errors(main_func)
reloader(wrapped_main_func, args, kwargs) reloader(wrapped_main_func, args, kwargs)

View File

@ -339,4 +339,3 @@ def flatten_result(source):
for i in range(len(result)): for i in range(len(result)):
result[i] += piece result[i] += piece
return result, result_args return result, result_args

View File

@ -135,4 +135,3 @@ def mark_for_escaping(s):
if isinstance(s, (six.text_type, Promise)): if isinstance(s, (six.text_type, Promise)):
return EscapeText(s) return EscapeText(s)
return EscapeBytes(bytes(s)) return EscapeBytes(bytes(s))

View File

@ -60,4 +60,3 @@ def get_language_from_request(request, check_path=False):
def get_language_from_path(request, supported=None): def get_language_from_path(request, supported=None):
return None return None

View File

@ -163,4 +163,3 @@ def etag(etag_func):
def last_modified(last_modified_func): def last_modified(last_modified_func):
return condition(last_modified_func=last_modified_func) return condition(last_modified_func=last_modified_func)

View File

@ -69,4 +69,3 @@ else
fi fi
complete -F _python_django_completion -o default $pythons complete -F _python_django_completion -o default $pythons

View File

@ -5,4 +5,3 @@ from django.contrib import admin
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)), (r'^admin/', include(admin.site.urls)),
) )

View File

@ -8,4 +8,3 @@ class Command(AppCommand):
def handle_app(self, app, **options): def handle_app(self, app, **options):
print('EXECUTE:AppCommand app=%s, options=%s' % (app, sorted(options.items()))) print('EXECUTE:AppCommand app=%s, options=%s' % (app, sorted(options.items())))

View File

@ -1633,7 +1633,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
for f in ('Procfile', 'additional_file.py', 'requirements.txt'): for f in ('Procfile', 'additional_file.py', 'requirements.txt'):
self.assertTrue(os.path.exists(os.path.join(base_path, f))) self.assertTrue(os.path.exists(os.path.join(base_path, f)))
with open(os.path.join(base_path, f)) as fh: with open(os.path.join(base_path, f)) as fh:
self.assertEqual(fh.read(), self.assertEqual(fh.read().strip(),
'# some file for customtestproject test project') '# some file for customtestproject test project')
def test_custom_project_template_context_variables(self): def test_custom_project_template_context_variables(self):

View File

@ -6,10 +6,12 @@ from . import models
class WidgetAdmin(admin.AdminSite): class WidgetAdmin(admin.AdminSite):
pass pass
class CarAdmin(admin.ModelAdmin): class CarAdmin(admin.ModelAdmin):
list_display = ['make', 'model', 'owner'] list_display = ['make', 'model', 'owner']
list_editable = ['owner'] list_editable = ['owner']
class CarTireAdmin(admin.ModelAdmin): class CarTireAdmin(admin.ModelAdmin):
def formfield_for_foreignkey(self, db_field, request, **kwargs): def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "car": if db_field.name == "car":
@ -17,6 +19,7 @@ class CarTireAdmin(admin.ModelAdmin):
return db_field.formfield(**kwargs) return db_field.formfield(**kwargs)
return super(CarTireAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) return super(CarTireAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
class EventAdmin(admin.ModelAdmin): class EventAdmin(admin.ModelAdmin):
raw_id_fields = ['main_band', 'supporting_bands'] raw_id_fields = ['main_band', 'supporting_bands']

View File

@ -44,4 +44,3 @@ class Store(models.Model):
def __str__(self): def __str__(self):
return self.name return self.name

View File

@ -1 +0,0 @@

View File

@ -7,4 +7,3 @@ class LiberalKeyValidationMixin(object):
class CacheClass(LiberalKeyValidationMixin, LocMemCache): class CacheClass(LiberalKeyValidationMixin, LocMemCache):
pass pass

View File

@ -1917,4 +1917,3 @@ class TestMakeTemplateFragmentKey(TestCase):
key = make_template_fragment_key('spam', ['abc:def%']) key = make_template_fragment_key('spam', ['abc:def%'])
self.assertEqual(key, self.assertEqual(key,
'template.cache.spam.f27688177baec990cdf3fbd9d9c3f469') 'template.cache.spam.f27688177baec990cdf3fbd9d9c3f469')

View File

@ -20,4 +20,3 @@ class ChoicesTests(TestCase):
a.gender = 'U' a.gender = 'U'
self.assertEqual(a.get_gender_display(), 'U') self.assertEqual(a.get_gender_display(), 'U')

View File

@ -82,4 +82,3 @@ class CommentTestCase(TestCase):
d = self.getData() d = self.getData()
d.update(f.initial) d.update(f.initial)
return d return d

View File

@ -23,4 +23,3 @@ etag_view1 = condition(etag_func=lambda r: ETAG)(etag_view1)
def etag_view2(request): def etag_view2(request):
return HttpResponse(FULL_RESPONSE) return HttpResponse(FULL_RESPONSE)
etag_view2 = etag(lambda r: ETAG)(etag_view2) etag_view2 = etag(lambda r: ETAG)(etag_view2)

View File

@ -34,4 +34,3 @@ class RequestContextProcessorTests(TestCase):
self.assertContains(response, url) self.assertContains(response, url)
response = self.client.post(url, {'path': '/blah/'}) response = self.client.post(url, {'path': '/blah/'})
self.assertContains(response, url) self.assertContains(response, url)

View File

@ -53,4 +53,3 @@ class MultiDBCreatesuperuserTestCase(TestCase):
self.assertEqual(u.email, 'joe@somewhere.org') self.assertEqual(u.email, 'joe@somewhere.org')
new_io.close() new_io.close()

View File

@ -43,4 +43,3 @@ class Article(models.Model):
class Meta: class Meta:
ordering = ('headline',) ordering = ('headline',)

View File

@ -36,6 +36,3 @@ class Author(models.Model):
class Meta: class Meta:
db_table = 'my author table' db_table = 'my author table'
ordering = ('last_name','first_name') ordering = ('last_name','first_name')

View File

@ -47,4 +47,3 @@ class CustomManagersRegressTestCase(TestCase):
obj = RelatedModel.objects.get(name="xyzzy") obj = RelatedModel.objects.get(name="xyzzy")
obj.delete() obj.delete()
self.assertEqual(len(OneToOneRestrictedModel.plain_manager.all()), 0) self.assertEqual(len(OneToOneRestrictedModel.plain_manager.all()), 0)

View File

@ -45,4 +45,3 @@ class Bar(models.Model):
class Foo(models.Model): class Foo(models.Model):
bar = models.ForeignKey(Bar) bar = models.ForeignKey(Bar)

View File

@ -1,2 +1 @@
# A models.py so that tests run. # A models.py so that tests run.

View File

@ -114,4 +114,3 @@ class DistinctOnTests(TestCase):
# distinct + aggregate not allowed # distinct + aggregate not allowed
with self.assertRaises(NotImplementedError): with self.assertRaises(NotImplementedError):
Celebrity.objects.distinct('id').aggregate(Max('id')) Celebrity.objects.distinct('id').aggregate(Max('id'))

View File

@ -26,4 +26,3 @@ class Experiment(models.Model):
def duration(self): def duration(self):
return self.end - self.start return self.end - self.start

View File

@ -42,4 +42,3 @@ class TestObject(models.Model):
def __str__(self): def __str__(self):
return 'TestObject: %s,%s,%s' % (self.first,self.second,self.third) return 'TestObject: %s,%s,%s' % (self.first,self.second,self.third)

View File

@ -72,5 +72,3 @@ class Contact(models.Model):
# #
class EpisodePermanent(Episode): class EpisodePermanent(Episode):
pass pass

View File

@ -375,4 +375,3 @@ class DeleteViewTests(TestCase):
self.fail('Should raise exception -- No redirect URL provided, and no get_absolute_url provided') self.fail('Should raise exception -- No redirect URL provided, and no get_absolute_url provided')
except ImproperlyConfigured: except ImproperlyConfigured:
pass pass

View File

@ -7,4 +7,3 @@ from django.db import models
class Simple(models.Model): class Simple(models.Model):
name = models.CharField(max_length = 50) name = models.CharField(max_length = 50)

View File

@ -20,4 +20,3 @@ class Pool(models.Model):
class PoolStyle(models.Model): class PoolStyle(models.Model):
name = models.CharField(max_length=30) name = models.CharField(max_length=30)
pool = models.OneToOneField(Pool) pool = models.OneToOneField(Pool)

View File

@ -27,4 +27,3 @@ class Issue(models.Model):
class UnicodeReferenceModel(models.Model): class UnicodeReferenceModel(models.Model):
others = models.ManyToManyField("UnicodeReferenceModel") others = models.ManyToManyField("UnicodeReferenceModel")

View File

@ -39,4 +39,3 @@ class Writer(models.Model):
def __str__(self): def __str__(self):
return '%s (%s)' % (self.reporter, self.position) return '%s (%s)' % (self.reporter, self.position)

View File

@ -108,4 +108,3 @@ class M2MRegressionTests(TestCase):
worksheet.lines = hi worksheet.lines = hi
self.assertEqual(1, worksheet.lines.count()) self.assertEqual(1, worksheet.lines.count())
self.assertEqual(1, hi.count()) self.assertEqual(1, hi.count())

View File

@ -1 +0,0 @@
# This file intentionally left blank

View File

@ -58,4 +58,3 @@ class WriteRouter(object):
# A router that only expresses an opinion on writes # A router that only expresses an opinion on writes
def db_for_write(self, model, **hints): def db_for_write(self, model, **hints):
return 'writer' return 'writer'

View File

@ -66,4 +66,3 @@ class ResolveUrlTests(TestCase):
""" """
with self.assertRaises(NoReverseMatch): with self.assertRaises(NoReverseMatch):
resolve_url(lambda: 'asdf') resolve_url(lambda: 'asdf')

View File

@ -9,4 +9,3 @@ urlpatterns = patterns('',
url(r'^(?P<one>\d+)|(?P<two>\d+)/$', empty_view), url(r'^(?P<one>\d+)|(?P<two>\d+)/$', empty_view),
(r'^included/', include('urlpatterns_reverse.included_named_urls2')), (r'^included/', include('urlpatterns_reverse.included_named_urls2')),
) )

View File

@ -8,4 +8,3 @@ urlpatterns = patterns('',
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url6"), url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url6"),
url(r'^(?P<one>\d+)|(?P<two>\d+)/$', empty_view), url(r'^(?P<one>\d+)|(?P<two>\d+)/$', empty_view),
) )

View File

@ -21,4 +21,3 @@ urlpatterns = patterns('urlpatterns_reverse.views',
(r'^ns-included3/', include('urlpatterns_reverse.included_urls', namespace='inc-ns3')), (r'^ns-included3/', include('urlpatterns_reverse.included_urls', namespace='inc-ns3')),
(r'^ns-included4/', include('urlpatterns_reverse.namespace_urls', namespace='inc-ns4')), (r'^ns-included4/', include('urlpatterns_reverse.namespace_urls', namespace='inc-ns4')),
) )

View File

@ -1,2 +1 @@
#from django.conf.urls import patterns, url, include #from django.conf.urls import patterns, url, include

View File

@ -656,4 +656,3 @@ class ViewLoadingTests(TestCase):
# swallow it. # swallow it.
self.assertRaises(AttributeError, get_callable, self.assertRaises(AttributeError, get_callable,
'urlpatterns_reverse.views_broken.i_am_broken') 'urlpatterns_reverse.views_broken.i_am_broken')

View File

@ -13,4 +13,3 @@ class ValidationTestCase(TestCase):
clean() clean()
self.assertIn(field_name, cm.exception.message_dict) self.assertIn(field_name, cm.exception.message_dict)
self.assertEqual(message, cm.exception.message_dict[field_name]) self.assertEqual(message, cm.exception.message_dict[field_name])

View File

@ -10,4 +10,3 @@ class CustomMessagesTest(ValidationTestCase):
def test_custom_null_message(self): def test_custom_null_message(self):
cmm = CustomMessagesModel() cmm = CustomMessagesModel()
self.assertFieldFailsValidationWithMessage(cmm.full_clean, 'number', ['NULL']) self.assertFieldFailsValidationWithMessage(cmm.full_clean, 'number', ['NULL'])

View File

@ -141,4 +141,3 @@ class PerformUniqueChecksTest(TestCase):
with self.assertRaises(ValidationError) as cm: with self.assertRaises(ValidationError) as cm:
m.full_clean() m.full_clean()
self.assertEqual(cm.exception.message_dict, {'no': ['Custom unique number message.']}) self.assertEqual(cm.exception.message_dict, {'no': ['Custom unique number message.']})

View File

@ -24,4 +24,3 @@ class VersionTests(TestCase):
) )
for ver_tuple, ver_string in tuples_to_strings: for ver_tuple, ver_string in tuples_to_strings:
self.assertEqual(get_version(ver_tuple), ver_string) self.assertEqual(get_version(ver_tuple), ver_string)

View File

@ -8,4 +8,3 @@ except_args = (b'Broken!', # plain exception with ASCII text
'¡Broken!', # non-ASCII unicode data '¡Broken!', # non-ASCII unicode data
'¡Broken!'.encode('utf-8'), # non-ASCII, utf-8 encoded bytestring '¡Broken!'.encode('utf-8'), # non-ASCII, utf-8 encoded bytestring
b'\xa1Broken!', ) # non-ASCII, latin1 bytestring b'\xa1Broken!', ) # non-ASCII, latin1 bytestring

View File

@ -8,4 +8,3 @@ register = template.Library()
@register.simple_tag @register.simple_tag
def go_boom(arg): def go_boom(arg):
raise BrokenException(arg) raise BrokenException(arg)

View File

@ -36,4 +36,3 @@ class URLHandling(TestCase):
""" """
response = self.client.get('/permanent_nonascii_redirect/') response = self.client.get('/permanent_nonascii_redirect/')
self.assertRedirects(response, self.redirect_target, status_code=301) self.assertRedirects(response, self.redirect_target, status_code=301)