summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-08-11 17:08:09 -0400
committerRob Crittenden <rcritten@redhat.com>2009-08-12 13:18:15 -0400
commit8780751330871033b13fc8fbb7eb0588baf4417d (patch)
tree0b21cac0974b193c67c43e22fb7b21983766fbf8 /ipapython
parentc781e8a57d3d05fa07729dbccff07bc1fab9d8e8 (diff)
downloadfreeipa-8780751330871033b13fc8fbb7eb0588baf4417d.tar.gz
freeipa-8780751330871033b13fc8fbb7eb0588baf4417d.tar.xz
freeipa-8780751330871033b13fc8fbb7eb0588baf4417d.zip
Clean up some problems discovered with pylint and pychecker
Much of this is formatting to make pylint happy but it also fixes some real bugs.
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/entity.py4
-rw-r--r--ipapython/ipasslfile.py26
-rw-r--r--ipapython/ipautil.py14
-rw-r--r--ipapython/nsslib.py1
-rw-r--r--ipapython/sysrestore.py5
5 files changed, 24 insertions, 26 deletions
diff --git a/ipapython/entity.py b/ipapython/entity.py
index 580cbd00..1274f8a1 100644
--- a/ipapython/entity.py
+++ b/ipapython/entity.py
@@ -15,10 +15,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-import ldap
-import ldif
-import re
-import cStringIO
import copy
import ipapython.ipautil
diff --git a/ipapython/ipasslfile.py b/ipapython/ipasslfile.py
index 5525ab9b..5f4ea2a7 100644
--- a/ipapython/ipasslfile.py
+++ b/ipapython/ipasslfile.py
@@ -15,6 +15,10 @@
# the reference counting and SharedSocketClient provides an constructor
# and close() method that call incref() and decref() correctly.
+import socket
+import errno
+from httplib import UnimplementedFileMode
+
class SharedSocket:
def __init__(self, sock):
self.sock = sock
@@ -91,13 +95,13 @@ class SSLFile(SharedSocketClient):
break
L.append(s)
avail += len(s)
- all = "".join(L)
+ alldata = "".join(L)
if size is None:
self._buf = ''
- return all
+ return alldata
else:
- self._buf = all[size:]
- return all[:size]
+ self._buf = alldata[size:]
+ return alldata[:size]
def readline(self):
L = [self._buf]
@@ -114,25 +118,25 @@ class SSLFile(SharedSocketClient):
# loop exited because there is no more data
return "".join(L)
else:
- all = "".join(L)
+ alldata = "".join(L)
# XXX could do enough bookkeeping not to do a 2nd search
- i = all.find("\n") + 1
- line = all[:i]
- self._buf = all[i:]
+ i = alldata.find("\n") + 1
+ line = alldata[:i]
+ self._buf = alldata[i:]
return line
def readlines(self, sizehint=0):
total = 0
- list = []
+ inlist = []
while True:
line = self.readline()
if not line:
break
- list.append(line)
+ inlist.append(line)
total += len(line)
if sizehint and total >= sizehint:
break
- return list
+ return inlist
def fileno(self):
return self._sock.fileno()
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index df721a51..2fa26fef 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -57,7 +57,7 @@ def get_domain_name():
try:
config.init_config()
domain_name = config.config.get_domain()
- except Exception, e:
+ except Exception:
return None
return domain_name
@@ -362,13 +362,13 @@ class GeneralizedTimeZone(datetime.tzinfo):
if self.houroffset < 0:
self.minoffset *= -1
- def utcoffset(self, dt):
+ def utcoffset(self):
return datetime.timedelta(hours=self.houroffset, minutes=self.minoffset)
- def dst(self, dt):
+ def dst(self):
return datetime.timedelta(0)
- def tzname(self, dt):
+ def tzname(self):
return self.name
@@ -748,7 +748,7 @@ class AttributeValueCompleter:
return self.default_value.get(self.lhs, None)
elif default_value_type is FunctionType:
return self.default_value(self.lhs)
- elif default_value_type is StringsType:
+ elif default_value_type is StringType:
return self.default_value
else:
return None
@@ -759,7 +759,7 @@ class AttributeValueCompleter:
else:
self.completions = self.lhs_names
- def complete(self, text, state):
+ def complete(self, state):
self.line_buffer= readline.get_line_buffer()
self.parse_input()
if not self.lhs_complete:
@@ -905,7 +905,7 @@ class ItemCompleter:
else:
self.completions = self.items
- def complete(self, text, state):
+ def complete(self, state):
self.line_buffer= readline.get_line_buffer()
if state == 0:
beg = readline.get_begidx()
diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py
index 1b678305..05b45c14 100644
--- a/ipapython/nsslib.py
+++ b/ipapython/nsslib.py
@@ -20,7 +20,6 @@
import httplib
import getpass
import socket
-import errno
from nss.error import NSPRError
import nss.io as io
diff --git a/ipapython/sysrestore.py b/ipapython/sysrestore.py
index 503f38b2..78c9b628 100644
--- a/ipapython/sysrestore.py
+++ b/ipapython/sysrestore.py
@@ -25,7 +25,6 @@
import os
import os.path
-import errno
import shutil
import logging
import ConfigParser
@@ -110,13 +109,13 @@ class FileStore:
logging.debug(" -> Not backing up - '%s' doesn't exist", path)
return
- (reldir, file) = os.path.split(path)
+ (reldir, backupfile) = os.path.split(path)
filename = ""
for i in range(8):
h = "%02x" % self.random.randint(0,255)
filename += h
- filename += "-"+file
+ filename += "-"+backupfile
backup_path = os.path.join(self._path, filename)
if os.path.exists(backup_path):