code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# jsb/gae/xmpp/bot.py
#
#
""" XMPP bot. """
## jsb imports
from jsb.lib.botbase import BotBase
from jsb.drivers.xmpp.presence import Presence
from jsb.utils.generic import strippedtxt
## xmpp import
from jsb.contrib.xmlstream import NodeBuilder, XMLescape, XMLunescape
## basic imports
import types
import logging... | Python |
# jsb common plugins
#
#
""" this package contains all the plugins common to all drivers. """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__.... | Python |
# jsb common plugins
#
#
""" this package contains all the plugins common to all drivers. """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__.... | Python |
# jsb common plugins
#
#
""" this package contains all the plugins common to all drivers. """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__.... | Python |
# jsb common plugins
#
#
""" this package contains all the plugins common to all drivers. """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__.... | Python |
# jsb/plugs/socket/dns.py
#
#
""" do a fqdn loopup. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## basic imports
from socket import gethostbyname
from socket import getfqdn
import re
## dns command
def handle_dns(bot, event):
""" do a dns lookup. """
if not... | Python |
# jsb/plugs/socket/chatlog.py
#
#
"""
log irc channels to [hour:min] <nick> txt format, only
logging to files is supported right now.
"""
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.callbacks import callbacks, remote_callbacks, last_callbacks, first_callbacks
from jsb.lib.persistconfig ... | Python |
# jsb/plugs/socket/kickban.py
#
#
""" kickban functionality for IRC. """
## jsb imports
from jsb.utils.generic import getwho
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.callbacks import callbacks
## basic imports
import Queue
import time
import logging
## defines
bans ... | Python |
# jsb/plugs/socket/udp.py
#
#
"""
the bot has the capability to listen for udp packets which it will use
to /msg a given nick or channel.
1) setup
* do !reload udp to enable the udp plugin
* call !udp-cfgsave to generate a config file in gozerdata/plugs/udp/config
* edit this file... | Python |
# jsb/plugs/socket/mpd.py
#
#
# interact with (your) Music Player Daemon
# (c) Wijnand 'tehmaze' Modderman - http://tehmaze.com
# BSD License
#
# CHANGELOG
# 2011-02-20
# * sMiLe - changed methods to be similar to the mpc commands
# 2011-02-13
# * sMiLe - added several new functions
# 2011-01-16
# * BHJTW - ad... | Python |
# jsb socket related plugins
#
#
""" this package contains all the socket related plugins. """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__... | Python |
# jsb/plugs/socket/restserver.py
#
#
## jsb imports
from jsb.lib.callbacks import callbacks
from jsb.utils.url import posturl, getpostdata
from jsb.lib.persistconfig import PersistConfig
from jsb.lib.commands import cmnds
from jsb.lib.rest.server import RestServer, RestRequestHandler
from jsb.lib.eventbase import Eve... | Python |
# jsb/plugs/socket/geo.py
#
#
""" This product includes GeoLite data created by MaxMind, available from http://maxmind.com/ """
## jsb imports
from jsb.lib.callbacks import callbacks
from jsb.lib.examples import examples
from jsb.lib.commands import cmnds
from jsb.utils.url import geturl2
from jsb.utils.exception i... | Python |
# jsb/plugs/wave/wave.py
#
#
""" wave related commands. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.utils.exception import handle_exception
from jsb.lib.persist import PlugPersist
from jsb.lib.callbacks import callbacks
from jsb.lib.plugins import plugs
from j... | Python |
# jsb/plugs/wave/gadget.py
#
#
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persist import PlugPersist
## defines
gadgeturls = PlugPersist('gadgeturls')
gadgeturls.data['gadget'] = 'https://jsonbot.appspot.com/gadget.xml'
gadgeturls.data['poll'] = 'https://js... | Python |
# jsb/plugs/wave/clone.py
#
#
""" clone the wave after x blips. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.callbacks import callbacks
from jsb.drivers.gae.wave.waves import Wave
from jsb.lib.plugins import plugs
## basic imports
import logging
## callbacks
def clonepre(bot, event):
if... | Python |
# jsb wave plugins
#
#
""" this package contains all wave related plugins. """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__.append(i)
try:... | Python |
# jsb/plugs/core/grep.py
#
#
""" grep the output of bot comamnds. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.utils.generic import waitforqueue
from jsb.lib.examples import examples
## basic imports
import getopt
import re
## grep command
def handle_grep(bot, ievent):
""" grep the result l... | Python |
# jsb/plugs/core/data.py
#
#
""" data dumper commands. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## data-event command
def handle_dataevent(bot, event):
""" dump event to json. """
event.reply(event.tojson())
cmnds.add("data-event", handle_dataevent, "OPER... | Python |
# jsb/plugs/core/rc.py
#
#
""" jsonbot resource files .. files with the .jsb extension which consists of commands to be executed. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.utils.url import geturl2
from jsb.utils.exception import handle_exception
from jsb.uti... | Python |
# jsb/plugs/core/nickserv.py
#
#
""" authenticate to NickServ. """
__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ ='BSD'
## jsb imports
from jsb.lib.examples import examples
from jsb.lib.callbacks import callbacks
from jsb.lib.commands import cmnds
from jsb.lib.datadir import getdatadi... | Python |
# jsb/plugs/core/core.py
#
#
""" core bot commands. """
## jsb imports
from jsb.utils.statdict import StatDict
from jsb.utils.log import setloglevel, getloglevel
from jsb.utils.timeutils import elapsedstring
from jsb.utils.exception import handle_exception
from jsb.lib.commands import cmnds
from jsb.lib.examples imp... | Python |
# jsb/plugs/core/gatekeeper.py
#
#
""" gatekeeper commands. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## gatekeeper-allow command
def handle_gatekeeperallow(bot, event):
""" allow user on bot. """
if not event.rest: event.missing("<userhost>") ; return
... | Python |
# jsb/plugs/core/reverse.py
#
#
""" reverse pipeline or reverse <txt>. """
__copyright__ = 'this file is in the public domain'
__author__ = 'Hans van Kranenburg <hans@knorrie.org>'
## jsb imports
from jsb.utils.generic import waitforqueue
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
##... | Python |
# jsb/plugs/core/outputcache.py
#
#
""" outputcache used when reply cannot directly be delivered. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.outputcache import get, set, clear
from jsb.lib.callbacks import callbacks
from jsb.lib.examples import examples
## basic imports
import logging
## o... | Python |
# jsb/plugs/core/underauth.py
#
#
""" handle non-ident connection on undernet. """
## copyright
__copyright__ = 'this file is in the public domain'
__author__ = 'aafshar@gmail.com'
## jsb imports
from jsb.lib.callbacks import callbacks
## pre_underauth_cb precondition
def pre_underauth_cb(bot, ievent):
""" ... | Python |
# jsb/plugs/core/uniq.py
#
#
""" used in a pipeline .. unique elements. """
__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ = 'BSD'
## jsb imports
from jsb.lib.examples import examples
from jsb.lib.commands import cmnds
from jsb.utils.generic import waitforqueue
## uniq command
def han... | Python |
# jsb/plugs/core/alias.py
#
#
"""
this alias plugin allows aliases for commands to be added. aliases are in
the form of <alias> -> <command> .. aliases to aliases are not allowed,
aliases are per channel.
"""
## gozerbot imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
... | Python |
# jsb/plugs/common/echo.py
#
#
""" echo typed sentences. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.callbacks import callbacks, first_callbacks
## basic imports
import logging
## echo-callback
def echopre(bot, event):
""" test whether we should ec... | Python |
# jsb/plugs/core/userstate.py
#
#
""" userstate is stored in jsondata/state/users/<username>. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persiststate import UserState
from jsb.lib.errors import NoSuchUser
## set command
def handle_set(bot, ievent):
... | Python |
# jsb/plugs/core/nickcapture.py
#
#
""" nick recapture callback. """
## jsb imports
from jsb.lib.callbacks import callbacks
## callbacks
def ncaptest(bot, ievent):
""" test if user is splitted. """
if '*.' in ievent.txt or bot.cfg.server in ievent.txt: return 0
if ievent.chan.data.wantnick and ievent.c... | Python |
# jsb/plugs/core/irc.py
#
#
""" irc related commands. """
## jsb imports
from jsb.lib.callbacks import callbacks
from jsb.lib.partyline import partyline
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.fleet import getfleet
from jsb.lib.wait import waiter
import jsb.lib.threads a... | Python |
# jsb/plugs/core/more.py
#
#
""" access the output cache. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.less import outcache
## basic imports
import logging
## more command
def handle_more(bot, ievent):
""" pop message from the output cache. """
... | Python |
# jsb/plugs/core/tail.py
#
#
""" tail bot results. """
## jsb imports
from jsb.utils.generic import waitforqueue
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## tail command
def handle_tail(bot, ievent):
""" used in a pipeline .. show last <nr> elements. """
if not ievent.inqueu... | Python |
# jsb/plugs/core/dispatch.py
#
#
""" this is the dispatch plugin that dispatches events to commands. """
## jsb imports
from jsb.lib.callbacks import last_callbacks
from jsb.lib.errors import NoSuchCommand, NoSuchUser
## basic logging
import logging
import copy
## defines
cpy = copy.deepcopy
## dispatch-precond... | Python |
# jsb/plugs/core/test.py
# encoding: utf-8
#
#
""" test plugin. """
from jsb.utils.exception import exceptionmsg, handle_exception, exceptionevents, exceptionlist
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.eventbase import EventBase
from jsb.lib.users import users
from jsb.l... | Python |
# jsb/plugs/core/choice.py
#
#
""" the choice command can be used with a string or in a pipeline. """
## jsb imports
from jsb.utils.generic import waitforqueue
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## basic imports
import random
## choice command
def handle_choice(bot, ievent):... | Python |
# jsb/plugs/core/fleet.py
#
#
"""
The fleet makes it possible to run multiple bots in one running instance.
It is a list of bots. This plugin provides commands to manipulate this list of bots.
"""
## jsb imports
from jsb.lib.config import Config
from jsb.lib.threads import start_new_thread
from jsb.lib.fle... | Python |
# jsb/plugs/core/to.py
#
#
""" send output to another user .. used in a pipeline. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.utils.generic import getwho, waitforqueue
from jsb.lib.examples import examples
## to command
def handle_to(bot, ievent):
""" direct pipeline output to <nick>. """
... | Python |
# jsb/plugs/core.admin.py
#
#
""" admin related commands. these commands are mainly for maintaining the bot. """
## jsb imports
from jsb.lib.eventhandler import mainhandler
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persist import Persist
from jsb.lib.boot import savecmndta... | Python |
# jsb/plugs/core/misc.py
#
#
""" misc commands. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persiststate import UserState
## basic imports
import time
import os
import threading
import thread
import copy
... | Python |
# jsb/plugs/core/xmpp.py
#
#
""" xmpp related commands. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.fleet import getfleet
## xmpp-invite command
def handle_xmppinvite(bot, event):
""" invite (subscribe to) a different user. """
if not event.rest:... | Python |
# jsb/plugs/core/remotecallbacks.py
#
#
""" dispatch remote events. """
## jsb imports
from jsb.utils.lazydict import LazyDict
from jsb.utils.generic import fromenc
from jsb.utils.exception import handle_exception
from jsb.lib.callbacks import callbacks, remote_callbacks, first_callbacks
from jsb.lib.container impor... | Python |
# jsb/plugs/core/not.py
#
#
""" negative grep. """
## jsb imports
from jsb.lib.examples import examples
from jsb.lib.commands import cmnds
from jsb.utils.generic import waitforqueue
## basic imports
import getopt
import re
## not command
def handle_not(bot, ievent):
""" negative grep. """
if not ievent.i... | Python |
# jsb/plugs/core/chan.py
#
#
""" channel related commands. """
## jsb imports
from jsb.lib.persist import Persist
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.callbacks import callbacks
from jsb.lib.channelbase import ChannelBase
from jsb.lib.datadir import getdatadir
from js... | Python |
# jsb/plugs/core/plug.py
#
#
""" plugin management. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.boot import default_plugins, plugin_packages, remove_plugin, update_mod
from jsb.utils.exception import handle_exception, exceptionmsg
from jsb.lib.boot import ... | Python |
# jsb/plugs/core/welcome.py
#
#
""" send welcome message. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## welcome command
def handle_welcome(bot, event):
event.how = "background"
event.reply("Welcome to JSONBOT - you can give this bot commands. try !help .. or... | Python |
# jsb basic plugins
#
#
""" register all .py files """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__.append(i)
try:
__all__.remove('__i... | Python |
# jsb/plugs/core/sort.py
#
#
""" sort bot results. """
__author__ = "Wijnand 'maze' Modderman <http://tehmaze.com>"
__license__ = "BSD"
## jsb imports
from jsb.lib.commands import cmnds
from jsb.utils.generic import waitforqueue
from jsb.lib.examples import examples
## basic imports
import optparse
## SortError... | Python |
# jsb/plugs/core/count.py
#
#
""" count number of items in result queue. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.utils.generic import waitforqueue
from jsb.lib.examples import examples
## count command
def handle_count(bot, ievent):
""" show nr of elements in result list. """
if not ... | Python |
# jsb/plugs/core/botevent.py
#
#
""" provide handling of host/tasks/botevent tasks. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.lib.tasks import taskmanager
from jsb.lib.botbase import BotBase
from jsb.lib.eventbase import EventBase
from jsb.utils.lazydict import LazyDict
from jsb.li... | Python |
# jsb/plugs/core/user.py
#
#
""" users related commands. """
## jsb imports
from jsb.utils.generic import getwho
from jsb.utils.exception import handle_exception
from jsb.utils.name import stripname
from jsb.lib.users import users
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## basic imp... | Python |
# jsb/plugs/common/forward.py
#
#
""" forward incoming trafic on a bot to another bot through xmpp. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.callbacks import callbacks, remote_callbacks, last_callbacks, first_callbacks
from jsb.lib.eventbase import EventBase
from jsb.lib.persist import Plug... | Python |
# jsb/plugs/common/hubbub.py
#
#
"""
the hubbub mantra is of the following:
use the hb-register <feedname> <url> command to register url and start a feed in in one pass.
"""
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persist import Persist, PlugPers... | Python |
# jsb/plugs/core/topic.py
#
#
""" manage topics. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## basic imports
import time
## checktopicmode function
def checktopicmode(bot, ievent):
""" callback for change in channel topic mode """
chan = ievent.channel
... | Python |
# jsb/plugs/common/wikipedia.py
#
#
""" query wikipedia .. use countrycode to select a country specific wikipedia. """
## jsb imports
from jsb.utils.url import geturl, striphtml
from jsb.utils.generic import splittxt, handle_exception, fromenc
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
... | Python |
# jsb/plugs/common/feedback.py
#
#
""" give feedback on the bot to dunker@jsonbot.org. connects to jsonbot.org if no jabber bot exists. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.fleet import getfleet
from jsb.lib.factory import bot_factory
from jsb.utils... | Python |
# jsb/plugs/common/weather.py
#
#
""" show weather based on Google's weather API """
__copyright__ = 'this file is in the public domain'
__author__ = 'Landon Fowles'
## jsb imports
from jsb.utils.url import geturl
from jsb.utils.generic import getwho
from jsb.lib.commands import cmnds
from jsb.lib.persist import Pe... | Python |
# jsb/plugs/common/ask.py
#
#
""" ask a user a question and relay back the response. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.callbacks import callbacks
from jsb.lib.persist import PlugPersist
from jsb.lib.examples import examples
from jsb.lib.fleet import getfleet
## basic imports
import... | Python |
# jsb/plugs/common/rss.py
#
#
"""
the rss mantra is of the following:
1) add a url with !rss-add <feedname> <url>
2) use !rss-start <feed> in the channel you want the feed to appear
3) run !rss-scan <feed> to see what tokens you can use .. add them with !rss-additem <feed> <token>
4) change markup... | Python |
# jsb/plugs/common/imdb.py
#
# author: melmoth
""" query the imdb database. """
## jsb imports
from jsb.lib.examples import examples
from jsb.lib.commands import cmnds
from jsb.utils.url import geturl2, striphtml, decode_html_entities
from jsb.imports import getjson
## basic imports
import logging
## defines
URL... | Python |
# jsb/plugs/common/controlchar.py
#
#
"""
command to control the control (command) characters. The cc is a string
containing the allowed control characters.
"""
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## cc command
def handle_cc(bot, ievent):
""" cc [<c... | Python |
# jsb/plugs/common/colors.py
#
#
""" use the morph to add color to selected words. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.callbacks import first_callbacks
from jsb.lib.morphs import outputmorphs
from jsb.lib.persiststate import PlugState
from jsb.util... | Python |
# jsb/plugs/common/seen.py
#
#
# Description: tracks when a nick is last seen
# Author: Wijnand 'tehmaze' Modderman
# Website: http://tehmaze.com
# License: BSD
""" nick tracking. """
from jsb.lib.callbacks import callbacks
from jsb.lib.commands import cmnds
from jsb.lib.datadir import getdatadir
from jsb.utils.pdod ... | Python |
# jsb/plugs/common/relay.py
#
#
""" relay to other users/channels. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.callbacks import first_callbacks
from jsb.lib.persist import PlugPersist
from jsb.lib.examples import examples
from jsb.lib.fleet import getfleet
from jsb.lib.errors import NoSuchWave... | Python |
# jsb/plugs/common/tinyurl.py
#
#
""" tinyurl.com feeder """
__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ = 'BSD'
## jsb imports
from jsb.lib.commands import cmnds
from jsb.utils.url import striphtml, useragent
from jsb.lib.examples import examples
from jsb.utils.exception import hand... | Python |
# jsb/plugs/common/urlinfo.py
# -*- coding: utf-8 -*-
#
#
"""
Catches URLs on channel and gives information about them like title, image size, etc.
Uses http://whatisthisfile.appspot.com/ via XMLRPC
Example:
19:20 <@raspi> http://www.youtube.com/watch?v=9RZ-hYPAMFQ
19:20 <@bot> Title: "YouTube - B... | Python |
# jsb/plugs/common/learn.py
#
#
""" learn information items .. facts .. factoids. """
## jsb imports
from jsb.lib.callbacks import callbacks
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.utils.lazydict import LazyDict
from jsb.lib.persist import PlugPersist
## basic imports
impo... | Python |
# jsb/plugs/common/googletranslate.py
#
#
# author: melmoth
""" use google translate. """
## jsb imports
from jsb.lib.examples import examples
from jsb.lib.commands import cmnds
from jsb.utils.url import geturl2
from jsb.imports import getjson
## basic imports
import re
from urllib import quote
## defines
URL = ... | Python |
# jsb/plugs/common/shop.py
#
#
""" maitain a shopping list (per user). """
## jsb imports
from jsb.utils.generic import getwho, jsonstring
from jsb.lib.users import users
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.utils.pdol import Pdol
## basic imports
import os
## function... | Python |
# jsb/plugs/common/url.py
#
#
""" maintain log of urls. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.lib.callbacks import callbacks
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persiststate import PlugState
## basic imports
import re
import o... | Python |
# jsb/plugs/common/ipcalc.py
#
# IP subnet calculator
# (c) 2007 Wijnand 'tehmaze' Modderman - http://tehmaze.com
# BSD License
""" IP subnet calculator. this module allows you to perform network calculations. """
"""
# IP subnet calculator
# (C) 2007 Wijnand 'tehmaze' Modderman - http://tehmaze.com
# BSD License
#
... | Python |
# jsb/plugs/common/gcalc.py
# encoding: utf-8
#
#
""" use google to calculate e.g. !gcalc 1 + 1 """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.utils.url import useragent
## basic imports
import urllib2
## gcalc command
def handle_gcalc(bot,... | Python |
# jsb/plugs/common/idle.py
#
#
""" show how long someone has been idle. """
## jsb imports
from jsb.utils.timeutils import elapsedstring
from jsb.utils.generic import getwho
from jsb.lib.commands import cmnds
from jsb.lib.callbacks import callbacks
from jsb.lib.examples import examples
from jsb.lib.persist import Pl... | Python |
# jsb/plugs/common/remind.py
#
#
""" remind people .. say txt when somebody gets active """
## jsb imports
from jsb.utils.generic import getwho
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.callbacks import callbacks
from jsb.lib.persist import PlugPersist
## basic imports
i... | Python |
# jsb/plugs/common/koffie.py
#
# Made by WildRover and Junke1990
""" schenk wat koffie! """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## basic imports
import os
import string
import random
## defines
koffie = []
thee = []
bier = []
wijn = []
fris = []
taart = []
koek... | Python |
# jsb/plugs/common/watcher.py
#
#
""" watch channels. channels events can be of remote origin. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.callbacks import callbacks, remote_callbacks, last_callbacks, first_callbacks
from jsb.lib.persist import PlugPersist
from jsb.lib.fleet import getfleet
fr... | Python |
# jsb/plugs/common/twitter.py
#
#
""" a twitter plugin for the JSONBOT. uses tweepy oauth. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.utils.pdol import Pdol
from jsb.utils.textutils import html_unescape
from js... | Python |
# jsb/plugs/common/8b.py
#
#
""" run the eight ball. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## basic imports
import re
import random
## defines
balltxt=[
"Signs point to yes.",
"Yes.",
"Most likely."... | Python |
# jsb/plugs/common/karma.py
#
#
""" karma plugin. """
## jsb imports
from jsb.lib.callbacks import callbacks
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persist import PlugPersist
from jsb.utils.statdict import StatDict
## basic imports
import logging
import re
## defines... | Python |
# jsb common plugins
#
#
""" this package contains all the plugins common to all drivers. """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__.... | Python |
# jsb/plugs/common/todo.py
#
#
""" manage todo lists per users .. a time/data string can be provided to set
time on a todo item.
"""
## jsb imports
from jsb.utils.generic import getwho
from jsb.utils.timeutils import strtotime, striptime, today
from jsb.utils.locking import lockdec
from jsb.utils.exception impo... | Python |
# jsb/plugs/common/quote.py
#
#
""" manage quotes. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.lib.persist import PlugPersist
## basic imports
import random
## defines
quotes = PlugPersist('quotes.data')
if not quotes.data.index:
quotes.data.index = 0... | Python |
# jsb/plugs/gae/gae.py
#
#
""" Google Application Engine related commands. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## gae-flushcache command
def handle_gaeflushcache(bot, ievent):
""" flush the cache .. flush all with no arguments otherwise delete specific. "... | Python |
# jsb basic plugins
#
#
""" register all .py files """
import os
(f, tail) = os.path.split(__file__)
__all__ = []
for i in os.listdir(f):
if i.endswith('.py'):
__all__.append(i[:-3])
elif os.path.isdir(f + os.sep + i) and not i.startswith('.'):
__all__.append(i)
try:
__all__.remove('__i... | Python |
# jsb/imports.py
#
#
""" provide a import wrappers for the contrib packages. """
## lib imports
from lib.jsbimport import _import
## basic imports
import logging
## getjson function
def getjson():
try:
import wave
mod = _import("jsb.contrib.simplejson")
except ImportError:
try: mo... | Python |
# jsb/datadir.py
#
#
""" the data directory of the bot. """
## jsb imports
from jsb.utils.source import getsource
## basic imports
import re
import os
import shutil
import logging
import os.path
import getpass
## the global datadir
try: homedir = os.path.abspath(os.path.expanduser("~"))
except: homedir = os.getc... | Python |
# jsb/users.py
#
#
""" bot's users in JSON file. NOT USED AT THE MOMENT. """
## lib imports
from jsb.utils.exception import handle_exception, exceptionmsg
from jsb.utils.generic import stripped
from jsb.utils.name import stripname
from persiststate import UserState
from persist import Persist
from jsb.utils.lazydic... | Python |
# jsb/gozerevent.py
#
#
"""
basic event used in jsb. supports json dumping and loading plus toxml
functionality.
"""
## jsb imports
from jsb.utils.url import striphtml
from jsb.lib.eventbase import EventBase
## dom imports
from jsb.contrib.xmlstream import NodeBuilder, XMLescape, XMLunescape
## for exce... | Python |
# gozerbot/morphs.py
#
#
""" convert input/output stream. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.trace import calledfrom
## basic imports
import sys
import logging
## Morph claas
class Morph(object):
""" transform stream. """
def __init__(self, func):
... | Python |
# jsb/reboot.py
#
#
""" reboot code. """
## jsb imports
from jsb.lib.fleet import getfleet
from jsb.imports import getjson
json = getjson()
## basic imports
import os
import sys
import pickle
import tempfile
import logging
## reboot function
def reboot():
""" reboot the bot. """
logging.warn("reboot - re... | Python |
# jsb/botbase.py
#
#
""" base class for all bots. """
## jsb imports
from jsb.utils.exception import handle_exception
from runner import defaultrunner, callbackrunner, waitrunner
from eventhandler import mainhandler
from jsb.utils.lazydict import LazyDict
from plugins import plugs as coreplugs
from callbacks import ... | Python |
# jsb/exit.py
#
#
""" jsb's finaliser """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.trace import whichmodule
from runner import defaultrunner, cmndrunner, callbackrunner, waitrunner
## basic imports
import atexit
import os
import time
import sys
import logging
## functions
de... | Python |
# jsb/gatekeeper.py
#
#
""" keep a whitelist of allowed entities based on userhost. """
## jsb imports
from jsb.lib.persist import Persist
from jsb.lib.datadir import getdatadir
## basic imports
import logging
import os
## GateKeeper class
class GateKeeper(Persist):
""" keep a whitelist of allowed entities ... | Python |
# jsb/outputcache.py
#
#
## jsb imports
from persist import Persist
from jsb.utils.name import stripname
from datadir import getdatadir
from jsb.utils.timeutils import hourmin
## basic imports
import os
import logging
import time
## clear function
def clear(target):
""" clear target's outputcache. """
cac... | Python |
# jsb/tick.py
#
#
""" provide system wide clock tick. """
## jsb imports
from jsb.lib.threadloop import TimedLoop
from jsb.lib.eventbase import EventBase
from jsb.lib.callbacks import callbacks
## TickLoop class
class TickLoop(TimedLoop):
def start(self, bot=None):
""" start the loop. """
sel... | Python |
# jsb/less.py
#
#
""" maintain bot output cache. """
# jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.limlist import Limlist
## google imports
try:
from google.appengine.api.memcache import get, set, delete
except ImportError:
from jsb.lib.cache import get, set, delete
## basi... | Python |
# jsb/channelbase.py
#
#
""" provide a base class for channels. """
## jsb imports
from jsb.utils.name import stripname
from jsb.utils.lazydict import LazyDict
from jsb.lib.persist import Persist
from jsb.lib.datadir import getdatadir
from jsb.utils.trace import whichmodule
from jsb.lib.errors import NoChannelProvid... | Python |
# jsb/plugins.py
#
#
""" holds all the plugins. plugins are imported modules. """
## jsb imports
from commands import cmnds
from callbacks import callbacks, remote_callbacks, first_callbacks, last_callbacks
from eventbase import EventBase
from persist import Persist
from jsb.utils.lazydict import LazyDict
from jsb.u... | Python |
# jsb/eventbase.py
#
#
""" base class of all events. """
## jsb imports
from channelbase import ChannelBase
from jsb.utils.lazydict import LazyDict
from jsb.utils.generic import splittxt, stripped, waitforqueue
from errors import NoSuchUser
from jsb.utils.opts import makeeventopts
from jsb.utils.trace import whichm... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.