rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
for cmd in config('ALL', 'before'):
for cmd in config('ALL', 'before'):
def write_env(bld, cwd, cname): # write out env.csh for people who haven't yet learned bash env_name = os.path.join(cwd, 'env.csh') f = open(env_name, 'w') for cmd in config('ALL', 'before'): f.write('%s\n' % cmd) print >> f, "setenv LD_LIBRARY_PATH " + bld.libdir + ":$LD_LIBRARY_PATH" try: if os.environ['PYTHONPATH']: print >> f, "setenv PYTHONPATH " + os.environ['PYTHONPATH'] except: pass print >> f, "setenv PATH %s:$PATH" % bld.bindir print >> f, "\n# Need this to recompile MPM in its directory." print >> f, "setenv MEMOSA_CONFNAME %s" % cname f.close() # write out env.sh env_name = os.path.join(cwd, 'env.sh') f = open(env_name, 'w') for cmd in config('ALL', 'before'): f.write('%s\n' % cmd) print >> f, "export LD_LIBRARY_PATH=" + bld.libdir + ":$LD_LIBRARY_PATH" try: if os.environ['PYTHONPATH']: print >> f, "export PYTHONPATH=" + os.environ['PYTHONPATH'] except: pass print >> f, "export PATH=%s:$PATH" % bld.bindir print >> f, "\n# Need this to recompile MPM in its directory." print >> f, "export MEMOSA_CONFNAME=%s" % cname f.close() return env_name
a5007a3ab5f62ac54c5e9c16690c8526cad323ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/a5007a3ab5f62ac54c5e9c16690c8526cad323ba/build_utils.py
self.faceNodesCoord = self.geomField.coordinate[self.mesh.getCells()].newSizedClone( self.nfaces.sum()*4 )
SIZE = int(self.nfaces.sum()*4) self.faceNodesCoord = self.geomField.coordinate[self.mesh.getCells()].newSizedClone( SIZE )
def acceptMPM( self, istep): if ( istep%self.couplingStep == 0 ): #gettin nlocalfaces from MPM ( len(nlocalfaces) = remote_comm_world.size() )
90f2566eeb714efb8dcd05942e578978e4547e55 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/90f2566eeb714efb8dcd05942e578978e4547e55/FluidStructure.py
self.FaceCentroidVels = self.geomField.coordinate[self.mesh.getCells()].newSizedClone( self.nfaces.sum() )
SIZE = int(self.nfaces.sum()) self.FaceCentroidVels = self.geomField.coordinate[self.mesh.getCells()].newSizedClone( SIZE )
def acceptMPM( self, istep): if ( istep%self.couplingStep == 0 ): #gettin nlocalfaces from MPM ( len(nlocalfaces) = remote_comm_world.size() )
90f2566eeb714efb8dcd05942e578978e4547e55 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/90f2566eeb714efb8dcd05942e578978e4547e55/FluidStructure.py
def setBaseVars(env,cla): for o in optionsList: env[o[0]] = o[1] for k,v in cla.iteritems(): if v in ['True','true']: v = True elif v in ['False', 'false']: v = False env[k] = v env['DEBUG'] = env['VERSION'] == 'debug' env['ARCH'] = Arch.getArch() sconstructDir = os.path.abspath(str(env.fs.SConstruct_dir)) #print sconstructDir env['TOPDIR'] = sconstructDir env['SRCDIR'] = '$TOPDIR/src' if env['BUILDDIR'] is None: env['BUILDDIR'] = '$TOPDIR/build' if isinstance(env['ATYPES'],types.StringType): env['ATYPES'] = [atype.lower() for atype in env['ATYPES'].split(',')] # Third-party packages directory variables if env['PACKAGESDIR'] is None: env['PACKAGESDIR'] = '$TOPDIR/packages/$ARCH' env['PACKAGESLIBDIR'] = '$PACKAGESDIR/lib' # Propagate the following env variables for var in ['TMP', 'TEMP', 'LD_LIBRARY_PATH', 'PATH']: if var in os.environ: env['ENV'][var] = os.environ[var] # Redefine command string variables for compact output. if env['COMPACTOUTPUT']: for var in ['SHCXXCOMSTR', 'CXXCOMSTR', 'CCCOMSTR', 'SHCCCOMSTR']: env[var] = 'Compiling $SOURCE' for var in ['SHLINKCOMSTR', 'LINKCOMSTR', 'LDMODULECOMSTR']: env[var] = 'Linking $TARGET' env['SWIGCOMSTR'] = 'Building swig module for $SOURCE'
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def setBaseVars(env,cla): for o in optionsList: env[o[0]] = o[1] for k,v in cla.iteritems(): if v in ['True','true']: v = True elif v in ['False', 'false']: v = False env[k] = v env['DEBUG'] = env['VERSION'] == 'debug' env['ARCH'] = Arch.getArch() sconstructDir = os.path.abspath(str(env.fs.SConstruct_dir)) #print sconstructDir env['TOPDIR'] = sconstructDir env['SRCDIR'] = '$TOPDIR/src' if env['BUILDDIR'] is None: env['BUILDDIR'] = '$TOPDIR/build' if isinstance(env['ATYPES'],types.StringType): env['ATYPES'] = [atype.lower() for atype in env['ATYPES'].split(',')] # Third-party packages directory variables if env['PACKAGESDIR'] is None: env['PACKAGESDIR'] = '$TOPDIR/packages/$ARCH' env['PACKAGESLIBDIR'] = '$PACKAGESDIR/lib' # Propagate the following env variables for var in ['TMP', 'TEMP', 'LD_LIBRARY_PATH', 'PATH']: if var in os.environ: env['ENV'][var] = os.environ[var] # Redefine command string variables for compact output. if env['COMPACTOUTPUT']: for var in ['SHCXXCOMSTR', 'CXXCOMSTR', 'CCCOMSTR', 'SHCCCOMSTR']: env[var] = 'Compiling $SOURCE' for var in ['SHLINKCOMSTR', 'LINKCOMSTR', 'LDMODULECOMSTR']: env[var] = 'Linking $TARGET' env['SWIGCOMSTR'] = 'Building swig module for $SOURCE'
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def setBaseVars(env,cla): for o in optionsList: env[o[0]] = o[1] for k,v in cla.iteritems(): if v in ['True','true']: v = True elif v in ['False', 'false']: v = False env[k] = v env['DEBUG'] = env['VERSION'] == 'debug' env['ARCH'] = Arch.getArch() sconstructDir = os.path.abspath(str(env.fs.SConstruct_dir)) #print sconstructDir env['TOPDIR'] = sconstructDir env['SRCDIR'] = '$TOPDIR/src' if env['BUILDDIR'] is None: env['BUILDDIR'] = '$TOPDIR/build' if isinstance(env['ATYPES'],types.StringType): env['ATYPES'] = [atype.lower() for atype in env['ATYPES'].split(',')] # Third-party packages directory variables if env['PACKAGESDIR'] is None: env['PACKAGESDIR'] = '$TOPDIR/packages/$ARCH' env['PACKAGESLIBDIR'] = '$PACKAGESDIR/lib' # Propagate the following env variables for var in ['TMP', 'TEMP', 'LD_LIBRARY_PATH', 'PATH']: if var in os.environ: env['ENV'][var] = os.environ[var] # Redefine command string variables for compact output. if env['COMPACTOUTPUT']: for var in ['SHCXXCOMSTR', 'CXXCOMSTR', 'CCCOMSTR', 'SHCCCOMSTR']: env[var] = 'Compiling $SOURCE' for var in ['SHLINKCOMSTR', 'LINKCOMSTR', 'LDMODULECOMSTR']: env[var] = 'Linking $TARGET' env['SWIGCOMSTR'] = 'Building swig module for $SOURCE'
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def setVersionPaths(env): env['BUILDVERSION'] = '$COMPILER/$VERSION' env['BUILDVERSIONDIR'] = '$BUILDDIR/$ARCH/$BUILDVERSION' env['AUTOGENDIR'] = '$BUILDVERSIONDIR/autogen' buildvdir = os.path.join(env['TOPDIR'], env.GetBuildPath('$BUILDVERSIONDIR')) if not os.access(buildvdir,os.F_OK): os.makedirs(buildvdir)
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def __init__(self, platform=None, **kwargs): SConsEnvironment.__init__(self, platform=platform, tools=[])
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def __init__(self, platform=None, **kwargs): SConsEnvironment.__init__(self, platform=platform, tools=[])
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def __init__(self, platform=None, **kwargs): SConsEnvironment.__init__(self, platform=platform, tools=[])
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def __init__(self, platform=None, **kwargs): SConsEnvironment.__init__(self, platform=platform, tools=[])
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def constructComponents(self): for component, dir in self._compDirMap.iteritems(): env = self.myClone(newTargets=True)
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def createATypedSharedLibrary(self, target, sources=[], deplibs=[], skip=[],**kwargs): env = self.myClone()
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def createSwigModule(self, target, sources=[], deplibs=[], atype=None,**kwargs):
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
env.AppendUnique(CPPDEFINES='RLOG_COMPONENT=%s' % target[1:-3])
env.AppendUnique(CPPDEFINES='RLOG_COMPONENT=%s' % target)
def createSwigModule(self, target, sources=[], deplibs=[], atype=None,**kwargs):
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def createATypedSwigModule(self, target, sources=[], deplibs=[], skip=[],**kwargs): env = self.myClone() env.loadTools(['swig'])
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def createATypedSwigModule(self, target, sources=[], deplibs=[], skip=[],**kwargs): env = self.myClone() env.loadTools(['swig'])
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
def _addTarget(self, nodes): self._targets.extend(nodes)
384884704f6685904738ccc28ab82582c61a055f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5963/384884704f6685904738ccc28ab82582c61a055f/MyEnv.py
print row['baseurl'] + row['path'],
print row['baseurl'].rstrip('/') + '/' + row['path'],
def do_file(self, subcmd, opts, action, path): """${cmd_name}: operations on files: ls/rm/add
a8d8e09f4e81b46d4c2e1d7e2b0032729063ca80 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/a8d8e09f4e81b46d4c2e1d7e2b0032729063ca80/mirrordoctor.py
class HashBag():
class HashBag:
def __str__(self): return self.basename
abba5fa0260aad38a6397a79ef58c777e304c3ff /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/abba5fa0260aad38a6397a79ef58c777e304c3ff/hashes.py
if missing: query = """select distinct(mirrors) from filearr where path not like '%s%%'""" % path else: query = """select distinct(mirrors) from filearr where path like '%s%%'""" % path
query = """select distinct(mirrors) from filearr where path like '%s%%'""" % path
def dir_show_mirrors(conn, path, missing=False): """Show mirrors on which a certain directory path was found. The path could actually also be a file, it doesn't matter, but directory is what we are looking for in the context that this function was written for. """ if missing: query = """select distinct(mirrors) from filearr where path not like '%s%%'""" % path else: query = """select distinct(mirrors) from filearr where path like '%s%%'""" % path result = conn.Server._connection.queryAll(query) mirror_ids = [] for i in result: i = i[0] for mirror_id in i: mirror_id = str(mirror_id) if mirror_id not in mirror_ids: mirror_ids.append(mirror_id) if not mirror_ids: return [] query = """select identifier from server where id in (%s)""" % ','.join(mirror_ids) result = conn.Server._connection.queryAll(query) return result
e413a6b1cc529cdea79698ac054cbe6c7708441c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/e413a6b1cc529cdea79698ac054cbe6c7708441c/files.py
query = """select identifier from server where id in (%s)""" % ','.join(mirror_ids)
if not missing: query = """select identifier from server where id in (%s)""" % ','.join(mirror_ids) else: query = """select identifier from server where id not in (%s)""" % ','.join(mirror_ids)
def dir_show_mirrors(conn, path, missing=False): """Show mirrors on which a certain directory path was found. The path could actually also be a file, it doesn't matter, but directory is what we are looking for in the context that this function was written for. """ if missing: query = """select distinct(mirrors) from filearr where path not like '%s%%'""" % path else: query = """select distinct(mirrors) from filearr where path like '%s%%'""" % path result = conn.Server._connection.queryAll(query) mirror_ids = [] for i in result: i = i[0] for mirror_id in i: mirror_id = str(mirror_id) if mirror_id not in mirror_ids: mirror_ids.append(mirror_id) if not mirror_ids: return [] query = """select identifier from server where id in (%s)""" % ','.join(mirror_ids) result = conn.Server._connection.queryAll(query) return result
e413a6b1cc529cdea79698ac054cbe6c7708441c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/e413a6b1cc529cdea79698ac054cbe6c7708441c/files.py
if not new_dict[i]:
if not old_dict[i] and not new_dict[i]:
def do_edit(self, subcmd, opts, identifier): """${cmd_name}: edit a new mirror entry in $EDITOR
0adb75d22b039983a7f38e3351ec2d7d7f5d3e3e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/0adb75d22b039983a7f38e3351ec2d7d7f5d3e3e/mb.py
elif str(old_dict[i]) != new_dict[i]: print """changing %s from '%s' to '%s'""" \ % (i, old_dict[i], new_dict[i])
if ( old_dict[i] and not new_dict[i] ) or \ ( str(old_dict[i]) != new_dict[i] ): if not new_dict[i]: print 'unsetting %s (was: %r)' % (i, old_dict[i]) else: print 'changing %s from %r to %r' % (i, old_dict[i], new_dict[i])
def do_edit(self, subcmd, opts, identifier): """${cmd_name}: edit a new mirror entry in $EDITOR
0adb75d22b039983a7f38e3351ec2d7d7f5d3e3e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/0adb75d22b039983a7f38e3351ec2d7d7f5d3e3e/mb.py
logging.debug("%s probing %s" % (threading.currentThread().getName(), mirror.identifier)) req = urllib2.Request(mirror.baseurl) req.add_header('User-Agent', USER_AGENT) mirror.status_baseurl_new = False mirror.timed_out = True mirror.response_code = None mirror.response = None if mirror.baseurl == '': return None
def probe_http(mirror): """Try to reach host at baseurl. Set status_baseurl_new.""" logging.debug("%s probing %s" % (threading.currentThread().getName(), mirror.identifier)) #req = urllib2.Request('http://old-cherry.suse.de') # never works #req = urllib2.Request('http://doozer.poeml.de/') # always works req = urllib2.Request(mirror.baseurl) req.add_header('User-Agent', USER_AGENT) #req.get_method = lambda: "HEAD" mirror.status_baseurl_new = False mirror.timed_out = True mirror.response_code = None mirror.response = None if mirror.baseurl == '': return None try: response = urllib2.urlopen(req) try: mirror.response_code = response.code # if the web server redirects to an ftp:// URL, our response won't have a code attribute # (except we are going via a proxy) except AttributeError: if response.url.startswith('ftp://'): # count as success mirror.response_code = 200 logging.debug('mirror %s redirects to ftp:// URL' % mirror.identifier) logging.debug('%s got response for %s: %s' % (threading.currentThread().getName(), mirror.identifier, getattr(response, 'code', None))) mirror.response = response.read() mirror.status_baseurl_new = True except ValueError, e: if str(e).startswith('invalid literal for int()'): mirror.response = 'response not read due to http://bugs.python.org/issue1205' logging.info('mirror %s sends broken chunked reply, see http://bugs.python.org/issue1205' % mirror.identifier) except socket.timeout, e: mirror.response = 'socket timeout in reading response: %s' % e except socket.error, e: #errno, errstr = sys.exc_info()[:2] mirror.response = "socket error: %s" % e except httplib.BadStatusLine: mirror.response_code = None mirror.response = None except urllib2.HTTPError, e: mirror.response_code = e.code mirror.response = e.read() except urllib2.URLError, e: mirror.response_code = 0 mirror.response = "%s" % e.reason except IOError, e: # IOError: [Errno ftp error] (111, 'Connection refused') if e.errno == 'ftp error': mirror.response_code = 0 mirror.response = "%s: %s" % (e.errno, e.strerror) else: print mirror.identifier, mirror.baseurl, 'errno:', e.errno raise except: print mirror.identifier, mirror.baseurl raise # not reached, if the timeout goes off mirror.timed_out = False
b20f288cec1c1dc546330c2c42363394bd60eca2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/b20f288cec1c1dc546330c2c42363394bd60eca2/mirrorprobe.py
response = urllib2.urlopen(req) try: mirror.response_code = response.code except AttributeError: if response.url.startswith('ftp://'): mirror.response_code = 200 logging.debug('mirror %s redirects to ftp:// URL' % mirror.identifier) logging.debug('%s got response for %s: %s' % (threading.currentThread().getName(), mirror.identifier, getattr(response, 'code', None))) mirror.response = response.read() mirror.status_baseurl_new = True except ValueError, e: if str(e).startswith('invalid literal for int()'): mirror.response = 'response not read due to http://bugs.python.org/issue1205' logging.info('mirror %s sends broken chunked reply, see http://bugs.python.org/issue1205' % mirror.identifier) except socket.timeout, e: mirror.response = 'socket timeout in reading response: %s' % e except socket.error, e: mirror.response = "socket error: %s" % e except httplib.BadStatusLine:
logging.debug("%s probing %s" % (threading.currentThread().getName(), mirror.identifier)) req = urllib2.Request(mirror.baseurl) req.add_header('User-Agent', USER_AGENT) mirror.status_baseurl_new = False mirror.timed_out = True
def probe_http(mirror): """Try to reach host at baseurl. Set status_baseurl_new.""" logging.debug("%s probing %s" % (threading.currentThread().getName(), mirror.identifier)) #req = urllib2.Request('http://old-cherry.suse.de') # never works #req = urllib2.Request('http://doozer.poeml.de/') # always works req = urllib2.Request(mirror.baseurl) req.add_header('User-Agent', USER_AGENT) #req.get_method = lambda: "HEAD" mirror.status_baseurl_new = False mirror.timed_out = True mirror.response_code = None mirror.response = None if mirror.baseurl == '': return None try: response = urllib2.urlopen(req) try: mirror.response_code = response.code # if the web server redirects to an ftp:// URL, our response won't have a code attribute # (except we are going via a proxy) except AttributeError: if response.url.startswith('ftp://'): # count as success mirror.response_code = 200 logging.debug('mirror %s redirects to ftp:// URL' % mirror.identifier) logging.debug('%s got response for %s: %s' % (threading.currentThread().getName(), mirror.identifier, getattr(response, 'code', None))) mirror.response = response.read() mirror.status_baseurl_new = True except ValueError, e: if str(e).startswith('invalid literal for int()'): mirror.response = 'response not read due to http://bugs.python.org/issue1205' logging.info('mirror %s sends broken chunked reply, see http://bugs.python.org/issue1205' % mirror.identifier) except socket.timeout, e: mirror.response = 'socket timeout in reading response: %s' % e except socket.error, e: #errno, errstr = sys.exc_info()[:2] mirror.response = "socket error: %s" % e except httplib.BadStatusLine: mirror.response_code = None mirror.response = None except urllib2.HTTPError, e: mirror.response_code = e.code mirror.response = e.read() except urllib2.URLError, e: mirror.response_code = 0 mirror.response = "%s" % e.reason except IOError, e: # IOError: [Errno ftp error] (111, 'Connection refused') if e.errno == 'ftp error': mirror.response_code = 0 mirror.response = "%s: %s" % (e.errno, e.strerror) else: print mirror.identifier, mirror.baseurl, 'errno:', e.errno raise except: print mirror.identifier, mirror.baseurl raise # not reached, if the timeout goes off mirror.timed_out = False
b20f288cec1c1dc546330c2c42363394bd60eca2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/b20f288cec1c1dc546330c2c42363394bd60eca2/mirrorprobe.py
except urllib2.HTTPError, e: mirror.response_code = e.code mirror.response = e.read() except urllib2.URLError, e: mirror.response_code = 0 mirror.response = "%s" % e.reason except IOError, e: if e.errno == 'ftp error':
if mirror.baseurl == '': return None try: response = urllib2.urlopen(req) try: mirror.response_code = response.code except AttributeError: if response.url.startswith('ftp://'): mirror.response_code = 200 logging.debug('mirror %s redirects to ftp:// URL' % mirror.identifier) logging.debug('%s got response for %s: %s' % (threading.currentThread().getName(), mirror.identifier, getattr(response, 'code', None))) mirror.response = response.read() mirror.status_baseurl_new = True except ValueError, e: if str(e).startswith('invalid literal for int()'): mirror.response = 'response not read due to http://bugs.python.org/issue1205' logging.info('mirror %s sends broken chunked reply, see http://bugs.python.org/issue1205' % mirror.identifier) except socket.timeout, e: mirror.response = 'socket timeout in reading response: %s' % e except socket.error, e: mirror.response = "socket error: %s" % e except httplib.BadStatusLine: mirror.response_code = None mirror.response = None except urllib2.HTTPError, e: mirror.response_code = e.code mirror.response = e.read() except urllib2.URLError, e:
def probe_http(mirror): """Try to reach host at baseurl. Set status_baseurl_new.""" logging.debug("%s probing %s" % (threading.currentThread().getName(), mirror.identifier)) #req = urllib2.Request('http://old-cherry.suse.de') # never works #req = urllib2.Request('http://doozer.poeml.de/') # always works req = urllib2.Request(mirror.baseurl) req.add_header('User-Agent', USER_AGENT) #req.get_method = lambda: "HEAD" mirror.status_baseurl_new = False mirror.timed_out = True mirror.response_code = None mirror.response = None if mirror.baseurl == '': return None try: response = urllib2.urlopen(req) try: mirror.response_code = response.code # if the web server redirects to an ftp:// URL, our response won't have a code attribute # (except we are going via a proxy) except AttributeError: if response.url.startswith('ftp://'): # count as success mirror.response_code = 200 logging.debug('mirror %s redirects to ftp:// URL' % mirror.identifier) logging.debug('%s got response for %s: %s' % (threading.currentThread().getName(), mirror.identifier, getattr(response, 'code', None))) mirror.response = response.read() mirror.status_baseurl_new = True except ValueError, e: if str(e).startswith('invalid literal for int()'): mirror.response = 'response not read due to http://bugs.python.org/issue1205' logging.info('mirror %s sends broken chunked reply, see http://bugs.python.org/issue1205' % mirror.identifier) except socket.timeout, e: mirror.response = 'socket timeout in reading response: %s' % e except socket.error, e: #errno, errstr = sys.exc_info()[:2] mirror.response = "socket error: %s" % e except httplib.BadStatusLine: mirror.response_code = None mirror.response = None except urllib2.HTTPError, e: mirror.response_code = e.code mirror.response = e.read() except urllib2.URLError, e: mirror.response_code = 0 mirror.response = "%s" % e.reason except IOError, e: # IOError: [Errno ftp error] (111, 'Connection refused') if e.errno == 'ftp error': mirror.response_code = 0 mirror.response = "%s: %s" % (e.errno, e.strerror) else: print mirror.identifier, mirror.baseurl, 'errno:', e.errno raise except: print mirror.identifier, mirror.baseurl raise # not reached, if the timeout goes off mirror.timed_out = False
b20f288cec1c1dc546330c2c42363394bd60eca2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/b20f288cec1c1dc546330c2c42363394bd60eca2/mirrorprobe.py
mirror.response = "%s: %s" % (e.errno, e.strerror) else: print mirror.identifier, mirror.baseurl, 'errno:', e.errno
mirror.response = "%s" % e.reason except IOError, e: if e.errno == 'ftp error': mirror.response_code = 0 mirror.response = "%s: %s" % (e.errno, e.strerror) else: print mirror.identifier, mirror.baseurl, 'errno:', e.errno raise except: print mirror.identifier, mirror.baseurl
def probe_http(mirror): """Try to reach host at baseurl. Set status_baseurl_new.""" logging.debug("%s probing %s" % (threading.currentThread().getName(), mirror.identifier)) #req = urllib2.Request('http://old-cherry.suse.de') # never works #req = urllib2.Request('http://doozer.poeml.de/') # always works req = urllib2.Request(mirror.baseurl) req.add_header('User-Agent', USER_AGENT) #req.get_method = lambda: "HEAD" mirror.status_baseurl_new = False mirror.timed_out = True mirror.response_code = None mirror.response = None if mirror.baseurl == '': return None try: response = urllib2.urlopen(req) try: mirror.response_code = response.code # if the web server redirects to an ftp:// URL, our response won't have a code attribute # (except we are going via a proxy) except AttributeError: if response.url.startswith('ftp://'): # count as success mirror.response_code = 200 logging.debug('mirror %s redirects to ftp:// URL' % mirror.identifier) logging.debug('%s got response for %s: %s' % (threading.currentThread().getName(), mirror.identifier, getattr(response, 'code', None))) mirror.response = response.read() mirror.status_baseurl_new = True except ValueError, e: if str(e).startswith('invalid literal for int()'): mirror.response = 'response not read due to http://bugs.python.org/issue1205' logging.info('mirror %s sends broken chunked reply, see http://bugs.python.org/issue1205' % mirror.identifier) except socket.timeout, e: mirror.response = 'socket timeout in reading response: %s' % e except socket.error, e: #errno, errstr = sys.exc_info()[:2] mirror.response = "socket error: %s" % e except httplib.BadStatusLine: mirror.response_code = None mirror.response = None except urllib2.HTTPError, e: mirror.response_code = e.code mirror.response = e.read() except urllib2.URLError, e: mirror.response_code = 0 mirror.response = "%s" % e.reason except IOError, e: # IOError: [Errno ftp error] (111, 'Connection refused') if e.errno == 'ftp error': mirror.response_code = 0 mirror.response = "%s: %s" % (e.errno, e.strerror) else: print mirror.identifier, mirror.baseurl, 'errno:', e.errno raise except: print mirror.identifier, mirror.baseurl raise # not reached, if the timeout goes off mirror.timed_out = False
b20f288cec1c1dc546330c2c42363394bd60eca2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/b20f288cec1c1dc546330c2c42363394bd60eca2/mirrorprobe.py
print mirror.identifier, mirror.baseurl raise
mirror.response_code = None mirror.response = 'unknown error'
def probe_http(mirror): """Try to reach host at baseurl. Set status_baseurl_new.""" logging.debug("%s probing %s" % (threading.currentThread().getName(), mirror.identifier)) #req = urllib2.Request('http://old-cherry.suse.de') # never works #req = urllib2.Request('http://doozer.poeml.de/') # always works req = urllib2.Request(mirror.baseurl) req.add_header('User-Agent', USER_AGENT) #req.get_method = lambda: "HEAD" mirror.status_baseurl_new = False mirror.timed_out = True mirror.response_code = None mirror.response = None if mirror.baseurl == '': return None try: response = urllib2.urlopen(req) try: mirror.response_code = response.code # if the web server redirects to an ftp:// URL, our response won't have a code attribute # (except we are going via a proxy) except AttributeError: if response.url.startswith('ftp://'): # count as success mirror.response_code = 200 logging.debug('mirror %s redirects to ftp:// URL' % mirror.identifier) logging.debug('%s got response for %s: %s' % (threading.currentThread().getName(), mirror.identifier, getattr(response, 'code', None))) mirror.response = response.read() mirror.status_baseurl_new = True except ValueError, e: if str(e).startswith('invalid literal for int()'): mirror.response = 'response not read due to http://bugs.python.org/issue1205' logging.info('mirror %s sends broken chunked reply, see http://bugs.python.org/issue1205' % mirror.identifier) except socket.timeout, e: mirror.response = 'socket timeout in reading response: %s' % e except socket.error, e: #errno, errstr = sys.exc_info()[:2] mirror.response = "socket error: %s" % e except httplib.BadStatusLine: mirror.response_code = None mirror.response = None except urllib2.HTTPError, e: mirror.response_code = e.code mirror.response = e.read() except urllib2.URLError, e: mirror.response_code = 0 mirror.response = "%s" % e.reason except IOError, e: # IOError: [Errno ftp error] (111, 'Connection refused') if e.errno == 'ftp error': mirror.response_code = 0 mirror.response = "%s: %s" % (e.errno, e.strerror) else: print mirror.identifier, mirror.baseurl, 'errno:', e.errno raise except: print mirror.identifier, mirror.baseurl raise # not reached, if the timeout goes off mirror.timed_out = False
b20f288cec1c1dc546330c2c42363394bd60eca2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/b20f288cec1c1dc546330c2c42363394bd60eca2/mirrorprobe.py
help='type of URLs to be probed (scan|http|all). Default: scam.')
help='type of URLs to be probed (scan|http|all). Default: scan.')
def do_test(self, subcmd, opts, identifier): """${cmd_name}: test if a mirror is working
6cc5b962855366d0758ab1bc4da5c614784bee6e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/6cc5b962855366d0758ab1bc4da5c614784bee6e/mb.py
res = c.fetchone() if res: file_id = res[0] else: print 'File %r not in database. Not on mirrors yet? Inserting.' % self.src_rel
res_filearr = c.fetchone() if res_filearr: file_id = res_filearr[0] c.execute("SELECT file_id, mtime, size FROM hash WHERE file_id = %s LIMIT 1", [file_id]) res_hash = c.fetchone() else: print 'File %r not in database. Not on mirrors yet? Will be inserted.' % self.src_rel file_id = None res_hash = None if not res_hash: if dry_run: print 'Would create hashes in db for: ', self.src_rel return if self.hb.empty: self.hb.fill(verbose=verbose) if self.hb.empty: sys.stderr.write('skipping db hash generation\n') return c.execute("BEGIN")
def check_db(self, conn, verbose=False, dry_run=False, force=False): """check if the hashes that are stored in the database are up to date for performance, this function talks very low level to the database""" # get a database cursor, but make it persistent which is faster try: conn.mycursor except AttributeError: conn.mycursor = conn.Hash._connection.getConnection().cursor() c = conn.mycursor
c0cd83f9e6f49bb3cc279bf2baa817af2249b5a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/c0cd83f9e6f49bb3cc279bf2baa817af2249b5a7/hashes.py
c.execute("commit") c.execute("SELECT file_id, mtime, size FROM hash WHERE file_id = %s LIMIT 1", [file_id]) res = c.fetchone() if not res: if dry_run: print 'Would create hashes in db for: ', self.src_rel return if self.hb.empty: self.hb.fill(verbose=verbose)
def check_db(self, conn, verbose=False, dry_run=False, force=False): """check if the hashes that are stored in the database are up to date for performance, this function talks very low level to the database""" # get a database cursor, but make it persistent which is faster try: conn.mycursor except AttributeError: conn.mycursor = conn.Hash._connection.getConnection().cursor() c = conn.mycursor
c0cd83f9e6f49bb3cc279bf2baa817af2249b5a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/c0cd83f9e6f49bb3cc279bf2baa817af2249b5a7/hashes.py
mtime, size = res[1], res[2]
mtime, size = res_hash[1], res_hash[2]
def check_db(self, conn, verbose=False, dry_run=False, force=False): """check if the hashes that are stored in the database are up to date for performance, this function talks very low level to the database""" # get a database cursor, but make it persistent which is faster try: conn.mycursor except AttributeError: conn.mycursor = conn.Hash._connection.getConnection().cursor() c = conn.mycursor
c0cd83f9e6f49bb3cc279bf2baa817af2249b5a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/c0cd83f9e6f49bb3cc279bf2baa817af2249b5a7/hashes.py
f = open(self.src, 'rb')
try: f = open(self.src, 'rb') except IOError, e: sys.stderr.write('%s\n' % e) return None
def fill(self, verbose=False): verbose = True # XXX if verbose: sys.stdout.write('Hashing %r... ' % self.src) sys.stdout.flush()
c0cd83f9e6f49bb3cc279bf2baa817af2249b5a7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/c0cd83f9e6f49bb3cc279bf2baa817af2249b5a7/hashes.py
'>>> warning: %r resolves to a multiple IP addresses: %s' \
'>>> warning: %r resolves to multiple IP addresses: %s' \
def iplookup(conn, s): from mb.util import IpAddress import mb.mberr if s[0].isdigit(): a = IpAddress(s) else: import sys, socket # note the difference between socket.gethostbyname # and socket.gethostbyname_ex try: host, aliases, ips = socket.gethostbyname_ex(s) except socket.error, e: if e[0] == socket.EAI_NONAME: raise mb.mberr.NameOrServiceNotKnown(s) else: print 'socket error msg:', str(e) return None #print host, aliases, ips if len(ips) != 1: print >>sys.stderr, \ '>>> warning: %r resolves to a multiple IP addresses: %s' \ % (s, ', '.join(ips)) print >>sys.stderr, '>>> see http://mirrorbrain.org/archive/mirrorbrain/0042.html why this could' \ ' could be a problem, and what to do about it.\n' a = IpAddress(ips[0]) query = """SELECT pfx, asn \ FROM pfx2asn \ WHERE pfx >>= ip4r('%s') \ ORDER BY ip4r_size(pfx) \ LIMIT 1""" % a.ip try: res = conn.Pfx2asn._connection.queryAll(query) except AttributeError: # we get this error if mod_asn isn't installed as well return a if len(res) != 1: return a (a.prefix, a.asn) = res[0] return a
0b589bcba9224aea608dd5f6d0c90995dcda4294 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/0b589bcba9224aea608dd5f6d0c90995dcda4294/asn.py
sys.exit('%r doesn\'t seem to be a Subversion working copy')
sys.exit('%r doesn\'t seem to be a Subversion working copy' % opts.target_dir)
def do_export(self, subcmd, opts, *args): """${cmd_name}: export the mirror list as text file
f46fcf10fb06186b16394f499a78f68383aad46d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/f46fcf10fb06186b16394f499a78f68383aad46d/mirrordoctor.py
print host, mod
def do_size(self, subcmd, opts, host): """${cmd_name}: find out the size of an rsync module
b0afe2c4fd0909e211e099be9282c5314ba784af /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3890/b0afe2c4fd0909e211e099be9282c5314ba784af/rsyncinfo.py
'<div id="${preview_id}" class="richtemplates-rst" ' 'style="display:none;"></div>',
'<div id="${preview_id}" class="richtemplates-rst-preview ' 'richtemplates-rst" style="display:none;"></div>',
def render(self, name, value, attrs=None): html = super(RestructuredTextareaWidget, self).render(name, value, attrs)
6ec3542e4b882db024953a25241481d024c96f9b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/6ec3542e4b882db024953a25241481d024c96f9b/widgets.py
cb = forms.CheckboxInput(final_attrs, check_test=lambda value: value in str_values)
cb = forms.CheckboxInput(final_attrs, check_test=lambda value: value in str_values)
def render(self, name, value, attrs=None, choices=()): import logging logging.debug("Adding media %s" % RichCheckboxSelectMultiple.Media.js) if value is None: value = [] has_id = attrs and 'id' in attrs checkbox_class = 'richtable-checkbox' if attrs and 'class' in attrs: attrs['class'] = attrs['class'] + ' ' + checkbox_class else: attrs['class'] = checkbox_class final_attrs = self.build_attrs(attrs, name=name) output = [u'<table class="datatable richcheckboxselectmultiple%s">' % (attrs and 'class' in attrs and ' ' + attrs['class']), u'<thead class="datatable-thead">', u'<tr class="datatable-thead-subheader">' u'<th>%s</th>' % _("State"), u'<th>%s</th>' % _("Name"), u'<th>%s</th>' % _("On/Off"), u'</tr>', u'</thead>', ] if self.extra: output.append( u'<tfoot>' u'<tr><td colspan="3">' u'<a class="richbutton select-all">Select all</a>' u'<a class="richbutton deselect-all">Deselect all</a>' u'<a class="richbutton change-all">Reverse all</a>' u'</td></tr>' u'</tfoot>')
10265a59fff6253a45f4315d85e1c18c27b5e4e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/10265a59fff6253a45f4315d85e1c18c27b5e4e6/widgets.py
u'<tbody class="datatable-tbody">',
def render(self, name, value, attrs=None, choices=()): import logging logging.debug("Adding media %s" % RichCheckboxSelectMultiple.Media.js) if value is None: value = [] has_id = attrs and 'id' in attrs checkbox_class = 'richtable-checkbox' if attrs and 'class' in attrs: attrs['class'] = attrs['class'] + ' ' + checkbox_class else: attrs['class'] = checkbox_class final_attrs = self.build_attrs(attrs, name=name) output = [u'<table class="datatable richcheckboxselectmultiple%s">' % (attrs and 'class' in attrs and ' ' + attrs['class']), u'<thead class="datatable-thead">', u'<tr class="datatable-thead-subheader">' u'<th>%s</th>' % _("State"), u'<th>%s</th>' % _("Name"), u'<th>%s</th>' % _("On/Off"), u'</tr>', u'</thead>', u'<tbody class="datatable-tbody">', ] # Normalize to strings str_values = set([force_unicode(v) for v in value]) for i, (option_value, option_label) in enumerate(chain(self.choices, choices)): # If an ID attribute was given, add a numeric index as a suffix, # so that the checkboxes don't all have the same ID attribute. if has_id: final_attrs = dict(final_attrs, id='%s_%s' % (attrs['id'], i)) label_for = u' for="%s"' % final_attrs['id'] else: label_for = '' cb = forms.CheckboxInput(final_attrs, check_test=lambda value: value in str_values) option_value = force_unicode(option_value) rendered_cb = cb.render(name, option_value) option_label = conditional_escape(force_unicode(option_label)) # Adding img next to the field itself if option_value in str_values: src = richicon_src("icon-yes.gif") else: src = richicon_src("icon-no.gif") tr_class = i % 2 and "even" or "odd" img_tag = u'<img src="%s" />' % src output.append(u'<tr class="%s">' u'<td class="centered">%s</td>' u'<td><label%s>%s</label></td>' u'<td>%s</td>' u'</tr></tbody>' % (tr_class, img_tag, label_for, option_label, rendered_cb)) if self.extra: output.append( u'<tfoot>' u'<tr><td colspan="3">' u'<a class="richbutton select-all">Select all</a>' u'<a class="richbutton deselect-all">Deselect all</a>' u'<a class="richbutton change-all">Reverse all</a>' u'</td></tr>' u'</tfoot>')
31694c5f670c95612524a2ae279da296a9d87d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/31694c5f670c95612524a2ae279da296a9d87d10/widgets.py
img_tag = u'<img src="%s" />' % src
img_tag = u'<img src="%s" alt="%s" />' % (src, src)
def render(self, name, value, attrs=None, choices=()): import logging logging.debug("Adding media %s" % RichCheckboxSelectMultiple.Media.js) if value is None: value = [] has_id = attrs and 'id' in attrs checkbox_class = 'richtable-checkbox' if attrs and 'class' in attrs: attrs['class'] = attrs['class'] + ' ' + checkbox_class else: attrs['class'] = checkbox_class final_attrs = self.build_attrs(attrs, name=name) output = [u'<table class="datatable richcheckboxselectmultiple%s">' % (attrs and 'class' in attrs and ' ' + attrs['class']), u'<thead class="datatable-thead">', u'<tr class="datatable-thead-subheader">' u'<th>%s</th>' % _("State"), u'<th>%s</th>' % _("Name"), u'<th>%s</th>' % _("On/Off"), u'</tr>', u'</thead>', u'<tbody class="datatable-tbody">', ] # Normalize to strings str_values = set([force_unicode(v) for v in value]) for i, (option_value, option_label) in enumerate(chain(self.choices, choices)): # If an ID attribute was given, add a numeric index as a suffix, # so that the checkboxes don't all have the same ID attribute. if has_id: final_attrs = dict(final_attrs, id='%s_%s' % (attrs['id'], i)) label_for = u' for="%s"' % final_attrs['id'] else: label_for = '' cb = forms.CheckboxInput(final_attrs, check_test=lambda value: value in str_values) option_value = force_unicode(option_value) rendered_cb = cb.render(name, option_value) option_label = conditional_escape(force_unicode(option_label)) # Adding img next to the field itself if option_value in str_values: src = richicon_src("icon-yes.gif") else: src = richicon_src("icon-no.gif") tr_class = i % 2 and "even" or "odd" img_tag = u'<img src="%s" />' % src output.append(u'<tr class="%s">' u'<td class="centered">%s</td>' u'<td><label%s>%s</label></td>' u'<td>%s</td>' u'</tr></tbody>' % (tr_class, img_tag, label_for, option_label, rendered_cb)) if self.extra: output.append( u'<tfoot>' u'<tr><td colspan="3">' u'<a class="richbutton select-all">Select all</a>' u'<a class="richbutton deselect-all">Deselect all</a>' u'<a class="richbutton change-all">Reverse all</a>' u'</td></tr>' u'</tfoot>')
31694c5f670c95612524a2ae279da296a9d87d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/31694c5f670c95612524a2ae279da296a9d87d10/widgets.py
u'</tr></tbody>' % (tr_class, img_tag, label_for,
u'</tr>' % (tr_class, img_tag, label_for,
def render(self, name, value, attrs=None, choices=()): import logging logging.debug("Adding media %s" % RichCheckboxSelectMultiple.Media.js) if value is None: value = [] has_id = attrs and 'id' in attrs checkbox_class = 'richtable-checkbox' if attrs and 'class' in attrs: attrs['class'] = attrs['class'] + ' ' + checkbox_class else: attrs['class'] = checkbox_class final_attrs = self.build_attrs(attrs, name=name) output = [u'<table class="datatable richcheckboxselectmultiple%s">' % (attrs and 'class' in attrs and ' ' + attrs['class']), u'<thead class="datatable-thead">', u'<tr class="datatable-thead-subheader">' u'<th>%s</th>' % _("State"), u'<th>%s</th>' % _("Name"), u'<th>%s</th>' % _("On/Off"), u'</tr>', u'</thead>', u'<tbody class="datatable-tbody">', ] # Normalize to strings str_values = set([force_unicode(v) for v in value]) for i, (option_value, option_label) in enumerate(chain(self.choices, choices)): # If an ID attribute was given, add a numeric index as a suffix, # so that the checkboxes don't all have the same ID attribute. if has_id: final_attrs = dict(final_attrs, id='%s_%s' % (attrs['id'], i)) label_for = u' for="%s"' % final_attrs['id'] else: label_for = '' cb = forms.CheckboxInput(final_attrs, check_test=lambda value: value in str_values) option_value = force_unicode(option_value) rendered_cb = cb.render(name, option_value) option_label = conditional_escape(force_unicode(option_label)) # Adding img next to the field itself if option_value in str_values: src = richicon_src("icon-yes.gif") else: src = richicon_src("icon-no.gif") tr_class = i % 2 and "even" or "odd" img_tag = u'<img src="%s" />' % src output.append(u'<tr class="%s">' u'<td class="centered">%s</td>' u'<td><label%s>%s</label></td>' u'<td>%s</td>' u'</tr></tbody>' % (tr_class, img_tag, label_for, option_label, rendered_cb)) if self.extra: output.append( u'<tfoot>' u'<tr><td colspan="3">' u'<a class="richbutton select-all">Select all</a>' u'<a class="richbutton deselect-all">Deselect all</a>' u'<a class="richbutton change-all">Reverse all</a>' u'</td></tr>' u'</tfoot>')
31694c5f670c95612524a2ae279da296a9d87d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/31694c5f670c95612524a2ae279da296a9d87d10/widgets.py
if self.extra: output.append( u'<tfoot>' u'<tr><td colspan="3">' u'<a class="richbutton select-all">Select all</a>' u'<a class="richbutton deselect-all">Deselect all</a>' u'<a class="richbutton change-all">Reverse all</a>' u'</td></tr>' u'</tfoot>') output.append(u'</table>')
output.append(u'</tbody></table>')
def render(self, name, value, attrs=None, choices=()): import logging logging.debug("Adding media %s" % RichCheckboxSelectMultiple.Media.js) if value is None: value = [] has_id = attrs and 'id' in attrs checkbox_class = 'richtable-checkbox' if attrs and 'class' in attrs: attrs['class'] = attrs['class'] + ' ' + checkbox_class else: attrs['class'] = checkbox_class final_attrs = self.build_attrs(attrs, name=name) output = [u'<table class="datatable richcheckboxselectmultiple%s">' % (attrs and 'class' in attrs and ' ' + attrs['class']), u'<thead class="datatable-thead">', u'<tr class="datatable-thead-subheader">' u'<th>%s</th>' % _("State"), u'<th>%s</th>' % _("Name"), u'<th>%s</th>' % _("On/Off"), u'</tr>', u'</thead>', u'<tbody class="datatable-tbody">', ] # Normalize to strings str_values = set([force_unicode(v) for v in value]) for i, (option_value, option_label) in enumerate(chain(self.choices, choices)): # If an ID attribute was given, add a numeric index as a suffix, # so that the checkboxes don't all have the same ID attribute. if has_id: final_attrs = dict(final_attrs, id='%s_%s' % (attrs['id'], i)) label_for = u' for="%s"' % final_attrs['id'] else: label_for = '' cb = forms.CheckboxInput(final_attrs, check_test=lambda value: value in str_values) option_value = force_unicode(option_value) rendered_cb = cb.render(name, option_value) option_label = conditional_escape(force_unicode(option_label)) # Adding img next to the field itself if option_value in str_values: src = richicon_src("icon-yes.gif") else: src = richicon_src("icon-no.gif") tr_class = i % 2 and "even" or "odd" img_tag = u'<img src="%s" />' % src output.append(u'<tr class="%s">' u'<td class="centered">%s</td>' u'<td><label%s>%s</label></td>' u'<td>%s</td>' u'</tr></tbody>' % (tr_class, img_tag, label_for, option_label, rendered_cb)) if self.extra: output.append( u'<tfoot>' u'<tr><td colspan="3">' u'<a class="richbutton select-all">Select all</a>' u'<a class="richbutton deselect-all">Deselect all</a>' u'<a class="richbutton change-all">Reverse all</a>' u'</td></tr>' u'</tfoot>')
31694c5f670c95612524a2ae279da296a9d87d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/31694c5f670c95612524a2ae279da296a9d87d10/widgets.py
print options['force']
def handle_label(self, app=None, **options): if app is None: raise CommandError("Specify at least one app") if app not in settings.INSTALLED_APPS: raise CommandError("%s not found at INSTALLED_APPS" % app) MEDIA_ROOT = os.path.abspath(options['media_root'])
5dfcfc39996c7bf8818f1195a096c3f03270a726 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/5dfcfc39996c7bf8818f1195a096c3f03270a726/import_media.py
logging.debug(msg)
logger.debug(msg)
def register_rst_directives(directives_items): """ Registers restructuredText directives given as dictionary with keys being names and paths to directive function. """ for name, directive_path in directives_items: try: splitted = directive_path.split('.') mod_path, method_name = '.'.join(splitted[:-1]), splitted[-1] mod = __import__(mod_path, (), (), [method_name], -1) directive = getattr(mod, method_name) directives.register_directive(name, directive) msg = "Registered restructuredText directive: %s" % method_name logging.debug(msg) except ImportError, err: msg = "Couldn't register restructuredText directive. Original "\ "exception was: %s" % err logging.warn(msg)
dadfe89669877fdf620a920a54be0982ea8600de /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/dadfe89669877fdf620a920a54be0982ea8600de/settings.py
logging.warn(msg)
logger.warn(msg)
def register_rst_directives(directives_items): """ Registers restructuredText directives given as dictionary with keys being names and paths to directive function. """ for name, directive_path in directives_items: try: splitted = directive_path.split('.') mod_path, method_name = '.'.join(splitted[:-1]), splitted[-1] mod = __import__(mod_path, (), (), [method_name], -1) directive = getattr(mod, method_name) directives.register_directive(name, directive) msg = "Registered restructuredText directive: %s" % method_name logging.debug(msg) except ImportError, err: msg = "Couldn't register restructuredText directive. Original "\ "exception was: %s" % err logging.warn(msg)
dadfe89669877fdf620a920a54be0982ea8600de /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12918/dadfe89669877fdf620a920a54be0982ea8600de/settings.py
R = 0.354 Delta = 0.153
R = 0.354 * nm Delta = 0.153 * nm
def rho(r): R = 0.354 Delta = 0.153 R1 = R - Delta / 2 R2 = R + Delta / 2 return rho0 * (theta(R2-r) - theta(r-R1))
b75544167810c12e843d28ad14e98aa9fbb65a57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13923/b75544167810c12e843d28ad14e98aa9fbb65a57/density.py
r = arange(0, 1, 0.01)
r = arange(0, 1 * nm, 0.01 *nm)
def rho(r): R = 0.354 Delta = 0.153 R1 = R - Delta / 2 R2 = R + Delta / 2 return rho0 * (theta(R2-r) - theta(r-R1))
b75544167810c12e843d28ad14e98aa9fbb65a57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13923/b75544167810c12e843d28ad14e98aa9fbb65a57/density.py
if self._input_report_queue:
if self._input_report_queue and self.__input_processing_thread.is_alive():
def close(self): # free parsed data if not self.is_opened(): return self.__open_status = False
99c31ae5bbd5f607698f28c5685c2eaf6283802b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/99c31ae5bbd5f607698f28c5685c2eaf6283802b/core.py
while self.__reading_thread and self.__reading_thread.is_alive():
while self.__reading_thread and self.__reading_thread.is_active():
def close(self): # free parsed data if not self.is_opened(): return self.__open_status = False
99c31ae5bbd5f607698f28c5685c2eaf6283802b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/99c31ae5bbd5f607698f28c5685c2eaf6283802b/core.py
if not raw_report: continue
if not raw_report or self.__abort: break
def run(self): hid_object = self.hid_object while hid_object.is_opened() and not self.__abort: raw_report = hid_object._input_report_queue.get() if not raw_report: continue hid_object._process_raw_report(raw_report) # reuse the report (avoid allocating new memory) hid_object._input_report_queue.reuse(raw_report)
99c31ae5bbd5f607698f28c5685c2eaf6283802b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/99c31ae5bbd5f607698f28c5685c2eaf6283802b/core.py
hid_object._input_report_queue.reuse(raw_report)
if hid_object._input_report_queue: hid_object._input_report_queue.reuse(raw_report)
def run(self): hid_object = self.hid_object while hid_object.is_opened() and not self.__abort: raw_report = hid_object._input_report_queue.get() if not raw_report: continue hid_object._process_raw_report(raw_report) # reuse the report (avoid allocating new memory) hid_object._input_report_queue.reuse(raw_report)
99c31ae5bbd5f607698f28c5685c2eaf6283802b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/99c31ae5bbd5f607698f28c5685c2eaf6283802b/core.py
if not self.__abort: self.__abort = True
if not self.__active: return self.__abort = True
def abort(self): if not self.__abort: self.__abort = True if self.is_alive() and self.__overlapped_read_obj: # force overlapped events completition SetEvent(self.__overlapped_read_obj.h_event)
99c31ae5bbd5f607698f28c5685c2eaf6283802b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/99c31ae5bbd5f607698f28c5685c2eaf6283802b/core.py
self.__active = False self.__abort = True
def run(self): if not self.raw_report_size: # don't raise any error as the hid object can still be used # for writing reports raise HIDError("Attempting to read input reports on non "\ "capable HID device") over_read = OVERLAPPED() over_read.h_event = CreateEvent(None, 0, 0, None) if over_read.h_event: self.__overlapped_read_obj = over_read else: raise HIDError("Error when create hid event resource")
99c31ae5bbd5f607698f28c5685c2eaf6283802b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/99c31ae5bbd5f607698f28c5685c2eaf6283802b/core.py
def send_output_report(self, data): """Send input/output/feature report ID = report_id, data should be a c_ubyte object with included the required report data """ assert( self.is_opened() )
4ec60e496fbef07c76b7566417c50a134745fe3c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/4ec60e496fbef07c76b7566417c50a134745fe3c/core.py
byte_index = (index * self.__bit_size) % 8 bit_value = (value & ((1 << self.__bit_size) - 1)) << byte_index self.__value[byte_index] &= bit_value self.__value[byte_index] |= bit_value
bit_index = (index * self.__bit_size) % 8 bit_mask = ((1 << self.__bit_size) - 1) self.__value[byte_index] &= ~(bit_mask << bit_index) self.__value[byte_index] |= (value & bit_mask) << bit_index
def __setitem__(self, index, value): "Allow to access value array by index" if not self.__is_value_array: raise ValueError("Report item is not value usage array") if index < self.__report_count: byte_index = (index * self.__bit_size) / 8 byte_index = (index * self.__bit_size) % 8 bit_value = (value & ((1 << self.__bit_size) - 1)) << byte_index self.__value[byte_index] &= bit_value self.__value[byte_index] |= bit_value else: raise IndexError
4ec60e496fbef07c76b7566417c50a134745fe3c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/4ec60e496fbef07c76b7566417c50a134745fe3c/core.py
byte_index = (index * self.__bit_size) % 8 return ((self.__value[byte_index] >> byte_index) & self.__bit_size )
bit_index = (index * self.__bit_size) % 8 return ((self.__value[byte_index] >> bit_index) & ((1 << self.__bit_size) - 1) )
def __getitem__(self, index): "Allow to access value array by index" if not self.__is_value_array: raise ValueError("Report item is not value usage array") if index < self.__report_count: byte_index = (index * self.__bit_size) / 8 byte_index = (index * self.__bit_size) % 8 return ((self.__value[byte_index] >> byte_index) & self.__bit_size ) else: raise IndexError
4ec60e496fbef07c76b7566417c50a134745fe3c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/4ec60e496fbef07c76b7566417c50a134745fe3c/core.py
def get(self): if self.__locked_down: return None #wait for data self.posted_event.wait() self.fresh_lock.acquire() if self.__locked_down: self.fresh_lock.release() return None
de130bf113ddbd0b43ffd5b319f29d39c14d16fc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/de130bf113ddbd0b43ffd5b319f29d39c14d16fc/core.py
self.posted_event.set()
def post(self, raw_report): if self.__locked_down: self.posted_event.set() return self.fresh_lock.acquire() self.fresh_queue.append( raw_report ) self.fresh_lock.release() self.posted_event.set()
73c7f724c6d27058fded6c1910030bda9a4287e4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/73c7f724c6d27058fded6c1910030bda9a4287e4/core.py
if bytes_read.value: input_report_queue.post( buf_report )
input_report_queue.post( buf_report )
def run(self): time.sleep(0.050) # this fixes an strange python threading bug if not self.raw_report_size: # don't raise any error as the hid object can still be used # for writing reports raise HIDError("Attempting to read input reports on non "\ "capable HID device")
56bf21f272dbff8be782a03a4e91ac5c80f09a1d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/56bf21f272dbff8be782a03a4e91ac5c80f09a1d/core.py
res.append( "value=%s)"%hex(self.__value) )
res.append( "value=%s" % str(self.get_value()))
def __repr__(self): res = [] if self.string_index: res.append( self.get_usage_string() ) res.append( "page_id=%s"%hex(self.page_id) ) res.append( "usage_id=%s"%hex(self.usage_id) ) if self.__value != None: res.append( "value=%s)"%hex(self.__value) ) else: res.append( "value=[None])" ) usage_type = "" if self.is_button(): usage_type = "Button" elif self.is_value(): usage_type = "Value" return usage_type + "Usage item, %s (" % hex(get_full_usage_id ( \ self.page_id, self.usage_id)) + ', '.join(res) + ')'
30f3b62e555377b89b65c7e8fbe26332fa3c3e31 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/30f3b62e555377b89b65c7e8fbe26332fa3c3e31/core.py
byref(raw_data), sizeof(raw_data)) )
byref(self.__raw_data), len(self.__raw_data)) )
def set_raw_data(self, raw_data): """Set usage values based on given raw data, item[0] is report_id, lenght should match 'raw_data_length' value, best performance if raw_data is c_ubyte ctypes array object type """ #pre-parsed data should exist if not self.__hid_object.ptr_preparsed_data: raise HIDError("HID object close or unable to request preparsed "\ "report data") #valid lenght if len(raw_data) != self.__raw_report_size: raise HIDError( "Report size has to be %d elements (bytes)" \ % self.__raw_report_size ) # copy to internal storage self.__alloc_raw_data(raw_data) if not self.__usage_data_list: # create HIDP_DATA buffer max_items = hid_dll.HidP_MaxDataListLength(self.__report_kind, self.__hid_object.ptr_preparsed_data) data_list_type = HIDP_DATA * max_items self.__usage_data_list = data_list_type() #reference HIDP_DATA bufer data_list = self.__usage_data_list data_len = c_ulong(len(data_list))
30f3b62e555377b89b65c7e8fbe26332fa3c3e31 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/30f3b62e555377b89b65c7e8fbe26332fa3c3e31/core.py
nength: %(hid_caps.output_report_byte_length)d byte(s)
length: %(hid_caps.output_report_byte_length)d byte(s)
def __getitem__(self, key): if '.' not in key: return self.parent[key] else: all_keys = key.split('.') curr_var = self.parent[all_keys[0]] for item in all_keys[1:]: new_var = getattr(curr_var, item) curr_var = new_var return new_var
43513eb3826c47180d7efd24f1fb4081705d1cc0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11669/43513eb3826c47180d7efd24f1fb4081705d1cc0/tools.py
t.byteswap(True)
if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True)
def LoadSingle(filename=None): if filename==None: filename=wx.FileSelector() im=Image.open(filename) # TODO: Need to add more smarts to this based on the mode 'I;16' vs. RGB, etc... #'1','P','RGB','RGBA','L','F','CMYK','YCbCr','I', # Can I simplify this by simply fixing the PIL -> numpy conversion #if im.format in _tif_names: datatype=np.uint16 #elif im.format in _gif_names: datatype=np.uint8 t=np.array(im) if t.dtype in [np.uint8,np.uint16,np.float32]: pass elif t.dtype==np.int16: t=np.uint16(t) # Convert from int16 to uint16 (same as what ImageJ does [I think]) else: print 'What kind of image fomrat is this anyway???' print 'Should be a 16 or 32 bit tiff or 8 bit unsigned gif or tiff' return t.resize(im.size[1],im.size[0]) # Patch around PIL's Tiff stupidity... if im.format in _tif_names: fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
473180b2e6ff319ae3b1793f4ad8496a5f4b900c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/473180b2e6ff319ae3b1793f4ad8496a5f4b900c/GifTiffLoader.py
if dtype==np.uint8 and arr.max()>255:
if arr.dtype==np.uint8 and arr.max()>255:
def SaveFileSequence(arr,basename=None,format='gif',tiffBits=16): if basename==None: basename=wx.SaveFileSelector('Array as Sequence of Gifs -- numbers automatically added to','.'+format) if format in _gif_names: pass elif format in _tif_names: if tiffBits not in [8,16,32]: print 'Unsupported tiff format! Choose 8 or 16 bit.' return else: print 'Unsupported Format! Choose Gif or Tiff format' return if dtype==np.uint8 and arr.max()>255: arr=np.array(arr*255./arr.max(),np.uint8) if len(arr.shape)==2: SaveSingle(arr,os.path.splitext(basename)[0]+'_0_000'+'.'+format,format=format,tiffBits=tiffBits) elif len(arr.shape)==3: for i in range(arr.shape[0]): SaveSingle(arr[i],os.path.splitext(basename)[0]+'_0_'+str('%03d' % i)+'.'+format,format=format,tiffBits=tiffBits) elif len(arr.shape)==4: for i in range(arr.shape[0]): for j in range(arr.shape[1]): SaveSingle(arr[i,j],os.path.splitext(basename)[0]+'_'+str(i)+'_'+str('%03d' % j)+'.'+format,format=format,tiffBits=tiffBits) else: print 'This function does not support saving arrays with more than 4 dimensions!'
473180b2e6ff319ae3b1793f4ad8496a5f4b900c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/473180b2e6ff319ae3b1793f4ad8496a5f4b900c/GifTiffLoader.py
t.byteswap(True)
if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True)
def LoadMonolithic(filename=None): #f='C:/Documents and Settings/Owner/Desktop/Stack_Zproject_GBR_DC.gif' if filename==None: filename=wx.FileSelector() im=Image.open(filename) if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8 l=[] numFrames=0 while 1: l.append(np.asarray(im.getdata(),dtype=datatype)) numFrames+=1 try: im.seek(im.tell()+1) except EOFError: break # end of sequence t=np.array(l,dtype=datatype) # Oops--was t=np.array(im)!! #No need for this any more... # if t.dtype in [np.uint8,np.uint16]: # pass # elif t.dtype==np.int16: # t=np.uint16(t) # Convert from int16 to uint16 (same as what ImageJ does [I think]) # else: # print 'What kind of image fomrat is this anyway???' # print 'Should be a 16bit tiff or 8bit unsigned gif or tiff.' # return t.resize(numFrames,im.size[1],im.size[0]) # Patch around PIL's Tiff stupidity... if im.format=='TIFF': fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
473180b2e6ff319ae3b1793f4ad8496a5f4b900c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/473180b2e6ff319ae3b1793f4ad8496a5f4b900c/GifTiffLoader.py
t.byteswap(True)
if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True)
def LoadFrameFromMonolithic(filename=None,frameNum=0): #f='C:/Documents and Settings/Owner/Desktop/Stack_Zproject_GBR_DC.gif' if filename==None: filename=wx.FileSelector() im=Image.open(filename) if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8 t=None i=0 while 1: if i==frameNum: t = np.asarray(im.getdata(),dtype=datatype) t.resize(numFrames,im.size[1],im.size[0]) break i+=1 try: im.seek(im.tell()+1) except EOFError: break # end of sequence if t==None: print 'Frame not able to be loaded' return t else: # Patch around PIL's Tiff stupidity... if im.format=='TIFF': fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
473180b2e6ff319ae3b1793f4ad8496a5f4b900c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/473180b2e6ff319ae3b1793f4ad8496a5f4b900c/GifTiffLoader.py
def LoadSingle(filename=None): if filename==None: filename=wx.FileSelector() im=Image.open(filename) # TODO: Need to add more smarts to this based on the mode 'I;16' vs. RGB, etc... #'1','P','RGB','RGBA','L','F','CMYK','YCbCr','I', # Can I simplify this by simply fixing the PIL -> numpy conversion #if im.format in _tif_names: datatype=np.uint16 #elif im.format in _gif_names: datatype=np.uint8 t=np.array(im) if t.dtype in [np.uint8,np.uint16,np.float32]: pass elif t.dtype==np.int16: t=np.uint16(t) # Convert from int16 to uint16 (same as what ImageJ does [I think]) else: print 'What kind of image fomrat is this anyway???' print 'Should be a 16 or 32 bit tiff or 8 bit unsigned gif or tiff' return t.resize(im.size[1],im.size[0]) # Patch around PIL's Tiff stupidity... if im.format in _tif_names: fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': # I assume no one will use earlier than 1.1.4 # 1.1.4 to 1.1.6 had a bug; fixed in 1.1.7 and later if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
22ad5ff7285312db6c9670b2b41de790312eefa6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/22ad5ff7285312db6c9670b2b41de790312eefa6/GifTiffLoader.py
def LoadSingle(filename=None): if filename==None: filename=wx.FileSelector() im=Image.open(filename) # TODO: Need to add more smarts to this based on the mode 'I;16' vs. RGB, etc... #'1','P','RGB','RGBA','L','F','CMYK','YCbCr','I', # Can I simplify this by simply fixing the PIL -> numpy conversion #if im.format in _tif_names: datatype=np.uint16 #elif im.format in _gif_names: datatype=np.uint8 t=np.array(im) if t.dtype in [np.uint8,np.uint16,np.float32]: pass elif t.dtype==np.int16: t=np.uint16(t) # Convert from int16 to uint16 (same as what ImageJ does [I think]) else: print 'What kind of image fomrat is this anyway???' print 'Should be a 16 or 32 bit tiff or 8 bit unsigned gif or tiff' return t.resize(im.size[1],im.size[0]) # Patch around PIL's Tiff stupidity... if im.format in _tif_names: fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': # I assume no one will use earlier than 1.1.4 # 1.1.4 to 1.1.6 had a bug; fixed in 1.1.7 and later if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
22ad5ff7285312db6c9670b2b41de790312eefa6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/22ad5ff7285312db6c9670b2b41de790312eefa6/GifTiffLoader.py
if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8
datatype = GetDatatype(im)
def LoadMonolithic(filename=None): #f='C:/Documents and Settings/Owner/Desktop/Stack_Zproject_GBR_DC.gif' if filename==None: filename=wx.FileSelector() im=Image.open(filename) if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8 l=[] numFrames=0 while 1: l.append(np.asarray(im.getdata(),dtype=datatype)) numFrames+=1 try: im.seek(im.tell()+1) except EOFError: break # end of sequence t=np.array(l,dtype=datatype) # Oops--was t=np.array(im)!! #No need for this any more... # if t.dtype in [np.uint8,np.uint16]: # pass # elif t.dtype==np.int16: # t=np.uint16(t) # Convert from int16 to uint16 (same as what ImageJ does [I think]) # else: # print 'What kind of image fomrat is this anyway???' # print 'Should be a 16bit tiff or 8bit unsigned gif or tiff.' # return t.resize(numFrames,im.size[1],im.size[0]) # Patch around PIL's Tiff stupidity... if im.format=='TIFF': fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': # I assume no one will use earlier than 1.1.4 # 1.1.4 to 1.1.6 had a bug; fixed in 1.1.7 and later if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
22ad5ff7285312db6c9670b2b41de790312eefa6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/22ad5ff7285312db6c9670b2b41de790312eefa6/GifTiffLoader.py
t=np.array(l,dtype=datatype)
t=np.array(l,dtype=datatype)
def LoadMonolithic(filename=None): #f='C:/Documents and Settings/Owner/Desktop/Stack_Zproject_GBR_DC.gif' if filename==None: filename=wx.FileSelector() im=Image.open(filename) if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8 l=[] numFrames=0 while 1: l.append(np.asarray(im.getdata(),dtype=datatype)) numFrames+=1 try: im.seek(im.tell()+1) except EOFError: break # end of sequence t=np.array(l,dtype=datatype) # Oops--was t=np.array(im)!! #No need for this any more... # if t.dtype in [np.uint8,np.uint16]: # pass # elif t.dtype==np.int16: # t=np.uint16(t) # Convert from int16 to uint16 (same as what ImageJ does [I think]) # else: # print 'What kind of image fomrat is this anyway???' # print 'Should be a 16bit tiff or 8bit unsigned gif or tiff.' # return t.resize(numFrames,im.size[1],im.size[0]) # Patch around PIL's Tiff stupidity... if im.format=='TIFF': fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': # I assume no one will use earlier than 1.1.4 # 1.1.4 to 1.1.6 had a bug; fixed in 1.1.7 and later if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
22ad5ff7285312db6c9670b2b41de790312eefa6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/22ad5ff7285312db6c9670b2b41de790312eefa6/GifTiffLoader.py
def LoadMonolithic(filename=None): #f='C:/Documents and Settings/Owner/Desktop/Stack_Zproject_GBR_DC.gif' if filename==None: filename=wx.FileSelector() im=Image.open(filename) if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8 l=[] numFrames=0 while 1: l.append(np.asarray(im.getdata(),dtype=datatype)) numFrames+=1 try: im.seek(im.tell()+1) except EOFError: break # end of sequence t=np.array(l,dtype=datatype) # Oops--was t=np.array(im)!! #No need for this any more... # if t.dtype in [np.uint8,np.uint16]: # pass # elif t.dtype==np.int16: # t=np.uint16(t) # Convert from int16 to uint16 (same as what ImageJ does [I think]) # else: # print 'What kind of image fomrat is this anyway???' # print 'Should be a 16bit tiff or 8bit unsigned gif or tiff.' # return t.resize(numFrames,im.size[1],im.size[0]) # Patch around PIL's Tiff stupidity... if im.format=='TIFF': fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': # I assume no one will use earlier than 1.1.4 # 1.1.4 to 1.1.6 had a bug; fixed in 1.1.7 and later if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
22ad5ff7285312db6c9670b2b41de790312eefa6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/22ad5ff7285312db6c9670b2b41de790312eefa6/GifTiffLoader.py
if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8
datatype = GetDatatype(im)
def LoadFrameFromMonolithic(filename=None,frameNum=0): #f='C:/Documents and Settings/Owner/Desktop/Stack_Zproject_GBR_DC.gif' if filename==None: filename=wx.FileSelector() im=Image.open(filename) if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8 t=None i=0 while 1: if i==frameNum: t = np.asarray(im.getdata(),dtype=datatype) t.resize(numFrames,im.size[1],im.size[0]) break i+=1 try: im.seek(im.tell()+1) except EOFError: break # end of sequence if t==None: print 'Frame not able to be loaded' return t else: # Patch around PIL's Tiff stupidity... if im.format=='TIFF': fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': # I assume no one will use earlier than 1.1.4 # 1.1.4 to 1.1.6 had a bug; fixed in 1.1.7 and later if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
22ad5ff7285312db6c9670b2b41de790312eefa6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/22ad5ff7285312db6c9670b2b41de790312eefa6/GifTiffLoader.py
def LoadFrameFromMonolithic(filename=None,frameNum=0): #f='C:/Documents and Settings/Owner/Desktop/Stack_Zproject_GBR_DC.gif' if filename==None: filename=wx.FileSelector() im=Image.open(filename) if im.format in _tif_names: datatype=np.uint16 elif im.format in _gif_names: datatype=np.uint8 t=None i=0 while 1: if i==frameNum: t = np.asarray(im.getdata(),dtype=datatype) t.resize(numFrames,im.size[1],im.size[0]) break i+=1 try: im.seek(im.tell()+1) except EOFError: break # end of sequence if t==None: print 'Frame not able to be loaded' return t else: # Patch around PIL's Tiff stupidity... if im.format=='TIFF': fid=open(filename,'rb') endianness=fid.read(2) fid.close() if endianness=='MM': # I assume no one will use earlier than 1.1.4 # 1.1.4 to 1.1.6 had a bug; fixed in 1.1.7 and later if Image.VERSION in ['1.1.4','1.1.5','1.1.6']: t.byteswap(True) elif endianness=='II': pass else: print "Just so you know... that ain't no tiff!" return t
22ad5ff7285312db6c9670b2b41de790312eefa6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/22ad5ff7285312db6c9670b2b41de790312eefa6/GifTiffLoader.py
filename,os.path.split(filename)[0] )
filename,os.path.split(filename)[0])
def LoadMonolithicOrSequenceSpecial(filename=None): if filename==None: filename=wx.FileSelector() numFrames,w,h,isSequence = GetShapeMonolithicOrSequence(filename) if isSequence: files = getSortedListOfNumericalEquivalentFiles( filename,os.path.split(filename)[0] ) if len(files)==0: print 'Empty Directory!' return t0=LoadSingle(files[0]) t=np.zeros([len(files),t0.shape[0],t0.shape[1]],t0.dtype) for i in range(len(files)): t[i]=LoadSingle(files[i]) return t else: return LoadMonolithic(filename)
22ad5ff7285312db6c9670b2b41de790312eefa6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10587/22ad5ff7285312db6c9670b2b41de790312eefa6/GifTiffLoader.py
from bluetooth import BluetoothError
import bluesock
def find_bricks(host=None, name=None): """Used by find_one_brick to look for bricks ***ADVANCED USERS ONLY***""" try: import usbsock usb_available = True socks = usbsock.find_bricks(host, name) for s in socks: yield s except ImportError: usb_available = False import sys print >>sys.stderr, "USB module unavailable, not searching there" try: from bluetooth import BluetoothError try: import bluesock socks = bluesock.find_bricks(host, name) for s in socks: yield s except (BluetoothError, IOError): #for cases such as no adapter, bluetooth throws IOError, not BluetoothError pass except ImportError: import sys print >>sys.stderr, "Bluetooth module unavailable, not searching there" if not usb_available: raise NoBackendError("Neither USB nor Bluetooth could be used! Did you install PyUSB or PyBluez?")
b7900994ec595907c9bb3b1884c799184655eb05 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/b7900994ec595907c9bb3b1884c799184655eb05/locator.py
import bluesock
def find_bricks(host=None, name=None): """Used by find_one_brick to look for bricks ***ADVANCED USERS ONLY***""" try: import usbsock usb_available = True socks = usbsock.find_bricks(host, name) for s in socks: yield s except ImportError: usb_available = False import sys print >>sys.stderr, "USB module unavailable, not searching there" try: from bluetooth import BluetoothError try: import bluesock socks = bluesock.find_bricks(host, name) for s in socks: yield s except (BluetoothError, IOError): #for cases such as no adapter, bluetooth throws IOError, not BluetoothError pass except ImportError: import sys print >>sys.stderr, "Bluetooth module unavailable, not searching there" if not usb_available: raise NoBackendError("Neither USB nor Bluetooth could be used! Did you install PyUSB or PyBluez?")
b7900994ec595907c9bb3b1884c799184655eb05 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/b7900994ec595907c9bb3b1884c799184655eb05/locator.py
except (BluetoothError, IOError):
except (bluesock.bluetooth.BluetoothError, IOError):
def find_bricks(host=None, name=None): """Used by find_one_brick to look for bricks ***ADVANCED USERS ONLY***""" try: import usbsock usb_available = True socks = usbsock.find_bricks(host, name) for s in socks: yield s except ImportError: usb_available = False import sys print >>sys.stderr, "USB module unavailable, not searching there" try: from bluetooth import BluetoothError try: import bluesock socks = bluesock.find_bricks(host, name) for s in socks: yield s except (BluetoothError, IOError): #for cases such as no adapter, bluetooth throws IOError, not BluetoothError pass except ImportError: import sys print >>sys.stderr, "Bluetooth module unavailable, not searching there" if not usb_available: raise NoBackendError("Neither USB nor Bluetooth could be used! Did you install PyUSB or PyBluez?")
b7900994ec595907c9bb3b1884c799184655eb05 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/b7900994ec595907c9bb3b1884c799184655eb05/locator.py
def _ls_read(self):
def _ls_get_status(self, n_bytes):
def _ls_read(self): for n in range(3): try: return self.brick.ls_read(self.port) except I2CError: pass raise I2CError, 'ls_read timeout'
70816acbdd88419a57657d6b66de7a2a8ae61e6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/70816acbdd88419a57657d6b66de7a2a8ae61e6a/digital.py
return self.brick.ls_read(self.port) except I2CError: pass raise I2CError, 'ls_read timeout'
b = self.brick.ls_get_status(self.port) if b >= n_bytes: return b except I2CPendingError: sleep(0.01) raise I2CError, 'ls_get_status timeout'
def _ls_read(self): for n in range(3): try: return self.brick.ls_read(self.port) except I2CError: pass raise I2CError, 'ls_read timeout'
70816acbdd88419a57657d6b66de7a2a8ae61e6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/70816acbdd88419a57657d6b66de7a2a8ae61e6a/digital.py
data = self._ls_read()
self._ls_get_status(n_bytes) data = self.brick.ls_read(self.port)
def _i2c_query(self, address, format): """Reads an i2c value from given address, and returns a value unpacked according to the given format. Format is the same as in the struct module. """ n_bytes = struct.calcsize(format) msg = chr(self.I2C_DEV) + chr(address) if not self.lastpoll: self.lastpoll = time() if self.lastpoll+0.02 > time(): diff = time() - self.lastpoll sleep(0.02 - diff) self.brick.ls_write(self.port, msg, n_bytes) data = self._ls_read() self.lastpoll = time() if len(data) < n_bytes: raise I2CError, 'Read failure' return struct.unpack(format, data[-n_bytes:]) # TODO: why could there be more than n_bytes?
70816acbdd88419a57657d6b66de7a2a8ae61e6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/70816acbdd88419a57657d6b66de7a2a8ae61e6a/digital.py
'mode': (0x41, 'b'), 'number': (0x42, 'b'), 'red': (0x43, 'b'), 'green': (0x44, 'b'), 'blue': (0x45, 'b'), 'white': (0x46, 'b') 'index': (0x47, 'b'), 'normred': (0x48, 'b'), 'normgreen': (0x49, 'b'), 'normblue': (0x4A, 'b'), 'all_data': (0x42, '9b'),
'mode': (0x41, 'B'), 'number': (0x42, 'B'), 'red': (0x43, 'B'), 'green': (0x44, 'B'), 'blue': (0x45, 'B'), 'white': (0x46, 'B') 'index': (0x47, 'B'), 'normred': (0x48, 'B'), 'normgreen': (0x49, 'B'), 'normblue': (0x4A, 'B'), 'all_data': (0x42, '9B'),
def __init__(self, red, green, blue, white): self.red, self.green, self.blue, self.white = red, green, blue, white
e881750df8a3317802a8d114a33238cbad8a5736 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/e881750df8a3317802a8d114a33238cbad8a5736/hitechnic.py
'rawwhite': (0x48, '<H')
'rawwhite': (0x48, '<H'), 'all_raw_data': (0x42, '<4H')
def __init__(self, red, green, blue, white): self.red, self.green, self.blue, self.white = red, green, blue, white
e881750df8a3317802a8d114a33238cbad8a5736 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/e881750df8a3317802a8d114a33238cbad8a5736/hitechnic.py
red = self.read_value('rawred') green = self.read_value('rawgreen') blue = self.read_value('rawblue') white = self.read_value('rawwhite')
red, green, blue, white = self.read_value('all_raw_data')
def get_passive_color(self): """"Returns color values when in passive or raw mode. """ red = self.read_value('rawred') green = self.read_value('rawgreen') blue = self.read_value('rawblue') white = self.read_value('rawwhite') return PassiveColor(red, green, blue, white)
e881750df8a3317802a8d114a33238cbad8a5736 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4128/e881750df8a3317802a8d114a33238cbad8a5736/hitechnic.py
option.subControls = ( Qt.QStyle.SC_ScrollBarAddLine|Qt.QStyle.SC_ScrollBarSubLine
option.subControls = ( Qt.QStyle.SC_ScrollBarAddLine|Qt.QStyle.SC_ScrollBarSubLine|
def paintEvent(self, event) : if len(self.highlight_positions_list) > 0 : painter = Qt.QPainter(self)
332ea461e32ffaf9424d70deaaa91ca1fc97426f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14668/332ea461e32ffaf9424d70deaaa91ca1fc97426f/ChromeScrollBar.py
def data(index = -1) :
def data(self, index = -1) :
def data(index = -1) : if index < 0 : index = self.index() return self.actions_list[index].data()
c07afcc1a5167640e8c1db09f3af2e1d53d99bd0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14668/c07afcc1a5167640e8c1db09f3af2e1d53d99bd0/RadioButtonsMenu.py
sys.path.append("client-pygame/lib")
def compress(base, directory): filelist = os.listdir(directory) filelist.sort() for file in filelist: if file in ('checksum.files', 'checksum.global', 'var', 'files.html'): continue if base: filename = base + '/' + file else: filename = file absfilename = os.path.join(directory, file) if os.path.isfile(absfilename): print 'BZIP2', os.path.normcase(absfilename) os.system('updater\\bzip2.exe %s' % os.path.normcase(absfilename)) elif os.path.isdir(absfilename): compress(filename, os.path.join(directory, file)) else: raise 'Unknow file type %s' % file
81d61fd1ada84a2def37ff2438e9d32023e6c7f8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10927/81d61fd1ada84a2def37ff2438e9d32023e6c7f8/deploy.py
import osci
def compress(base, directory): filelist = os.listdir(directory) filelist.sort() for file in filelist: if file in ('checksum.files', 'checksum.global', 'var', 'files.html'): continue if base: filename = base + '/' + file else: filename = file absfilename = os.path.join(directory, file) if os.path.isfile(absfilename): print 'BZIP2', os.path.normcase(absfilename) os.system('updater\\bzip2.exe %s' % os.path.normcase(absfilename)) elif os.path.isdir(absfilename): compress(filename, os.path.join(directory, file)) else: raise 'Unknow file type %s' % file
81d61fd1ada84a2def37ff2438e9d32023e6c7f8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10927/81d61fd1ada84a2def37ff2438e9d32023e6c7f8/deploy.py
"version": "%d.%d.%d%s" % osci.version,
"version": options.version,
def compress(base, directory): filelist = os.listdir(directory) filelist.sort() for file in filelist: if file in ('checksum.files', 'checksum.global', 'var', 'files.html'): continue if base: filename = base + '/' + file else: filename = file absfilename = os.path.join(directory, file) if os.path.isfile(absfilename): print 'BZIP2', os.path.normcase(absfilename) os.system('updater\\bzip2.exe %s' % os.path.normcase(absfilename)) elif os.path.isdir(absfilename): compress(filename, os.path.join(directory, file)) else: raise 'Unknow file type %s' % file
81d61fd1ada84a2def37ff2438e9d32023e6c7f8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10927/81d61fd1ada84a2def37ff2438e9d32023e6c7f8/deploy.py
shutil.copy2('client-pygame/lib/osci/version.py', 'server/lib/ige/ospace/ClientVersion.py') shutil.copy2('client-pygame/lib/osci/versiondata.py', 'server/lib/ige/ospace/versiondata.py')
def compress(base, directory): filelist = os.listdir(directory) filelist.sort() for file in filelist: if file in ('checksum.files', 'checksum.global', 'var', 'files.html'): continue if base: filename = base + '/' + file else: filename = file absfilename = os.path.join(directory, file) if os.path.isfile(absfilename): print 'BZIP2', os.path.normcase(absfilename) os.system('updater\\bzip2.exe %s' % os.path.normcase(absfilename)) elif os.path.isdir(absfilename): compress(filename, os.path.join(directory, file)) else: raise 'Unknow file type %s' % file
81d61fd1ada84a2def37ff2438e9d32023e6c7f8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10927/81d61fd1ada84a2def37ff2438e9d32023e6c7f8/deploy.py
_index_products([product])
if product.active: _index_products([product])
def index_product(product): """Indexes passed product. """ if product.is_variant(): try: product = product.parent.get_default_variant() except AttributeError: return _index_products([product])
67c601620255dc5eeb22616e9bf3a16acdc9965d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11163/67c601620255dc5eeb22616e9bf3a16acdc9965d/utils.py
def delete_product(product): """Deletes passed product from index. """ conn = Solr(SOLR_ADDRESS) conn.delete(id=product.id)
67c601620255dc5eeb22616e9bf3a16acdc9965d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11163/67c601620255dc5eeb22616e9bf3a16acdc9965d/utils.py
revision.committer,
revision.get_apparent_author(),
def _changesetFromRevision(self, branch, revision_id): """ Generate changeset for the given Bzr revision """ from datetime import datetime from vcpx.tzinfo import FixedOffset, UTC
d7bdc8e6b76b3ef027f3b37ac9720115ad992046 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5981/d7bdc8e6b76b3ef027f3b37ac9720115ad992046/bzr.py
super(DarcsChangeset, self).setLog(self.ignore_this.sub('', log))
log = self.ignore_this.sub('', log) if not SynchronizableTargetWorkingDir.PATCH_NAME_FORMAT: if log: log = self.revision + '\n' + log else: log = self.revision super(DarcsChangeset, self).setLog(log)
def setLog(self, log): """Strip away the "Ignore-this:" noise from the changelog."""
2a5213a6055f281c91c257228aa3d145749a6ea1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5981/2a5213a6055f281c91c257228aa3d145749a6ea1/source.py
phrase_counter = 0 phrases = dict () okeys = set ()
okeys = dict ()
def debug (*what): print >> sys.stderr, '[DEBUG]: ', ' '.join (map (unicode, what))
2adf966b62b6258fc88fcc4515f698c536634ba9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5124/2adf966b62b6258fc88fcc4515f698c536634ba9/make-json.py
okeys.add (okey) phrases[(okey, phrase)] = 0 phrase_counter += 1 if options.verbose and phrase_counter % 1000 == 0: print >> sys.stderr, '%dk phrases imported from %s.' % (phrase_counter / 1000, keyword_file)
okeys[okey] = [phrase] else: okeys[okey].append(phrase)
def debug (*what): print >> sys.stderr, '[DEBUG]: ', ' '.join (map (unicode, what))
2adf966b62b6258fc88fcc4515f698c536634ba9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5124/2adf966b62b6258fc88fcc4515f698c536634ba9/make-json.py
freq_total += freq ikeys = g ([[]], okey.split (), 0) if not ikeys and options.verbose: print >> sys.stderr, 'failed index generation for phrase [%s] %s.' % (okey, phrase) for i in ikeys: ikey = u' '.join (i) if ikey in ip_map: ip_map[ikey].add (k) else: ip_map[ikey] = set ([k])
ikeys = g ([[]], okey.split (), 0) if not ikeys and options.verbose: print >> sys.stderr, 'failed index generation for phrase [%s] %s.' % (okey, phrase) for i in ikeys: ikey = u' '.join (i) if ikey in ip_map: ip_map[ikey].add (k) else: ip_map[ikey] = set ([k]) for okey in okeys: for phrase in okeys[okey]: process_phrase(okey, phrase, 0) if options.verbose and phrase_counter % 1000 == 0: print >> sys.stderr, '%dk phrases imported from %s.' % (phrase_counter / 1000, keyword_file) del okeys
def process_phrase (okey, phrase, freq): global phrase_counter, phrases, freq_total, i_map phrase_counter += 1 k = (okey, phrase) if k in phrases: phrases[k] += freq else: phrases[k] = freq freq_total += freq ikeys = g ([[]], okey.split (), 0) if not ikeys and options.verbose: print >> sys.stderr, 'failed index generation for phrase [%s] %s.' % (okey, phrase) for i in ikeys: ikey = u' '.join (i) if ikey in ip_map: ip_map[ikey].add (k) else: ip_map[ikey] = set ([k])
2adf966b62b6258fc88fcc4515f698c536634ba9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5124/2adf966b62b6258fc88fcc4515f698c536634ba9/make-json.py
s = self.__dict[dict_prefix][1] s.append(schema_info)
s = self.__dict[dict_prefix] s[1].append(schema_info)
def __register_dict(self, dict_prefix, max_key_length, schema_info): if dict_prefix not in self.__dict: s = self.__dict[dict_prefix] = [max_key_length, [], None, dict(), -1] else: s = self.__dict[dict_prefix][1] s.append(schema_info)
e437d4a37df02212ebf6399bf07ea15211e582b6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5124/e437d4a37df02212ebf6399bf07ea15211e582b6/plumedb.py
process_phrase(k, p, 0)
process_phrase(k, p[1:] if p.startswith(u'*') else p, 0)
def process_phrase(okey, phrase, freq): global phrase_counter, phrases, freq_total, ip_map phrase_counter += 1 freq_total += freq k = (okey, phrase) if k in phrases: phrases[k] += freq else: phrases[k] = freq ikeys = g([[]], okey.split(), 0) if not ikeys and options.verbose: print >> sys.stderr, 'failed index generation for phrase [%s] %s.' % (okey, phrase) for i in ikeys: ikey = u' '.join(i) if ikey in ip_map: ip_map[ikey].add(k) else: ip_map[ikey] = set([k])
91af39a983b47dbf9cea841858caa08c20b9fc8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5124/91af39a983b47dbf9cea841858caa08c20b9fc8d/make-json.py
if phrase.startswith(u'*'): phrase = phrase[1:]
def process_phrase(okey, phrase, freq): global phrase_counter, phrases, freq_total, ip_map phrase_counter += 1 freq_total += freq k = (okey, phrase) if k in phrases: phrases[k] += freq else: phrases[k] = freq ikeys = g([[]], okey.split(), 0) if not ikeys and options.verbose: print >> sys.stderr, 'failed index generation for phrase [%s] %s.' % (okey, phrase) for i in ikeys: ikey = u' '.join(i) if ikey in ip_map: ip_map[ikey].add(k) else: ip_map[ikey] = set([k])
91af39a983b47dbf9cea841858caa08c20b9fc8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5124/91af39a983b47dbf9cea841858caa08c20b9fc8d/make-json.py