code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
a = range(17)
del a[::3]
print a
a = range(16)
del a[::3]
print a
a = range(17)
del a[::2]
print a
a = range(16)
del a[::2]
print a
| [
[
14,
0,
0.0833,
0.0833,
0,
0.66,
0,
475,
3,
1,
0,
0,
816,
10,
1
],
[
8,
0,
0.25,
0.0833,
0,
0.66,
0.2857,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.3333,
0.0833,
0,
0... | [
"a = range(17)",
"print(a)",
"a = range(16)",
"print(a)",
"a = range(17)",
"print(a)",
"a = range(16)",
"print(a)"
] |
print 2+3
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2+3)"
] |
print 7 in {1:2,'a':7}
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(7 in {1:2,'a':7})"
] |
def test(): return
x = 1
print test()
| [
[
2,
0,
0.3333,
0.3333,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
0
],
[
13,
1,
0.3333,
0.3333,
1,
0.07,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
... | [
"def test(): return",
"def test(): return",
"x = 1",
"print(test())"
] |
if 0 == 1:
print "X"
elif 1 == 1:
print "OK"
else:
print "Y"
| [
[
4,
0,
0.5833,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
3
],
[
8,
1,
0.3333,
0.1667,
1,
0,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
4,
1,
0.75,
0.6667,
1,
0,
1,
0,
... | [
"if 0 == 1:\n print(\"X\")\nelif 1 == 1:\n print(\"OK\")\nelse:\n print(\"Y\")",
" print(\"X\")",
"elif 1 == 1:\n print(\"OK\")\nelse:\n print(\"Y\")",
" print(\"OK\")",
" print(\"Y\")"
] |
print type(1)
print type(2**10)
print type(2**1024)
print type("wee")
| [
[
8,
0,
0.25,
0.25,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.5,
0.25,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.75,
0.25,
0,
0.66,
0.6667,... | [
"print(type(1))",
"print(type(2**10))",
"print(type(2**1024))",
"print(type(\"wee\"))"
] |
print str(range(-4,-8,-1))[:5]
print len(range(-4,-8,-1))
print range(-4,-8,-1)[0]
print range(-4,-8,-1)[1]
print range(-4,-8,-1)[-1]
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,
... | [
"print(str(range(-4,-8,-1))[:5])",
"print(len(range(-4,-8,-1)))",
"print(range(-4,-8,-1)[0])",
"print(range(-4,-8,-1)[1])",
"print(range(-4,-8,-1)[-1])"
] |
t = [[y*10+x for x in range(0,10)] for y in range(0,10)]
print t[2][3]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
15,
5,
0,
0,
0,
0,
0,
2
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"t = [[y*10+x for x in range(0,10)] for y in range(0,10)]",
"print(t[2][3])"
] |
# using obj[token] in JS doesn't work as a generic string dict
# make sure to use *both* hasOwnProperty and then get it, otherwise object
# builtins will return existence.
def toString():
print "wee"
class stuff:
def toString(self):
return "waa"
def valueOf(self):
return "stuff"
toString()... | [
[
2,
0,
0.2812,
0.125,
0,
0.66,
0,
661,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.3125,
0.0625,
1,
0.13,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
3,
0,
0.5625,
0.3125,
0,
0.66,
... | [
"def toString():\n print(\"wee\")",
" print(\"wee\")",
"class stuff:\n def toString(self):\n return \"waa\"\n def valueOf(self):\n return \"stuff\"",
" def toString(self):\n return \"waa\"",
" return \"waa\"",
" def valueOf(self):\n return \"stuff\"",
... |
print [5]*10
print [1,2,3]*4
print (5,)*10
print (1,2,3)*4
print 10*[5]
print 4*[1,2,3]
print 10*(5,)
print 4*(1,2,3)
| [
[
8,
0,
0.125,
0.125,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.25,
0.125,
0,
0.66,
0.1429,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.375,
0.125,
0,
0.66,
0... | [
"print([5]*10)",
"print([1,2,3]*4)",
"print (5,)*10",
"print (1,2,3)*4",
"print(10*[5])",
"print(4*[1,2,3])",
"print(10*(5,))",
"print(4*(1,2,3))"
] |
x="OK"
print x
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x=\"OK\"",
"print(x)"
] |
print 2 in [1,2,3]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2 in [1,2,3])"
] |
import goog.graphics as gfx
import goog.dom as dom
def main():
g = gfx.createSimpleGraphics(600, 200)
print g
fill = gfx.SolidFill('yellow')
stroke = gfx.Stroke(2, 'green')
g.drawRect(30, 10, 100, 80, stroke, fill)
stroke = gfx.Stroke(4, 'green')
g.drawImage(30, 110, 276, 110, 'http://www... | [
[
1,
0,
0.0256,
0.0256,
0,
0.66,
0,
78,
0,
1,
0,
0,
78,
0,
0
],
[
1,
0,
0.0513,
0.0256,
0,
0.66,
0.3333,
107,
0,
1,
0,
0,
107,
0,
0
],
[
2,
0,
0.5256,
0.8718,
0,
0.... | [
"import goog.graphics as gfx",
"import goog.dom as dom",
"def main():\n g = gfx.createSimpleGraphics(600, 200)\n print(g)\n fill = gfx.SolidFill('yellow')\n stroke = gfx.Stroke(2, 'green')\n\n g.drawRect(30, 10, 100, 80, stroke, fill)\n stroke = gfx.Stroke(4, 'green')",
" g = gfx.createSi... |
y = 1
| [
[
14,
0,
1,
1,
0,
0.66,
0,
304,
1,
0,
0,
0,
0,
1,
0
]
] | [
"y = 1"
] |
print x+2*3
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(x+2*3)"
] |
def f():
n = "OK"
print n
f()
| [
[
2,
0,
0.4167,
0.6667,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
1
],
[
14,
1,
0.3333,
0.1667,
1,
0.44,
0,
773,
1,
0,
0,
0,
0,
3,
0
],
[
8,
1,
0.6667,
0.1667,
1,
0.44,
... | [
"def f():\n n = \"OK\"\n\n print(n)",
" n = \"OK\"",
" print(n)",
"f()"
] |
print '0"1'
print '2\'3'
print "4'5"
print "6\"7"
print '''8'9"0'''
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,
... | [
"print('0\"1')",
"print('2\\'3')",
"print(\"4'5\")",
"print(\"6\\\"7\")",
"print('''8'9\"0''')"
] |
import ast
import sys
def astppdump(node):
def _format(node, indent):
#print node, len(indent)
if isinstance(node, ast.AST):
namelen = " "*(len(node.__class__.__name__)) + " "
fields = []
for a,b in ast.iter_fields(node):
fieldlen = len(a)*" "
... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
809,
0,
1,
0,
0,
809,
0,
0
],
[
1,
0,
0.0741,
0.037,
0,
0.66,
0.3333,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.5,
0.7407,
0,
0.66,
... | [
"import ast",
"import sys",
"def astppdump(node):\n def _format(node, indent):\n #print node, len(indent)\n if isinstance(node, ast.AST):\n namelen = \" \"*(len(node.__class__.__name__)) + \" \"\n fields = []\n for a,b in ast.iter_fields(node):\n ... |
#! /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... | [
[
8,
0,
0.0366,
0.0122,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1098,
0.0122,
0,
0.66,
0.0159,
977,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.122,
0.0122,
0,
0.66,... | [
"\"\"\"Token constants (from \"token.h\").\"\"\"",
"ENDMARKER = 0",
"NAME = 1",
"NUMBER = 2",
"STRING = 3",
"NEWLINE = 4",
"INDENT = 5",
"DEDENT = 6",
"LPAR = 7",
"RPAR = 8",
"LSQB = 9",
"RSQB = 10",
"COLON = 11",
"COMMA = 12",
"SEMI = 13",
"PLUS = 14",
"MINUS = 15",
"STAR = 16",
... |
# 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... | [
[
8,
0,
0.0314,
0.0482,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0587,
0.0021,
0,
0.66,
0.0172,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0618,
0.0042,
0,
0.66... | [
"\"\"\"Tokenization help for Python programs.\n\ngenerate_tokens(readline) is a generator that breaks a stream of\ntext into Python tokens. It accepts a readline-like method which is called\nrepeatedly to get the next line of input (or \"\" for EOF). It generates\n5-tuples with these members:\n\n the token typ... |
# 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
... | [
[
1,
0,
0.013,
0.0026,
0,
0.66,
0,
260,
0,
3,
0,
0,
260,
0,
0
],
[
3,
0,
0.0195,
0.0052,
0,
0.66,
0.2,
344,
0,
0,
0,
0,
407,
0,
0
],
[
3,
0,
0.4492,
0.849,
0,
0.66,... | [
"import grammar, token, tokenize",
"class PgenGrammar(grammar.Grammar):\n pass",
"class ParserGenerator(object):\n\n def __init__(self, filename, stream=None):\n close_stream = None\n if stream is None:\n stream = open(filename)\n close_stream = stream.close\n se... |
# 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 ... | [
[
8,
0,
0.0421,
0.0495,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0792,
0.005,
0,
0.66,
0.1667,
848,
0,
1,
0,
0,
848,
0,
0
],
[
1,
0,
0.0941,
0.005,
0,
0.66,
... | [
"\"\"\"This module defines the data structures used to represent a grammar.\n\nThese are a bit arcane because they are derived from the data\nstructures used by Python's 'pgen' parser generator.\n\nThere's also a table here mapping operators to their names in the\ntoken module; the Python tokenize module reports al... |
#! /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... | [
[
8,
0,
0.0051,
0.0026,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0179,
0.0026,
0,
0.66,
0.0455,
688,
0,
2,
0,
0,
688,
0,
0
],
[
1,
0,
0.023,
0.0026,
0,
0.66,... | [
"\"\"\"Generate JS code from an ASDL description.\"\"\"",
"import os, sys",
"import asdl",
"TABSIZE = 4",
"MAX_COL = 80",
"def get_c_type(name):\n \"\"\"Return a string for the C name of the type.\n\n This function special cases the default types provided by asdl:\n identifier, string, int, bool.... |
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... | [
[
14,
0,
0.3929,
0.75,
0,
0.66,
0,
553,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.8214,
0.0357,
0,
0.66,
0.3333,
355,
0,
0,
0,
0,
0,
6,
0
],
[
6,
0,
0.8929,
0.1071,
0,
0.66... | [
"s = \"\"\"Gur Mra bs Clguba, ol Gvz Crgref\n\nOrnhgvshy vf orggre guna htyl.\nRkcyvpvg vf orggre guna vzcyvpvg.\nFvzcyr vf orggre guna pbzcyrk.\nPbzcyrk vf orggre guna pbzcyvpngrq.\nSyng vf orggre guna arfgrq.\nFcnefr vf orggre guna qrafr.",
"d = {}",
"for c in (65, 97):\n for i in range(26):\n d[chr... |
# 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, ... | [
[
1,
0,
0.1818,
0.013,
0,
0.66,
0,
394,
0,
2,
0,
0,
394,
0,
0
],
[
1,
0,
0.1948,
0.013,
0,
0.66,
0.2,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.2078,
0.013,
0,
0.66,
... | [
"from subprocess import Popen, PIPE",
"import sys",
"import re",
"def remapError(linestarts, line, col, err):\n if len(linestarts) == 0:\n # none supplied on command line\n return \"%s:%d:%d: %s\" % (sys.argv[1], line, col - 1, err)\n\n for i in range(len(linestarts)):\n if line > l... |
# 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... | [
[
1,
0,
0.02,
0.002,
0,
0.66,
0,
201,
0,
1,
0,
0,
201,
0,
0
],
[
14,
0,
0.047,
0.048,
0,
0.66,
0.0294,
183,
0,
0,
0,
0,
0,
5,
0
],
[
3,
0,
0.081,
0.012,
0,
0.66,
... | [
"import webgl",
"ShapeParams = [\n # m a b n1 n2 n3 m a b n1 n2 n3 res1 res2 scale (org.res1,res2)\n [10, 1, 2, 90, 1, -45, 8, 1, 1, -1, 1, -0.4 , 20, 30, 2], # 40, 60\n [10, 1, 2, 90, 1, -45, 4, 1, 1, ... |
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... | [
[
1,
0,
0.0164,
0.0164,
0,
0.66,
0,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.0328,
0.0164,
0,
0.66,
0.0833,
327,
0,
1,
0,
0,
327,
0,
0
],
[
1,
0,
0.0492,
0.0164,
0,
... | [
"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):\n def get(self):\n self.response.headers['Content-Type'] = 't... |
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... | [
[
1,
0,
0.0118,
0.0118,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0235,
0.0118,
0,
0.66,
0.125,
201,
0,
1,
0,
0,
201,
0,
0
],
[
1,
0,
0.0353,
0.0118,
0,
0... | [
"import sys",
"import webgl",
"import webgl.primitives",
"import webgl.models",
"import webgl.matrix4 as m4",
"def main():\n print(\"Starting up...\")\n gl = webgl.Context(\"canvas\")\n sh = webgl.Shader(gl, VertexShader, FragmentShader)\n sh.use()\n \n m = webgl.models.Model(sh, webgl.p... |
"""
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... | [
[
8,
0,
0.0724,
0.1402,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1495,
0.0047,
0,
0.66,
0.0909,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1542,
0.0047,
0,
0.66... | [
"\"\"\"\n\nquick hack script to convert from quake2 .bsp to simple format to draw. drops\nmost information. keeps only raw polys and lightmaps.\n\nmakes .blv and .llv file (big and little endian level)\n\nfile format is",
"import os",
"import sys",
"import struct",
"def strunpack(stream, format):\n retur... |
"""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.
"""
#-----------------------------------------------------------------... | [
[
8,
0,
0.0307,
0.0526,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1053,
0.0088,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1316,
0.0088,
0,
0.66... | [
"\"\"\"reST directive for syntax-highlighting ipython interactive sessions.\n\nXXX - See what improvements can be made based on the new (as of Sept 2009)\n'pycon' lexer for the python console. At the very least it will give better\nhighlighted tracebacks.\n\"\"\"",
"import re",
"from pygments.lexer import Lexe... |
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... | [
[
1,
0,
0.0018,
0.0018,
0,
0.66,
0,
509,
0,
7,
0,
0,
509,
0,
0
],
[
1,
0,
0.0053,
0.0018,
0,
0.66,
0.0455,
12,
0,
1,
0,
0,
12,
0,
0
],
[
1,
0,
0.0071,
0.0018,
0,
0.... | [
"import sys, os, shutil, imp, warnings, cStringIO, re",
"import IPython",
"from IPython.Shell import MatplotlibShell",
"try:\n from hashlib import md5\nexcept ImportError:\n from md5 import md5",
" from hashlib import md5",
" from md5 import md5",
"from docutils.parsers.rst import directives... |
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'... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
509,
0,
2,
0,
0,
509,
0,
0
],
[
7,
0,
0.0522,
0.0597,
0,
0.66,
0.3333,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0448,
0.0149,
1,
0.31... | [
"import sys, os",
"try:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup",
" from setuptools import setup",
" from distutils.core import setup",
"version = '0.1.1'",
"setup(\n name='pykml',\n version=version,\n packages=['pykml',],\n package_di... |
""" 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... | [
[
8,
0,
0.0103,
0.0172,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0206,
0.0034,
0,
0.66,
0.125,
540,
0,
1,
0,
0,
540,
0,
0
],
[
2,
0,
0.0326,
0.0137,
0,
0.66,... | [
"\"\"\" pyKML Utility Module\n\nThe pykml.utility module provides utility functions that operate on KML \ndocuments\n\"\"\"",
"import re",
"def clean_xml_string(input_string):\n '''removes invalid characters from an XML string'''\n from curses import ascii\n return ''.join(c for c in input_string if as... |
"""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... | [
[
8,
0,
0.0243,
0.0417,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0556,
0.0069,
0,
0.66,
0.25,
30,
0,
1,
0,
0,
30,
0,
0
],
[
1,
0,
0.0625,
0.0069,
0,
0.66,
... | [
"\"\"\"pyKML Helpers Module\n\nThe pykml.helpers module contains 'helper' functions that operate on pyKML \ndocument objects for accomplishing common tasks.\n\n\"\"\"",
"from pykml.factory import KML_ElementMaker as K",
"from pykml.factory import GX_ElementMaker as GX",
"def separate_namespace(qname):\n \"... |
'''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... | [
[
8,
0,
0.0255,
0.0463,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0556,
0.0046,
0,
0.66,
0.125,
123,
0,
2,
0,
0,
123,
0,
0
],
[
14,
0,
0.0741,
0.0231,
0,
0.66... | [
"'''pyKML Factory Module\n\nThe pykml.factory module provides objects and functions that can be used to \ncreate KML documents element-by-element. \nThe factory module leverages `lxml's ElementMaker factory`_ objects to create\nKML objects with the appropriate namespace prefixes.\n\n.. _lxml: http://lxml.de",
"fr... |
'''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... | [
[
8,
0,
0.0246,
0.041,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0492,
0.0082,
0,
0.66,
0.1111,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0574,
0.0082,
0,
0.66,... | [
"'''pyKML Parser Module\n\nThe pykml.parser module provides functions that can be used to parse KML \nfrom a file or remote URL.\n'''",
"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()... |
import unittest
from test_factory import *
from test_helpers import *
from test_parser import *
from test_util import *
if __name__ == '__main__':
unittest.main() | [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.3333,
0.1111,
0,
0.66,
0.2,
203,
0,
1,
0,
0,
203,
0,
0
],
[
1,
0,
0.4444,
0.1111,
0,
0.66,... | [
"import unittest",
"from test_factory import *",
"from test_helpers import *",
"from test_parser import *",
"from test_util import *",
"if __name__ == '__main__':\n unittest.main()",
" unittest.main()"
] |
#!/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... | [
[
8,
0,
0.0566,
0.0566,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0943,
0.0189,
0,
0.66,
0.0714,
430,
0,
1,
0,
0,
430,
0,
0
],
[
1,
0,
0.1132,
0.0189,
0,
0.66... | [
"'''Generate a KML document of a tour based on a KML linestring.\n\n'''",
"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 etre... |
#!/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... | [
[
8,
0,
0.0149,
0.0149,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0249,
0.005,
0,
0.66,
0.0833,
30,
0,
1,
0,
0,
30,
0,
0
],
[
1,
0,
0.0299,
0.005,
0,
0.66,
... | [
"'''Generate a KML document of a tour based on rotating around locations.\n\n'''",
"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",
"gxns = '{' + nsmap['... |
#!/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... | [
[
8,
0,
0.0179,
0.026,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0325,
0.0032,
0,
0.66,
0.0769,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.0357,
0.0032,
0,
0.66,... | [
"'''Example of generating transitions between camera locations using splines \n\nNote that this example requires the scipy package\n http://pypi.python.org/pypi/scipy\n\nReferences:\n\n'''",
"from datetime import time, datetime",
"from time import mktime",
"from lxml import etree",
"from pykml.factory im... |
#!/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)
| [
[
1,
0,
0.2,
0.0667,
0,
0.66,
0,
123,
0,
1,
0,
0,
123,
0,
0
],
[
1,
0,
0.2667,
0.0667,
0,
0.66,
0.3333,
30,
0,
1,
0,
0,
30,
0,
0
],
[
14,
0,
0.6333,
0.5333,
0,
0.66... | [
"from lxml import etree",
"from pykml.factory import KML_ElementMaker as KML",
"doc = KML.kml(\n KML.Placemark(\n KML.name('Hello World!'),\n KML.Point(\n KML.coordinates('-91.35,0,0'),\n ),\n ),\n)",
"print(etree.tostring(etree.ElementTree(doc),pretty_print=True))"
] |
#!/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(
... | [
[
1,
0,
0.1111,
0.037,
0,
0.66,
0,
123,
0,
1,
0,
0,
123,
0,
0
],
[
1,
0,
0.1481,
0.037,
0,
0.66,
0.2,
30,
0,
1,
0,
0,
30,
0,
0
],
[
1,
0,
0.1852,
0.037,
0,
0.66,
... | [
"from lxml import etree",
"from pykml.factory import KML_ElementMaker as KML",
"from math import cos, sin, radians",
"kmlobj = KML.kml(\n KML.Document()\n)",
"for i in range(0,360*2,10):\n kmlobj.Document.append(\n KML.Placemark(\n KML.name('Hello World!'),\n KML.Point(\n ... |
#!/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(
... | [
[
1,
0,
0.0811,
0.027,
0,
0.66,
0,
123,
0,
1,
0,
0,
123,
0,
0
],
[
1,
0,
0.1081,
0.027,
0,
0.66,
0.2,
30,
0,
1,
0,
0,
30,
0,
0
],
[
14,
0,
0.1622,
0.027,
0,
0.66,
... | [
"from lxml import etree",
"from pykml.factory import KML_ElementMaker as KML",
"text = 'Hello World!'",
"kmlobj = KML.kml(\n KML.Document(\n KML.Style(\n KML.LabelStyle(\n KML.scale(6)\n ),\n id=\"big_label\"\n )",
"for i in range(0,len(text))... |
#!/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... | [
[
1,
0,
0.0968,
0.0323,
0,
0.66,
0,
123,
0,
1,
0,
0,
123,
0,
0
],
[
1,
0,
0.129,
0.0323,
0,
0.66,
0.1667,
30,
0,
1,
0,
0,
30,
0,
0
],
[
1,
0,
0.1613,
0.0323,
0,
0.6... | [
"from lxml import etree",
"from pykml.factory import KML_ElementMaker as KML",
"from math import cos, sin, radians",
"text = 'Hello World! '",
"kmlobj = KML.kml(\n KML.Document()\n)",
"for i in range(0,103):\n char = text[i % len(text)]\n if char != ' ':\n kmlobj.Document.append(\n ... |
#!/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... | [
[
1,
0,
0.0698,
0.0233,
0,
0.66,
0,
123,
0,
1,
0,
0,
123,
0,
0
],
[
1,
0,
0.093,
0.0233,
0,
0.66,
0.0714,
30,
0,
1,
0,
0,
30,
0,
0
],
[
1,
0,
0.1163,
0.0233,
0,
0.6... | [
"from lxml import etree",
"from pykml.factory import KML_ElementMaker as KML",
"from math import cosh",
"text = 'Hello World!'",
"kmlobj = KML.kml(\n KML.Document()\n)",
"lon1 = -90.18527061414699",
"lat1 = 38.62381763642669",
"lon2 = -90.18462877742689",
"lat2 = 38.62537095459039",
"fc = 191 ... |
#!/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... | [
[
1,
0,
0.0388,
0.0097,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0485,
0.0097,
0,
0.66,
0.0385,
123,
0,
1,
0,
0,
123,
0,
0
],
[
1,
0,
0.0583,
0.0097,
0,
... | [
"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 drange(star... |
#!/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
... | [
[
8,
0,
0.0938,
0.125,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1875,
0.0208,
0,
0.66,
0.125,
123,
0,
1,
0,
0,
123,
0,
0
],
[
1,
0,
0.2083,
0.0208,
0,
0.66,
... | [
"'''Generate a KML string that matches the altitudemode example.\n\nReferences:\nhttp://code.google.com/apis/kml/documentation/kmlreference.html#gxaltitudemode\nhttp://code.google.com/apis/kml/documentation/kmlfiles/altitudemode_reference.kml\n'''",
"from lxml import etree",
"from pykml.parser import Schema",
... |
#!/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... | [
[
8,
0,
0.0854,
0.1341,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1707,
0.0122,
0,
0.66,
0.0833,
123,
0,
1,
0,
0,
123,
0,
0
],
[
1,
0,
0.1829,
0.0122,
0,
0.66... | [
"'''Generate a KML string that matches the animated update example.\n\nReferences:\nhttp://code.google.com/apis/kml/documentation/kmlreference.html#gxanimatedupdate\nhttp://code.google.com/apis/kml/documentation/kmlfiles/animatedupdate_example.kml\n\nNote that as of 12/1/2010, the KML code displayed beneath the ani... |
#!/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... | [
[
8,
0,
0.0435,
0.0543,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0761,
0.0109,
0,
0.66,
0.0526,
312,
0,
1,
0,
0,
312,
0,
0
],
[
1,
0,
0.087,
0.0109,
0,
0.66,... | [
"'''Example of generating KML from data in a CSV file \n\nReferences:\n\n'''",
"import csv",
"import urllib2",
"from datetime import datetime",
"from lxml import etree",
"from pykml.factory import KML_ElementMaker as KML",
"def makeExtendedDataElements(datadict):\n '''Converts a dictionary to Extende... |
#!/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... | [
[
1,
0,
0.0588,
0.0118,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0706,
0.0118,
0,
0.66,
0.125,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0824,
0.0118,
0,
0... | [
"import logging",
"import shutil",
"import sys",
"import urlparse",
"import SimpleHTTPServer",
"import BaseHTTPServer",
"class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):\n \"\"\"Handle playfoursquare.com requests, for testing.\"\"\"\n\n def do_GET(self):\n logging.warn('do_GET: %s, %s',... |
#!/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... | [
[
1,
0,
0.1111,
0.037,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1481,
0.037,
0,
0.66,
0.1429,
394,
0,
1,
0,
0,
394,
0,
0
],
[
1,
0,
0.1852,
0.037,
0,
0.6... | [
"import os",
"import subprocess",
"import sys",
"BASEDIR = '../main/src/com/joelapenna/foursquare'",
"TYPESDIR = '../captures/types/v1'",
"captures = sys.argv[1:]",
"if not captures:\n captures = os.listdir(TYPESDIR)",
" captures = os.listdir(TYPESDIR)",
"for f in captures:\n basename = f.split('... |
#!/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.... | [
[
8,
0,
0.0631,
0.0991,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1261,
0.009,
0,
0.66,
0.05,
2,
0,
1,
0,
0,
2,
0,
0
],
[
1,
0,
0.1351,
0.009,
0,
0.66,
0.... | [
"\"\"\"\nPull a oAuth protected page from foursquare.\n\nExpects ~/.oget to contain (one on each line):\nCONSUMER_KEY\nCONSUMER_KEY_SECRET\nUSERNAME\nPASSWORD",
"import httplib",
"import os",
"import re",
"import sys",
"import urllib",
"import urllib2",
"import urlparse",
"import user",
"from xml.... |
#!/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... | [
[
1,
0,
0.0201,
0.0067,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0268,
0.0067,
0,
0.66,
0.0769,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0336,
0.0067,
0,
... | [
"import datetime",
"import sys",
"import textwrap",
"import common",
"from xml.dom import pulldom",
"PARSER = \"\"\"\\\n/**\n * Copyright 2009 Joe LaPenna\n */\n\npackage com.joelapenna.foursquare.parsers;\n\nimport com.joelapenna.foursquare.Foursquare;",
"BOOLEAN_STANZA = \"\"\"\\\n } else i... |
#!/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... | [
[
1,
0,
0.0263,
0.0088,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0439,
0.0088,
0,
0.66,
0.0833,
290,
0,
1,
0,
0,
290,
0,
0
],
[
1,
0,
0.0526,
0.0088,
0,
... | [
"import logging",
"from xml.dom import minidom",
"from xml.dom import pulldom",
"BOOLEAN = \"boolean\"",
"STRING = \"String\"",
"GROUP = \"Group\"",
"DEFAULT_INTERFACES = ['FoursquareType']",
"INTERFACES = {\n}",
"DEFAULT_CLASS_IMPORTS = [\n]",
"CLASS_IMPORTS = {\n# 'Checkin': DEFAULT_CLASS_IMP... |
#!/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.... | [
[
1,
0,
0.0769,
0.0077,
0,
0.66,
0,
509,
0,
2,
0,
0,
509,
0,
0
],
[
2,
0,
0.1,
0.0231,
0,
0.66,
0.0357,
129,
0,
0,
0,
0,
0,
0,
2
],
[
8,
1,
0.1,
0.0077,
1,
0.22,
... | [
"import sys, os#, re",
"def usage():\n sys.stderr.write(\"usage: %s [-t] file1 file2\\n\" % sys.argv[0])\n sys.exit(-1)",
" sys.stderr.write(\"usage: %s [-t] file1 file2\\n\" % sys.argv[0])",
" sys.exit(-1)",
"f1, f2 = (None, None)",
"flag_timing, dashes = (False, False)",
"for f in sys.argv... |
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... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.2,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.2,
0.05,
0,
0.66,
0.4,
... | [
"import sys",
"import re",
"start_re = \"(^.*released under the GPL version 2 \\(see below\\)).*however due\"",
"skip = 0",
"while True:\n line = sys.stdin.readline()\n if not line:\n break\n m = re.match (start_re, line)\n if m:\n g = m.groups()\n print(g[0] + '.')",
" ... |
'''
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... | [
[
8,
0,
0.1304,
0.2174,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.6739,
0.6957,
0,
0.66,
1,
798,
0,
2,
1,
0,
0,
0,
9
],
[
8,
1,
0.413,
0.087,
1,
0.81,
0,
... | [
"'''\nCreated on 21-03-2011\n\n@author: maciek\n'''",
"def formatString(format, **kwargs):\n '''\n '''\n if not format: return ''\n \n for arg in kwargs.keys():\n format = format.replace(\"{\" + arg + \"}\", \"##\" + arg + \"##\")\n format = format.replace (\"{\", \"{{\")",
" '''\n ... |
'''
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... | [
[
8,
0,
0.0341,
0.0568,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0682,
0.0114,
0,
0.66,
0.0303,
933,
0,
1,
0,
0,
933,
0,
0
],
[
1,
0,
0.0795,
0.0114,
0,
0.66... | [
"'''\nCreated on 21-03-2011\n\n@author: maciek\n'''",
"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... |
'''
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 = ""
... | [
[
8,
0,
0.0526,
0.0877,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1053,
0.0175,
0,
0.66,
0.3333,
11,
0,
1,
0,
0,
11,
0,
0
],
[
1,
0,
0.1228,
0.0175,
0,
0.66,
... | [
"'''\nCreated on 21-03-2011\n\n@author: maciek\n'''",
"from formater import formatString",
"import os",
"class IndexGenerator(object):\n '''\n Generates Index.html for iOS app OTA distribution\n '''\n basePath = os.path.dirname(__file__)\n templateFile = os.path.join(basePath,\"templates/index.... |
#!/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... | [
[
1,
0,
0.0816,
0.0102,
0,
0.66,
0,
688,
0,
4,
0,
0,
688,
0,
0
],
[
14,
0,
0.1224,
0.0102,
0,
0.66,
0.0714,
792,
6,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1531,
0.0102,
0,
... | [
"import os, re, mimetypes, sys",
"SOURCE = sys.argv[1:]",
"COMMENT_BLOCK = re.compile(r\"(/\\*.+?\\*/)\", re.MULTILINE | re.DOTALL)",
"COMMENT_LICENSE = re.compile(r\"(license)\", re.IGNORECASE)",
"COMMENT_COPYRIGHT = re.compile(r\"(copyright)\", re.IGNORECASE)",
"EXCLUDE_TYPES = [\n \"application/xml\... |
#!/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
... | [
[
8,
0,
0.2076,
0.0089,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2188,
0.0045,
0,
0.66,
0.0833,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2277,
0.0045,
0,
0.66,... | [
"\"\"\"Google Code file uploader script.\n\"\"\"",
"__author__ = 'danderson@google.com (David Anderson)'",
"import httplib",
"import os.path",
"import optparse",
"import getpass",
"import base64",
"import sys",
"def upload(file, project_name, user_name, password, summary, labels=None):\n \"\"\"Uplo... |
#!/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 ... | [
[
1,
0,
0.2162,
0.0135,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.2297,
0.0135,
0,
0.66,
0.125,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2432,
0.0135,
0,
0... | [
"import re",
"import os",
"import sys",
"import shutil",
"PACKAGE_NAME = 'com.google.android.apps.dashclock.api'",
"def main():\n root = sys.argv[1]\n for path, _, files in os.walk(root):\n for f in [f for f in files if f.endswith('.html')]:\n fp = open(os.path.join(path, f), 'r')\n html = ... |
#!/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... | [
[
1,
0,
0.0816,
0.0102,
0,
0.66,
0,
688,
0,
4,
0,
0,
688,
0,
0
],
[
14,
0,
0.1224,
0.0102,
0,
0.66,
0.0714,
792,
6,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1531,
0.0102,
0,
... | [
"import os, re, mimetypes, sys",
"SOURCE = sys.argv[1:]",
"COMMENT_BLOCK = re.compile(r\"(/\\*.+?\\*/)\", re.MULTILINE | re.DOTALL)",
"COMMENT_LICENSE = re.compile(r\"(license)\", re.IGNORECASE)",
"COMMENT_COPYRIGHT = re.compile(r\"(copyright)\", re.IGNORECASE)",
"EXCLUDE_TYPES = [\n \"application/xml\... |
#!/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... | [
[
1,
0,
0.0526,
0.0175,
0,
0.66,
0,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0702,
0.0175,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0877,
0.0175,
0,
... | [
"import codecs",
"import re",
"import jinja2",
"import markdown",
"def process_slides():\n with codecs.open('../../presentation-output.html', 'w', encoding='utf8') as outfile:\n md = codecs.open('slides.md', encoding='utf8').read()\n md_slides = md.split('\\n---\\n')\n print('Compiled %s slides.' ... |
# 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... | [
[
8,
0,
0.0538,
0.0108,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.086,
0.0108,
0,
0.66,
0.0714,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.0968,
0.0108,
0,
0.66,... | [
"\"\"\"In-App Payments - Online Store Python Sample\"\"\"",
"from cgi import escape",
"import os",
"import time",
"from google.appengine.ext import webapp",
"from google.appengine.ext.webapp import template",
"from google.appengine.ext.webapp.util import run_wsgi_app",
"import jwt",
"from sellerinfo... |
""" 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... | [
[
8,
0,
0.0417,
0.0694,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0139,
0,
0.66,
0.0833,
177,
0,
1,
0,
0,
177,
0,
0
],
[
1,
0,
0.0972,
0.0139,
0,
0.66... | [
"\"\"\" JSON Web Token implementation\n\nMinimum implementation based on this spec:\nhttp://self-issued.info/docs/draft-jones-json-web-token-01.html\n\"\"\"",
"import base64",
"import hashlib",
"import hmac",
"try:\n import json\nexcept ImportError:\n import simplejson as json",
" import json",
... |
SELLER_ID = "ADD YOUR SELLER ID"
SELLER_SECRET = "ADD YOUR SELLER SECRET"
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
232,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
1,
0.5,
0,
0.66,
1,
57,
1,
0,
0,
0,
0,
3,
0
]
] | [
"SELLER_ID = \"ADD YOUR SELLER ID\"",
"SELLER_SECRET = \"ADD YOUR SELLER SECRET\""
] |
'''
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):
... | [
[
8,
0,
0.1111,
0.1852,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2593,
0.037,
0,
0.66,
0.2,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.2963,
0.037,
0,
0.66,
... | [
"'''\nCreated on 2009-11-23\n\n@author: LiPengYu\n'''",
"import cherrypy",
"from abio.util import template",
"from abio.util import session",
"import environment",
"class account(object):\n def __init__(self):\n pass\n \n @template.kid('./abio/sys/index.xhtml')\n def index(self, usr=Non... |
import cherrypy
from pyamf.remoting.gateway.wsgi import WSGIGateway
from account import account
class url(object):
def __init__(self):
pass
account=account()
| [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.2727,
0.0909,
0,
0.66,
0.3333,
977,
0,
1,
0,
0,
977,
0,
0
],
[
1,
0,
0.4545,
0.0909,
0,
... | [
"import cherrypy",
"from pyamf.remoting.gateway.wsgi import WSGIGateway",
"from account import account",
"class url(object):\n def __init__(self):\n pass\n \n account=account()",
" def __init__(self):\n pass",
" account=account()"
] |
'''
Created on 2009-11-21
@author: LiPengYu
'''
def echo(data):
return data
def echo2(data1, data2):
return data1, data2
| [
[
8,
0,
0.2727,
0.4545,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.6818,
0.1818,
0,
0.66,
0.5,
807,
0,
1,
1,
0,
0,
0,
0
],
[
13,
1,
0.7273,
0.0909,
1,
0.85,
... | [
"'''\nCreated on 2009-11-21\n\n@author: LiPengYu\n'''",
"def echo(data):\n return data",
" return data",
"def echo2(data1, data2):\n return data1, data2",
" return data1, data2"
] |
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... | [
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
0.66,
0.1111,
4,
0,
1,
0,
0,
4,
0,
0
],
[
1,
0,
0.1212,
0.0303,
0,
0.66... | [
"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 = {\n 'echo': echo,\n 'echo2': echo2,\... |
'''
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):
... | [
[
8,
0,
0.1579,
0.2632,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3158,
0.0526,
0,
0.66,
0.25,
639,
0,
1,
0,
0,
639,
0,
0
],
[
2,
0,
0.4474,
0.1053,
0,
0.66,
... | [
"'''\nCreated on 2009-9-4\n\n@author: LiPengYu\n'''",
"import cherrypy",
"def set(name, value):\n cherrypy.session[name]=value",
" cherrypy.session[name]=value",
"def user():\n if('user' not in cherrypy.session):\n cherrypy.session['user']=''\n return cherrypy.session['user']",
" if(... |
'''
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:
... | [
[
8,
0,
0.15,
0.25,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.35,
0.05,
0,
0.66,
0.25,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.4,
0.05,
0,
0.66,
0.5,
... | [
"'''\nCreated on 2009-9-4\n\n@author: LiPengYu\n'''",
"import cherrypy",
"import environment",
"from abio.util import session",
"def role(rolename):\n def decorator(handler):\n def function(self, *para):\n if rolename == session.role():\n return handler(self, *para)\n ... |
'''
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):
... | [
[
8,
0,
0.1304,
0.2174,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2609,
0.0435,
0,
0.66,
0.25,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.3043,
0.0435,
0,
0.66,
... | [
"'''\nCreated on 2009-9-4\n\n@author: LiPengYu\n'''",
"import cherrypy",
"from kid import load_template",
"def void(handler=None):\n def decorator(handler):\n return cherrypy.expose(handler)\n if handler==None:\n return decorator\n else:\n return cherrypy.expose(handler)",
" ... |
'''
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... | [
[
8,
0,
0.1667,
0.2778,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3333,
0.0556,
0,
0.66,
0.1667,
639,
0,
1,
0,
0,
639,
0,
0
],
[
1,
0,
0.3889,
0.0556,
0,
0.66... | [
"'''\nCreated on 2009-11-21\n\n@author: LiPengYu\n'''",
"import cherrypy",
"import environment",
"from abio import sys",
"from abio import file",
"from pyamf.remoting.gateway.wsgi import WSGIGateway",
"if __name__ == '__main__':\n cherrypy.tree.mount(sys.url(), '/sys/')\n cherrypy.tree.mount(file.... |
'''
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,
}
| [
[
8,
0,
0.1765,
0.2941,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4412,
0.1176,
0,
0.66,
0.3333,
268,
0,
0,
0,
0,
0,
6,
0
],
[
14,
0,
0.6176,
0.1176,
0,
0.66... | [
"'''\nCreated on 2009-11-23\n\n@author: LiPengYu\n'''",
"server={'url':'http://localhost:80',\n}",
"system={'path_swf_file':'e:/abio/swfFile/bin-debug',\n}",
"cherrypy={'server.socket_host': '127.0.0.1',\n 'server.socket_port': 80,\n 'tools.sessions.on': True,\n}"
] |
#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('... | [
[
1,
0,
0.1379,
0.0345,
0,
0.66,
0,
279,
0,
4,
0,
0,
279,
0,
0
],
[
14,
0,
0.2069,
0.0345,
0,
0.66,
0.1429,
627,
3,
0,
0,
0,
969,
10,
1
],
[
14,
0,
0.2414,
0.0345,
0,
... | [
"import Skype4Py, lightpack, time, sys",
"skype = Skype4Py.Skype() # Create an instance of the Skype class",
"lpack = lightpack.lightpack('127.0.0.1', 3636, [2,3,6,7,8,9,10,4,5,1] )",
"skype.Attach() # Connect the Skype object to the Skype client",
"targetstat = ['ONLINE', 'DND', 'SKYPEME'] # Array of targe... |
#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... | [
[
1,
0,
0.0169,
0.0085,
0,
0.66,
0,
635,
0,
4,
0,
0,
635,
0,
0
],
[
14,
0,
0.0339,
0.0085,
0,
0.66,
0.1,
117,
3,
3,
0,
0,
635,
10,
1
],
[
8,
0,
0.0424,
0.0085,
0,
0... | [
"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 script header first)***')",
"print ('\t1 -- Basic flash 4 times')",
"print ('\t2 -- \"Snake\"')",
"print ... |
# 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.... | [
[
1,
0,
0.075,
0.025,
0,
0.66,
0,
635,
0,
5,
0,
0,
635,
0,
0
],
[
2,
0,
0.25,
0.275,
0,
0.66,
0.1667,
592,
0,
2,
1,
0,
0,
0,
9
],
[
1,
1,
0.15,
0.025,
1,
0.9,
0... | [
"import lightpack, time, imaplib, re, getpass",
"def gmail_checker(username,password):\n import imaplib,re\n i=imaplib.IMAP4_SSL('imap.gmail.com')\n try:\n i.login(username,password)\n x,y=i.status('INBOX','(MESSAGES UNSEEN)')\n messages=int(re.sea... |
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... | [
[
1,
0,
0.0093,
0.0093,
0,
0.66,
0,
687,
0,
5,
0,
0,
687,
0,
0
],
[
3,
0,
0.5093,
0.972,
0,
0.66,
1,
635,
0,
17,
0,
0,
0,
0,
49
],
[
2,
1,
0.0981,
0.0374,
1,
0.41,
... | [
"import socket, time, imaplib, re, sys",
"class lightpack:\n\n#\thost = '127.0.0.1' # The remote host\n#\tport = 3636 # The same port as used by the server\n#\tledMap = [1,2,3,4,5,6,7,8,9,10] \t#mapped LEDs\n\t\n\tdef __init__(self, _host, _port, _ledMap):\n\t\tself.host = _host",
"\tdef __init_... |
#!/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... | [
[
8,
0,
0.2329,
0.0137,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2603,
0.0137,
0,
0.66,
0.125,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.274,
0.0137,
0,
0.66,
... | [
"'''The setup and build script for the python-twitter library.'''",
"__author__ = 'python-twitter@googlegroups.com'",
"__version__ = '0.8.5'",
"METADATA = dict(\n name = \"python-twitter\",\n version = __version__,\n py_modules = ['twitter'],\n author='The Python-Twitter Developers',\n author_email='pyth... |
#!/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... | [
[
1,
0,
0.1978,
0.011,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2088,
0.011,
0,
0.66,
0.0625,
509,
0,
1,
0,
0,
509,
0,
0
],
[
7,
0,
0.2582,
0.044,
0,
0.6... | [
"import os",
"import sys",
"try:\n from urlparse import parse_qsl\nexcept:\n from cgi import parse_qsl",
" from urlparse import parse_qsl",
" from cgi import parse_qsl",
"import oauth2 as oauth",
"REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token'",
"ACCESS_TOKEN_URL = 'https://api... |
"""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
... | [
[
8,
0,
0.0035,
0.0046,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0069,
0.0023,
0,
0.66,
0.0667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.015,
0.0092,
0,
0.66,... | [
"\"\"\"Implementation of JSONEncoder\n\"\"\"",
"import re",
"try:\n from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii = None",
" from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii",... |
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 ... | [
[
8,
0,
0.1582,
0.3133,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3165,
0.0032,
0,
0.66,
0.1,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3244,
0.0127,
0,
0.66,
... | [
"r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintaine... |
"""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... | [
[
8,
0,
0.0231,
0.0308,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0462,
0.0154,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.0846,
0.0615,
0,
0.66... | [
"\"\"\"JSON token scanner\n\"\"\"",
"import re",
"try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None",
" from simplejson._speedups import make_scanner as c_make_scanner",
" c_make_scanner = None",
"__all__ = ['make_scanner']",
... |
#!/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... | [
[
8,
0,
0.0213,
0.0071,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0355,
0.0071,
0,
0.66,
0.0667,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0496,
0.0071,
0,
0.66,... | [
"'''Post a message to twitter'''",
"__author__ = 'dewitt@google.com'",
"import ConfigParser",
"import getopt",
"import os",
"import sys",
"import twitter",
"USAGE = '''Usage: tweet [options] message\n\n This script posts a message to Twitter.\n\n Options:\n\n -h --help : print this help\n --co... |
#!/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... | [
[
8,
0,
0.2606,
0.0563,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3099,
0.0141,
0,
0.66,
0.5,
614,
0,
1,
0,
0,
614,
0,
0
],
[
3,
0,
0.7535,
0.507,
0,
0.66,
... | [
"'''A class that defines the default URL Shortener.\n\nTinyURL is provided as the default and as an example.\n'''",
"import urllib",
"class ShortenURL(object):\n '''Helper class to make URL Shortener calls if/when required'''\n def __init__(self,\n userid=None,\n password=N... |
#!/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... | [
[
1,
0,
0.0588,
0.0118,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0706,
0.0118,
0,
0.66,
0.125,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0824,
0.0118,
0,
0... | [
"import logging",
"import shutil",
"import sys",
"import urlparse",
"import SimpleHTTPServer",
"import BaseHTTPServer",
"class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):\n \"\"\"Handle playfoursquare.com requests, for testing.\"\"\"\n\n def do_GET(self):\n logging.warn('do_GET: %s, %s',... |
#!/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... | [
[
1,
0,
0.1111,
0.037,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1481,
0.037,
0,
0.66,
0.1429,
394,
0,
1,
0,
0,
394,
0,
0
],
[
1,
0,
0.1852,
0.037,
0,
0.6... | [
"import os",
"import subprocess",
"import sys",
"BASEDIR = '../main/src/com/joelapenna/foursquare'",
"TYPESDIR = '../captures/types/v1'",
"captures = sys.argv[1:]",
"if not captures:\n captures = os.listdir(TYPESDIR)",
" captures = os.listdir(TYPESDIR)",
"for f in captures:\n basename = f.split('... |
#!/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.... | [
[
8,
0,
0.0631,
0.0991,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1261,
0.009,
0,
0.66,
0.05,
2,
0,
1,
0,
0,
2,
0,
0
],
[
1,
0,
0.1351,
0.009,
0,
0.66,
0.... | [
"\"\"\"\nPull a oAuth protected page from foursquare.\n\nExpects ~/.oget to contain (one on each line):\nCONSUMER_KEY\nCONSUMER_KEY_SECRET\nUSERNAME\nPASSWORD",
"import httplib",
"import os",
"import re",
"import sys",
"import urllib",
"import urllib2",
"import urlparse",
"import user",
"from xml.... |
#!/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... | [
[
1,
0,
0.0201,
0.0067,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0268,
0.0067,
0,
0.66,
0.0769,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0336,
0.0067,
0,
... | [
"import datetime",
"import sys",
"import textwrap",
"import common",
"from xml.dom import pulldom",
"PARSER = \"\"\"\\\n/**\n * Copyright 2009 Joe LaPenna\n */\n\npackage com.joelapenna.foursquare.parsers;\n\nimport com.joelapenna.foursquare.Foursquare;",
"BOOLEAN_STANZA = \"\"\"\\\n } else i... |
#!/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... | [
[
1,
0,
0.0263,
0.0088,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0439,
0.0088,
0,
0.66,
0.0833,
290,
0,
1,
0,
0,
290,
0,
0
],
[
1,
0,
0.0526,
0.0088,
0,
... | [
"import logging",
"from xml.dom import minidom",
"from xml.dom import pulldom",
"BOOLEAN = \"boolean\"",
"STRING = \"String\"",
"GROUP = \"Group\"",
"DEFAULT_INTERFACES = ['FoursquareType']",
"INTERFACES = {\n}",
"DEFAULT_CLASS_IMPORTS = [\n]",
"CLASS_IMPORTS = {\n# 'Checkin': DEFAULT_CLASS_IMP... |
#!/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... | [
[
8,
0,
0.0675,
0.12,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.13,
0.005,
0,
0.66,
0.1111,
688,
0,
6,
0,
0,
688,
0,
0
],
[
1,
0,
0.135,
0.005,
0,
0.66,
0... | [
"\"\"\"\nTo do:\n\n3) command-line argument (to test a single file)\n\n- What about exceptions and aborts?\n\n-If ...is embedded anywhere in a line, that portion becomes a .*? regexp",
"import os, re, glob, sys, string, codecs",
"from difflib import SequenceMatcher",
"argTag = '// {Args: '",
"targetOutput =... |
#!/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... | [
[
8,
0,
0.0675,
0.12,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.13,
0.005,
0,
0.66,
0.1111,
688,
0,
6,
0,
0,
688,
0,
0
],
[
1,
0,
0.135,
0.005,
0,
0.66,
0... | [
"\"\"\"\nTo do:\n\n3) command-line argument (to test a single file)\n\n- What about exceptions and aborts?\n\n-If ...is embedded anywhere in a line, that portion becomes a .*? regexp",
"import os, re, glob, sys, string, codecs",
"from difflib import SequenceMatcher",
"argTag = '// {Args: '",
"targetOutput =... |
#!/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... | [
[
8,
0,
0.22,
0.32,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4,
0.04,
0,
0.66,
0.3333,
688,
0,
1,
0,
0,
688,
0,
0
],
[
6,
0,
0.66,
0.4,
0,
0.66,
0.6667,
... | [
"\"\"\"\nDEclipse.py by Bruce Eckel, for Thinking in Java 4e\n\nUndoes the effect of Eclipse.py, so that Ant can be used\nagain to build the code tree.\n\nYou must have Python 2.3 installed to run this program. See www.python.org.\n\"\"\"",
"import os",
"for path, dirs, files in os.walk('.'):\n for file in f... |
#!/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)
... | [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
]
] | [
"import os"
] |
#!/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 ... | [
[
8,
0,
0.0609,
0.0957,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.113,
0.0087,
0,
0.66,
0.0833,
688,
0,
1,
0,
0,
688,
0,
0
],
[
8,
0,
0.1304,
0.0087,
0,
0.66,... | [
"\"\"\"\nEclipse.py by Bruce Eckel, for Thinking in Java 4e\nModify or insert package statments so that Eclipse is happy with the code tree.\nRun this with no arguments from the root of the code tree.\n\nThe Ant build will not work once you run this program!\n\nYou may also want to modify the dotproject and dotclas... |
#!/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 ... | [
[
8,
0,
0.0609,
0.0957,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.113,
0.0087,
0,
0.66,
0.0833,
688,
0,
1,
0,
0,
688,
0,
0
],
[
8,
0,
0.1304,
0.0087,
0,
0.66,... | [
"\"\"\"\nEclipse.py by Bruce Eckel, for Thinking in Java 4e\nModify or insert package statments so that Eclipse is happy with the code tree.\nRun this with no arguments from the root of the code tree.\n\nThe Ant build will not work once you run this program!\n\nYou may also want to modify the dotproject and dotclas... |
#!/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... | [
[
8,
0,
0.22,
0.32,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4,
0.04,
0,
0.66,
0.3333,
688,
0,
1,
0,
0,
688,
0,
0
],
[
6,
0,
0.66,
0.4,
0,
0.66,
0.6667,
... | [
"\"\"\"\nDEclipse.py by Bruce Eckel, for Thinking in Java 4e\n\nUndoes the effect of Eclipse.py, so that Ant can be used\nagain to build the code tree.\n\nYou must have Python 2.3 installed to run this program. See www.python.org.\n\"\"\"",
"import os",
"for path, dirs, files in os.walk('.'):\n for file in f... |
#!/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)
... | [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
]
] | [
"import os"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.