summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
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 580cbd00b..1274f8a13 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 5525ab9b5..5f4ea2a7b 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 df721a518..2fa26fef8 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 1b678305b..05b45c14a 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 503f38b24..78c9b6283 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):