rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
list of strings (???) containing version numbers; the list will be | list of strings containing version numbers; the list will be | def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings (???) containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found. (XXX is this correct???)""" try: import win32api import win32con except ImportError: return [] K = 'Software\\Microsoft\\Devstudio' L = [] for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: p = win32api.RegEnumKey(k,i) if p[0] in '123456789' and p not in L: L.append(p) except win32api.error: break i = i + 1 except win32api.error: pass L.sort() L.reverse() return L | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
found. (XXX is this correct???)""" | found.""" | def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings (???) containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found. (XXX is this correct???)""" try: import win32api import win32con except ImportError: return [] K = 'Software\\Microsoft\\Devstudio' L = [] for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: p = win32api.RegEnumKey(k,i) if p[0] in '123456789' and p not in L: L.append(p) except win32api.error: break i = i + 1 except win32api.error: pass L.sort() L.reverse() return L | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
"""Get a devstudio path (include, lib or path).""" | """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" | def get_msvc_paths (path, version='6.0', platform='x86'): """Get a devstudio path (include, lib or path).""" try: import win32api import win32con except ImportError: return None L = [] if path=='lib': path= 'Library' path = string.upper(path + ' Dirs') K = ('Software\\Microsoft\\Devstudio\\%s\\' + 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ (version,platform) for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: (p,v,t) = win32api.RegEnumValue(k,i) if string.upper(p) == path: V = string.split(v,';') for v in V: if v == '' or v in L: continue L.append(v) break i = i + 1 except win32api.error: break except win32api.error: pass return L | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
return None | return [] | def get_msvc_paths (path, version='6.0', platform='x86'): """Get a devstudio path (include, lib or path).""" try: import win32api import win32con except ImportError: return None L = [] if path=='lib': path= 'Library' path = string.upper(path + ' Dirs') K = ('Software\\Microsoft\\Devstudio\\%s\\' + 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ (version,platform) for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: (p,v,t) = win32api.RegEnumValue(k,i) if string.upper(p) == path: V = string.split(v,';') for v in V: if v == '' or v in L: continue L.append(v) break i = i + 1 except win32api.error: break except win32api.error: pass return L | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
def _find_exe(exe): for v in get_devstudio_versions(): for p in get_msvc_paths('path',v): fn = os.path.join(os.path.abspath(p),exe) if os.path.isfile(fn): return fn try: for p in string.split(os.environ['Path'],';'): fn=os.path.join(os.path.abspath(p),exe) if os.path.isfile(fn): return fn except: pass return exe def _find_SET(n): for v in get_devstudio_versions(): p = get_msvc_paths(n,v) if p: return p return [] def _do_SET(n): p = _find_SET(n) | def find_exe (exe, version_number): """Try to find an MSVC executable program 'exe' (from version 'version_number' of MSVC) in several places: first, one of the MSVC program search paths from the registry; next, the directories in the PATH environment variable. If any of those work, return an absolute path that is known to exist. If none of them work, just return the original program name, 'exe'.""" for p in get_msvc_paths ('path', version_number): fn = os.path.join (os.path.abspath(p), exe) if os.path.isfile(fn): return fn for p in string.split (os.environ['Path'],';'): fn = os.path.join(os.path.abspath(p),exe) if os.path.isfile(fn): return fn return exe def _find_SET(name,version_number): """looks up in the registry and returns a list of values suitable for use in a SET command eg SET name=value. Normally the value will be a ';' separated list similar to a path list. name is the name of an MSVC path and version_number is a version_number of an MSVC installation.""" return get_msvc_paths(name, version_number) def _do_SET(name, version_number): """sets os.environ[name] to an MSVC path type value obtained from _find_SET. This is equivalent to a SET command prior to execution of spawned commands.""" p=_find_SET(name, version_number) | def _find_exe(exe): for v in get_devstudio_versions(): for p in get_msvc_paths('path',v): fn = os.path.join(os.path.abspath(p),exe) if os.path.isfile(fn): return fn #didn't find it; try existing path try: for p in string.split(os.environ['Path'],';'): fn=os.path.join(os.path.abspath(p),exe) if os.path.isfile(fn): return fn # XXX BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD !!!!!!!!!!!!!!!! except: # XXX WHAT'S BEING CAUGHT HERE?!?!? pass return exe #last desperate hope | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
os.environ[n] = string.join(p,';') | os.environ[name]=string.join(p,';') | def _do_SET(n): p = _find_SET(n) if p: os.environ[n] = string.join(p,';') | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
self.cc = _find_exe("cl.exe") self.link = _find_exe("link.exe") _do_SET('lib') _do_SET('include') path=_find_SET('path') try: for p in string.split(os.environ['path'],';'): path.append(p) except KeyError: pass os.environ['path'] = string.join(path,';') | vNum = get_devstudio_versions () if vNum: vNum = vNum[0] self.cc = _find_exe("cl.exe", vNum) self.link = _find_exe("link.exe", vNum) _do_SET('lib', vNum) _do_SET('include', vNum) path=_find_SET('path', vNum) try: for p in string.split(os.environ['path'],';'): path.append(p) except KeyError: pass os.environ['path'] = string.join(path,';') else: self.cc = "cl.exe" self.link = "link.exe" | def __init__ (self, verbose=0, dry_run=0, force=0): | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
self.compile_options = [ '/nologo', '/Ox', '/MD' ] | self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3' ] | def __init__ (self, verbose=0, dry_run=0, force=0): | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
'/nologo', '/Od', '/MDd', '/Z7', '/D_DEBUG' | '/nologo', '/Od', '/MDd', '/W3', '/Z7', '/D_DEBUG' | def __init__ (self, verbose=0, dry_run=0, force=0): | 01c6453268730f0196a5451bf42b6f997496e60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/01c6453268730f0196a5451bf42b6f997496e60d/msvccompiler.py |
#ifdef WITHOUT_FRAMEWORKS | e6677828ed425694f83f25779f5c454e66cd9c0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6677828ed425694f83f25779f5c454e66cd9c0b/filesupport.py |
||
if ( PyString_Check(args) ) { OSStatus err; | if ( PyString_Check(v) ) { | #ifdef WITHOUT_FRAMEWORKS | e6677828ed425694f83f25779f5c454e66cd9c0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6677828ed425694f83f25779f5c454e66cd9c0b/filesupport.py |
PyErr_Mac(ErrorObject, err); | PyMac_Error(err); | #ifdef WITHOUT_FRAMEWORKS | e6677828ed425694f83f25779f5c454e66cd9c0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6677828ed425694f83f25779f5c454e66cd9c0b/filesupport.py |
if (FSpMakeFSRef(&((FSSpecObject *)v)->ob_itself, fsr)) | if ((err=FSpMakeFSRef(&((FSSpecObject *)v)->ob_itself, fsr)) == 0) | #ifdef WITHOUT_FRAMEWORKS | e6677828ed425694f83f25779f5c454e66cd9c0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6677828ed425694f83f25779f5c454e66cd9c0b/filesupport.py |
getsetlist = [ ("data", """int size; PyObject *rv; size = GetHandleSize((Handle)self->ob_itself); HLock((Handle)self->ob_itself); rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size); HUnlock((Handle)self->ob_itself); return rv; """, None, "Raw data of the alias object" ) ] | def output_tp_initBody(self): Output("PyObject *v;") Output("char *kw[] = {\"itself\", 0};") Output() Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"O\", kw, &v))") Output("return -1;") Output("if (myPyMac_GetFSRef(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype) Output("return -1;") | e6677828ed425694f83f25779f5c454e66cd9c0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6677828ed425694f83f25779f5c454e66cd9c0b/filesupport.py |
|
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) | module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, longname=LONGMODNAME) | def parseArgumentList(self, args): args0, arg1, argsrest = args[:1], args[1], args[2:] t0, n0, m0 = arg1 args = args0 + argsrest if m0 != InMode: raise ValueError, "method's 'self' must be 'InMode'" self.itself = Variable(t0, "_self->ob_itself", SelfMode) FunctionGenerator.parseArgumentList(self, args) self.argumentList.insert(2, self.itself) | e6677828ed425694f83f25779f5c454e66cd9c0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6677828ed425694f83f25779f5c454e66cd9c0b/filesupport.py |
self.compile = None self.no_compile = None | self.compile = 0 | def initialize_options (self): | 97c3abdc12ddc74881181bf9acee6258de862479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97c3abdc12ddc74881181bf9acee6258de862479/install.py |
import sys | if debug_stderr: sys.stderr = debug_stderr | def __init__(self): self.preffilepath = ":Python:PythonIDE preferences" Wapplication.Application.__init__(self, 'Pide') from Carbon import AE from Carbon import AppleEvents AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEOpenApplication, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEReopenApplication, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEPrintDocuments, self.ignoreevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEOpenDocuments, self.opendocsevent) AE.AEInstallEventHandler(AppleEvents.kCoreEventClass, AppleEvents.kAEQuitApplication, self.quitevent) import PyConsole, PyEdit Splash.wait() PyConsole.installoutput() PyConsole.installconsole() import sys for path in sys.argv[1:]: self.opendoc(path) try: import Wthreading except ImportError: self.mainloop() else: if Wthreading.haveThreading: self.mainthread = Wthreading.Thread("IDE event loop", self.mainloop) self.mainthread.start() #self.mainthread.setResistant(1) Wthreading.run() else: self.mainloop() | 903ada48ccb8cf2b1e0ae6f853c7a0e197235dc9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/903ada48ccb8cf2b1e0ae6f853c7a0e197235dc9/PythonIDEMain.py |
self.filename = filename | self.filename = _normpath(filename) | def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): self.filename = filename # Name of the file in the archive self.date_time = date_time # year, month, day, hour, min, sec # Standard values: self.compress_type = ZIP_STORED # Type of compression for the file self.comment = "" # Comment for each file self.extra = "" # ZIP extra data self.create_system = 0 # System which created ZIP archive self.create_version = 20 # Version which created ZIP archive self.extract_version = 20 # Version needed to extract archive self.reserved = 0 # Must be zero self.flag_bits = 0 # ZIP flag bits self.volume = 0 # Volume number of file header self.internal_attr = 0 # Internal attributes self.external_attr = 0 # External file attributes # Other attributes are set by class ZipFile: # header_offset Byte offset to the file header # file_offset Byte offset to the start of the file data # CRC CRC-32 of the uncompressed file # compress_size Size of the compressed file # file_size Size of the uncompressed file | 9a1c2c1570f3f7af994952e01e1b98f805970e38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9a1c2c1570f3f7af994952e01e1b98f805970e38/zipfile.py |
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): | def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): | def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.calledfuncs.copy() self.infile = infile self.outfile = outfile if self.infile: # try and merge existing counts file try: thingie = pickle.load(open(self.infile, 'r')) if type(thingie) is types.DictType: # backwards compatibility for old trace.py after Zooko touched it but before calledfuncs --Zooko 2001-10-24 self.update(self.__class__(thingie)) elif type(thingie) is types.TupleType and len(thingie) == 2: counts, calledfuncs = thingie self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError): pass except pickle.UnpicklingError: # backwards compatibility for old trace.py before Zooko touched it --Zooko 2001-10-24 self.update(self.__class__(marshal.load(open(self.infile)))) | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.calledfuncs.copy() self.infile = infile self.outfile = outfile if self.infile: # try and merge existing counts file try: thingie = pickle.load(open(self.infile, 'r')) if type(thingie) is types.DictType: # backwards compatibility for old trace.py after Zooko touched it but before calledfuncs --Zooko 2001-10-24 self.update(self.__class__(thingie)) elif type(thingie) is types.TupleType and len(thingie) == 2: counts, calledfuncs = thingie self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError): pass except pickle.UnpicklingError: # backwards compatibility for old trace.py before Zooko touched it --Zooko 2001-10-24 self.update(self.__class__(marshal.load(open(self.infile)))) | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
||
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.calledfuncs.copy() self.infile = infile self.outfile = outfile if self.infile: # try and merge existing counts file try: thingie = pickle.load(open(self.infile, 'r')) if type(thingie) is types.DictType: # backwards compatibility for old trace.py after Zooko touched it but before calledfuncs --Zooko 2001-10-24 self.update(self.__class__(thingie)) elif type(thingie) is types.TupleType and len(thingie) == 2: counts, calledfuncs = thingie self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError): pass except pickle.UnpicklingError: # backwards compatibility for old trace.py before Zooko touched it --Zooko 2001-10-24 self.update(self.__class__(marshal.load(open(self.infile)))) | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
||
if key != 'calledfuncs': | if key != 'calledfuncs': | def update(self, other): """Merge in the data from another CoverageResults""" counts = self.counts calledfuncs = self.calledfuncs other_counts = other.counts other_calledfuncs = other.calledfuncs | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None): | def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None): | def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None): """ @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' @param ignoremods a list of the names of modules to ignore @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results @param outfile file in which to write the results """ self.infile = infile self.outfile = outfile self.ignore = Ignore(ignoremods, ignoredirs) self.counts = {} # keys are (filename, linenumber) self.blabbed = {} # for debugging self.pathtobasename = {} # for memoizing os.path.basename self.donothing = 0 self.trace = trace self._calledfuncs = {} if countfuncs: self.globaltrace = self.globaltrace_countfuncs elif trace and count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace_and_count elif trace: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace elif count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_count else: # Ahem -- do nothing? Okay. self.donothing = 1 | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
@param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' | @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' | def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None): """ @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' @param ignoremods a list of the names of modules to ignore @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results @param outfile file in which to write the results """ self.infile = infile self.outfile = outfile self.ignore = Ignore(ignoremods, ignoredirs) self.counts = {} # keys are (filename, linenumber) self.blabbed = {} # for debugging self.pathtobasename = {} # for memoizing os.path.basename self.donothing = 0 self.trace = trace self._calledfuncs = {} if countfuncs: self.globaltrace = self.globaltrace_countfuncs elif trace and count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace_and_count elif trace: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace elif count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_count else: # Ahem -- do nothing? Okay. self.donothing = 1 | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
@param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results | @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results | def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None): """ @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' @param ignoremods a list of the names of modules to ignore @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results @param outfile file in which to write the results """ self.infile = infile self.outfile = outfile self.ignore = Ignore(ignoremods, ignoredirs) self.counts = {} # keys are (filename, linenumber) self.blabbed = {} # for debugging self.pathtobasename = {} # for memoizing os.path.basename self.donothing = 0 self.trace = trace self._calledfuncs = {} if countfuncs: self.globaltrace = self.globaltrace_countfuncs elif trace and count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace_and_count elif trace: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace elif count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_count else: # Ahem -- do nothing? Okay. self.donothing = 1 | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
key = (filename, lineno,) | key = filename, lineno | def localtrace_trace_and_count(self, frame, why, arg): if why == 'line': # record the file name and line number of every trace # XXX I wish inspect offered me an optimized # `getfilename(frame)' to use in place of the presumably # heavier `getframeinfo()'. --Zooko 2001-10-14 filename, lineno, funcname, context, lineindex = \ inspect.getframeinfo(frame, 1) key = (filename, lineno,) self.counts[key] = self.counts.get(key, 0) + 1 # XXX not convinced that this memoizing is a performance # win -- I don't know enough about Python guts to tell. # --Zooko 2001-10-14 bname = self.pathtobasename.get(filename) if bname is None: # Using setdefault faster than two separate lines? # --Zooko 2001-10-14 bname = self.pathtobasename.setdefault(filename, os.path.basename(filename)) try: print "%s(%d): %s" % (bname, lineno, context[lineindex]), except IndexError: # Uh.. sometimes getframeinfo gives me a context of # length 1 and a lineindex of -2. Oh well. pass return self.localtrace | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
listfuncs = false | listfuncs = False | def main(argv=None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:msC:l", ["help", "version", "trace", "count", "report", "no-report", "file=", "missing", "ignore-module=", "ignore-dir=", "coverdir=", "listfuncs",]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None missing = 0 ignore_modules = [] ignore_dirs = [] coverdir = None summary = 0 listfuncs = false for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-l" or opt == "--listfuncs": listfuncs = true continue if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "-C" or opt == "--coverdir": coverdir = val continue if opt == "-s" or opt == "--summary": summary = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in val.split(os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = s.replace("$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = s.replace("$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if listfuncs and (count or trace): _err_exit("cannot specify both --listfuncs and (--trace or --count)") if not count and not trace and not report and not listfuncs: _err_exit("must specify one of --trace, --count, --report or --listfuncs") if report and no_report: _err_exit("cannot specify both --report and --no-report") if report and not counts_file: _err_exit("--report requires a --file") if no_report and len(prog_argv) == 0: _err_exit("missing name of file to run") # everything is ready if report: results = CoverageResults(infile=counts_file, outfile=counts_file) results.write_results(missing, summary=summary, coverdir=coverdir) else: sys.argv = prog_argv progname = prog_argv[0] sys.path[0] = os.path.split(progname)[0] t = Trace(count, trace, countfuncs=listfuncs, ignoremods=ignore_modules, ignoredirs=ignore_dirs, infile=counts_file, outfile=counts_file) try: t.run('execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % (`sys.argv[0]`, err)) except SystemExit: pass results = t.results() if not no_report: results.write_results(missing, summary=summary, coverdir=coverdir) | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
listfuncs = true | listfuncs = True | def main(argv=None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:msC:l", ["help", "version", "trace", "count", "report", "no-report", "file=", "missing", "ignore-module=", "ignore-dir=", "coverdir=", "listfuncs",]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None missing = 0 ignore_modules = [] ignore_dirs = [] coverdir = None summary = 0 listfuncs = false for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-l" or opt == "--listfuncs": listfuncs = true continue if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "-C" or opt == "--coverdir": coverdir = val continue if opt == "-s" or opt == "--summary": summary = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in val.split(os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = s.replace("$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = s.replace("$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if listfuncs and (count or trace): _err_exit("cannot specify both --listfuncs and (--trace or --count)") if not count and not trace and not report and not listfuncs: _err_exit("must specify one of --trace, --count, --report or --listfuncs") if report and no_report: _err_exit("cannot specify both --report and --no-report") if report and not counts_file: _err_exit("--report requires a --file") if no_report and len(prog_argv) == 0: _err_exit("missing name of file to run") # everything is ready if report: results = CoverageResults(infile=counts_file, outfile=counts_file) results.write_results(missing, summary=summary, coverdir=coverdir) else: sys.argv = prog_argv progname = prog_argv[0] sys.path[0] = os.path.split(progname)[0] t = Trace(count, trace, countfuncs=listfuncs, ignoremods=ignore_modules, ignoredirs=ignore_dirs, infile=counts_file, outfile=counts_file) try: t.run('execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % (`sys.argv[0]`, err)) except SystemExit: pass results = t.results() if not no_report: results.write_results(missing, summary=summary, coverdir=coverdir) | 9340d0d72de79fcdacc1995974f82fcd6e43dd51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9340d0d72de79fcdacc1995974f82fcd6e43dd51/trace.py |
if isdir(name) and not islink(name): | st = os.lstat(name) if stat.S_ISDIR(st[stat.ST_MODE]): | def walk(top, func, arg): """walk(top,func,arg) calls func(arg, d, files) for each directory "d" | e2cdfc7593294ee121dfa8def76f3ed7cebf12f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e2cdfc7593294ee121dfa8def76f3ed7cebf12f3/posixpath.py |
self.socket.close() | def process_request(self, request, client_address): """Fork a new subprocess to process the request.""" self.collect_children() pid = os.fork() if pid: # Parent process if self.active_children is None: self.active_children = [] self.active_children.append(pid) return else: # Child process. # This must never return, hence os._exit()! try: self.finish_request(request, client_address) os._exit(0) except: try: self.socket.close() self.handle_error(request, client_address) finally: os._exit(1) | ec8886119967e9f2e1f1672f4249000027964f5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec8886119967e9f2e1f1672f4249000027964f5b/SocketServer.py |
|
def __init__(self, s): self.__lines = s.split('\n') | def __init__(self, name, data, files=(), dirs=()): self.__name = name self.__data = data self.__files = files self.__dirs = dirs self.__lines = None def __setup(self): if self.__lines: return data = None for dir in self.__dirs: for file in self.__files: file = os.path.join(dir, file) try: fp = open(file) data = fp.read() fp.close() break except IOError: pass if data: break if not data: data = self.__data self.__lines = data.split('\n') | def __init__(self, s): self.__lines = s.split('\n') self.__linecnt = len(self.__lines) | 936b2dd45c6958b9ddb514189b0b133eb507cfd8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/936b2dd45c6958b9ddb514189b0b133eb507cfd8/site.py |
return '' __builtin__.copyright = _Printer(sys.copyright) __builtin__.credits = _Printer( '''Python development is led by BeOpen PythonLabs (www.pythonlabs.com).''') def make_license(filename): try: return _Printer(open(filename).read()) except IOError: return None | __builtin__.copyright = _Printer("copyright", sys.copyright) __builtin__.credits = _Printer("credits", "Python development is led by BeOpen PythonLabs (www.pythonlabs.com).") | def __repr__(self): prompt = 'Hit Return for more, or q (and Return) to quit: ' lineno = 0 while 1: try: for i in range(lineno, lineno + self.MAXLINES): print self.__lines[i] except IndexError: break else: lineno += self.MAXLINES key = None while key is None: key = raw_input(prompt) if key not in ('', 'q'): key = None if key == 'q': break return '' | 936b2dd45c6958b9ddb514189b0b133eb507cfd8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/936b2dd45c6958b9ddb514189b0b133eb507cfd8/site.py |
for dir in here, os.path.join(here, os.pardir), os.curdir: for file in "LICENSE.txt", "LICENSE": lic = make_license(os.path.join(dir, file)) if lic: break if lic: __builtin__.license = lic break else: __builtin__.license = _Printer('See http://hdl.handle.net/1895.22/1012') | __builtin__.license = _Printer( "license", "See http://www.pythonlabs.com/products/python2.0/license.html", ["LICENSE.txt", "LICENSE"], [here, os.path.join(here, os.pardir), os.curdir]) | def make_license(filename): try: return _Printer(open(filename).read()) except IOError: return None | 936b2dd45c6958b9ddb514189b0b133eb507cfd8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/936b2dd45c6958b9ddb514189b0b133eb507cfd8/site.py |
adlist = None | adlist = "" | def getrouteaddr(self): """Parse a route address (Return-path value). | 0de8b68c4aecfa7b908aee9f677f90c6b8a7ed06 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0de8b68c4aecfa7b908aee9f677f90c6b8a7ed06/rfc822.py |
result.append('\\') result.append(char) | if char == '\000': result.append(r'\000') else: result.append('\\' + char) else: result.append(char) | def escape(pattern): "Escape all non-alphanumeric characters in pattern." result = [] alphanum=string.letters+'_'+string.digits for char in pattern: if char not in alphanum: result.append('\\') result.append(char) return string.join(result, '') | e2e045c918de0dd788e1260b0023a9e9052a0ab5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e2e045c918de0dd788e1260b0023a9e9052a0ab5/re.py |
while not self.state: | if not self.state: | def wait(self): self.posted.acquire() while not self.state: self.posted.wait() self.posted.release() | 3fdee996bec2a84eaa9b98292719bad2a4b0629c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3fdee996bec2a84eaa9b98292719bad2a4b0629c/sync.py |
self.plist.CFBundleExecutable = self.name | def preProcess(self): self.plist.CFBundleExecutable = self.name resdir = pathjoin("Contents", "Resources") if self.executable is not None: if self.mainprogram is None: execpath = pathjoin(self.execdir, self.name) else: execpath = pathjoin(resdir, os.path.basename(self.executable)) self.files.append((self.executable, execpath)) # For execve wrapper setexecutable = setExecutableTemplate % os.path.basename(self.executable) else: setexecutable = "" # XXX for locals() call | 42fffc1d3be00aca96bdd2fc2006ce5494ca3fea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42fffc1d3be00aca96bdd2fc2006ce5494ca3fea/bundlebuilder.py |
|
python [options] command | python bundlebuilder.py [options] command | def pathjoin(*args): """Safe wrapper for os.path.join: asserts that all but the first argument are relative paths.""" for seg in args[1:]: assert seg[0] != "/" return os.path.join(*args) | 42fffc1d3be00aca96bdd2fc2006ce5494ca3fea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42fffc1d3be00aca96bdd2fc2006ce5494ca3fea/bundlebuilder.py |
b = (12,) c = (6, 6) d = (4, 4, 4) e = (3, 3, 3, 3) | b = (1,) c = (1, 2) d = (1, 2, 3) e = (1, 2, 3, 4) | def test_short_tuples(self): a = () b = (12,) c = (6, 6) d = (4, 4, 4) e = (3, 3, 3, 3) for proto in 0, 1, 2: for x in a, b, c, d, e: s = self.dumps(x, proto) y = self.loads(s) self.assertEqual(x, y, (proto, x, s, y)) | 90047b42269f22d4350f00483f5587cf6e9e2566 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90047b42269f22d4350f00483f5587cf6e9e2566/pickletester.py |
if not debugger: | if not debugger and \ self.editwin.getvar("<<toggle-jit-stack-viewer>>"): | def run_module_event(self, event, debugger=None): if not self.editwin.get_saved(): tkMessageBox.showerror("Not saved", "Please save first!", master=self.editwin.text) self.editwin.text.focus_set() return filename = self.editwin.io.filename if not filename: tkMessageBox.showerror("No file name", "This window has no file name", master=self.editwin.text) self.editwin.text.focus_set() return modname, ext = os.path.splitext(os.path.basename(filename)) if sys.modules.has_key(modname): mod = sys.modules[modname] else: mod = imp.new_module(modname) sys.modules[modname] = mod mod.__file__ = filename saveout = sys.stdout saveerr = sys.stderr owin = OnDemandOutputWindow(self.editwin.flist) try: sys.stderr = PseudoFile(owin, "stderr") try: sys.stdout = PseudoFile(owin, "stdout") try: if debugger: debugger.run("execfile(%s)" % `filename`, mod.__dict__) else: execfile(filename, mod.__dict__) except: (sys.last_type, sys.last_value, sys.last_traceback) = sys.exc_info() linecache.checkcache() traceback.print_exc() if not debugger: from StackViewer import StackBrowser sv = StackBrowser(self.root, self.flist) finally: sys.stdout = saveout finally: sys.stderr = saveerr | c95ed37697a4fd9cee14a0f83706e6d7f31f26bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c95ed37697a4fd9cee14a0f83706e6d7f31f26bd/ScriptBinding.py |
to_convert = to_convert[:] to_convert.sort(key=len, reverse=True) | def __seqToRE(self, to_convert, directive): """Convert a list to a regex string for matching a directive. | 7c1215df0e3d60cb25d1a75a496c926e5d6061f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c1215df0e3d60cb25d1a75a496c926e5d6061f4/_strptime.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 = urllib.urlopen('https://sf.net') buf = f.read() f.close() | 6aac0ca4d27b8f47b25120a63c9dcbe6074634d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6aac0ca4d27b8f47b25120a63c9dcbe6074634d7/test_socket_ssl.py |
if not self._dict['Download-URL']: | if not self._dict.get('Download-URL'): | def prerequisites(self): """Return a list of prerequisites for this package. The list contains 2-tuples, of which the first item is either a PimpPackage object or None, and the second is a descriptive string. The first item can be None if this package depends on something that isn't pimp-installable, in which case the descriptive string should tell the user what to do.""" rv = [] if not self._dict['Download-URL']: return [(None, "This package needs to be installed manually")] if not self._dict['Prerequisites']: return [] for item in self._dict['Prerequisites']: if type(item) == str: pkg = None descr = str(item) else: name = item['Name'] if item.has_key('Version'): name = name + '-' + item['Version'] if item.has_key('Flavor'): name = name + '-' + item['Flavor'] pkg = self._db.find(name) if not pkg: descr = "Requires unknown %s"%name else: descr = pkg.description() rv.append((pkg, descr)) return rv | b1785136efdb8a4326b51b960cd628a20e7712f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1785136efdb8a4326b51b960cd628a20e7712f4/pimp.py |
fp = os.popen(cmd, "r") | dummy, fp = os.popen4(cmd, "r") dummy.close() | def _cmd(self, output, dir, *cmditems): """Internal routine to run a shell command in a given directory.""" cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems) if output: output.write("+ %s\n" % cmd) if NO_EXECUTE: return 0 fp = os.popen(cmd, "r") while 1: line = fp.readline() if not line: break if output: output.write(line) rv = fp.close() return rv | b1785136efdb8a4326b51b960cd628a20e7712f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1785136efdb8a4326b51b960cd628a20e7712f4/pimp.py |
cast = "(PyObject*(*)(void*))" | self.emit("{", depth) self.emit("int i, n = asdl_seq_LEN(%s);" % value, depth+1) self.emit("value = PyList_New(n);", depth+1) self.emit("if (!value) goto failed;", depth+1) self.emit("for(i = 0; i < n; i++)", depth+1) self.emit("PyList_SET_ITEM(value, i, ast2obj_%s((%s_ty)asdl_seq_GET(%s, i)));" % (field.type, field.type, value), depth+2, reflow=False) self.emit("}", depth) | def set(self, field, value, depth): if field.seq: if field.type.value == "cmpop": # XXX check that this cast is safe, i.e. works independent on whether # sizeof(cmpop_ty) != sizeof(void*) cast = "(PyObject*(*)(void*))" else: cast = "" self.emit("value = ast2obj_list(%s, %sast2obj_%s);" % (value, cast, field.type), depth) else: ctype = get_c_type(field.type) self.emit("value = ast2obj_%s(%s);" % (field.type, value), depth, reflow=False) | d7625dcb7aa3a06e0f767089841c5250c72d8cd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d7625dcb7aa3a06e0f767089841c5250c72d8cd7/asdl_c.py |
cast = "" self.emit("value = ast2obj_list(%s, %sast2obj_%s);" % (value, cast, field.type), depth) | self.emit("value = ast2obj_list(%s, ast2obj_%s);" % (value, field.type), depth) | def set(self, field, value, depth): if field.seq: if field.type.value == "cmpop": # XXX check that this cast is safe, i.e. works independent on whether # sizeof(cmpop_ty) != sizeof(void*) cast = "(PyObject*(*)(void*))" else: cast = "" self.emit("value = ast2obj_list(%s, %sast2obj_%s);" % (value, cast, field.type), depth) else: ctype = get_c_type(field.type) self.emit("value = ast2obj_%s(%s);" % (field.type, value), depth, reflow=False) | d7625dcb7aa3a06e0f767089841c5250c72d8cd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d7625dcb7aa3a06e0f767089841c5250c72d8cd7/asdl_c.py |
if not string.find(value, "%("): | if string.find(value, "%(") >= 0: | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. | 176e00333c9e869d226e3352b20e89b6db5d4019 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/176e00333c9e869d226e3352b20e89b6db5d4019/ConfigParser.py |
onoff = 0 else: onoff = 255 if self.barx: self.barx.HiliteControl(onoff) if self.bary: self.bary.HiliteControl(onoff) | if self.barx and self.barx_enabled: self.barx.HiliteControl(0) if self.bary and self.bary_enabled: self.bary.HiliteControl(0) else: if self.barx: self.barx.HiliteControl(255) if self.bary: self.bary.HiliteControl(255) | def do_activate(self, onoff, event): if onoff: onoff = 0 else: onoff = 255 if self.barx: self.barx.HiliteControl(onoff) if self.bary: self.bary.HiliteControl(onoff) | 3a0a0cb6a1371459e2660311fc8c04740045404b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3a0a0cb6a1371459e2660311fc8c04740045404b/FrameWork.py |
self.barx.SetControlValue(vx) | if vx == None: self.barx.HiliteControl(255) self.barx_enabled = 0 else: if not self.barx_enabled: self.barx_enabled = 1 if self.activated: self.barx.HiliteControl(0) self.barx.SetControlValue(vx) | def updatescrollbars(self): SetPort(self.wid) vx, vy = self.getscrollbarvalues() if self.barx: self.barx.SetControlValue(vx) if self.bary: self.bary.SetControlValue(vy) | 3a0a0cb6a1371459e2660311fc8c04740045404b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3a0a0cb6a1371459e2660311fc8c04740045404b/FrameWork.py |
self.bary.SetControlValue(vy) | if vy == None: self.bary.HiliteControl(255) self.bary_enabled = 0 else: if not self.bary_enabled: self.bary_enabled = 1 if self.activated: self.bary.HiliteControl(0) self.bary.SetControlValue(vy) def scalebarvalue(self, absmin, absmax, curmin, curmax): if curmin <= absmin and curmax >= absmax: return None if curmin <= absmin: return 0 if curmax >= absmax: return 32767 perc = float(curmin-absmin)/float(absmax-absmin) return int(perc*32767) | def updatescrollbars(self): SetPort(self.wid) vx, vy = self.getscrollbarvalues() if self.barx: self.barx.SetControlValue(vx) if self.bary: self.bary.SetControlValue(vy) | 3a0a0cb6a1371459e2660311fc8c04740045404b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3a0a0cb6a1371459e2660311fc8c04740045404b/FrameWork.py |
for i in range(3): | for count in range(3): | def test_trashcan(): # "trashcan" is a hack to prevent stack overflow when deallocating # very deeply nested tuples etc. It works in part by abusing the # type pointer and refcount fields, and that can yield horrible # problems when gc tries to traverse the structures. # If this test fails (as it does in 2.0, 2.1 and 2.2), it will # most likely die via segfault. gc.enable() N = 200 for i in range(3): t = [] for i in range(N): t = [t, Ouch()] u = [] for i in range(N): u = [u, Ouch()] v = {} for i in range(N): v = {1: v, 2: Ouch()} gc.disable() | 20979fcfa9b77a87a8feb76ab0e876750535db3a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/20979fcfa9b77a87a8feb76ab0e876750535db3a/test_gc.py |
if s1[-2:] == "\r\n": s1 = s1[:-2] + "\n" sys.stdout.write(s1) | sys.stdout.write(s1.replace("\r\n", "\n")) | def debug(msg): pass | b8c865079bb9b6ad5413c1651f04cbc95e8ee832 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b8c865079bb9b6ad5413c1651f04cbc95e8ee832/test_pty.py |
if s2[-2:] == "\r\n": s2 = s2[:-2] + "\n" sys.stdout.write(s2) | sys.stdout.write(s2.replace("\r\n", "\n")) | def debug(msg): pass | b8c865079bb9b6ad5413c1651f04cbc95e8ee832 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b8c865079bb9b6ad5413c1651f04cbc95e8ee832/test_pty.py |
"""Reset the list of warnings filters to its default state.""" | """Clear the list of warning filters, so that no filters are active.""" | def resetwarnings(): """Reset the list of warnings filters to its default state.""" filters[:] = [] | 33fa94b43504d9a37ce9e060a17fe174b17937de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/33fa94b43504d9a37ce9e060a17fe174b17937de/warnings.py |
pid, status = os.wait() | exited_pid, status = os.waitpid(pid, 0) | def test_lock_conflict(self): # Fork off a subprocess that will lock the file for 2 seconds, # unlock it, and then exit. if not hasattr(os, 'fork'): return pid = os.fork() if pid == 0: # In the child, lock the mailbox. self._box.lock() time.sleep(2) self._box.unlock() os._exit(0) | 32d40170bd00aad9ee16629400aefbd5e6ee7ba4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/32d40170bd00aad9ee16629400aefbd5e6ee7ba4/test_mailbox.py |
(typ, [data]) = <instance>.search(charset, criterium, ...) | (typ, [data]) = <instance>.search(charset, criterion, ...) | def search(self, charset, *criteria): """Search mailbox for matching messages. | 078199e1f0290a4bca5c1b4445c9cdad1a292955 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/078199e1f0290a4bca5c1b4445c9cdad1a292955/imaplib.py |
self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, | self.fp.write(struct.pack("<lLL", zinfo.CRC, zinfo.compress_size, | def write(self, filename, arcname=None, compress_type=None): """Put the bytes from filename into the archive under the name arcname.""" st = os.stat(filename) mtime = time.localtime(st.st_mtime) date_time = mtime[0:6] # Create ZipInfo instance to store file information if arcname is None: zinfo = ZipInfo(filename, date_time) else: zinfo = ZipInfo(arcname, date_time) zinfo.external_attr = (st[0] & 0xFFFF) << 16L # Unix attributes if compress_type is None: zinfo.compress_type = self.compression else: zinfo.compress_type = compress_type self._writecheck(zinfo) fp = open(filename, "rb") zinfo.flag_bits = 0x00 zinfo.header_offset = self.fp.tell() # Start of header bytes # Must overwrite CRC and sizes with correct data later zinfo.CRC = CRC = 0 zinfo.compress_size = compress_size = 0 zinfo.file_size = file_size = 0 self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes if zinfo.compress_type == ZIP_DEFLATED: cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) else: cmpr = None while 1: buf = fp.read(1024 * 8) if not buf: break file_size = file_size + len(buf) CRC = binascii.crc32(buf, CRC) if cmpr: buf = cmpr.compress(buf) compress_size = compress_size + len(buf) self.fp.write(buf) fp.close() if cmpr: buf = cmpr.flush() compress_size = compress_size + len(buf) self.fp.write(buf) zinfo.compress_size = compress_size else: zinfo.compress_size = file_size zinfo.CRC = CRC zinfo.file_size = file_size # Seek backwards and write CRC and file sizes position = self.fp.tell() # Preserve current position in file self.fp.seek(zinfo.header_offset + 14, 0) self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.fp.seek(position, 0) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo | d5ad59d11aca2ea7e4b85e9b3fc9d264e5679815 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d5ad59d11aca2ea7e4b85e9b3fc9d264e5679815/zipfile.py |
self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, | self.fp.write(struct.pack("<lLL", zinfo.CRC, zinfo.compress_size, | def writestr(self, zinfo_or_arcname, bytes): """Write a file into the archive. The contents is the string 'bytes'. 'zinfo_or_arcname' is either a ZipInfo instance or the name of the file in the archive.""" if not isinstance(zinfo_or_arcname, ZipInfo): zinfo = ZipInfo(filename=zinfo_or_arcname, date_time=time.localtime(time.time())) zinfo.compress_type = self.compression else: zinfo = zinfo_or_arcname self._writecheck(zinfo) zinfo.file_size = len(bytes) # Uncompressed size zinfo.CRC = binascii.crc32(bytes) # CRC-32 checksum if zinfo.compress_type == ZIP_DEFLATED: co = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) bytes = co.compress(bytes) + co.flush() zinfo.compress_size = len(bytes) # Compressed size else: zinfo.compress_size = zinfo.file_size zinfo.header_offset = self.fp.tell() # Start of header bytes self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes self.fp.write(bytes) if zinfo.flag_bits & 0x08: # Write CRC and file sizes after the file data self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo | d5ad59d11aca2ea7e4b85e9b3fc9d264e5679815 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d5ad59d11aca2ea7e4b85e9b3fc9d264e5679815/zipfile.py |
incomment = '' | instr = '' brackets = 0 | def checkline(self, filename, lineno): """Return line number of first line at or after input argument such that if the input points to a 'def', the returned line number is the first non-blank/non-comment line to follow. If the input points to a blank or comment line, return 0. At end of file, also return 0.""" | 323f97436d8fb14c49eb896cfe36a491b673ec1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/323f97436d8fb14c49eb896cfe36a491b673ec1f/pdb.py |
if incomment: if len(line) < 3: continue if (line[-3:] == incomment): incomment = '' continue | def checkline(self, filename, lineno): """Return line number of first line at or after input argument such that if the input points to a 'def', the returned line number is the first non-blank/non-comment line to follow. If the input points to a blank or comment line, return 0. At end of file, also return 0.""" | 323f97436d8fb14c49eb896cfe36a491b673ec1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/323f97436d8fb14c49eb896cfe36a491b673ec1f/pdb.py |
|
if len(line) >= 3: if (line[:3] == '"""' or line[:3] == "'''"): if line[-3:] == line[:3]: continue incomment = line[:3] continue if line[0] != ' | if brackets <= 0 and line[0] not in (' break | def checkline(self, filename, lineno): """Return line number of first line at or after input argument such that if the input points to a 'def', the returned line number is the first non-blank/non-comment line to follow. If the input points to a blank or comment line, return 0. At end of file, also return 0.""" | 323f97436d8fb14c49eb896cfe36a491b673ec1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/323f97436d8fb14c49eb896cfe36a491b673ec1f/pdb.py |
f.write("<title>Directory listing for %s</title>\n" % self.path) f.write("<h2>Directory listing for %s</h2>\n" % self.path) | displaypath = cgi.escape(urllib.unquote(self.path)) f.write("<title>Directory listing for %s</title>\n" % displaypath) f.write("<h2>Directory listing for %s</h2>\n" % displaypath) | def list_directory(self, path): """Helper to produce a directory listing (absent index.html). | db213a3d7cae4d97d5e1463a665ca2a1e462205c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db213a3d7cae4d97d5e1463a665ca2a1e462205c/SimpleHTTPServer.py |
print msg % args | if not args: print msg else: print msg % args | def _log(self, level, msg, args): if level >= self.threshold: print msg % args sys.stdout.flush() | 4d827c3bdcc9e72bfa3f5bbbc628bfd74ef2d33c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4d827c3bdcc9e72bfa3f5bbbc628bfd74ef2d33c/log.py |
key = (message, category, lineno) | if isinstance(message, Warning): text = str(message) category = message.__class__ else: text = message message = category(message) key = (text, category, lineno) | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.get(key): return # Search the filters for item in filters: action, msg, cat, mod, ln = item if (msg.match(message) and issubclass(category, cat) and mod.match(module) and (ln == 0 or lineno == ln)): break else: action = defaultaction # Early exit actions if action == "ignore": registry[key] = 1 return if action == "error": raise category(message) # Other actions if action == "once": registry[key] = 1 oncekey = (message, category) if onceregistry.get(oncekey): return onceregistry[oncekey] = 1 elif action == "always": pass elif action == "module": registry[key] = 1 altkey = (message, category, 0) if registry.get(altkey): return registry[altkey] = 1 elif action == "default": registry[key] = 1 else: # Unrecognized actions are errors raise RuntimeError( "Unrecognized action (%s) in warnings.filters:\n %s" % (`action`, str(item))) # Print message and context showwarning(message, category, filename, lineno) | 4b5db8774e9e35b3dbd80e62527491c251496ac9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4b5db8774e9e35b3dbd80e62527491c251496ac9/warnings.py |
if (msg.match(message) and | if (msg.match(text) and | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.get(key): return # Search the filters for item in filters: action, msg, cat, mod, ln = item if (msg.match(message) and issubclass(category, cat) and mod.match(module) and (ln == 0 or lineno == ln)): break else: action = defaultaction # Early exit actions if action == "ignore": registry[key] = 1 return if action == "error": raise category(message) # Other actions if action == "once": registry[key] = 1 oncekey = (message, category) if onceregistry.get(oncekey): return onceregistry[oncekey] = 1 elif action == "always": pass elif action == "module": registry[key] = 1 altkey = (message, category, 0) if registry.get(altkey): return registry[altkey] = 1 elif action == "default": registry[key] = 1 else: # Unrecognized actions are errors raise RuntimeError( "Unrecognized action (%s) in warnings.filters:\n %s" % (`action`, str(item))) # Print message and context showwarning(message, category, filename, lineno) | 4b5db8774e9e35b3dbd80e62527491c251496ac9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4b5db8774e9e35b3dbd80e62527491c251496ac9/warnings.py |
raise category(message) | raise message | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.get(key): return # Search the filters for item in filters: action, msg, cat, mod, ln = item if (msg.match(message) and issubclass(category, cat) and mod.match(module) and (ln == 0 or lineno == ln)): break else: action = defaultaction # Early exit actions if action == "ignore": registry[key] = 1 return if action == "error": raise category(message) # Other actions if action == "once": registry[key] = 1 oncekey = (message, category) if onceregistry.get(oncekey): return onceregistry[oncekey] = 1 elif action == "always": pass elif action == "module": registry[key] = 1 altkey = (message, category, 0) if registry.get(altkey): return registry[altkey] = 1 elif action == "default": registry[key] = 1 else: # Unrecognized actions are errors raise RuntimeError( "Unrecognized action (%s) in warnings.filters:\n %s" % (`action`, str(item))) # Print message and context showwarning(message, category, filename, lineno) | 4b5db8774e9e35b3dbd80e62527491c251496ac9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4b5db8774e9e35b3dbd80e62527491c251496ac9/warnings.py |
oncekey = (message, category) | oncekey = (text, category) | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.get(key): return # Search the filters for item in filters: action, msg, cat, mod, ln = item if (msg.match(message) and issubclass(category, cat) and mod.match(module) and (ln == 0 or lineno == ln)): break else: action = defaultaction # Early exit actions if action == "ignore": registry[key] = 1 return if action == "error": raise category(message) # Other actions if action == "once": registry[key] = 1 oncekey = (message, category) if onceregistry.get(oncekey): return onceregistry[oncekey] = 1 elif action == "always": pass elif action == "module": registry[key] = 1 altkey = (message, category, 0) if registry.get(altkey): return registry[altkey] = 1 elif action == "default": registry[key] = 1 else: # Unrecognized actions are errors raise RuntimeError( "Unrecognized action (%s) in warnings.filters:\n %s" % (`action`, str(item))) # Print message and context showwarning(message, category, filename, lineno) | 4b5db8774e9e35b3dbd80e62527491c251496ac9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4b5db8774e9e35b3dbd80e62527491c251496ac9/warnings.py |
altkey = (message, category, 0) | altkey = (text, category, 0) | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} key = (message, category, lineno) # Quick test for common case if registry.get(key): return # Search the filters for item in filters: action, msg, cat, mod, ln = item if (msg.match(message) and issubclass(category, cat) and mod.match(module) and (ln == 0 or lineno == ln)): break else: action = defaultaction # Early exit actions if action == "ignore": registry[key] = 1 return if action == "error": raise category(message) # Other actions if action == "once": registry[key] = 1 oncekey = (message, category) if onceregistry.get(oncekey): return onceregistry[oncekey] = 1 elif action == "always": pass elif action == "module": registry[key] = 1 altkey = (message, category, 0) if registry.get(altkey): return registry[altkey] = 1 elif action == "default": registry[key] = 1 else: # Unrecognized actions are errors raise RuntimeError( "Unrecognized action (%s) in warnings.filters:\n %s" % (`action`, str(item))) # Print message and context showwarning(message, category, filename, lineno) | 4b5db8774e9e35b3dbd80e62527491c251496ac9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4b5db8774e9e35b3dbd80e62527491c251496ac9/warnings.py |
exts.append( Extension('cPickle', ['cPickle.c']) ) | 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') | db5185a1a85cbca29ce61fcae3f1ab228b074f9d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db5185a1a85cbca29ce61fcae3f1ab228b074f9d/setup.py |
|
def _strxor(s1, s2): """Utility method. XOR the two strings s1 and s2 (must have same length). """ return "".join(map(lambda x, y: chr(ord(x) ^ ord(y)), s1, s2)) | trans_5C = "".join ([chr (x ^ 0x5C) for x in xrange(256)]) trans_36 = "".join ([chr (x ^ 0x36) for x in xrange(256)]) | def _strxor(s1, s2): """Utility method. XOR the two strings s1 and s2 (must have same length). """ return "".join(map(lambda x, y: chr(ord(x) ^ ord(y)), s1, s2)) | 19fd5d6556b975e2dfffc7ea32bc2251fc254594 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/19fd5d6556b975e2dfffc7ea32bc2251fc254594/hmac.py |
ipad = "\x36" * blocksize opad = "\x5C" * blocksize | def __init__(self, key, msg = None, digestmod = None): """Create a new HMAC object. | 19fd5d6556b975e2dfffc7ea32bc2251fc254594 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/19fd5d6556b975e2dfffc7ea32bc2251fc254594/hmac.py |
|
self.outer.update(_strxor(key, opad)) self.inner.update(_strxor(key, ipad)) | self.outer.update(key.translate(trans_5C)) self.inner.update(key.translate(trans_36)) | def __init__(self, key, msg = None, digestmod = None): """Create a new HMAC object. | 19fd5d6556b975e2dfffc7ea32bc2251fc254594 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/19fd5d6556b975e2dfffc7ea32bc2251fc254594/hmac.py |
use_statcache -- Do not stat() each file directly: go through the statcache module for more efficiency. | use_statcache -- obsolete argument. | 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 -- Do not stat() each file directly: go through the statcache module for more efficiency. Return value: True if the files are the same, False otherwise. This function uses a cache for past comparisons and the results, with a cache invalidation mechanism relying on stale signatures. Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. """ if use_statcache: stat_function = statcache.stat else: stat_function = os.stat s1 = _sig(stat_function(f1)) s2 = _sig(stat_function(f2)) if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG: return False if shallow and s1 == s2: return True if s1[1] != s2[1]: return False result = _cache.get((f1, f2)) if result and (s1, s2) == result[:2]: return result[2] outcome = _do_cmp(f1, f2) _cache[f1, f2] = s1, s2, outcome return outcome | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. | 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 -- Do not stat() each file directly: go through the statcache module for more efficiency. Return value: True if the files are the same, False otherwise. This function uses a cache for past comparisons and the results, with a cache invalidation mechanism relying on stale signatures. Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. """ if use_statcache: stat_function = statcache.stat else: stat_function = os.stat s1 = _sig(stat_function(f1)) s2 = _sig(stat_function(f2)) if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG: return False if shallow and s1 == s2: return True if s1[1] != s2[1]: return False result = _cache.get((f1, f2)) if result and (s1, s2) == result[:2]: return result[2] outcome = _do_cmp(f1, f2) _cache[f1, f2] = s1, s2, outcome return outcome | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
|
if use_statcache: stat_function = statcache.stat else: stat_function = os.stat s1 = _sig(stat_function(f1)) s2 = _sig(stat_function(f2)) | s1 = _sig(os.stat(f1)) s2 = _sig(os.stat(f2)) | 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 -- Do not stat() each file directly: go through the statcache module for more efficiency. Return value: True if the files are the same, False otherwise. This function uses a cache for past comparisons and the results, with a cache invalidation mechanism relying on stale signatures. Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. """ if use_statcache: stat_function = statcache.stat else: stat_function = os.stat s1 = _sig(stat_function(f1)) s2 = _sig(stat_function(f2)) if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG: return False if shallow and s1 == s2: return True if s1[1] != s2[1]: return False result = _cache.get((f1, f2)) if result and (s1, s2) == result[:2]: return result[2] outcome = _do_cmp(f1, f2) _cache[f1, f2] = s1, s2, outcome return outcome | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
a_stat = statcache.stat(a_path) | a_stat = os.stat(a_path) | def phase2(self): # Distinguish files, directories, funnies self.common_dirs = [] self.common_files = [] self.common_funny = [] | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
b_stat = statcache.stat(b_path) | b_stat = os.stat(b_path) | def phase2(self): # Distinguish files, directories, funnies self.common_dirs = [] self.common_files = [] self.common_funny = [] | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
use_statcache -- if true, use statcache.stat() instead of os.stat() | use_statcache -- obsolete argument | 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 -- if true, use statcache.stat() instead of os.stat() Returns a tuple of three lists: files that compare equal files that are different filenames that aren't regular files. """ res = ([], [], []) for x in common: ax = os.path.join(a, x) bx = os.path.join(b, x) res[_cmp(ax, bx, shallow, use_statcache)].append(x) return res | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
res[_cmp(ax, bx, shallow, use_statcache)].append(x) | res[_cmp(ax, bx, shallow)].append(x) | 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 -- if true, use statcache.stat() instead of os.stat() Returns a tuple of three lists: files that compare equal files that are different filenames that aren't regular files. """ res = ([], [], []) for x in common: ax = os.path.join(a, x) bx = os.path.join(b, x) res[_cmp(ax, bx, shallow, use_statcache)].append(x) return res | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
def _cmp(a, b, sh, st): | def _cmp(a, b, sh): | def _cmp(a, b, sh, st): try: return not abs(cmp(a, b, sh, st)) except os.error: return 2 | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
return not abs(cmp(a, b, sh, st)) | return not abs(cmp(a, b, sh)) | def _cmp(a, b, sh, st): try: return not abs(cmp(a, b, sh, st)) except os.error: return 2 | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py |
os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP) | os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP) os.chown(p, -1, gid) | def buildPython(): print "Building a universal python" buildDir = os.path.join(WORKDIR, '_bld', 'python') rootDir = os.path.join(WORKDIR, '_root') if os.path.exists(buildDir): shutil.rmtree(buildDir) if os.path.exists(rootDir): shutil.rmtree(rootDir) os.mkdir(buildDir) os.mkdir(rootDir) os.mkdir(os.path.join(rootDir, 'empty-dir')) curdir = os.getcwd() os.chdir(buildDir) # Not sure if this is still needed, the original build script # claims that parts of the install assume python.exe exists. os.symlink('python', os.path.join(buildDir, 'python.exe')) # Extract the version from the configure file, needed to calculate # several paths. version = getVersion() print "Running configure..." runCommand("%s -C --enable-framework --enable-universalsdk=%s LDFLAGS='-g -L%s/libraries/usr/local/lib' OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%( shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH), shellQuote(WORKDIR)[1:-1], shellQuote(WORKDIR)[1:-1])) print "Running make" runCommand("make") print "Runing make frameworkinstall" runCommand("make frameworkinstall DESTDIR=%s"%( shellQuote(rootDir))) print "Runing make frameworkinstallextras" runCommand("make frameworkinstallextras DESTDIR=%s"%( shellQuote(rootDir))) print "Copy required shared libraries" if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')): runCommand("mv %s/* %s"%( shellQuote(os.path.join( WORKDIR, 'libraries', 'Library', 'Frameworks', 'Python.framework', 'Versions', getVersion(), 'lib')), shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks', 'Python.framework', 'Versions', getVersion(), 'lib')))) print "Fix file modes" frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework') for dirpath, dirnames, filenames in os.walk(frmDir): for dn in dirnames: os.chmod(os.path.join(dirpath, dn), 0775) for fn in filenames: if os.path.islink(fn): continue # "chmod g+w $fn" p = os.path.join(dirpath, fn) st = os.stat(p) os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP) # We added some directories to the search path during the configure # phase. Remove those because those directories won't be there on # the end-users system. path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework', 'Versions', version, 'lib', 'python%s'%(version,), 'config', 'Makefile') fp = open(path, 'r') data = fp.read() fp.close() data = data.replace('-L%s/libraries/usr/local/lib'%(WORKDIR,), '') data = data.replace('-I%s/libraries/usr/local/include'%(WORKDIR,), '') fp = open(path, 'w') fp.write(data) fp.close() # Add symlinks in /usr/local/bin, using relative links usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin') to_framework = os.path.join('..', '..', '..', 'Library', 'Frameworks', 'Python.framework', 'Versions', version, 'bin') if os.path.exists(usr_local_bin): shutil.rmtree(usr_local_bin) os.makedirs(usr_local_bin) for fn in os.listdir( os.path.join(frmDir, 'Versions', version, 'bin')): os.symlink(os.path.join(to_framework, fn), os.path.join(usr_local_bin, fn)) os.chdir(curdir) | e31d2b6c38a808633a54b26c053bad00dd2f36f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e31d2b6c38a808633a54b26c053bad00dd2f36f8/build-installer.py |
else: raise ValueError, "zero step for randrange()" | else: raise ValueError, "zero step for randrange()" | def randrange(self, start, stop=None, step=1, # Do not supply the following arguments int=int, default=None): # This code is a bit messy to make it fast for the # common case while still doing adequate error checking istart = int(start) if istart != start: raise ValueError, "non-integer arg 1 for randrange()" if stop is default: if istart > 0: return int(self.random() * istart) raise ValueError, "empty range for randrange()" istop = int(stop) if istop != stop: raise ValueError, "non-integer stop for randrange()" if step == 1: if istart < istop: return istart + int(self.random() * (istop - istart)) raise ValueError, "empty range for randrange()" istep = int(step) if istep != step: raise ValueError, "non-integer step for randrange()" if istep > 0: n = (istop - istart + istep - 1) / istep elif istep < 0: n = (istop - istart + istep + 1) / istep else: raise ValueError, "zero step for randrange()" | 26407823b5acb5818812c7b910e107a3df035903 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/26407823b5acb5818812c7b910e107a3df035903/whrandom.py |
if n <= 0: raise ValueError, "empty range for randrange()" return istart + istep*int(self.random() * n) | if n <= 0: raise ValueError, "empty range for randrange()" return istart + istep*int(self.random() * n) | def randrange(self, start, stop=None, step=1, # Do not supply the following arguments int=int, default=None): # This code is a bit messy to make it fast for the # common case while still doing adequate error checking istart = int(start) if istart != start: raise ValueError, "non-integer arg 1 for randrange()" if stop is default: if istart > 0: return int(self.random() * istart) raise ValueError, "empty range for randrange()" istop = int(stop) if istop != stop: raise ValueError, "non-integer stop for randrange()" if step == 1: if istart < istop: return istart + int(self.random() * (istop - istart)) raise ValueError, "empty range for randrange()" istep = int(step) if istep != step: raise ValueError, "non-integer step for randrange()" if istep > 0: n = (istop - istart + istep - 1) / istep elif istep < 0: n = (istop - istart + istep + 1) / istep else: raise ValueError, "zero step for randrange()" | 26407823b5acb5818812c7b910e107a3df035903 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/26407823b5acb5818812c7b910e107a3df035903/whrandom.py |
print '%s started at %s\n\tLocal addr: %s\n\tRemote addr:%s' % ( | print >> DEBUGSTREAM, \ '%s started at %s\n\tLocal addr: %s\n\tRemote addr:%s' % ( | def __init__(self, localaddr, remoteaddr): self._localaddr = localaddr self._remoteaddr = remoteaddr asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) # try to re-use a server port if possible self.socket.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1) self.bind(localaddr) self.listen(5) print '%s started at %s\n\tLocal addr: %s\n\tRemote addr:%s' % ( self.__class__.__name__, time.ctime(time.time()), localaddr, remoteaddr) | b245089c177ff545f3a46232d597df0d56ad62bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b245089c177ff545f3a46232d597df0d56ad62bd/smtpd.py |
if (not rframe is frame) and rcur: | if (rframe is frame) and rcur: | def trace_dispatch_exception(self, frame, t): rt, rtt, rct, rfn, rframe, rcur = self.cur if (not rframe is frame) and rcur: return self.trace_dispatch_return(rframe, t) return 0 | f9d3358e38a378bd257ee42cc2d9fe0e383091b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f9d3358e38a378bd257ee42cc2d9fe0e383091b3/profile.py |
def newgroups(self, date, time): | def newgroups(self, date, time, file=None): | def newgroups(self, date, time): """Process a NEWGROUPS command. Arguments: - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of newsgroup names""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
return self.longcmd('NEWGROUPS ' + date + ' ' + time) def newnews(self, group, date, time): | return self.longcmd('NEWGROUPS ' + date + ' ' + time, file) def newnews(self, group, date, time, file=None): | def newgroups(self, date, time): """Process a NEWGROUPS command. Arguments: - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of newsgroup names""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
return self.longcmd(cmd) def list(self): | return self.longcmd(cmd, file) def list(self, file=None): | def newnews(self, group, date, time): """Process a NEWNEWS command. Arguments: - group: group name or '*' - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of article ids""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
resp, list = self.longcmd('LIST') | resp, list = self.longcmd('LIST', file) | def list(self): """Process a LIST command. Return: - resp: server response if successful - list: list of (group, last, first, flag) (strings)""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
def help(self): | def help(self, file=None): | def help(self): """Process a HELP command. Returns: - resp: server response if successful - list: list of strings""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
return self.longcmd('HELP') | return self.longcmd('HELP',file) | def help(self): """Process a HELP command. Returns: - resp: server response if successful - list: list of strings""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
def xhdr(self, hdr, str): | def xhdr(self, hdr, str, file=None): | def xhdr(self, hdr, str): """Process an XHDR command (optional server extension). Arguments: - hdr: the header type (e.g. 'subject') - str: an article nr, a message id, or a range nr1-nr2 Returns: - resp: server response if successful - list: list of (nr, value) strings""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str) | resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str, file) | def xhdr(self, hdr, str): """Process an XHDR command (optional server extension). Arguments: - hdr: the header type (e.g. 'subject') - str: an article nr, a message id, or a range nr1-nr2 Returns: - resp: server response if successful - list: list of (nr, value) strings""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
def xover(self,start,end): | def xover(self, start, end, file=None): | def xover(self,start,end): """Process an XOVER command (optional server extension) Arguments: - start: start of range - end: end of range Returns: - resp: server response if successful - list: list of (art-nr, subject, poster, date, id, references, size, lines)""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
resp, lines = self.longcmd('XOVER ' + start + '-' + end) | resp, lines = self.longcmd('XOVER ' + start + '-' + end, file) | def xover(self,start,end): """Process an XOVER command (optional server extension) Arguments: - start: start of range - end: end of range Returns: - resp: server response if successful - list: list of (art-nr, subject, poster, date, id, references, size, lines)""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
def xgtitle(self, group): | def xgtitle(self, group, file=None): | def xgtitle(self, group): """Process an XGTITLE command (optional server extension) Arguments: - group: group name wildcard (i.e. news.*) Returns: - resp: server response if successful - list: list of (name,title) strings""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
resp, raw_lines = self.longcmd('XGTITLE ' + group) | resp, raw_lines = self.longcmd('XGTITLE ' + group, file) | def xgtitle(self, group): """Process an XGTITLE command (optional server extension) Arguments: - group: group name wildcard (i.e. news.*) Returns: - resp: server response if successful - list: list of (name,title) strings""" | bf414590658c8878c0a27cbcf1dda4738d4ce7e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf414590658c8878c0a27cbcf1dda4738d4ce7e0/nntplib.py |
if isinstance(s, StringType): | if isinstance(s, str): | def _is8bitstring(s): if isinstance(s, StringType): try: unicode(s, 'us-ascii') except UnicodeError: return True return False | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
self.__maxheaderlen = maxheaderlen | self._maxheaderlen = maxheaderlen | def __init__(self, outfp, mangle_from_=True, maxheaderlen=78): """Create the generator for message flattening. | 06f820621b37df5c977e2d2239c494cb51a805fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06f820621b37df5c977e2d2239c494cb51a805fb/Generator.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.