Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed "indentation is not a multiple of four" pep8 issues.

  • Loading branch information...
commit 5649c0af9d90ba1368abbe6c233ee61c976c8137 1 parent cb98ffe
@timgraham timgraham authored
View
2  django/contrib/admin/util.py
@@ -28,7 +28,7 @@ def lookup_needs_distinct(opts, lookup_path):
isinstance(field.rel, models.ManyToManyRel)) or
(isinstance(field, models.related.RelatedObject) and
not field.field.unique)):
- return True
+ return True
return False
def prepare_lookup_value(key, value):
View
8 django/contrib/gis/geos/prototypes/io.py
@@ -252,10 +252,10 @@ def wkb_r():
return thread_context.wkb_r
def wkb_w(dim=2):
- if not thread_context.wkb_w:
- thread_context.wkb_w = WKBWriter()
- thread_context.wkb_w.outdim = dim
- return thread_context.wkb_w
+ if not thread_context.wkb_w:
+ thread_context.wkb_w = WKBWriter()
+ thread_context.wkb_w.outdim = dim
+ return thread_context.wkb_w
def ewkb_w(dim=2):
if not thread_context.ewkb_w:
View
14 django/contrib/gis/tests/geoapp/test_regress.py
@@ -58,14 +58,14 @@ def test_unicode_date(self):
self.assertEqual(founded, PennsylvaniaCity.objects.aggregate(Min('founded'))['founded__min'])
def test_empty_count(self):
- "Testing that PostGISAdapter.__eq__ does check empty strings. See #13670."
- # contrived example, but need a geo lookup paired with an id__in lookup
- pueblo = City.objects.get(name='Pueblo')
- state = State.objects.filter(poly__contains=pueblo.point)
- cities_within_state = City.objects.filter(id__in=state)
+ "Testing that PostGISAdapter.__eq__ does check empty strings. See #13670."
+ # contrived example, but need a geo lookup paired with an id__in lookup
+ pueblo = City.objects.get(name='Pueblo')
+ state = State.objects.filter(poly__contains=pueblo.point)
+ cities_within_state = City.objects.filter(id__in=state)
- # .count() should not throw TypeError in __eq__
- self.assertEqual(cities_within_state.count(), 1)
+ # .count() should not throw TypeError in __eq__
+ self.assertEqual(cities_within_state.count(), 1)
def test_defer_or_only_with_annotate(self):
"Regression for #16409. Make sure defer() and only() work with annotate()"
View
5 django/contrib/messages/tests/base.py
@@ -31,14 +31,15 @@ def add_level_messages(storage):
class override_settings_tags(override_settings):
- def enable(self):
+ def enable(self):
super(override_settings_tags, self).enable()
# LEVEL_TAGS is a constant defined in the
# django.contrib.messages.storage.base module, so after changing
# settings.MESSAGE_TAGS, we need to update that constant too.
self.old_level_tags = base.LEVEL_TAGS
base.LEVEL_TAGS = utils.get_level_tags()
- def disable(self):
+
+ def disable(self):
super(override_settings_tags, self).disable()
base.LEVEL_TAGS = self.old_level_tags
View
2  django/core/serializers/xml_serializer.py
@@ -300,7 +300,7 @@ def getInnerText(node):
elif child.nodeType == child.ELEMENT_NODE:
inner_text.extend(getInnerText(child))
else:
- pass
+ pass
return "".join(inner_text)
View
2  django/utils/translation/trans_real.py
@@ -670,7 +670,7 @@ def parse_accept_lang_header(lang_string):
if priority:
priority = float(priority)
if not priority: # if priority is 0.0 at this point make it 1.0
- priority = 1.0
+ priority = 1.0
result.append((lang, priority))
result.sort(key=lambda k: k[1], reverse=True)
return result
View
8 tests/admin_validation/tests.py
@@ -244,14 +244,14 @@ class FieldsetBookAdmin(admin.ModelAdmin):
def test_nested_fields(self):
class NestedFieldsAdmin(admin.ModelAdmin):
- fields = ('price', ('name', 'subtitle'))
+ fields = ('price', ('name', 'subtitle'))
NestedFieldsAdmin.validate(Book)
def test_nested_fieldsets(self):
class NestedFieldsetAdmin(admin.ModelAdmin):
- fieldsets = (
- ('Main', {'fields': ('price', ('name', 'subtitle'))}),
- )
+ fieldsets = (
+ ('Main', {'fields': ('price', ('name', 'subtitle'))}),
+ )
NestedFieldsetAdmin.validate(Book)
def test_explicit_through_override(self):
View
18 tests/admin_widgets/models.py
@@ -43,17 +43,17 @@ def get_queryset(self):
@python_2_unicode_compatible
class Inventory(models.Model):
- barcode = models.PositiveIntegerField(unique=True)
- parent = models.ForeignKey('self', to_field='barcode', blank=True, null=True)
- name = models.CharField(blank=False, max_length=20)
- hidden = models.BooleanField(default=False)
+ barcode = models.PositiveIntegerField(unique=True)
+ parent = models.ForeignKey('self', to_field='barcode', blank=True, null=True)
+ name = models.CharField(blank=False, max_length=20)
+ hidden = models.BooleanField(default=False)
- # see #9258
- default_manager = models.Manager()
- objects = HiddenInventoryManager()
+ # see #9258
+ default_manager = models.Manager()
+ objects = HiddenInventoryManager()
- def __str__(self):
- return self.name
+ def __str__(self):
+ return self.name
class Event(models.Model):
main_band = models.ForeignKey(Band, limit_choices_to=models.Q(pk__gt=0), related_name='events_main_band_at')
View
4 tests/custom_managers/tests.py
@@ -29,12 +29,12 @@ def test_manager(self):
manager.public_method()
# Don't copy private methods.
with self.assertRaises(AttributeError):
- manager._private_method()
+ manager._private_method()
# Copy methods with `manager=True` even if they are private.
manager._optin_private_method()
# Don't copy methods with `manager=False` even if they are public.
with self.assertRaises(AttributeError):
- manager.optout_public_method()
+ manager.optout_public_method()
# Test that the overridden method is called.
queryset = manager.filter()
View
2  tests/defaultfilters/tests.py
@@ -481,7 +481,7 @@ def test_unordered_list(self):
@python_2_unicode_compatible
class ULItem(object):
def __init__(self, title):
- self.title = title
+ self.title = title
def __str__(self):
return 'ulitem-%s' % str(self.title)
View
6 tests/forms_tests/tests/test_forms.py
@@ -1173,9 +1173,9 @@ def initial_other_options():
# If a Form defines 'initial' *and* 'initial' is passed as a parameter to Form(),
# then the latter will get precedence.
class UserRegistration(Form):
- username = CharField(max_length=10, initial=initial_django)
- password = CharField(widget=PasswordInput)
- options = MultipleChoiceField(choices=[('f','foo'),('b','bar'),('w','whiz')], initial=initial_other_options)
+ username = CharField(max_length=10, initial=initial_django)
+ password = CharField(widget=PasswordInput)
+ options = MultipleChoiceField(choices=[('f','foo'),('b','bar'),('w','whiz')], initial=initial_other_options)
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(p.as_ul(), """<li>Username: <input type="text" name="username" value="django" maxlength="10" /></li>
View
8 tests/forms_tests/tests/test_formsets.py
@@ -91,7 +91,7 @@ def test_basic_formset(self):
# for adding data. By default, it displays 1 blank form. It can display more,
# but we'll look at how to do so later.
formset = self.make_choiceformset()
-
+
self.assertHTMLEqual(str(formset), """<input type="hidden" name="choices-TOTAL_FORMS" value="1" /><input type="hidden" name="choices-INITIAL_FORMS" value="0" /><input type="hidden" name="choices-MAX_NUM_FORMS" value="1000" />
<tr><th>Choice:</th><td><input type="text" name="choices-0-choice" /></td></tr>
<tr><th>Votes:</th><td><input type="number" name="choices-0-votes" /></td></tr>""")
@@ -366,7 +366,7 @@ def test_formset_with_deletion(self):
# it's going to be deleted.
class CheckForm(Form):
- field = IntegerField(min_value=100)
+ field = IntegerField(min_value=100)
data = {
'check-TOTAL_FORMS': '3', # the number of forms rendered
@@ -978,7 +978,7 @@ def clean(self):
def test_validate_max_ignores_forms_marked_for_deletion(self):
class CheckForm(Form):
- field = IntegerField()
+ field = IntegerField()
data = {
'check-TOTAL_FORMS': '2',
@@ -1004,7 +1004,7 @@ def test_formset_total_error_count(self):
([('Calexico', '100'), ('Calexico', '')], 1),
([('Calexico', ''), ('Calexico', '')], 2),
]
-
+
for formset_data, expected_error_count in data:
formset = self.make_choiceformset(formset_data)
self.assertEqual(formset.total_error_count(), expected_error_count)
View
6 tests/forms_tests/tests/test_widgets.py
@@ -639,8 +639,8 @@ def get_choices():
# You can create your own custom renderers for RadioSelect to use.
class MyRenderer(RadioFieldRenderer):
- def render(self):
- return '<br />\n'.join(six.text_type(choice) for choice in self)
+ def render(self):
+ return '<br />\n'.join(six.text_type(choice) for choice in self)
w = RadioSelect(renderer=MyRenderer)
self.assertHTMLEqual(w.render('beatle', 'G', choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo'))), """<label><input type="radio" name="beatle" value="J" /> John</label><br />
<label><input type="radio" name="beatle" value="P" /> Paul</label><br />
@@ -649,7 +649,7 @@ def render(self):
# Or you can use custom RadioSelect fields that use your custom renderer.
class CustomRadioSelect(RadioSelect):
- renderer = MyRenderer
+ renderer = MyRenderer
w = CustomRadioSelect()
self.assertHTMLEqual(w.render('beatle', 'G', choices=(('J', 'John'), ('P', 'Paul'), ('G', 'George'), ('R', 'Ringo'))), """<label><input type="radio" name="beatle" value="J" /> John</label><br />
<label><input type="radio" name="beatle" value="P" /> Paul</label><br />
View
8 tests/m2m_multiple/models.py
@@ -14,21 +14,23 @@
@python_2_unicode_compatible
class Category(models.Model):
name = models.CharField(max_length=20)
+
class Meta:
- ordering = ('name',)
+ ordering = ('name',)
def __str__(self):
return self.name
+
@python_2_unicode_compatible
class Article(models.Model):
headline = models.CharField(max_length=50)
pub_date = models.DateTimeField()
primary_categories = models.ManyToManyField(Category, related_name='primary_article_set')
secondary_categories = models.ManyToManyField(Category, related_name='secondary_article_set')
+
class Meta:
- ordering = ('pub_date',)
+ ordering = ('pub_date',)
def __str__(self):
return self.headline
-
View
16 tests/model_forms/tests.py
@@ -88,11 +88,11 @@ class Meta:
class CustomWriterForm(forms.ModelForm):
- name = forms.CharField(required=False)
+ name = forms.CharField(required=False)
- class Meta:
- model = Writer
- fields = '__all__'
+ class Meta:
+ model = Writer
+ fields = '__all__'
class FlexDatePostForm(forms.ModelForm):
@@ -456,11 +456,11 @@ class SubCategoryForm(BaseCategoryForm):
def test_subclassmeta_form(self):
class SomeCategoryForm(forms.ModelForm):
- checkbox = forms.BooleanField()
+ checkbox = forms.BooleanField()
- class Meta:
- model = Category
- fields = '__all__'
+ class Meta:
+ model = Category
+ fields = '__all__'
class SubclassMeta(SomeCategoryForm):
""" We can also subclass the Meta inner class to change the fields
View
2  tests/or_lookups/models.py
@@ -19,7 +19,7 @@ class Article(models.Model):
pub_date = models.DateTimeField()
class Meta:
- ordering = ('pub_date',)
+ ordering = ('pub_date',)
def __str__(self):
return self.headline
View
2  tests/prefetch_related/models.py
@@ -29,7 +29,7 @@ class FavoriteAuthors(models.Model):
likes_author = models.ForeignKey(Author, to_field='name', related_name='likes_me')
class Meta:
- ordering = ['id']
+ ordering = ['id']
@python_2_unicode_compatible
View
2  tests/queries/models.py
@@ -355,7 +355,7 @@ class ObjectC(models.Model):
objectb = models.ForeignKey(ObjectB)
def __str__(self):
- return self.name
+ return self.name
@python_2_unicode_compatible
class SimpleCategory(models.Model):
View
3  tests/reserved_names/models.py
@@ -21,8 +21,9 @@ class Thing(models.Model):
having = models.CharField(max_length=1)
where = models.DateField(max_length=1)
has_hyphen = models.CharField(max_length=1, db_column='has-hyphen')
+
class Meta:
- db_table = 'select'
+ db_table = 'select'
def __str__(self):
return self.when
View
6 tests/serializers/models.py
@@ -19,7 +19,7 @@ class Category(models.Model):
name = models.CharField(max_length=20)
class Meta:
- ordering = ('name',)
+ ordering = ('name',)
def __str__(self):
return self.name
@@ -44,7 +44,7 @@ class Article(models.Model):
categories = models.ManyToManyField(Category)
class Meta:
- ordering = ('pub_date',)
+ ordering = ('pub_date',)
def __str__(self):
return self.headline
@@ -77,7 +77,7 @@ class Movie(models.Model):
price = models.DecimalField(max_digits=6, decimal_places=2, default=Decimal('0.00'))
class Meta:
- ordering = ('title',)
+ ordering = ('title',)
def __str__(self):
return self.title

1 comment on commit 5649c0a

@jezdez
Owner

@timgraham You're the best of the best. <3

Please sign in to comment.
Something went wrong with that request. Please try again.