Skip to content

Commit 4b8f7c3

Browse files
Merge pull request #191 from tapasweni-pathak/predev
Enable Flake8
2 parents 4fa8e07 + 4c17c73 commit 4b8f7c3

File tree

11 files changed

+24
-14
lines changed

11 files changed

+24
-14
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ before_script:
2222
- python manage.py collectstatic --noinput
2323

2424
script:
25+
- flake8 .
2526
- coverage run --source='main' manage.py test --verbosity 2
2627

2728
after_success:

oshc/authentication/regbackend.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
class EmailLoginBackend(object):
55
'''
6-
This class checks that the user can be authenticated via our backend and if it fails than normal authentication backend is used.
6+
This class checks that the user can be authenticated via our backend and
7+
if it fails than normal authentication backend is used.
78
'''
89

910
def authenticate(self, username=None, password=None):
@@ -15,7 +16,7 @@ def authenticate(self, username=None, password=None):
1516
except user_cls.DoesNotExist:
1617
return None
1718
return None
18-
19+
1920
def get_user(self, user_id):
2021
user_cls = get_user_model()
2122
try:

oshc/authentication/urls.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
urlpatterns = [
55
url(r'^accounts/', include('allauth.urls')),
66
url(r'^accounts/login/profile/', views.profile, name="profile"),
7-
url(r'^ajax/validate_username/$', views.validate_username, name='validate_username'),
7+
url(r'^ajax/validate_username/$', views.validate_username,
8+
name='validate_username'),
89
]

oshc/authentication/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ def validate_username(request):
1212
data = {
1313
'is_present': User.objects.filter(username__iexact=username).exists()
1414
}
15-
return JsonResponse(data)
15+
return JsonResponse(data)

oshc/main/admin.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ class chatSessionAdmin(admin.ModelAdmin):
1111

1212

1313
class contestAdmin(admin.ModelAdmin):
14-
list_display = ('name', 'link', 'description', 'start_date', 'end_date', 'approved')
14+
list_display = ('name', 'link', 'description', 'start_date', 'end_date',
15+
'approved')
1516
actions = ['approve_contest']
1617

1718
def approve_contest(self, request, queryset):
@@ -23,5 +24,6 @@ def approve_contest(self, request, queryset):
2324
self.message_user(request, "{} approved.".format(message_bit))
2425
approve_contest.short_description = "Approve"
2526

27+
2628
admin.site.register(chatSession, chatSessionAdmin)
2729
admin.site.register(Contest, contestAdmin)

oshc/main/models.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
class chatSession(models.Model):
88
title = models.CharField(max_length=128, help_text="Session title")
9-
profile_name = models.CharField(max_length=128, help_text="The person's name")
9+
profile_name = models.CharField(max_length=128,
10+
help_text="The person's name")
1011
profile_url = models.URLField(help_text="The Url of the person's website")
1112
description = models.TextField(max_length=512, help_text="Session details")
1213
start_date = models.DateTimeField()

oshc/main/tests.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import unicode_literals
33

4-
from django.contrib.auth.models import User
54
from django.test import SimpleTestCase, TestCase
65
from django.urls import reverse
76

oshc/main/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from django.shortcuts import render
22
from django.http import HttpResponseRedirect
33
from main.models import chatSession, Contest
4-
from datetime import datetime
54
from django.shortcuts import render_to_response
65
from django.template import RequestContext
76
from .forms import ContestForm
@@ -38,6 +37,7 @@ def add_contest(request):
3837
form = ContestForm()
3938
return render(request, 'contest_edit.html', {'form': form})
4039

40+
4141
def submit_contest(request):
4242
return render(request, 'contest_submission.html')
4343

oshc/oshc/settings.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,20 @@
9595

9696
AUTH_PASSWORD_VALIDATORS = [
9797
{
98-
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
98+
'NAME': 'django.contrib.auth.password_validation.'
99+
'UserAttributeSimilarityValidator',
99100
},
100101
{
101-
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
102+
'NAME': 'django.contrib.auth.password_validation.'
103+
'MinimumLengthValidator',
102104
},
103105
{
104-
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
106+
'NAME': 'django.contrib.auth.password_validation.'
107+
'CommonPasswordValidator',
105108
},
106109
{
107-
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
110+
'NAME': 'django.contrib.auth.password_validation.'
111+
'NumericPasswordValidator',
108112
},
109113
]
110114

oshc/oshc/wsgi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99

1010
import os
11+
from django.core.wsgi import get_wsgi_application
1112
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oshc.settings")
1213

13-
from django.core.wsgi import get_wsgi_application
1414
application = get_wsgi_application()

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ psycopg2==2.7.3.1
66
pytz==2017.2
77
whitenoise==3.3.1
88
django-allauth==0.33.0
9-
django-crispy-forms==1.7.0
9+
django-crispy-forms==1.7.0
10+
flake8==3.4.1

0 commit comments

Comments
 (0)