[Patchew-devel] [PATCH 2/2] "autoflake" out unused imports

Fam Zheng famz at redhat.com
Fri Mar 16 07:11:20 UTC 2018


Signed-off-by: Fam Zheng <famz at redhat.com>
---
 api/admin.py                                        | 1 -
 api/migrations/0019_populate_last_comment_date.py   | 2 +-
 api/migrations/0021_fix_recipients_utf8.py          | 2 +-
 api/migrations/0025_populate_project_maintainers.py | 2 +-
 api/models.py                                       | 4 +---
 api/views.py                                        | 1 -
 mod.py                                              | 2 --
 mods/diff.py                                        | 7 +------
 mods/email.py                                       | 1 -
 mods/git.py                                         | 4 +---
 mods/testing.py                                     | 4 ----
 patchew/urls.py                                     | 1 -
 tests/test_custom_tags.py                           | 1 -
 tests/test_diff.py                                  | 1 -
 tests/test_git.py                                   | 3 ---
 tests/test_message.py                               | 2 --
 tests/test_model.py                                 | 3 ---
 tests/test_project.py                               | 2 --
 tests/test_rest.py                                  | 6 +-----
 tests/test_tags.py                                  | 1 -
 tests/test_testing.py                               | 3 +--
 www/views.py                                        | 1 -
 22 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/api/admin.py b/api/admin.py
index c7ca190..6c8aa17 100644
--- a/api/admin.py
+++ b/api/admin.py
@@ -11,7 +11,6 @@
 from django.contrib import admin
 from .models import *
 from mod import get_module
-from django.contrib.auth.models import User, Group
 
 class ProjectPropertyInline(admin.TabularInline):
     model = ProjectProperty
diff --git a/api/migrations/0019_populate_last_comment_date.py b/api/migrations/0019_populate_last_comment_date.py
index f9d755f..093fa77 100644
--- a/api/migrations/0019_populate_last_comment_date.py
+++ b/api/migrations/0019_populate_last_comment_date.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
-from django.db import migrations, models
+from django.db import migrations
 import json
 
 
diff --git a/api/migrations/0021_fix_recipients_utf8.py b/api/migrations/0021_fix_recipients_utf8.py
index ef02209..47bb86f 100644
--- a/api/migrations/0021_fix_recipients_utf8.py
+++ b/api/migrations/0021_fix_recipients_utf8.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
-from django.db import migrations, models
+from django.db import migrations
 import json
 import email.header
 
diff --git a/api/migrations/0025_populate_project_maintainers.py b/api/migrations/0025_populate_project_maintainers.py
index e029e70..3f9f3aa 100644
--- a/api/migrations/0025_populate_project_maintainers.py
+++ b/api/migrations/0025_populate_project_maintainers.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
-from django.db import migrations, models
+from django.db import migrations
 from django.db.models import Count
 import json
 
diff --git a/api/models.py b/api/models.py
index 277c112..15da8fb 100644
--- a/api/models.py
+++ b/api/models.py
@@ -17,12 +17,10 @@ import uuid
 import logging
 from django.conf import settings
 from django.db import models
-from django.db.models import Q
-from django.contrib.auth.models import User, Group
+from django.contrib.auth.models import User
 from django.urls import reverse
 from mbox import MboxMessage
 from event import emit_event, declare_event
-from django.contrib import admin
 import lzma
 
 def save_blob(data, name=None):
diff --git a/api/views.py b/api/views.py
index 27c8775..2d84be8 100644
--- a/api/views.py
+++ b/api/views.py
@@ -8,7 +8,6 @@
 # This work is licensed under the MIT License.  Please see the LICENSE file or
 # http://opensource.org/licenses/MIT.
 
-from django.shortcuts import render
 from django.views.generic import View
 from django.contrib.auth import authenticate, login, logout
 from django.http import HttpResponse, Http404
diff --git a/mod.py b/mod.py
index 3a86cc5..90880ea 100644
--- a/mod.py
+++ b/mod.py
@@ -15,8 +15,6 @@ from django.conf import settings
 from django.template import Template, Context
 import traceback
 import configparser
-import io
-import json
 from schema import *
 
 class PatchewModule(object):
diff --git a/mods/diff.py b/mods/diff.py
index 38404e0..197e31e 100644
--- a/mods/diff.py
+++ b/mods/diff.py
@@ -8,22 +8,17 @@
 # This work is licensed under the MIT License.  Please see the LICENSE file or
 # http://opensource.org/licenses/MIT.
 
-import os
-import shutil
-import hashlib
 from collections import namedtuple
 from django.conf.urls import url
-from django.http import Http404
 from django.urls import reverse
 from django.utils.html import format_html
 from django.utils.safestring import mark_safe
 from django.db.models import Exists, OuterRef
 from mod import PatchewModule
-from api.models import Project, Message
+from api.models import Message
 from api.rest import PluginMethodField
 import rest_framework
 from www.views import render_page
-from schema import *
 import re
 
 _instance = None
diff --git a/mods/email.py b/mods/email.py
index 0517864..72e8f2b 100644
--- a/mods/email.py
+++ b/mods/email.py
@@ -19,7 +19,6 @@ import smtplib
 import email
 import email.utils
 import uuid
-import traceback
 from api.models import Message, Project
 from event import register_handler, get_events_info
 from schema import *
diff --git a/mods/git.py b/mods/git.py
index 4fd7dbe..e646654 100644
--- a/mods/git.py
+++ b/mods/git.py
@@ -10,8 +10,6 @@
 
 import os
 import subprocess
