From 68619a5597e291d6b5eb4c3840cf117606bcb656 Mon Sep 17 00:00:00 2001 From: Jean-Marie Traissard Date: Sun, 4 Feb 2007 18:57:25 +0000 Subject: [PATCH] No space in indentation, /src/common/ part --- src/common/commands.py | 6 +- src/common/connection_handlers.py | 4 +- src/common/fuzzyclock.py | 154 +++++++++++++++--------------- src/common/helpers.py | 6 +- src/common/optparser.py | 4 +- src/common/rst_xhtml_generator.py | 6 +- src/common/xmpp_stringprep.py | 42 ++++---- 7 files changed, 111 insertions(+), 111 deletions(-) diff --git a/src/common/commands.py b/src/common/commands.py index 457266e45..09f93fea0 100644 --- a/src/common/commands.py +++ b/src/common/commands.py @@ -117,7 +117,7 @@ class ChangeStatusCommand(AdHocCommand): 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 @@ class ConnectionCommands: 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}) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 1c6a1f2e7..713f45b77 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -859,14 +859,14 @@ class ConnectionVcard: 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): diff --git a/src/common/fuzzyclock.py b/src/common/fuzzyclock.py index 6e38d1e48..50d155af4 100755 --- a/src/common/fuzzyclock.py +++ b/src/common/fuzzyclock.py @@ -34,103 +34,103 @@ So most of the credit goes to this guys, thanks :-) 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 diff --git a/src/common/helpers.py b/src/common/helpers.py index 0ce6660c6..eb054ec00 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -620,7 +620,7 @@ r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders') 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 @@ def get_os_info(): (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 @@ def sanitize_filename(filename): 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] diff --git a/src/common/optparser.py b/src/common/optparser.py index 19f7b1cae..4ae169df1 100644 --- a/src/common/optparser.py +++ b/src/common/optparser.py @@ -361,14 +361,14 @@ class OptionsParser: 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): diff --git a/src/common/rst_xhtml_generator.py b/src/common/rst_xhtml_generator.py index c69771506..16b38fe71 100644 --- a/src/common/rst_xhtml_generator.py +++ b/src/common/rst_xhtml_generator.py @@ -28,7 +28,7 @@ else: 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 @@ if __name__ == '__main__': print Generator.create_xhtml(''' test:: - >>> print 1 - 1 +>>> print 1 +1 *I* like it. It is for :JEP:`71` diff --git a/src/common/xmpp_stringprep.py b/src/common/xmpp_stringprep.py index f8bad61b4..f0cb473c9 100644 --- a/src/common/xmpp_stringprep.py +++ b/src/common/xmpp_stringprep.py @@ -32,10 +32,10 @@ if sys.version_info < (2,3,2): 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 EmptyMappingTable: 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 @@ class NamePrep: # 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 @@ class NamePrep: 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 @@ class NamePrep: 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 @@ else: 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()