From ff8379b7b410a473833e1836bd67a066a58faed9 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 10 Jan 2005 04:45:24 +0000 Subject: [PATCH] Added the collect command. --- sandbox/Debug.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sandbox/Debug.py b/sandbox/Debug.py index ac3360988..a4ecdd1f6 100644 --- a/sandbox/Debug.py +++ b/sandbox/Debug.py @@ -38,6 +38,7 @@ __revision__ = "$Id$" import supybot.plugins as plugins +import gc import sys import exceptions @@ -163,6 +164,19 @@ class Debug(privmsgs.CapabilityCheckingPrivmsg): irc.reply(channel) channeldb = wrap(channeldb, ['channeldb']) + def collect(self, irc, msg, args, times): + """[] + + Does gc collections, returning the number of objects collected + each time. defaults to 1. + """ + L = [] + while times: + L.append(gc.collect()) + times -= 1 + irc.reply(utils.commaAndify(map(str, L))) + collect = wrap(collect, [additional('positiveInt', 1)]) + Class = Debug