[damned-lies] Minor fixes to make pyflakes happier



commit 2428bab793c6a6e699449a1fd3de726776f7f412
Author: Gil Forcada <gforcada gnome org>
Date:   Sat Nov 5 23:48:54 2011 +0100

    Minor fixes to make pyflakes happier

 common/tests.py  |    1 -
 common/views.py  |    1 -
 stats/admin.py   |    1 +
 stats/models.py  |    5 +++--
 stats/potdiff.py |   10 ++++------
 stats/utils.py   |    4 ----
 teams/tests.py   |    1 -
 teams/views.py   |    1 -
 8 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/common/tests.py b/common/tests.py
index 8e905f3..cc9dc12 100644
--- a/common/tests.py
+++ b/common/tests.py
@@ -24,7 +24,6 @@ from datetime import datetime, timedelta
 from django.core.urlresolvers import reverse
 from django.test import TestCase
 
-from common import views
 from people.models import Person
 from teams.models import Team, Role
 
diff --git a/common/views.py b/common/views.py
index d365ea9..cc863dd 100644
--- a/common/views.py
+++ b/common/views.py
@@ -30,7 +30,6 @@ from django.utils.translation import ugettext as _
 from people.models import Person
 from teams.models import Role
 from people.forms import RegistrationForm
-from languages.models import Language
 from common.utils import get_user_locale
 
 def index(request):
diff --git a/stats/admin.py b/stats/admin.py
index 8049bbe..1c54d65 100644
--- a/stats/admin.py
+++ b/stats/admin.py
@@ -18,6 +18,7 @@
 # along with Damned Lies; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+from django.core.exceptions import PermissionDenied
 from django.contrib import admin
 from django.contrib.admin import helpers
 from django.shortcuts import render
diff --git a/stats/models.py b/stats/models.py
index 7fcc020..8d9d513 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -20,10 +20,11 @@
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from __future__ import with_statement
-import os, sys, re, hashlib
+import os, sys, re
 import threading
 from time import sleep
 from datetime import datetime
+from urllib2 import URLError
 
 from django.conf import settings
 from django.core.exceptions import ValidationError
@@ -788,7 +789,7 @@ class Domain(models.Model):
             req = urllib2.Request(self.pot_method)
             try:
                 handle = urllib2.urlopen(req)
-            except URLError, e:
+            except URLError:
                 return "", (("error", ugettext_noop("Error retrieving pot file from URL.")),)
             potfile = os.path.join(vcs_path, self.potbase() + ".pot")
             with open(potfile, 'w') as f:
diff --git a/stats/potdiff.py b/stats/potdiff.py
index c6842cc..bd14e35 100644
--- a/stats/potdiff.py
+++ b/stats/potdiff.py
@@ -76,11 +76,10 @@ def _parse_contents(contents):
     if len(contents) and contents[-1] != "\n": contents += "\n"
 
     # state machine for parsing PO files
-    msgid = ""; msgstr = ""; msgctxt = ""; comment = ""; plural = "";
-    in_msgid = in_msgstr = in_msgctxt = in_msgid_plural = in_plural = 0
+    msgid = ""; msgctxt = ""; plural = "";
+    in_msgid = in_msgstr = in_msgctxt = in_msgid_plural = 0
 
     result = []
-    enc = "UTF-8"
 
     lines = contents.split("\n")
     lines.append("\n")
@@ -101,10 +100,9 @@ def _parse_contents(contents):
                 # Ignore PO header
                 pass
 
-            msgid = ""; msgstr = ""; msgctxt = ""
+            msgid = ""; msgctxt = ""
             in_msgid = 0; in_msgstr = 0; in_msgctxt = 0
-            flags = []; sources = []; othercomments = {}
-            plural = ""; plurals = []; in_msgid_plural = 0; in_plural = 0
+            plural = ""; in_msgid_plural = 0
 
         elif line[0] == "\"" and line[-1] == "\"":
             if in_msgid:
diff --git a/stats/utils.py b/stats/utils.py
index 0b078a1..3f35f79 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -90,10 +90,6 @@ class DocFormat(object):
             return "^msgid \"@@image:"
 
     @property
-    def img_grep(self):
-        return self.tool == "itstool" and "^msgid \"external ref=" or "^msgid \"@@image:"
-
-    @property
     def bef_line(self):
         # Lines to keep before matched grep to catch the ,fuzzy or #|msgid line
         return self.tool == "itstool" and 2 or 1
diff --git a/teams/tests.py b/teams/tests.py
index a5d1b54..3382bf2 100644
--- a/teams/tests.py
+++ b/teams/tests.py
@@ -6,7 +6,6 @@ from django.test import TestCase
 from django.test.client import Client
 from django.core.urlresolvers import reverse
 from django.core import mail
-from django.contrib.auth import login
 from people.models import Person
 from teams.models import Team, Role
 from languages.models import Language
diff --git a/teams/views.py b/teams/views.py
index 4ae4bd6..ebe0c39 100644
--- a/teams/views.py
+++ b/teams/views.py
@@ -19,7 +19,6 @@
 # along with Damned Lies; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from django.conf import settings
 from django.core.urlresolvers import reverse
 from django.http import HttpResponseRedirect, HttpResponseForbidden
 from django.shortcuts import render, get_object_or_404



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]