From 5841566982dbb7383785264078a078bcace3ba3a Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 30 Aug 2003 04:46:17 +0000 Subject: [PATCH] Docstrings updated. --- plugins/Utilities.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/plugins/Utilities.py b/plugins/Utilities.py index 8381d19ec..781c308b5 100644 --- a/plugins/Utilities.py +++ b/plugins/Utilities.py @@ -76,16 +76,24 @@ class Utilities(callbacks.Privmsg): def ignore(self, irc, msg, args): """takes no arguments - does nothing + Does nothing. Useful sometimes for sequencing commands when you don't + care about their non-error return values. """ pass def shrink(self, irc, msg, args): + """ + + Shrinks to 400 characters. + """ text = privmsgs.getArgs(args) irc.reply(msg, text[:400]) def strjoin(self, irc, msg, args): - " " + """ [ ...] + + Joins all the arguments together with . + """ sep = args.pop(0) args = flatten(map(callbacks.tokenize, args)) irc.reply(msg, sep.join(args)) @@ -115,6 +123,10 @@ class Utilities(callbacks.Privmsg): irc.reply(msg, privmsgs.getArgs(args).lower()) def strlen(self, irc, msg, args): + """ + + Returns the length of . + """ total = 0 for arg in args: total += len(arg) @@ -129,7 +141,12 @@ class Utilities(callbacks.Privmsg): irc.reply(msg, utils.dqrepr(text)) def strconcat(self, irc, msg, args): - " " + """ + + Concatenates two strings. Do keep in mind that this is *not* the same + thing as strjoin "", since if contains spaces, they won't be + removed by strconcat. + """ (first, second) = privmsgs.getArgs(args, needed=2) irc.reply(msg, first+second) @@ -143,7 +160,10 @@ class Utilities(callbacks.Privmsg): def re(self, irc, msg, args): """ - Returns all matches to (in the form /regexp/flags) in text. + If is of the form m/regexp/flags, returns the portion of + that matches the regexp. If is of the form + s/regexp/replacement/flags, returns the result of applying such a + regexp to """ (regexp, text) = privmsgs.getArgs(args, needed=2) f = None