-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
@@ -27,7 +31,7 @@ def profile(request): | |
| if u_form.is_valid() and p_form.is_valid(): | ||
| u_form.save() | ||
| p_form.save() | ||
| messages.success(request, f'Your account has been updated!') | ||
| messages.success(request, 'Your account has been updated!') | ||
|
Comment on lines
-30
to
+34
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('profile') | ||
|
|
||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,9 +47,7 @@ def form_valid(self, form): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | ||
|
|
@@ -58,9 +56,7 @@ class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Comment on lines
-61
to
+59
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def about(request): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
@@ -27,7 +31,7 @@ def profile(request): | |
| if u_form.is_valid() and p_form.is_valid(): | ||
| u_form.save() | ||
| p_form.save() | ||
| messages.success(request, f'Your account has been updated!') | ||
| messages.success(request, 'Your account has been updated!') | ||
|
Comment on lines
-30
to
+34
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('profile') | ||
|
|
||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,9 +60,7 @@ def form_valid(self, form): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | ||
|
|
@@ -71,9 +69,7 @@ class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Comment on lines
-74
to
+72
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def about(request): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
@@ -27,7 +31,7 @@ def profile(request): | |
| if u_form.is_valid() and p_form.is_valid(): | ||
| u_form.save() | ||
| p_form.save() | ||
| messages.success(request, f'Your account has been updated!') | ||
| messages.success(request, 'Your account has been updated!') | ||
|
Comment on lines
-30
to
+34
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('profile') | ||
|
|
||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,9 +60,7 @@ def form_valid(self, form): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | ||
|
|
@@ -71,9 +69,7 @@ class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Comment on lines
-74
to
+72
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def about(request): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
@@ -27,7 +31,7 @@ def profile(request): | |
| if u_form.is_valid() and p_form.is_valid(): | ||
| u_form.save() | ||
| p_form.save() | ||
| messages.success(request, f'Your account has been updated!') | ||
| messages.success(request, 'Your account has been updated!') | ||
|
Comment on lines
-30
to
+34
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('profile') | ||
|
|
||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,9 +60,7 @@ def form_valid(self, form): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | ||
|
|
@@ -71,9 +69,7 @@ class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Comment on lines
-74
to
+72
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def about(request): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
@@ -27,7 +31,7 @@ def profile(request): | |
| if u_form.is_valid() and p_form.is_valid(): | ||
| u_form.save() | ||
| p_form.save() | ||
| messages.success(request, f'Your account has been updated!') | ||
| messages.success(request, 'Your account has been updated!') | ||
|
Comment on lines
-30
to
+34
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('profile') | ||
|
|
||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,9 +60,7 @@ def form_valid(self, form): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | ||
|
|
@@ -71,9 +69,7 @@ class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Comment on lines
-74
to
+72
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def about(request): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
@@ -27,7 +31,7 @@ def profile(request): | |
| if u_form.is_valid() and p_form.is_valid(): | ||
| u_form.save() | ||
| p_form.save() | ||
| messages.success(request, f'Your account has been updated!') | ||
| messages.success(request, 'Your account has been updated!') | ||
|
Comment on lines
-30
to
+34
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('profile') | ||
|
|
||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,9 +60,7 @@ def form_valid(self, form): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | ||
|
|
@@ -71,9 +69,7 @@ class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): | |
|
|
||
| def test_func(self): | ||
| post = self.get_object() | ||
| if self.request.user == post.author: | ||
| return True | ||
| return False | ||
| return self.request.user == post.author | ||
|
Comment on lines
-74
to
+72
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| def about(request): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ def register(request): | |
| if form.is_valid(): | ||
| form.save() | ||
| username = form.cleaned_data.get('username') | ||
| messages.success(request, f'Your account has been created! You are now able to log in') | ||
| messages.success( | ||
| request, | ||
| 'Your account has been created! You are now able to log in', | ||
| ) | ||
|
|
||
|
Comment on lines
-13
to
+17
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('login') | ||
| else: | ||
| form = UserRegisterForm() | ||
|
|
@@ -27,7 +31,7 @@ def profile(request): | |
| if u_form.is_valid() and p_form.is_valid(): | ||
| u_form.save() | ||
| p_form.save() | ||
| messages.success(request, f'Your account has been updated!') | ||
| messages.success(request, 'Your account has been updated!') | ||
|
Comment on lines
-30
to
+34
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return redirect('profile') | ||
|
|
||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,16 +14,16 @@ def prime(n,x): | |
| i = 1 | ||
| j = 1 | ||
| while j <= n: | ||
| if x[i] == 1: | ||
| j = j + 1 | ||
| i = i + 1 | ||
| if x[i] == 1: | ||
| j += 1 | ||
| i += 1 | ||
|
Comment on lines
-17
to
+19
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return i - 1 | ||
| x=sieve(10000) | ||
| code = [1206,301,384,5] | ||
| key =[1,1,2,2,] | ||
|
|
||
| sys.stdout.write("".join(chr(i) for i in [73,83,66,78,32,61,32])) | ||
| for i in range (0,4): | ||
| for i in range(4): | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines
|
||
| sys.stdout.write(str(prime(code[i],x)-key[i])) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines
9-37refactored with the following changes:withwhen opening file to ensure closure (ensure-file-closed)