Repository: CiviWiki/OpenCiviWiki

Issue:
Remove unused variables
While scanning the project with Flake8 (#33), we received several errors related to **unused imports**.

# Goal
Resolve all Flake8 errors related to unused imports.

# Task
The following Flake8 errors should be resolved:

- [x] ./api/read.py:156:9: F841 local variable 'user_categories' is assigned to but never used
- [x] ./api/read.py:187:9: F841 local variable 'problems' is assigned to but never used
- [x] ./api/write.py:17:1: F811 redefinition of unused 'require_post_params' from line 5                                                                                                                                                                                             
- [x] ./api/write.py:18:1: F811 redefinition of unused 'JsonResponse' from line 4                                                                                                                                                                                                    
- [x] ./api/write.py:19:1: F811 redefinition of unused 'login_required' from line 6
- [x] ./api/write.py:465:29: F841 local variable 'e' is assigned to but never used
- [x] ./api/models/civi.py:134:9: F841 local variable 'owner_id' is assigned to but never used
Remove unused variables
While scanning the project with Flake8 (#33), we received several errors related to **unused imports**.

# Goal
Resolve all Flake8 errors related to unused imports.

# Task
The following Flake8 errors should be resolved:

- [x] ./api/read.py:156:9: F841 local variable 'user_categories' is assigned to but never used
- [x] ./api/read.py:187:9: F841 local variable 'problems' is assigned to but never used
- [x] ./api/write.py:17:1: F811 redefinition of unused 'require_post_params' from line 5                                                                                                                                                                                             
- [x] ./api/write.py:18:1: F811 redefinition of unused 'JsonResponse' from line 4                                                                                                                                                                                                    
- [x] ./api/write.py:19:1: F811 redefinition of unused 'login_required' from line 6
- [x] ./api/write.py:465:29: F841 local variable 'e' is assigned to but never used
- [x] ./api/models/civi.py:134:9: F841 local variable 'owner_id' is assigned to but never used


Discussion:
After making the initial changes listed in the Issue, I reran flake and found 2 more F811.  Bot are in read.py
##
./api/read.py:154:9: F841 local variable 'a' is assigned to but never used
./api/read.py:155:9: F841 local variable 'all_categories' is assigned to but never used
##

I will fix these in this branch as well
After making the initial changes listed in the Issue, I reran flake and found 2 more F811.  Bot are in read.py
##
./api/read.py:154:9: F841 local variable 'a' is assigned to but never used
./api/read.py:155:9: F841 local variable 'all_categories' is assigned to but never used
##

I will fix these in this branch as well

Resolving patch:
diff --git a/project/api/write.py b/project/api/write.py
--- a/project/api/write.py
+++ b/project/api/write.py
@@ -1,6 +1,7 @@
 import json, PIL, urllib, uuid
 
 from notifications.signals import notify
+
 # django packages
 from django.contrib.auth.models import User
 from django.http import JsonResponse, HttpResponse, HttpResponseServerError, HttpResponseForbidden, HttpResponseBadRequest
@@ -10,6 +11,7 @@
 from django.contrib.auth.decorators import user_passes_test
 from django.contrib.sites.shortcuts import get_current_site
 
+
 # civi packages
 from api.forms import UpdateProfileImage
 from api.models import Thread


Test patch: