code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/python
#
# Copyright (C) 2008 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) 2007 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) 2007, 2008 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 applicabl... | Python |
#!/usr/bin/python
#
# Copyright (C) 2007, 2008 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 applicabl... | Python |
#!/usr/bin/python
#
# Copyright (C) 2007 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) 2007 SIOS Technology, 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 appli... | Python |
#!/usr/bin/python
#
# Copyright (C) 2007 SIOS Technology, 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 appli... | Python |
#!/usr/bin/python
#
# Copyright (C) 2007 SIOS Technology, 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 appli... | Python |
#!/usr/bin/python
#
# Copyright (C) 2007 SIOS Technology, 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 appli... | Python |
#!/usr/bin/python
#
# Copyright (C) 2008 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 |
# -*-*- encoding: utf-8 -*-*-
#
# This is gdata.photos.exif, implementing the exif namespace in gdata
#
# $Id: __init__.py 81 2007-10-03 14:41:42Z havard.gulldahl $
#
# Copyright 2007 Håvard Gulldahl
# Portions copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not... | Python |
#!/usr/bin/env python
# -*-*- encoding: utf-8 -*-*-
#
# This is the service file for the Google Photo python client.
# It is used for higher level operations.
#
# $Id: service.py 144 2007-10-25 21:03:34Z havard.gulldahl $
#
# Copyright 2007 Håvard Gulldahl
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | Python |
# -*-*- encoding: utf-8 -*-*-
#
# This is the base file for the PicasaWeb python client.
# It is used for lower level operations.
#
# $Id: __init__.py 148 2007-10-28 15:09:19Z havard.gulldahl $
#
# Copyright 2007 Håvard Gulldahl
# Portions (C) 2006 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "L... | Python |
#!/usr/bin/env python
# -*-*- encoding: utf-8 -*-*-
#
# This is the service file for the Google Photo python client.
# It is used for higher level operations.
#
# $Id: service.py 144 2007-10-25 21:03:34Z havard.gulldahl $
#
# Copyright 2007 Håvard Gulldahl
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | Python |
#!/usr/bin/python
#
# Copyright (C) 2006 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) 2006 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 |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-formed X... | Python |
import cgi
import datetime
import wsgiref.handlers
import gdata.service
from src.handlers.welcome import Welcome
from src.handlers.auth import AuthHandler
from src.handlers.test import *
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
application = ... | Python |
import cgi
import datetime
import wsgiref.handlers
import gdata.service
from src.Authenticator import Authenticator
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
class AuthHandler(webapp.RequestHandler):
def get(self):
newT... | Python |
import wsgiref.handlers
from src.BeautifulSoup import BeautifulSoup
from google.appengine.api import urlfetch
from google.appengine.ext import webapp
class Test(webapp.RequestHandler):
def get(self):
self.response.out.write("<ul>")
self.response.out.write(r"<li><a href=""/testCrawler"">Test... | Python |
import cgi
import os
import datetime
import wsgiref.handlers
import gdata.service
from src.Authenticator import Authenticator
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
class User... | Python |
from google.appengine.ext import db
class Profile(db.Model):
user = db.UserProperty()
token = db.StringProperty(required = False) | Python |
import urllib
import gdata.service
import gdata.alt.appengine
from src.Profile import Profile
from google.appengine.ext import db
class Authenticator(object):
# constants
TOKEN_SCOPE = "http://docs.google.com/feeds/"
HOST_NAME = "usverg-er.appspot.com"
BACK_HANDLER = "auth"
#privat... | Python |
# commonplugs/todo.py
#
#
""" manage todo lists per users .. a time/data string can be provided to set
time on a todo item.
"""
## gozerlib imports
from gozerlib.utils.generic import getwho
from gozerlib.utils.timeutils import strtotime, striptime, today
from gozerlib.utils.locking import lockdec
from gozerlib.... | Python |
# plugs/gcalc.py
# encoding: utf-8
#
#
""" use google to calculate e.g. !gcalc 1 + 1 """
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.examples import examples
## basic imports
import urllib2
## commands
def handle_gcalc(bot, ievent):
if len(ievent.args) > 0:
expr = " ".join(i... | Python |
# waveplugs/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.
"""
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.examples import examples
from gozerlib.contrib import feedparser
from goze... | Python |
# IP subnet calculator
# (c) 2007 Wijnand 'tehmaze' Modderman - http://tehmaze.com
# BSD License
from gozerlib.commands import cmnds
from gozerlib.examples import examples
""" IP subnet calculator. this module allows you to perform network
calculations.
"""
"""
# IP subnet calculator
# (C) 2007 Wijnand 'tehmaze... | Python |
# commonplugs/remote.py
#
#
""" events passed as json over xmpp. """
## gozerbot imports
from gozerlib.callbacks import callbacks
from gozerlib.utils.url import posturl, getpostdata
from gozerlib.persist import PlugPersist
from gozerlib.commands import cmnds
from gozerlib.examples import examples
from gozerlib.utils... | Python |
# commonplugs/relay.py
#
#
""" relay to other users/channels/waves. """
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.callbacks import callbacks
from gozerlib.persist import PlugPersist
from gozerlib.examples import examples
from gozerlib.fleet import fleet
from gozerlib.utils.exception impor... | Python |
# commonplugs/8b.py
#
#
""" run the eight ball. """
## gozerlib imports
from gozerlib.utils.exception import handle_exception
from gozerlib.commands import cmnds
from gozerlib.examples import examples
## basic imports
import re
import random
## defines
balltxt=[
"Signs point to yes.",
"Yes.",
"Most l... | Python |
# plugs/wikipedia.py
#
#
""" query wikipedia .. use countrycode to select a country specific wikipedia. """
## gozerlib imports
from gozerlib.utils.url import geturl, striphtml
from gozerlib.utils.generic import splittxt, handle_exception, fromenc
from gozerlib.commands import cmnds
from gozerlib.examples import exa... | Python |
# feedprovider 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('.'):
... | Python |
# waveplugs/watcher.py
#
#
""" watch waves through xmpp. a wave is called a channel here. """
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.callbacks import callbacks, gn_callbacks
from gozerlib.persist import PlugPersist
from gozerlib.fleet import fleet
from gozerlib.utils.exception import h... | Python |
# commonplugs/tinyurl.py
#
#
""" tinyurl.com feeder """
__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ = 'BSD'
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.utils.url import striphtml, useragent
from gozerlib.examples import examples
## google imports
try:
... | Python |
# waveplugs/ask.py
#
#
""" ask a jabber user a question and relay back the response. """
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.callbacks import callbacks
from gozerlib.persist import PlugPersist
from gozerlib.examples import examples
from gozerlib.fleet import fleet
## basic imports
... | Python |
# waveplugs/gadget.py
#
#
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.examples import examples
from gozerlib.persist import PlugPersist
gadgeturls = PlugPersist('gadgeturls')
gadgeturls.data['gadget'] = 'https://feedprovider.appspot.com/gadget.xml'
gadgeturls.data['poll'] = 'https://feedpr... | Python |
# feedprovider 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... | Python |
# waveplugs/clone.py
#
#
""" clone the wave after x blips. """
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.callbacks import callbacks
from gozerlib.gae.wave.waves import Wave
from gozerlib.plugins import plugs
## basic imports
import logging
## callbacks
def clonecallback(bot, event):
... | Python |
# waveplugs/wave.py
#
#
""" wave related commands. """
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.examples import examples
from gozerlib.utils.exception import handle_exception
from gozerlib.persist import PlugPersist
from gozerlib.callbacks import callbacks
from gozerlib.plugins import pl... | Python |
# handler_hubbub.py
#
#
## gozerlib imports
from gozerlib.contrib import feedparser
from gozerlib.utils.generic import getversion
from gozerlib.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.appen... | Python |
# handler_remote.py
#
#
""" FEEDPROVIDER Remote Events Network. """
import time
starttime = time.time()
## gozerlib imports
from gozerlib.remote.bot import RemoteBot
from gozerlib.remote.event import RemoteEvent
from gozerlib.utils.generic import fromenc, toenc, getversion
from gozerlib.utils.xmpp import stripped
... | 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/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/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 |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | Python |
import simplejson
import cgi
class JSONFilter(object):
def __init__(self, app, mime_type='text/x-json'):
self.app = app
self.mime_type = mime_type
def __call__(self, environ, start_response):
# Read JSON POST input to jsonfilter.json if matching mime type
response = {'status': ... | Python |
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
from scanner import make_scanner
try:
from _speedups import scanstring as c_scanstring
except ImportError:
c_scanstring = None
__all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconstants():
_BYTES = '... | Python |
"""Implementation of JSONEncoder
"""
import re
try:
from _speedups import encode_basestring_ascii as \
c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from _speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
from decoder... | 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 |
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 |
#!/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 |
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/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/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 (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/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/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 (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/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.
"""Run robot from the commandline for testing.
This robot_runner let's you define event handlers using flags and takes the
json input from the std in and writes out the json output to stdout.
for example
cat events | commandline_robot_runner.... | Python |
# handler_xmpp.py
#
#
""" xmpp request handler. """
# set start time
import time
starttime = time.time()
## gozerlib imports
from gozerlib.utils.generic import fromenc, toenc, getversion
from gozerlib.utils.lazydict import LazyDict
from gozerlib.utils.exception import handle_exception
from gozerlib.plugins import... | Python |
# handler_wave.py
#
#
""" this handler handles all the wave jsonrpc requests. """
## gozerlib imports
from gozerlib.utils.generic import getversion
from gozerlib.config import cfg
from gozerlib.errors import NoSuchCommand
## gaelib imports
from gozerlib.gae.wave.bot import WaveBot
## basic imports
import logging... | Python |
# handler_web.py
#
#
""" web request handler. """
import time
import logging
starttime = time.time()
#logging.debug('start time: %s' % time.ctime(time.time()))
## gozerlib imports
from gozerlib.utils.generic import fromenc, toenc, getversion
from gozerlib.utils.xmpp import stripped
from gozerlib.plugins import plu... | Python |
# handler_task.py
#
#
""" feedprovider task handler. """
## gozerlib imports
from gozerlib.plugins import plugs
from gozerlib.utils.generic import getversion
from gozerlib.utils.exception import handle_exception
from gozerlib.tasks import taskmanager
## google imports
from google.appengine.ext import webapp
from g... | Python |
# handler_gadgetexec.py
#
#
""" feedprovider exec handler. just return the results in a <div>. """
## gozerlib imports
from gozerlib.utils.generic import fromenc, toenc, getversion
from gozerlib.utils.xmpp import stripped
from gozerlib.plugins import plugs
from gozerlib.persist import Persist
from gozerlib.utils.ex... | Python |
"""JSON token scanner
"""
import re
def _import_c_make_scanner():
try:
from simplejson._speedups import make_scanner
return make_scanner
except ImportError:
return None
c_make_scanner = _import_c_make_scanner()
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))... | Python |
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
from simplejson.scanner import make_scanner
def _import_c_scanstring():
try:
from simplejson._speedups import scanstring
return scanstring
except ImportError:
return None
c_scanstring = _import_c_scanstring()
__all... | Python |
"""Implementation of JSONEncoder
"""
import re
from decimal import Decimal
def _import_speedups():
try:
from simplejson import _speedups
return _speedups.encode_basestring_ascii, _speedups.make_encoder
except ImportError:
return None, None
c_encode_basestring_ascii, c_make_encoder = _im... | 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 |
import unittest
import doctest
class OptionalExtensionTestSuite(unittest.TestSuite):
def run(self, result):
import simplejson
run = unittest.TestSuite.run
run(self, result)
simplejson._toggle_speedups(False)
run(self, result)
simplejson._toggle_speedups(True)
... | 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 |
#!/usr/bin/env python
#
#
from setuptools import setup
import glob
import os
upload = []
def uploadlist(dir):
upl = []
for file in os.listdir(dir):
if not file or file.startswith('.'):
continue
d = dir + os.sep + file
if os.path.isdir(d):
#upload.append(di... | Python |
# socketplugs/remoteserver.py
#
#
## gozerlib imports
from gozerlib.callbacks import callbacks
from gozerlib.utils.url import posturl, getpostdata
from gozerlib.persiststate import PlugState
from gozerlib.commands import cmnds
from gozerlib.socket.irc.monitor import outmonitor
from gozerlib.socket.rest.server import ... | Python |
# socketplugs/restserver.py
#
#
## gozerlib imports
from gozerlib.callbacks import callbacks
from gozerlib.utils.url import posturl, getpostdata
from gozerlib.persistconfig import PersistConfig
from gozerlib.commands import cmnds
from gozerlib.socket.irc.monitor import outmonitor
from gozerlib.socket.rest.server impo... | Python |
# feedprovider 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('.'):
... | Python |
import unittest | Python |
# gozerlib/fleet.py
#
#
""" fleet is a list of bots. """
## gozerlib imports
from utils.exception import handle_exception
from utils.generic import waitforqueue
from config import Config
from config import cfg as mainconfig
from users import users
from plugins import plugs
from persist import Persist
from errors imp... | Python |
# gozerlib/config.py
#
#
""" config module. """
## gozerlib imports
from utils.trace import whichmodule
from utils.lazydict import LazyDict
from utils.exception import handle_exception
from datadir import datadir
from errors import CantSaveConfig
## simplejson imports
from simplejson import loads, dumps
## basic ... | Python |
# gozerbot/persistconfig.py
#
#
""" allow data to be pickled to disk .. creating the persisted object
restores data.
usage:
!plug-cfg -> shows list of all config
!plug-cfg key value -> sets value to key
!plug-cfg key -> shows list of key
!plug-cfg key add value -> adds value to list
!p... | Python |
# gozerlib/remote/bot.py
#
#
""" remote bot. handlers incoming nodes. """
## gozerlib imports
from gozerlib.utils.url import posturl, getpostdata
from gozerlib.botbase import BotBase
from event import RemoteEvent, Container
import logging
class RemoteBot(BotBase):
""" RemoteBot broadcasts events through HTTP ... | Python |
# gozerlib/remote/event.py
#
#
""" gozerlib remote event. """
## gozerlib imports
from gozerlib.eventbase import EventBase
from gozerlib.utils.generic import splittxt
from gozerlib.utils.lazydict import LazyDict
## simplejson imports
from simplejson import loads
## basic imports
import cgi
import logging
import ... | Python |
# gozerlib/outputcache.py
#
#
## gozerlib imports
from persist import Persist
from utils.name import stripname
## basic imports
import os
## functions
def add(target, txtlist):
cache = Persist('outputcache' + os.sep + stripname(target))
d = cache.data
if not d.has_key('msg'):
d['msg'] = []
... | Python |
# gozerlib/threads.py
#
#
""" own threading wrapper. """
## lib imports
from utils.exception import handle_exception
## basic imports
import threading
import re
import time
import thread
import logging
## defines
# regular expression to determine thread name
methodre = re.compile('method\s+(\S+)', re.I)
funcre = r... | Python |
# gozerlib/sockets/utils/generic.py
#
#
""" generic functions """
## gozerlib imports
from gozerlib.persist import Persist
from gozerlib.utils.exception import handle_exception
from gozerlib.utils.trace import calledfrom
from gozerlib.config import cfg as config
from gozerlib.utils.lazydict import LazyDict
## simp... | Python |
# gozerbot/rest/server.py
#
#
## gozerlib imports
from gozerlib.utils.exception import handle_exception, exceptionmsg
from gozerlib.utils.trace import calledfrom
from gozerlib.config import cfg as config
from gozerlib.persiststate import ObjectState
from gozerlib.threads import start_new_thread
# basic imports
from... | Python |
# gozerlib/rest/client.py
#
#
""" Rest Client class """
## gozerlib imports
from gozerlib.utils.url import geturl3, geturl4, posturl, deleteurl, useragent
from gozerlib.utils.generic import toenc
from gozerlib.utils.exception import handle_exception, exceptionmsg
from gozerlib.utils.locking import lockdec
from gozer... | Python |
# gozerlib/socket/partyline.py
#
#
""" provide partyline functionality .. manage dcc sockets. """
__copyright__ = 'this file is in the public domain'
__author__ = 'Aim'
## gozerlib imports
from gozerlib.utils.exception import handle_exception
from gozerlib.threads import start_new_thread
## simplejson import
fro... | Python |
# gozerlib/socket/irc/bot.py
#
#
#
"""
a bot object handles the dispatching of commands and check for callbacks
that need to be fired.
"""
## gozerlib imports
from gozerlib.utils.exception import handle_exception
from gozerlib.utils.generic import waitforqueue, uniqlist, strippedtxt
from gozerlib.commands ... | Python |
# gozerbot/wait.py
#
#
""" wait for ircevent based on ircevent.CMND """
## gozerbot imports
from gozerlib.utils.locking import lockdec
import gozerlib.threads as thr
## basic imports
import time
import thread
## locks
waitlock = thread.allocate_lock()
locked = lockdec(waitlock)
## classes
class Wait(object):
... | Python |
# gozerbot/ircevent.py
#
#
# http://www.irchelp.org/irchelp/rfc/rfc2812.txt
""" an ircevent is extracted from the IRC string received from the server. """
__copyright__ = 'this file is in the public domain'
## gozerbot imports
from gozerlib.socket.utils.generic import fix_format, toenc, fromenc, stripident, makearg... | 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.