-import tempfile
-import shutil
 import hashlib
 from django.conf.urls import url
 from django.http import Http404, HttpResponseRedirect
@@ -20,7 +18,7 @@ from django.core.exceptions import PermissionDenied
 from django.utils.html import format_html
 from mod import PatchewModule
 from event import declare_event, register_handler, emit_event
-from api.models import Project, Message, MessageProperty
+from api.models import Message, MessageProperty
 from api.views import APILoginRequiredView, prepare_series
 from patchew.logviewer import LogView
 from schema import *
diff --git a/mods/testing.py b/mods/testing.py
index 24bd509..d6492aa 100644
--- a/mods/testing.py
+++ b/mods/testing.py
@@ -13,12 +13,8 @@ from django.http import HttpResponseForbidden, Http404, HttpResponseRedirect
 from django.core.exceptions import PermissionDenied
 from django.urls import reverse
 from django.utils.html import format_html
-from django.template import Template, Context
 from mod import PatchewModule
 import time
-import smtplib
-import email
-import traceback
 import math
 from api.views import APILoginRequiredView
 from api.models import Message, Project, MessageProperty
diff --git a/patchew/urls.py b/patchew/urls.py
index 2fd2d1d..08ace07 100644
--- a/patchew/urls.py
+++ b/patchew/urls.py
@@ -23,7 +23,6 @@ Including another URLconf
     1. Import the include() function: from django.conf.urls import url, include
     2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
 """
-import os
 from django.conf.urls import include, url
 from api.admin import admin_site
 from django.conf.urls.static import static
diff --git a/tests/test_custom_tags.py b/tests/test_custom_tags.py
index aa828be..9ed2117 100755
--- a/tests/test_custom_tags.py
+++ b/tests/test_custom_tags.py
@@ -10,7 +10,6 @@
 
 from django.template import Context, Template
 from patchew.tags import tail_lines, grep_A, grep_B, grep_C, grep
-import patchewtest
 import unittest
 
 class CustomTagsTest(unittest.TestCase):
diff --git a/tests/test_diff.py b/tests/test_diff.py
index 41fb0b4..735c4e7 100755
--- a/tests/test_diff.py
+++ b/tests/test_diff.py
@@ -12,7 +12,6 @@ import sys
 import os
 sys.path.append(os.path.dirname(__file__))
 from patchewtest import PatchewTestCase, main
-import json
 
 class DiffTest(PatchewTestCase):
 
diff --git a/tests/test_git.py b/tests/test_git.py
index 4744ef4..c2c98ae 100755
--- a/tests/test_git.py
+++ b/tests/test_git.py
@@ -10,11 +10,8 @@
 
 import sys
 import os
-import re
 sys.path.append(os.path.dirname(__file__))
 from patchewtest import PatchewTestCase, main
-import json
-import tempfile
 import shutil
 import subprocess
 from api.models import Message
diff --git a/tests/test_message.py b/tests/test_message.py
index 68a1282..8f2f75e 100755
--- a/tests/test_message.py
+++ b/tests/test_message.py
@@ -8,8 +8,6 @@
 # This work is licensed under the MIT License.  Please see the LICENSE file or
 # http://opensource.org/licenses/MIT.
 
-import sys
-import os
 import time
 import datetime
 from patchewtest import PatchewTestCase, main
diff --git a/tests/test_model.py b/tests/test_model.py
index 250a922..7e8853b 100755
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -8,11 +8,8 @@
 # This work is licensed under the MIT License.  Please see the LICENSE file or
 # http://opensource.org/licenses/MIT.
 
-import sys
-import os
 from patchewtest import PatchewTestCase, main
 from api.models import Message
-import json
 
 class ImportTest(PatchewTestCase):
 
diff --git a/tests/test_project.py b/tests/test_project.py
index 25b9661..eb06050 100755
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -8,8 +8,6 @@
 # This work is licensed under the MIT License.  Please see the LICENSE file or
 # http://opensource.org/licenses/MIT.
 
-import sys
-import os
 from patchewtest import PatchewTestCase, main
 
 class ProjectTest(PatchewTestCase):
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 1a7285b..28ca10b 100755
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -10,12 +10,8 @@
 
 import sys
 import os
-import json
-import tempfile
-import shutil
-import subprocess
 
-from django.contrib.auth.models import User, Group
+from django.contrib.auth.models import User
 
 sys.path.append(os.path.dirname(__file__))
 from patchewtest import PatchewTestCase, main
diff --git a/tests/test_tags.py b/tests/test_tags.py
index d663b41..8469c42 100755
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -12,7 +12,6 @@ import sys
 import os
 sys.path.append(os.path.dirname(__file__))
 from patchewtest import PatchewTestCase, main
-import json
 
 class ImportTest(PatchewTestCase):
 
diff --git a/tests/test_testing.py b/tests/test_testing.py
index 0d7e316..0897bbc 100755
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -10,11 +10,10 @@
 
 import sys
 import os
-import datetime
 import subprocess
 sys.path.append(os.path.dirname(__file__))
 from patchewtest import PatchewTestCase, main
-from api.models import Message, Project
+from api.models import Message
 
 def create_test(project, name):
     prefix = "testing.tests." + name + "."
diff --git a/www/views.py b/www/views.py
index e12fa48..8965ebf 100644
--- a/www/views.py
+++ b/www/views.py
@@ -10,7 +10,6 @@
 
 import urllib.request, urllib.parse, urllib.error
 from django.shortcuts import render
-from django.template import Context
 from django.http import HttpResponse, Http404
 from django.db.models import Exists, OuterRef
 from django.urls import reverse
-- 
2.14.3




More information about the Patchew-devel mailing list