Ticket #5329: deprecated_string_functions.diff

File deprecated_string_functions.diff, 9.9 KB (added by Ezio Melotti, 10 years ago)
  • twisted/words/protocols/irc.py

     
    273273            raise ValueError, "Somebody screwed up, 'cuz this doesn't" \
    274274                  " look like a command to me: %s" % command
    275275
    276         line = string.join([command] + list(parameter_list))
     276        line = ' '.join([command] + list(parameter_list))
    277277        if prefix.has_key('prefix'):
    278278            line = ":%s %s" % (prefix['prefix'], line)
    279279        self.sendLine(line)
     
    17651765        if not (size is None):
    17661766            args.append(size)
    17671767
    1768         args = string.join(args, ' ')
     1768        args = ' '.join(args)
    17691769
    17701770        self.ctcpMakeQuery(user, [('DCC', args)])
    17711771
     
    18491849        """
    18501850        Called when a user joins a channel.
    18511851        """
    1852         nick = string.split(prefix,'!')[0]
     1852        nick = prefix.split('!')[0]
    18531853        channel = params[-1]
    18541854        if nick == self.nickname:
    18551855            self.joined(channel)
     
    18601860        """
    18611861        Called when a user leaves a channel.
    18621862        """
    1863         nick = string.split(prefix,'!')[0]
     1863        nick = prefix.split('!')[0]
    18641864        channel = params[0]
    18651865        if nick == self.nickname:
    18661866            self.left(channel)
     
    18711871        """
    18721872        Called when a user has quit.
    18731873        """
    1874         nick = string.split(prefix,'!')[0]
     1874        nick = prefix.split('!')[0]
    18751875        self.userQuit(nick, params[0])
    18761876
    18771877
     
    19321932            if not m['normal']:
    19331933                return
    19341934
    1935             message = string.join(m['normal'], ' ')
     1935            message = ' '.join(m['normal'])
    19361936
    19371937        self.privmsg(user, channel, message)
    19381938
     
    19521952            if not m['normal']:
    19531953                return
    19541954
    1955             message = string.join(m['normal'], ' ')
     1955            message = ' '.join(m['normal'])
    19561956
    19571957        self.noticed(user, channel, message)
    19581958
     
    19601960        """
    19611961        Called when a user changes their nickname.
    19621962        """
    1963         nick = string.split(prefix,'!', 1)[0]
     1963        nick = prefix.split('!', 1)[0]
    19641964        if nick == self.nickname:
    19651965            self.nickChanged(params[0])
    19661966        else:
     
    19701970        """
    19711971        Called when a user is kicked from a channel.
    19721972        """
    1973         kicker = string.split(prefix,'!')[0]
     1973        kicker = prefix.split('!')[0]
    19741974        channel = params[0]
    19751975        kicked = params[1]
    19761976        message = params[-1]
    1977         if string.lower(kicked) == string.lower(self.nickname):
     1977        if kicked.lower() == self.nickname.lower():
    19781978            # Yikes!
    19791979            self.kickedFrom(channel, kicker, message)
    19801980        else:
     
    19841984        """
    19851985        Someone in the channel set the topic.
    19861986        """
    1987         user = string.split(prefix, '!')[0]
     1987        user = prefix.split('!')[0]
    19881988        channel = params[0]
    19891989        newtopic = params[1]
    19901990        self.topicUpdated(user, channel, newtopic)
     
    19941994        Called when the topic for a channel is initially reported or when it
    19951995        subsequently changes.
    19961996        """
    1997         user = string.split(prefix, '!')[0]
     1997        user = prefix.split('!')[0]
    19981998        channel = params[1]
    19991999        newtopic = params[2]
    20002000        self.topicUpdated(user, channel, newtopic)
    20012001
    20022002    def irc_RPL_NOTOPIC(self, prefix, params):
    2003         user = string.split(prefix, '!')[0]
     2003        user = prefix.split('!')[0]
    20042004        channel = params[1]
    20052005        newtopic = ""
    20062006        self.topicUpdated(user, channel, newtopic)
     
    21092109        self.action(user, channel, data)
    21102110
    21112111    def ctcpQuery_PING(self, user, channel, data):
    2112         nick = string.split(user,"!")[0]
     2112        nick = user.split('!')[0]
    21132113        self.ctcpMakeReply(nick, [("PING", data)])
    21142114
    21152115    def ctcpQuery_FINGER(self, user, channel, data):
     
    21242124        else:
    21252125            reply = str(self.fingerReply)
    21262126
    2127         nick = string.split(user,"!")[0]
     2127        nick = user.split('!')[0]
    21282128        self.ctcpMakeReply(nick, [('FINGER', reply)])
    21292129
    21302130    def ctcpQuery_VERSION(self, user, channel, data):
     
    21332133                               % (user, data))
    21342134
    21352135        if self.versionName:
    2136             nick = string.split(user,"!")[0]
     2136            nick = user.split('!')[0]
    21372137            self.ctcpMakeReply(nick, [('VERSION', '%s:%s:%s' %
    21382138                                       (self.versionName,
    21392139                                        self.versionNum or '',
     
    21442144            self.quirkyMessage("Why did %s send '%s' with a SOURCE query?"
    21452145                               % (user, data))
    21462146        if self.sourceURL:
    2147             nick = string.split(user,"!")[0]
     2147            nick = user.split('!')[0]
    21482148            # The CTCP document (Zeuge, Rollo, Mesander 1994) says that SOURCE
    21492149            # replies should be responded to with the location of an anonymous
    21502150            # FTP server in host:directory:file format.  I'm taking the liberty
     
    21572157            self.quirkyMessage("Why did %s send '%s' with a USERINFO query?"
    21582158                               % (user, data))
    21592159        if self.userinfo:
    2160             nick = string.split(user,"!")[0]
     2160            nick = user.split('!')[0]
    21612161            self.ctcpMakeReply(nick, [('USERINFO', self.userinfo)])
    21622162
    21632163    def ctcpQuery_CLIENTINFO(self, user, channel, data):
     
    21692169        the usage of that tag.
    21702170        """
    21712171
    2172         nick = string.split(user,"!")[0]
     2172        nick = user.split('!')[0]
    21732173        if not data:
    21742174            # XXX: prefixedMethodNames gets methods from my *class*,
    21752175            # but it's entirely possible that this *instance* has more
     
    21772177            names = reflect.prefixedMethodNames(self.__class__,
    21782178                                                'ctcpQuery_')
    21792179
    2180             self.ctcpMakeReply(nick, [('CLIENTINFO',
    2181                                        string.join(names, ' '))])
     2180            self.ctcpMakeReply(nick, [('CLIENTINFO', ' '.join(names))])
    21822181        else:
    2183             args = string.split(data)
     2182            args = data.split()
    21842183            method = getattr(self, 'ctcpQuery_%s' % (args[0],), None)
    21852184            if not method:
    21862185                self.ctcpMakeReply(nick, [('ERRMSG',
     
    21952194    def ctcpQuery_ERRMSG(self, user, channel, data):
    21962195        # Yeah, this seems strange, but that's what the spec says to do
    21972196        # when faced with an ERRMSG query (not a reply).
    2198         nick = string.split(user,"!")[0]
     2197        nick = user.split('!')[0]
    21992198        self.ctcpMakeReply(nick, [('ERRMSG',
    22002199                                   "%s :No error has occoured." % data)])
    22012200
     
    22032202        if data is not None:
    22042203            self.quirkyMessage("Why did %s send '%s' with a TIME query?"
    22052204                               % (user, data))
    2206         nick = string.split(user,"!")[0]
     2205        nick = user.split('!')[0]
    22072206        self.ctcpMakeReply(nick,
    22082207                           [('TIME', ':%s' %
    22092208                             time.asctime(time.localtime(time.time())))])
     
    22212220            data = data[len(dcctype)+1:]
    22222221            handler(user, channel, data)
    22232222        else:
    2224             nick = string.split(user,"!")[0]
     2223            nick = user.split('!')[0]
    22252224            self.ctcpMakeReply(nick, [('ERRMSG',
    22262225                                       "DCC %s :Unknown DCC type '%s'"
    22272226                                       % (data, dcctype))])
     
    23912390        """When I get a message that's so broken I can't use it.
    23922391        """
    23932392        log.msg(line)
    2394         log.msg(string.join(traceback.format_exception(excType,
    2395                                                         excValue,
    2396                                                         tb),''))
     2393        log.msg(''.join(traceback.format_exception(excType, excValue, tb)))
    23972394
    23982395    def quirkyMessage(self, s):
    23992396        """This is called when I receive a message which is peculiar,
     
    26582655
    26592656    def dataReceived(self, data):
    26602657        self.buffer = self.buffer + data
    2661         lines = string.split(self.buffer, LF)
     2658        lines = self.buffer.split(LF)
    26622659        # Put the (possibly empty) element after the last LF back in the
    26632660        # buffer
    26642661        self.buffer = lines.pop()
     
    26972694    """
    26982695
    26992696    orig_data = data
    2700     data = string.split(data)
     2697    data = data.split()
    27012698    if len(data) < 4:
    27022699        return orig_data
    27032700
     
    27192716                )
    27202717            # The mapping to 'int' is to get rid of those accursed
    27212718            # "L"s which python 1.5.2 puts on the end of longs.
    2722             address = string.join(map(str,map(int,address)), ".")
     2719            address = '.'.join(map(str,map(int,address)))
    27232720
    27242721    if dcctype == 'SEND':
    27252722        filename = arg
     
    28902887    retval = {'extended': extended_messages,
    28912888              'normal': normal_messages }
    28922889
    2893     messages = string.split(message, X_DELIM)
     2890    messages = message.split(X_DELIM)
    28942891    odd = 0
    28952892
    28962893    # X1 extended data X2 nomal data X3 extended data X4 normal...
     
    29062903
    29072904    extended_messages[:] = map(ctcpDequote, extended_messages)
    29082905    for i in xrange(len(extended_messages)):
    2909         m = string.split(extended_messages[i], SPC, 1)
     2906        m = extended_messages[i].split(SPC, 1)
    29102907        tag = m[0]
    29112908        if len(m) > 1:
    29122909            data = m[1]
     
    29372934
    29382935def lowQuote(s):
    29392936    for c in (M_QUOTE, NUL, NL, CR):
    2940         s = string.replace(s, c, mQuoteTable[c])
     2937        s = s.replace(c, mQuoteTable[c])
    29412938    return s
    29422939
    29432940def lowDequote(s):
     
    29672964
    29682965def ctcpQuote(s):
    29692966    for c in (X_QUOTE, X_DELIM):
    2970         s = string.replace(s, c, xQuoteTable[c])
     2967        s = s.replace(c, xQuoteTable[c])
    29712968    return s
    29722969
    29732970def ctcpDequote(s):
     
    30063003        m = "%s%s%s" % (X_DELIM, m, X_DELIM)
    30073004        coded_messages.append(m)
    30083005
    3009     line = string.join(coded_messages, '')
     3006    line = ''.join(coded_messages)
    30103007    return line
    30113008
    30123009