Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed a bunch of errors detected by pychecker -- unneeded imports and…

… shadows of builtin variable names

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2058 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c12c225a66df0c48bc00cc4b418c383d5516e668 1 parent ce40c4a
Adrian Holovaty authored January 19, 2006
8  django/bin/compile-messages.py
@@ -16,10 +16,10 @@ def compile_messages():
16 16
         sys.exit(1)
17 17
 
18 18
     for (dirpath, dirnames, filenames) in os.walk(basedir):
19  
-        for file in filenames:
20  
-            if file.endswith('.po'):
21  
-                sys.stderr.write('processing file %s in %s\n' % (file, dirpath))
22  
-                pf = os.path.splitext(os.path.join(dirpath, file))[0]
  19
+        for f in filenames:
  20
+            if f.endswith('.po'):
  21
+                sys.stderr.write('processing file %s in %s\n' % (f, dirpath))
  22
+                pf = os.path.splitext(os.path.join(dirpath, f))[0]
23 23
                 cmd = 'msgfmt -o "%s.mo" "%s.po"' % (pf, pf)
24 24
                 os.system(cmd)
25 25
 
9  django/bin/unique-messages.py
@@ -2,7 +2,6 @@
2 2
 
3 3
 import os
4 4
 import sys
5  
-import getopt
6 5
 
7 6
 def unique_messages():
8 7
     basedir = None
@@ -16,10 +15,10 @@ def unique_messages():
16 15
         sys.exit(1)
17 16
 
18 17
     for (dirpath, dirnames, filenames) in os.walk(basedir):
19  
-        for file in filenames:
20  
-            if file.endswith('.po'):
21  
-                sys.stderr.write('processing file %s in %s\n' % (file, dirpath))
22  
-                pf = os.path.splitext(os.path.join(dirpath, file))[0]
  18
+        for f in filenames:
  19
+            if f.endswith('.po'):
  20
+                sys.stderr.write('processing file %s in %s\n' % (f, dirpath))
  21
+                pf = os.path.splitext(os.path.join(dirpath, f))[0]
23 22
                 cmd = 'msguniq "%s.po"' % pf
24 23
                 stdout = os.popen(cmd)
25 24
                 msg = stdout.read()
7  django/utils/html.py
@@ -12,13 +12,14 @@
12 12
 unencoded_ampersands_re = re.compile(r'&(?!(\w+|#\d+);)')
13 13
 word_split_re = re.compile(r'(\s+)')
14 14
 punctuation_re = re.compile('^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$' % \
15  
-    ('|'.join([re.escape(p) for p in LEADING_PUNCTUATION]),
16  
-    '|'.join([re.escape(p) for p in TRAILING_PUNCTUATION])))
  15
+    ('|'.join([re.escape(x) for x in LEADING_PUNCTUATION]),
  16
+    '|'.join([re.escape(x) for x in TRAILING_PUNCTUATION])))
17 17
 simple_email_re = re.compile(r'^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$')
18 18
 link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+')
19 19
 html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE)
20  
-hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join([re.escape(d) for d in DOTS]), re.DOTALL)
  20
+hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join([re.escape(x) for x in DOTS]), re.DOTALL)
21 21
 trailing_empty_content_re = re.compile(r'(?:<p>(?:&nbsp;|\s|<br \/>)*?</p>\s*)+\Z')
  22
+del x # Temporary variable
22 23
 
23 24
 def escape(html):
24 25
     "Returns the given HTML with ampersands, quotes and carets encoded"
2  django/views/debug.py
@@ -2,7 +2,7 @@
2 2
 from django.core.template import Template, Context, TemplateDoesNotExist
3 3
 from django.utils.html import escape
4 4
 from django.utils.httpwrappers import HttpResponseServerError, HttpResponseNotFound
5  
-import inspect, os, re, sys
  5
+import os, re
6 6
 from itertools import count, izip
7 7
 from os.path import dirname, join as pathjoin
8 8
 
11  django/views/i18n.py
... ...
@@ -1,12 +1,9 @@
1  
-import re
2  
-import os
3  
-
4  
-import gettext as gettext_module
5  
-
6 1
 from django.utils import httpwrappers
7 2
 from django.utils.translation import check_for_language, activate, to_locale, get_language
8 3
 from django.utils.text import javascript_quote
9 4
 from django.conf import settings
  5
+import os
  6
+import gettext as gettext_module
10 7
 
11 8
 def set_language(request):
12 9
     """
@@ -145,7 +142,7 @@ def javascript_catalog(request, domain='djangojs', packages=None):
145 142
         for path in paths:
146 143
             try:
147 144
                 catalog = gettext_module.translation(domain, path, [default_locale])
148  
-            except IOError, e:
  145
+            except IOError:
149 146
                 catalog = None
150 147
             if catalog is not None:
151 148
                 t.update(catalog._catalog)
@@ -154,7 +151,7 @@ def javascript_catalog(request, domain='djangojs', packages=None):
154 151
         for path in paths:
155 152
             try:
156 153
                 catalog = gettext_module.translation(domain, path, [locale])
157  
-            except IOError, e:
  154
+            except IOError:
158 155
                 catalog = None
159 156
             if catalog is not None:
160 157
                 t.update(catalog._catalog)

0 notes on commit c12c225

Please sign in to comment.
Something went wrong with that request. Please try again.