Author: jim++
Date: 2007-02-04 19:57:25 +0100 (Sun, 04 Feb 2007)
New Revision: 7937
Modified:
trunk/src/common/commands.py
trunk/src/common/connection_handlers.py
trunk/src/common/fuzzyclock.py
trunk/src/common/helpers.py
trunk/src/common/optparser.py
trunk/src/common/rst_xhtml_generator.py
trunk/src/common/xmpp_stringprep.py
Log:
No space in indentation, /src/common/ part
Modified: trunk/src/common/commands.py
===================================================================
--- trunk/src/common/commands.py 2007-02-04 14:09:38 UTC (rev 7936)
+++ trunk/src/common/commands.py 2007-02-04 18:57:25 UTC (rev 7937)
@@ -117,7 +117,7 @@
try:
presencetype = form['presence-type'].value
if not presencetype in \
- ('free-for-chat', 'online', 'away', 'xa', 'dnd', 'offline'):
+ ('free-for-chat', 'online', 'away', 'xa', 'dnd', 'offline'):
self.badRequest(request)
return False
except: # KeyError if there's no presence-type field in form or
@@ -282,8 +282,8 @@
iq = iq_obj.buildReply('result')
q = iq.getTag('query')
q.addChild('identity', attrs = {'type': 'command-node',
- 'category': 'automation',
- 'name': cmd.commandname})
+ 'category': 'automation',
+ 'name': cmd.commandname})
q.addChild('feature', attrs = {'var': xmpp.NS_COMMANDS})
for feature in cmd.commandfeatures:
q.addChild('feature', attrs = {'var': feature})
Modified: trunk/src/common/connection_handlers.py
===================================================================
--- trunk/src/common/connection_handlers.py 2007-02-04 14:09:38 UTC (rev 7936)
+++ trunk/src/common/connection_handlers.py 2007-02-04 18:57:25 UTC (rev 7937)
@@ -859,14 +859,14 @@
dict[name] = []
entry = {}
for c in info.getChildren():
- entry[c.getName()] = c.getData()
+ entry[c.getName()] = c.getData()
dict[name].append(entry)
elif info.getChildren() == []:
dict[name] = info.getData()
else:
dict[name] = {}
for c in info.getChildren():
- dict[name][c.getName()] = c.getData()
+ dict[name][c.getName()] = c.getData()
return dict
def save_vcard_to_hd(self, full_jid, card):
Modified: trunk/src/common/fuzzyclock.py
===================================================================
--- trunk/src/common/fuzzyclock.py 2007-02-04 14:09:38 UTC (rev 7936)
+++ trunk/src/common/fuzzyclock.py 2007-02-04 18:57:25 UTC (rev 7937)
@@ -34,103 +34,103 @@
import time
class FuzzyClock:
- def __init__(self):
- self.__hour = 0
- self.__minute = 0
- self.__dayOfWeek = 0
+ def __init__(self):
+ self.__hour = 0
+ self.__minute = 0
+ self.__dayOfWeek = 0
- self.__hourNames = [ _('one'), _('two'), _('three'), _('four'), _('five'), _('six'),
- _('seven'), _('eight'), _('nine'), _('ten'), _('eleven'),
- _('twelve')]
+ self.__hourNames = [ _('one'), _('two'), _('three'), _('four'), _('five'), _('six'),
+ _('seven'), _('eight'), _('nine'), _('ten'), _('eleven'),
+ _('twelve')]
- #Strings to use for the output. %0 will be replaced with the preceding hour (e.g. "x PAST %0"), %1 with the coming hour (e.g. "x TO %1). '''
- self.__normalFuzzy = [ _("$0 o'clock"), _('five past $0'),
- _('ten past $0'), _('quarter past $0'),
- _('twenty past $0'), _('twenty five past $0'),
- _('half past $0'), _('twenty five to $1'),
- _('twenty to $1'), _('quarter to $1'),
- _('ten to $1'), _('five to $1'), _("$1 o'clock") ]
+ #Strings to use for the output. %0 will be replaced with the preceding hour (e.g. "x PAST %0"), %1 with the coming hour (e.g. "x TO %1). '''
+ self.__normalFuzzy = [ _("$0 o'clock"), _('five past $0'),
+ _('ten past $0'), _('quarter past $0'),
+ _('twenty past $0'), _('twenty five past $0'),
+ _('half past $0'), _('twenty five to $1'),
+ _('twenty to $1'), _('quarter to $1'),
+ _('ten to $1'), _('five to $1'), _("$1 o'clock") ]
- #A "singular-form". It is used when talking about hour 0
- self.__normalFuzzyOne = [ _("$0 o'clock"), _('five past $0'),
- _('ten past $0'), _('quarter past $0'),
- _('twenty past $0'), _('twenty five past $0'),
- _('half past $0'), _('twenty five to $1'),
- _('twenty to $1'), _('quarter to $1'),
- _('ten to $1'), _('five to $1'),
- _("$1 o'clock") ]
+ #A "singular-form". It is used when talking about hour 0
+ self.__normalFuzzyOne = [ _("$0 o'clock"), _('five past $0'),
+ _('ten past $0'), _('quarter past $0'),
+ _('twenty past $0'), _('twenty five past $0'),
+ _('half past $0'), _('twenty five to $1'),
+ _('twenty to $1'), _('quarter to $1'),
+ _('ten to $1'), _('five to $1'),
+ _("$1 o'clock") ]
- self.__dayTime = [ _('Night'), _('Early morning'), _('Morning'), _('Almost noon'),
- _('Noon'), _('Afternoon'), _('Evening'), _('Late evening') ]
+ self.__dayTime = [ _('Night'), _('Early morning'), _('Morning'), _('Almost noon'),
+ _('Noon'), _('Afternoon'), _('Evening'), _('Late evening') ]
- self.__fuzzyWeek = [ _('Start of week'), _('Middle of week'), _('End of week'),
- _('Weekend!') ]
+ self.__fuzzyWeek = [ _('Start of week'), _('Middle of week'), _('End of week'),
+ _('Weekend!') ]
- self.setCurrent()
+ self.setCurrent()
- def setHour(self,hour):
- self.__hour = int(hour)
+ def setHour(self,hour):
+ self.__hour = int(hour)
- def setMinute(self,minute):
- self.__minute=int(minute)
+ def setMinute(self,minute):
+ self.__minute=int(minute)
- def setDayOfWeek(self,day):
- self.__dayOfWeek=int(day)
+ def setDayOfWeek(self,day):
+ self.__dayOfWeek=int(day)
- def setTime(self,time):
- timeArray = time.split(":")
- self.setHour(timeArray[0])
- self.setMinute(timeArray[1])
+ def setTime(self,time):
+ timeArray = time.split(":")
+ self.setHour(timeArray[0])
+ self.setMinute(timeArray[1])
- def setCurrent(self):
- hour=time.strftime("%H")
- minute=time.strftime("%M")
- day=time.strftime("%w")
+ def setCurrent(self):
+ hour=time.strftime("%H")
+ minute=time.strftime("%M")
+ day=time.strftime("%w")
- self.setTime(hour+":"+minute)
- self.setDayOfWeek(day)
+ self.setTime(hour+":"+minute)
+ self.setDayOfWeek(day)
- def getFuzzyTime(self, fuzzyness = 1):
- sector = 0
- realHour = 0
+ def getFuzzyTime(self, fuzzyness = 1):
+ sector = 0
+ realHour = 0
- if fuzzyness == 1 or fuzzyness == 2:
- if fuzzyness == 1:
- if self.__minute >2:
- sector = (self.__minute - 3) / 5 +1
- else:
- if self.__minute > 6:
- sector = ((self.__minute - 7) / 15 + 1) * 3
+ if fuzzyness == 1 or fuzzyness == 2:
+ if fuzzyness == 1:
+ if self.__minute >2:
+ sector = (self.__minute - 3) / 5 +1
+ else:
+ if self.__minute > 6:
+ sector = ((self.__minute - 7) / 15 + 1) * 3
- newTimeStr = self.__normalFuzzy[sector]
- #$0 or $1?
- deltaHour = int(newTimeStr[newTimeStr.find("$")+1])
+ newTimeStr = self.__normalFuzzy[sector]
+ #$0 or $1?
+ deltaHour = int(newTimeStr[newTimeStr.find("$")+1])
- if (self.__hour + deltaHour) % 12 > 0:
- realHour = (self.__hour + deltaHour) % 12 - 1
- else:
- realHour = 12 - ((self.__hour + deltaHour) % 12 + 1)
+ if (self.__hour + deltaHour) % 12 > 0:
+ realHour = (self.__hour + deltaHour) % 12 - 1
+ else:
+ realHour = 12 - ((self.__hour + deltaHour) % 12 + 1)
- if realHour == 0:
- newTimeStr = self.__normalFuzzyOne[sector]
+ if realHour == 0:
+ newTimeStr = self.__normalFuzzyOne[sector]
- newTimeStr = newTimeStr.replace("$"+str(deltaHour),
- self.__hourNames[realHour])
+ newTimeStr = newTimeStr.replace("$"+str(deltaHour),
+ self.__hourNames[realHour])
- elif fuzzyness == 3:
- newTimeStr = self.__dayTime[self.__hour / 3]
+ elif fuzzyness == 3:
+ newTimeStr = self.__dayTime[self.__hour / 3]
- else:
- dayOfWeek = self.__dayOfWeek
- if dayOfWeek == 1:
- newTimeStr = self.__fuzzyWeek[0]
- elif dayOfWeek >= 2 and dayOfWeek <= 4:
- newTimeStr = self.__fuzzyWeek[1]
- elif dayOfWeek == 5:
- newTimeStr = self.__fuzzyWeek[2]
- else:
- newTimeStr = self.__fuzzyWeek[3]
+ else:
+ dayOfWeek = self.__dayOfWeek
+ if dayOfWeek == 1:
+ newTimeStr = self.__fuzzyWeek[0]
+ elif dayOfWeek >= 2 and dayOfWeek <= 4:
+ newTimeStr = self.__fuzzyWeek[1]
+ elif dayOfWeek == 5:
+ newTimeStr = self.__fuzzyWeek[2]
+ else:
+ newTimeStr = self.__fuzzyWeek[3]
- return newTimeStr
+ return newTimeStr
Modified: trunk/src/common/helpers.py
===================================================================
--- trunk/src/common/helpers.py 2007-02-04 14:09:38 UTC (rev 7936)
+++ trunk/src/common/helpers.py 2007-02-04 18:57:25 UTC (rev 7937)
@@ -620,7 +620,7 @@
finally:
win32api.RegCloseKey(rkey)
return val
-
+
def get_my_pictures_path():
'''windows-only atm. [Unix lives in the past]'''
return get_windows_reg_env('My Pictures')
@@ -698,7 +698,7 @@
(2, 5, 0): '2000',
(2, 5, 1): 'XP',
(2, 5, 2): '2003',
- (2, 6, 0): 'Vista',
+ (2, 6, 0): 'Vista',
}
if win_version.has_key(ver_format):
return 'Windows' + ' ' + win_version[ver_format]
@@ -760,7 +760,7 @@
filename = filename.replace('?', '_').replace(':', '_')\
.replace('\\', '_').replace('"', "'").replace('|', '_')\
.replace('*', '_').replace('<', '_').replace('>', '_')
- # 48 is the limit
+ # 48 is the limit
if len(filename) > 48:
extension = filename.split('.')[-1]
filename = filename[0:48]
Modified: trunk/src/common/optparser.py
===================================================================
--- trunk/src/common/optparser.py 2007-02-04 14:09:38 UTC (rev 7936)
+++ trunk/src/common/optparser.py 2007-02-04 18:57:25 UTC (rev 7937)
@@ -361,14 +361,14 @@
trayicon_notification_on_events '''
if self.old_values.has_key('trayicon_notification_on_new_messages'):
gajim.config.set('trayicon_notification_on_events',
- self.old_values['trayicon_notification_on_new_messages'])
+ self.old_values['trayicon_notification_on_new_messages'])
gajim.config.set('version', '0.10.1.7')
def update_config_to_01018(self):
'''chat_state_notifications -> outgoing_chat_state_notifications'''
if self.old_values.has_key('chat_state_notifications'):
gajim.config.set('outgoing_chat_state_notifications',
- self.old_values['chat_state_notifications'])
+ self.old_values['chat_state_notifications'])
gajim.config.set('version', '0.10.1.8')
def update_config_to_01101(self):
Modified: trunk/src/common/rst_xhtml_generator.py
===================================================================
--- trunk/src/common/rst_xhtml_generator.py 2007-02-04 14:09:38 UTC (rev 7936)
+++ trunk/src/common/rst_xhtml_generator.py 2007-02-04 18:57:25 UTC (rev 7937)
@@ -28,7 +28,7 @@
options={}, content=[]):
'''Role to make handy references to Jabber Enhancement Proposals (JEP).
- Use as :JEP:`71` (or jep, or jep-reference).
+ Use as :JEP:`71` (or jep, or jep-reference).
Modeled after the sample in docutils documentation.
'''
@@ -111,8 +111,8 @@
print Generator.create_xhtml('''
test::
- >>> print 1
- 1
+>>> print 1
+1
*I* like it. It is for :JEP:`71`
Modified: trunk/src/common/xmpp_stringprep.py
===================================================================
--- trunk/src/common/xmpp_stringprep.py 2007-02-04 14:09:38 UTC (rev 7936)
+++ trunk/src/common/xmpp_stringprep.py 2007-02-04 18:57:25 UTC (rev 7937)
@@ -32,10 +32,10 @@
crippled = True
warnings.warn("Accented and non-Western Jabber IDs will not be properly "
- "case-folded with this version of Python, resulting in "
- "incorrect protocol-level behavior. It is strongly "
- "recommended you upgrade to Python 2.3.2 or newer if you "
- "intend to use Twisted's Jabber support.")
+ "case-folded with this version of Python, resulting in "
+ "incorrect protocol-level behavior. It is strongly "
+ "recommended you upgrade to Python 2.3.2 or newer if you "
+ "intend to use Twisted's Jabber support.")
else:
import stringprep
@@ -97,7 +97,7 @@
class Profile:
def __init__(self, mappings=[], normalize=True, prohibiteds=[],
- check_unassigneds=True, check_bidi=True):
+ check_unassigneds=True, check_bidi=True):
self.mappings = mappings
self.normalize = normalize
self.prohibiteds = prohibiteds
@@ -183,10 +183,10 @@
# Prohibited characters.
prohibiteds = [unichr(n) for n in range(0x00, 0x2c + 1) +
- range(0x2e, 0x2f + 1) +
- range(0x3a, 0x40 + 1) +
- range(0x5b, 0x60 + 1) +
- range(0x7b, 0x7f + 1) ]
+ range(0x2e, 0x2f + 1) +
+ range(0x3a, 0x40 + 1) +
+ range(0x5b, 0x60 + 1) +
+ range(0x7b, 0x7f + 1) ]
def prepare(self, string):
result = []
@@ -206,8 +206,8 @@
def check_prohibiteds(self, string):
for c in string:
- if c in self.prohibiteds:
- raise UnicodeError, "Invalid character %s" % repr(c)
+ if c in self.prohibiteds:
+ raise UnicodeError, "Invalid character %s" % repr(c)
def nameprep(self, label):
label = idna.nameprep(label)
@@ -221,16 +221,16 @@
if crippled:
case_map = MappingTableFromFunction(lambda c: c.lower())
nodeprep = Profile(mappings=[case_map],
- normalize=False,
- prohibiteds=[LookupTable([u' ', u'"', u'&', u"'", u'/',
- u':', u'<', u'>', u'@'])],
- check_unassigneds=False,
- check_bidi=False)
+ normalize=False,
+ prohibiteds=[LookupTable([u' ', u'"', u'&', u"'", u'/',
+ u':', u'<', u'>', u'@'])],
+ check_unassigneds=False,
+ check_bidi=False)
resourceprep = Profile(normalize=False,
- check_unassigneds=False,
- check_bidi=False)
-
+ check_unassigneds=False,
+ check_bidi=False)
+
else:
C_11 = LookupTableFromFunction(stringprep.in_table_c11)
C_12 = LookupTableFromFunction(stringprep.in_table_c12)
@@ -251,10 +251,10 @@
prohibiteds=[C_11, C_12, C_21, C_22,
C_3, C_4, C_5, C_6, C_7, C_8, C_9,
LookupTable([u'"', u'&', u"'", u'/',
- u':', u'<', u'>', u'@'])])
+ u':', u'<', u'>', u'@'])])
resourceprep = Profile(mappings=[B_1,],
- prohibiteds=[C_12, C_21, C_22,
+ prohibiteds=[C_12, C_21, C_22,
C_3, C_4, C_5, C_6, C_7, C_8, C_9])
nameprep = NamePrep()