code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env python
import os,sys, logging, socket
import subprocess
import string
from exceptions import Exception
from threading import Thread
from optparse import OptionParser
from subprocess import Popen, PIPE, STDOUT
import re
import glob
sys.stderr=sys.stdout
arff_head_s=('''@RELATION <netmate>
@ATTRIBUTE ... | Python |
#!/usr/bin/env python
import os,sys,logging
import string
from exceptions import Exception
from optparse import OptionParser
import re
import glob
import yaml
arff_head_s=('''@RELATION <netmate>
@ATTRIBUTE srcip STRING
@ATTRIBUTE srcport NUMERIC
@ATTRIBUTE dstip STRING
@ATTRIBUTE dstport NUMERIC
@ATTRIBUTE proto NUM... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A pure Python GlobalConfig implementation. Copyright (c) 2010, flk3y """
__version__ = '0.1'
import os
import sys
GlobalConfig = {'xmlfilename':"test.xml",
'pcapfilename':"test.pcap",
'outputpathname':"outputdir",
'appn... | Python |
env = Environment()
env.Append( CPPPATH=['agent/','front/','network/','thread', 'connection'])
myfile = env.Command( ['network/com.pb.cc', 'network/com.pb.h'], 'com.proto', 'cd ./$SOURCE.dir && protoc --cpp_out=network/ $SOURCE.file')
print myfile
#NetworkLib = env.StaticLibrary("Network",['network/com.pb.cc'], myfi... | Python |
SConscript('SConscript', variant_dir='build')
| Python |
#!/usr/bin/env python
# Copyright (c) 2008 Qtrac Ltd. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of the License, or
# version 3 of the Licens... | Python |
#!/usr/bin/env python
# Copyright (c) 2008 Qtrac Ltd. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of the License, or
# version 3 of the Licens... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 flykeysky<at>gmail.com. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of t... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 flykeysky<at>gmail.com. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of th... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 flykeysky<at>gmail.com. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of t... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 flykeysky<at>gmail.com. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of th... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 flykeysky<at>gmail.com. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of t... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 flykeysky<at>gmail.com. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of t... | Python |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'configwizardui.ui'
#
# Created: Tue Jan 25 06:46:08 2011
# by: PyQt4 UI code generator 4.7.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_ConfigWizard(object):
def setupUi(self,... | Python |
PROGRAM_NAME = 'Flyback'
PROGRAM_VERSION = '0.6.5'
DEFAULT_PREFERENCES = {
'exclude_audio': True,
'exclude_video': True,
'exclude_trash': True,
'exclude_cache': True,
'exclude_vms': True,
'exclude_iso': True,
'exclude_filesize': 1,
}
if __name__=='__main__':
print PROGRAM_VERSION
| Python |
import gnome, gobject, gtk, gtk.glade, os, sys, threading
import backup
import create_backup_gui
import manage_backup_gui
import settings
import util
def echo(*args):
print 'echo', args
class GUI(object):
def close(self, a=None, b=None):
self.main_window.hide()
self.unregister_gui(self)
def op... | Python |
import datetime, gnome, gobject, gtk, gtk.glade, os, sys, tempfile, threading, time
import backup
import settings
import util
def echo(*args):
print 'echo', args
class GUI(object):
def close(self, a=None, b=None):
self.main_window.hide()
self.unregister_gui(self)
def update_revisions(self):
... | Python |
from __future__ import division
import datetime, os, sys, threading, time
# fix for python <2.6
if not hasattr(threading.Thread, "is_alive"):
threading.Thread.is_alive = threading.Thread.isAlive
RUN_FROM_DIR = os.path.abspath(os.path.dirname(sys.argv[0]))
def pango_escape(message):
if message is None:
retur... | Python |
import gnome, gobject, gtk, gtk.glade, os, sys, tempfile, threading
import backup
import settings
import util
class GUI(object):
def close(self, a=None, b=None):
self.main_window.hide()
self.unregister_gui(self)
def save(self, a=None):
preferences = {
'exclude_audio': self.xml.get_widget('c... | Python |
import gnome, gobject, gtk, gtk.glade, os, sys
import backup
import manage_backup_gui
import settings
import util
print util.RUN_FROM_DIR
def echo(*args):
print 'echo', args
class GUI(object):
def close(self, a=None, b=None):
self.main_window.hide()
self.unregister_gui(self)
def init_backup(self... | Python |
import datetime, os, pickle, sys, tempfile, traceback
import uuid as uuidlib
import settings
import util
UUID_GVFS = uuidlib.uuid5(uuidlib.NAMESPACE_DNS, 'gvfs.flyback.org')
def get_known_backups():
backups = []
for uuid in get_all_devices():
path = get_mount_point_for_uuid(uuid)
if path:
fbdbs = [... | Python |
#!/usr/bin/python
import os, sys, traceback
import settings
import backup
GUIS = set()
def register_gui(gui):
GUIS.add( gui )
def unregister_gui(gui):
GUIS.discard(gui)
if not GUIS:
import gtk
gtk.main_quit()
def run_all_backups():
for t in backup.get_known_backups():
uuid = t['uuid']
h... | Python |
import gnome, gobject, gtk, gtk.glade, os, sys, tempfile, threading
import settings
import util
class GUI(object):
def close(self, a=None, b=None):
self.main_window.hide()
self.unregister_gui(self)
def set_files(self, added, modified, deleted):
print added, modified, deleted
model = self.xml.ge... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
import subprocess
import os
import sys
from webbrowser import _iscommand as is_command
import gtk
import mimetypes, mimetools
import config
import locale
import ctypes
try: import i18n
except: from gettext import gette... | Python |
#!/usr/bin/env python
# -*- coding:utf8 -*-
import json
import config
import time
import base64
import urllib, urllib2
import gtk
import threading
import gobject
import utils
import hotot
import os
import sys
import subprocess
try: import i18n
except: from gettext import gettext as _
reload(sys)
sys.setdefaultencodi... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
import glib
import gtk
import pango
import os
from xml.sax.saxutils import escape
queue = list()
actual_notification = None
def gtknotification(title, text, icon_file=None, const=None, callback=None, tooltip=None):
... | Python |
#!/usr/bin/env python
# -*- coding:utf8 -*-
'''Hotot
@author: U{Shellex Wei <5h3ll3x@gmail.com>}
@license: LGPLv3+
'''
import gtk
import gobject
import view
import config
import agent
import keybinder
import utils
try:
import appindicator
except ImportError:
HAS_INDICATOR = False
else:
HAS_INDICATOR = True... | Python |
#!/usr/bin/env python
# -*- coding:utf8 -*-
import gtk
gtk.gdk.threads_init() ## fix issue 24
import webkit
import agent
import config
from webkit import WebView
import utils
import json
import gobject
try: import i18n
except: from gettext import gettext as _
class MainView(WebView):
def __init__(self):
W... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# Author: Huang Jiahua <jhuangjiahua@gmail.com>
# License: LGPLv3+
# Last modified:
app = 'hotot'
import os, sys
import gettext
import json
import re
if os.path.isdir(os.path.dirname(sys.argv[0]) + '/../build/mo'):
... | Python |
# -*- coding: UTF-8 -*-
import os
import pickle
import json
import gtk
import sys
import glob
import shutil
import glib
PROGRAM_NAME = 'hotot'
EXT_DIR_NAME = 'ext'
CONF_DIR = os.path.join(glib.get_user_config_dir(), PROGRAM_NAME)
DB_DIR = os.path.join(CONF_DIR, 'db')
CACHE_DIR = os.path.join(glib.get_user_cache_dir()... | Python |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# Author: Shellex Wai <5h3ll3x@gmail.com>
# License: GNU LGPL
# Last modified:
"""
"""
__revision__ = '0.1'
if __name__=="__main__":
import hotot.hotot
hotot.hotot.main()
| Python |
#!/usr/bin/env python
# -*- coding:utf8 -*-
from distutils.core import setup
from DistUtilsExtra.command import *
from glob import glob
import os, os.path
def get_data_files(root, data_dir):
return [
(root + parent[len(data_dir):], [ os.path.join(parent, fn) for fn in files ])
for pare... | Python |
#!/usr/bin/env python
# -*- coding:utf8 -*-
import re
import json
import os.path
TEMPLATE = "data/index.html"
DEFAULT_LOCALE_FILE = 'data/_locales/en/messages.json'
JS_FILE_DIR = ['data/js/']
LOCALE_FILE_DIR = 'data/_locales/'
template_tag_re = re.compile('data-i18n-[a-z0-9]+="(.+?)"')
js_tag_re = re.compile('''... | Python |
class MainPage(webapp.RequestHandler):
def get(self):
# choice which days to view
startdate = self.request.get("startdate")
enddate = self.request.get("enddate")
if startdate == None or startdate == '' or not matchdateformat(startdate):
startdate = date.today()
el... | Python |
# -*- coding: utf-8 -*-
import logging
from datetime import date
import datetime
import time
import re
import os
import hashlib
from google.appengine.ext.webapp import template
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.... | Python |
'''
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the ... | Python |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
... | Python |
import Cookie
import os
from common.appengine_utilities import sessions
class SessionMiddleware(object):
TEST_COOKIE_NAME = 'testcookie'
TEST_COOKIE_VALUE = 'worked'
def process_request(self, request):
"""
Check to see if a valid session token exists, if not,
then use a cookie on... | Python |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... | Python |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... | Python |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... | Python |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... | Python |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
... | Python |
import e32dbm
DB_FILE = u"E:\\flyingonwheel.db"
def write_db():
db = e32dbm.open(DB_FILE, "cf")
db[u"name"] = u"musli"
db[u"password"] = u"my secret"
db.close()
def read_db():
db = e32dbm.open(DB_FILE, "r")
name = db[u"name"]
password = db[u"passwo... | Python |
import e32
import appuifw
import dir_iter
import pyS60uiutil
import os
import os.path
import sys
import re
import socket
class pyFileManagerS60:
"""
File Manager written in Python for S60 phones.
Can be used as a standalone application or as a part of another program.
"""
def __init__(self, title=... | Python |
#= pyS60uiutil.py - a collection of miscellaneous UI dialogs and utility
#= functions for PyS60.
#= Copyright (C) 2005 - 2006 Lasse Huovinen
#=
#= This library is free software; you can redistribute it and/or
#= modify it under the terms of the GNU Lesser General Public
#= License as published by the F... | Python |
#=
#= default.py for pyFileManagerS60
#=
#= Do not change. This id has been officially allocated from Symbian.
# SYMBIAN_UID=0x10279730
import sys
import os.path
import appuifw
if __name__ == '__main__':
#=
#= Run as a main program.
#= Force importing from the local directory first.
#=
localpath ... | Python |
# Simple BT App
#$GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598, ,*10
import socket, location, urllib
class BTReader:
def connect(self):
self.sock = socket.socket(socket.AF_BT, socket.SOCK_STREAM)
address, services = socket.bt_discover()
print "Discovered: %s, %s"... | Python |
#!/usr/bin/python
####
# 02/2006 Will Holcomb <wholcomb@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later v... | Python |
import MultipartPostHandler, urllib2, cookielib
latitude = str('23.34')
longitude = str('34.45')
file = 'logo.jpg'
cookies = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies), MultipartPostHandler.MultipartPostHandler)
params = { 'point': '%s, %s' % (latitude, longitude)... | Python |
#!/usr/bin/python
####
# 02/2006 Will Holcomb <wholcomb@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later v... | Python |
import httplib, mimetypes
def post_multipart(host, selector, fields, files):
"""
Post fields and files to an http host as multipart/form-data.
fields is a sequence of (name, value) elements for regular form fields.
files is a sequence of (name, filename, value) elements for data to be uploaded as files... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#Author: alvayang <alvayang@tabex.org>
#Last Change:
#Description:
import positioning
import appuifw
import sys
import e32
import time
def writelog(data):
if data:
try:
file('E:\\gpslog.log', 'a').write('%s|%s|%s\n' % \
(str(time.ti... | Python |
# -*- coding: utf-8 -*-
import appuifw, e32, graphics, os
def cn(x):
return x.decode("utf-8")
appuifw.app.body = canvas = appuifw.Canvas()
appuifw.app.screen="full"
font=('normal', 15, graphics.FONT_BOLD)
img=graphics.Image.new((240, 320))
img.rectangle((8, 90, 230, 110), 0xFF6347, 0x316ac5)
img.te... | Python |
# -*- coding: utf-8 -*-
"""
test text show on graphics of pys60
"""
import appuifw, graphics, e32
appuifw.app.screen = 'full'
canvas = appuifw.Canvas() # create a canvas
image = graphics.Image.new(canvas.size) # create an image
appuifw.app.body = canvas
appuifw.app.exit_key_handler = q... | Python |
#! -*- coding: utf-8 -*-
"""
test graph menu
"""
import appuifw, time, audio, os
from graphics import *
import e32, topwindow
appuifw.app.screen="full"
img = Image.new((240, 320))
img.clear(0xFAEBD7)
appuifw.app.body = canvas = appuifw.Canvas()
def cn(x):
return x.decode("utf-8")
font=('n... | Python |
import e32, camera, appuifw, key_codes
from graphics import Image
def viewfinder(img):
canvas.blit(img)
def shoot():
camera.stop_finder()
photo = camera.take_photo(size = (640, 480))
w, h = canvas.size
canvas.blit(photo, target = (0, 0, w, h), scale = 1)
photo.resize((320, 240))
... | Python |
# -*- coding: utf-8 -*-
"""
a graph login frame
"""
import graphics, e32, appuifw
font = ('normal', 15, graphics.FONT_BOLD)
appuifw.app.body = canvas = appuifw.Canvas()
appuifw.app.screen = "full"
def cn(x):
return x.decode("utf-8")
img = graphics.Image.new(canvas.size)
img.clear(0)
img.... | Python |
# -*- coding: utf-8 -*-
"""
persion walk
"""
import appuifw, graphics, e32
def cn(x):
return x.decode("utf-8")
font=('normal', 15, graphics.FONT_BOLD)
appuifw.app.body = canvas = appuifw.Canvas()
appuifw.app.screen = "full"
img = graphics.Image.new(canvas.size)
img.clear(0)
man = graphics.Im... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#Author: iamsk <skxiaonan@gmail.com>
#Last Change: 2010-04-04
#Description: mark current position and post it to flyingonwheel.appspot.com
#Notice: your phone must have the 'Location' (GPS data /position) application on,
#and receive satalite data in order to make th... | Python |
#-*- coding: utf-8 -*-
# 测试中文
####
# 02/2006 Will Holcomb <wholcomb@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) ... | Python |
#-*- coding: utf-8 -*-
#Author: iamsk <skxiaonan@gmail.com>
#Last Change: 2010-05-16
#Description: mark current position and post it to flyingonwheel.appspot.com
#Notice: your phone must have the 'Location' (GPS data /position) application on,
#and receive satalite data in order to make this script work. (can be ... | Python |
# -*- coding: utf-8 -*-
import appuifw
import e32
import graphics
import thread
import time
class Main:
def __init__(self):
appuifw.app.title = u'Fibonacci'
appuifw.app.body = self.canvas = appuifw.Canvas()
appuifw.exit_key_handler = self.OnExit
appuifw.app.menu = [(... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#Author: alvayang <alvayang@tabex.org>
#Last Change:
#Description:
import positioning
import appuifw
import sys
import e32
import time
def writelog(data):
if data:
try:
file('E:\\gpslog.log', 'a').write('%s|%s|%s\n' % \
(str(time.ti... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#Author: iamsk <skxiaonan@gmail.com>
#Last Change: 2010-04-04
#Description: mark current position and post it to flyingonwheel.appspot.com
#Notice: your phone must have the 'Location' (GPS data /position) application on,
#and receive satalite data in order to make th... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#Author: iamsk <skxiaonan@gmail.com>
#Last Change: 2010-04-04
#Description: mark current position and post it to flyingonwheel.appspot.com
#Notice: your phone must have the 'Location' (GPS data /position) application on,
#and receive satalite data in order to make th... | Python |
# Copyright (c) 2006 Jurgen Scheible
# image upload to URL
import httplib
def upload_image_to_url():
filename = 'D:\logo.jpg'
picture = file(filename).read()
conn = httplib.HTTPConnection("www.mobilenin.com")
conn.request("POST", "/pys60/php/upload_image_to_url.php", picture)
p... | Python |
"""Streaming HTTP uploads module.
This module extends the standard httplib and urllib2 objects so that
iterable objects can be used in the body of HTTP requests.
In most cases all one should have to do is call :func:`register_openers()`
to register the new streaming http handlers which will take priority over
the def... | Python |
"""multipart/form-data encoding module
This module provides functions that faciliate encoding name/value pairs
as multipart/form-data suitable for a HTTP POST or PUT request.
multipart/form-data is the standard way to upload files over HTTP"""
__all__ = ['gen_boundary', 'encode_and_quote', 'MultipartParam',
... | Python |
# Copyright (c) 2010 Chris AtLee
#
# 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, publish, distri... | Python |
import time
import threading
class timer(threading.Thread):
def __init__(self, interval):
threading.Thread.__init__(self)
self.interval = interval
def run(self):
print 'berfore'
time.sleep(self.interval)
print 'after'
def test():
threa... | Python |
########################################################
# Send an SMS with your current GPS co-ordinates using a
# Nokia SmartPhoneand PyS60
# Timothy Makobu, 01-01-2009
########################################################
import positioning
import messaging
import appuifw
import sys
# Get your GPS co... | Python |
import appuifw
import e32
import graphics
import thread
import time
class Main:
def __init__(self):
appuifw.app.title = u'Positioning'
appuifw.app.body = self.canvas = appuifw.Canvas()
appuifw.exit_key_handler = self.OnExit
appuifw.app.menu = [(u'Calcola', self.OnCalc... | Python |
# Copyright (c) 2006 Jurgen Scheible
# this script lets you upload an XML file to a server.
# use both the httplib, urllib libraries
import httplib, urllib
import appuifw
def senddata():
# read the xml file from the c drive and put it into a variable called xmlfile
f=open('c:/xml_btscan.xml','rt')
... | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#Author: iamsk <skxiaonan@gmail.com>
#Last Change: 2010-04-04
#Description: mark current position and post it to flyingonwheel.appspot.com
#Notice: your phone must have the 'Location' (GPS data /position) application on,
#and receive satalite data in order to make th... | Python |
# Quickfix for the missing module in the Google App Engine using Python 2.6.
#
# Koen Bollen <meneer koenbollen nl>
# 2009 GPL
import multiprocessing
# vim: expandtab shiftwidth=4 softtabstop=4 textwidth=79:
| Python |
#!/usr/bin/python
import sys, os, re, platform
from os.path import exists, abspath, dirname, join, isdir
try:
# Allow use of setuptools so eggs can be built.
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
from distutils.extension import Extension
from ... | Python |
import os, sys, platform
from os.path import join, dirname, abspath, basename
import unittest
def add_to_path():
"""
Prepends the build directory to the path so that newly built pyodbc libraries are used, allowing it to be tested
without installing it.
"""
# Put the build directory into ... | Python |
#!/usr/bin/python
# Unit tests for PostgreSQL on Linux (Fedora)
# This is a stripped down copy of the SQL Server tests.
import sys, os, re
import unittest
from decimal import Decimal
from testutils import *
_TESTSTR = '0123456789-abcdefghijklmnopqrstuvwxyz-'
def _generate_test_string(length):
"""
Returns a ... | Python |
#!/usr/bin/python
# Tests for reading from Excel files.
#
# I have not been able to successfully create or modify Excel files.
import sys, os, re
import unittest
from os.path import abspath
from testutils import *
CNXNSTRING = None
class ExcelTestCase(unittest.TestCase):
def __init__(self, method_name):
... | Python |
#!/usr/bin/env python
''' Python DB API 2.0 driver compliance unit test suite.
This software is Public Domain and may be used without restrictions.
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time I read... | Python |
from testutils import *
add_to_path()
import pyodbc
cnxn = pyodbc.connect("DRIVER={SQL Server Native Client 10.0};SERVER=localhost;DATABASE=test;Trusted_Connection=yes")
print('cnxn:', cnxn)
cursor = cnxn.cursor()
print('cursor:', cursor)
cursor.execute("select 1")
row = cursor.fetchone()
print('row:... | Python |
import unittest
from testutils import *
import dbapi20
def main():
add_to_path()
import pyodbc
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog [options] connection_string")
parser.add_option("-v", "--verbose", action="count", help="Increment test verbosity (... | Python |
import unittest
_TESTSTR = '0123456789-abcdefghijklmnopqrstuvwxyz-'
def _generate_test_string(length):
"""
Returns a string of `length` characters, constructed by repeating _TESTSTR as necessary.
To enhance performance, there are 3 ways data is read, based on the length of the value, so most da... | Python |
#!/usr/bin/python
# -*- coding: latin-1 -*-
usage = """\
usage: %prog [options] connection_string
Unit tests for SQL Server. To use, pass a connection string as the parameter.
The tests will create and drop tables t1 and t2 as necessary.
These run using the version from the 'build' directory, not the version
instal... | Python |
#!/usr/bin/python
usage="""\
usage: %prog [options] filename
Unit tests for Microsoft Access
These run using the version from the 'build' directory, not the version
installed into the Python directories. You must run python setup.py build
before running the tests.
To run, pass the filename of an Access database on... | Python |
import os, sys, platform
from os.path import join, dirname, abspath, basename
import unittest
def add_to_path():
"""
Prepends the build directory to the path so that newly built pyodbc libraries are used, allowing it to be tested
without installing it.
"""
# Put the build directory into ... | Python |
#!/usr/bin/python
# Unit tests for PostgreSQL on Linux (Fedora)
# This is a stripped down copy of the SQL Server tests.
import sys, os, re
import unittest
from decimal import Decimal
from testutils import *
_TESTSTR = '0123456789-abcdefghijklmnopqrstuvwxyz-'
def _generate_test_string(length):
"""
Returns a ... | Python |
#!/usr/bin/python
# Tests for reading from Excel files.
#
# I have not been able to successfully create or modify Excel files.
import sys, os, re
import unittest
from os.path import abspath
from testutils import *
CNXNSTRING = None
class ExcelTestCase(unittest.TestCase):
def __init__(self, method_name):
... | Python |
#!/usr/bin/env python
''' Python DB API 2.0 driver compliance unit test suite.
This software is Public Domain and may be used without restrictions.
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time I read... | Python |
#!/usr/bin/env python
from testutils import *
add_to_path()
import pyodbc
def main():
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-v", "--verbose", action="count", help="Increment test verbosity (can be used multiple times)")
parser.add_option("-d", "--debug", action=... | Python |
import unittest
from testutils import *
import dbapi20
def main():
add_to_path()
import pyodbc
from optparse import OptionParser
parser = OptionParser(usage="usage: %prog [options] connection_string")
parser.add_option("-v", "--verbose", action="count", help="Increment test verbosity (... | Python |
import unittest
_TESTSTR = '0123456789-abcdefghijklmnopqrstuvwxyz-'
def _generate_test_string(length):
"""
Returns a string of `length` characters, constructed by repeating _TESTSTR as necessary.
To enhance performance, there are 3 ways data is read, based on the length of the value, so most da... | Python |
#!/usr/bin/python
usage="""\
usage: %prog [options] filename
Unit tests for Microsoft Access
These run using the version from the 'build' directory, not the version
installed into the Python directories. You must run python setup.py build
before running the tests.
To run, pass the filename of an Access database on... | Python |
# Django settings for cms project.
import os
import sys
ROOT = os.path.abspath(os.path.dirname(__file__))
path = lambda *args: os.path.join(ROOT, *args)
sys.path.insert(0, path("lib"))
sys.path.insert(0, path("plugins"))
#USER SETTINGS (LATER TAKE FROM DATABASE)
LANGUAGES = (
('en', 'English'),
('ru', 'Russian')... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | Python |
from django import forms
class AdminImageWidget(forms.FileInput):
"""
A ImageField Widget for admin that shows a thumbnail.
"""
def __init__(self, attrs={}):
super(AdminImageWidget, self).__init__(attrs)
def render(self, name, value, attrs=None):
output = []
if value and h... | Python |
from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^cms/', include('cms.foo.urls'... | Python |
from django.conf import settings
def setting(request):
setting = {
'TEMPLATE_DIR': settings.TEMPLATE_DIR,
'CURRENT_TEMPLATE': settings.CURRENT_TEMPLATE,
'STATIC_DIR': settings.STATIC_DIR,
'STATIC_URL': settings.STATIC_URL,
'MEDIA_ROOT': settings.MEDIA_ROOT,
'ADMIN_ME... | Python |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.