code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
# -*- coding: utf-8 -*-
Python
# -*- coding: utf-8 -*- # This file is part of tWMS. # tWMS is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # tWMS is di...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
# -*- coding: utf-8 -*-
Python
# -*- coding: utf-8 -*- from twms import projections from libkomapnik import pixel_size_at_zoom import json import psycopg2 from mapcss import MapCSS import cgi import os import sys reload(sys) sys.setdefaultencoding("utf-8") # a hack to support UTF-8 try: import psyco psyco.full() except ImportError: p...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of kothic, the realtime map renderer. # kothic is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # ...
Python
import wmi TEMPATTR = 194 # the number of the temperature attribute c = wmi.WMI(namespace='root/wmi') for drive in c.MSStorageDriver_ATAPISmartData(): # strip out parts of the name to make it more readable. driveName = drive.InstanceName.split('_')[1] # The first byte of the array is the ...
Python
# -*- coding: utf-8 -*- # Windows WMI SQL (WQL) # Network information # # http://msdn.microsoft.com/en-us/library/aa394084(VS.85).aspx # http://python.net/crew/mhammond/win32/ # # raspi 2008 import sys try: import win32com.client except ImportError: sys.exit("you can has epic fail") wmi = win32co...
Python
from subprocess import * p = Popen(["netstat", "-an"], bufsize=1024,stdin=PIPE, stdout=PIPE, close_fds=True) (fin, fout) = (p.stdin, p.stdout) for i in range(10): fin.write("line" + str(i)) fin.wr...
Python
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
Python
from Vector import * from Ray import * from math import sqrt class Sphere: c = Vector() r = 1 hit = [] def __init__(self, _c=[0,0,0], r=1): self.c = Vector(_c) self.r = r hit = [] def __str__(self): return "%s, r=%f" % (str(self.c), self.r) def Intersect(self, r): ...
Python
from math import sqrt class Vector: # x,y,z c = [] # ---------------------------------------------------------------------------- def __init__(self, _c=[0,0,0]): self.c = _c def __str__(self): return str(self.c) def Clear(self): self.__init__() # -----------------------------------...
Python
from array import array from random import * class Framebuffer: stack = [] def __init__(self): stack = [] def Create(self, w = 800, h = 600): try: buffer = array('B') for i in range(0, w*h*3): buffer.append(0) self.stack.append([buffer,w,h,None]) return...
Python
from Framebuffer import * from Ray import * from Sphere import * s = Sphere([400,300,-10], 100) ray = Ray() def trace(x,y,r,g,b,px): global s ray.o.c[0] = x ray.o.c[1] = y if (s.Intersect(ray) == True): px[r],px[g],px[b] = [255,255,255] f = Framebuffer() slot = f.Create(1280, 720...
Python
from Vector import * class Ray: o,d = Vector(),Vector() def __init__(self, _o=[0,0,0], _d=[0,0,-1]): self.o = Vector(_o) self.d = Vector(_d) def __str__(self): return "Ray %s %s" % (str(self.o), str(self.d)) def P(self,t): return self.o + t * self.d
Python
from Vector import * from Ray import * class Triangle: A,B,C = Vector(),Vector(),Vector() hit = [0] def __init__(self, _A=[0,0,0], _B=[1,0,0], _C=[0,1,0]): self.A = Vector(_A) self.B = Vector(_B) self.C = Vector(_C) hit = [0] def Intersect(self, r): return False
Python
#!/usr/bin/python # Copyright 2011 Google, Inc. All Rights Reserved. # simple script to walk source tree looking for third-party licenses # dumps resulting html page to stdout import os, re, mimetypes, sys # read source directories to scan from command line SOURCE = sys.argv[1:] # regex to find /* */ style commen...
Python
# Helper to set a breakpoint in App Engine. Requires Python >= 2.5. import os import pdb import sys class MyPdb(pdb.Pdb): def default(self, line): # Save/set + restore stdin/stdout around self.default() call. # (This is only needed for Python 2.5.) save_stdout = sys.stdout save_stdin = sys.stdin ...
Python
def webapp_add_wsgi_middleware(app): try: from google.appengine.ext.appstats import recording except ImportError, err: logging.info('Failed to import recording: %s', err) else: app = recording.appstats_wsgi_middleware(app) return app appstats_KEY_DISTANCE = 10 appstats_MAX_REPR = 1000 appstats_MAX_...
Python
# Startup file for interactive prompt, used by "make python". from ndb import utils utils.tweak_logging() import os from google.appengine.api import apiproxy_stub_map from google.appengine.api import datastore_file_stub from google.appengine.api import memcache from google.appengine.api.memcache import memcache_stub...
Python
"""Tests for eventloop.py.""" import os import time import unittest from google.appengine.datastore import datastore_rpc from ndb import eventloop, test_utils class EventLoopTests(test_utils.DatastoreTest): def setUp(self): super(EventLoopTests, self).setUp() if eventloop._EVENT_LOOP_KEY in os.environ: ...
Python
"""Higher-level Query wrapper. There are perhaps too many query APIs in the world. The fundamental API here overloads the 6 comparisons operators to represent filters on property values, and supports AND and OR operations (implemented as functions -- Python's 'and' and 'or' operators cannot be overloaded, and the '&'...
Python
"""An event loop. This event loop should handle both asynchronous App Engine RPC objects (specifically urlfetch and datastore RPC objects) and arbitrary callback functions with an optional time delay. Normally, event loops are singleton objects, though there is no enforcement of this requirement. The API here is ins...
Python
"""A tasklet decorator. Tasklets are a way to write concurrently running functions without threads; tasklets are executed by an event loop and can suspend themselves blocking for I/O or some other operation using a yield statement. The notion of a blocking operation is abstracted into the Future class, but a tasklet ...
Python
"""Tests for query.py.""" import os import re import sys import time import unittest from google.appengine.api import apiproxy_stub_map from google.appengine.api import datastore_errors from google.appengine.api import datastore_file_stub from google.appengine.api.memcache import memcache_stub from google.appengine.d...
Python
"""Tests for key.py.""" import base64 import pickle import unittest from google.appengine.api import datastore_errors from google.appengine.datastore import entity_pb from ndb import key class KeyTests(unittest.TestCase): def testShort(self): k0 = key.Key('Kind', None) self.assertEqual(k0.flat(), ['Kind'...
Python
"""Model and Property classes and associated stuff. A model class represents the structure of entities stored in the datastore. Applications define model classes to indicate the structure of their entities, then instantiate those model classes to create entities. All model classes must inherit (directly or indirectl...
Python
"""Tests for context.py.""" import logging import os import re import sys import time import unittest from google.appengine.api import datastore_errors from google.appengine.api import memcache from google.appengine.api import taskqueue from google.appengine.datastore import datastore_rpc from ndb import context fro...
Python
"""Some tests for datastore_rpc.py.""" import unittest from google.appengine.api import apiproxy_stub_map from google.appengine.api import datastore_file_stub from google.appengine.datastore import entity_pb from google.appengine.datastore import datastore_rpc from ndb import key, model, test_utils class PendingTes...
Python
"""The Key class, and associated utilities. A Key encapsulates the following pieces of information, which together uniquely designate a (possible) entity in the App Engine datastore: - an application id (a string) - a namespace (a string) - a list of one or more (kind, id) pairs where kind is a string and id is eit...
Python
import logging import os import sys def wrapping(wrapped): # A decorator to decorate a decorator's wrapper. Following the lead # of Twisted and Monocle, this is supposed to make debugging heavily # decorated code easier. We'll see... # TODO: Evaluate; so far it hasn't helped (nor hurt). def wrapping_wrappe...
Python
"""Tests for model.py.""" import base64 import datetime import difflib import pickle import re import unittest from google.appengine.api import datastore_errors from google.appengine.api import datastore_types from google.appengine.api import namespace_manager from google.appengine.api import users from google.appeng...
Python
# This file intentionally left blank.
Python
"""Context class.""" # TODO: Handle things like request size limits. E.g. what if we've # batched up 1000 entities to put and now the memcache call fails? import logging import sys from google.appengine.api import datastore # For taskqueue coordination from google.appengine.api import datastore_errors from google....
Python
"""Tests for tasklets.py.""" import os import re import random import sys import time import unittest from google.appengine.api import apiproxy_stub_map from google.appengine.api import datastore_file_stub from google.appengine.datastore import datastore_rpc from ndb import eventloop from ndb import model from ndb ...
Python
"""A simple guestbook app to test parts of NDB end-to-end.""" import cgi import logging import re import sys import time from google.appengine.api import urlfetch from google.appengine.api import users from google.appengine.datastore import entity_pb from google.appengine.ext import webapp from google.appengine.ext.w...
Python
from google.appengine.ext import webapp from google.appengine.ext.webapp import util from ndb import model class Greeting(model.Model): message = model.StringProperty() userid = model.IntegerProperty() # Not used here, but later class HomePage(webapp.RequestHandler): def get(self): msg = Greeting...
Python
"""Quick hack to (a) demo the synchronous APIs and (b) dump all records.""" import time from demo.main import model, context, tasklets, Message, Account, account_key class LogRecord(model.Model): timestamp = model.FloatProperty() @context.toplevel def main(): print 'Content-type: text/plain' print qry = M...
Python
# This file intentionally left blank.
Python
# -*- coding: utf-8 -*- from django.conf.urls.defaults import * rootpatterns = patterns('', (r'^xnmemo/', include('apps.xnmemo.urls')), )
Python
# -*- coding: utf-8 -*- from django.db.models import permalink, signals from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import force_unicode,smart_str from google.appengine.ext import db from django.contrib.auth.models import User import re
Python
# -*- coding: utf-8 -*- from django.conf.urls.defaults import * urlpatterns = patterns('apps.xnmemo.views', #~ (r'^$', 'xnmemo_index'), (r'^has_scheduled_items/$', 'has_scheduled_items'), (r'^get_items/$', 'get_items'), (r'^update_item/$', 'update_item'), (r'^skip_item/$', 'skip_item'), (r'^mar...
Python
from django import template register = template.Library() def get_deck_id(deck): '''Workaround for deck._id''' return deck._id get_deck_id = register.filter(get_deck_id)
Python
#!/usr/bin/python # -*- coding: utf-8 -*- import unittest class RangeList(): @staticmethod def encode(_list): if len(_list) == 0: return [] _list.sort() rangelist = [] prev = _list[0] start = end = prev for i in _list[1:]: if i == prev+1:...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2010 Bill Chen <pro711@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later ver...
Python
from django.contrib import admin
Python
# -*- coding: utf-8 -*- from django.conf.urls.defaults import * rootpatterns = patterns('', (r'^dbbuilder/', include('apps.dbbuilder.urls')), )
Python
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from google.appengine.ext import db
Python
# -*- coding: utf-8 -*- from django.conf.urls.defaults import * urlpatterns = patterns('apps.dbbuilder.views', #~ (r'^$', 'xnmemo_index'), (r'^import/$', 'db_import'), (r'^fix_deck_info/$', 'fix_deck_info'), (r'^remove_duplicates/$', 'remove_duplicates'), #~ (r'^(?P<lesson_id>\d+)/$', 'lesson_detai...
Python
# -*- coding: utf-8 -*- import os,logging,csv,codecs,cStringIO from django.http import HttpResponseRedirect,Http404,HttpResponseForbidden,HttpResponse,HttpResponseNotFound from django.views.decorators.http import require_GET, require_POST from django.utils.translation import ugettext as _ from ragendja.template import...
Python
# -*- coding: utf-8 -*- # # Copyright (C) 2010 Bill Chen <pro711@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later ver...
Python
# -*- coding: utf-8 -*- # # Copyright 2010 Bill Chen <pro711@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any lat...
Python
# -*- coding: utf-8 -*- from django import forms from django.contrib.auth.models import User from django.core.files.uploadedfile import UploadedFile from django.utils.translation import ugettext_lazy as _, ugettext as __ from ragendja.auth.models import UserTraits from ragendja.forms import FormWithSets, FormSetField f...
Python
# -*- coding: utf-8 -*- from django.http import HttpResponseRedirect from django.utils.translation import ugettext as _ from ragendja.template import render_to_response
Python
# -*- coding: utf-8 -*- from ragendja.settings_pre import * DEBUG = True # Increase this when you update your media on the production site, so users # don't have to refresh their cache. By setting this your MEDIA_URL # automatically becomes /media/MEDIA_VERSION/ MEDIA_VERSION = 1 # By hosting media on a different dom...
Python
# -*- coding: utf-8 -*- from django.conf.urls.defaults import * from ragendja.urlsauto import urlpatterns from ragendja.auth.urls import urlpatterns as auth_patterns from apps.core.forms import UserRegistrationForm from apps.core.item import Item from django.contrib import admin admin.autodiscover() handler500 = 'rag...
Python
from ragendja.settings_post import settings if not hasattr(settings, 'ACCOUNT_ACTIVATION_DAYS'): settings.ACCOUNT_ACTIVATION_DAYS = 30
Python
from django.conf.urls.defaults import * rootpatterns = patterns('', (r'^account/', include('registration.urls')), )
Python
import datetime import random import re import sha from google.appengine.ext import db from django.conf import settings from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.db import models from django.template.loader import render_to_string from django.utils.translatio...
Python
""" Forms and validation code for user registration. """ from django.contrib.auth.models import User from django import forms from django.utils.translation import ugettext_lazy as _ from registration.models import RegistrationProfile # I put this on all required fields, because it's easier to pick up # on them wit...
Python
""" Unit tests for django-registration. These tests assume that you've completed all the prerequisites for getting django-registration running in the default setup, to wit: 1. You have ``registration`` in your ``INSTALLED_APPS`` setting. 2. You have created all of the templates mentioned in this application's doc...
Python
""" URLConf for Django user registration and authentication. If the default behavior of the registration views is acceptable to you, simply use a line like this in your root URLConf to set up the default URLs for registration:: (r'^accounts/', include('registration.urls')), This will also automatically set up th...
Python
""" A management command which deletes expired accounts (e.g., accounts which signed up but never activated) from the database. Calls ``RegistrationProfile.objects.delete_expired_users()``, which contains the actual logic for determining which accounts are deleted. """ from django.core.management.base import NoArgsC...
Python
""" Views which allow users to create and activate accounts. """ from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from registration.forms import Registr...
Python
from django.contrib import admin from registration.models import RegistrationProfile class RegistrationAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'activation_key_expired') search_fields = ('user__username', 'user__first_name') admin.site.register(RegistrationProfile, RegistrationAdmin)
Python
from django.dispatch import Signal # A new user has registered. user_registered = Signal(providing_args=["user"]) # A user has activated his or her account. user_activated = Signal(providing_args=["user"])
Python
#!/usr/bin/env python if __name__ == '__main__': from common.appenginepatch.aecmd import setup_env setup_env(manage_py_env=True) # Recompile translation files from mediautils.compilemessages import updatemessages updatemessages() # Generate compressed media files for manage.py update impor...
Python
#! /usr/bin/python import sys import os # executable base_feature_dir refactor_feature_dir subdir_to_be_refactored files_to_be_refactored def foo(): flagsvn = 0 flagcp = 0 if len(sys.argv) < 5: print "Usage: " + sys.argv[0] + " [-cp] <fromdir> <todir> <hierarchy> <files>" sys.exit() c...
Python
#! /usr/bin/python import sys import os # executable base_feature_dir refactor_feature_dir subdir_to_be_refactored files_to_be_refactored def foo(): flagsvn = 0 flagcp = 0 if len(sys.argv) < 5: print "Usage: " + sys.argv[0] + " [-cp] <fromdir> <todir> <hierarchy> <files>" sys.exit() c...
Python
#!/usr/bin/env python # # target = "jsb" # BHJTW change this to /var/cache/jsb on debian import os try: from setuptools import setup except ImportError: from distutils.core import setup print "TARGET IS %s" % target upload = [] def uploadfiles(dir): upl = [] if not os.path.isdir(dir): print "%s do...
Python
# handler_dispatch.py # # """ jsb dispatch handler. dispatches remote commands. """ ## boot from jsb.lib.boot import boot boot() ## jsb imports from jsb.utils.generic import fromenc, toenc from jsb.version import getversion from jsb.utils.xmpp import stripped from jsb.utils.url import getpostdata, useragent from...
Python
# -*- coding: utf-8 -*- """ webapp2 ======= Taking Google App Engine's webapp to the next level! :copyright: 2010 by tipfy.org. :license: Apache Sotware License, see LICENSE for details. """ import logging import re import urllib import urlparse from google.appengine.ext import webapp from google...
Python
# handler_docs.py # # """ xmpp request handler. """ ## jsb imports from jsb.utils.exception import handle_exception from jsb.version import getversion ## google imports import webapp2 ## basic imports import sys import time import types import logging ## greet logging.warn(getversion('REDIRECT')) ## classes ...
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/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
"""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
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
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 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
"""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
#!/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
#!/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