~ubuntu-branches/ubuntu/utopic/gozerbot/utopic

« back to all changes in this revision

Viewing changes to debian/gozerbot/usr/lib/python2.5/site-packages/gozerplugs/plugs/size.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Malcolm
  • Date: 2009-09-14 09:00:29 UTC
  • mfrom: (1.1.4 upstream) (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090914090029-uval0ekt72kmklxw
Tags: 0.9.1.3-3
Changed dependency on python-setuptools to python-pkg-resources
(Closes: #546435) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# plugs/size.py
2
 
#
3
 
#
4
 
 
5
 
__copyright__ = 'this file is in the public domain'
6
 
 
7
 
from gozerbot.commands import cmnds
8
 
from gozerbot.examples import examples
9
 
from gozerbot.users import users
10
 
from gozerbot.redispatcher import rebefore, reafter
11
 
from gozerbot.aliases import aliases
12
 
from gozerbot.callbacks import callbacks
13
 
from gozerbot.plugins import plugins
14
 
from gozerbot.fleet import fleet
15
 
from gozerbot.plughelp import plughelp
16
 
 
17
 
plughelp.add('size', 'the size command shows the sizes of plugins that \
18
 
provide a size() plugin command and the sizes of some basic structures')
19
 
 
20
 
def handle_size(bot, ievent):
21
 
    """ size .. show size of core datastructures """
22
 
    txtlist = []
23
 
    txtlist.append("fleet: %s" % fleet.size())
24
 
    txtlist.append("users: %s" % users.size())
25
 
    txtlist.append("cmnds: %s" % cmnds.size())
26
 
    txtlist.append("callbacks: %s" % callbacks.size())
27
 
    txtlist.append("rebefore: %s" % rebefore.size())
28
 
    txtlist.append("reafter: %s" % reafter.size())
29
 
    txtlist.append("aliases: %s" % len(aliases.data))
30
 
    txtlist.append("examples: %s" % examples.size()) 
31
 
    plugsizes = plugins.plugsizes()
32
 
    if plugsizes:
33
 
        txtlist += plugsizes
34
 
    ievent.reply(txtlist)
35
 
 
36
 
cmnds.add('size', handle_size, ['USER', 'WEB', 'ANON'])
37
 
examples.add('size', 'show sizes of various data structures', 'size')