coding standards

This commit is contained in:
Yann Leboulanger 2008-03-13 09:07:58 +00:00
parent cc1c4457c3
commit 323c50ec44
1 changed files with 62 additions and 59 deletions

View File

@ -463,7 +463,8 @@ class Logger:
# gimme unixtime from year month day:
d = datetime.date(year, month, day)
local_time = d.timetuple() # time tupple (compat with time.localtime())
start_of_day = int(time.mktime(local_time)) # we have time since epoch baby :)
# we have time since epoch baby :)
start_of_day = int(time.mktime(local_time))
return start_of_day
def get_conversation_for_date(self, jid, year, month, day, account):
@ -615,8 +616,8 @@ class Logger:
if result == type_id:
return
self.cur.execute(
'UPDATE transports_cache SET type = %d WHERE transport = "%s"' % (type_id,
jid))
'UPDATE transports_cache SET type = %d WHERE transport = "%s"' % (
type_id, jid))
try:
self.con.commit()
except sqlite.OperationalError, e:
@ -638,7 +639,8 @@ class Logger:
return {}
answer = {}
for result in results:
answer[result[0]] = self.convert_api_values_to_human_transport_type(result[1])
answer[result[0]] = self.convert_api_values_to_human_transport_type(
result[1])
return answer
# A longer note here:
@ -670,7 +672,7 @@ class Logger:
# (format: (category, type, name, category, type, name, ...
# ..., 'FEAT', feature1, feature2, ...).join(' '))
# NOTE: if there's a need to do more gzip, put that to a function
data=GzipFile(fileobj=StringIO(str(data))).read().split('\0') # (2) -- note above
data=GzipFile(fileobj=StringIO(str(data))).read().split('\0')
i=0
identities=set()
features=set()
@ -701,7 +703,8 @@ class Logger:
data.append('FEAT')
data.extend(features)
data = '\0'.join(data)
string = StringIO() # if there's a need to do more gzip, put that to a function
# if there's a need to do more gzip, put that to a function
string = StringIO()
gzip=GzipFile(fileobj=string, mode='w')
gzip.write(data)
gzip.close()