code
stringlengths
1
1.72M
language
stringclasses
1 value
#! /usr/bin/env python """Token constants (from "token.h").""" # Taken from Python (r53757) and modified to include some tokens # originally monkeypatched in by pgen2.tokenize #--start constants-- ENDMARKER = 0 NAME = 1 NUMBER = 2 STRING = 3 NEWLINE = 4 INDENT = 5 DEDENT = 6 LPAR = 7 RPAR = 8 LSQB = 9 RSQB = 10 C...
Python
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation. # All rights reserved. """Tokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line o...
Python
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. # Pgen imports import grammar, token, tokenize class PgenGrammar(grammar.Grammar): pass class ParserGenerator(object): def __init__(self, filename, stream=None): close_stream = None ...
Python
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """This module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also ...
Python
"""An implementation of the Zephyr Abstract Syntax Definition Language. See http://asdl.sourceforge.net/ and http://www.cs.princeton.edu/~danwang/Papers/dsl97/dsl97-abstract.html. Only supports top level module decl, not view. I'm guessing that view is intended to support the browser and I'm not interested in the br...
Python
#! /usr/bin/env python """Generate JS code from an ASDL description.""" # TO DO # handle fields that have a type but no name import os, sys import asdl TABSIZE = 4 MAX_COL = 80 def get_c_type(name): """Return a string for the C name of the type. This function special cases the default types provided by as...
Python
# Copyright (c) 1998-2002 John Aycock # # 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
#!/usr/bin/env python ''' Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework. This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests ...
Python
s = """Gur Mra bs Clguba, ol Gvz Crgref Ornhgvshy vf orggre guna htyl. Rkcyvpvg vf orggre guna vzcyvpvg. Fvzcyr vf orggre guna pbzcyrk. Pbzcyrk vf orggre guna pbzcyvpngrq. Syng vf orggre guna arfgrq. Fcnefr vf orggre guna qrafr. Ernqnovyvgl pbhagf. Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf. Nygubhtu cenpg...
Python
# JSLint doesn't allow/support disabling the requirement for braces around # blocks, and that's one uglification I refuse to perform in the service of a # lint. # # There are of course lots of other intelligent things JSLint has to say # because it's just too easy in JS to do something that (e.g.) IE won't like. # So, ...
Python
# San Angeles Observation # Original C version Copyright 2004-2005 Jetro Lauha # Web: http://iki.fi/jetro/ # # BSD-license. # # Javascript version by Ken Waters # Skulpt (Python) version by Scott Graham import webgl ShapeParams = [ # m a b n1 n2 n3 m a b n1 n2 n3 res1...
Python
from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import os from django.utils import simplejson from google.appengine.ext import db class MainPage(webapp.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/html' path = os.pat...
Python
import sys import webgl import webgl.primitives import webgl.models import webgl.matrix4 as m4 def main(): print "Starting up..." gl = webgl.Context("canvas") sh = webgl.Shader(gl, VertexShader, FragmentShader) sh.use() m = webgl.models.Model(sh, webgl.primitives.createCube(1), []) eyePos...
Python
""" quick hack script to convert from quake2 .bsp to simple format to draw. drops most information. keeps only raw polys and lightmaps. makes .blv and .llv file (big and little endian level) file format is 'BLV1' or 'LLV1' int texwidth int texheight int numtris float startx, starty, s...
Python
"""reST directive for syntax-highlighting ipython interactive sessions. XXX - See what improvements can be made based on the new (as of Sept 2009) 'pycon' lexer for the python console. At the very least it will give better highlighted tracebacks. """ #-----------------------------------------------------------------...
Python
import sys, os, shutil, imp, warnings, cStringIO, re import IPython from IPython.Shell import MatplotlibShell try: from hashlib import md5 except ImportError: from md5 import md5 from docutils.parsers.rst import directives import sphinx sphinx_version = sphinx.__version__.split(".") # The split is necessar...
Python
import sys, os try: from setuptools import setup except ImportError: from distutils.core import setup version = '0.1.1' setup( name='pykml', version=version, packages=['pykml',], package_dir={'': 'src'}, package_data={ 'pykml': [ 'schemas/*.xsd', 'test/*.py'...
Python
""" pyKML Utility Module The pykml.utility module provides utility functions that operate on KML documents """ import re def clean_xml_string(input_string): '''removes invalid characters from an XML string''' from curses import ascii return ''.join(c for c in input_string if ascii.isascii(c)) def format...
Python
"""pyKML Helpers Module The pykml.helpers module contains 'helper' functions that operate on pyKML document objects for accomplishing common tasks. """ from pykml.factory import KML_ElementMaker as K from pykml.factory import GX_ElementMaker as GX def separate_namespace(qname): "Separates the namespace from th...
Python
'''pyKML Factory Module The pykml.factory module provides objects and functions that can be used to create KML documents element-by-element. The factory module leverages `lxml's ElementMaker factory`_ objects to create KML objects with the appropriate namespace prefixes. .. _lxml: http://lxml.de .. _lxml's ElementM...
Python
'''pyKML Parser Module The pykml.parser module provides functions that can be used to parse KML from a file or remote URL. ''' import sys import os import urllib2 from lxml import etree, objectify OGCKML_SCHEMA = 'http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd' class Schema(): "A class representing an XML Sc...
Python
import unittest from test_factory import * from test_helpers import * from test_parser import * from test_util import * if __name__ == '__main__': unittest.main()
Python
#!/usr/bin/python import sys import getopt from pykml.parser import parse from pykml.parser import Schema from pykml.factory import write_python_script_for_kml_document class Usage(Exception): def __init__(self, msg): self.msg = msg def main(argv=None): if argv is None: argv = sys.argv try...
Python
#!/usr/bin/env python '''Generate a KML document of a tour based on a KML linestring. ''' from pykml.parser import parse from pykml.factory import nsmap from pykml.factory import KML_ElementMaker as KML from pykml.factory import GX_ElementMaker as GX from pykml.parser import Schema from lxml import etree # define var...
Python
#!/usr/bin/env python '''Generate a KML document of a tour based on rotating around locations. ''' from pykml.factory import nsmap from pykml.factory import KML_ElementMaker as KML from pykml.factory import GX_ElementMaker as GX from pykml.parser import Schema from lxml import etree # define a variable for the Google...
Python
#!/usr/bin/env python '''Example of generating transitions between camera locations using splines Note that this example requires the scipy package http://pypi.python.org/pypi/scipy References: ''' from datetime import time, datetime from time import mktime from lxml import etree from pykml.factory import KML_E...
Python
#!/usr/bin/python from lxml import etree from pykml.factory import KML_ElementMaker as KML doc = KML.kml( KML.Placemark( KML.name('Hello World!'), KML.Point( KML.coordinates('-91.35,0,0'), ), ), ) print etree.tostring(etree.ElementTree(doc),pretty_print=True)
Python
#!/usr/bin/python from lxml import etree from pykml.factory import KML_ElementMaker as KML from math import cos, sin, radians kmlobj = KML.kml( KML.Document() ) for i in range(0,360*2,10): kmlobj.Document.append( KML.Placemark( KML.name('Hello World!'), KML.Point( ...
Python
#!/usr/bin/python # a Python script that uses pyKML to create a Hello World example from lxml import etree from pykml.factory import KML_ElementMaker as KML text = 'Hello World!' # create a document element with a single label style kmlobj = KML.kml( KML.Document( KML.Style( KML.LabelStyle( ...
Python
#!/usr/bin/python from lxml import etree from pykml.factory import KML_ElementMaker as KML from math import cos, sin, radians text = 'Hello World! ' kmlobj = KML.kml( KML.Document() ) for i in range(0,103): char = text[i % len(text)] if char != ' ': kmlobj.Document.append( KML.Placema...
Python
#!/usr/bin/python from lxml import etree from pykml.factory import KML_ElementMaker as KML from math import cosh text = 'Hello World!' kmlobj = KML.kml( KML.Document() ) lon1 = -90.18527061414699 lat1 = 38.62381763642669 lon2 = -90.18462877742689 lat2 = 38.62537095459039 # dimensions from: http://en.wikipedia.o...
Python
#!/usr/bin/python # example virtual base jump import math from lxml import etree from pykml.parser import Schema from pykml.factory import KML_ElementMaker as kml from pykml.factory import ATOM_ElementMaker as atom from pykml.factory import GX_ElementMaker as gx GX_ns = "{http://www.google.com/kml/ext/2.2}" def dran...
Python
#!/usr/bin/env python '''Generate a KML string that matches the altitudemode example. References: http://code.google.com/apis/kml/documentation/kmlreference.html#gxaltitudemode http://code.google.com/apis/kml/documentation/kmlfiles/altitudemode_reference.kml ''' from lxml import etree from pykml.parser import Schema ...
Python
#!/usr/bin/env python '''Generate a KML string that matches the animated update example. References: http://code.google.com/apis/kml/documentation/kmlreference.html#gxanimatedupdate http://code.google.com/apis/kml/documentation/kmlfiles/animatedupdate_example.kml Note that as of 12/1/2010, the KML code displayed bene...
Python
#!/usr/bin/env python '''Example of generating KML from data in a CSV file References: ''' import csv import urllib2 from datetime import datetime from lxml import etree from pykml.factory import KML_ElementMaker as KML def makeExtendedDataElements(datadict): '''Converts a dictionary to ExtendedData/Data elemen...
Python
#!/usr/bin/python2.6 # # Simple http server to emulate api.playfoursquare.com import logging import shutil import sys import urlparse import SimpleHTTPServer import BaseHTTPServer class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """Handle playfoursquare.com requests, for testing.""" def do_GET(self...
Python
#!/usr/bin/python import os import subprocess import sys BASEDIR = '../main/src/com/joelapenna/foursquare' TYPESDIR = '../captures/types/v1' captures = sys.argv[1:] if not captures: captures = os.listdir(TYPESDIR) for f in captures: basename = f.split('.')[0] javaname = ''.join([c.capitalize() for c in basena...
Python
#!/usr/bin/python """ Pull a oAuth protected page from foursquare. Expects ~/.oget to contain (one on each line): CONSUMER_KEY CONSUMER_KEY_SECRET USERNAME PASSWORD Don't forget to chmod 600 the file! """ import httplib import os import re import sys import urllib import urllib2 import urlparse import user from xml....
Python
#!/usr/bin/python import datetime import sys import textwrap import common from xml.dom import pulldom PARSER = """\ /** * Copyright 2009 Joe LaPenna */ package com.joelapenna.foursquare.parsers; import com.joelapenna.foursquare.Foursquare; import com.joelapenna.foursquare.error.FoursquareError; import com.joel...
Python
#!/usr/bin/python import logging from xml.dom import minidom from xml.dom import pulldom BOOLEAN = "boolean" STRING = "String" GROUP = "Group" # Interfaces that all FoursquareTypes implement. DEFAULT_INTERFACES = ['FoursquareType'] # Interfaces that specific FoursqureTypes implement. INTERFACES = { } DEFAULT_CLA...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Basic interface to Amazon MWS # richard@sitescraper.net # import re import webbrowser import urllib import urllib2 import hashlib import hmac import base64 from pprint import pprint from xml.dom import minidom import ecs class MWSError(Exception): pass class MWS...
Python
#!/usr/bin/env python # # Copyright 2004 Matt Mackall <mpm@selenic.com> # # Inspired by perl Bloat-O-Meter (c) 1997 by Andi Kleen # # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. import sys, os#, re def usage(): sys.stderr....
Python
import sys import re start_re = "(^.*released under the GPL version 2 \(see below\)).*however due" skip = 0 while True: line = sys.stdin.readline() if not line: break m = re.match (start_re, line) if m: g = m.groups() print g[0] + '.' skip = 5 if skip > 0: sk...
Python
''' Created on 21-03-2011 @author: maciek ''' def formatString(format, **kwargs): ''' ''' if not format: return '' for arg in kwargs.keys(): format = format.replace("{" + arg + "}", "##" + arg + "##") format = format.replace ("{", "{{") format = format.replace("}", "}}") for...
Python
''' Created on 21-03-2011 @author: maciek ''' from IndexGenerator import IndexGenerator from optparse import OptionParser import os import tempfile import shutil import logging logging.basicConfig(level = logging.DEBUG) parser = OptionParser() parser.add_option('-n', '--app-name', action='store', dest='appName', hel...
Python
''' Created on 21-03-2011 @author: maciek ''' from formater import formatString import os class IndexGenerator(object): ''' Generates Index.html for iOS app OTA distribution ''' basePath = os.path.dirname(__file__) templateFile = os.path.join(basePath,"templates/index.tmpl") releaseUrls = "" ...
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
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for ...
Python
#!/usr/bin/env python # Copyright 2013 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 or ...
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
#!/usr/bin/env python import codecs import re import jinja2 import markdown def process_slides(): with codecs.open('../../presentation-output.html', 'w', encoding='utf8') as outfile: md = codecs.open('slides.md', encoding='utf8').read() md_slides = md.split('\n---\n') print 'Compiled %s slides.' % len(m...
Python
# Copyright 2012 Google Inc. All Rights Reserved. # pylint: disable-msg=C6409,C6203 """In-App Payments - Online Store Python Sample""" # standard library imports from cgi import escape import os import time # third-party imports from google.appengine.ext import webapp from google.appengine.ext.webapp import templat...
Python
""" JSON Web Token implementation Minimum implementation based on this spec: http://self-issued.info/docs/draft-jones-json-web-token-01.html """ import base64 import hashlib import hmac try: import json except ImportError: import simplejson as json __all__ = ['encode', 'decode', 'DecodeError'] class Dec...
Python
SELLER_ID = "ADD YOUR SELLER ID" SELLER_SECRET = "ADD YOUR SELLER SECRET"
Python
''' Created on 2009-11-23 @author: LiPengYu ''' import cherrypy from abio.util import template from abio.util import session import environment class account(object): def __init__(self): pass @template.kid('./abio/sys/index.xhtml') def index(self, usr=None, pwd=None): ...
Python
import cherrypy from pyamf.remoting.gateway.wsgi import WSGIGateway from account import account class url(object): def __init__(self): pass account=account()
Python
''' Created on 2009-11-21 @author: LiPengYu ''' def echo(data): return data def echo2(data1, data2): return data1, data2
Python
import cherrypy import environment from abio.util import template from abio.util import authorization from abio.util import session from pyamf.remoting.gateway.wsgi import WSGIGateway from amf import echo from amf import echo2 amf = { 'echo': echo, 'echo2': echo2, } class url(object): d...
Python
''' Created on 2009-9-4 @author: LiPengYu ''' import cherrypy def set(name, value): cherrypy.session[name]=value def user(): if('user' not in cherrypy.session): cherrypy.session['user']='' return cherrypy.session['user'] def role(): if('role' not in cherrypy.session): ...
Python
''' Created on 2009-9-4 @author: LiPengYu ''' import cherrypy import environment from abio.util import session def role(rolename): def decorator(handler): def function(self, *para): if rolename == session.role(): return handler(self, *para) else: ...
Python
''' Created on 2009-9-4 @author: LiPengYu ''' import cherrypy from kid import load_template def void(handler=None): def decorator(handler): return cherrypy.expose(handler) if handler==None: return decorator else: return cherrypy.expose(handler) def kid(file): ...
Python
''' Created on 2009-11-21 @author: LiPengYu ''' import cherrypy import environment from abio import sys from abio import file from pyamf.remoting.gateway.wsgi import WSGIGateway if __name__ == '__main__': cherrypy.tree.mount(sys.url(), '/sys/') cherrypy.tree.mount(file.url(), '/file/') che...
Python
''' Created on 2009-11-23 @author: LiPengYu ''' server={'url':'http://localhost:80', } system={'path_swf_file':'e:/abio/swfFile/bin-debug', } cherrypy={'server.socket_host': '127.0.0.1', 'server.socket_port': 80, 'tools.sessions.on': True, }
Python
#Skype contact waiting script. It flashes Lightpack when target buddy in contact list are changed his online status. #You need Skype4Py module and lightpack.py class for using it. import Skype4Py, lightpack, time, sys skype = Skype4Py.Skype() # Create an instance of the Skype class lpack = lightpack.lightpack('...
Python
#inaccurate pyLightpack class animation examples for 10 LED Lightpack configuration (3+2+3+2 clockwise from the left edge). import lightpack, time, re, random lpack = lightpack.lightpack('127.0.0.1', 3636, [2,3,6,7,8,9,10,4,5,1] ) lpack.connect() lpack.lock() print ('***pyLightpack animation examples (read scr...
Python
# Gmail checker script. It check you mail thru IMAP and run clockwise "snake" effect if you have unread messages in the box import lightpack, time, imaplib, re, getpass def gmail_checker(username,password): import imaplib,re i=imaplib.IMAP4_SSL('imap.gmail.com') try: i....
Python
import socket, time, imaplib, re, sys class lightpack: # host = '127.0.0.1' # The remote host # port = 3636 # The same port as used by the server # ledMap = [1,2,3,4,5,6,7,8,9,10] #mapped LEDs def __init__(self, _host, _port, _ledMap): self.host = _host self.port = _port self.ledM...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # 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...
Python
"""Implementation of JSONEncoder """ import re try: from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ...
Python
"""Implementation of JSONDecoder """ import re import sys import struct from simplejson.scanner import make_scanner try: from simplejson._speedups import scanstring as c_scanstring except ImportError: c_scanstring = None __all__ = ['JSONDecoder'] FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconst...
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"""Using simplejson from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -msimplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -msimplejson.tool Expecting property name: line 1 column 2 (char 2) """ import simplejson def main(): import sys if l...
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
#!/usr/bin/python2.4 '''Load the latest update for a Twitter user and leave it in an XHTML fragment''' __author__ = 'dewitt@google.com' import codecs import getopt import sys import twitter TEMPLATE = """ <div class="twitter"> <span class="twitter-user"><a href="http://twitter.com/%s">Twitter</a>: </span> <span...
Python
#!/usr/bin/python2.4 '''Post a message to twitter''' __author__ = 'dewitt@google.com' import ConfigParser import getopt import os import sys import twitter USAGE = '''Usage: tweet [options] message This script posts a message to Twitter. Options: -h --help : print this help --consumer-key : the twit...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # 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...
Python
#!/usr/bin/python2.4 # -*- coding: utf-8 -*-# # # Copyright 2007 The Python-Twitter Developers # # 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...
Python
#!/usr/bin/python2.6 # # Simple http server to emulate api.playfoursquare.com import logging import shutil import sys import urlparse import SimpleHTTPServer import BaseHTTPServer class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """Handle playfoursquare.com requests, for testing.""" def do_GET(self...
Python
#!/usr/bin/python import os import subprocess import sys BASEDIR = '../main/src/com/joelapenna/foursquare' TYPESDIR = '../captures/types/v1' captures = sys.argv[1:] if not captures: captures = os.listdir(TYPESDIR) for f in captures: basename = f.split('.')[0] javaname = ''.join([c.capitalize() for c in basena...
Python
#!/usr/bin/python """ Pull a oAuth protected page from foursquare. Expects ~/.oget to contain (one on each line): CONSUMER_KEY CONSUMER_KEY_SECRET USERNAME PASSWORD Don't forget to chmod 600 the file! """ import httplib import os import re import sys import urllib import urllib2 import urlparse import user from xml....
Python
#!/usr/bin/python import datetime import sys import textwrap import common from xml.dom import pulldom PARSER = """\ /** * Copyright 2009 Joe LaPenna */ package com.joelapenna.foursquare.parsers; import com.joelapenna.foursquare.Foursquare; import com.joelapenna.foursquare.error.FoursquareError; import com.joel...
Python
#!/usr/bin/python import logging from xml.dom import minidom from xml.dom import pulldom BOOLEAN = "boolean" STRING = "String" GROUP = "Group" # Interfaces that all FoursquareTypes implement. DEFAULT_INTERFACES = ['FoursquareType'] # Interfaces that specific FoursqureTypes implement. INTERFACES = { } DEFAULT_CLA...
Python
#!/usr/bin/python """ To do: 3) command-line argument (to test a single file) - What about exceptions and aborts? -If ...is embedded anywhere in a line, that portion becomes a .*? regexp --------------- Find files with /* Output: Run the programs and capture the output, compare with anticipated outpu...
Python
#!/usr/bin/python """ To do: 3) command-line argument (to test a single file) - What about exceptions and aborts? -If ...is embedded anywhere in a line, that portion becomes a .*? regexp --------------- Find files with /* Output: Run the programs and capture the output, compare with anticipated outpu...
Python
#!/usr/bin/python """ DEclipse.py by Bruce Eckel, for Thinking in Java 4e Undoes the effect of Eclipse.py, so that Ant can be used again to build the code tree. You must have Python 2.3 installed to run this program. See www.python.org. """ import os for path, dirs, files in os.walk('.'): for file in...
Python
#!/usr/bin/python """ Runs javac -Xlint on all files in all subdirectories. Collects results into JavaLint.txt """ import os outputfile = "JavaLint.txt" javadirs = [] for path, dirs, files in os.walk('.'): for file in files: if file.endswith(".java"): javadirs.append(path) ...
Python
#!/usr/bin/python """ Eclipse.py by Bruce Eckel, for Thinking in Java 4e Modify or insert package statments so that Eclipse is happy with the code tree. Run this with no arguments from the root of the code tree. The Ant build will not work once you run this program! You may also want to modify the dotproject ...
Python
#!/usr/bin/python """ Runs a Java program, appends output if it's not there -force as first argument when doing batch files forces overwrite """ import os, re, sys argTag = '// {Args: ' oldOutput = re.compile("/* Output:.*?\n(.*)\n\*///:~(?s)") def makeOutputIncludedFile(path, fileName, changeReport, fo...
Python
#!/usr/bin/python """ Eclipse.py by Bruce Eckel, for Thinking in Java 4e Modify or insert package statments so that Eclipse is happy with the code tree. Run this with no arguments from the root of the code tree. The Ant build will not work once you run this program! You may also want to modify the dotproject ...
Python
"""RedundantImportDetector.py Discover redundant java imports using brute force. Requires Python 2.3""" import os, sys, re from glob import glob reportFile = file("RedundantImports.txt", 'w') startDir = 'D:\\aaa-TIJ4\\code' # Regular expression to find the block of import statements: findImports = re.comp...
Python
#!/usr/bin/python """ Runs a Java program, appends output if it's not there -force as first argument when doing batch files forces overwrite """ import os, re, sys argTag = '// {Args: ' oldOutput = re.compile("/* Output:.*?\n(.*)\n\*///:~(?s)") def makeOutputIncludedFile(path, fileName, changeReport, fo...
Python
#!/usr/bin/python """ DEclipse.py by Bruce Eckel, for Thinking in Java 4e Undoes the effect of Eclipse.py, so that Ant can be used again to build the code tree. You must have Python 2.3 installed to run this program. See www.python.org. """ import os for path, dirs, files in os.walk('.'): for file in...
Python
#!/usr/bin/python """ Runs javac -Xlint on all files in all subdirectories. Collects results into JavaLint.txt """ import os outputfile = "JavaLint.txt" javadirs = [] for path, dirs, files in os.walk('.'): for file in files: if file.endswith(".java"): javadirs.append(path) ...
Python
"""FindBugsExcluder.py Creates a filter file from the xml and text output of FindBugs To prepare, you must run findbugs -textui . > findbugs.txt findbugs -textui -xml . > findbugs.xml Once you've run this program you can then run findbugs -textui -exclude FindBugsFilter-auto.xml . To exclude the bugs that have b...
Python
# Set up the system so that this development # version of google-api-python-client is run, even if # an older version is installed on the system. # # To make this totally automatic add the following to # your ~/.bash_profile: # # export PYTHONPATH=/path/to/where/you/checked/out/apiclient import sys import os sys.path....
Python
#!/usr/bin/env python # Copyright (c) 2007, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this l...
Python
#!/usr/bin/env python """Execute all sample applications. Runs over all the sample applications, determines their type (App Engine, Django, or a command-line application), and then runs them checking for a good return status in the case of command-line applications and a 200 OK response in the case of the App Engine a...
Python
# Copyright (C) 2010 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 or agreed to in writ...
Python