Skip to content
Snippets Groups Projects
Commit 0bcbfc2a authored by Aurélien Dunand's avatar Aurélien Dunand Committed by Seblu
Browse files

Fix typos and docstring bad format

parent 3ea443e0
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,8 @@ from installsystems.tarball import Tarball
from installsystems.printer import *
class Database(object):
''' Abstract repo database stuff
'''
Abstract repo database stuff
It needs to be local cause of sqlite3 which need to open a file
'''
......
......@@ -615,7 +615,7 @@ class Payload(object):
@property
def info(self):
'''
return a dict of info about current payload
Return a dict of info about current payload
'''
return {"md5": self.md5,
"size": self.size,
......
......@@ -32,7 +32,9 @@ color = {
_arrow_level = 1
def out(message="", fd=sys.stdout, endl=os.linesep, flush=True):
'''Print message colorised in fd ended by endl'''
'''
Print message colorised in fd ended by endl
'''
# color subsitution
for c in color:
message = message.replace("#%s#" % c, color[c])
......@@ -42,7 +44,9 @@ def out(message="", fd=sys.stdout, endl=os.linesep, flush=True):
fd.flush()
def err(message, fd=sys.stderr, endl=os.linesep):
'''Print a message on stderr'''
'''
Print a message on stderr
'''
out(message, fd, endl)
def fatal(message, quit=True, fd=sys.stderr, endl=os.linesep):
......
......@@ -227,7 +227,7 @@ class Repository(object):
def get(self, name, version):
'''
return a image from a name and version
Return an image from a name and version
'''
# get file md5 from db
r = self.db.ask("select md5 from image where name = ? and version = ? limit 1",
......@@ -242,8 +242,8 @@ class Repository(object):
def getmd5(self, name, version):
'''
return a image md5 and payload md5 from name and version. Order matter !
image md5 will still be the first
Return an image md5 and payload md5 from name and version. Order matter !
Image md5 will still be the first
'''
# get file md5 from db
a = self.db.ask("SELECT md5 FROM image WHERE name = ? AND version = ? LIMIT 1",
......@@ -305,7 +305,7 @@ class RepositoryConfig(object):
@property
def lastpath(self):
'''
return the last file complete path
Return the last file complete path
'''
if self._lastpath is None:
return os.path.join(self.path, self.lastname)
......@@ -321,7 +321,7 @@ class RepositoryConfig(object):
@property
def dbpath(self):
'''
return the db complete path
Return the db complete path
'''
if self._dbpath is None:
return os.path.join(self.path, self.dbname)
......@@ -452,7 +452,7 @@ class RepositoryManager(object):
# delete temporary files (used by db)
for f in self.tempfiles:
try:
debug("Removing temporaty db file %s" % f)
debug("Removing temporary db file %s" % f)
os.unlink(f)
except OSError:
pass
......@@ -466,7 +466,7 @@ class RepositoryManager(object):
def __getitem__(self, key):
'''
Return a repostiory by its possition in list
Return a repostiory by its position in list
'''
return self.repos[key]
......
......@@ -14,7 +14,9 @@ import re
class Tarball(tarfile.TarFile):
def add_str(self, name, content, ftype, mode):
'''Add a string in memory as a file in tarball'''
'''
Add a string in memory as a file in tarball
'''
ti = tarfile.TarInfo(name)
ti.type = ftype
ti.mode = mode
......@@ -25,7 +27,9 @@ class Tarball(tarfile.TarFile):
self.addfile(ti, StringIO.StringIO(content))
def get_str(self, name):
'''Return a string from a filename in a tarball'''
'''
Return a string from a filename in a tarball
'''
ti = self.getmember(name)
return self.extractfile(ti).read()
......@@ -38,7 +42,9 @@ class Tarball(tarfile.TarFile):
if re.match(reg_pattern, tpname) ]
def size(self):
'''Return real (uncompressed) size of the tarball'''
'''
Return real (uncompressed) size of the tarball
'''
total_sz = 0
for ti in self.getmembers():
total_sz += ti.size
......
......@@ -30,7 +30,7 @@ def md5sum(path=None, fileobj=None):
def copyfileobj(sfile, dfile):
'''
Copy data from sfile to dfile coputing length and md5 on the fly
Copy data from sfile to dfile computing length and md5 on the fly
'''
f_sum = hashlib.md5()
f_len = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment