code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
#!/usr/bin/python
#-*- coding: utf-8 -*-
import sys
from xml.dom.minidom import parseString
f = open(sys.argv[1],"r").read()
arbol = parseString(f)
for i in arbol.getElementsByTagName("habitacion"):
print "* " + i.attributes.getNamedItem("id").value
| [
[
1,
0,
0.3636,
0.0909,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.4545,
0.0909,
0,
0.66,
0.25,
770,
0,
1,
0,
0,
770,
0,
0
],
[
14,
0,
0.6364,
0.0909,
0,
0... | [
"import sys",
"from xml.dom.minidom import parseString",
"f = open(sys.argv[1],\"r\").read()",
"arbol = parseString(f)",
"for i in arbol.getElementsByTagName(\"habitacion\"):\n print(\"* \" + i.attributes.getNamedItem(\"id\").value)",
" print(\"* \" + i.attributes.getNamedItem(\"id\").value)"
] |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import sys
from xml.dom.minidom import parseString
f = open(sys.argv[1],"r").read()
arbol = parseString(f)
for i in arbol.getElementsByTagName("habitacion"):
print "* " + i.attributes.getNamedItem("id").value
| [
[
1,
0,
0.3636,
0.0909,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.4545,
0.0909,
0,
0.66,
0.25,
770,
0,
1,
0,
0,
770,
0,
0
],
[
14,
0,
0.6364,
0.0909,
0,
0... | [
"import sys",
"from xml.dom.minidom import parseString",
"f = open(sys.argv[1],\"r\").read()",
"arbol = parseString(f)",
"for i in arbol.getElementsByTagName(\"habitacion\"):\n print(\"* \" + i.attributes.getNamedItem(\"id\").value)",
" print(\"* \" + i.attributes.getNamedItem(\"id\").value)"
] |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import sys
import urllib2
from xml.dom.minidom import parseString
f = urllib2.urlopen(sys.argv[1]).read()
arbol = parseString(f)
for i in arbol.getElementsByTagName("item"):
print " * " + i.getElementsByTagName("title")[0].firstChild.nodeValue
| [
[
1,
0,
0.3333,
0.0833,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.4167,
0.0833,
0,
0.66,
0.2,
345,
0,
1,
0,
0,
345,
0,
0
],
[
1,
0,
0.5,
0.0833,
0,
0.66,
... | [
"import sys",
"import urllib2",
"from xml.dom.minidom import parseString",
"f = urllib2.urlopen(sys.argv[1]).read()",
"arbol = parseString(f)",
"for i in arbol.getElementsByTagName(\"item\"):\n print(\" * \" + i.getElementsByTagName(\"title\")[0].firstChild.nodeValue)",
" print(\" * \" + i.getElementsBy... |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import sys
import urllib2
from xml.dom.minidom import parseString
f = urllib2.urlopen(sys.argv[1]).read()
arbol = parseString(f)
for i in arbol.getElementsByTagName("item"):
print " * " + i.getElementsByTagName("title")[0].firstChild.nodeValue
| [
[
1,
0,
0.3333,
0.0833,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.4167,
0.0833,
0,
0.66,
0.2,
345,
0,
1,
0,
0,
345,
0,
0
],
[
1,
0,
0.5,
0.0833,
0,
0.66,
... | [
"import sys",
"import urllib2",
"from xml.dom.minidom import parseString",
"f = urllib2.urlopen(sys.argv[1]).read()",
"arbol = parseString(f)",
"for i in arbol.getElementsByTagName(\"item\"):\n print(\" * \" + i.getElementsByTagName(\"title\")[0].firstChild.nodeValue)",
" print(\" * \" + i.getElementsBy... |
import libxml2
doc = libxml2.parseFile('t212.xml')
for nombreHabitacion in doc.xpathEval('//habitacion[@puerta="pasillo"]'):
print nombreHabitacion.content
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
256,
0,
1,
0,
0,
256,
0,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.5,
555,
3,
1,
0,
0,
947,
10,
1
],
[
6,
0,
0.875,
0.5,
0,
0.66,
1,
... | [
"import libxml2",
"doc = libxml2.parseFile('t212.xml')",
"for nombreHabitacion in doc.xpathEval('//habitacion[@puerta=\"pasillo\"]'):\n print(nombreHabitacion.content)",
" print(nombreHabitacion.content)"
] |
#! /usr/bin/env python
# encoding=utf-8
from xml.sax import make_parser
from xml.sax.saxutils import XMLGenerator
class Handler(XMLGenerator):
def startElement(self, name, attr):
name = self.traducir(name)
XMLGenerator.startElement(self, name, attr)
def endElement(self, name):
name = self.traducir(name)
... | [
[
1,
0,
0.1538,
0.0385,
0,
0.66,
0,
587,
0,
1,
0,
0,
587,
0,
0
],
[
1,
0,
0.1923,
0.0385,
0,
0.66,
0.2,
759,
0,
1,
0,
0,
759,
0,
0
],
[
3,
0,
0.5577,
0.6154,
0,
0.6... | [
"from xml.sax import make_parser",
"from xml.sax.saxutils import XMLGenerator",
"class Handler(XMLGenerator):\n\tdef startElement(self, name, attr):\n\t\tname = self.traducir(name)\n\t\tXMLGenerator.startElement(self, name, attr)\n\t\n\tdef endElement(self, name):\n\t\tname = self.traducir(name)\n\t\tXMLGenerat... |
#! /usr/bin/env python
# encoding=utf-8
import cgi
import urllib
import feedparser
import jsonpickle
url = cgi.FieldStorage()['url'].value
feed = jsonpickle.encode(feedparser.parse(url))
print 'Content-Type: text/plain'
print
print feed | [
[
1,
0,
0.3077,
0.0769,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.3846,
0.0769,
0,
0.66,
0.1667,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.4615,
0.0769,
0,
... | [
"import cgi",
"import urllib",
"import feedparser",
"import jsonpickle",
"url = cgi.FieldStorage()['url'].value",
"feed = jsonpickle.encode(feedparser.parse(url))",
"print('Content-Type: text/plain')"
] |
#! /usr/bin/env python
# encoding=utf-8
from xml.dom.ext.reader import Sax2
from xml import xpath
doc = Sax2.FromXmlFile('micasa.xml').documentElement
for nodo in xpath.Evaluate('//habitacion[position() <= 2]', doc):
print nodo.getAttribute('id') | [
[
1,
0,
0.4444,
0.1111,
0,
0.66,
0,
45,
0,
1,
0,
0,
45,
0,
0
],
[
1,
0,
0.5556,
0.1111,
0,
0.66,
0.3333,
324,
0,
1,
0,
0,
324,
0,
0
],
[
14,
0,
0.7778,
0.1111,
0,
0... | [
"from xml.dom.ext.reader import Sax2",
"from xml import xpath",
"doc = Sax2.FromXmlFile('micasa.xml').documentElement",
"for nodo in xpath.Evaluate('//habitacion[position() <= 2]', doc):\n\tprint(nodo.getAttribute('id'))",
"\tprint(nodo.getAttribute('id'))"
] |
#! /usr/bin/env python
from feedparser import parse
# Funciona con RSS y Atom
# RSS 2 => http://www.enchufa2.es/feed
# Atom => http://www.enchufa2.es/feed/atom
feed = parse('http://www.enchufa2.es/feed')
for item in feed['items']:
print item.title
print item.date + "\n" | [
[
1,
0,
0.25,
0.0833,
0,
0.66,
0,
4,
0,
1,
0,
0,
4,
0,
0
],
[
14,
0,
0.75,
0.0833,
0,
0.66,
0.5,
87,
3,
1,
0,
0,
678,
10,
1
],
[
6,
0,
0.9167,
0.25,
0,
0.66,
1,... | [
"from feedparser import parse",
"feed = parse('http://www.enchufa2.es/feed')",
"for item in feed['items']:\n\tprint(item.title)\n\tprint(item.date + \"\\n\")",
"\tprint(item.title)",
"\tprint(item.date + \"\\n\")"
] |
#! /usr/bin/env python
# encoding=utf-8
import cgi
import urllib
url = cgi.FieldStorage()['url'].value
feed = urllib.urlopen(url).read()
print 'Content-Type: application/xml+rss'
print
print feed | [
[
1,
0,
0.3636,
0.0909,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.4545,
0.0909,
0,
0.66,
0.25,
614,
0,
1,
0,
0,
614,
0,
0
],
[
14,
0,
0.6364,
0.0909,
0,
0... | [
"import cgi",
"import urllib",
"url = cgi.FieldStorage()['url'].value",
"feed = urllib.urlopen(url).read()",
"print('Content-Type: application/xml+rss')"
] |
#! /usr/bin/env python
import xml.etree.ElementTree as x
import sys
tree = x.parse(open(sys.argv[1]))
for element in tree.iter():
if element.tag == 'habitacion':
print element.attrib['id'] | [
[
1,
0,
0.3333,
0.1111,
0,
0.66,
0,
902,
0,
1,
0,
0,
902,
0,
0
],
[
1,
0,
0.4444,
0.1111,
0,
0.66,
0.3333,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.6667,
0.1111,
0,
... | [
"import xml.etree.ElementTree as x",
"import sys",
"tree = x.parse(open(sys.argv[1]))",
"for element in tree.iter():\n\tif element.tag == 'habitacion':\n\t\tprint(element.attrib['id'])",
"\tif element.tag == 'habitacion':\n\t\tprint(element.attrib['id'])",
"\t\tprint(element.attrib['id'])"
] |
#! /usr/bin/env python
from feedparser import parse
# Funciona con RSS y Atom
# RSS 2 => http://www.enchufa2.es/feed
# Atom => http://www.enchufa2.es/feed/atom
feed = parse('http://www.enchufa2.es/feed')
for item in feed['items']:
print item.title
print item.date + "\n" | [
[
1,
0,
0.25,
0.0833,
0,
0.66,
0,
4,
0,
1,
0,
0,
4,
0,
0
],
[
14,
0,
0.75,
0.0833,
0,
0.66,
0.5,
87,
3,
1,
0,
0,
678,
10,
1
],
[
6,
0,
0.9167,
0.25,
0,
0.66,
1,... | [
"from feedparser import parse",
"feed = parse('http://www.enchufa2.es/feed')",
"for item in feed['items']:\n\tprint(item.title)\n\tprint(item.date + \"\\n\")",
"\tprint(item.title)",
"\tprint(item.date + \"\\n\")"
] |
#! /usr/bin/env python
# encoding=utf-8
from xml.sax import make_parser
from xml.sax.saxutils import XMLGenerator
class Handler(XMLGenerator):
def startElement(self, name, attr):
name = self.traducir(name)
XMLGenerator.startElement(self, name, attr)
def endElement(self, name):
name = self.traducir(name)
... | [
[
1,
0,
0.1538,
0.0385,
0,
0.66,
0,
587,
0,
1,
0,
0,
587,
0,
0
],
[
1,
0,
0.1923,
0.0385,
0,
0.66,
0.2,
759,
0,
1,
0,
0,
759,
0,
0
],
[
3,
0,
0.5577,
0.6154,
0,
0.6... | [
"from xml.sax import make_parser",
"from xml.sax.saxutils import XMLGenerator",
"class Handler(XMLGenerator):\n\tdef startElement(self, name, attr):\n\t\tname = self.traducir(name)\n\t\tXMLGenerator.startElement(self, name, attr)\n\t\n\tdef endElement(self, name):\n\t\tname = self.traducir(name)\n\t\tXMLGenerat... |
#! /usr/bin/env python
# encoding=utf-8
from xml.dom.ext.reader import Sax2
from xml import xpath
doc = Sax2.FromXmlFile('micasa.xml').documentElement
for nodo in xpath.Evaluate('//habitacion[position() <= 2]', doc):
print nodo.getAttribute('id') | [
[
1,
0,
0.4444,
0.1111,
0,
0.66,
0,
45,
0,
1,
0,
0,
45,
0,
0
],
[
1,
0,
0.5556,
0.1111,
0,
0.66,
0.3333,
324,
0,
1,
0,
0,
324,
0,
0
],
[
14,
0,
0.7778,
0.1111,
0,
0... | [
"from xml.dom.ext.reader import Sax2",
"from xml import xpath",
"doc = Sax2.FromXmlFile('micasa.xml').documentElement",
"for nodo in xpath.Evaluate('//habitacion[position() <= 2]', doc):\n\tprint(nodo.getAttribute('id'))",
"\tprint(nodo.getAttribute('id'))"
] |
#! /usr/bin/env python
import xml.etree.ElementTree as x
import sys
tree = x.parse(open(sys.argv[1]))
for element in tree.iter():
if element.tag == 'habitacion':
print element.attrib['id'] | [
[
1,
0,
0.3333,
0.1111,
0,
0.66,
0,
902,
0,
1,
0,
0,
902,
0,
0
],
[
1,
0,
0.4444,
0.1111,
0,
0.66,
0.3333,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.6667,
0.1111,
0,
... | [
"import xml.etree.ElementTree as x",
"import sys",
"tree = x.parse(open(sys.argv[1]))",
"for element in tree.iter():\n\tif element.tag == 'habitacion':\n\t\tprint(element.attrib['id'])",
"\tif element.tag == 'habitacion':\n\t\tprint(element.attrib['id'])",
"\t\tprint(element.attrib['id'])"
] |
#! /usr/bin/env python
# encoding=utf-8
import cgi
import urllib
import feedparser
import jsonpickle
url = cgi.FieldStorage()['url'].value
feed = jsonpickle.encode(feedparser.parse(url))
print 'Content-Type: text/plain'
print
print feed | [
[
1,
0,
0.3077,
0.0769,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.3846,
0.0769,
0,
0.66,
0.1667,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.4615,
0.0769,
0,
... | [
"import cgi",
"import urllib",
"import feedparser",
"import jsonpickle",
"url = cgi.FieldStorage()['url'].value",
"feed = jsonpickle.encode(feedparser.parse(url))",
"print('Content-Type: text/plain')"
] |
#! /usr/bin/env python
# encoding=utf-8
import cgi
print 'Content-Type: application/xml+rss'
print
print '''\
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1... | [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
]
] | [
"import cgi"
] |
#! /usr/bin/env python
# encoding=utf-8
from xml.dom.ext.reader import Sax2
from xml import xpath
import sys
doc = Sax2.FromXmlFile('micasa.xml').documentElement
for nodo in xpath.Evaluate('//habitacion[puerta[@a="' + sys.argv[1] + '"]]', doc):
print nodo.getAttribute('id') | [
[
1,
0,
0.4,
0.1,
0,
0.66,
0,
45,
0,
1,
0,
0,
45,
0,
0
],
[
1,
0,
0.5,
0.1,
0,
0.66,
0.25,
324,
0,
1,
0,
0,
324,
0,
0
],
[
1,
0,
0.6,
0.1,
0,
0.66,
0.5,
509... | [
"from xml.dom.ext.reader import Sax2",
"from xml import xpath",
"import sys",
"doc = Sax2.FromXmlFile('micasa.xml').documentElement",
"for nodo in xpath.Evaluate('//habitacion[puerta[@a=\"' + sys.argv[1] + '\"]]', doc):\n\tprint(nodo.getAttribute('id'))",
"\tprint(nodo.getAttribute('id'))"
] |
#! /usr/bin/env python
# encoding=utf-8
import cgi
import urllib
url = cgi.FieldStorage()['url'].value
feed = urllib.urlopen(url).read()
print 'Content-Type: application/xml+rss'
print
print feed | [
[
1,
0,
0.3636,
0.0909,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.4545,
0.0909,
0,
0.66,
0.25,
614,
0,
1,
0,
0,
614,
0,
0
],
[
14,
0,
0.6364,
0.0909,
0,
0... | [
"import cgi",
"import urllib",
"url = cgi.FieldStorage()['url'].value",
"feed = urllib.urlopen(url).read()",
"print('Content-Type: application/xml+rss')"
] |
#! /usr/bin/env python
# encoding=utf-8
import cgi
print 'Content-Type: application/xml+rss'
print
print '''\
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1... | [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
]
] | [
"import cgi"
] |
#! /usr/bin/env python
# encoding=utf-8
from xml.dom.ext.reader import Sax2
from xml import xpath
import sys
doc = Sax2.FromXmlFile('micasa.xml').documentElement
for nodo in xpath.Evaluate('//habitacion[puerta[@a="' + sys.argv[1] + '"]]', doc):
print nodo.getAttribute('id') | [
[
1,
0,
0.4,
0.1,
0,
0.66,
0,
45,
0,
1,
0,
0,
45,
0,
0
],
[
1,
0,
0.5,
0.1,
0,
0.66,
0.25,
324,
0,
1,
0,
0,
324,
0,
0
],
[
1,
0,
0.6,
0.1,
0,
0.66,
0.5,
509... | [
"from xml.dom.ext.reader import Sax2",
"from xml import xpath",
"import sys",
"doc = Sax2.FromXmlFile('micasa.xml').documentElement",
"for nodo in xpath.Evaluate('//habitacion[puerta[@a=\"' + sys.argv[1] + '\"]]', doc):\n\tprint(nodo.getAttribute('id'))",
"\tprint(nodo.getAttribute('id'))"
] |
#! /usr/bin/env python
# encoding=utf-8
from xml.sax import parseString
from xml.sax.handler import ContentHandler
from urllib import urlopen
class Handler(ContentHandler):
def startElement(self, name, attrs):
if name == 'post':
print attrs.getValue(u'time'), '->', attrs.getValue(u'href')
url = 'https://xxxx:... | [
[
1,
0,
0.25,
0.0625,
0,
0.66,
0,
587,
0,
1,
0,
0,
587,
0,
0
],
[
1,
0,
0.3125,
0.0625,
0,
0.66,
0.1429,
416,
0,
1,
0,
0,
416,
0,
0
],
[
1,
0,
0.375,
0.0625,
0,
0.6... | [
"from xml.sax import parseString",
"from xml.sax.handler import ContentHandler",
"from urllib import urlopen",
"class Handler(ContentHandler):\n\tdef startElement(self, name, attrs):\n\t\tif name == 'post':\n\t\t\tprint(attrs.getValue(u'time'), '->', attrs.getValue(u'href'))",
"\tdef startElement(self, name... |
#! /usr/bin/env python
# encoding=utf-8
from xmlrpclib import ServerProxy
username = 'aapugr'
password = 'ugr_aap'
server = ServerProxy('http://aapugr.wordpress.com/xmlrpc.php')
post = server.metaWeblog.getRecentPosts(1, username, password, 1)[0]
print 'Último post:', post['postid']
print 'Título:', post['title']
p... | [
[
1,
0,
0.1905,
0.0476,
0,
0.66,
0,
251,
0,
1,
0,
0,
251,
0,
0
],
[
14,
0,
0.2857,
0.0476,
0,
0.66,
0.0909,
718,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.0476,
0,
... | [
"from xmlrpclib import ServerProxy",
"username = 'aapugr'",
"password = 'ugr_aap'",
"server = ServerProxy('http://aapugr.wordpress.com/xmlrpc.php')",
"post = server.metaWeblog.getRecentPosts(1, username, password, 1)[0]",
"print('Último post:', post['postid'])",
"print('Título:', post['title'])",
"pri... |
#! /usr/bin/env python
# encoding=utf-8
from xml.sax import parseString
from xml.sax.handler import ContentHandler
from urllib import urlopen
class Handler(ContentHandler):
def __init__(self):
self.name = [False, None]
self.location = [False, None]
self.url = [False, None]
self.text = False
def startElem... | [
[
1,
0,
0.1053,
0.0263,
0,
0.66,
0,
587,
0,
1,
0,
0,
587,
0,
0
],
[
1,
0,
0.1316,
0.0263,
0,
0.66,
0.2,
416,
0,
1,
0,
0,
416,
0,
0
],
[
1,
0,
0.1579,
0.0263,
0,
0.6... | [
"from xml.sax import parseString",
"from xml.sax.handler import ContentHandler",
"from urllib import urlopen",
"class Handler(ContentHandler):\n\tdef __init__(self):\n\t\tself.name = [False, None]\n\t\tself.location = [False, None]\n\t\tself.url = [False, None]\n\t\tself.text = False\n\t\n\tdef startElement(s... |
#! /usr/bin/env python
# encoding=utf-8
from suds.client import Client
api = 'asdf'
url = 'http://api.bing.net/search.wsdl?AppID='+api
client = Client(url)
print client
request = client.factory.create('SearchRequest')
request.parameters.AppId = api
sourcetype = client.factory.create('SourceType')
arraysource = cl... | [
[
1,
0,
0.1212,
0.0303,
0,
0.66,
0,
743,
0,
1,
0,
0,
743,
0,
0
],
[
14,
0,
0.1818,
0.0303,
0,
0.66,
0.0625,
976,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2424,
0.0303,
0,
... | [
"from suds.client import Client",
"api = 'asdf'",
"url = 'http://api.bing.net/search.wsdl?AppID='+api",
"client = Client(url)",
"print(client)",
"request = client.factory.create('SearchRequest')",
"request.parameters.AppId = api",
"sourcetype = client.factory.create('SourceType')",
"arraysource = cl... |
#! /usr/bin/env python
# encoding=utf-8
from suds.client import Client
api = 'asdf'
url = 'http://api.bing.net/search.wsdl?AppID='+api
client = Client(url)
print client
request = client.factory.create('SearchRequest')
request.parameters.AppId = api
sourcetype = client.factory.create('SourceType')
arraysource = cl... | [
[
1,
0,
0.1212,
0.0303,
0,
0.66,
0,
743,
0,
1,
0,
0,
743,
0,
0
],
[
14,
0,
0.1818,
0.0303,
0,
0.66,
0.0625,
976,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2424,
0.0303,
0,
... | [
"from suds.client import Client",
"api = 'asdf'",
"url = 'http://api.bing.net/search.wsdl?AppID='+api",
"client = Client(url)",
"print(client)",
"request = client.factory.create('SearchRequest')",
"request.parameters.AppId = api",
"sourcetype = client.factory.create('SourceType')",
"arraysource = cl... |
#! /usr/bin/env python
# encoding=utf-8
from xmlrpclib import ServerProxy
server = ServerProxy('http://admin:existe@localhost:8081/exist/xmlrpc')
print server.describeCollection('/db/aap')
#xml = raw_input('Introduzca el documento XML: ')
xml = '''\
<datos>
<cosa>asdfad</cosa>
</datos>'''
server.parse(xml, '/db/aa... | [
[
1,
0,
0.25,
0.0625,
0,
0.66,
0,
251,
0,
1,
0,
0,
251,
0,
0
],
[
14,
0,
0.375,
0.0625,
0,
0.66,
0.25,
268,
3,
1,
0,
0,
164,
10,
1
],
[
8,
0,
0.5,
0.0625,
0,
0.66,
... | [
"from xmlrpclib import ServerProxy",
"server = ServerProxy('http://admin:existe@localhost:8081/exist/xmlrpc')",
"print(server.describeCollection('/db/aap'))",
"xml = '''\\\n<datos>\n<cosa>asdfad</cosa>\n</datos>'''",
"server.parse(xml, '/db/aap/datos')"
] |
#! /usr/bin/env python
# encoding=utf-8
from xmlrpclib import ServerProxy
username = 'aapugr'
password = 'ugr_aap'
server = ServerProxy('http://aapugr.wordpress.com/xmlrpc.php')
post = server.metaWeblog.getRecentPosts(1, username, password, 1)[0]
print 'Último post:', post['postid']
print 'Título:', post['title']
p... | [
[
1,
0,
0.1905,
0.0476,
0,
0.66,
0,
251,
0,
1,
0,
0,
251,
0,
0
],
[
14,
0,
0.2857,
0.0476,
0,
0.66,
0.0909,
718,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.0476,
0,
... | [
"from xmlrpclib import ServerProxy",
"username = 'aapugr'",
"password = 'ugr_aap'",
"server = ServerProxy('http://aapugr.wordpress.com/xmlrpc.php')",
"post = server.metaWeblog.getRecentPosts(1, username, password, 1)[0]",
"print('Último post:', post['postid'])",
"print('Título:', post['title'])",
"pri... |
#! /usr/bin/env python
# encoding=utf-8
from xml.sax import parseString
from xml.sax.handler import ContentHandler
from urllib import urlopen
class Handler(ContentHandler):
def startElement(self, name, attrs):
if name == 'post':
print attrs.getValue(u'time'), '->', attrs.getValue(u'href')
url = 'https://xxxx:... | [
[
1,
0,
0.25,
0.0625,
0,
0.66,
0,
587,
0,
1,
0,
0,
587,
0,
0
],
[
1,
0,
0.3125,
0.0625,
0,
0.66,
0.1429,
416,
0,
1,
0,
0,
416,
0,
0
],
[
1,
0,
0.375,
0.0625,
0,
0.6... | [
"from xml.sax import parseString",
"from xml.sax.handler import ContentHandler",
"from urllib import urlopen",
"class Handler(ContentHandler):\n\tdef startElement(self, name, attrs):\n\t\tif name == 'post':\n\t\t\tprint(attrs.getValue(u'time'), '->', attrs.getValue(u'href'))",
"\tdef startElement(self, name... |
#! /usr/bin/env python
# encoding=utf-8
from xml.sax import parseString
from xml.sax.handler import ContentHandler
from urllib import urlopen
class Handler(ContentHandler):
def __init__(self):
self.name = [False, None]
self.location = [False, None]
self.url = [False, None]
self.text = False
def startElem... | [
[
1,
0,
0.1053,
0.0263,
0,
0.66,
0,
587,
0,
1,
0,
0,
587,
0,
0
],
[
1,
0,
0.1316,
0.0263,
0,
0.66,
0.2,
416,
0,
1,
0,
0,
416,
0,
0
],
[
1,
0,
0.1579,
0.0263,
0,
0.6... | [
"from xml.sax import parseString",
"from xml.sax.handler import ContentHandler",
"from urllib import urlopen",
"class Handler(ContentHandler):\n\tdef __init__(self):\n\t\tself.name = [False, None]\n\t\tself.location = [False, None]\n\t\tself.url = [False, None]\n\t\tself.text = False\n\t\n\tdef startElement(s... |
#! /usr/bin/env python
# encoding=utf-8
from xmlrpclib import ServerProxy
server = ServerProxy('http://admin:existe@localhost:8081/exist/xmlrpc')
print server.describeCollection('/db/aap')
#xml = raw_input('Introduzca el documento XML: ')
xml = '''\
<datos>
<cosa>asdfad</cosa>
</datos>'''
server.parse(xml, '/db/aa... | [
[
1,
0,
0.25,
0.0625,
0,
0.66,
0,
251,
0,
1,
0,
0,
251,
0,
0
],
[
14,
0,
0.375,
0.0625,
0,
0.66,
0.25,
268,
3,
1,
0,
0,
164,
10,
1
],
[
8,
0,
0.5,
0.0625,
0,
0.66,
... | [
"from xmlrpclib import ServerProxy",
"server = ServerProxy('http://admin:existe@localhost:8081/exist/xmlrpc')",
"print(server.describeCollection('/db/aap'))",
"xml = '''\\\n<datos>\n<cosa>asdfad</cosa>\n</datos>'''",
"server.parse(xml, '/db/aap/datos')"
] |
#!/usr/bin/env python
import cgi
import urllib
import urllib2
import httplib
from xml.dom import minidom
form = cgi.FieldStorage()
if form.has_key('user'): name=form.getvalue('user')
if form.has_key('pass'): passwd=form.getvalue('pass')
#Chequeamos el registro. Necesitamos la BD.
parametros = urllib.urlencode({"_qu... | [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.25,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.5,
0.1667,
0,
0.66,... | [
"import cgi",
"import urllib",
"import urllib2",
"import httplib",
"from xml.dom import minidom"
] |
#!/usr/bin/env python
import cgi
print """\
Content-Type: text/plain\n
Funciona
"""
| [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
]
] | [
"import cgi"
] |
#!/usr/bin/env python
import cgi
import urllib
import urllib2
form = cgi.FieldStorage()
if form.has_key('buscar'): titulo=form.getvalue('buscar')
#Consultamos a IMdB
parametros = urllib.urlencode({"t":titulo,"plot":"full","tomatoes":"true"})
#url = '/?t='+titulo+'&plot=full&tomatoes=true'
#solicitud = urllib2.Reque... | [
[
1,
0,
0.3333,
0.3333,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
1,
0.3333,
0,
0.66,
... | [
"import cgi",
"import urllib",
"import urllib2"
] |
#!/usr/bin/env python
import cgi
import urllib
import urllib2
import httplib
from xml.dom import minidom
form = cgi.FieldStorage()
if form.has_key('pelicula'): pel=form.getvalue('pelicula')
if form.has_key('usuario'): user=form.getvalue('usuario')
if form.has_key('comentario'): comment=form.getvalue('comentario')
if... | [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.25,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.5,
0.1667,
0,
0.66,... | [
"import cgi",
"import urllib",
"import urllib2",
"import httplib",
"from xml.dom import minidom"
] |
#!/usr/bin/env python
import cgi
import urllib
import urllib2
import httplib
from xml.dom import minidom
form = cgi.FieldStorage()
if form.has_key('user'): name=form.getvalue('user')
if form.has_key('pass'): passwd=form.getvalue('pass')
#Chequeamos el registro. Necesitamos la BD.
parametros = urllib.urlencode({"_qu... | [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.25,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.5,
0.1667,
0,
0.66,... | [
"import cgi",
"import urllib",
"import urllib2",
"import httplib",
"from xml.dom import minidom"
] |
#!/usr/bin/env python
import cgi
import urllib
import urllib2
from xml.dom import minidom
form = cgi.FieldStorage()
if form.has_key('buscar'): pel=form.getvalue('buscar')
pel = pel.lower()
#Chequeamos el registro. Necesitamos la BD.
parametros = urllib.urlencode({"_query":"//pelicula[@name='"+pel+"']","_wrap":"no... | [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.3333,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.5,
0.1667,
0,
0.6... | [
"import cgi",
"import urllib",
"import urllib2",
"from xml.dom import minidom"
] |
#!/usr/bin/env python
import cgi
import urllib
import urllib2
form = cgi.FieldStorage()
if form.has_key('buscar'): titulo=form.getvalue('buscar')
#Consultamos a IMdB
parametros = urllib.urlencode({"t":titulo,"plot":"full","tomatoes":"true"})
#url = '/?t='+titulo+'&plot=full&tomatoes=true'
#solicitud = urllib2.Reque... | [
[
1,
0,
0.3333,
0.3333,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
1,
0.3333,
0,
0.66,
... | [
"import cgi",
"import urllib",
"import urllib2"
] |
#!/usr/bin/env python
import cgi
print """\
Content-Type: text/plain\n
Funciona
"""
| [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
]
] | [
"import cgi"
] |
from xml.dom import minidom
#Tratamiento del XML
def leer_pelicula(nombre):
pelis = xml.getElementsByTagName('film')
for peli in pelis:
if peli.attributes['title'].nodeValue == nombre:
print peli.attributes['title'].nodeValue
xml = minidom.parse("films.xml");
leer_pelicula('Stalker')
| [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
290,
0,
1,
0,
0,
290,
0,
0
],
[
2,
0,
0.375,
0.3125,
0,
0.66,
0.3333,
79,
0,
1,
0,
0,
0,
0,
2
],
[
14,
1,
0.3125,
0.0625,
1,
0.5... | [
"from xml.dom import minidom",
"def leer_pelicula(nombre):\n\tpelis = xml.getElementsByTagName('film')\n\tfor peli in pelis:\n\t\tif peli.attributes['title'].nodeValue == nombre:\n\t\t\tprint(peli.attributes['title'].nodeValue)",
"\tpelis = xml.getElementsByTagName('film')",
"\tfor peli in pelis:\n\t\tif peli... |
#!/usr/bin/env python
import cgi
import urllib
import urllib2
import httplib
from xml.dom import minidom
form = cgi.FieldStorage()
if form.has_key('pelicula'): pel=form.getvalue('pelicula')
if form.has_key('usuario'): user=form.getvalue('usuario')
if form.has_key('comentario'): comment=form.getvalue('comentario')
if... | [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.25,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.5,
0.1667,
0,
0.66,... | [
"import cgi",
"import urllib",
"import urllib2",
"import httplib",
"from xml.dom import minidom"
] |
#!/usr/bin/env python
import cgi
import urllib
import urllib2
from xml.dom import minidom
form = cgi.FieldStorage()
if form.has_key('buscar'): pel=form.getvalue('buscar')
pel = pel.lower()
#Chequeamos el registro. Necesitamos la BD.
parametros = urllib.urlencode({"_query":"//pelicula[@name='"+pel+"']","_wrap":"no... | [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.3333,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.5,
0.1667,
0,
0.6... | [
"import cgi",
"import urllib",
"import urllib2",
"from xml.dom import minidom"
] |
#!/usr/bin/env python
import cgi
form = cgi.FieldStorage()
if form.has_key('user'): nombre=form.getvalue('user')
if form.has_key('pass'): passwd=form.getvalue('pass')
#Chequeamos el registro. Necesitamos la BD.
loginOK=True
if loginOK==True:
print """\
Content-Type: text/plain\n
LoginOK
"""
else:
print """\
C... | [
[
1,
0,
1,
1,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
]
] | [
"import cgi"
] |
#!/usr/bin/env python
import cgi
form = cgi.FieldStorage()
if form.has_key('user'): nombre=form.getvalue('user')
if form.has_key('pass'): passwd=form.getvalue('pass')
#Chequeamos el registro. Necesitamos la BD.
loginOK=True
if loginOK==True:
print """\
Content-Type: text/plain\n
LoginOK
"""
else:
print """\
C... | [
[
1,
0,
1,
1,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
]
] | [
"import cgi"
] |
#!/usr/bin/env python
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2008 - 2010 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# LGPL: http://www.gnu.org/licenses/lgpl.html
# ... | [
[
1,
0,
0.3472,
0.0139,
0,
0.66,
0,
509,
0,
4,
0,
0,
509,
0,
0
],
[
14,
0,
0.375,
0.0139,
0,
0.66,
0.0667,
328,
7,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3889,
0.0139,
0,
0... | [
"import sys, os, re, subprocess",
"CMD_PYTHON = sys.executable",
"QOOXDOO_PATH = '../qooxdoo-1.4-sdk'",
"def getQxPath():\n path = QOOXDOO_PATH\n # try updating from config file\n if os.path.exists('config.json'):\n # \"using QOOXDOO_PATH from config.json\"\n qpathr=re.compile(r'\"QOOXD... |
#!/usr/bin/env python
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2008 - 2010 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# LGPL: http://www.gnu.org/licenses/lgpl.html
# ... | [
[
1,
0,
0.3472,
0.0139,
0,
0.66,
0,
509,
0,
4,
0,
0,
509,
0,
0
],
[
14,
0,
0.375,
0.0139,
0,
0.66,
0.0667,
328,
7,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3889,
0.0139,
0,
0... | [
"import sys, os, re, subprocess",
"CMD_PYTHON = sys.executable",
"QOOXDOO_PATH = '../qooxdoo-1.4-sdk'",
"def getQxPath():\n path = QOOXDOO_PATH\n # try updating from config file\n if os.path.exists('config.json'):\n # \"using QOOXDOO_PATH from config.json\"\n qpathr=re.compile(r'\"QOOXD... |
#!/usr/bin/env python
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2008 - 2010 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# LGPL: http://www.gnu.org/licenses/lgpl.html
# ... | [
[
1,
0,
0.3472,
0.0139,
0,
0.66,
0,
509,
0,
4,
0,
0,
509,
0,
0
],
[
14,
0,
0.375,
0.0139,
0,
0.66,
0.0667,
328,
7,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3889,
0.0139,
0,
0... | [
"import sys, os, re, subprocess",
"CMD_PYTHON = sys.executable",
"QOOXDOO_PATH = '../qooxdoo-1.4-sdk'",
"def getQxPath():\n path = QOOXDOO_PATH\n # try updating from config file\n if os.path.exists('config.json'):\n # \"using QOOXDOO_PATH from config.json\"\n qpathr=re.compile(r'\"QOOXD... |
#!/usr/bin/env python
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2008 - 2010 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# LGPL: http://www.gnu.org/licenses/lgpl.html
# ... | [
[
1,
0,
0.3472,
0.0139,
0,
0.66,
0,
509,
0,
4,
0,
0,
509,
0,
0
],
[
14,
0,
0.375,
0.0139,
0,
0.66,
0.0667,
328,
7,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3889,
0.0139,
0,
0... | [
"import sys, os, re, subprocess",
"CMD_PYTHON = sys.executable",
"QOOXDOO_PATH = '../qooxdoo-1.4-sdk'",
"def getQxPath():\n path = QOOXDOO_PATH\n # try updating from config file\n if os.path.exists('config.json'):\n # \"using QOOXDOO_PATH from config.json\"\n qpathr=re.compile(r'\"QOOXD... |
#!/usr/bin/python
import feedparser
import sys
entrada = feedparser.parse(sys.argv[1])
for i in entrada['entries']:
print " * " +i['title']
| [
[
1,
0,
0.3333,
0.1111,
0,
0.66,
0,
4,
0,
1,
0,
0,
4,
0,
0
],
[
1,
0,
0.4444,
0.1111,
0,
0.66,
0.3333,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.5556,
0.1111,
0,
0.6... | [
"import feedparser",
"import sys",
"entrada = feedparser.parse(sys.argv[1])",
"for i in entrada['entries']:\n print(\" * \" +i['title'])",
" print(\" * \" +i['title'])"
] |
#!/usr/bin/python
import feedparser
import sys
entrada = feedparser.parse(sys.argv[1])
for i in entrada['entries']:
print " * " +i['title']
| [
[
1,
0,
0.3333,
0.1111,
0,
0.66,
0,
4,
0,
1,
0,
0,
4,
0,
0
],
[
1,
0,
0.4444,
0.1111,
0,
0.66,
0.3333,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.5556,
0.1111,
0,
0.6... | [
"import feedparser",
"import sys",
"entrada = feedparser.parse(sys.argv[1])",
"for i in entrada['entries']:\n print(\" * \" +i['title'])",
" print(\" * \" +i['title'])"
] |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "miniupload.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| [
[
1,
0,
0.2,
0.1,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.75,
0.6,
0,
0.66,
1,
0,
... | [
"import os",
"import sys",
"if __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"miniupload.settings\")\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)",
" os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"min... |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
"""
Tweepy Twitter API library
"""
__version__ = '1.9'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'
from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory
from tweepy.error import Twee... | [
[
8,
0,
0.2222,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2963,
0.037,
0,
0.66,
0.0833,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.037,
0,
0.66,
... | [
"\"\"\"\nTweepy Twitter API library\n\"\"\"",
"__version__ = '1.9'",
"__author__ = 'Joshua Roesslein'",
"__license__ = 'MIT'",
"from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory",
"from tweepy.error import TweepError",
"from tweepy.api import API"... |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from tweepy.error import TweepError
from tweepy.utils import parse_datetime, parse_html_value, parse_a_href, \
parse_search_datetime, unescape_html
class ResultSet(list):
"""A list like object that holds results from a Twitter API... | [
[
1,
0,
0.0152,
0.003,
0,
0.66,
0,
108,
0,
1,
0,
0,
108,
0,
0
],
[
1,
0,
0.0198,
0.0061,
0,
0.66,
0.0714,
155,
0,
5,
0,
0,
155,
0,
0
],
[
3,
0,
0.0319,
0.0061,
0,
0... | [
"from tweepy.error import TweepError",
"from tweepy.utils import parse_datetime, parse_html_value, parse_a_href, \\\n parse_search_datetime, unescape_html",
"class ResultSet(list):\n \"\"\"A list like object that holds results from a Twitter API query.\"\"\"",
" \"\"\"A list like object that hold... |
"""
The MIT License
Copyright (c) 2007 Leah Culver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | [
[
8,
0,
0.0183,
0.0351,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0382,
0.0015,
0,
0.66,
0.0385,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.0397,
0.0015,
0,
0.66... | [
"\"\"\"\nThe MIT License\n\nCopyright (c) 2007 Leah Culver\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights",
"import cgi",
... |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import time
import threading
import os
try:
import cPickle as pickle
except ImportError:
import pickle
try:
import hashlib
except ImportError:
# python 2.4
import md5 as hashlib
try:
import fcntl
except ImportError:
... | [
[
1,
0,
0.0131,
0.0026,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0157,
0.0026,
0,
0.66,
0.1,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0183,
0.0026,
0,
0.66,... | [
"import time",
"import threading",
"import os",
"try:\n import cPickle as pickle\nexcept ImportError:\n import pickle",
" import cPickle as pickle",
" import pickle",
"try:\n import hashlib\nexcept ImportError:\n # python 2.4\n import md5 as hashlib",
" import hashlib",
" ... |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from tweepy.error import TweepError
class Cursor(object):
"""Pagination helper class"""
def __init__(self, method, *args, **kargs):
if hasattr(method, 'pagination_mode'):
if method.pagination_mode == 'cursor':
... | [
[
1,
0,
0.0391,
0.0078,
0,
0.66,
0,
108,
0,
1,
0,
0,
108,
0,
0
],
[
3,
0,
0.1406,
0.1797,
0,
0.66,
0.2,
647,
0,
3,
0,
0,
186,
0,
5
],
[
8,
1,
0.0625,
0.0078,
1,
0.2... | [
"from tweepy.error import TweepError",
"class Cursor(object):\n \"\"\"Pagination helper class\"\"\"\n\n def __init__(self, method, *args, **kargs):\n if hasattr(method, 'pagination_mode'):\n if method.pagination_mode == 'cursor':\n self.iterator = CursorIterator(method, args... |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
class TweepError(Exception):
"""Tweepy exception"""
def __init__(self, reason, response=None):
self.reason = unicode(reason)
self.response = response
def __str__(self):
return self.reason
| [
[
3,
0,
0.6429,
0.6429,
0,
0.66,
0,
430,
0,
2,
0,
0,
645,
0,
1
],
[
8,
1,
0.4286,
0.0714,
1,
0.87,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
1,
0.6429,
0.2143,
1,
0.87,
... | [
"class TweepError(Exception):\n \"\"\"Tweepy exception\"\"\"\n\n def __init__(self, reason, response=None):\n self.reason = unicode(reason)\n self.response = response\n\n def __str__(self):",
" \"\"\"Tweepy exception\"\"\"",
" def __init__(self, reason, response=None):\n self... |
#!/usr/bin/python
import os, sys
_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, _PROJECT_DIR)
sys.path.insert(0, os.path.dirname(_PROJECT_DIR))
_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]
os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME
from django.c... | [
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0,
688,
0,
2,
0,
0,
688,
0,
0
],
[
14,
0,
0.3333,
0.0833,
0,
0.66,
0.1429,
473,
3,
1,
0,
0,
959,
10,
3
],
[
8,
0,
0.4167,
0.0833,
0,
... | [
"import os, sys",
"_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))",
"sys.path.insert(0, _PROJECT_DIR)",
"sys.path.insert(0, os.path.dirname(_PROJECT_DIR))",
"_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]",
"os.environ['DJANGO_SETTINGS_MODULE'] = \"%s.settings\" % _PROJECT_NAME",
... |
#!/usr/bin/python
import os, sys
_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, _PROJECT_DIR)
sys.path.insert(0, os.path.dirname(_PROJECT_DIR))
_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]
os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME
from django.c... | [
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0,
688,
0,
2,
0,
0,
688,
0,
0
],
[
14,
0,
0.3333,
0.0833,
0,
0.66,
0.1429,
473,
3,
1,
0,
0,
959,
10,
3
],
[
8,
0,
0.4167,
0.0833,
0,
... | [
"import os, sys",
"_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))",
"sys.path.insert(0, _PROJECT_DIR)",
"sys.path.insert(0, os.path.dirname(_PROJECT_DIR))",
"_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]",
"os.environ['DJANGO_SETTINGS_MODULE'] = \"%s.settings\" % _PROJECT_NAME",
... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "miniupload.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| [
[
1,
0,
0.2,
0.1,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.75,
0.6,
0,
0.66,
1,
0,
... | [
"import os",
"import sys",
"if __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"miniupload.settings\")\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)",
" os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"min... |
from miniupload.models import *
from django.contrib import admin
admin.site.register(package)
admin.site.register(user)
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
429,
0,
1,
0,
0,
429,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.3333,
302,
0,
1,
0,
0,
302,
0,
0
],
[
8,
0,
0.6667,
0.1667,
0,
... | [
"from miniupload.models import *",
"from django.contrib import admin",
"admin.site.register(package)",
"admin.site.register(user)"
] |
from django.db import models
from django.core.files.storage import FileSystemStorage
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
fs = FileSystemStorage(location = settings.BASE_DIR)
class user(models.Model):
user = models.OneTo... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0909,
0.0455,
0,
0.66,
0.1429,
919,
0,
1,
0,
0,
919,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.... | [
"from django.db import models",
"from django.core.files.storage import FileSystemStorage",
"from django.conf import settings",
"from django.contrib.auth.models import User",
"from django.utils.translation import ugettext_lazy as _",
"fs = FileSystemStorage(location = settings.BASE_DIR)",
"class user(mod... |
# -.- coding: utf-8 -.-
from django import forms
from models import *
class SendingForm(forms.ModelForm):
class Meta:
model = package
fields = ('comment','package')
def save(self, destinatario, sendr):
#Pedimos a twitter el id del receptor en base a su nombre
try:
recvr = user.objects.get(id_twitter=des... | [
[
1,
0,
0.0769,
0.0256,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1026,
0.0256,
0,
0.66,
0.5,
495,
0,
1,
0,
0,
495,
0,
0
],
[
3,
0,
0.5769,
0.8718,
0,
0.6... | [
"from django import forms",
"from models import *",
"class SendingForm(forms.ModelForm):\n\tclass Meta:\n\t\tmodel = package\n\t\tfields = ('comment','package')\n\n\tdef save(self, destinatario, sendr):\n\t\t#Pedimos a twitter el id del receptor en base a su nombre\n\t\ttry:",
"\tclass Meta:\n\t\tmodel = pack... |
# Django settings for miniupload project.
import os.path
DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASE_DIR = os.path.normpath(os.path.dirname(__file__))
ADMINS = (
# ('Pelayo', 'phazonius@gmail.com'),
)
# KEY y SECRET de nuestra aplicación facilitado por Twitter.
TWITTER_KEY = 'MgcoF6aTNnlosQV28OA'
TWITTER_SECRET = 'Nv... | [
[
1,
0,
0.0112,
0.0056,
0,
0.66,
0,
79,
0,
1,
0,
0,
79,
0,
0
],
[
14,
0,
0.0223,
0.0056,
0,
0.66,
0.0312,
309,
1,
0,
0,
0,
0,
4,
0
],
[
14,
0,
0.0279,
0.0056,
0,
0.... | [
"import os.path",
"DEBUG = True",
"TEMPLATE_DEBUG = DEBUG",
"BASE_DIR = os.path.normpath(os.path.dirname(__file__))",
"ADMINS = (\n # ('Pelayo', 'phazonius@gmail.com'),\n)",
"TWITTER_KEY = 'MgcoF6aTNnlosQV28OA'",
"TWITTER_SECRET = 'NvxIGd4i4Qr4PuqFd9EBu6TzCuQS1KeOfHesswGSYRA'",
"LOGIN_URL = 'http://... |
"""
WSGI config for miniupload project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... | [
[
8,
0,
0.2857,
0.5357,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5714,
0.0357,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
8,
0,
0.6429,
0.0357,
0,
0.66,
... | [
"\"\"\"\nWSGI config for miniupload project.\n\nThis module contains the WSGI application used by Django's development server\nand any production WSGI deployments. It should expose a module-level variable\nnamed ``application``. Django's ``runserver`` and ``runfcgi`` commands discover\nthis application via the ``WS... |
from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'miniupload.views.home', name='home'),
# Uncomment the admin/do... | [
[
1,
0,
0.0333,
0.0333,
0,
0.66,
0,
528,
0,
3,
0,
0,
528,
0,
0
],
[
1,
0,
0.0667,
0.0333,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1333,
0.0333,
0,
0.... | [
"from django.conf.urls import patterns, include, url",
"from django.conf import settings",
"from django.contrib import admin",
"admin.autodiscover()",
"urlpatterns = patterns('',\n # Examples:\n # url(r'^$', 'miniupload.views.home', name='home'),\n\n # Uncomment the admin/doc line below to enable a... |
#!/usr/bin/python
a, b = 0, 1
while b < 1000:
print b
a, b = b, a+b
| [
[
14,
0,
0.4286,
0.1429,
0,
0.66,
0,
127,
0,
0,
0,
0,
0,
8,
0
],
[
5,
0,
0.8571,
0.4286,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.8571,
0.1429,
1,
0.21,
... | [
"a, b = 0, 1",
"while b < 1000:\n\tprint(b)\n\ta, b = b, a+b",
"\tprint(b)",
"\ta, b = b, a+b"
] |
#!/usr/bin/python
a, b = 0, 1
while b < 1000:
print b
a, b = b, a+b
| [
[
14,
0,
0.4286,
0.1429,
0,
0.66,
0,
127,
0,
0,
0,
0,
0,
8,
0
],
[
5,
0,
0.8571,
0.4286,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.8571,
0.1429,
1,
0.03,
... | [
"a, b = 0, 1",
"while b < 1000:\n\tprint(b)\n\ta, b = b, a+b",
"\tprint(b)",
"\ta, b = b, a+b"
] |
#!/usr/bin/env python
"""ackermann_controller.py
Control the wheels of a vehicle with Ackermann steering.
Subscribed Topics:
ackermann_cmd (ackermann_msgs/AckermannDriveStamped)
Ackermann command. It contains the vehicle's desired speed and steering
angle.
Published Topics:
<left steering co... | [
[
8,
0,
0.1186,
0.2268,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2351,
0.0021,
0,
0.66,
0.0667,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.2371,
0.0021,
0,
0.66... | [
"\"\"\"ackermann_controller.py\n\nControl the wheels of a vehicle with Ackermann steering.\n\nSubscribed Topics:\n ackermann_cmd (ackermann_msgs/AckermannDriveStamped)\n Ackermann command. It contains the vehicle's desired speed and steering\n angle.",
"import math",
"import numpy",
"import t... |
#!/usr/bin/env python
"""ackermann_controller.py
Control the wheels of a vehicle with Ackermann steering.
Subscribed Topics:
ackermann_cmd (ackermann_msgs/AckermannDriveStamped)
Ackermann command. It contains the vehicle's desired speed and steering
angle.
Published Topics:
<left steering co... | [
[
8,
0,
0.1186,
0.2268,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2351,
0.0021,
0,
0.66,
0.0667,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.2371,
0.0021,
0,
0.66... | [
"\"\"\"ackermann_controller.py\n\nControl the wheels of a vehicle with Ackermann steering.\n\nSubscribed Topics:\n ackermann_cmd (ackermann_msgs/AckermannDriveStamped)\n Ackermann command. It contains the vehicle's desired speed and steering\n angle.",
"import math",
"import numpy",
"import t... |
#!/usr/bin/python
from math import sqrt
from sys import stderr
wp = [(0.0, 0.0), (5.0, 5.0), (7.0, 2.0), (4.0, 1.0)]
def plot(f1=['plot']):
f2 = f1[0]
f1[0] = 'replot'
return f2
def length(v):
return sqrt(v[0] ** 2 + v[1] ** 2)
def normalize(v):
magnitude = length(v)
return (v[0] / magnitud... | [
[
1,
0,
0.0667,
0.0667,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.1333,
0.0667,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.3667,
0.2667,
0,
0.... | [
"from math import sqrt",
"from sys import stderr",
"def plot(f1=['plot']):\n f2 = f1[0]\n f1[0] = 'replot'\n return f2",
" f2 = f1[0]",
" f1[0] = 'replot'",
" return f2",
"def length(v):\n return sqrt(v[0] ** 2 + v[1] ** 2)",
" return sqrt(v[0] ** 2 + v[1] ** 2)",
"def normal... |
#!/usr/bin/python
from math import sqrt
from sys import stderr
wp = [(0.0, 0.0), (5.0, 5.0), (7.0, 2.0), (4.0, 1.0)]
def plot(f1=['plot']):
f2 = f1[0]
f1[0] = 'replot'
return f2
def length(v):
return sqrt(v[0] ** 2 + v[1] ** 2)
def normalize(v):
magnitude = length(v)
return (v[0] / magnitud... | [
[
1,
0,
0.0667,
0.0667,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.1333,
0.0667,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.3667,
0.2667,
0,
0.... | [
"from math import sqrt",
"from sys import stderr",
"def plot(f1=['plot']):\n f2 = f1[0]\n f1[0] = 'replot'\n return f2",
" f2 = f1[0]",
" f1[0] = 'replot'",
" return f2",
"def length(v):\n return sqrt(v[0] ** 2 + v[1] ** 2)",
" return sqrt(v[0] ** 2 + v[1] ** 2)",
"def normal... |
#!/usr/bin/python3
import sys
from Segment import *
from Waypoint import *
def plot(f1=['plot']):
f2 = f1[0]
f1[0] = 'replot'
return f2
with open(sys.argv[1], 'r') as f:
s = f.read().strip()
waypoints = parse_waypoints(s)
min_X = min([ wp.axis[X].loc for wp in waypoints ]) - 1
max_X = max([ wp.axis[... | [
[
1,
0,
0.0349,
0.0116,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0465,
0.0116,
0,
0.66,
0.0714,
261,
0,
1,
0,
0,
261,
0,
0
],
[
1,
0,
0.0581,
0.0116,
0,
... | [
"import sys",
"from Segment import *",
"from Waypoint import *",
"def plot(f1=['plot']):\n f2 = f1[0]\n f1[0] = 'replot'\n return f2",
" f2 = f1[0]",
" f1[0] = 'replot'",
" return f2",
" s = f.read().strip()",
"waypoints = parse_waypoints(s)",
"min_X = min([ wp.axis[X].loc for... |
#!/usr/bin/python3
import sys
from Segment import *
from Waypoint import *
def plot(f1=['plot']):
f2 = f1[0]
f1[0] = 'replot'
return f2
with open(sys.argv[1], 'r') as f:
s = f.read().strip()
waypoints = parse_waypoints(s)
min_X = min([ wp.axis[X].loc for wp in waypoints ]) - 1
max_X = max([ wp.axis[... | [
[
1,
0,
0.0349,
0.0116,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0465,
0.0116,
0,
0.66,
0.0714,
261,
0,
1,
0,
0,
261,
0,
0
],
[
1,
0,
0.0581,
0.0116,
0,
... | [
"import sys",
"from Segment import *",
"from Waypoint import *",
"def plot(f1=['plot']):\n f2 = f1[0]\n f1[0] = 'replot'\n return f2",
" f2 = f1[0]",
" f1[0] = 'replot'",
" return f2",
" s = f.read().strip()",
"waypoints = parse_waypoints(s)",
"min_X = min([ wp.axis[X].loc for... |
#!/usr/bin/python3
import math, re, sys
from Waypoint import *
def magnitude(vector):
return math.sqrt(vector[X] ** 2 + vector[Y] ** 2)
# Create a list of waypoints from the command-line arguments.
state = X
waypoints = []
prev = None
tokens = [token.strip()
for arg in sys.argv[1:]
for token in re.sp... | [
[
1,
0,
0.0286,
0.0095,
0,
0.66,
0,
526,
0,
3,
0,
0,
526,
0,
0
],
[
1,
0,
0.0381,
0.0095,
0,
0.66,
0.0833,
768,
0,
1,
0,
0,
768,
0,
0
],
[
2,
0,
0.0619,
0.019,
0,
0... | [
"import math, re, sys",
"from Waypoint import *",
"def magnitude(vector):\n return math.sqrt(vector[X] ** 2 + vector[Y] ** 2)",
" return math.sqrt(vector[X] ** 2 + vector[Y] ** 2)",
"state = X",
"waypoints = []",
"prev = None",
"tokens = [token.strip()\n for arg in sys.argv[1:]\n for t... |
X = 0
Y = 1
class QuinticSegment:
def __init__(self):
self.P0 = None
self.P1 = None
self.P2 = None
self.P3 = None
self.P4 = None
self.P5 = None
def __str__(self):
return '[P0:{0}, P1:{1}, P2:{2}, P3:{3}, P4:{4}, P5:{5}]'.\
format(str(sel... | [
[
14,
0,
0.0333,
0.0167,
0,
0.66,
0,
783,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.05,
0.0167,
0,
0.66,
0.2,
24,
1,
0,
0,
0,
0,
1,
0
],
[
3,
0,
0.1833,
0.2167,
0,
0.66,
... | [
"X = 0",
"Y = 1",
"class QuinticSegment:\n def __init__(self):\n self.P0 = None\n self.P1 = None\n self.P2 = None\n self.P3 = None\n self.P4 = None\n self.P5 = None",
" def __init__(self):\n self.P0 = None\n self.P1 = None\n self.P2 = None\n... |
import re
X = 0
Y = 1
class Axis:
def __init__(self):
self.loc = None
self.d1 = None
self.d2 = None
def __str__(self):
return '[loc:{0} d1:{1} d2:{2}]'.\
format(str(self.loc), str(self.d1), str(self.d2))
class Waypoint:
def __init__(self):
self.axi... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.0536,
0.0179,
0,
0.66,
0.1667,
783,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.0714,
0.0179,
0,
... | [
"import re",
"X = 0",
"Y = 1",
"class Axis:\n def __init__(self):\n self.loc = None\n self.d1 = None\n self.d2 = None\n\n def __str__(self):\n return '[loc:{0} d1:{1} d2:{2}]'.\\",
" def __init__(self):\n self.loc = None\n self.d1 = None\n self.d2 = ... |
#!/usr/bin/python3
import math, re, sys
from Waypoint import *
def magnitude(vector):
return math.sqrt(vector[X] ** 2 + vector[Y] ** 2)
# Create a list of waypoints from the command-line arguments.
state = X
waypoints = []
prev = None
tokens = [token.strip()
for arg in sys.argv[1:]
for token in re.sp... | [
[
1,
0,
0.0286,
0.0095,
0,
0.66,
0,
526,
0,
3,
0,
0,
526,
0,
0
],
[
1,
0,
0.0381,
0.0095,
0,
0.66,
0.0833,
768,
0,
1,
0,
0,
768,
0,
0
],
[
2,
0,
0.0619,
0.019,
0,
0... | [
"import math, re, sys",
"from Waypoint import *",
"def magnitude(vector):\n return math.sqrt(vector[X] ** 2 + vector[Y] ** 2)",
" return math.sqrt(vector[X] ** 2 + vector[Y] ** 2)",
"state = X",
"waypoints = []",
"prev = None",
"tokens = [token.strip()\n for arg in sys.argv[1:]\n for t... |
#!/usr/bin/python
from math import sqrt
from sys import stderr
wp = [(0.0, 0.0), (2.0, 4.0), (5.0, 2.0)]
def length(v):
return sqrt(v[0] ** 2 + v[1] ** 2)
def normalize(v):
magnitude = length(v)
return (v[0] / magnitude, v[1] / magnitude)
# d1s
d1s = [((wp[len(wp) - 1][0] - wp[len(wp) - 2][0]) / 2.0,
... | [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.2,
0.1,
0,
0.66,
0.3333,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.45,
0.2,
0,
0.66,
0.6667,... | [
"from math import sqrt",
"from sys import stderr",
"def length(v):\n return sqrt(v[0] ** 2 + v[1] ** 2)",
" return sqrt(v[0] ** 2 + v[1] ** 2)",
"def normalize(v):\n magnitude = length(v)\n return (v[0] / magnitude, v[1] / magnitude)",
" magnitude = length(v)",
" return (v[0] / magnitu... |
#!/usr/bin/python
from math import sqrt
from sys import stderr
wp = [(0.0, 0.0), (2.0, 4.0), (5.0, 2.0)]
def length(v):
return sqrt(v[0] ** 2 + v[1] ** 2)
def normalize(v):
magnitude = length(v)
return (v[0] / magnitude, v[1] / magnitude)
# d1s
d1s = [((wp[len(wp) - 1][0] - wp[len(wp) - 2][0]) / 2.0,
... | [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.2,
0.1,
0,
0.66,
0.3333,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.45,
0.2,
0,
0.66,
0.6667,... | [
"from math import sqrt",
"from sys import stderr",
"def length(v):\n return sqrt(v[0] ** 2 + v[1] ** 2)",
" return sqrt(v[0] ** 2 + v[1] ** 2)",
"def normalize(v):\n magnitude = length(v)\n return (v[0] / magnitude, v[1] / magnitude)",
" magnitude = length(v)",
" return (v[0] / magnitu... |
#!/usr/bin/python
from math import sqrt
from sys import argv
def segment(x):
y = dy / dx * x + b
return y
def dist(x0, y0, f, x):
y = f(x)
d = sqrt((x - x0) ** 2 + (y - y0) ** 2)
return d
def hill_climb(x, delta, f):
y0 = f(x - delta)
y1 = f(x)
y2 = f(x + delta)
if y0 < y1:
... | [
[
1,
0,
0.0625,
0.0208,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0833,
0.0208,
0,
0.66,
0.0909,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.1458,
0.0625,
0,
... | [
"from math import sqrt",
"from sys import argv",
"def segment(x):\n y = dy / dx * x + b\n return y",
" y = dy / dx * x + b",
" return y",
"def dist(x0, y0, f, x):\n y = f(x)\n d = sqrt((x - x0) ** 2 + (y - y0) ** 2)\n return d",
" y = f(x)",
" d = sqrt((x - x0) ** 2 + (y - y... |
#!/usr/bin/python
from math import sqrt
from sys import argv
def segment(x):
y = dy / dx * x + b
return y
def dist(x0, y0, f, x):
y = f(x)
d = sqrt((x - x0) ** 2 + (y - y0) ** 2)
return d
def hill_climb(x, delta, f):
y0 = f(x - delta)
y1 = f(x)
y2 = f(x + delta)
if y0 < y1:
... | [
[
1,
0,
0.0625,
0.0208,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0833,
0.0208,
0,
0.66,
0.0909,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.1458,
0.0625,
0,
... | [
"from math import sqrt",
"from sys import argv",
"def segment(x):\n y = dy / dx * x + b\n return y",
" y = dy / dx * x + b",
" return y",
"def dist(x0, y0, f, x):\n y = f(x)\n d = sqrt((x - x0) ** 2 + (y - y0) ** 2)\n return d",
" y = f(x)",
" d = sqrt((x - x0) ** 2 + (y - y... |
#!/usr/bin/python
from math import sqrt
from sys import argv
def segment(x):
y = dy / dx * x + b
return y
def dist(x0, y0, f, x):
y = f(x)
d = sqrt((x - x0) ** 2 + (y - y0) ** 2)
return d
def quadratic_optimization(x1, x2, x3, f):
for i in range(1, 5):
y1 = f(x1)
y2 = f(x2) ... | [
[
1,
0,
0.027,
0.027,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0541,
0.027,
0,
0.66,
0.2,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.1351,
0.0811,
0,
0.66,
... | [
"from math import sqrt",
"from sys import argv",
"def segment(x):\n y = dy / dx * x + b\n return y",
" y = dy / dx * x + b",
" return y",
"def dist(x0, y0, f, x):\n y = f(x)\n d = sqrt((x - x0) ** 2 + (y - y0) ** 2)\n return d",
" y = f(x)",
" d = sqrt((x - x0) ** 2 + (y - y... |
#!/usr/bin/python
from math import sqrt
from sys import argv
def segment(x):
y = dy / dx * x + b
return y
def dist(x0, y0, f, x):
y = f(x)
d = sqrt((x - x0) ** 2 + (y - y0) ** 2)
return d
def quadratic_optimization(x1, x2, x3, f):
for i in range(1, 5):
y1 = f(x1)
y2 = f(x2) ... | [
[
1,
0,
0.027,
0.027,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0541,
0.027,
0,
0.66,
0.2,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.1351,
0.0811,
0,
0.66,
... | [
"from math import sqrt",
"from sys import argv",
"def segment(x):\n y = dy / dx * x + b\n return y",
" y = dy / dx * x + b",
" return y",
"def dist(x0, y0, f, x):\n y = f(x)\n d = sqrt((x - x0) ** 2 + (y - y0) ** 2)\n return d",
" y = f(x)",
" d = sqrt((x - x0) ** 2 + (y - y... |
#!/usr/bin/python
import numpy as np
import cv2
from matplotlib import pyplot as plt
def find_center(image, keypoints):
min_y, min_x = image.shape
max_y, max_x = (0, 0)
for kp in keypoints:
min_x, max_x = min(min_x, kp.pt[0]), max(max_x, kp.pt[0])
min_y, max_y = min(min_y, kp.pt[1]), max(m... | [
[
1,
0,
0.0588,
0.0196,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0784,
0.0196,
0,
0.66,
0.0435,
896,
0,
1,
0,
0,
896,
0,
0
],
[
1,
0,
0.098,
0.0196,
0,
0... | [
"import numpy as np",
"import cv2",
"from matplotlib import pyplot as plt",
"def find_center(image, keypoints):\n min_y, min_x = image.shape\n max_y, max_x = (0, 0)\n for kp in keypoints:\n min_x, max_x = min(min_x, kp.pt[0]), max(max_x, kp.pt[0])\n min_y, max_y = min(min_y, kp.pt[1]), ... |
#!/usr/bin/python
import sys
import math
# a, b, and c are lengths of the triangle sides. d is the distance,
# or delta, from "straight ahead" vs the location of the car. f is
# the camera's focal distance. This code assumes that d has the same
# units as f, and I still need to figure out how to make that happen.
... | [
[
1,
0,
0.1154,
0.0385,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1538,
0.0385,
0,
0.66,
0.0667,
526,
0,
1,
0,
0,
526,
0,
0
],
[
14,
0,
0.4231,
0.0385,
0,
... | [
"import sys",
"import math",
"a = float(sys.argv[1])",
"b = float(sys.argv[2])",
"c = float(sys.argv[3])",
"d = float(sys.argv[4])",
"f = float(sys.argv[5])",
"A = math.acos((b ** 2 + c ** 2 - a ** 2) / (2 * b * c))",
"B = math.acos((c ** 2 + a ** 2 - b ** 2) / (2 * c * a))",
"C = math.pi - A - B"... |
#!/usr/bin/python
import sys
import math
# a, b, and c are lengths of the triangle sides. d is the distance,
# or delta, from "straight ahead" vs the location of the car. f is
# the camera's focal distance. This code assumes that d has the same
# units as f, and I still need to figure out how to make that happen.
... | [
[
1,
0,
0.1154,
0.0385,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1538,
0.0385,
0,
0.66,
0.0667,
526,
0,
1,
0,
0,
526,
0,
0
],
[
14,
0,
0.4231,
0.0385,
0,
... | [
"import sys",
"import math",
"a = float(sys.argv[1])",
"b = float(sys.argv[2])",
"c = float(sys.argv[3])",
"d = float(sys.argv[4])",
"f = float(sys.argv[5])",
"A = math.acos((b ** 2 + c ** 2 - a ** 2) / (2 * b * c))",
"B = math.acos((c ** 2 + a ** 2 - b ** 2) / (2 * c * a))",
"C = math.pi - A - B"... |
#!/usr/bin/python
import numpy as np
import cv2
from matplotlib import pyplot as plt
def find_center(image, keypoints):
min_y, min_x = image.shape
max_y, max_x = (0, 0)
for kp in keypoints:
min_x, max_x = min(min_x, kp.pt[0]), max(max_x, kp.pt[0])
min_y, max_y = min(min_y, kp.pt[1]), max(m... | [
[
1,
0,
0.0588,
0.0196,
0,
0.66,
0,
954,
0,
1,
0,
0,
954,
0,
0
],
[
1,
0,
0.0784,
0.0196,
0,
0.66,
0.0435,
896,
0,
1,
0,
0,
896,
0,
0
],
[
1,
0,
0.098,
0.0196,
0,
0... | [
"import numpy as np",
"import cv2",
"from matplotlib import pyplot as plt",
"def find_center(image, keypoints):\n min_y, min_x = image.shape\n max_y, max_x = (0, 0)\n for kp in keypoints:\n min_x, max_x = min(min_x, kp.pt[0]), max(max_x, kp.pt[0])\n min_y, max_y = min(min_y, kp.pt[1]), ... |
import os
from setuptools import setup
from distutils.extension import Extension
import sys
if 'setuptools.extension' in sys.modules:
m = sys.modules['setuptools.extension']
m.Extension.__dict__ = m._Extension.__dict__
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
C... | [
[
1,
0,
0.0256,
0.0256,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0513,
0.0256,
0,
0.66,
0.1111,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0769,
0.0256,
0,
... | [
"import os",
"from setuptools import setup",
"from distutils.extension import Extension",
"import sys",
"if 'setuptools.extension' in sys.modules:\n m = sys.modules['setuptools.extension']\n m.Extension.__dict__ = m._Extension.__dict__",
" m = sys.modules['setuptools.extension']",
" m.Extens... |
#!/usr/bin/env python2.6
import sys
from time import clock
from p2t import *
# PyGame Constants
import pygame
from pygame.gfxdraw import trigon, line
from pygame.locals import *
from pygame import Color
head_hole = [[325, 437],[320, 423], [329, 413], [332, 423]]
chest_hole = [[320.72342,480],[338.90617,465.96863],[... | [
[
1,
0,
0.0185,
0.0062,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0247,
0.0062,
0,
0.66,
0.0909,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.037,
0.0062,
0,
0... | [
"import sys",
"from time import clock",
"from p2t import *",
"import pygame",
"from pygame.gfxdraw import trigon, line",
"from pygame.locals import *",
"from pygame import Color",
"head_hole = [[325, 437],[320, 423], [329, 413], [332, 423]]",
"chest_hole = [[320.72342,480],[338.90617,465.96863],[347... |
CPP_SOURCES = """./poly2tri/common/shapes.cc
./poly2tri/sweep/advancing_front.cc
./poly2tri/sweep/cdt.cc
./poly2tri/sweep/sweep.cc
./poly2tri/sweep/sweep_context.cc""".split("\n")
| [
[
14,
0,
0.6,
1,
0,
0.66,
0,
694,
3,
1,
0,
0,
908,
10,
1
]
] | [
"CPP_SOURCES = \"\"\"./poly2tri/common/shapes.cc\n./poly2tri/sweep/advancing_front.cc\n./poly2tri/sweep/cdt.cc\n./poly2tri/sweep/sweep.cc\n./poly2tri/sweep/sweep_context.cc\"\"\".split(\"\\n\")"
] |
#!/usr/bin/env python
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
[
8,
0,
0.12,
0.0067,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1333,
0.0067,
0,
0.66,
0.0588,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.14,
0.0067,
0,
0.66,
... | [
"\"\"\"Simple subscriber that aggregates all feeds together.\"\"\"",
"import hashlib",
"import logging",
"import random",
"import wsgiref.handlers",
"from google.appengine.ext import db",
"from google.appengine.ext import webapp",
"from google.appengine.ext.webapp import template",
"import feedparse... |
"""
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_sca... | [
[
8,
0,
0.0303,
0.0455,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0606,
0.0152,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.0985,
0.0606,
0,
0.66... | [
"\"\"\"\nJSON 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']",
... |
import unittest
import doctest
def additional_tests():
import simplejson
import simplejson.encoder
import simplejson.decoder
suite = unittest.TestSuite()
for mod in (simplejson, simplejson.encoder, simplejson.decoder):
suite.addTest(doctest.DocTestSuite(mod))
suite.addTest(doctest.DocFi... | [
[
1,
0,
0.0435,
0.0435,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.087,
0.0435,
0,
0.66,
0.25,
614,
0,
1,
0,
0,
614,
0,
0
],
[
2,
0,
0.3478,
0.3913,
0,
0.66,... | [
"import unittest",
"import doctest",
"def additional_tests():\n import simplejson\n import simplejson.encoder\n import simplejson.decoder\n suite = unittest.TestSuite()\n for mod in (simplejson, simplejson.encoder, simplejson.decoder):\n suite.addTest(doctest.DocTestSuite(mod))\n suite.... |
"""
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.0046,
0.0069,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0092,
0.0023,
0,
0.66,
0.0625,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.0172,
0.0092,
0,
0.66... | [
"\"\"\"\nImplementation 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"""
A simple, fast, extensible JSON encoder and decoder
JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
simplejson exposes an API familiar to uses of the standard library
marshal and pickle modules.
Encoding b... | [
[
8,
0,
0.1376,
0.2725,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2751,
0.0026,
0,
0.66,
0.0714,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2817,
0.0106,
0,
0.66... | [
"r\"\"\"\nA simple, fast, extensible JSON encoder and decoder\n\nJSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\nsimplejson exposes an API familiar to uses of the standard library",
"__version__ = '2.0.... |
#!/usr/bin/env python
js = open('bookmarklet.min.js').read()
config = open('bookmarklet_config.template').read()
print config % {'bookmarklet_min_js': js}
| [
[
14,
0,
0.6,
0.2,
0,
0.66,
0,
62,
3,
0,
0,
0,
453,
10,
2
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.5,
308,
3,
0,
0,
0,
453,
10,
2
],
[
8,
0,
1,
0.2,
0,
0.66,
1,
535... | [
"js = open('bookmarklet.min.js').read()",
"config = open('bookmarklet_config.template').read()",
"print(config % {'bookmarklet_min_js': js})"
] |
#!/usr/bin/python
# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. The original code had the following copyright and
# license.
#
# /* jsmin.c
# 2007-05-22
#
# Copyright (c) 2002 Douglas Crockford (www.crockford.com)
#
# Permission is hereby granted, free of ch... | [
[
1,
0,
0.1514,
0.0046,
0,
0.66,
0,
609,
0,
1,
0,
0,
609,
0,
0
],
[
2,
0,
0.1766,
0.0367,
0,
0.66,
0.1429,
275,
0,
1,
1,
0,
0,
0,
6
],
[
14,
1,
0.1651,
0.0046,
1,
0... | [
"from StringIO import StringIO",
"def jsmin(js):\n ins = StringIO(js)\n outs = StringIO()\n JavascriptMinify().minify(ins, outs)\n str = outs.getvalue()\n if len(str) > 0 and str[0] == '\\n':\n str = str[1:]\n return str",
" ins = StringIO(js)",
" outs = StringIO()",
" Java... |
#!/usr/bin/env python
#
# Copyright 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 o... | [
[
8,
0,
0.0334,
0.0019,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0371,
0.0019,
0,
0.66,
0.0476,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.039,
0.0019,
0,
0.66,... | [
"\"\"\"Tests for the fork_join_queue module.\"\"\"",
"import datetime",
"import logging",
"logging.basicConfig(format='%(levelname)-8s %(filename)s] %(message)s')",
"import os",
"import random",
"import sys",
"import unittest",
"import testutil",
"testutil.fix_path()",
"from google.appengine.api... |
#!/usr/bin/env python
#
# Copyright 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 o... | [
[
8,
0,
0.0627,
0.0035,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0697,
0.0035,
0,
0.66,
0.0556,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0732,
0.0035,
0,
0.66... | [
"\"\"\"Tests for the offline_jobs module.\"\"\"",
"import datetime",
"import logging",
"logging.basicConfig(format='%(levelname)-8s %(filename)s] %(message)s')",
"import re",
"import time",
"import unittest",
"import testutil",
"testutil.fix_path()",
"from google.appengine.ext import db",
"from ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.