Skip to content

Commit

Permalink
Fixed requirements and flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Casassarnau committed Oct 1, 2021
1 parent 5045cfe commit a2bfc5f
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
exclude = build,.git,.tox,./django/utils/six.py,./django/conf/app_template/*,./tests/.env,./env,./app/settings.py,./*/migrations,./app/hackathon_variables.py, ./venv/*
ignore = W601,F403
ignore = W601,F403,W504
max-line-length = 119
14 changes: 7 additions & 7 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ def lazy_format(s, f):

def hacker_tabs(user):
app = getattr(user, 'application', None)
l = [('Home', reverse('dashboard'),
'Invited' if app and user.application.needs_action() else False), ]
tabs_list = [('Home', reverse('dashboard'),
'Invited' if app and user.application.needs_action() else False), ]
if user.email_verified and app and getattr(settings, 'TEAMS_ENABLED', False) and app.can_join_team():
l.append(('Team', reverse('teams'), False))
tabs_list.append(('Team', reverse('teams'), False))
if app:
l.append(('Application', reverse('application'), False))
tabs_list.append(('Application', reverse('application'), False))

if app and getattr(user, 'reimbursement', None) and settings.REIMBURSEMENT_ENABLED:
l.append(('Travel', reverse('reimbursement_dashboard'),
'Pending' if user.reimbursement.needs_action() else False))
tabs_list.append(('Travel', reverse('reimbursement_dashboard'),
'Pending' if user.reimbursement.needs_action() else False))

return l
return tabs_list
2 changes: 1 addition & 1 deletion applications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def __init__(self, *args, **kwargs):
super(BaseApplication, self).__init__(*args, **kwargs)
try:
dict = args[0]['dict']
except:
except Exception:
dict = None
if dict is not None:
for key in dict:
Expand Down
10 changes: 5 additions & 5 deletions applications/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get(self, request, *args, **kwargs):
msg = emails.create_confirmation_email(application, self.request)
try:
application.confirm()
except:
except Exception:
raise Http404

if msg:
Expand Down Expand Up @@ -142,14 +142,14 @@ def get_context_data(self, **kwargs):
dict = draft.get_dict()
app = Application({'dict': dict})
form = ApplicationForm(instance=app)
except:
except Exception:
form = ApplicationForm()
context.update({'form': form})
try:
application = Application.objects.get(user=self.request.user)
deadline = get_deadline(application)
context.update({'invite_timeleft': deadline - timezone.now(), 'application': application})
except:
except Exception:
# We ignore this as we are okay if the user has not created an application yet
pass

Expand All @@ -162,7 +162,7 @@ def post(self, request, *args, **kwargs):
try:
form = ApplicationForm(request.POST, request.FILES, instance=request.user.application)
new_application = False
except:
except Exception:
form = ApplicationForm(request.POST, request.FILES)
if form.is_valid():
application = form.save(commit=False)
Expand Down Expand Up @@ -207,7 +207,7 @@ def post(self, request, *args, **kwargs):
try:
form = ApplicationForm(request.POST, request.FILES,
instance=request.user.application)
except:
except Exception:
form = ApplicationForm(request.POST, request.FILES)
if form.is_valid():
application = form.save(commit=False)
Expand Down
2 changes: 1 addition & 1 deletion checkin/management/commands/add_volunteers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ def handle(self, *args, **options):

print('User {0} successfully created.'.format(email))

except:
except Exception:
print('There was a problem creating the user: {0}. Error: {1}.'
.format(email, sys.exc_info()[1]))
2 changes: 1 addition & 1 deletion checkin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_context_data(self, **kwargs):
})
try:
context.update({'checkin': CheckIn.objects.filter(application=app).first()})
except:
except Exception:
pass
return context

Expand Down
2 changes: 1 addition & 1 deletion reimbursement/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def check_friend_emails(friend_emails, user_email):
for email in emails:
try:
user = User.objects.get(email=email)
except:
except User.DoesNotExist:
raise Exception('%s is not a registered hacker' % email)

try:
Expand Down
2 changes: 1 addition & 1 deletion reimbursement/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_context_data(self, **kwargs):
def post(self, request, *args, **kwargs):
try:
form = forms.ReceiptSubmissionReceipt(request.POST, request.FILES, instance=request.user.reimbursement)
except:
except Exception:
form = forms.ReceiptSubmissionReceipt(request.POST, request.FILES)
if form.is_valid():
reimb = form.save(commit=False)
Expand Down
19 changes: 9 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ certifi==2019.9.11
chardet==3.0.4
defusedxml==0.6.0
dj-database-url==0.5.0
Django==1.11.29
Django==1.11.28
django-bootstrap3==8.2.3
django-filter==1.0.2
django-form-utils==1.0.3
django-jet==1.0.8
django-multiselectfield==0.1.12
django-storages==1.7.2
django-storages @ git+https://github.com/jschneier/django-storages.git@b116e3a235323144cda6d3cc5a5cb27baf076ee2
django-tables2==1.14.2
dropbox==8.7.1
et-xmlfile==1.0.1
flake8==3.4.1
flake8==3.9.2
google-api-python-client==1.7.9
google-auth==1.6.3
google-auth-httplib2==0.0.3
gunicorn==19.6.0
httplib2==0.18.0
httplib2==0.9.2
idna==2.7
jdcal==1.4.1
Markdown==2.6.7
Expand All @@ -29,12 +29,11 @@ oauthlib==2.0.2
odfpy==1.4.0
openpyxl==2.6.4
packaging==16.8
psycopg2==2.7.5
psycopg2-binary==2.8.3
pyasn1==0.1.9
pyasn1-modules==0.0.8
pycodestyle==2.3.1
pyflakes==1.5.0
Pillow==2.0.0
psycopg2-binary~=2.8.3
pyasn1==0.4.8
pyasn1-modules==0.2.1
pycodestyle==2.7.0
pyparsing==2.1.10
python-http-client==2.2.1
python-openid==2.2.5
Expand Down
4 changes: 2 additions & 2 deletions stats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def get_stats(model):
elif mentor:
study_work_count['Worker'] += 1
if sponsor or volunteer or mentor:
for day in a.get_attendance_display().split(', '):
attendance_count[day] += 1
for day in a.get_attendance_display().split(', '):
attendance_count[day] += 1

if not sponsor and a.status == APP_CONFIRMED:
shirt_count_confirmed[a.get_tshirt_size_display()] += 1
Expand Down
4 changes: 2 additions & 2 deletions user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def is_volunteer_accepted(self):
if self.type == USR_VOLUNTEER:
try:
return self.volunteerapplication_application.is_attended()
except:
except Exception:
pass
return False

Expand Down Expand Up @@ -228,7 +228,7 @@ def application(self):
return self.volunteerapplication_application
if self.type == USR_MENTOR:
return self.mentorapplication_application
except:
except Exception:
return None

def has_applications_left(self):
Expand Down
4 changes: 2 additions & 2 deletions user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def login(request):
if c_domain and c_key:
try:
resp.set_cookie(c_key, 'biene', domain=c_domain, max_age=settings.SESSION_COOKIE_AGE)
except:
except Exception:
# We don't care if this is not set, we are being cool here!
pass
return resp
Expand Down Expand Up @@ -84,7 +84,7 @@ def logout(request):
if c_domain and c_key:
try:
resp.delete_cookie(c_key, domain=c_domain)
except:
except Exception:
# We don't care if this is not deleted, we are being cool here!
pass
return resp
Expand Down

0 comments on commit a2bfc5f

Please sign in to comment.