code
stringlengths
1
1.49M
vector
listlengths
0
7.38k
snippet
listlengths
0
7.38k
if False: # set to True to insert test data store(store.product.id > 0).delete() store(store.category.id > 0).delete() if len(store(store.product.id > 0).select()) == 0: fantasy_id = store.category.insert(name='Fantasy', description='Fantasy books', small_image='testdata/hp1.jpg') hp1 = ...
[ [ 4, 0, 0.525, 1, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 19 ], [ 8, 1, 0.1, 0.05, 1, 0.89, 0, 266, 3, 0, 0, 0, 0, 0, 2 ], [ 8, 1, 0.15, 0.05, 1, 0.89, 0.5, 266, ...
[ "if False: # set to True to insert test data \n store(store.product.id > 0).delete()\n store(store.category.id > 0).delete()\n if len(store(store.product.id > 0).select()) == 0:\n fantasy_id = store.category.insert(name='Fantasy', description='Fantasy books', small_image='testdata/hp1.jpg')\n ...
UNDEFINED = -1 if request.env.web2py_runtime_gae: # if running on Google App Engine store = DAL('gae') # connect to Google BigTable session.connect(request, response, db=store) # and store sessions and tickets there else: store = DAL("sqlite://store.db") store.define...
[ [ 14, 0, 0.0065, 0.0065, 0, 0.66, 0, 67, 0, 0, 0, 0, 0, 0, 0 ], [ 4, 0, 0.039, 0.0325, 0, 0.66, 0.0323, 0, 7, 0, 0, 0, 0, 0, 3 ], [ 14, 1, 0.0325, 0.0065, 1, 0.3, ...
[ "UNDEFINED = -1", "if request.env.web2py_runtime_gae: # if running on Google App Engine\n store = DAL('gae') # connect to Google BigTable\n session.connect(request, response, db=store) # and store sessions and tickets there\nelse:\n store = DAL(\"sqlite://store.db\")"...
# import re # delimiter to use between words in URL URL_DELIMITER = '-' def pretty_url(id, name): """Create pretty URL from record name and ID """ return '%s%s%d' % (' '.join(re.sub('[^\w ]+', '', name).split()).replace(' ', URL_DELIMITER), URL_DELIMITER, id) def pretty_id(url): """Extract id fr...
[ [ 1, 0, 0.1071, 0.0357, 0, 0.66, 0, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 14, 0, 0.25, 0.0357, 0, 0.66, 0.2, 352, 1, 0, 0, 0, 0, 3, 0 ], [ 2, 0, 0.3393, 0.1429, 0, 0.66, ...
[ "import re", "URL_DELIMITER = '-'", "def pretty_url(id, name):\n \"\"\"Create pretty URL from record name and ID\n \"\"\"\n return '%s%s%d' % (' '.join(re.sub('[^\\w ]+', '', name).split()).replace(' ', URL_DELIMITER), URL_DELIMITER, id)", " \"\"\"Create pretty URL from record name and ID\n \"\...
########################################################### ### make sure administrator is on localhost ############################################################ import os, socket, datetime,copy import gluon.contenttype import gluon.fileutils ### crytical --- make a copy of the environment global_env=copy.copy(glo...
[ [ 1, 0, 0.0288, 0.0048, 0, 0.66, 0, 688, 0, 4, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0337, 0.0048, 0, 0.66, 0.04, 919, 0, 1, 0, 0, 919, 0, 0 ], [ 1, 0, 0.0385, 0.0048, 0, 0....
[ "import os, socket, datetime,copy", "import gluon.contenttype", "import gluon.fileutils", "global_env=copy.copy(globals())", "global_env['datetime']=datetime", "http_host = request.env.http_host.split(':')[0]", "remote_addr = request.env.remote_addr", "try: hosts=(http_host, socket.gethostbyname(remot...
if not session.cart: # instantiate new cart session.cart, session.balance = [], 0 session.google_merchant_id = mystore.google_merchant_id response.menu = [ ['Store Front', request.function == 'index', URL(r=request, f='index')], ['About Us', request.function == 'aboutus', URL(r=request, f='aboutus')]...
[ [ 4, 0, 0.0203, 0.0203, 0, 0.66, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 14, 1, 0.027, 0.0068, 1, 0.72, 0, 0, 0, 0, 0, 0, 0, 8, 0 ], [ 14, 0, 0.0338, 0.0068, 0, 0.66, 0....
[ "if not session.cart:\n # instantiate new cart\n session.cart, session.balance = [], 0", " session.cart, session.balance = [], 0", "session.google_merchant_id = mystore.google_merchant_id", "response.menu = [\n ['Store Front', request.function == 'index', URL(r=request, f='index')],\n ['About Us', ...
########################################################### ### make sure administrator is on localhost ############################################################ import os from gluon.contenttype import contenttype from gluon.fileutils import check_credentials, listdir if not session.authorized and not request.func...
[ [ 1, 0, 0.0278, 0.0056, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0333, 0.0056, 0, 0.66, 0.0625, 919, 0, 1, 0, 0, 919, 0, 0 ], [ 1, 0, 0.0389, 0.0056, 0, ...
[ "import os", "from gluon.contenttype import contenttype", "from gluon.fileutils import check_credentials, listdir", "if not session.authorized and not request.function=='login':\n redirect(URL(r=request,f='login'))", " redirect(URL(r=request,f='login'))", "response.view='manage.html'", "response.m...
#!/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...
maxVf = 200 # Generating the header head = """// Copyright qiuc12@gmail.com // This file is generated autmatically by python. DONT MODIFY IT! #pragma once #include <OleAuto.h> class FakeDispatcher; HRESULT DualProcessCommand(int commandId, FakeDispatcher *disp, ...); extern "C" void DualProcessCommandWrap()...
[ [ 14, 0, 0.0172, 0.0172, 0, 0.66, 0, 302, 1, 0, 0, 0, 0, 1, 0 ], [ 14, 0, 0.1466, 0.1724, 0, 0.66, 0.0476, 217, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.319, 0.1379, 0, 0....
[ "maxVf = 200", "head = \"\"\"// Copyright qiuc12@gmail.com\n// This file is generated autmatically by python. DONT MODIFY IT!\n\n#pragma once\n#include <OleAuto.h>\nclass FakeDispatcher;\nHRESULT DualProcessCommand(int commandId, FakeDispatcher *disp, ...);\nextern \"C\" void DualProcessCommandWrap();", "patter...
#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Error.py # Purpose: error exception class # Author: Fabien Marteau <fabien.marteau@armadeus.com> # Created: 30/04/2008 #-------------------------------------------------------------...
[ [ 14, 0, 0.4923, 0.0154, 0, 0.66, 0, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.5077, 0.0154, 0, 0.66, 0.1667, 587, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.5231, 0.0154, 0, 0...
[ "__doc__ = \"\"", "__versionTime__ = \"30/04/2008\"", "__author__ = \"Fabien Marteau <fabien.marteau@armadeus.com>\"", "INFO = 2", "WARNING = 1", "ERROR = 0", "class Error(Exception):\n \"\"\" Manage specific error\n\n attributes:\n message -- the message\n level -- the except...
#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: general_test.py # Purpose: General testing program for unioc-ng # Author: Fabien Marteau <fabien.marteau@armadeus.com> # Created: 22/11/2008 #----------------------------------------...
[ [ 14, 0, 0.4848, 0.0152, 0, 0.66, 0, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.5, 0.0152, 0, 0.66, 0.125, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.5303, 0.0152, 0, 0.66, ...
[ "__doc__ = \"\"", "__author__ = \"Fabien Marteau <fabien.marteau@armadeus.com>\"", "import sys", "import os", "from error import Error", "from bootstrap import BootStrap", "def consoleDump(tid):\n while 1:\n sys.stdout.write(tid.read(1))", " while 1:\n sys.stdout.write(tid.read...
#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: bootstrap.py # Purpose: bootstrap class used to communicate with atmega # Author: Fabien Marteau <fabien.marteau@armadeus.com> # Created: 22/11/2008 #--------------------------------...
[ [ 14, 0, 0.5333, 0.0167, 0, 0.66, 0, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.55, 0.0167, 0, 0.66, 0.1667, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.5833, 0.0167, 0, 0.66...
[ "__doc__ = \"\"", "__author__ = \"Fabien Marteau <fabien.marteau@armadeus.com>\"", "import sys", "import time", "import os", "try:\n import serial\nexcept ImportError:\n \"http://pyserial.wiki.sourceforge.net/pySerial\"", " import serial", " \"http://pyserial.wiki.sourceforge.n...
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datet...
[ [ 1, 0, 0.0544, 0.0068, 0, 0.66, 0, 890, 0, 1, 0, 0, 890, 0, 0 ], [ 1, 0, 0.0612, 0.0068, 0, 0.66, 0.1667, 752, 0, 2, 0, 0, 752, 0, 0 ], [ 1, 0, 0.068, 0.0068, 0, 0...
[ "import string", "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module", "from datetime import datetime", "from packet_function import *", "import re #regular expression", "from email.parser import Parser #parser for mime type !", "class MSN:\n\tdef __init__(self,ip, parano=False...
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datet...
[ [ 1, 0, 0.0544, 0.0068, 0, 0.66, 0, 890, 0, 1, 0, 0, 890, 0, 0 ], [ 1, 0, 0.0612, 0.0068, 0, 0.66, 0.1667, 752, 0, 2, 0, 0, 752, 0, 0 ], [ 1, 0, 0.068, 0.0068, 0, 0...
[ "import string", "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module", "from datetime import datetime", "from packet_function import *", "import re #regular expression", "from email.parser import Parser #parser for mime type !", "class MSN:\n\tdef __init__(self,ip, parano=False...
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datet...
[ [ 1, 0, 0.2, 0.025, 0, 0.66, 0, 890, 0, 1, 0, 0, 890, 0, 0 ], [ 1, 0, 0.225, 0.025, 0, 0.66, 0.1429, 752, 0, 2, 0, 0, 752, 0, 0 ], [ 1, 0, 0.25, 0.025, 0, 0.66, ...
[ "import string", "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module", "from datetime import datetime", "import time", "import re #regular expression", "from email.parser import Parser #parser for mime type !", "from packet_function import *", "class BBC:\n\tdef __init__(self...
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datet...
[ [ 1, 0, 0.0727, 0.0091, 0, 0.66, 0, 890, 0, 1, 0, 0, 890, 0, 0 ], [ 1, 0, 0.0818, 0.0091, 0, 0.66, 0.1111, 752, 0, 2, 0, 0, 752, 0, 0 ], [ 1, 0, 0.0909, 0.0091, 0, ...
[ "import string", "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module", "from datetime import datetime", "import time", "from packet_function import *", "import re #regular expression", "from email.parser import Parser #parser for mime type !", "class Triplet:\n\tdef __init__(...
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datet...
[ [ 1, 0, 0.0727, 0.0091, 0, 0.66, 0, 890, 0, 1, 0, 0, 890, 0, 0 ], [ 1, 0, 0.0818, 0.0091, 0, 0.66, 0.1111, 752, 0, 2, 0, 0, 752, 0, 0 ], [ 1, 0, 0.0909, 0.0091, 0, ...
[ "import string", "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module", "from datetime import datetime", "import time", "from packet_function import *", "import re #regular expression", "from email.parser import Parser #parser for mime type !", "class Triplet:\n\tdef __init__(...
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datet...
[ [ 1, 0, 0.2, 0.025, 0, 0.66, 0, 890, 0, 1, 0, 0, 890, 0, 0 ], [ 1, 0, 0.225, 0.025, 0, 0.66, 0.1429, 752, 0, 2, 0, 0, 752, 0, 0 ], [ 1, 0, 0.25, 0.025, 0, 0.66, ...
[ "import string", "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module", "from datetime import datetime", "import time", "import re #regular expression", "from email.parser import Parser #parser for mime type !", "from packet_function import *", "class BBC:\n\tdef __init__(self...
#!/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/python # $Id: testupnpigd.py,v 1.4 2008/10/11 10:27:20 nanard Exp $ # MiniUPnP project # Author : Thomas Bernard # This Sample code is public domain. # website : http://miniupnp.tuxfamily.org/ # import the python miniupnpc module import miniupnpc import socket import BaseHTTPServer # function definition d...
[ [ 1, 0, 0.0526, 0.0526, 0, 0.66, 0, 772, 0, 1, 0, 0, 772, 0, 0 ], [ 1, 0, 0.1053, 0.0526, 0, 0.66, 0.25, 687, 0, 1, 0, 0, 687, 0, 0 ], [ 1, 0, 0.1579, 0.0526, 0, 0....
[ "import miniupnpc", "import socket", "import BaseHTTPServer", "def list_redirections():\n\ti = 0\n\twhile True:\n\t\tp = u.getgenericportmapping(i)\n\t\tif p==None:\n\t\t\tbreak\n\t\tprint(i, p)\n\t\ti = i + 1", "\ti = 0", "\twhile True:\n\t\tp = u.getgenericportmapping(i)\n\t\tif p==None:\n\t\t\tbreak\n\...
#! /usr/bin/python # $Id: setup.py,v 1.3 2009/04/17 20:59:42 nanard Exp $ # the MiniUPnP Project (c) 2007 Thomas Bernard # http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ # # python script to build the miniupnpc module under unix # # replace libminiupnpc.a by libminiupnpc.so for shared library usage from dis...
[ [ 1, 0, 0.6, 0.0667, 0, 0.66, 0, 152, 0, 2, 0, 0, 152, 0, 0 ], [ 8, 0, 0.8, 0.3333, 0, 0.66, 1, 234, 3, 3, 0, 0, 0, 0, 2 ] ]
[ "from distutils.core import setup, Extension", "setup(name=\"miniupnpc\", version=\"1.3\",\n ext_modules=[\n\t Extension(name=\"miniupnpc\", sources=[\"miniupnpcmodule.c\"],\n\t\t\t extra_objects=[\"libminiupnpc.a\"])\n\t\t\t ])" ]
#! /usr/bin/python # $Id: setupmingw32.py,v 1.1 2007/06/12 23:04:13 nanard Exp $ # the MiniUPnP Project (c) 2007 Thomas Bernard # http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ # # python script to build the miniupnpc module under unix # from distutils.core import setup, Extension setup(name="miniupnpc", ve...
[ [ 1, 0, 0.5333, 0.0667, 0, 0.66, 0, 152, 0, 2, 0, 0, 152, 0, 0 ], [ 8, 0, 0.7667, 0.4, 0, 0.66, 1, 234, 3, 3, 0, 0, 0, 0, 2 ] ]
[ "from distutils.core import setup, Extension", "setup(name=\"miniupnpc\", version=\"1.0-RC6\",\n ext_modules=[\n\t Extension(name=\"miniupnpc\", sources=[\"miniupnpcmodule.c\"],\n\t libraries=[\"ws2_32\"],\n\t\t\t extra_objects=[\"libminiupnpc.a\"])\n\t\t\t ])" ]
#! /usr/bin/python # MiniUPnP project # Author : Thomas Bernard # This Sample code is public domain. # website : http://miniupnp.tuxfamily.org/ # import the python miniupnpc module import miniupnpc import sys # create the object u = miniupnpc.UPnP() print 'inital(default) values :' print ' discoverdelay', u.discoverd...
[ [ 1, 0, 0.3333, 0.3333, 0, 0.66, 0, 772, 0, 1, 0, 0, 772, 0, 0 ], [ 1, 0, 0.6667, 0.3333, 0, 0.66, 1, 509, 0, 1, 0, 0, 509, 0, 0 ] ]
[ "import miniupnpc", "import sys" ]
#!/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...
#!/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.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...
"""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']", ...
"""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...
#!/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...
''' Module which brings history information about files from Mercurial. @author: Rodrigo Damazio ''' import re import subprocess REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*') def _GetOutputLines(args): ''' Runs an external process and returns its output as a list of lines. @param args: the argume...
[ [ 8, 0, 0.0319, 0.0532, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0745, 0.0106, 0, 0.66, 0.1429, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 1, 0, 0.0851, 0.0106, 0, 0.66...
[ "'''\nModule which brings history information about files from Mercurial.\n\n@author: Rodrigo Damazio\n'''", "import re", "import subprocess", "REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')", "def _GetOutputLines(args):\n '''\n Runs an external process and returns its output as a list of lines...
#!/usr/bin/python ''' Entry point for My Tracks i18n tool. @author: Rodrigo Damazio ''' import mytracks.files import mytracks.translate import mytracks.validate import sys def Usage(): print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0] print 'Commands are:' print ' cleanup' print ' translate' p...
[ [ 8, 0, 0.0417, 0.0521, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0833, 0.0104, 0, 0.66, 0.125, 640, 0, 1, 0, 0, 640, 0, 0 ], [ 1, 0, 0.0938, 0.0104, 0, 0.66,...
[ "'''\nEntry point for My Tracks i18n tool.\n\n@author: Rodrigo Damazio\n'''", "import mytracks.files", "import mytracks.translate", "import mytracks.validate", "import sys", "def Usage():\n print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])\n print('Commands are:')\n print(' cleanup')\n p...
''' Module which prompts the user for translations and saves them. TODO: implement @author: Rodrigo Damazio ''' class Translator(object): ''' classdocs ''' def __init__(self, language): ''' Constructor ''' self._language = language def Translate(self, string_names): print string_names
[ [ 8, 0, 0.1905, 0.3333, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 3, 0, 0.7143, 0.619, 0, 0.66, 1, 229, 0, 2, 0, 0, 186, 0, 1 ], [ 8, 1, 0.5238, 0.1429, 1, 0, 0, ...
[ "'''\nModule which prompts the user for translations and saves them.\n\nTODO: implement\n\n@author: Rodrigo Damazio\n'''", "class Translator(object):\n '''\n classdocs\n '''\n\n def __init__(self, language):\n '''\n Constructor", " '''\n classdocs\n '''", " def __init__(self, language):\n '''...
''' Module which compares languague files to the master file and detects issues. @author: Rodrigo Damazio ''' import os from mytracks.parser import StringsParser import mytracks.history class Validator(object): def __init__(self, languages): ''' Builds a strings file validator. Params: @para...
[ [ 8, 0, 0.0304, 0.0522, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0696, 0.0087, 0, 0.66, 0.25, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0783, 0.0087, 0, 0.66, ...
[ "'''\nModule which compares languague files to the master file and detects\nissues.\n\n@author: Rodrigo Damazio\n'''", "import os", "from mytracks.parser import StringsParser", "import mytracks.history", "class Validator(object):\n\n def __init__(self, languages):\n '''\n Builds a strings file valida...
''' Module for dealing with resource files (but not their contents). @author: Rodrigo Damazio ''' import os.path from glob import glob import re MYTRACKS_RES_DIR = 'MyTracks/res' ANDROID_MASTER_VALUES = 'values' ANDROID_VALUES_MASK = 'values-*' def GetMyTracksDir(): ''' Returns the directory in which the MyTrac...
[ [ 8, 0, 0.0667, 0.1111, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1333, 0.0222, 0, 0.66, 0.125, 79, 0, 1, 0, 0, 79, 0, 0 ], [ 1, 0, 0.1556, 0.0222, 0, 0.66, ...
[ "'''\nModule for dealing with resource files (but not their contents).\n\n@author: Rodrigo Damazio\n'''", "import os.path", "from glob import glob", "import re", "MYTRACKS_RES_DIR = 'MyTracks/res'", "ANDROID_MASTER_VALUES = 'values'", "ANDROID_VALUES_MASK = 'values-*'", "def GetMyTracksDir():\n '''\n...
''' Module which parses a string XML file. @author: Rodrigo Damazio ''' from xml.parsers.expat import ParserCreate import re #import xml.etree.ElementTree as ET class StringsParser(object): ''' Parser for string XML files. This object is not thread-safe and should be used for parsing a single file at a time...
[ [ 8, 0, 0.0261, 0.0435, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0609, 0.0087, 0, 0.66, 0.3333, 573, 0, 1, 0, 0, 573, 0, 0 ], [ 1, 0, 0.0696, 0.0087, 0, 0.66...
[ "'''\nModule which parses a string XML file.\n\n@author: Rodrigo Damazio\n'''", "from xml.parsers.expat import ParserCreate", "import re", "class StringsParser(object):\n '''\n Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n...
import urllib import urllib2 import argparse import sys from log import Logger from datetime import datetime, timedelta def verify_order(postdata, sandbox): data = 'cmd=_notify-validate&' + postdata if sandbox: scr = 'https://www.sandbox.paypal.com/cgi-bin/websc' else: scr = 'https://www.payp...
[ [ 1, 0, 0.012, 0.012, 0, 0.66, 0, 614, 0, 1, 0, 0, 614, 0, 0 ], [ 1, 0, 0.0241, 0.012, 0, 0.66, 0.1, 345, 0, 1, 0, 0, 345, 0, 0 ], [ 1, 0, 0.0361, 0.012, 0, 0.66, ...
[ "import urllib", "import urllib2", "import argparse", "import sys", "from log import Logger", "from datetime import datetime, timedelta", "def verify_order(postdata, sandbox):\n data = 'cmd=_notify-validate&' + postdata\n if sandbox:\n scr = 'https://www.sandbox.paypal.com/cgi-bin/websc'\n else:\n...
from hgapi import * import shutil import os import threading import optparse import traceback import log from datetime import datetime, timedelta class HGDonationLog: def __init__(self, config, logger): self._path = config['path'] self._repo = Repo(self._path) self._target = config['logfile'...
[ [ 1, 0, 0.011, 0.011, 0, 0.66, 0, 757, 0, 1, 0, 0, 757, 0, 0 ], [ 1, 0, 0.022, 0.011, 0, 0.66, 0.1, 614, 0, 1, 0, 0, 614, 0, 0 ], [ 1, 0, 0.033, 0.011, 0, 0.66, ...
[ "from hgapi import *", "import shutil", "import os", "import threading", "import optparse", "import traceback", "import log", "from datetime import datetime, timedelta", "class HGDonationLog:\n def __init__(self, config, logger):\n self._path = config['path']\n self._repo = Repo(self._path)\n...
import subprocess import tempfile import shutil import os import codecs import json import zipfile class Packer: def __init__(self, input_path, outputfile): self.input_path = os.path.abspath(input_path) self.outputfile = os.path.abspath(outputfile) self.tmppath = None def pack(self): ...
[ [ 1, 0, 0.0116, 0.0116, 0, 0.66, 0, 394, 0, 1, 0, 0, 394, 0, 0 ], [ 1, 0, 0.0233, 0.0116, 0, 0.66, 0.1, 516, 0, 1, 0, 0, 516, 0, 0 ], [ 1, 0, 0.0349, 0.0116, 0, 0.6...
[ "import subprocess", "import tempfile", "import shutil", "import os", "import codecs", "import json", "import zipfile", "class Packer:\n def __init__(self, input_path, outputfile):\n self.input_path = os.path.abspath(input_path)\n self.outputfile = os.path.abspath(outputfile)\n self.tmppath ...
#!/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.1816, 0.0078, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.1914, 0.0039, 0, 0.66, 0.0833, 777, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.1992, 0.0039, 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...
# Copyright (c) 2012 eagleonhill(qiuc12@gmail.com). All rights reserved. # Use of this source code is governed by a Mozilla-1.1 license that can be # found in the LICENSE file. import googlecode_upload import tempfile import urllib2 import optparse import os extensionid = 'lgllffgicojgllpmdbemgglaponefajn' ...
[ [ 1, 0, 0.093, 0.0233, 0, 0.66, 0, 481, 0, 1, 0, 0, 481, 0, 0 ], [ 1, 0, 0.1163, 0.0233, 0, 0.66, 0.1111, 516, 0, 1, 0, 0, 516, 0, 0 ], [ 1, 0, 0.1395, 0.0233, 0, 0...
[ "import googlecode_upload", "import tempfile", "import urllib2", "import optparse", "import os", "extensionid = 'lgllffgicojgllpmdbemgglaponefajn'", "def download():\n url = (\"https://clients2.google.com/service/update2/crx?\"\n \"response=redirect&x=id%3D\" + extensionid + \"%26uc\")\n respons...
maxVf = 200 # Generating the header head = """// Copyright qiuc12@gmail.com // This file is generated autmatically by python. DONT MODIFY IT! #pragma once #include <OleAuto.h> class FakeDispatcher; HRESULT DualProcessCommand(int commandId, FakeDispatcher *disp, ...); extern "C" void DualProcessCommandWrap()...
[ [ 14, 0, 0.0172, 0.0172, 0, 0.66, 0, 302, 1, 0, 0, 0, 0, 1, 0 ], [ 14, 0, 0.1466, 0.1724, 0, 0.66, 0.0476, 217, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.319, 0.1379, 0, 0....
[ "maxVf = 200", "head = \"\"\"// Copyright qiuc12@gmail.com\n// This file is generated autmatically by python. DONT MODIFY IT!\n\n#pragma once\n#include <OleAuto.h>\nclass FakeDispatcher;\nHRESULT DualProcessCommand(int commandId, FakeDispatcher *disp, ...);\nextern \"C\" void DualProcessCommandWrap();", "patter...
import time def yesno(question): val = raw_input(question + " ") return val.startswith("y") or val.startswith("Y") use_pysqlite2 = yesno("Use pysqlite 2.0?") use_autocommit = yesno("Use autocommit?") use_executemany= yesno("Use executemany?") if use_pysqlite2: from pysqlite2 import dbapi2 as s...
[ [ 1, 0, 0.0164, 0.0164, 0, 0.66, 0, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 2, 0, 0.0656, 0.0492, 0, 0.66, 0.125, 796, 0, 1, 1, 0, 0, 0, 3 ], [ 14, 1, 0.0656, 0.0164, 1, 0....
[ "import time", "def yesno(question):\n val = raw_input(question + \" \")\n return val.startswith(\"y\") or val.startswith(\"Y\")", " val = raw_input(question + \" \")", " return val.startswith(\"y\") or val.startswith(\"Y\")", "use_pysqlite2 = yesno(\"Use pysqlite 2.0?\")", "use_autocommit = y...
import time def yesno(question): val = raw_input(question + " ") return val.startswith("y") or val.startswith("Y") use_pysqlite2 = yesno("Use pysqlite 2.0?") if use_pysqlite2: use_custom_types = yesno("Use custom types?") use_dictcursor = yesno("Use dict cursor?") use_rowcursor = yesno("...
[ [ 1, 0, 0.0103, 0.0103, 0, 0.66, 0, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 2, 0, 0.0412, 0.0309, 0, 0.66, 0.1111, 796, 0, 1, 1, 0, 0, 0, 3 ], [ 14, 1, 0.0412, 0.0103, 1, 0...
[ "import time", "def yesno(question):\n val = raw_input(question + \" \")\n return val.startswith(\"y\") or val.startswith(\"Y\")", " val = raw_input(question + \" \")", " return val.startswith(\"y\") or val.startswith(\"Y\")", "use_pysqlite2 = yesno(\"Use pysqlite 2.0?\")", "if use_pysqlite2:\...
#!/usr/bin/env python from pysqlite2.test import test test()
[ [ 1, 0, 0.6667, 0.3333, 0, 0.66, 0, 472, 0, 1, 0, 0, 472, 0, 0 ], [ 8, 0, 1, 0.3333, 0, 0.66, 1, 224, 3, 0, 0, 0, 0, 0, 1 ] ]
[ "from pysqlite2.test import test", "test()" ]
from pysqlite2 import dbapi2 as sqlite import os, threading def getcon(): #con = sqlite.connect("db", isolation_level=None, timeout=5.0) con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(i, s)") for i in range(10): cur.execute("insert into test(i, s) values ...
[ [ 1, 0, 0.0125, 0.0125, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 1, 0, 0.025, 0.0125, 0, 0.66, 0.1, 688, 0, 2, 0, 0, 688, 0, 0 ], [ 2, 0, 0.1062, 0.125, 0, 0.66,...
[ "from pysqlite2 import dbapi2 as sqlite", "import os, threading", "def getcon():\n #con = sqlite.connect(\"db\", isolation_level=None, timeout=5.0)\n con = sqlite.connect(\":memory:\")\n cur = con.cursor()\n cur.execute(\"create table test(i, s)\")\n for i in range(10):\n cur.execute(\"ins...
from __future__ import with_statement from pysqlite2 import dbapi2 as sqlite3 from datetime import datetime, timedelta import time def read_modify_write(): # Open connection and create example schema and data. # In reality, open a database file instead of an in-memory database. con = sqlite3.connect(":memo...
[ [ 1, 0, 0.0091, 0.0091, 0, 0.66, 0, 777, 0, 1, 0, 0, 777, 0, 0 ], [ 1, 0, 0.0182, 0.0091, 0, 0.66, 0.1429, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 1, 0, 0.0273, 0.0091, 0, ...
[ "from __future__ import with_statement", "from pysqlite2 import dbapi2 as sqlite3", "from datetime import datetime, timedelta", "import time", "def read_modify_write():\n # Open connection and create example schema and data.\n # In reality, open a database file instead of an in-memory database.\n c...
from pysqlite2 import dbapi2 as sqlite3 Cursor = sqlite3.Cursor class EagerCursor(Cursor): def __init__(self, con): Cursor.__init__(self, con) self.rows = [] self.pos = 0 def execute(self, *args): sqlite3.Cursor.execute(self, *args) self.rows = Cursor.fetchall(self) ...
[ [ 1, 0, 0.0196, 0.0196, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.0588, 0.0196, 0, 0.66, 0.25, 647, 7, 0, 0, 0, 0, 0, 0 ], [ 3, 0, 0.3922, 0.6078, 0, 0.6...
[ "from pysqlite2 import dbapi2 as sqlite3", "Cursor = sqlite3.Cursor", "class EagerCursor(Cursor):\n def __init__(self, con):\n Cursor.__init__(self, con)\n self.rows = []\n self.pos = 0\n\n def execute(self, *args):\n sqlite3.Cursor.execute(self, *args)", " def __init__(se...
#!/usr/bin/env python # # Cross-compile and build pysqlite installers for win32 on Linux or Mac OS X. # # The way this works is very ugly, but hey, it *works*! And I didn't have to # reinvent the wheel using NSIS. import os import sys import urllib import zipfile from setup import get_amalgamation # Cross-compiler ...
[ [ 1, 0, 0.1176, 0.0147, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.1324, 0.0147, 0, 0.66, 0.0833, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.1471, 0.0147, 0, ...
[ "import os", "import sys", "import urllib", "import zipfile", "from setup import get_amalgamation", "if sys.platform == \"darwin\":\n CC = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc\"\n LIBDIR = \"lib.macosx-10.6-i386-2.5\"\n STRIP = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc ...
# -*- coding: utf-8 -*- # # pysqlite documentation build configuration file, created by # sphinx-quickstart.py on Sat Mar 22 02:47:54 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pic...
[ [ 1, 0, 0.1061, 0.0076, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 14, 0, 0.2045, 0.0076, 0, 0.66, 0.0769, 518, 0, 0, 0, 0, 0, 5, 0 ], [ 14, 0, 0.2273, 0.0076, 0, ...
[ "import sys", "templates_path = ['.templates']", "source_suffix = '.rst'", "master_doc = 'index'", "project = 'pysqlite'", "copyright = u'2008-2009, Gerhard Häring'", "version = '2.6'", "release = '2.6.0'", "today_fmt = '%B %d, %Y'", "pygments_style = 'sphinx'", "html_style = 'default.css'", "...
from pysqlite2 import dbapi2 as sqlite3 FIELD_MAX_WIDTH = 20 TABLE_NAME = 'people' SELECT = 'select * from %s order by age, name_last' % TABLE_NAME con = sqlite3.connect("mydb") cur = con.cursor() cur.execute(SELECT) # Print a header. for fieldDesc in cur.description: print fieldDesc[0].ljust(FIELD_MAX_WIDTH) ,...
[ [ 1, 0, 0.5, 0.5, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ] ]
[ "from pysqlite2 import dbapi2 as sqlite3" ]
from pysqlite2 import dbapi2 as sqlite3 def progress(): print "Query still executing. Please wait ..." con = sqlite3.connect(":memory:") con.execute("create table test(x)") # Let's create some data con.executemany("insert into test(x) values (?)", [(x,) for x in xrange(300)]) # A progress handler, executed ever...
[ [ 1, 0, 0.0345, 0.0345, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 2, 0, 0.1207, 0.069, 0, 0.66, 0.1, 82, 0, 0, 0, 0, 0, 0, 1 ], [ 8, 1, 0.1379, 0.0345, 1, 0.68, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "def progress():\n print(\"Query still executing. Please wait ...\")", " print(\"Query still executing. Please wait ...\")", "con = sqlite3.connect(\":memory:\")", "con.execute(\"create table test(x)\")", "con.executemany(\"insert into test(x) values (?)\",...
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() SELECT = "select name_last, age from people order by age, name_last" # 1. Iterate over the rows available from the cursor, unpacking the # resulting sequences to yield their elements (name_last, age): cur.execute(SELECT) for (na...
[ [ 1, 0, 0.0588, 0.0588, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.1765, 0.0588, 0, 0.66, 0.1429, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.2941, 0.0588, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\"mydb\")", "cur = con.cursor()", "SELECT = \"select name_last, age from people order by age, name_last\"", "cur.execute(SELECT)", "for (name_last, age) in cur:\n print('%s is %d years old.' % (name_last, age))", " print('%s is %d y...
from pysqlite2 import dbapi2 as sqlite3 # Create a connection to the database file "mydb": con = sqlite3.connect("mydb") # Get a Cursor object that operates in the context of Connection con: cur = con.cursor() # Execute the SELECT statement: cur.execute("select * from people order by age") # Retrieve all rows as a ...
[ [ 1, 0, 0.0769, 0.0769, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.3077, 0.0769, 0, 0.66, 0.25, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.5385, 0.0769, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\"mydb\")", "cur = con.cursor()", "cur.execute(\"select * from people order by age\")", "print(cur.fetchall())" ]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb")
[ [ 1, 0, 0.3333, 0.3333, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 1, 0.3333, 0, 0.66, 1, 761, 3, 1, 0, 0, 242, 10, 1 ] ]
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\"mydb\")" ]
from pysqlite2 import dbapi2 as sqlite3 class MySum: def __init__(self): self.count = 0 def step(self, value): self.count += value def finalize(self): return self.count con = sqlite3.connect(":memory:") con.create_aggregate("mysum", 1, MySum) cur = con.cursor() cur.execute("creat...
[ [ 1, 0, 0.05, 0.05, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 3, 0, 0.35, 0.45, 0, 0.66, 0.1111, 865, 0, 3, 0, 0, 0, 0, 0 ], [ 2, 1, 0.225, 0.1, 1, 0.23, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "class MySum:\n def __init__(self):\n self.count = 0\n\n def step(self, value):\n self.count += value\n\n def finalize(self):", " def __init__(self):\n self.count = 0", " self.count = 0", " def step(self, value):\n ...
# A minimal SQLite shell for experiments from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") con.isolation_level = None cur = con.cursor() buffer = "" print "Enter your SQL commands to execute in SQLite." print "Enter a blank line to exit." while True: line = raw_input() if line == ""...
[ [ 1, 0, 0.5, 0.5, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ] ]
[ "from pysqlite2 import dbapi2 as sqlite3" ]
from pysqlite2 import dbapi2 as sqlite3 def dict_factory(cursor, row): d = {} for idx, col in enumerate(cursor.description): d[col[0]] = row[idx] return d con = sqlite3.connect(":memory:") con.row_factory = dict_factory cur = con.cursor() cur.execute("select 1 as a") print cur.fetchone()["a"]
[ [ 1, 0, 0.0769, 0.0769, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 2, 0, 0.3846, 0.3846, 0, 0.66, 0.1667, 131, 0, 2, 1, 0, 0, 0, 1 ], [ 14, 1, 0.3077, 0.0769, 1, 0...
[ "from pysqlite2 import dbapi2 as sqlite3", "def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d", " d = {}", " for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]", " d[col[0]] = row[...
from pysqlite2 import dbapi2 as sqlite3 import datetime con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) cur = con.cursor() cur.execute("create table test(d date, ts timestamp)") today = datetime.date.today() now = datetime.datetime.now() cur.execute("insert into test(d,...
[ [ 1, 0, 0.05, 0.05, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 1, 0, 0.1, 0.05, 0, 0.66, 0.0667, 426, 0, 1, 0, 0, 426, 0, 0 ], [ 14, 0, 0.2, 0.05, 0, 0.66, 0.1...
[ "from pysqlite2 import dbapi2 as sqlite3", "import datetime", "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)", "cur = con.cursor()", "cur.execute(\"create table test(d date, ts timestamp)\")", "today = datetime.date.today()", "now = datetime.datetime.no...
from pysqlite2 import dbapi2 as sqlite3 def authorizer_callback(action, arg1, arg2, dbname, source): if action != sqlite3.SQLITE_SELECT: return sqlite3.SQLITE_DENY if arg1 == "private_table": return sqlite3.SQLITE_DENY return sqlite3.SQLITE_OK con = sqlite3.connect(":memory:") con.executes...
[ [ 1, 0, 0.1111, 0.1111, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 2, 0, 0.6111, 0.6667, 0, 0.66, 1, 423, 0, 5, 1, 0, 0, 0, 0 ], [ 4, 1, 0.5, 0.2222, 1, 0.03, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "def authorizer_callback(action, arg1, arg2, dbname, source):\n if action != sqlite3.SQLITE_SELECT:\n return sqlite3.SQLITE_DENY\n if arg1 == \"private_table\":\n return sqlite3.SQLITE_DENY\n return sqlite3.SQLITE_OK", " if action != sqlite3.S...
from pysqlite2 import dbapi2 as sqlite3 # The shared cache is only available in SQLite versions 3.3.3 or later # See the SQLite documentaton for details. sqlite3.enable_shared_cache(True)
[ [ 1, 0, 0.1667, 0.1667, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 8, 0, 1, 0.1667, 0, 0.66, 1, 965, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "from pysqlite2 import dbapi2 as sqlite3", "sqlite3.enable_shared_cache(True)" ]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:")
[ [ 1, 0, 0.3333, 0.3333, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 1, 0.3333, 0, 0.66, 1, 761, 3, 1, 0, 0, 242, 10, 1 ] ]
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\":memory:\")" ]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() who = "Yeltsin" age = 72 cur.execute("select name_last, age from people where name_last=? and age=?", (who, age)) print cur.fetchone()
[ [ 1, 0, 0.0909, 0.0909, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.2727, 0.0909, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.4545, 0.0909, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\"mydb\")", "cur = con.cursor()", "who = \"Yeltsin\"", "age = 72", "cur.execute(\"select name_last, age from people where name_last=? and age=?\", (who, age))", "print(cur.fetchone())" ]
from __future__ import with_statement from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") con.execute("create table person (id integer primary key, firstname varchar unique)") # Successful, con.commit() is called automatically afterwards with con: con.execute("insert into person(firstname) v...
[ [ 1, 0, 0.0526, 0.0526, 0, 0.66, 0, 777, 0, 1, 0, 0, 777, 0, 0 ], [ 1, 0, 0.1053, 0.0526, 0, 0.66, 0.25, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.2105, 0.0526, 0, 0...
[ "from __future__ import with_statement", "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\":memory:\")", "con.execute(\"create table person (id integer primary key, firstname varchar unique)\")", " con.execute(\"insert into person(firstname) values (?)\", (\"Joe\",))", "try:\n with...
from pysqlite2 import dbapi2 as sqlite3 import md5 def md5sum(t): return md5.md5(t).hexdigest() con = sqlite3.connect(":memory:") con.create_function("md5", 1, md5sum) cur = con.cursor() cur.execute("select md5(?)", ("foo",)) print cur.fetchone()[0]
[ [ 1, 0, 0.0909, 0.0909, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 1, 0, 0.1818, 0.0909, 0, 0.66, 0.1429, 604, 0, 1, 0, 0, 604, 0, 0 ], [ 2, 0, 0.4091, 0.1818, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "import md5", "def md5sum(t):\n return md5.md5(t).hexdigest()", " return md5.md5(t).hexdigest()", "con = sqlite3.connect(\":memory:\")", "con.create_function(\"md5\", 1, md5sum)", "cur = con.cursor()", "cur.execute(\"select md5(?)\", (\"foo\",))", "pr...
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") con.row_factory = sqlite3.Row cur = con.cursor() cur.execute("select name_last, age from people") for row in cur: assert row[0] == row["name_last"] assert row["name_last"] == row["nAmE_lAsT"] assert row[1] == row["age"] assert row[1...
[ [ 1, 0, 0.0833, 0.0833, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.25, 0.0833, 0, 0.66, 0.2, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.3333, 0.0833, 0, 0....
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\"mydb\")", "con.row_factory = sqlite3.Row", "cur = con.cursor()", "cur.execute(\"select name_last, age from people\")", "for row in cur:\n assert row[0] == row[\"name_last\"]\n assert row[\"name_last\"] == row[\"nAmE_lAsT\"]\n ass...
from pysqlite2 import dbapi2 as sqlite3 class Point(object): def __init__(self, x, y): self.x, self.y = x, y def adapt_point(point): return "%f;%f" % (point.x, point.y) sqlite3.register_adapter(Point, adapt_point) con = sqlite3.connect(":memory:") cur = con.cursor() p = Point(4.0, -3.2) cur.execute...
[ [ 1, 0, 0.0588, 0.0588, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 3, 0, 0.2353, 0.1765, 0, 0.66, 0.125, 652, 0, 1, 0, 0, 186, 0, 0 ], [ 2, 1, 0.2647, 0.1176, 1, 0...
[ "from pysqlite2 import dbapi2 as sqlite3", "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y", " def __init__(self, x, y):\n self.x, self.y = x, y", " self.x, self.y = x, y", "def adapt_point(point):\n return \"%f;%f\" % (point.x, point.y)", " retur...
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") cur = con.cursor() # Create the table con.execute("create table person(lastname, firstname)") AUSTRIA = u"\xd6sterreich" # by default, rows are returned as Unicode cur.execute("select ?", (AUSTRIA,)) row = cur.fetchone() assert row[0] == AUST...
[ [ 1, 0, 0.0238, 0.0238, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.0714, 0.0238, 0, 0.66, 0.0588, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.0952, 0.0238, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\":memory:\")", "cur = con.cursor()", "con.execute(\"create table person(lastname, firstname)\")", "AUSTRIA = u\"\\xd6sterreich\"", "cur.execute(\"select ?\", (AUSTRIA,))", "row = cur.fetchone()", "con.text_factory = str", "cur.execut...
from pysqlite2 import dbapi2 as sqlite3 class CountCursorsConnection(sqlite3.Connection): def __init__(self, *args, **kwargs): sqlite3.Connection.__init__(self, *args, **kwargs) self.numcursors = 0 def cursor(self, *args, **kwargs): self.numcursors += 1 return sqlite3.Connectio...
[ [ 1, 0, 0.0667, 0.0667, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 3, 0, 0.4333, 0.5333, 0, 0.66, 0.2, 293, 0, 2, 0, 0, 809, 0, 2 ], [ 2, 1, 0.3333, 0.2, 1, 0.79, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "class CountCursorsConnection(sqlite3.Connection):\n def __init__(self, *args, **kwargs):\n sqlite3.Connection.__init__(self, *args, **kwargs)\n self.numcursors = 0\n\n def cursor(self, *args, **kwargs):\n self.numcursors += 1\n return s...
from pysqlite2 import dbapi2 as sqlite3 def collate_reverse(string1, string2): return -cmp(string1, string2) con = sqlite3.connect(":memory:") con.create_collation("reverse", collate_reverse) cur = con.cursor() cur.execute("create table test(x)") cur.executemany("insert into test(x) values (?)", [("a",), ("b",)]...
[ [ 1, 0, 0.0667, 0.0667, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 2, 0, 0.2333, 0.1333, 0, 0.66, 0.1111, 722, 0, 2, 1, 0, 0, 0, 1 ], [ 13, 1, 0.2667, 0.0667, 1, 0...
[ "from pysqlite2 import dbapi2 as sqlite3", "def collate_reverse(string1, string2):\n return -cmp(string1, string2)", " return -cmp(string1, string2)", "con = sqlite3.connect(\":memory:\")", "con.create_collation(\"reverse\", collate_reverse)", "cur = con.cursor()", "cur.execute(\"create table test...
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") cur = con.cursor() cur.executescript(""" create table person( firstname, lastname, age ); create table book( title, author, published ); insert into book(title, author, publis...
[ [ 1, 0, 0.0417, 0.0417, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.125, 0.0417, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.1667, 0.0417, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\":memory:\")", "cur = con.cursor()", "cur.executescript(\"\"\"\n create table person(\n firstname,\n lastname,\n age\n );\n\n create table book(" ]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") # enable extension loading con.enable_load_extension(True) # Load the fulltext search extension con.execute("select load_extension('./fts3.so')") # alternatively you can load the extension using an API call: # con.load_extension("./fts3.so") ...
[ [ 1, 0, 0.0357, 0.0357, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.1071, 0.0357, 0, 0.66, 0.1429, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 8, 0, 0.2143, 0.0357, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\":memory:\")", "con.enable_load_extension(True)", "con.execute(\"select load_extension('./fts3.so')\")", "con.enable_load_extension(False)", "con.execute(\"create virtual table recipe using fts3(name, ingredients)\")", "con.executescript...
from pysqlite2 import dbapi2 as sqlite3 persons = [ ("Hugo", "Boss"), ("Calvin", "Klein") ] con = sqlite3.connect(":memory:") # Create the table con.execute("create table person(firstname, lastname)") # Fill the table con.executemany("insert into person(firstname, lastname) values (?, ?)", persons) # P...
[ [ 1, 0, 0.0476, 0.0476, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.2143, 0.1905, 0, 0.66, 0.1667, 70, 0, 0, 0, 0, 0, 5, 0 ], [ 14, 0, 0.381, 0.0476, 0, 0....
[ "from pysqlite2 import dbapi2 as sqlite3", "persons = [\n (\"Hugo\", \"Boss\"),\n (\"Calvin\", \"Klein\")\n ]", "con = sqlite3.connect(\":memory:\")", "con.execute(\"create table person(firstname, lastname)\")", "con.executemany(\"insert into person(firstname, lastname) values (?, ?)\", persons)", ...
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() who = "Yeltsin" age = 72 cur.execute("select name_last, age from people where name_last=:who and age=:age", locals()) print cur.fetchone()
[ [ 1, 0, 0.0833, 0.0833, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.25, 0.0833, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.4167, 0.0833, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\"mydb\")", "cur = con.cursor()", "who = \"Yeltsin\"", "age = 72", "cur.execute(\"select name_last, age from people where name_last=:who and age=:age\",\n locals())", "print(cur.fetchone())" ]
# Not referenced from the documentation, but builds the database file the other # code snippets expect. from pysqlite2 import dbapi2 as sqlite3 import os DB_FILE = "mydb" if os.path.exists(DB_FILE): os.remove(DB_FILE) con = sqlite3.connect(DB_FILE) cur = con.cursor() cur.execute(""" create table people ...
[ [ 1, 0, 0.1429, 0.0357, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 1, 0, 0.1786, 0.0357, 0, 0.66, 0.0909, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 14, 0, 0.25, 0.0357, 0, 0...
[ "from pysqlite2 import dbapi2 as sqlite3", "import os", "DB_FILE = \"mydb\"", "if os.path.exists(DB_FILE):\n os.remove(DB_FILE)", " os.remove(DB_FILE)", "con = sqlite3.connect(DB_FILE)", "cur = con.cursor()", "cur.execute(\"\"\"\n create table people\n (\n name_last v...
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() who = "Yeltsin" age = 72 cur.execute("select name_last, age from people where name_last=:who and age=:age", {"who": who, "age": age}) print cur.fetchone()
[ [ 1, 0, 0.0833, 0.0833, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.25, 0.0833, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.4167, 0.0833, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\"mydb\")", "cur = con.cursor()", "who = \"Yeltsin\"", "age = 72", "cur.execute(\"select name_last, age from people where name_last=:who and age=:age\",\n {\"who\": who, \"age\": age})", "print(cur.fetchone())" ]
from pysqlite2 import dbapi2 as sqlite3 import datetime con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES) cur = con.cursor() cur.execute('select ? as "x [timestamp]"', (datetime.datetime.now(),)) dt = cur.fetchone()[0] print dt, type(dt)
[ [ 1, 0, 0.125, 0.125, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 1, 0, 0.25, 0.125, 0, 0.66, 0.1667, 426, 0, 1, 0, 0, 426, 0, 0 ], [ 14, 0, 0.5, 0.125, 0, 0.66, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "import datetime", "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)", "cur = con.cursor()", "cur.execute('select ? as \"x [timestamp]\"', (datetime.datetime.now(),))", "dt = cur.fetchone()[0]", "print(dt, type(dt))" ]
from pysqlite2 import dbapi2 as sqlite3 def char_generator(): import string for c in string.letters[:26]: yield (c,) con = sqlite3.connect(":memory:") cur = con.cursor() cur.execute("create table characters(c)") cur.executemany("insert into characters(c) values (?)", char_generator()) cur.execute("s...
[ [ 1, 0, 0.0667, 0.0667, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 2, 0, 0.3, 0.2667, 0, 0.66, 0.1429, 806, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 0.2667, 0.0667, 1, 0.41,...
[ "from pysqlite2 import dbapi2 as sqlite3", "def char_generator():\n import string\n for c in string.letters[:26]:\n yield (c,)", " import string", " for c in string.letters[:26]:\n yield (c,)", " yield (c,)", "con = sqlite3.connect(\":memory:\")", "cur = con.cursor()", ...
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() newPeople = ( ('Lebed' , 53), ('Zhirinovsky' , 57), ) for person in newPeople: cur.execute("insert into people (name_last, age) values (?, ?)", person) # The changes will not be saved unless the transaction...
[ [ 1, 0, 0.0625, 0.0625, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 14, 0, 0.1875, 0.0625, 0, 0.66, 0.2, 761, 3, 1, 0, 0, 242, 10, 1 ], [ 14, 0, 0.3125, 0.0625, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "con = sqlite3.connect(\"mydb\")", "cur = con.cursor()", "newPeople = (\n ('Lebed' , 53),\n ('Zhirinovsky' , 57),\n )", "for person in newPeople:\n cur.execute(\"insert into people (name_last, age) values (?, ?)\", person)", " cur.execute(\"ins...
from pysqlite2 import dbapi2 as sqlite3 class Point(object): def __init__(self, x, y): self.x, self.y = x, y def __conform__(self, protocol): if protocol is sqlite3.PrepareProtocol: return "%f;%f" % (self.x, self.y) con = sqlite3.connect(":memory:") cur = con.cursor() p = Point(4...
[ [ 1, 0, 0.0625, 0.0625, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 3, 0, 0.375, 0.4375, 0, 0.66, 0.1667, 652, 0, 2, 0, 0, 186, 0, 0 ], [ 2, 1, 0.2812, 0.125, 1, 0....
[ "from pysqlite2 import dbapi2 as sqlite3", "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y\n\n def __conform__(self, protocol):\n if protocol is sqlite3.PrepareProtocol:\n return \"%f;%f\" % (self.x, self.y)", " def __init__(self, x, y):\n self....
from pysqlite2 import dbapi2 as sqlite3 class Point(object): def __init__(self, x, y): self.x, self.y = x, y def __repr__(self): return "(%f;%f)" % (self.x, self.y) def adapt_point(point): return "%f;%f" % (point.x, point.y) def convert_point(s): x, y = map(float, s.split(";")) r...
[ [ 1, 0, 0.0213, 0.0213, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 3, 0, 0.117, 0.1277, 0, 0.66, 0.0455, 652, 0, 2, 0, 0, 186, 0, 0 ], [ 2, 1, 0.0957, 0.0426, 1, 0...
[ "from pysqlite2 import dbapi2 as sqlite3", "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y\n\n def __repr__(self):\n return \"(%f;%f)\" % (self.x, self.y)", " def __init__(self, x, y):\n self.x, self.y = x, y", " self.x, self.y = x, y", " def...
from pysqlite2 import dbapi2 as sqlite3 class IterChars: def __init__(self): self.count = ord('a') def __iter__(self): return self def next(self): if self.count > ord('z'): raise StopIteration self.count += 1 return (chr(self.count - 1),) # this is a 1-...
[ [ 1, 0, 0.0417, 0.0417, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 3, 0, 0.3542, 0.5, 0, 0.66, 0.125, 192, 0, 3, 0, 0, 0, 0, 3 ], [ 2, 1, 0.1875, 0.0833, 1, 0.87, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "class IterChars:\n def __init__(self):\n self.count = ord('a')\n\n def __iter__(self):\n return self\n\n def next(self):", " def __init__(self):\n self.count = ord('a')", " self.count = ord('a')", " def __iter__(self):\n ...
from pysqlite2 import dbapi2 as sqlite3 import apsw apsw_con = apsw.Connection(":memory:") apsw_con.createscalarfunction("times_two", lambda x: 2*x, 1) # Create pysqlite connection from APSW connection con = sqlite3.connect(apsw_con) result = con.execute("select times_two(15)").fetchone()[0] assert result == 30 con.c...
[ [ 1, 0, 0.0833, 0.0833, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 1, 0, 0.1667, 0.0833, 0, 0.66, 0.1667, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 14, 0, 0.3333, 0.0833, 0, ...
[ "from pysqlite2 import dbapi2 as sqlite3", "import apsw", "apsw_con = apsw.Connection(\":memory:\")", "apsw_con.createscalarfunction(\"times_two\", lambda x: 2*x, 1)", "con = sqlite3.connect(apsw_con)", "result = con.execute(\"select times_two(15)\").fetchone()[0]", "con.close()" ]
from pysqlite2 import dbapi2 as sqlite3 import datetime, time def adapt_datetime(ts): return time.mktime(ts.timetuple()) sqlite3.register_adapter(datetime.datetime, adapt_datetime) con = sqlite3.connect(":memory:") cur = con.cursor() now = datetime.datetime.now() cur.execute("select ?", (now,)) print cur.fetcho...
[ [ 1, 0, 0.0714, 0.0714, 0, 0.66, 0, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 1, 0, 0.1429, 0.0714, 0, 0.66, 0.125, 426, 0, 2, 0, 0, 426, 0, 0 ], [ 2, 0, 0.3214, 0.1429, 0, 0...
[ "from pysqlite2 import dbapi2 as sqlite3", "import datetime, time", "def adapt_datetime(ts):\n return time.mktime(ts.timetuple())", " return time.mktime(ts.timetuple())", "sqlite3.register_adapter(datetime.datetime, adapt_datetime)", "con = sqlite3.connect(\":memory:\")", "cur = con.cursor()", "...
# Author: Paul Kippes <kippesp@gmail.com> import unittest from pysqlite2 import dbapi2 as sqlite class DumpTests(unittest.TestCase): def setUp(self): self.cx = sqlite.connect(":memory:") self.cu = self.cx.cursor() def tearDown(self): self.cx.close() def CheckTableDump(self): ...
[ [ 1, 0, 0.0577, 0.0192, 0, 0.66, 0, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0769, 0.0192, 0, 0.66, 0.2, 987, 0, 1, 0, 0, 987, 0, 0 ], [ 3, 0, 0.4615, 0.7115, 0, 0.66,...
[ "import unittest", "from pysqlite2 import dbapi2 as sqlite", "class DumpTests(unittest.TestCase):\n def setUp(self):\n self.cx = sqlite.connect(\":memory:\")\n self.cu = self.cx.cursor()\n\n def tearDown(self):\n self.cx.close()", " def setUp(self):\n self.cx = sqlite.conn...
# Mimic the sqlite3 console shell's .dump command # Author: Paul Kippes <kippesp@gmail.com> def _iterdump(connection): """ Returns an iterator to the dump of the database in an SQL text format. Used to produce an SQL dump of the database. Useful to save an in-memory database for later restoration. T...
[ [ 2, 0, 0.5317, 0.9524, 0, 0.66, 0, 339, 0, 1, 0, 0, 0, 0, 11 ], [ 8, 1, 0.127, 0.1111, 1, 0.84, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 1, 0.2063, 0.0159, 1, 0.84, ...
[ "def _iterdump(connection):\n \"\"\"\n Returns an iterator to the dump of the database in an SQL text format.\n\n Used to produce an SQL dump of the database. Useful to save an in-memory\n database for later restoration. This function should not be called\n directly but instead called from the Conn...
#coding:utf8 from bottle import route, run, debug, template, request, validate, error, response, redirect from y_common import * from weibopy.auth import WebOAuthHandler from weibopy import oauth @route('/login') def login(): redirect('/sina/login') @route('/sina/login') def sina_login(): auth = WebOAuthH...
[ [ 1, 0, 0.087, 0.0435, 0, 0.66, 0, 591, 0, 9, 0, 0, 591, 0, 0 ], [ 1, 0, 0.1304, 0.0435, 0, 0.66, 0.1667, 64, 0, 1, 0, 0, 64, 0, 0 ], [ 1, 0, 0.1739, 0.0435, 0, 0.6...
[ "from bottle import route, run, debug, template, request, validate, error, response, redirect", "from y_common import *", "from weibopy.auth import WebOAuthHandler", "from weibopy import oauth", "def login():\n redirect('/sina/login')", " redirect('/sina/login')", "def sina_login():\n auth = We...
from bottle import route, run, debug, template, request, validate, error, response, redirect @route('/apply/sent') @route('/apply/sent/show') def apply_sent_show(): return template('home') @route('/apply/sent/add/:tweet_id') def apply_sent_add(tweet_id): return template('home') @route('/apply/sent/exist/...
[ [ 1, 0, 0.0455, 0.0455, 0, 0.66, 0, 591, 0, 9, 0, 0, 591, 0, 0 ], [ 2, 0, 0.25, 0.0909, 0, 0.66, 0.2, 409, 0, 0, 1, 0, 0, 0, 3 ], [ 13, 1, 0.2727, 0.0455, 1, 0.31, ...
[ "from bottle import route, run, debug, template, request, validate, error, response, redirect", "def apply_sent_show():\n return template('home')", " return template('home')", "def apply_sent_add(tweet_id):\n return template('home')", " return template('home')", "def apply_sent_exist(tweet_id)...
from bottle import route, run, debug, template, request, validate, error, response, redirect @route('/') @route('/home') def home(): return template('home') #return 'Ybole - Python backend ... Coming soon!'
[ [ 1, 0, 0.1429, 0.1429, 0, 0.66, 0, 591, 0, 9, 0, 0, 591, 0, 0 ], [ 2, 0, 0.7857, 0.2857, 0, 0.66, 1, 475, 0, 0, 1, 0, 0, 0, 3 ], [ 13, 1, 0.8571, 0.1429, 1, 0.92, ...
[ "from bottle import route, run, debug, template, request, validate, error, response, redirect", "def home():\n return template('home')", " return template('home')" ]
from bottle import route, run, debug, template, request, validate, error, response, redirect @route('/admin/') def admin(): return template("home") @route('/admin/tag') def admin_tag(): return template("home") @route('/admin/tag/edit') def admin_tag(): return template("home")
[ [ 1, 0, 0.0769, 0.0769, 0, 0.66, 0, 591, 0, 9, 0, 0, 591, 0, 0 ], [ 2, 0, 0.3462, 0.1538, 0, 0.66, 0.3333, 426, 0, 0, 1, 0, 0, 0, 2 ], [ 13, 1, 0.3846, 0.0769, 1, 0...
[ "from bottle import route, run, debug, template, request, validate, error, response, redirect", "def admin():\n return template(\"home\")", " return template(\"home\")", "def admin_tag():\n return template(\"home\")", " return template(\"home\")", "def admin_tag():\n return template(\"home\...
import re, base64, json baseurl = "http://www.ybole.com:81" gng_secret = "HUSTGNGisVeryGelivable" sina_consumer_key= "961495784" sina_consumer_secret ="47d9d806a1dc04cc758be6f7213465bc" def htmlEncode(str): """ Returns the HTML encoded version of the given string. This is useful to display a plain ASCII...
[ [ 1, 0, 0.04, 0.04, 0, 0.66, 0, 540, 0, 3, 0, 0, 540, 0, 0 ], [ 14, 0, 0.12, 0.04, 0, 0.66, 0.1667, 660, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.2, 0.04, 0, 0.66, 0.3...
[ "import re, base64, json", "baseurl = \"http://www.ybole.com:81\"", "gng_secret = \"HUSTGNGisVeryGelivable\"", "sina_consumer_key= \"961495784\"", "sina_consumer_secret =\"47d9d806a1dc04cc758be6f7213465bc\"", "def htmlEncode(str):\n \"\"\" Returns the HTML encoded version of the given string. This is u...
# Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. class WeibopError(Exception): """Weibopy exception""" def __init__(self, reason): try: self.reason = reason.encode('utf-8') except: self.reason = reason def __str__(self): return self.reason...
[ [ 3, 0, 0.625, 0.6875, 0, 0.66, 0, 305, 0, 2, 0, 0, 645, 0, 1 ], [ 8, 1, 0.375, 0.0625, 1, 0.81, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 2, 1, 0.625, 0.3125, 1, 0.81, 0....
[ "class WeibopError(Exception):\n \"\"\"Weibopy exception\"\"\"\n\n def __init__(self, reason):\n try:\n self.reason = reason.encode('utf-8')\n except:\n self.reason = reason", " \"\"\"Weibopy exception\"\"\"", " def __init__(self, reason):\n try:\n ...
# Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. from weibopy.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 query.""" class Model(object): def _...
[ [ 1, 0, 0.0155, 0.0056, 0, 0.66, 0, 478, 0, 5, 0, 0, 478, 0, 0 ], [ 3, 0, 0.0239, 0.0056, 0, 0.66, 0.0667, 885, 0, 0, 0, 0, 430, 0, 0 ], [ 8, 1, 0.0254, 0.0028, 1, ...
[ "from weibopy.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 holds results from a Twitter API query.\"\"\...
""" 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.0352, 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.0398, 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", ...
# Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. """ weibo API library """ __version__ = '1.5' __author__ = 'Joshua Roesslein' __license__ = 'MIT' from weibopy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, IDSModel from weibopy.error import WeibopErr...
[ [ 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, ...
[ "\"\"\"\nweibo API library\n\"\"\"", "__version__ = '1.5'", "__author__ = 'Joshua Roesslein'", "__license__ = 'MIT'", "from weibopy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, IDSModel", "from weibopy.error import WeibopError", "from weibopy.api import...