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