Skip to content

Commit 74a6f4e

Browse files
committed
apply autopep8
1 parent 6ff6b40 commit 74a6f4e

File tree

9 files changed

+11
-14
lines changed

9 files changed

+11
-14
lines changed

fluent_utils/ajax.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class JsonResponse(HttpResponse):
99
"""
1010
A convenient HttpResponse class, which encodes the response in JSON format.
1111
"""
12+
1213
def __init__(self, jsondata, status=200):
1314
self.jsondata = jsondata
1415
super(JsonResponse, self).__init__(json.dumps(jsondata), content_type='application/json; charset=utf-8', status=status)

fluent_utils/django_compat/django16.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
def add_preserved_filters(context, form_url):
1919
return form_url
2020

21-
if django.VERSION >= (1,6):
21+
if django.VERSION >= (1, 6):
2222
def is_queryset_empty(queryset):
2323
"""
2424
Check whether a queryset is empty by using ``.none()``.
2525
"""
2626
return queryset.query.is_empty()
2727
else:
2828
from django.db.models.query import EmptyQuerySet
29+
2930
def is_queryset_empty(queryset):
3031
return isinstance(queryset, EmptyQuerySet)

fluent_utils/dry/admin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class MultiSiteAdminMixin(object):
88
"""
99
filter_site = True
1010

11-
1211
def get_queryset(self, request):
1312
qs = super(MultiSiteAdminMixin, self).get_queryset(request)
1413

@@ -18,11 +17,10 @@ def get_queryset(self, request):
1817
qs = qs.parent_site(int(settings.SITE_ID)) # Note: that method can be customized (e.g. SharedContentQuerySet)
1918
return qs
2019

21-
2220
# For Django 1.5:
2321
# Leave for Django 1.6/1.7, so backwards compatibility can be fixed.
2422
# It will be removed in Django 1.8, so remove it here too to avoid false promises.
25-
if django.VERSION < (1,8):
23+
if django.VERSION < (1, 8):
2624
def queryset(self, request):
2725
qs = super(MultiSiteAdminMixin, self).queryset(request)
2826
if self.filter_site:

fluent_utils/dry/fields.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class HideChoicesCharField(models.CharField):
55
"""
66
For Django 1.7, hide the 'choices' for a field.
77
"""
8+
89
def deconstruct(self):
910
name, path, args, kwargs = models.CharField.deconstruct(self)
1011

fluent_utils/dry/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ def get_db_table(module, model_name, meta=None, prefix=None):
2323
model_name = model_name.lower()
2424
db_table = "{0}{1}_{2}".format(prefix or '', app_label, model_name)
2525
return truncate_name(db_table, connection.ops.max_name_length())
26-
27-

fluent_utils/softdeps/any_imagefield.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class AnyFileField(BaseFileField):
1919
2020
If *django-any-imagefield* is not installed, the filebrowser link will not be displayed.
2121
"""
22+
2223
def south_field_triple(self):
2324
# Masquerade as normal FileField, so the soft-dependency also exists in the migrations.
2425
from south.modelsinspector import introspector
@@ -40,6 +41,7 @@ class AnyImageField(BaseImageField):
4041
4142
If *django-any-imagefield* is not installed, the filebrowser link will not be displayed.
4243
"""
44+
4345
def south_field_triple(self):
4446
# Masquerade as normal ImageField, so the soft-dependency also exists in the migrations.
4547
from south.modelsinspector import introspector

fluent_utils/softdeps/any_urlfield.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class AnyUrlField(BaseUrlField):
1818
1919
If *django-any-urlfield* is not installed, only regular URLs can be used.
2020
"""
21+
2122
def __init__(self, *args, **kwargs):
2223
if 'max_length' not in kwargs:
2324
kwargs['max_length'] = 300 # Standardize

fluent_utils/softdeps/comments.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class CommentManagerStub(models.Manager):
123123
def get_queryset(self):
124124
return super(CommentManagerStub, self).get_queryset().none()
125125

126-
if django.VERSION < (1,7):
126+
if django.VERSION < (1, 7):
127127
def get_query_set(self):
128128
return super(CommentManagerStub, self).get_query_set().none()
129129

@@ -162,26 +162,25 @@ class Meta:
162162
is_removed = models.BooleanField(default=False)
163163

164164

165-
166165
CommentModel = get_model()
167166

168167

169-
170168
if IS_INSTALLED:
171169
class CommentRelation(GenericRelation):
170+
172171
def __init__(self, to=CommentModel, **kwargs):
173172
kwargs.setdefault('object_id_field', 'object_pk')
174173
super(CommentRelation, self).__init__(to, **kwargs)
175174
else:
176175
class CommentRelation(models.Field):
176+
177177
def __init__(self, *args, **kwargs):
178178
pass
179179

180180
def contribute_to_class(self, cls, name, virtual_only=False):
181181
setattr(cls, name, CommentModelStub.objects.none())
182182

183183

184-
185184
class CommentsMixin(models.Model):
186185
"""
187186
Mixin for adding comments support to a model.
@@ -200,7 +199,6 @@ class Meta:
200199
comments = property(get_public_comments_for_model, doc="Return the visible comments.")
201200
comments_are_moderated = property(get_comments_are_moderated, doc="Check if comments are moderated")
202201

203-
204202
@property
205203
def comments_are_open(self):
206204
"""
@@ -210,5 +208,3 @@ def comments_are_open(self):
210208
return False
211209

212210
return get_comments_are_open(self)
213-
214-

fluent_utils/softdeps/taggit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class TagsMixin(models.Model):
5151
class Meta:
5252
abstract = True
5353

54-
5554
def similar_objects(self, num=None, **filters):
5655
"""
5756
Find similar objects using related tags.

0 commit comments

Comments
 (0)