code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Python |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Python |
import cgi
import urllib
import time
import random
import urlparse
import hmac
import base64
VERSION = '1.0' # Hi Blaine!
HTTP_METHOD = 'GET'
SIGNATURE_METHOD = 'PLAINTEXT'
# Generic exception class
class OAuthError(RuntimeError):
def __init__(self, message='OAuth error occured.'):
self.message = message
... | Python |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
#!/usr/bin/python2.4
#
# Copyright 2009 Google Inc. All Rights Reserved.
"""Tests for google3.walkabout.externalagents.api.commandline_robot_runner."""
__author__ = 'douwe@google.com (Douwe Osinga)'
import StringIO
from google3.pyglib import app
from google3.pyglib import flags
from google3.testing.pybase import g... | Python |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Python |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Python |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Python |
# handler_xmpp.py
#
#
""" xmpp request handler. """
## jsb imports
from jsb.utils.generic import fromenc, toenc
from jsb.version import getversion
from jsb.utils.lazydict import LazyDict
from jsb.utils.exception import handle_exception
from jsb.lib.plugins import plugs
from jsb.lib.boot import boot, plugin_packages
... | Python |
# handler_warmup.py
#
#
""" xmpp request handler. """
## jsb imports
from jsb.version import getversion
## google imports
import webapp2
## basic imports
import sys
import time
import types
import logging
## greet
logging.warn(getversion('WARMUP'))
## classes
class WarmupHandler(webapp2.RequestHandler):
... | Python |
# handler_hubbub.py
#
#
## jsb imports
from jsb.contrib import feedparser
from jsb.version import getversion
from jsb.lib.plugins import plugs
## google imports
from google.appengine.api import urlfetch
from google.appengine.api import xmpp
from google.appengine.ext import db
from google.appengine.ext import webapp... | Python |
# handler_web.py
#
#
""" web request handler. """
import time
import logging
## jsb imports
from jsb.version import getversion
from jsb.utils.exception import handle_exception
from jsb.lib.channelbase import ChannelBase
## gaelib import
from jsb.utils.gae.auth import finduser
from jsb.utils.gae.web import start, ... | Python |
# handler_wave.py
#
#
""" this handler handles all the wave jsonrpc requests. """
## jsb imports
from jsb.version import getversion
from jsb.lib.errors import NoSuchCommand
from jsb.lib.boot import boot
## gaelib imports
from jsb.drivers.gae.wave.bot import WaveBot
## basic imports
import logging
import os
## d... | Python |
# jsb/upload/handler_openid.py
#
#
""" Openid handler. """
## jsb imports
from jsb.utils.gae.web import loginurl
from jsb.version import getversion
from jsb.utils.exception import handle_exception
from jsb.utils.lazydict import LazyDict
## google imports
from google.appengine.api import users
import webapp2 as web... | Python |
# handler_task.py
#
#
""" jsb task handler. """
## jsb imports
from jsb.lib.plugins import plugs
from jsb.version import getversion
from jsb.utils.exception import handle_exception
from jsb.lib.tasks import taskmanager
## google imports
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util ... | 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/utils/trace.py
#
#
""" trace related functions """
## basic imports
import sys
import os
## defines
stopmarkers = ['waveapi', 'jsb', 'myplugs', 'python2.5', 'python2.6']
## calledfrom function
def calledfrom(frame):
""" return the plugin name where given frame occured. """
try:
filename = f... | Python |
# jsb/utils/opts.py
#
#
""" options related functions. """
## jsb imports
from jsb.lib.errors import NameNotSet
from jsb.lib.config import Config
from jsb.version import getversion
from jsb.utils.name import stripname
## basic imports
import os
import uuid
import logging
import optparse
## EventOptionParser class... | Python |
# jsb/utils/mainloop.py
#
#
""" main loop used in jsb binairies. """
## jsb imports
from jsb.lib.eventhandler import mainhandler
from jsb.lib.exit import globalshutdown
## basic imports
import os
import time
## mainloop function
def mainloop():
""" function to be used as mainloop. """
while 1:
tr... | Python |
# jsb/utils/locking.py
#
#
""" locking functions """
## jsb imports
from exception import handle_exception
from trace import whichmodule
from lockmanager import lockmanager, rlockmanager
from jsb.lib.threads import getname
## generic imports
import logging
import sys
## Locked-class
class Locked(object):
""... | Python |
# jsb/utils/rsslist.py
#
#
""" create a list of rss data """
## jsb imports
from exception import handle_exception
## basic imports
import xml.dom.minidom
## gettext function
def gettext(nodelist):
""" get text data from nodelist """
result = ""
for node in nodelist:
if node.nodeType == node.... | Python |
# gozerbot/dol.py
#
#
""" dict of lists """
class Dol(dict):
""" dol is dict of lists """
def insert(self, nr, item, issue):
""" add issue to item entry """
if self.has_key(item): self[item].insert(nr, issue)
else: self[item] = [issue]
return True
def add(self, item, iss... | Python |
# jsb/utils/statdict.py
#
#
""" dictionairy to keep stats. """
## jsb imports
from jsb.utils.lazydict import LazyDict
## classes
class StatDict(LazyDict):
""" dictionary to hold stats """
def set(self, item, value):
""" set item to value """
self[item] = value
def upitem(self, item, ... | Python |
# jsb/utils/id.py
#
#
""" id related functions. """
## jsb imports
from jsb.utils.generic import toenc
## basic imports
import uuid
## getrssid function
def getrssid(url, time):
""" get an id based on url and time. """
key = unicode(url) + unicode(time)
return str(uuid.uuid3(uuid.NAMESPACE_DNS, toenc... | Python |
# jsb/utils/format.py
#
#
""" provide formatting functions. """
## jsb imports
from jsb.utils.name import stripname
from jsb.utils.url import striphtml
from jsb.utils.lazydict import LazyDict
## basic imports
import time
import os
import logging
from datetime import datetime
## formats
# Formats are defined here.... | Python |
# jsb/utils/lockmanager.py
#
#
""" manages locks """
## basic imports
import thread
import threading
import logging
## LockManager class
class LockManager(object):
""" place to hold locks """
def __init__(self):
self.locks = {}
try:
import waveapi
self.gae = True
... | Python |
# jsb/utils/generic.py
#
#
""" generic functions. """
## lib imports
from exception import handle_exception
from trace import calledfrom, whichmodule
from lazydict import LazyDict
from jsb.imports import getjson
json = getjson()
## generic imports
from stat import ST_UID, ST_MODE, S_IMODE
import time
import sys
i... | Python |
# jsb/utils/log.py
#
#
""" log module. """
## basic imports
import logging
import logging.handlers
import os
import os.path
import getpass
## defines
LEVELS = {'debug': logging.DEBUG,
'info': logging.INFO,
'warning': logging.WARNING,
'warn': logging.WARNING,
'error': logging... | Python |
# jsb/utils/textutils.py
#
#
## basic imports
import cgi
import re
import htmlentitydefs
## unescape_charref function
def unescape_charref(ref):
""" ask maze. """
name = ref[2:-1]
base = 10
if name.startswith("x"):
name = name[1:]
base = 16
return unichr(int(name, base))
... | Python |
# gozerbot/pdol.py
#
#
""" pickled dict of lists """
## jsb imports
from jsb.lib.persist import Persist
## Pdol class
class Pdol(Persist):
""" pickled dict of lists """
def __init__(self, fname):
Persist.__init__(self, fname)
if not self.data: self.data = {}
def __iter__(self, name):... | Python |
# jsb/utils/exception.py
#
#
""" exception related functions. """
## basic imports
import sys
import traceback
import logging
import thread
import os
import logging
## defines
exceptionlist = []
exceptionevents = []
ERASE_LINE = '\033[2K'
BOLD='\033[1m'
RED = '\033[91m'
YELLOW = '\033[93m'
GREEN = '\033[92m'
ENDC... | Python |
# jsb/utils/source.py
#
#
""" get the location of a source """
## basic imports
import os
import logging
## getsource function
def getsource(mod):
source = None
splitted = mod.split(".")
if len(splitted) == 1: splitted.append("")
try:
import pkg_resources
source = pkg_resources.reso... | Python |
# jsb/utils/url.py
#
# most code taken from maze
""" url related functions. """
## jsb imports
from generic import fromenc, toenc
## basic imports
import logging
import time
import sys
import re
import traceback
import Queue
import urllib
import urllib2
import urlparse
import socket
import random
import os
import ... | Python |
# jsb/utils/xmpp.py
#
#
""" XMPP related helper functions. """
def stripped(userhost):
""" strip resource from userhost. """
return userhost.split('/')[0]
def resource(userhost):
""" return resource of userhost. """
try: return userhost.split('/')[1]
except ValueError: return ""
| Python |
# lib/utils/timeutils.py
#
#
""" time related helper functions. """
## jsb imports
from exception import handle_exception
## basic imports
import time
import re
import calendar
## defines
leapfactor = float(6*60*60)/float(365*24*60*60)
timere = re.compile('(\S+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\d+)')
bdmo... | Python |
# jsb/utils/twitter.py
#
#
""" twitter related helper functions .. uses tweepy. """
## tweepy imports
from jsb.contrib.tweepy.auth import OAuthHandler
from jsb.contrib.tweepy.api import API
from jsb.contrib.tweepy import oauth
## basic imports
import logging
## defines
go = True
## twitterapi function
def t... | Python |
# jsb/utils/popen.py
#
#
""" popen helper functions. """
## defines
go = False
## basic imports
try:
from subprocess import Popen, PIPE
from locking import lockdec
import thread, StringIO, logging, types
go = True
except: go = False
if go:
## locks
popenlock = thread.allocate_lock()
... | Python |
# jsb/utils/fileutils.py
#
# Description: Various file utilities
# Author: Wijnand 'tehmaze' Modderman
# Author URL: http://tehmaze.com
# License: BSD
""" provide file related helpers. """
## jsb imports
from jsb.utils.generic import istr
## basic imports
import tarfile
import os
import types
import cStringIO
impo... | Python |
# jsb/utils/lazydict.py
#
# thnx to maze
""" a lazydict allows dotted access to a dict .. dict.key. """
## jsb imports
from jsb.utils.locking import lockdec
from jsb.utils.exception import handle_exception
from jsb.utils.trace import whichmodule
from jsb.lib.errors import PropertyIgnored
from jsb.imports import getj... | Python |
# gozerbot/pdod.py
#
#
""" pickled dicts of dicts """
## jsb imports
from jsb.utils.lazydict import LazyDict
from jsb.lib.persist import Persist
## Pdod class
class Pdod(Persist):
""" pickled dicts of dicts """
def __init__(self, filename):
Persist.__init__(self, filename)
if not self.dat... | Python |
# jsb/utils/web.py
#
#
""" google auth related functions. """
## jsb imports
from jsb.utils.trace import whichmodule
## finduser
def finduser():
""" try to find the email of the current logged in user. """
from google.appengine.api import users as gusers
user = gusers.get_current_user()
if user: re... | Python |
# jsb/utils/web.py
#
#
""" web related functions. """
## jsb imports
from jsb.utils.generic import fromenc
from jsb.version import getversion
from jsb.lib.config import Config
from jsb.utils.lazydict import LazyDict
## gaelib imports
from auth import finduser
## basic imports
import os
import time
import socket
... | Python |
# jsb/utils/limlist.py
#
#
""" limited list """
class Limlist(list):
""" list with limited number of items """
def __init__(self, limit):
self.limit = limit
list.__init__(self)
def insert(self, index, item):
""" insert item at index .. pop oldest item if limit is reached """
... | Python |
# jsb/utils/name.py
#
#
"""
name related helper functions.
google requirements on file names:
- It must contain only letters, numbers, _, +, /, $, ., and -.
- It must be less than 256 chars.
- It must not contain "/./", "/../", or "//".
- It must not end in "/".
- All spaces must be in the middle of a direc... | Python |
#!/usr/bin/env python
"""Universal feed parser
Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
Visit http://feedparser.org/ for the latest version
Visit http://feedparser.org/docs/ for the latest documentation
Required: Python 2.1 or later
Recommended: Python 2.3 or later
Recommended: CJKCodecs... | Python |
## xmlstream.py
##
## Copyright (C) 2001 Matthew Allum
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published
## by the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## ... | Python |
"""
The MIT License
Copyright (c) 2007 Leah Culver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from urllib2 import Request, urlopen
import base64
import oauth
from error import TweepError
from api import API
class AuthHandler(object):
def apply_auth(self, url, method, headers, parameters):
"""Apply authentication headers ... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
class TweepError(Exception):
"""Tweepy exception"""
def __init__(self, reason, response=None):
self.reason = str(reason)
self.response = response
def __str__(self):
return self.reason
| Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from error import TweepError
from utils import parse_datetime, parse_html_value, parse_a_href, parse_search_datetime, unescape_html
class ResultSet(list):
"""A list like object that holds results from a Twitter API query."""
class Model(... | Python |
"""
The MIT License
Copyright (c) 2007 Leah Culver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from models import ModelFactory
from utils import import_simplejson
class Parser(object):
def parse(self, method, payload):
"""
Parse the response payload and return the result.
Returns a tuple that contains the r... | Python |
# Tweepy
# Copyright 2010 Joshua Roesslein
# See LICENSE for details.
from datetime import datetime
import time
import htmlentitydefs
import re
import locale
def parse_datetime(string):
# Set locale for date parsing
loc = locale.getlocale()
locale.setlocale(locale.LC_TIME, 'C')
# We must parse datet... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import httplib
import urllib
import time
import re
from error import TweepError
from utils import convert_to_utf8_str
re_path_template = re.compile('{\w+}')
def bind_api(**config):
class APIMethod(object):
path = config['path'... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
"""
Tweepy Twitter API library
"""
__version__ = '1.7.1'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
from models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory
from error import TweepError
from ... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import httplib
from socket import timeout
from threading import Thread
from time import sleep
import urllib
from auth import BasicAuthHandler
from models import Status
from api import API
from error import TweepError
from utils import import_... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import os
import mimetypes
from binder import bind_api
from error import TweepError
from parsers import ModelParser
from utils import list_to_csv
class API(object):
"""Twitter API"""
def __init__(self, auth_handler=None,
... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from error import TweepError
class Cursor(object):
"""Pagination helper class"""
def __init__(self, method, *args, **kargs):
if hasattr(method, 'pagination_mode'):
if method.pagination_mode == 'cursor':
... | Python |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import time
import threading
import os
import cPickle as pickle
try:
import hashlib
except ImportError:
# python 2.4
import md5 as hashlib
try:
import fcntl
except ImportError:
# Probably on a windows system
# TODO: us... | Python |
# -*- coding: utf-8 -*-
"""
requests.core
~~~~~~~~~~~~~
This module implements the main Requests system.
:copyright: (c) 2011 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
from __future__ import absolute_import
import urllib
import urllib2
from urllib2 import HTTPError
fro... | Python |
# -*- coding: utf-8 -*-
"""
requests.async
~~~~~~~~~~~~~~
This module implements the main Requests system, after monkey-patching
the urllib2 module with eventlet or gevent..
:copyright: (c) 2011 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
from __future__ import absolu... | Python |
# -*- coding: utf-8 -*-
import packages
from core import *
from core import __version__
| Python |
"""Implementation of JSONEncoder
"""
import re
from decimal import Decimal
def _import_speedups():
return None, None
c_encode_basestring_ascii, c_make_encoder = _import_speedups()
from jsb.contrib.simplejson.decoder import PosInf
ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"]... | Python |
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
from jsb.contrib.simplejson.scanner import make_scanner
def _import_c_scanstring():
return None
c_scanstring = _import_c_scanstring()
__all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconstants():
_BYTES... | Python |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | Python |
r"""Command-line tool to validate and pretty-print JSON
Usage::
$ echo '{"json":"obj"}' | python -m simplejson.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m simplejson.tool
Expecting property name: line 1 column 2 (char 2)
"""
import sys
import simplejson as json
def main():
... | Python |
"""JSON token scanner
"""
import re
def _import_c_make_scanner():
return None
c_make_scanner = _import_c_make_scanner()
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scanner(context):
parse_object ... | Python |
"""Drop-in replacement for collections.OrderedDict by Raymond Hettinger
http://code.activestate.com/recipes/576693/
"""
from UserDict import DictMixin
# Modified from original to support Python 2.4, see
# http://code.google.com/p/simplejson/issues/detail?id=53
try:
all
except NameError:
def all(seq):
... | Python |
"""
A pure python (slow) implementation of rijndael with a decent interface
To include -
from rijndael import rijndael
To do a key setup -
r = rijndael(key, block_size = 16)
key must be a string of length 16, 24, or 32
blocksize must be 16, 24, or 32. Default is 16
To use -
ciphertext = r.encrypt(plaintext)
plai... | Python |
#!/usr/bin/env python
#
# Copyright under the latest Apache License 2.0
'''A class the inherits everything from python-twitter and allows oauth based access
Requires:
python-twitter
simplejson
oauth
'''
__author__ = "Hameedullah Khan <hameed@hameedkhan.net>"
__version__ = "0.2"
from jsb.contrib.twitter impo... | Python |
# jsb/version.py
#
#
""" version related stuff. """
## jsb imports
from jsb.lib.datadir import getdatadir
## basic imports
import os
## defines
version = "0.7 RELEASE"
## getversion function
def getversion(txt=""):
""" return a version string. """
try: tip = open(getdatadir() + os.sep + "TIP", 'r').rea... | Python |
# jsb/lib/convore/event.py
#
#
""" convore event. """
## jsb imports
from jsb.utils.locking import lockdec
from jsb.lib.eventbase import EventBase
from jsb.utils.lazydict import LazyDict
from jsb.imports import getjson
## basic imports
import logging
import thread
## defines
json = getjson()
## locks
parselock... | Python |
# jsb/lib/convore/bot.py
#
#
""" convore bot. """
## jsb import
from jsb.lib.botbase import BotBase
from jsb.lib.errors import NotConnected
from jsb.drivers.convore.event import ConvoreEvent
from jsb.utils.lazydict import LazyDict
from jsb.utils.exception import handle_exception
from jsb.imports import getjson, getr... | Python |
# jsb/console/event.py
#
#
""" a console event. """
## jsb imports
from jsb.lib.eventbase import EventBase
from jsb.lib.channelbase import ChannelBase
from jsb.lib.errors import NoInput
## basic imports
import getpass
import logging
import re
## ConsoleEvent class
class ConsoleEvent(EventBase):
def __deepco... | Python |
# jsb/console/bot.py
#
#
""" console bot. """
## jsb imports
from jsb.lib.datadir import getdatadir
from jsb.utils.generic import waitforqueue
from jsb.lib.errors import NoSuchCommand, NoInput
from jsb.lib.botbase import BotBase
from jsb.lib.exit import globalshutdown
from jsb.utils.generic import strippedtxt, waite... | Python |
# jsb/socklib/irc/irc.py
#
#
"""
an Irc object handles the connection to the irc server .. receiving,
sending, connect and reconnect code.
"""
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.generic import toenc, fromenc
from jsb.utils.generic import getrandomnick, strippedtx... | Python |
# gozerbot/ircevent.py
#
#
# http://www.irchelp.org/irchelp/rfc/rfc2812.txt
""" an ircevent is extracted from the IRC string received from the server. """
## jsb imports
from jsb.utils.generic import toenc, fromenc, strippedtxt, fix_format
from jsb.lib.eventbase import EventBase
## basic imports
import time
import... | Python |
# gozerbot/channels.py
#
#
"""
channel related data. implemented with a persisted dict of dicts.
:example:
key = channels[event.channel]['key']
"""
## jsb imports
from jsb.utils.pdod import Pdod
class Channels(Pdod):
"""
channels class .. per channel data.
:param fna... | Python |
# jsb/socklib/irc/bot.py
#
#
#
"""
a bot object handles the dispatching of commands and check for callbacks
that need to be fired.
"""
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.generic import waitforqueue, uniqlist, strippedtxt
from jsb.lib.commands import cmnds
from js... | Python |
# gozerbot/socket/xmpp/presence.py
#
#
""" Iq. """
## jsb imports
from jsb.lib.eventbase import EventBase
from jsb.utils.trace import whichmodule
from jsb.lib.gozerevent import GozerEvent
## basic imports
import logging
import time
## Iq class
class Iq(GozerEvent):
def __init__(self, nodedict={}):
... | Python |
# jsb/socklib/xmpp/message.py
#
#
""" jabber message definition .. types can be normal, chat, groupchat,
headline or error
"""
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.utils.trace import whichmodule
from jsb.utils.generic import toenc, fromenc, jabberstrip
from jsb.utils.locking... | Python |
# jsb/socklib/xmpp/core.py
#
#
"""
this module contains the core xmpp handling functions.
"""
## jsb imports
from jsb.lib.eventbase import EventBase
from jsb.lib.config import Config
from jsb.utils.generic import toenc, jabberstrip, fromenc
from jsb.utils.lazydict import LazyDict
from jsb.utils.exception import... | Python |
# jsb/socklib/xmpp/JID.py
#
#
""" JID related helpers. """
## classes
class InvalidJID(BaseException):
pass
class JID(object):
""" class representing a JID. """
def __init__(self, str):
if not str:
self.full = ""
self.user = ""
self.userhost = ""
... | Python |
# jsb/socklib/xmpp/errors.py
#
#
""" xmpp error codes. """
xmpperrors = {'400': 'Bad Request',
'401': 'Unauthorized',
'402': 'Payment Required',
'403': 'Forbidden',
'404': 'Not Found',
'405': 'Not Allowed',
'406': 'Not Acceptable',
... | Python |
# gozerbot/xmpp/namespace.py
#
#
## CONSTANTS
attributes = {}
subelements = {}
attributes['message'] = ['type', 'from', 'to', 'id']
subelements['message'] = ['subject', 'body', 'error', 'thread', 'x']
attributes['presence'] = ['type', 'from', 'to', 'id']
subelements['presence'] = ['show', 'status', 'priority', 'x']... | Python |
# jsb/socklib/xmpp/wait.py
#
#
""" wait for ircevent based on ircevent.CMND """
## jsb imports
from jsb.utils.locking import lockdec
from jsb.lib.wait import Wait
import jsb.lib.threads as thr
## basic imports
import time
import thread
import logging
## locks
waitlock = thread.allocate_lock()
locked = lockdec(wa... | Python |
# jsb/socklib/xmpp/presence.py
#
#
""" Presence. """
# jsb imports
from jsb.lib.eventbase import EventBase
from jsb.utils.trace import whichmodule
from jsb.lib.gozerevent import GozerEvent
## basic imports
import time
import logging
## classes
class Presence(GozerEvent):
def __init__(self, nodedict={}):
... | Python |
# jsb/socklib/xmpp/bot.py
#
#
""" jabber bot definition """
## jsb imports
from jsb.lib.users import users
from jsb.utils.exception import handle_exception
from jsb.utils.trace import whichmodule
from jsb.utils.locking import lockdec
from jsb.utils.pdod import Pdod
from jsb.utils.dol import Dol
from jsb.utils.generi... | Python |
# jsb/web/event.py
#
#
""" web event. """
## jsb imports
from jsb.lib.eventbase import EventBase
from jsb.utils.generic import splittxt, fromenc, toenc
from jsb.utils.xmpp import stripped
from jsb.lib.outputcache import add
from jsb.utils.url import getpostdata
from jsb.utils.exception import handle_exception
from j... | Python |
# jsb/gae/web/bot.py
#
#
""" GAE web bot. """
## jsb imports
from jsb.lib.botbase import BotBase
from jsb.lib.outputcache import add
from jsb.utils.generic import toenc, fromenc, strippedtxt
from jsb.utils.url import re_url_match
from jsb.utils.timeutils import hourmin
from jsb.lib.channelbase import ChannelBase
##... | Python |
# jsb/gae/wave/event.py
#
#
""" google wave events. """
## jsb imports
from jsb.lib.eventbase import EventBase
from jsb.utils.exception import handle_exception
from jsb.utils.gae.auth import finduser
from jsb.drivers.gae.wave.waves import Wave
## basic imports
import logging
import cgi
import re
import time
## d... | Python |
# jsb/wave/waves.py
#
#
""" class to repesent a wave. """
## jsb imports
from jsb.lib.channelbase import ChannelBase
from jsb.utils.exception import handle_exception
from jsb.utils.locking import lockdec
from jsb.utils.generic import strippedtxt, toenc, fromenc
## basic imports
import logging
import copy
import os... | Python |
# jsb/wave/bot.py
#
#
""" google wave bot. """
## jsb imports
from jsb.lib.persist import Persist
from jsb.lib.botbase import BotBase
from jsb.lib.plugins import plugs
from jsb.version import getversion
from jsb.lib.callbacks import callbacks
from jsb.lib.outputcache import add
from jsb.lib.config import Config, get... | Python |
# jsb/gae/tasks.py
#
#
""" appengine tasks related classes and functions. """
## jsb imports
from jsb.utils.exception import handle_exception
## google imports
from google.appengine.api.labs.taskqueue import Task, Queue
## simplejson imports
from jsb.imports import getjson
json = getjson()
## basic imports
imp... | Python |
# gaelib/xmpp/event.py
#
#
""" an xmpp event. """
## jsb imports
from jsb.lib.eventbase import EventBase
from jsb.utils.xmpp import stripped, resource
from jsb.utils.lazydict import LazyDict
from jsb.utils.gae.auth import checkuser
from jsb.utils.generic import strippedtxt
## xmpp import
from jsb.contrib.xmlstrea... | 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.