Fix minor python code style issues

Fix some minor issues that were reported by pyflakes and pylint.

- Rename arguments to prevent redefinition of built-in 'dir'
- Rename method call to prevent redefinition of built-in 'help'
- Remove unused imports
- Prefix unused variable with underscore to prevent warning

Change-Id: Ia9e21c0f1a69af43f6e4566be46c31bdda540d2f
diff --git a/contrib/check-valid-commit.py b/contrib/check-valid-commit.py
index 150b310..d26fa58 100755
--- a/contrib/check-valid-commit.py
+++ b/contrib/check-valid-commit.py
@@ -25,7 +25,7 @@
     patchset = None
 
     try:
-        opts, args = getopt.getopt(sys.argv[1:], '', \
+        opts, _args = getopt.getopt(sys.argv[1:], '', \
             ['change=', 'project=', 'branch=', 'commit=', 'patchset='])
     except getopt.GetoptError as err:
         print('Error: %s' % (err))
diff --git a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/Startup.py b/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/Startup.py
index 92d6e56..cf6fac9 100644
--- a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/Startup.py
+++ b/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/Startup.py
@@ -18,7 +18,7 @@
 
 import sys
 
-def help():
+def print_help():
   for (n, v) in vars(sys.modules['__main__']).items():
     if not n.startswith("__") and not n in ['help', 'reload'] \
        and str(type(v)) != "<type 'javapackage'>"             \
@@ -28,4 +28,4 @@
   print "Welcome to the Gerrit Inspector"
   print "Enter help() to see the above again, EOF to quit and stop Gerrit"
 
-help()
+print_help()
diff --git a/tools/eclipse/project.py b/tools/eclipse/project.py
index 4ff7ab2..dd6f248 100755
--- a/tools/eclipse/project.py
+++ b/tools/eclipse/project.py
@@ -52,8 +52,8 @@
   return deps
 
 
-def gen_project(name='gerrit', dir=ROOT):
-  p = path.join(dir, '.project')
+def gen_project(name='gerrit', root=ROOT):
+  p = path.join(root, '.project')
   with open(p, 'w') as fd:
     print("""\
 <?xml version="1.0" encoding="UTF-8"?>
@@ -70,10 +70,10 @@
 </projectDescription>\
 """, file=fd)
 
-def gen_plugin_classpath(dir):
-  p = path.join(dir, '.classpath')
+def gen_plugin_classpath(root):
+  p = path.join(root, '.classpath')
   with open(p, 'w') as fd:
-    if path.exists(path.join(dir, 'src', 'test', 'java')):
+    if path.exists(path.join(root, 'src', 'test', 'java')):
       testpath = """
   <classpathentry kind="src" path="src/test/java"\
  out="buck-out/eclipse/test"/>"""
diff --git a/tools/pack_war.py b/tools/pack_war.py
index ba39856..7e7d895 100755
--- a/tools/pack_war.py
+++ b/tools/pack_war.py
@@ -15,7 +15,7 @@
 
 from __future__ import print_function
 from optparse import OptionParser
-from os import getcwd, chdir, makedirs, path, symlink
+from os import chdir, makedirs, path, symlink
 from subprocess import check_call, check_output
 import sys