rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
inc_dir = os.curdir
inc_dir = argv0_path
def get_config_h_filename(): """Return full pathname of installed pyconfig.h file.""" if python_build: inc_dir = os.curdir else: inc_dir = get_python_inc(plat_specific=1) if get_python_version() < '2.2': config_h = 'config.h' else: # The name of the config.h file changed in 2.2 config_h = 'pyconfig.h' return os.path.jo...
dfde91a79e235e2e1ca121d6164dd1818cbba395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dfde91a79e235e2e1ca121d6164dd1818cbba395/sysconfig.py
return 'pwpc'
return 'pwpc', 1
def interact(scriptname): if PPC_ONLY: return 'pwpc' d = Dlg.GetNewDialog(DLG_ID, -1) if not d: print "Can't get DLOG resource with id =", DLG_ID return d.SetDialogDefaultItem(OK_BUTTON) d.SetDialogCancelItem(CANCEL_BUTTON) Dlg.ParamText(scriptname, "", "", "") radiogroup = radio(d, GENFAT_BUTTON, GENPPC_BUTTON, GEN68...
f0d750803dc78ea6fefed17de4fd785e80fb66b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f0d750803dc78ea6fefed17de4fd785e80fb66b5/BuildApplication.py
print "Can't get DLOG resource with id =", DLG_ID return
raise "Can't get DLOG resource with id =", DLG_ID
def interact(scriptname): if PPC_ONLY: return 'pwpc' d = Dlg.GetNewDialog(DLG_ID, -1) if not d: print "Can't get DLOG resource with id =", DLG_ID return d.SetDialogDefaultItem(OK_BUTTON) d.SetDialogCancelItem(CANCEL_BUTTON) Dlg.ParamText(scriptname, "", "", "") radiogroup = radio(d, GENFAT_BUTTON, GENPPC_BUTTON, GEN68...
f0d750803dc78ea6fefed17de4fd785e80fb66b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f0d750803dc78ea6fefed17de4fd785e80fb66b5/BuildApplication.py
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX' ]
self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX' , '/DNDEBUG']
def __init__ (self, verbose=0, dry_run=0, force=0):
2683ac755d5fcb164926bdb2bc320dcb33bb58b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2683ac755d5fcb164926bdb2bc320dcb33bb58b0/msvccompiler.py
def _read(self, size=1024): if self.fileobj is None: raise EOFError, "Reached EOF"
41616ee194e65b23fa508326d7b3788f2d63f362 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/41616ee194e65b23fa508326d7b3788f2d63f362/gzip.py
def readline(self):
def readline(self, size=-1): if size < 0: size = sys.maxint
def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2
41616ee194e65b23fa508326d7b3788f2d63f362 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/41616ee194e65b23fa508326d7b3788f2d63f362/gzip.py
readsize = 100
orig_size = size readsize = min(100, size)
def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2
41616ee194e65b23fa508326d7b3788f2d63f362 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/41616ee194e65b23fa508326d7b3788f2d63f362/gzip.py
bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '')
bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '')
def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2
41616ee194e65b23fa508326d7b3788f2d63f362 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/41616ee194e65b23fa508326d7b3788f2d63f362/gzip.py
readsize = readsize * 2 def readlines(self, ignored=None): buf = self.read() lines = string.split(buf, '\n') for i in range(len(lines)-1): lines[i] = lines[i] + '\n' if lines and not lines[-1]: del lines[-1] return lines
size = size - len(c) readsize = min(size, readsize * 2) def readlines(self, sizehint=0): if sizehint <= 0: sizehint = sys.maxint L = [] while sizehint > 0: line = self.readline() if line == "": break L.append( line ) sizehint = sizehint - len(line) return L
def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2
41616ee194e65b23fa508326d7b3788f2d63f362 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/41616ee194e65b23fa508326d7b3788f2d63f362/gzip.py
if proxy_auth: h.putheader('Proxy-Authorization: Basic %s' % proxy_auth) if auth: h.putheader('Authorization: Basic %s' % auth)
if proxy_auth: h.putheader('Proxy-Authorization', 'Basic %s' % proxy_auth) if auth: h.putheader('Authorization', 'Basic %s' % auth)
def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None proxy_passwd = None if isinstance(url, str): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url # here, we determine, whether the pr...
522785732f09b0be6d4bc06a2782ecda66fc83af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/522785732f09b0be6d4bc06a2782ecda66fc83af/urllib.py
out.write("
out.write("
typedef struct
a4657f736c34e4bb1802b40246028c5bec545fe6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a4657f736c34e4bb1802b40246028c5bec545fe6/GenUCNHash.py
import linecache
def formatwarning(message, category, filename, lineno): """Function to format a warning the standard way.""" import linecache s = "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message) line = linecache.getline(filename, lineno).strip() if line: s = s + " " + line + "\n" return s
a43fd0c8996eec2bdd0ec59edc252cb4f4ff4436 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a43fd0c8996eec2bdd0ec59edc252cb4f4ff4436/warnings.py
ValueError if 'pathname' is absolute (starts with '/') or contains local directory separators (unless the local separator is '/', of course).
ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash.
def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local conventio...
4752769d08c3ef950d31b926751d5e4d1dae294f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4752769d08c3ef950d31b926751d5e4d1dae294f/util.py
occurrence of '$' followed by a name, or a name enclosed in braces, is considered a variable. Every variable is substituted by the value found in the 'local_vars' dictionary, or in 'os.environ' if it's not in 'local_vars'. 'os.environ' is first checked/ augmented to guarantee that it contains certain values: see '_ch...
occurrence of '$' followed by a name is considered a variable, and variable is substituted by the value found in the 'local_vars' dictionary, or in 'os.environ' if it's not in 'local_vars'. 'os.environ' is first checked/augmented to guarantee that it contains certain values: see 'check_environ()'. Raise ValueError for...
def subst_vars (str, local_vars): """Perform shell/Perl-style variable substitution on 'string'. Every occurrence of '$' followed by a name, or a name enclosed in braces, is considered a variable. Every variable is substituted by the value found in the 'local_vars' dictionary, or in 'os.environ' if it's not in 'local...
4752769d08c3ef950d31b926751d5e4d1dae294f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4752769d08c3ef950d31b926751d5e4d1dae294f/util.py
return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str)
try: return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str) except KeyError, var: raise ValueError, "invalid variable '$%s'" % var
def _subst (match, local_vars=local_vars): var_name = match.group(1) if local_vars.has_key(var_name): return str(local_vars[var_name]) else: return os.environ[var_name]
4752769d08c3ef950d31b926751d5e4d1dae294f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4752769d08c3ef950d31b926751d5e4d1dae294f/util.py
if os.sep != '/': paths = string.split (pathname, '/') return apply (os.path.join, paths) else: return pathname
paths = string.split(pathname, '/') return apply(os.path.join, paths)
def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local conventio...
7ec053544cf4849a138e70329ffeec1d6ab93e62 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec053544cf4849a138e70329ffeec1d6ab93e62/util.py
if version > 7.0: self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1") else: self.set_macro("FrameworkSDKDir", net, "sdkinstallroot")
try: if version > 7.0: self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1") else: self.set_macro("FrameworkSDKDir", net, "sdkinstallroot") except KeyError, exc: raise DistutilsPlatformError, \ ("The .NET Framework SDK needs to be installed before " "building extensions for Python.")
def load_macros(self, version): vsbase = r"Software\Microsoft\VisualStudio\%0.1f" % version self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir") self.set_macro("VSInstallDir", vsbase + r"\Setup\VS", "productdir") net = r"Software\Microsoft\.NETFramework" self.set_macro("FrameworkDir", net, "installroot")...
cb328f393e9ca0278491a97fad48c225ad9c5484 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cb328f393e9ca0278491a97fad48c225ad9c5484/msvccompiler.py
from UserDict import DictMixin class SeqDict(DictMixin):
class SeqDict(UserDict.DictMixin):
def display(self): print self
e28be5968683241e4a785108a0023fc49ecbb03a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e28be5968683241e4a785108a0023fc49ecbb03a/test_userdict.py
s = SeqDict() s[10] = 'ten' s[20] = 'twenty' s[30] = 'thirty' del s[20] verify(s[10] == 'ten') verify(s.keys() == [10, 30]) verify(s.has_key(10)) verify(not s.has_key(20)) verify(10 in s) verify(20 not in s) verify([k for k in s] == [10, 30]) verify(len(s) == 2) verify(list(s.iteritems()) == [(10,'ten'), (30, 't...
class UserDictMixinTest(unittest.TestCase): def test_all(self): s = SeqDict() s[10] = 'ten' s[20] = 'twenty' s[30] = 'thirty' del s[20] self.assertEqual(s[10], 'ten') self.assertEqual(s.keys(), [10, 30]) self.assert_(s.has_key(10)) self.assert_(not s.has_key(20)) self.assert_(10 in s) self.assert_(20 not ...
def keys(self): return list(self.keylist)
e28be5968683241e4a785108a0023fc49ecbb03a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e28be5968683241e4a785108a0023fc49ecbb03a/test_userdict.py
if node.nodeType==Node.ELEMENT_NODE and self.documentElement: raise TypeError, "Two document elements disallowed" else: self.documentElement=node
if node.nodeType==Node.ELEMENT_NODE: if self.documentElement: raise TypeError, "Two document elements disallowed" else: self.documentElement=node
def appendChild( self, node ): if node.nodeType==Node.ELEMENT_NODE and self.documentElement: raise TypeError, "Two document elements disallowed" else: self.documentElement=node Node.appendChild( self, node ) return node
ce88db02303409ae8b19f8aaf5e540c2f99f47c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ce88db02303409ae8b19f8aaf5e540c2f99f47c1/minidom.py
def cmp(f1, f2, shallow=1, use_statcache=0):
def cmp(f1, f2, shallow=1, use_statcache=None):
def cmp(f1, f2, shallow=1, use_statcache=0): """Compare two files. Arguments: f1 -- First file name f2 -- Second file name shallow -- Just check stat signature (do not read the files). defaults to 1. use_statcache -- obsolete argument. Return value: True if the files are the same, False otherwise. This function...
83e879d99fc855dfca597d222b4c5a372d1611eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83e879d99fc855dfca597d222b4c5a372d1611eb/filecmp.py
def cmpfiles(a, b, common, shallow=1, use_statcache=0):
def cmpfiles(a, b, common, shallow=1, use_statcache=None):
def cmpfiles(a, b, common, shallow=1, use_statcache=0): """Compare common files in two directories. a, b -- directory names common -- list of file names found in both directories shallow -- if true, do comparison based solely on stat() information use_statcache -- obsolete argument Returns a tuple of three lists: fil...
83e879d99fc855dfca597d222b4c5a372d1611eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83e879d99fc855dfca597d222b4c5a372d1611eb/filecmp.py
raise getopt.error, 'need exactly two args'
raise getopt.GetoptError('need exactly two args', None)
def demo(): import sys import getopt options, args = getopt.getopt(sys.argv[1:], 'r') if len(args) != 2: raise getopt.error, 'need exactly two args' dd = dircmp(args[0], args[1]) if ('-r', '') in options: dd.report_full_closure() else: dd.report()
83e879d99fc855dfca597d222b4c5a372d1611eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83e879d99fc855dfca597d222b4c5a372d1611eb/filecmp.py
self.bytebuffer = ""
self.buffer = ""
def reset(self): IncrementalDecoder.reset(self) self.bytebuffer = ""
b17f12bbc6e6fc61e28aaf5d796cd83df1591779 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b17f12bbc6e6fc61e28aaf5d796cd83df1591779/codecs.py
if __debug__: class Foo: version = 1 class Foo: version = 2 class Foo: version = 3 def execfunc(x): exec x in y
def get_namespace(self): """Returns the single namespace bound to this name.
101651c128825a05a7ba7c1c556c90e22bfb86c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/101651c128825a05a7ba7c1c556c90e22bfb86c2/symtable.py
def generate_header(self, structName): header = """
e3f257e6819327e40544315cae2ad838de8ff2e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3f257e6819327e40544315cae2ad838de8ff2e1/perfect_hash.py
""" static PyObject *codec_tuple(PyObject *unicode, int len) { PyObject *v,*w; if (unicode == NULL) return NULL; v = PyTuple_New(2); if (v == NULL) { Py_DECREF(unicode); return NULL; } PyTuple_SET_ITEM(v,0,unicode); w = PyInt_FromLong(len); if (w == NULL) { Py_DECREF(v); return NULL; } PyTuple_SET_ITEM(v,1,w); return...
def generate_hash(keys, caseInsensitive=0, minC=None, initC=None, f1Seed=None, f2Seed=None, cIncrement=None, cTries=None): """Print out code for a perfect minimal hash. Input is a list of (key, desired hash value) tuples. """ # K is the number of keys. K = len(keys) # We will be generating graphs of size N, where N...
e3f257e6819327e40544315cae2ad838de8ff2e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3f257e6819327e40544315cae2ad838de8ff2e1/perfect_hash.py
try: os.mkdir(homeDir) except os.error: pass
try: os.mkdir(homeDir) except os.error: import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file)
def setUp(self): self.filename = self.__class__.__name__ + '.db' homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass self.env = db.DBEnv() self.env.open(homeDir, db.DB_CREATE | db.DB_INIT_MPOOL)
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
try: os.mkdir(homeDir) except os.error: pass
try: os.mkdir(homeDir) except os.error: import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file)
def setUp(self): self.filename = self.__class__.__name__ + '.db' homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass self.env = db.DBEnv() self.env.open(homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_THREAD | self.envFla...
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
secDB = db.DB(self.env) secDB.set_flags(db.DB_DUP) secDB.set_get_returns_none(2) secDB.open(self.filename, "secondary", db.DB_BTREE,
self.secDB = db.DB(self.env) self.secDB.set_flags(db.DB_DUP) self.secDB.set_get_returns_none(2) self.secDB.open(self.filename, "secondary", db.DB_BTREE,
def test01_associateWithDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_associateWithDB..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
self.getDB().associate(secDB, self.getGenre)
self.getDB().associate(self.secDB, self.getGenre)
def test01_associateWithDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_associateWithDB..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
self.finish_test(secDB)
self.finish_test(self.secDB)
def test01_associateWithDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_associateWithDB..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
secDB = db.DB(self.env) secDB.set_flags(db.DB_DUP) secDB.open(self.filename, "secondary", db.DB_BTREE,
self.secDB = db.DB(self.env) self.secDB.set_flags(db.DB_DUP) self.secDB.open(self.filename, "secondary", db.DB_BTREE,
def test02_associateAfterDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test02_associateAfterDB..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
self.getDB().associate(secDB, self.getGenre, db.DB_CREATE) self.finish_test(secDB)
self.getDB().associate(self.secDB, self.getGenre, db.DB_CREATE) self.finish_test(self.secDB)
def test02_associateAfterDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test02_associateAfterDB..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
c = self.getDB().cursor(txn)
self.cur = self.getDB().cursor(txn)
def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
rec = c.first()
rec = self.cur.first()
def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
rec = c.next()
rec = self.cur.next()
def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
c = secDB.cursor(txn)
self.cur = secDB.cursor(txn)
def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
vals = c.pget('Unknown', flags=db.DB_LAST)
vals = self.cur.pget('Unknown', flags=db.DB_LAST)
def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
vals = c.pget('Unknown', data='wrong value', flags=db.DB_GET_BOTH)
vals = self.cur.pget('Unknown', data='wrong value', flags=db.DB_GET_BOTH)
def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
rec = c.first()
rec = self.cur.first()
def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
rec = c.next()
rec = self.cur.next()
def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
def test13_associateAutoCommit(self):
def txn_finish_test(self, sDB, txn): try: self.finish_test(sDB, txn=txn) finally: if self.cur: self.cur.close() self.cur = None if txn: txn.commit() def test13_associate_in_transaction(self):
def test13_associateAutoCommit(self): if verbose: print '\n', '-=' * 30 print "Running %s.test13_associateAutoCommit..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
secDB = db.DB(self.env) secDB.set_flags(db.DB_DUP) secDB.set_get_returns_none(2) secDB.open(self.filename, "secondary", db.DB_BTREE,
self.secDB = db.DB(self.env) self.secDB.set_flags(db.DB_DUP) self.secDB.set_get_returns_none(2) self.secDB.open(self.filename, "secondary", db.DB_BTREE,
def test13_associateAutoCommit(self): if verbose: print '\n', '-=' * 30 print "Running %s.test13_associateAutoCommit..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
self.getDB().associate(secDB, self.getGenre, txn=txn)
self.getDB().associate(self.secDB, self.getGenre, txn=txn)
def test13_associateAutoCommit(self): if verbose: print '\n', '-=' * 30 print "Running %s.test13_associateAutoCommit..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
self.finish_test(secDB, txn=txn) finally: txn.commit()
except: txn.abort() raise self.txn_finish_test(self.secDB, txn=txn)
def test13_associateAutoCommit(self): if verbose: print '\n', '-=' * 30 print "Running %s.test13_associateAutoCommit..." % \ self.__class__.__name__
c9321ccdfc51bc5e6317151467eb008720a86fe7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c9321ccdfc51bc5e6317151467eb008720a86fe7/test_associate.py
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
class container: def __init__(self): root = Tk() text = self.text = Text(root) text.pack(side=LEFT, fill=BOTH, expand=1) text.insert("insert", "string.split") root.update() self.calltip = CallTip(text)
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
85b973576887f174f4f12fa643eeb232dba2be66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/85b973576887f174f4f12fa643eeb232dba2be66/CallTipWindow.py
tc = TC() tests = t1, t2, t3, t4, t5, t6, \ tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6
text.event_add("<<calltip-show>>", "(") text.event_add("<<calltip-hide>>", ")") text.bind("<<calltip-show>>", self.calltip_show) text.bind("<<calltip-hide>>", self.calltip_hide) text.focus_set()
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
85b973576887f174f4f12fa643eeb232dba2be66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/85b973576887f174f4f12fa643eeb232dba2be66/CallTipWindow.py
test(tests)
def calltip_show(self, event): self.calltip.showtip("Hello world") def calltip_hide(self, event): self.calltip.hidetip() def main(): c=container() if __name__=='__main__': main()
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
85b973576887f174f4f12fa643eeb232dba2be66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/85b973576887f174f4f12fa643eeb232dba2be66/CallTipWindow.py
adlist = None
adlist = ""
def getrouteaddr(self): """Parse a route address (Return-path value).
f830a529961b54d136aac71e1e499e6735627d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f830a529961b54d136aac71e1e499e6735627d99/rfc822.py
if path.startswith(dir) and path[len(dir)] == os.path.sep:
dir = os.path.normcase(dir) if comparepath.startswith(dir) and comparepath[len(dir)] == os.sep:
def fullmodname(path): """Return a plausible module name for the path.""" # If the file 'path' is part of a package, then the filename isn't # enough to uniquely identify it. Try to do the right thing by # looking in sys.path for the longest matching prefix. We'll # assume that the rest is the package name. longest...
7a1af770b9fbf73e967fac9ad224e6caad62e4cc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7a1af770b9fbf73e967fac9ad224e6caad62e4cc/trace.py
if self.text.get("insert-1c") not in (')',']','}'):
closer = self.text.get("insert-1c") if closer not in _openers:
def paren_closed_event(self, event): # If it was a shortcut and not really a closing paren, quit. if self.text.get("insert-1c") not in (')',']','}'): return hp = HyperParser(self.editwin, "insert-1c") if not hp.is_in_code(): return indices = hp.get_surrounding_brackets(keysym_opener[event.keysym], True) if indices is N...
43476e009b2f3b9fd6c3d600bb41a0298907bad5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/43476e009b2f3b9fd6c3d600bb41a0298907bad5/ParenMatch.py
indices = hp.get_surrounding_brackets(keysym_opener[event.keysym], True)
indices = hp.get_surrounding_brackets(_openers[closer], True)
def paren_closed_event(self, event): # If it was a shortcut and not really a closing paren, quit. if self.text.get("insert-1c") not in (')',']','}'): return hp = HyperParser(self.editwin, "insert-1c") if not hp.is_in_code(): return indices = hp.get_surrounding_brackets(keysym_opener[event.keysym], True) if indices is N...
43476e009b2f3b9fd6c3d600bb41a0298907bad5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/43476e009b2f3b9fd6c3d600bb41a0298907bad5/ParenMatch.py
log.info("changing mode of %s to %o", file, mode)
log.info("changing mode of %s", file)
def run (self): if not self.skip_build: self.run_command('build_scripts') self.outfiles = self.copy_tree(self.build_dir, self.install_dir) if os.name == 'posix': # Set the executable bits (owner, group, and world) on # all the scripts we just installed. for file in self.get_outputs(): if self.dry_run: log.info("changin...
e6f40ea4b668ae615b1f48461a4875d966b2915a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e6f40ea4b668ae615b1f48461a4875d966b2915a/install_scripts.py
prog = prog + self.compiler.exe_extension
if self.compiler.exe_extension is not None: prog = prog + self.compiler.exe_extension
def _link (self, body, headers, include_dirs, libraries, library_dirs, lang): (src, obj) = self._compile(body, headers, include_dirs, lang) prog = os.path.splitext(os.path.basename(src))[0] self.compiler.link_executable([obj], prog, libraries=libraries, library_dirs=library_dirs, target_lang=lang)
ca3fec716203db814e297894c09e1daa8fbbef25 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ca3fec716203db814e297894c09e1daa8fbbef25/config.py
host, port = splitport(host) if port is None: port = ftplib.FTP_PORT user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = unquote(user or '') passwd = unquote(passwd or '')
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splita...
a79449e7a2c34daa622c01b66b8a8bd681089176 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a79449e7a2c34daa622c01b66b8a8bd681089176/urllib2.py
host, port = splitport(host) if port is None: port = ftplib.FTP_PORT
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splita...
a79449e7a2c34daa622c01b66b8a8bd681089176 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a79449e7a2c34daa622c01b66b8a8bd681089176/urllib2.py
user = passwd = ''
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splita...
a79449e7a2c34daa622c01b66b8a8bd681089176 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a79449e7a2c34daa622c01b66b8a8bd681089176/urllib2.py
_copy_reg.pickle(stat_result, _pickle_stat_result,_make_stat_result)
try: _copy_reg.pickle(stat_result, _pickle_stat_result, _make_stat_result) except NameError: pass
def _pickle_stat_result(sr): (type, args) = sr.__reduce__() return (_make_stat_result, args)
ce00b735cde4e4d0c56e02723fb0b459c403ace3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ce00b735cde4e4d0c56e02723fb0b459c403ace3/os.py
def test_main():
def test_basic():
def test_main(): test_support.requires('network') if not hasattr(socket, "ssl"): raise test_support.TestSkipped("socket module has no ssl support") import urllib socket.RAND_status() try: socket.RAND_egd(1) except TypeError: pass else: print "didn't raise TypeError" socket.RAND_add("this is a random string", 75.0) f...
a9002f824bdca26700a9a6e7b7e6b36a9482e345 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a9002f824bdca26700a9a6e7b7e6b36a9482e345/test_socket_ssl.py
prefix = buf[345:500] while prefix and prefix[-1] == NUL: prefix = prefix[:-1] if len(prefix.split(NUL)) == 1: tarinfo.prefix = prefix tarinfo.name = normpath(os.path.join(tarinfo.prefix, tarinfo.name)) else: tarinfo.prefix = buf[345:500]
if tarinfo.type != GNUTYPE_SPARSE: tarinfo.name = normpath(os.path.join(nts(tarinfo.prefix), tarinfo.name))
def frombuf(cls, buf): """Construct a TarInfo object from a 512 byte string buffer. """ tarinfo = cls() tarinfo.name = nts(buf[0:100]) tarinfo.mode = int(buf[100:108], 8) tarinfo.uid = int(buf[108:116],8) tarinfo.gid = int(buf[116:124],8) tarinfo.size = long(buf[124:136], 8) tarinfo.mtime = long(buf[136:1...
2b4b5a54d6138e1d8be56b83574a16146306e630 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2b4b5a54d6138e1d8be56b83574a16146306e630/tarfile.py
print 'ParsedDate:', time.asctime(date[:-1]), hhmmss = date[-1]
print 'ParsedDate:', time.asctime(date), hhmmss = tz
def formatdate(timeval=None): """Returns time format preferred for Internet standards. Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 """ if timeval is None: timeval = time.time() return "%s" % time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(timeval))
1d2b23ef22856ae90a2947ab29ebfbf6f83f134a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1d2b23ef22856ae90a2947ab29ebfbf6f83f134a/rfc822.py
if isinstance(host, TupleType): host, x509 = host else: x509 = {}
host, extra_headers, x509 = self.get_host_info(host)
def make_connection(self, host): # create a HTTPS connection object from a host descriptor # host may be a string, or a (host, x509-dict) tuple import httplib if isinstance(host, TupleType): host, x509 = host else: x509 = {} try: HTTPS = httplib.HTTPS except AttributeError: raise NotImplementedError,\ "your version of ...
1303c7cb166ed404945ac79a3a20c06b702c6224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1303c7cb166ed404945ac79a3a20c06b702c6224/xmlrpclib.py
raise NotImplementedError,\ "your version of httplib doesn't support HTTPS"
raise NotImplementedError( "your version of httplib doesn't support HTTPS" )
def make_connection(self, host): # create a HTTPS connection object from a host descriptor # host may be a string, or a (host, x509-dict) tuple import httplib if isinstance(host, TupleType): host, x509 = host else: x509 = {} try: HTTPS = httplib.HTTPS except AttributeError: raise NotImplementedError,\ "your version of ...
1303c7cb166ed404945ac79a3a20c06b702c6224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1303c7cb166ed404945ac79a3a20c06b702c6224/xmlrpclib.py
return apply(HTTPS, (host, None), x509) def send_host(self, connection, host): if isinstance(host, TupleType): host, x509 = host connection.putheader("Host", host)
return apply(HTTPS, (host, None), x509 or {})
def make_connection(self, host): # create a HTTPS connection object from a host descriptor # host may be a string, or a (host, x509-dict) tuple import httplib if isinstance(host, TupleType): host, x509 = host else: x509 = {} try: HTTPS = httplib.HTTPS except AttributeError: raise NotImplementedError,\ "your version of ...
1303c7cb166ed404945ac79a3a20c06b702c6224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1303c7cb166ed404945ac79a3a20c06b702c6224/xmlrpclib.py
res[i] = '%%%02x' % ord(c)
res[i] = '%%%02X' % ord(c)
def _fast_quote(s): global _fast_safe if _fast_safe is None: _fast_safe = {} for c in _fast_safe_test: _fast_safe[c] = c res = list(s) for i in range(len(res)): c = res[i] if not _fast_safe.has_key(c): res[i] = '%%%02x' % ord(c) return ''.join(res)
e27a7b80748c902ce956287f14857666db523c4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e27a7b80748c902ce956287f14857666db523c4b/urllib.py
res[i] = '%%%02x' % ord(c)
res[i] = '%%%02X' % ord(c)
def quote(s, safe = '/'): """quote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved = ";" | "/" | "?" | ":...
e27a7b80748c902ce956287f14857666db523c4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e27a7b80748c902ce956287f14857666db523c4b/urllib.py
for filename in self._built_objects: os.remove(filename)
try: for filename in self._built_objects: os.remove(filename) except AttributeError: self.announce('unable to remove files (ignored)')
def build_extension(self, ext):
03ffbcd393319cfd34341974829fd010fad4b053 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03ffbcd393319cfd34341974829fd010fad4b053/setup.py
extra_link_args=['-framework', 'Carbon']) )
extra_link_args=['-framework', 'Carbon']) )
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
03ffbcd393319cfd34341974829fd010fad4b053 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03ffbcd393319cfd34341974829fd010fad4b053/setup.py
simple_err(struct.calcsize, 'Q')
simple_err(struct.calcsize, 'Z')
def simple_err(func, *args): try: apply(func, args) except struct.error: pass else: raise TestFailed, "%s%s did not raise struct.error" % ( func.__name__, args)
7b9542a3f747787aedf056ddaef99e4469777aa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7b9542a3f747787aedf056ddaef99e4469777aa9/test_struct.py
def badpack(fmt, arg, got, exp): return def badunpack(fmt, arg, got, exp): return "unpack(%s, %s) -> (%s,) `fmt`, `arg`, `got`, `exp`) isbigendian = struct.pack('=h', 1) == '\0\1'
isbigendian = struct.pack('=i', 1)[0] == chr(0)
def badpack(fmt, arg, got, exp): return
7b9542a3f747787aedf056ddaef99e4469777aa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7b9542a3f747787aedf056ddaef99e4469777aa9/test_struct.py
"""Pretty-print a Python object to a stream [default is sys.sydout]."""
"""Pretty-print a Python object to a stream [default is sys.stdout]."""
def pprint(object, stream=None, indent=1, width=80, depth=None): """Pretty-print a Python object to a stream [default is sys.sydout].""" printer = PrettyPrinter( stream=stream, indent=indent, width=width, depth=depth) printer.pprint(object)
2dc0c138400cb562fbf10632a11a1703d99973e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2dc0c138400cb562fbf10632a11a1703d99973e2/pprint.py
nframes = self.calcnframes()
nframes = self.calcnframes(memsize)
def burst_capture(self): self.setwatch() gl.winset(self.window) x, y = gl.getsize() if self.use_24: fl.show_message('Sorry, no 24 bit continuous capture yet', '', '') return vformat = SV.RGB8_FRAMES nframes = self.getint(self.in_nframes, 0) if nframes == 0: maxmem = self.getint(self.in_maxmem, 1.0) memsize = int(maxmem...
546185075cbfde306021d8cbf913a1a575286eb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/546185075cbfde306021d8cbf913a1a575286eb0/Vb.py
def calcnframes(self):
def calcnframes(self, memsize):
def calcnframes(self): gl.winset(self.window) x, y = gl.getsize() pixels = x*y pixels = pixels/2 # XXX always assume fields if self.mono or self.grey: n = memsize/pixels else: n = memsize/(4*pixels) return max(1, n)
546185075cbfde306021d8cbf913a1a575286eb0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/546185075cbfde306021d8cbf913a1a575286eb0/Vb.py
("CompilePyc", 18, "python.exe", r"[TARGETDIR]Lib\compileall.py [TARGETDIR]Lib"), ("CompilePyo", 18, "python.exe", r"-O [TARGETDIR]Lib\compileall.py [TARGETDIR]Lib")
("CompilePyc", 18, "python.exe", compileargs), ("CompilePyo", 18, "python.exe", "-O "+compileargs),
def add_ui(db): x = y = 50 w = 370 h = 300 title = "[ProductName] Setup" # see "Dialog Style Bits" modal = 3 # visible | modal modeless = 1 # visible track_disk_space = 32 add_data(db, 'ActionText', uisample.ActionText) add_data(db, 'UIText', uisample.UIText) # Bitmaps if not os.path.exists(srcdir+r"\PC\pytho...
7b2563bc802c00b13b4411b020b501763efebf23 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7b2563bc802c00b13b4411b020b501763efebf23/msi.py
while True:
while self.pos < len(self.field):
def getaddrlist(self): """Parse all addresses.
fa348c876f990c16e7f9057358765f34396e7d76 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa348c876f990c16e7f9057358765f34396e7d76/_parseaddr.py
break
result.append(('', ''))
def getaddrlist(self): """Parse all addresses.
fa348c876f990c16e7f9057358765f34396e7d76 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa348c876f990c16e7f9057358765f34396e7d76/_parseaddr.py
def formatmonthname(self, theyear, themonth, width):
def formatmonthname(self, theyear, themonth, width, withyear=True):
def formatmonthname(self, theyear, themonth, width): """ Return a formatted month name. """ s = "%s %r" % (month_name[themonth], theyear) return s.center(width)
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
s = "%s %r" % (month_name[themonth], theyear)
s = month_name[themonth] if withyear: s = "%s %r" % (s, theyear)
def formatmonthname(self, theyear, themonth, width): """ Return a formatted month name. """ s = "%s %r" % (month_name[themonth], theyear) return s.center(width)
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
a(formatstring((month_name[k] for k in months), colwidth, c).rstrip())
names = (self.formatmonthname(theyear, k, colwidth, False) for k in months) a(formatstring(names, colwidth, c).rstrip())
def formatyear(self, theyear, w=2, l=1, c=6, m=3): """ Returns a year's calendar as a multi-line string. """ w = max(2, w) l = max(1, l) c = max(2, c) colwidth = (w + 1) * 7 - 1 v = [] a = v.append a(repr(theyear).center(colwidth*m+c*(m-1)).rstrip()) a('\n'*l) header = self.formatweekheader(w) for (i, row) in enumerate...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
a(formatstring((header for k in months), colwidth, c).rstrip())
headers = (header for k in months) a(formatstring(headers, colwidth, c).rstrip())
def formatyear(self, theyear, w=2, l=1, c=6, m=3): """ Returns a year's calendar as a multi-line string. """ w = max(2, w) l = max(1, l) c = max(2, c) colwidth = (w + 1) * 7 - 1 v = [] a = v.append a(repr(theyear).center(colwidth*m+c*(m-1)).rstrip()) a('\n'*l) header = self.formatweekheader(w) for (i, row) in enumerate...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
return ''.join(v).encode(encoding)
return ''.join(v).encode(encoding, "xmlcharrefreplace") class LocaleTextCalendar(TextCalendar): """ This class can be passed a locale name in the constructor and will return month and weekday names in the specified locale. If this locale includes an encoding all strings containing month and weekday names will be retu...
def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None): """ Return a formatted year as a complete HTML page. """ if encoding is None: encoding = sys.getdefaultencoding() v = [] a = v.append a('<?xml version="1.0" encoding="%s"?>\n' % encoding) a('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
parser = optparse.OptionParser(usage="usage: %prog [options] [year] [month]") parser.add_option("-w", "--width", dest="width", type="int", default=2, help="width of date column (default 2, text only)") parser.add_option("-l", "--lines", dest="lines", type="int", default=1, help="number of lines for each week (default 1...
parser = optparse.OptionParser(usage="usage: %prog [options] [year [month]]") parser.add_option( "-w", "--width", dest="width", type="int", default=2, help="width of date column (default 2, text only)" ) parser.add_option( "-l", "--lines", dest="lines", type="int", default=1, help="number of lines for each week (defaul...
def main(args): import optparse parser = optparse.OptionParser(usage="usage: %prog [options] [year] [month]") parser.add_option("-w", "--width", dest="width", type="int", default=2, help="width of date column (default 2, text only)") parser.add_option("-l", "--lines", dest="lines", type="int", default=1, help="number o...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
cal = HTMLCalendar()
if options.locale: cal = LocaleHTMLCalendar(locale=options.locale) else: cal = HTMLCalendar()
def main(args): import optparse parser = optparse.OptionParser(usage="usage: %prog [options] [year] [month]") parser.add_option("-w", "--width", dest="width", type="int", default=2, help="width of date column (default 2, text only)") parser.add_option("-l", "--lines", dest="lines", type="int", default=1, help="number o...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
cal = TextCalendar()
if options.locale: cal = LocaleTextCalendar(locale=options.locale) else: cal = TextCalendar()
def main(args): import optparse parser = optparse.OptionParser(usage="usage: %prog [options] [year] [month]") parser.add_option("-w", "--width", dest="width", type="int", default=2, help="width of date column (default 2, text only)") parser.add_option("-l", "--lines", dest="lines", type="int", default=1, help="number o...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
print cal.formatyear(datetime.date.today().year, **optdict)
result = cal.formatyear(datetime.date.today().year, **optdict)
def main(args): import optparse parser = optparse.OptionParser(usage="usage: %prog [options] [year] [month]") parser.add_option("-w", "--width", dest="width", type="int", default=2, help="width of date column (default 2, text only)") parser.add_option("-l", "--lines", dest="lines", type="int", default=1, help="number o...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
print cal.formatyear(int(args[1]), **optdict)
result = cal.formatyear(int(args[1]), **optdict)
def main(args): import optparse parser = optparse.OptionParser(usage="usage: %prog [options] [year] [month]") parser.add_option("-w", "--width", dest="width", type="int", default=2, help="width of date column (default 2, text only)") parser.add_option("-l", "--lines", dest="lines", type="int", default=1, help="number o...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
print cal.formatmonth(int(args[1]), int(args[2]), **optdict)
result = cal.formatmonth(int(args[1]), int(args[2]), **optdict)
def main(args): import optparse parser = optparse.OptionParser(usage="usage: %prog [options] [year] [month]") parser.add_option("-w", "--width", dest="width", type="int", default=2, help="width of date column (default 2, text only)") parser.add_option("-l", "--lines", dest="lines", type="int", default=1, help="number o...
48d5e508ebc136f8f67a2cb2bdd29e55324f5a95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/48d5e508ebc136f8f67a2cb2bdd29e55324f5a95/calendar.py
waste = self.rfile.read(1)
if not self.rfile.read(1): break
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip...
e2f18377ff21c0e3217d561c8509e6816ecb362d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e2f18377ff21c0e3217d561c8509e6816ecb362d/CGIHTTPServer.py
waste = self.rfile._sock.recv(1)
if not self.rfile._sock.recv(1): break
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip...
e2f18377ff21c0e3217d561c8509e6816ecb362d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e2f18377ff21c0e3217d561c8509e6816ecb362d/CGIHTTPServer.py
def test_compresscopy(self): data0 = HAMLET_SCENE data1 = HAMLET_SCENE.swapcase() c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION) bufs0 = [] bufs0.append(c0.compress(data0)) c1 = c0.copy() bufs1 = bufs0[:] bufs0.append(c0.compress(data0)) bufs0.append(c0.flush()) s0 = ''.join(bufs0) bufs1.append(c1.compress(data1)) ...
if hasattr(zlib.compressobj(), "copy"): def test_compresscopy(self): data0 = HAMLET_SCENE data1 = HAMLET_SCENE.swapcase() c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION) bufs0 = [] bufs0.append(c0.compress(data0)) c1 = c0.copy() bufs1 = bufs0[:] bufs0.append(c0.compress(data0)) bufs0.append(c0.flush()) s0 = ''.join(b...
def test_compresscopy(self): # Test copying a compression object data0 = HAMLET_SCENE data1 = HAMLET_SCENE.swapcase() c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION) bufs0 = [] bufs0.append(c0.compress(data0))
6e73aaab474ab9df512e8f24029ed1c57f39c619 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6e73aaab474ab9df512e8f24029ed1c57f39c619/test_zlib.py
['extract-all', 'default-domain', 'escape', 'help',
['extract-all', 'default-domain=', 'escape', 'help',
def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ['extract-all', 'default-domain', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstri...
2b63969a5adbc43a3843102f95b45424da229745 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2b63969a5adbc43a3843102f95b45424da229745/pygettext.py
if sys.platform == 'aix4': python_lib = get_python_lib(standard_lib=1) ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') python_exp = os.path.join(python_lib, 'config', 'python.exp') g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) elif sys.platform == 'beos': python_lib = get_python_...
if python_build: g['LDSHARED'] = g['BLDSHARED']
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_ms...
1a020868857cc58be9c2f36400b6e1c178750a49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a020868857cc58be9c2f36400b6e1c178750a49/sysconfig.py
a = -1 b = -1 c = -1
Unpack list
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
3981511070311e958bd2cd48b1ab16b24f8b350e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3981511070311e958bd2cd48b1ab16b24f8b350e/test_unpack.py
if verbose: print 'unpack tuple' a, b, c = t if a != 1 or b != 2 or c != 3: raise TestFailed
>>> l = [4, 5, 6] >>> a, b, c = l >>> a == 4 and b == 5 and c == 6 True
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
3981511070311e958bd2cd48b1ab16b24f8b350e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3981511070311e958bd2cd48b1ab16b24f8b350e/test_unpack.py
if verbose: print 'unpack list' a, b, c = l if a != 4 or b != 5 or c != 6: raise TestFailed
Unpack implied tuple
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
3981511070311e958bd2cd48b1ab16b24f8b350e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3981511070311e958bd2cd48b1ab16b24f8b350e/test_unpack.py
if verbose: print 'unpack implied tuple' a, b, c = 7, 8, 9 if a != 7 or b != 8 or c != 9: raise TestFailed
>>> a, b, c = 7, 8, 9 >>> a == 7 and b == 8 and c == 9 True
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
3981511070311e958bd2cd48b1ab16b24f8b350e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3981511070311e958bd2cd48b1ab16b24f8b350e/test_unpack.py
if verbose: print 'unpack string' a, b, c = 'one' if a != 'o' or b != 'n' or c != 'e': raise TestFailed
Unpack string... fun!
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
3981511070311e958bd2cd48b1ab16b24f8b350e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3981511070311e958bd2cd48b1ab16b24f8b350e/test_unpack.py
if verbose: print 'unpack sequence' a, b, c = Seq() if a != 0 or b != 1 or c != 2: raise TestFailed
>>> a, b, c = 'one' >>> a == 'o' and b == 'n' and c == 'e' True
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
3981511070311e958bd2cd48b1ab16b24f8b350e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3981511070311e958bd2cd48b1ab16b24f8b350e/test_unpack.py
if verbose: print 'unpack single tuple/list' st = (99,) sl = [100] a, = st if a != 99: raise TestFailed b, = sl if b != 100: raise TestFailed
Unpack generic sequence
def __getitem__(self, i): if i >= 0 and i < 3: return i raise IndexError
3981511070311e958bd2cd48b1ab16b24f8b350e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3981511070311e958bd2cd48b1ab16b24f8b350e/test_unpack.py