Changeset 7937

Show
Ignore:
Timestamp:
02/04/07 19:57:25 (22 months ago)
Author:
jim++
Message:

No space in indentation, /src/common/ part

Location:
trunk/src/common
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/commands.py

    r7872 r7937  
    118118                        presencetype = form['presence-type'].value 
    119119                        if not presencetype in \ 
    120                             ('free-for-chat', 'online', 'away', 'xa', 'dnd', 'offline'): 
     120                        ('free-for-chat', 'online', 'away', 'xa', 'dnd', 'offline'): 
    121121                                self.badRequest(request) 
    122122                                return False 
     
    283283                        q = iq.getTag('query') 
    284284                        q.addChild('identity', attrs = {'type': 'command-node', 
    285                                                         'category': 'automation', 
    286                                                         'name': cmd.commandname}) 
     285                                'category': 'automation', 
     286                                'name': cmd.commandname}) 
    287287                        q.addChild('feature', attrs = {'var': xmpp.NS_COMMANDS}) 
    288288                        for feature in cmd.commandfeatures: 
  • trunk/src/common/connection_handlers.py

    r7934 r7937  
    860860                                entry = {} 
    861861                                for c in info.getChildren(): 
    862                                          entry[c.getName()] = c.getData() 
     862                                        entry[c.getName()] = c.getData() 
    863863                                dict[name].append(entry) 
    864864                        elif info.getChildren() == []: 
     
    867867                                dict[name] = {} 
    868868                                for c in info.getChildren(): 
    869                                          dict[name][c.getName()] = c.getData() 
     869                                        dict[name][c.getName()] = c.getData() 
    870870                return dict 
    871871 
  • trunk/src/common/fuzzyclock.py

    r7756 r7937  
    3535 
    3636class FuzzyClock: 
    37     def __init__(self): 
    38         self.__hour = 0 
    39         self.__minute = 0 
    40         self.__dayOfWeek = 0 
     37        def __init__(self): 
     38                self.__hour = 0 
     39                self.__minute = 0 
     40                self.__dayOfWeek = 0 
    4141 
    42         self.__hourNames = [ _('one'), _('two'), _('three'), _('four'), _('five'), _('six'), 
    43                              _('seven'), _('eight'), _('nine'), _('ten'), _('eleven'), 
    44                              _('twelve')] 
     42                self.__hourNames = [ _('one'), _('two'), _('three'), _('four'), _('five'), _('six'), 
     43                        _('seven'), _('eight'), _('nine'), _('ten'), _('eleven'), 
     44                        _('twelve')] 
    4545 
    46         #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). ''' 
    47         self.__normalFuzzy = [ _("$0 o'clock"), _('five past $0'), 
    48                                                                                 _('ten past $0'), _('quarter past $0'), 
    49                                                                                 _('twenty past $0'), _('twenty five past $0'), 
    50                                                                                 _('half past $0'), _('twenty five to $1'), 
    51                                                                                 _('twenty to $1'), _('quarter to $1'), 
    52                                                                                 _('ten to $1'), _('five to $1'), _("$1 o'clock") ] 
     46                #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). ''' 
     47                self.__normalFuzzy = [ _("$0 o'clock"), _('five past $0'), 
     48                        _('ten past $0'), _('quarter past $0'), 
     49                        _('twenty past $0'), _('twenty five past $0'), 
     50                        _('half past $0'), _('twenty five to $1'), 
     51                        _('twenty to $1'), _('quarter to $1'), 
     52                        _('ten to $1'), _('five to $1'), _("$1 o'clock") ] 
    5353 
    54         #A "singular-form". It is used when talking about hour 0 
    55         self.__normalFuzzyOne = [ _("$0 o'clock"), _('five past $0'), 
    56                                   _('ten past $0'), _('quarter past $0'), 
    57                                   _('twenty past $0'), _('twenty five past $0'), 
    58                                   _('half past $0'), _('twenty five to $1'), 
    59                                   _('twenty to $1'), _('quarter to $1'), 
    60                                   _('ten to $1'), _('five to $1'), 
    61                                                                                          _("$1 o'clock") ] 
     54                #A "singular-form". It is used when talking about hour 0 
     55                self.__normalFuzzyOne = [ _("$0 o'clock"), _('five past $0'), 
     56                        _('ten past $0'), _('quarter past $0'), 
     57                        _('twenty past $0'), _('twenty five past $0'), 
     58                        _('half past $0'), _('twenty five to $1'), 
     59                        _('twenty to $1'), _('quarter to $1'), 
     60                        _('ten to $1'), _('five to $1'), 
     61                        _("$1 o'clock") ] 
    6262 
    6363 
    64         self.__dayTime = [ _('Night'), _('Early morning'), _('Morning'), _('Almost noon'), 
    65                            _('Noon'), _('Afternoon'), _('Evening'), _('Late evening') ] 
     64                self.__dayTime = [ _('Night'), _('Early morning'), _('Morning'), _('Almost noon'), 
     65                        _('Noon'), _('Afternoon'), _('Evening'), _('Late evening') ] 
    6666 
    67         self.__fuzzyWeek = [ _('Start of week'), _('Middle of week'), _('End of week'), 
    68                              _('Weekend!') ] 
     67                self.__fuzzyWeek = [ _('Start of week'), _('Middle of week'), _('End of week'), 
     68                        _('Weekend!') ] 
    6969 
    70         self.setCurrent() 
     70                self.setCurrent() 
    7171 
    72     def setHour(self,hour): 
    73         self.__hour = int(hour) 
     72        def setHour(self,hour): 
     73                self.__hour = int(hour) 
    7474 
    75     def setMinute(self,minute): 
    76         self.__minute=int(minute) 
     75        def setMinute(self,minute): 
     76                self.__minute=int(minute) 
    7777 
    78     def setDayOfWeek(self,day): 
    79         self.__dayOfWeek=int(day) 
     78        def setDayOfWeek(self,day): 
     79                self.__dayOfWeek=int(day) 
    8080 
    81     def setTime(self,time): 
    82         timeArray = time.split(":") 
    83         self.setHour(timeArray[0]) 
    84         self.setMinute(timeArray[1]) 
     81        def setTime(self,time): 
     82                timeArray = time.split(":") 
     83                self.setHour(timeArray[0]) 
     84                self.setMinute(timeArray[1]) 
    8585 
    86     def setCurrent(self): 
    87         hour=time.strftime("%H") 
    88         minute=time.strftime("%M") 
    89         day=time.strftime("%w") 
     86        def setCurrent(self): 
     87                hour=time.strftime("%H") 
     88                minute=time.strftime("%M") 
     89                day=time.strftime("%w") 
    9090 
    91         self.setTime(hour+":"+minute) 
    92         self.setDayOfWeek(day) 
     91                self.setTime(hour+":"+minute) 
     92                self.setDayOfWeek(day) 
    9393 
    94     def getFuzzyTime(self, fuzzyness = 1): 
    95         sector = 0 
    96         realHour = 0 
     94        def getFuzzyTime(self, fuzzyness = 1): 
     95                sector = 0 
     96                realHour = 0 
    9797 
    98         if fuzzyness == 1 or fuzzyness == 2: 
    99             if fuzzyness == 1: 
    100                 if self.__minute >2: 
    101                     sector = (self.__minute - 3) / 5 +1 
    102             else: 
    103                 if self.__minute > 6: 
    104                     sector = ((self.__minute - 7) / 15 + 1) * 3 
     98                if fuzzyness == 1 or fuzzyness == 2: 
     99                        if fuzzyness == 1: 
     100                                if self.__minute >2: 
     101                                        sector = (self.__minute - 3) / 5 +1 
     102                        else: 
     103                                if self.__minute > 6: 
     104                                        sector = ((self.__minute - 7) / 15 + 1) * 3 
    105105 
    106             newTimeStr = self.__normalFuzzy[sector] 
    107             #$0 or $1? 
    108             deltaHour = int(newTimeStr[newTimeStr.find("$")+1]) 
     106                        newTimeStr = self.__normalFuzzy[sector] 
     107                        #$0 or $1? 
     108                        deltaHour = int(newTimeStr[newTimeStr.find("$")+1]) 
    109109 
    110             if (self.__hour + deltaHour) % 12 > 0: 
    111                 realHour = (self.__hour + deltaHour) % 12 - 1 
    112             else: 
    113                 realHour = 12 - ((self.__hour + deltaHour) % 12 + 1) 
     110                        if (self.__hour + deltaHour) % 12 > 0: 
     111                                realHour = (self.__hour + deltaHour) % 12 - 1 
     112                        else: 
     113                                realHour = 12 - ((self.__hour + deltaHour) % 12 + 1) 
    114114 
    115             if realHour == 0: 
    116                 newTimeStr = self.__normalFuzzyOne[sector] 
     115                        if realHour == 0: 
     116                                newTimeStr = self.__normalFuzzyOne[sector] 
    117117 
    118             newTimeStr = newTimeStr.replace("$"+str(deltaHour), 
    119                                             self.__hourNames[realHour]) 
     118                        newTimeStr = newTimeStr.replace("$"+str(deltaHour), 
     119                                self.__hourNames[realHour]) 
    120120 
    121121 
    122         elif fuzzyness == 3: 
    123             newTimeStr = self.__dayTime[self.__hour / 3] 
     122                elif fuzzyness == 3: 
     123                        newTimeStr = self.__dayTime[self.__hour / 3] 
    124124 
    125         else: 
    126             dayOfWeek = self.__dayOfWeek 
    127             if dayOfWeek == 1: 
    128                 newTimeStr = self.__fuzzyWeek[0] 
    129             elif dayOfWeek >= 2 and dayOfWeek <= 4: 
    130                 newTimeStr = self.__fuzzyWeek[1] 
    131             elif dayOfWeek == 5: 
    132                 newTimeStr = self.__fuzzyWeek[2] 
    133             else: 
    134                 newTimeStr = self.__fuzzyWeek[3] 
     125                else: 
     126                        dayOfWeek = self.__dayOfWeek 
     127                        if dayOfWeek == 1: 
     128                                newTimeStr = self.__fuzzyWeek[0] 
     129                        elif dayOfWeek >= 2 and dayOfWeek <= 4: 
     130                                newTimeStr = self.__fuzzyWeek[1] 
     131                        elif dayOfWeek == 5: 
     132                                newTimeStr = self.__fuzzyWeek[2] 
     133                        else: 
     134                                newTimeStr = self.__fuzzyWeek[3] 
    135135 
    136         return newTimeStr 
     136                return newTimeStr 
  • trunk/src/common/helpers.py

    r7852 r7937  
    621621                win32api.RegCloseKey(rkey) 
    622622        return val 
    623   
     623 
    624624def get_my_pictures_path(): 
    625625        '''windows-only atm. [Unix lives in the past]''' 
     
    699699                        (2, 5, 1): 'XP', 
    700700                        (2, 5, 2): '2003', 
    701                         (2, 6, 0): 'Vista', 
     701                        (2, 6, 0): 'Vista', 
    702702                } 
    703703                if win_version.has_key(ver_format): 
     
    761761                        .replace('\\', '_').replace('"', "'").replace('|', '_')\ 
    762762                        .replace('*', '_').replace('<', '_').replace('>', '_') 
    763            # 48 is the limit 
     763                # 48 is the limit 
    764764                if len(filename) > 48: 
    765765                        extension = filename.split('.')[-1] 
  • trunk/src/common/optparser.py

    r7911 r7937  
    362362                if self.old_values.has_key('trayicon_notification_on_new_messages'): 
    363363                        gajim.config.set('trayicon_notification_on_events', 
    364                                  self.old_values['trayicon_notification_on_new_messages']) 
     364                                self.old_values['trayicon_notification_on_new_messages']) 
    365365                gajim.config.set('version', '0.10.1.7') 
    366366 
     
    369369                if self.old_values.has_key('chat_state_notifications'): 
    370370                        gajim.config.set('outgoing_chat_state_notifications', 
    371                                  self.old_values['chat_state_notifications']) 
     371                                self.old_values['chat_state_notifications']) 
    372372                gajim.config.set('version', '0.10.1.8') 
    373373 
  • trunk/src/common/rst_xhtml_generator.py

    r7099 r7937  
    2929                '''Role to make handy references to Jabber Enhancement Proposals (JEP). 
    3030 
    31                 Use as :JEP:`71` (or jep, or jep-reference). 
     31                Use as :JEP:`71` (or jep, or jep-reference). 
    3232                Modeled after the sample in docutils documentation. 
    3333                ''' 
     
    112112test:: 
    113113 
    114   >>> print 1 
    115   1 
     114>>> print 1 
     1151 
    116116 
    117117*I* like it. It is for :JEP:`71` 
  • trunk/src/common/xmpp_stringprep.py

    r7270 r7937  
    3333 
    3434        warnings.warn("Accented and non-Western Jabber IDs will not be properly " 
    35                                   "case-folded with this version of Python, resulting in " 
    36                                   "incorrect protocol-level behavior.  It is strongly " 
    37                                   "recommended you upgrade to Python 2.3.2 or newer if you " 
    38                                   "intend to use Twisted's Jabber support.") 
     35                "case-folded with this version of Python, resulting in " 
     36                "incorrect protocol-level behavior.  It is strongly " 
     37                "recommended you upgrade to Python 2.3.2 or newer if you " 
     38                "intend to use Twisted's Jabber support.") 
    3939 
    4040else: 
     
    9898class Profile: 
    9999        def __init__(self, mappings=[],  normalize=True, prohibiteds=[], 
    100                                            check_unassigneds=True, check_bidi=True): 
     100                                                check_unassigneds=True, check_bidi=True): 
    101101                self.mappings = mappings 
    102102                self.normalize = normalize 
     
    184184        # Prohibited characters. 
    185185        prohibiteds = [unichr(n) for n in range(0x00, 0x2c + 1) + 
    186                                                                            range(0x2e, 0x2f + 1) + 
    187                                                                            range(0x3a, 0x40 + 1) + 
    188                                                                            range(0x5b, 0x60 + 1) + 
    189                                                                            range(0x7b, 0x7f + 1) ] 
     186                                                                                range(0x2e, 0x2f + 1) + 
     187                                                                                range(0x3a, 0x40 + 1) + 
     188                                                                                range(0x5b, 0x60 + 1) + 
     189                                                                                range(0x7b, 0x7f + 1) ] 
    190190 
    191191        def prepare(self, string): 
     
    207207        def check_prohibiteds(self, string): 
    208208                for c in string: 
    209                    if c in self.prohibiteds: 
    210                            raise UnicodeError, "Invalid character %s" % repr(c) 
     209                        if c in self.prohibiteds: 
     210                                raise UnicodeError, "Invalid character %s" % repr(c) 
    211211 
    212212        def nameprep(self, label): 
     
    222222        case_map = MappingTableFromFunction(lambda c: c.lower()) 
    223223        nodeprep = Profile(mappings=[case_map], 
    224                                            normalize=False, 
    225                                            prohibiteds=[LookupTable([u' ', u'"', u'&', u"'", u'/', 
    226                                                                                                  u':', u'<', u'>', u'@'])], 
    227                                            check_unassigneds=False, 
    228                                            check_bidi=False)  
     224                                                normalize=False, 
     225                                                prohibiteds=[LookupTable([u' ', u'"', u'&', u"'", u'/', 
     226                                                                                                u':', u'<', u'>', u'@'])], 
     227                                                check_unassigneds=False, 
     228                                                check_bidi=False)  
    229229 
    230230        resourceprep = Profile(normalize=False, 
    231                                                    check_unassigneds=False, 
    232                                                    check_bidi=False) 
    233     
     231                                                        check_unassigneds=False, 
     232                                                        check_bidi=False) 
     233         
    234234else: 
    235235        C_11 = LookupTableFromFunction(stringprep.in_table_c11) 
     
    252252                                                                                        C_3, C_4, C_5, C_6, C_7, C_8, C_9, 
    253253                                                        LookupTable([u'"', u'&', u"'", u'/', 
    254                                                                                          u':', u'<', u'>', u'@'])]) 
     254                                                                                        u':', u'<', u'>', u'@'])]) 
    255255 
    256256        resourceprep = Profile(mappings=[B_1,], 
    257                                                                    prohibiteds=[C_12, C_21, C_22, 
     257                                                                        prohibiteds=[C_12, C_21, C_22, 
    258258                                                                                                        C_3, C_4, C_5, C_6, C_7, C_8, C_9]) 
    259259