summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2010-10-23 13:53:35 +0200
committerGilles Dartiguelongue <eva@gentoo.org>2010-10-23 13:53:35 +0200
commit8a43e7460fcb23dc1bfc8f903824639f218ad0c0 (patch)
tree7151b149842734ef8bde22c88f11c9637d0211bc /modules/simple_cache_module.py
parentFix sys.path alteration to allow invocation from any directory (diff)
downloadgentoo-bumpchecker-8a43e7460fcb23dc1bfc8f903824639f218ad0c0.tar.gz
gentoo-bumpchecker-8a43e7460fcb23dc1bfc8f903824639f218ad0c0.tar.bz2
gentoo-bumpchecker-8a43e7460fcb23dc1bfc8f903824639f218ad0c0.zip
Fix various style issues
* Remove trailing whitespaces * Add some whitespace per PEP8 * Replace tabs by spaces in x-modular per PEP * Make Status class in package_module a new style object since it uses property methods
Diffstat (limited to 'modules/simple_cache_module.py')
-rw-r--r--modules/simple_cache_module.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/modules/simple_cache_module.py b/modules/simple_cache_module.py
index aca3453..3f622fe 100644
--- a/modules/simple_cache_module.py
+++ b/modules/simple_cache_module.py
@@ -8,14 +8,14 @@
# of this program.
class SimpleCache:
-
+
def __init__(self):
self.filename = "cache.txt"
self.write_queue = []
-
+
def write_to_queue(self, release_version, latest_version):
self.write_queue.append(release_version + "," + latest_version)
-
+
def append(self, list_of_lines):
try:
# open file stream
@@ -23,33 +23,33 @@ class SimpleCache:
except IOError:
print "There was an error writing to"+self.filename
sys.exit()
-
+
for line in list_of_lines:
file.write(line+"\n")
-
+
file.close()
-
+
def flush_queue(self):
self.append(self.write_queue)
-
-
+
+
class FileStuff:
def __init__(self, filename):
self.filename = filename
self.lines = []
-
+
def read(self):
file = self.open("r")
# read the file in line by line, and then return it
for line in file.readlines():
# replace the newline characters
- line = string.replace(line,'\n','')
+ line = string.replace(line, '\n', '')
# add it to the collection
self.lines.append(line)
file.close()
-
+
return self.lines
-
+
def write(self, list_of_lines):
try:
# open file stream
@@ -57,12 +57,12 @@ class FileStuff:
except IOError:
print "There was an error writing to"+self.filename
sys.exit()
-
+
for line in list_of_lines:
file.write(line+"\n")
-
+
file.close()
-
+
def append(self, list_of_lines):
try:
# open file stream
@@ -70,12 +70,12 @@ class FileStuff:
except IOError:
print "There was an error writing to"+self.filename
sys.exit()
-
+
for line in list_of_lines:
file.write(line+"\n")
-
+
file.close()
-
+
def open(self, type):
try:
file = open(self.filename, type)