rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
def get_vt_graph_remotely(path_to_vistrails, download_url, host, db_name, vt_id, port, path_to_figures, build_always=False, pdf=False): """get_vt_graph_remotely(path_to_vistrails: str, download_url: str, host: str, db_name: str, vt_id: str, port: str, path_to_figures: str, build_always: bool, pdf: bool) -> tuple(bool, str) Get the version tree image of a vistrail and returns a tuple containing a boolean saying whether it was successful and the latex code. """ log("get_vt_graph_remotely") if not path_exists_and_not_empty(path_to_figures) or build_always: if not os.path.exists(path_to_figures): os.makedirs(path_to_figures) if check_url(path_to_vistrails): website = "://".join(urlparse(path_to_vistrails)[:2]) request = "?host=%s&db=%s&vt=%s&port=%s&pdf=%s&showtree=True" % (host, db_name, vt_id, port, pdf) url = path_to_vistrails + request log("will download from: " + url) (result, msg) = _download_content(website, url, path_to_figures) if result == True: log("success") return (result, generate_latex(download_url, host, db_name, vt_id, None, port, '', False, False, path_to_figures, graphics_options)) else: log("Error: " + msg) return (result, generate_latex_error(msg)) else: msg = "Invalid url: %s" % path_to_vistrails log("Error: " + msg) return (False, generate_latex_error(msg)) else: log("using cached files") return (True, generate_latex(download_url, host, db_name, vt_id, None, port, '', False, False, path_to_figures, graphics_options)) def get_wf_graph_remotely(path_to_vistrails, download_url, host, db_name, vt_id, version, port, path_to_figures, build_always=False, tag='', pdf=False): """get_wf_graph_remotely(path_to_vistrails: str, download_url:str, host: str, db_name: str, vt_id: str, version: str, port: str, path_to_figures: str, build_always: bool, tag:str, pdf: bool) -> tuple(bool, str) Get the graph of a workflow and returns a tuple containing a boolean saying whether it was successful and the latex code. """ log("get_wf_graph_remotely") if not path_exists_and_not_empty(path_to_figures) or build_always: if not os.path.exists(path_to_figures): os.makedirs(path_to_figures) if check_url(path_to_vistrails): website = "://".join(urlparse(path_to_vistrails)[:2]) request = "?host=%s&db=%s&vt=%s&version=%s&port=%s&pdf=%s&showworkflow=True" % (host, db_name, vt_id, urllib2.quote(version), port, pdf) url = path_to_vistrails + request log("will download from: " + url) (result, msg) = _download_content(website, url, path_to_figures) if result == True: log("success") return (result, generate_latex(download_url, host, db_name, vt_id, version, port, tag, False, False, path_to_figures, graphics_options)) else: log("Error: " + msg) return (result, generate_latex_error(msg)) else: msg = "Invalid url: %s" % path_to_vistrails log("Error: " + msg) return (False, generate_latex_error(msg)) else: log("using cached files") return (True, generate_latex(download_url, host, db_name, vt_id, version, port, tag, False, False, path_to_figures, graphics_options)) | def download_as_text(url): try: furl = urllib2.urlopen(url) s = furl.read() return s except: return None | 3123297d6a1b374a7b720af850b6ee46e7955b16 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3123297d6a1b374a7b720af850b6ee46e7955b16/includevistrail.py |
|
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False | 3123297d6a1b374a7b720af850b6ee46e7955b16 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3123297d6a1b374a7b720af850b6ee46e7955b16/includevistrail.py |
||
if tree: path_to_figures = os.path.join("vistrails_images", "%s_%s_%s_%s_%s" % (host, db_name, port, vt_id, out_type)) elif wgraph: path_to_figures = os.path.join("vistrails_images", "%s_%s_%s_%s_%s_%s_graph" % (host, db_name, port, vt_id, version, out_type)) | def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False | 3123297d6a1b374a7b720af850b6ee46e7955b16 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3123297d6a1b374a7b720af850b6ee46e7955b16/includevistrail.py |
|
result, latex = run_vistrails_locally(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, build_always, version_tag, execute, showspreadsheetonly,pdf) | if tree: result, latex = get_vt_graph_locally(path_to_vistrails, host, db_name, vt_id, port, path_to_figures, build_always, pdf) elif wgraph: result, latex = get_wf_graph_locally(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, version_tag, pdf) else: result, latex = run_vistrails_locally(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, build_always, version_tag, execute, showspreadsheetonly,pdf) | def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False | 3123297d6a1b374a7b720af850b6ee46e7955b16 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3123297d6a1b374a7b720af850b6ee46e7955b16/includevistrail.py |
result, latex = run_vistrails_remotely(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, build_always, version_tag, execute, showspreadsheetonly,pdf) | if tree: result, latex = get_vt_graph_remotely(path_to_vistrails, download_url, host, db_name, vt_id, port, path_to_figures, build_always, pdf) elif wgraph: result, latex = get_wf_graph_remotely(path_to_vistrails, download_url, host, db_name, vt_id, version, port, path_to_figures, build_always,version_tag, pdf) else: result, latex = run_vistrails_remotely(path_to_vistrails, download_url, host, db_name, vt_id, version, port, path_to_figures, build_always, version_tag, execute, showspreadsheetonly,pdf) | def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False | 3123297d6a1b374a7b720af850b6ee46e7955b16 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3123297d6a1b374a7b720af850b6ee46e7955b16/includevistrail.py |
"%s is not a valid url nor a valid path to vistrails.py" %\ (path_to_vistrails)) | generate_latex_error("%s is not a valid url nor a valid path to vistrails.py" %\ (path_to_vistrails))) | def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False | 3123297d6a1b374a7b720af850b6ee46e7955b16 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3123297d6a1b374a7b720af850b6ee46e7955b16/includevistrail.py |
reg.get_descriptor_by_name('edu.utah.sci.vistrails.persistence.exp', | reg.get_descriptor_by_name('edu.utah.sci.vistrails.persistence', | def set_values(self): from core.modules.module_registry import get_module_registry reg = get_module_registry() PersistentRef = \ reg.get_descriptor_by_name('edu.utah.sci.vistrails.persistence.exp', 'PersistentRef').module | 9dd3ad8e0b08f71ad1f767386d7937685ebdca87 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9dd3ad8e0b08f71ad1f767386d7937685ebdca87/widgets.py |
reg.get_descriptor_by_name('edu.utah.sci.vistrails.persistence.exp', | reg.get_descriptor_by_name('edu.utah.sci.vistrails.persistence', | def get_values(self): from core.modules.module_registry import get_module_registry reg = get_module_registry() PersistentRef = \ reg.get_descriptor_by_name('edu.utah.sci.vistrails.persistence.exp', 'PersistentRef').module | 9dd3ad8e0b08f71ad1f767386d7937685ebdca87 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9dd3ad8e0b08f71ad1f767386d7937685ebdca87/widgets.py |
'vistrails_1_3.log') | 'vistrails_%s.log'%(get_version())) | def setupLogFile(self): if not self.temp_configuration.check('logFile'): s = os.path.join(self.temp_configuration.dotVistrails, 'vistrails_1_3.log') self.temp_configuration.logFile = s if not self.configuration.check('logFile'): # if this was not set before, it should point to the # value in temp_configuration s = os.path.join(self.temp_configuration.dotVistrails, 'vistrails_1_3.log') self.configuration.logFile = s if not os.path.lexists(self.temp_configuration.dotVistrails): self.create_default_directory() debug.DebugPrint.getInstance().set_logfile(self.temp_configuration.logFile) | 561b499791f10733579de872d846999d83fc58bd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/561b499791f10733579de872d846999d83fc58bd/startup.py |
'vistrails_1_3.log') | 'vistrails_%s.log'%(get_version())) | def setupLogFile(self): if not self.temp_configuration.check('logFile'): s = os.path.join(self.temp_configuration.dotVistrails, 'vistrails_1_3.log') self.temp_configuration.logFile = s if not self.configuration.check('logFile'): # if this was not set before, it should point to the # value in temp_configuration s = os.path.join(self.temp_configuration.dotVistrails, 'vistrails_1_3.log') self.configuration.logFile = s if not os.path.lexists(self.temp_configuration.dotVistrails): self.create_default_directory() debug.DebugPrint.getInstance().set_logfile(self.temp_configuration.logFile) | 561b499791f10733579de872d846999d83fc58bd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/561b499791f10733579de872d846999d83fc58bd/startup.py |
def setupLogFile(self): if not self.temp_configuration.check('logFile'): s = os.path.join(self.temp_configuration.dotVistrails, 'vistrails_1_3.log') self.temp_configuration.logFile = s if not self.configuration.check('logFile'): # if this was not set before, it should point to the # value in temp_configuration s = os.path.join(self.temp_configuration.dotVistrails, 'vistrails_1_3.log') self.configuration.logFile = s if not os.path.lexists(self.temp_configuration.dotVistrails): self.create_default_directory() debug.DebugPrint.getInstance().set_logfile(self.temp_configuration.logFile) | 561b499791f10733579de872d846999d83fc58bd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/561b499791f10733579de872d846999d83fc58bd/startup.py |
||
zipcmd = os.path.join(cur_dir,'zip.exe') | zipcmd = os.path.join(os.getcwd(),'zip.exe') | def save_vistrail_bundle_to_zip_xml(save_bundle, filename, vt_save_dir=None, version=None): """save_vistrail_bundle_to_zip_xml(save_bundle: SaveBundle, filename: str, vt_save_dir: str, version: str) -> (save_bundle: SaveBundle, vt_save_dir: str) save_bundle: a SaveBundle object containing vistrail data to save filename: filename to save to vt_save_dir: directory storing any previous files Generates a zip compressed version of vistrail. It raises an Exception if there was an error. """ core.requirements.require_executable('zip') if save_bundle.vistrail is None: raise VistrailsDBException('save_vistrail_bundle_to_zip_xml failed, ' 'bundle does not contain a vistrail') if not vt_save_dir: vt_save_dir = tempfile.mkdtemp(prefix='vt_save') # saving zip files flat so we'll do without this dir for now # abstraction_dir = os.path.join(vt_save_dir, 'abstractions') thumbnail_dir = os.path.join(vt_save_dir, 'thumbs') # Save Vistrail xml_fname = os.path.join(vt_save_dir, 'vistrail') save_vistrail_to_xml(save_bundle.vistrail, xml_fname, version) # Save Log if save_bundle.vistrail.db_log_filename is not None: xml_fname = os.path.join(vt_save_dir, 'log') if save_bundle.vistrail.db_log_filename != xml_fname: shutil.copyfile(save_bundle.vistrail.db_log_filename, xml_fname) save_bundle.vistrail.db_log_filename = xml_fname if save_bundle.log is not None: xml_fname = os.path.join(vt_save_dir, 'log') save_log_to_xml(save_bundle.log, xml_fname, version, True) save_bundle.vistrail.db_log_filename = xml_fname # Save Abstractions saved_abstractions = [] for obj in save_bundle.abstractions: if type(obj) == type(""): # FIXME we should have an abstraction directory here instead # of the abstraction_ prefix... if not os.path.basename(obj).startswith('abstraction_'): obj_fname = 'abstraction_' + os.path.basename(obj) else: obj_fname = os.path.basename(obj) # xml_fname = os.path.join(abstraction_dir, obj_fname) xml_fname = os.path.join(vt_save_dir, obj_fname) saved_abstractions.append(xml_fname) # if not os.path.exists(abstraction_dir): # os.mkdir(abstraction_dir) # print "obj:", obj # print "xml_fname:", xml_fname if obj != xml_fname: # print 'copying %s -> %s' % (obj, xml_fname) try: shutil.copyfile(obj, xml_fname) except Exception, e: saved_abstractions.pop() debug.critical('copying %s -> %s failed: %s' % \ (obj, xml_fname, str(e))) else: raise VistrailsDBException('save_vistrail_bundle_to_zip_xml failed, ' 'abstraction list entry must be a filename') # Save Thumbnails saved_thumbnails = [] for obj in save_bundle.thumbnails: if type(obj) == type(""): obj_fname = os.path.basename(obj) png_fname = os.path.join(thumbnail_dir, obj_fname) saved_thumbnails.append(png_fname) if not os.path.exists(thumbnail_dir): os.mkdir(thumbnail_dir) #print 'copying %s -> %s' %(obj, png_fname) try: shutil.copyfile(obj, png_fname) except Exception, e: saved_thumbnails.pop() debug.warning('copying thumbnail %s -> %s failed: %s' % \ (obj, png_fname, str(e))) else: raise VistrailsDBException('save_vistrail_bundle_to_zip_xml failed, ' 'thumbnail list entry must be a filename') tmp_zip_dir = tempfile.mkdtemp(prefix='vt_zip') tmp_zip_file = os.path.join(tmp_zip_dir, "vt.zip") output = [] rel_vt_save_dir = os.path.split(vt_save_dir)[1] # on windows, we assume zip.exe is in the current directory when # running from the binary install zipcmd = 'zip' if systemType in ['Windows', 'Microsoft']: zipcmd = os.path.join(cur_dir,'zip.exe') if not os.path.exists(zipcmd): zipcmd = 'zip.exe' #assume zip is in path cmdline = [zipcmd, '-r', '-q', tmp_zip_file, '.'] try: #if we want that directories are also stored in the zip file # we need to run from the vt directory with Chdir(vt_save_dir): result = execute_cmdline(cmdline,output) #print result, output if result != 0 or len(output) != 0: for line in output: if line.find('deflated') == -1: raise VistrailsDBException(" ".join(output)) shutil.copyfile(tmp_zip_file, filename) finally: os.unlink(tmp_zip_file) os.rmdir(tmp_zip_dir) save_bundle = SaveBundle(save_bundle.bundle_type, save_bundle.vistrail, save_bundle.log, thumbnails=saved_thumbnails, abstractions=saved_abstractions) return (save_bundle, vt_save_dir) | 0a2b8a0d50d88c7d37635cf49b38ec59c9ee83c3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/0a2b8a0d50d88c7d37635cf49b38ec59c9ee83c3/io.py |
new_locator = ZIPFileLocator(fname).load() | new_locator = ZIPFileLocator(fname) | def merge_vt(self, host, port, db_name, user, new_vt_filepath, old_db_vt_id, is_local=True): """ Merge new_vt (new_vt_filepath) with current vt (old_db_vt_id) | 2b53ad32a374c31727c9093c24c9f013c31dbcca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/2b53ad32a374c31727c9093c24c9f013c31dbcca/application_server.py |
self.server_logger.info("get_vt_graph_png(%s, %d, %s, %d)" % (host, port, db_name, vt_id)) | self.server_logger.info("get_vt_graph_png(%s, %s, %s, %s)" % (host, port, db_name, vt_id)) | def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """ | 2b53ad32a374c31727c9093c24c9f013c31dbcca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/2b53ad32a374c31727c9093c24c9f013c31dbcca/application_server.py |
port=port, | port=int(port), | def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """ | 2b53ad32a374c31727c9093c24c9f013c31dbcca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/2b53ad32a374c31727c9093c24c9f013c31dbcca/application_server.py |
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """ self.server_logger.info("get_vt_graph_pdf(%s, %s, %s, %s)" % (host, port, db_name, vt_id)) try: vt_id = long(vt_id) subdir = 'vistrails' filepath = os.path.join(media_dir, 'graphs', subdir) base_fname = "graph_%s.pdf" % (vt_id) filename = os.path.join(filepath,base_fname) if ((not os.path.exists(filepath) or os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None): proxy = self.proxies_queue.get() try: self.server_logger.info("Sending request to %s" % proxy) result = proxy.get_vt_graph_pdf(host, port, db_name, vt_id, is_local) self.proxies_queue.put(proxy) self.server_logger.info("returning %s" % result) return result except Exception, e: self.server_logger.error(str(e)) return (str(e), 0) if not os.path.exists(filepath): os.mkdir(filepath) if not os.path.exists(filename): locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=vt_id, obj_type=None, connection_id=None) (v, abstractions , thumbnails) = io.load_vistrail(locator) controller = VistrailController() controller.set_vistrail(v, locator, abstractions, thumbnails) from gui.version_view import QVersionTreeView version_view = QVersionTreeView() version_view.scene().setupScene(controller) version_view.scene().saveToPDF(filename) del version_view else: self.server_logger.info("Found cached pdf: %s" % filename) if is_local: return (os.path.join(subdir,base_fname), 1) else: f = open(filename, 'rb') contents = f.read() f.close() return (xmlrpclib.Binary(contents), 1) except Exception, e: self.server_logger.error("Error when saving pdf: %s" % str(e)) return (str(e), 0) | def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """ | 2b53ad32a374c31727c9093c24c9f013c31dbcca /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/2b53ad32a374c31727c9093c24c9f013c31dbcca/application_server.py |
|
port.find_port_types() | def remap(): port_type = \ PortSpec.port_type_map.inverse[port.type] pspec = reg.get_port_spec(m.package, m.name, m.namespace, port.name, port_type) all_ports = reg.all_source_ports(d) # print "pspec", pspec # First try to find a perfect match for (klass_name, ports) in all_ports: for candidate_port in ports: if (candidate_port.type_equals(pspec) and candidate_port.name == port.name): #print "found perfect match" port.spec = candidate_port port.find_port_types() return True # Now try to find an imperfect one for (klass_name, ports) in all_ports: for candidate_port in ports: print candidate_port if candidate_port.type_equals(pspec): #print "found imperfect match" port.name = candidate_port.name port.spec = candidate_port port.find_port_types() return True return False | f7ceb0f4a3a7df30371910dc88e03db6833134f8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/f7ceb0f4a3a7df30371910dc88e03db6833134f8/__init__.py |
|
port.find_port_types() | def remap(): port_type = \ PortSpec.port_type_map.inverse[port.type] pspec = reg.get_port_spec(m.package, m.name, m.namespace, port.name, port_type) all_ports = reg.all_source_ports(d) # print "pspec", pspec # First try to find a perfect match for (klass_name, ports) in all_ports: for candidate_port in ports: if (candidate_port.type_equals(pspec) and candidate_port.name == port.name): #print "found perfect match" port.spec = candidate_port port.find_port_types() return True # Now try to find an imperfect one for (klass_name, ports) in all_ports: for candidate_port in ports: print candidate_port if candidate_port.type_equals(pspec): #print "found imperfect match" port.name = candidate_port.name port.spec = candidate_port port.find_port_types() return True return False | f7ceb0f4a3a7df30371910dc88e03db6833134f8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/f7ceb0f4a3a7df30371910dc88e03db6833134f8/__init__.py |
|
port.find_port_types() | def remap(): port_type = \ PortSpec.port_type_map.inverse[port.type] pspec = reg.get_port_spec(m.package, m.name, m.namespace, port.name, port_type) | f7ceb0f4a3a7df30371910dc88e03db6833134f8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/f7ceb0f4a3a7df30371910dc88e03db6833134f8/__init__.py |
|
port.find_port_types() | def remap(): port_type = \ PortSpec.port_type_map.inverse[port.type] pspec = reg.get_port_spec(m.package, m.name, m.namespace, port.name, port_type) | f7ceb0f4a3a7df30371910dc88e03db6833134f8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/f7ceb0f4a3a7df30371910dc88e03db6833134f8/__init__.py |
|
self._port_type = port_type.lower() | self._port_type = port_type.lower() if port_type else None | def __init__(self, msg, module=None, port_name=None, port_type=None): Exception.__init__(self, msg) self._msg = msg self._module = module self._port_name = port_name self._port_type = port_type.lower() | 93b3be3d2a50f8082508bbac6c63769fd65e4a54 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/93b3be3d2a50f8082508bbac6c63769fd65e4a54/upgradeworkflow.py |
version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ | version=None, pdf=False, vt_tag='', build_always=False, parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ | def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local)) | 47a1105664a0a84abc7c7faa7587e2a74000d648 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/47a1105664a0a84abc7c7faa7587e2a74000d648/application_server.py |
vt_tag, parameters, is_local)) | vt_tag, build_always, parameters, is_local)) | def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local)) | 47a1105664a0a84abc7c7faa7587e2a74000d648 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/47a1105664a0a84abc7c7faa7587e2a74000d648/application_server.py |
if (not self.path_exists_and_not_empty(path_to_figures) and self.proxies_queue is not None): | if ((not self.path_exists_and_not_empty(path_to_figures) or build_always) and self.proxies_queue is not None): | def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local)) | 47a1105664a0a84abc7c7faa7587e2a74000d648 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/47a1105664a0a84abc7c7faa7587e2a74000d648/application_server.py |
parameters, is_local) | build_always, parameters, is_local) | def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local)) | 47a1105664a0a84abc7c7faa7587e2a74000d648 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/47a1105664a0a84abc7c7faa7587e2a74000d648/application_server.py |
traceback.print_exc() | def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters=''): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters)) | 528e48ed7e11a5a00323f9a015feecc53bb44113 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/528e48ed7e11a5a00323f9a015feecc53bb44113/application_server.py |
|
""" | def get_wf_datasets(self, host, port, db_name, vt_id, version): self.server_logger.info("Request: get_wf_datasets(%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) | 528e48ed7e11a5a00323f9a015feecc53bb44113 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/528e48ed7e11a5a00323f9a015feecc53bb44113/application_server.py |
|
""" | def index_workflow(self, host, port, db_name, vt_id, wf_info): self.server_logger.info("Request: index_workflow(%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, wf_info)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) | 528e48ed7e11a5a00323f9a015feecc53bb44113 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/528e48ed7e11a5a00323f9a015feecc53bb44113/application_server.py |
|
'\n '.join(str(e) for e in self._exception_set) | '\n '.join(line for e in self._exception_set for line in str(e).splitlines()) def get_exception_set(self): return self._exception_set | def __str__(self): return "Pipeline cannot be instantiated:\n " + \ '\n '.join(str(e) for e in self._exception_set) | d350d9a3d5252cadad63151e842c058ddb794296 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/d350d9a3d5252cadad63151e842c058ddb794296/__init__.py |
return True | return False | def versions_increasing(v1, v2): v1_list = v1.split('.') v2_list = v2.split('.') try: while len(v1_list) > 0 and len(v2_list) > 0: v1_num = int(v1_list.pop()) v2_num = int(v2_list.pop()) if v1_num < v2_num: return True elif v1_num > v2_num: return False if len(v1_list) < len(v2_list): return True elif len(v1_list) > len(v2_list): return False except ValueError: print "ERROR: cannot compare versions whose components " \ "are not integers" return True | d350d9a3d5252cadad63151e842c058ddb794296 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/d350d9a3d5252cadad63151e842c058ddb794296/__init__.py |
info = socket.getaddrinfo(socket.gethostname(), None) for i in info: if len(i[4][0]) <= 15: return i[4][0] else: | try: info = socket.getaddrinfo(socket.gethostname(), None) for i in info: if len(i[4][0]) <= 15: return i[4][0] else: return '0.0.0.0' except: | def current_ip(): """ current_ip() -> str Gets current IP address trying to avoid the IPv6 interface """ info = socket.getaddrinfo(socket.gethostname(), None) for i in info: if len(i[4][0]) <= 15: return i[4][0] else: return '0.0.0.0' | 4ed478859da5fec10c1985c66f93128424cc359a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/4ed478859da5fec10c1985c66f93128424cc359a/__init__.py |
_hash = self.hash() | def load(self, type, tmp_dir=None): self._hash = self.hash() if DBLocator.cache.has_key(self._hash): save_bundle = DBLocator.cache[self._hash] obj = save_bundle.get_primary_obj() ts = io.get_db_object_modification_time(self.get_connection(), obj.db_id, obj.vtType) ts = datetime(*strptime(str(ts).strip(), '%Y-%m-%d %H:%M:%S')[0:6]) #print DBLocator.cache_timestamps[self._hash],ts if DBLocator.cache_timestamps[self._hash] == ts: # If thumbnail cache was cleared, get thumbs from db if tmp_dir is not None: for absfname in save_bundle.thumbnails: if not os.path.isfile(absfname): save_bundle.thumbnails = io.open_thumbnails_from_db(self.get_connection(), type, self.obj_id, tmp_dir) break return save_bundle connection = self.get_connection() save_bundle = io.open_bundle_from_db(type, connection, self.obj_id, tmp_dir) primary_obj = save_bundle.get_primary_obj() self._name = primary_obj.db_name for obj in save_bundle.get_db_objs(): obj.locator = self #The problem of computing the hash again is that will always be #different from what the locator is created because we don't know #the name of the locator before it is loaded. So we will use the #one that was created before loading the vistrail #_hash = self.hash() DBLocator.cache[self._hash] = save_bundle.do_copy() DBLocator.cache_timestamps[self._hash] = primary_obj.db_last_modified return save_bundle | 90cd36889371bb2707e7b8e4c101838e8d6b715d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/90cd36889371bb2707e7b8e4c101838e8d6b715d/locator.py |
|
if self._hash != '': self_hash = self.hash() | self_hash = self.hash() | def save(self, save_bundle, do_copy=False, version=None): connection = self.get_connection() for obj in save_bundle.get_db_objs(): obj.db_name = self._name save_bundle = io.save_bundle_to_db(save_bundle, connection, do_copy, version) primary_obj = save_bundle.get_primary_obj() self._obj_id = primary_obj.db_id self._obj_type = primary_obj.vtType for obj in save_bundle.get_db_objs(): obj.locator = self #update the cache with a copy of the new bundle if self._hash != '': self_hash = self.hash() DBLocator.cache[self._hash] = save_bundle.do_copy() DBLocator.cache_timestamps[self._hash] = primary_obj.db_last_modified return save_bundle | 90cd36889371bb2707e7b8e4c101838e8d6b715d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/90cd36889371bb2707e7b8e4c101838e8d6b715d/locator.py |
childnode = ElementTree.SubElement(node,'name') childnode.text = str(self._name) | def to_xml(self, node=None): """to_xml(node: ElementTree.Element) -> ElementTree.Element Convert this object to an XML representation. """ if node is None: node = ElementTree.Element('locator') | 90cd36889371bb2707e7b8e4c101838e8d6b715d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/90cd36889371bb2707e7b8e4c101838e8d6b715d/locator.py |
|
for child in node.getchildren(): if child.tag == 'name': name = str(child.text).strip(" \n\t") return DBLocator(host, port, database, user, passwd, name, vt_id, None) return None return None | return DBLocator(host, port, database, user, passwd, name, vt_id, None) else: return None | def bool_conv(x): s = str(x).upper() if s == 'TRUE': return True if s == 'FALSE': return False | 90cd36889371bb2707e7b8e4c101838e8d6b715d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/90cd36889371bb2707e7b8e4c101838e8d6b715d/locator.py |
self.perm_download = QtGui.QCheckBox("download") | def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
|
top_layout.addWidget(self.perm_download) | self.perm_view.setEnabled(True) | def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """ | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
||
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """ | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
||
vistrail_link = "%s/vistrails/details/%s" % \ | vt_id_url = "%s/vistrails/get_id/%s" % \ | def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """ | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
self.loginUser = QtGui.QLineEdit(self.config.webRepositoryLogin) | self.dialog.loginUser = QtGui.QLineEdit(self.config.webRepositoryLogin) | def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
self.loginUser = QtGui.QLineEdit("") self.loginUser.setFixedWidth(200) self.loginUser.setSizePolicy(QtGui.QSizePolicy.Fixed, | self.dialog.loginUser = QtGui.QLineEdit("") self.dialog.loginUser.setFixedWidth(200) self.dialog.loginUser.setSizePolicy(QtGui.QSizePolicy.Fixed, | def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
base_layout.addWidget(self.loginUser) | base_layout.addWidget(self.dialog.loginUser) | def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
self.loginUser.setEnabled(True) | self.dialog.loginUser.setEnabled(True) | def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
self.loginUser.setEnabled(False) | self.dialog.loginUser.setEnabled(False) | def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
params = urllib.urlencode({'username':self.loginUser.text(), | params = urllib.urlencode({'username':self.dialog.loginUser.text(), | def clicked_on_login(self): """ Attempts to log into web repository stores auth cookie for session """ from gui.application import VistrailsApplication | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
self.loginUser.setEnabled(False) | self.dialog.loginUser.setEnabled(False) | def clicked_on_login(self): """ Attempts to log into web repository stores auth cookie for session """ from gui.application import VistrailsApplication | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
self.config.webRepositoryLogin == self.loginUser.text(): | self.config.webRepositoryLogin == self.dialog.loginUser.text(): | def clicked_on_login(self): """ Attempts to log into web repository stores auth cookie for session """ from gui.application import VistrailsApplication | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
self.config.webRepositoryLogin = str(self.loginUser.text()) | self.config.webRepositoryLogin = str(self.dialog.loginUser.text()) | def clicked_on_login(self): """ Attempts to log into web repository stores auth cookie for session """ from gui.application import VistrailsApplication | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
self.loginUser.setEnabled(True) | self.dialog.loginUser.setEnabled(True) | def clicked_on_logout(self): """ Reset cookie, text fields and gui buttons """ self.loginUser.setEnabled(True) self.loginPassword.setEnabled(True) self._logout_button.setEnabled(False) self._login_button.setEnabled(True) self.saveLogin.setEnabled(True) self.dialog.cookiejar = None | 9001cae1a3809039b46aed5d00bc5877b84f3544 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9001cae1a3809039b46aed5d00bc5877b84f3544/repository.py |
elements = parameters.split("&") | elements = parameters.split("&&") | def run_and_get_results(w_list, parameters='', workflow_info=None, update_vistrail=False, extra_info=None): """run_and_get_results(w_list: list of (locator, version), parameters: str, workflow_info:str, update_vistrail: boolean) Run all workflows in w_list, and returns an interpreter result object. version can be a tag name or a version id. """ elements = parameters.split("&") aliases = {} result = [] for locator, workflow in w_list: (v, abstractions , thumbnails) = load_vistrail(locator) controller = VistrailController() controller.set_vistrail(v, locator, abstractions, thumbnails) if type(workflow) == type("str"): version = v.get_version_number(workflow) elif type(workflow) in [ type(1), long]: version = workflow elif workflow is None: version = controller.get_latest_version_in_graph() else: msg = "Invalid version tag or number: %s" % workflow raise VistrailsInternalError(msg) controller.change_selected_version(version) for e in elements: pos = e.find("=") if pos != -1: key = e[:pos].strip() value = e[pos+1:].strip() if controller.current_pipeline.has_alias(key): aliases[key] = value if workflow_info is not None and controller.current_pipeline is not None: from gui.pipeline_view import QPipelineView pipeline_view = QPipelineView() pipeline_view.scene().setupScene(controller.current_pipeline) base_fname = "%s_%s_pipeline.pdf" % (locator.short_name, version) filename = os.path.join(workflow_info, base_fname) pipeline_view.scene().saveToPDF(filename) del pipeline_view base_fname = "%s_%s_pipeline.xml" % (locator.short_name, version) filename = os.path.join(workflow_info, base_fname) core.db.io.save_workflow(controller.current_pipeline, filename) if not update_vistrail: conf = get_vistrails_configuration() if conf.has('thumbs'): conf.thumbs.autoSave = False (results, _) = controller.execute_current_workflow(aliases, extra_info) run = results[0] run.workflow_info = (locator.name, version) run.pipeline = controller.current_pipeline #not sure if you need to add the abstractions back #but just to be safe if update_vistrail: controller.write_vistrail(locator) result.append(run) return result | fbccb5b68ba643cf5d0d47e9b2a7dfcb2a28f004 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/fbccb5b68ba643cf5d0d47e9b2a7dfcb2a28f004/console_mode.py |
CurrentTheme.DEBUG_INFO_COLOR.name()) | CurrentTheme.DEBUG_INFO_COLOR.name() + ';background-color: | def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails Messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) | ee8906c91039ec4223a5bb680b953260096a657f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ee8906c91039ec4223a5bb680b953260096a657f/debug.py |
CurrentTheme.DEBUG_WARNING_COLOR.name()) | CurrentTheme.DEBUG_WARNING_COLOR.name() + ';background-color: | def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails Messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) | ee8906c91039ec4223a5bb680b953260096a657f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ee8906c91039ec4223a5bb680b953260096a657f/debug.py |
CurrentTheme.DEBUG_CRITICAL_COLOR.name()) | CurrentTheme.DEBUG_CRITICAL_COLOR.name() + ';background-color: | def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails Messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) | ee8906c91039ec4223a5bb680b953260096a657f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ee8906c91039ec4223a5bb680b953260096a657f/debug.py |
visible == True | visible = True | def toggleType(self, s, visible): if visible == QtCore.Qt.Unchecked: visible = False elif visible == QtCore.Qt.Checked: visible == True for item in [self.list.item(i) for i in xrange(self.list.count())]: if str(item.data(32).toString()).split('\n')[0] == s: self.list.setItemHidden(item, not visible) | ee8906c91039ec4223a5bb680b953260096a657f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ee8906c91039ec4223a5bb680b953260096a657f/debug.py |
pattern = re.compile(r"(^r[0-9]+ \| )(\S+ \| )", re.MULTILINE) | pattern = re.compile(r"(^\s*?def vistrails_revision\(\):.*?release = ['\"])([0-9]+?)(['\"].*?return release)", re.DOTALL | re.MULTILINE) | 9f3b509da5a4db0c96d96a025eb7e9f70da18184 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9f3b509da5a4db0c96d96a025eb7e9f70da18184/make-vistrails-src-nightly.py |
|
expected_count = int(REVISION) - int(last_revision) | pattern = re.compile(r"(^\s*?def vistrails_revision\(\):.*?release = ['\"])([0-9]+?)(['\"].*?return release)", re.DOTALL | re.MULTILINE) | 9f3b509da5a4db0c96d96a025eb7e9f70da18184 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/9f3b509da5a4db0c96d96a025eb7e9f70da18184/make-vistrails-src-nightly.py |
|
if self.db_type and self.db_type.find(':') != -1: (self._identifier, name) = self.db_type.split(':', 1) if name.find('|') != -1: (self._namespace, self._type) = name.rsplit('|', 1) else: self._namespace = None self._type = name else: | if self.db_type: k = self.db_type.split(':', 2) else: k = [] if len(k) < 2: | def parse_db_type(self): if self.db_type and self.db_type.find(':') != -1: (self._identifier, name) = self.db_type.split(':', 1) if name.find('|') != -1: (self._namespace, self._type) = name.rsplit('|', 1) else: self._namespace = None self._type = name else: # FIXME don't hardcode this self._identifier = "edu.utah.sci.vistrails.basic" self._namespace = None self._type = self.db_type | 7e59568440f9e1eab6eb50daa7dd471a8c4b1231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/7e59568440f9e1eab6eb50daa7dd471a8c4b1231/module_param.py |
self.db_type = self._identifier + ':' + self._namespace + \ '|' + self._type else: self.db_type = self._identifier + ':' + self._type | type_list.append(self._namespace) self.db_type = ':'.join([self._identifier, self._type, self._namespace]) | def update_db_type(self): if not self._type: self.db_type = None else: if not self._identifier: # FIXME don't hardcode this self._identifier = "edu.utah.sci.vistrails.basic" if self._namespace: self.db_type = self._identifier + ':' + self._namespace + \ '|' + self._type else: self.db_type = self._identifier + ':' + self._type | 7e59568440f9e1eab6eb50daa7dd471a8c4b1231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/7e59568440f9e1eab6eb50daa7dd471a8c4b1231/module_param.py |
msg = "Web server returned: %s" % page | msg = "url: '%s' \n returned: %s" % (url,page.strip()) | def _download_content(url, request, path_to_figures): """_download_images(url:string, request:string, path_to_figures:string) -> (Boolean, message) Downloads all images and pdf files listed in url and saves them to path_to_figures """ website = url url = request try: page = download_as_text(url) # we will look for images and other files embedded in the html re_imgs = re.compile('<img[^>]*/>') re_src = re.compile('(.*src=")([^"]*)"') re_a = re.compile('<a[^>]*>[^<]*</a>') re_href = re.compile('(.*href=")([^"]*)"') images = re_imgs.findall(page) files = re_a.findall(page) failed = False msg = '' if len(images) > 0 or len(files) > 0: for i in images: pngfile = re_src.match(i).groups()[1] if not check_url(pngfile): img = website + pngfile else: img = pngfile if not download(img, os.path.join(path_to_figures, os.path.basename(img))): msg += "Error when downloading image: %s. <return>" %img failed = True for f in files: otherfile = re_href.match(f).groups()[1] if not check_url(otherfile): filename = website + otherfile else: filename = otherfile if not download(filename, os.path.join(path_to_figures, os.path.basename(filename))): msg += "Error when downloading file: %s. <return>"%filename failed = True if not failed : return (True, "") else: return (False, msg) else: msg = "Web server returned: %s" % page return (False, msg) except Exception, e: return (False, str(e)) | 16f522c459c512f6eec949f3d5095195f2b262ed /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/16f522c459c512f6eec949f3d5095195f2b262ed/includevistrail.py |
}{vistrails}""" % error_msg | }{}""" % error_msg | def generate_latex_error(error_msg): """ generate_latex_error(error_msg: str) -> str this generates a piece of latex code with an error message. """ s = """\\PackageError{vistrails}{ An error occurred when executing vistrails. \\MessageBreak | 16f522c459c512f6eec949f3d5095195f2b262ed /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/16f522c459c512f6eec949f3d5095195f2b262ed/includevistrail.py |
if use_filename and os.path.isfile(str(data[0])): | if use_filename: if os.path.isfile(str(data[0])): | def _parse_vtinfo(self, info, use_filename=True): name = None version = None if use_filename and os.path.isfile(info): name = info else: data = info.split(":") if len(data) >= 2: if use_filename and os.path.isfile(str(data[0])): name = str(data[0]) elif not use_filename: name = str(data[0]) # will try to convert version to int # if it fails, it's a tag name try: #maybe a tag name contains ':' in its name #so we need to bring it back together rest = ":".join(data[1:]) version = int(rest) except ValueError: version = str(rest) elif len(data) == 1: if use_filename and os.path.isfile(str(data[0])): name = str(data[0]) elif not use_filename: name = str(data[0]) return (name, version) | 81812ac04e85e651f882cf3133818bd36400e26c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/81812ac04e85e651f882cf3133818bd36400e26c/application.py |
def http_error_default(self, url, fp, errcode, errmsg, headers): if errcode == 404: raise IOError, ('http error', errcode, errmsg, headers) # call parent method urllib.FancyURLopener().http_error_default(url, fp, errcode, errmsg, headers) | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
||
url = self.getInputFromPort('url') | url = self.getInputFromPort("url") self._parse_url(url) | def is_cacheable(self): self.checkInputPort('url') url = self.getInputFromPort('url') local_filename = self._local_filename(url) # If file is not in cache, then we must re-run if not self._file_is_in_local_cache(local_filename): return False conn = httplib.HTTPConnection(self.host) try: conn.request("GET", self.filename) except socket.gaierror, e: # We could not get to the net, but file exists in local # cache, so we'll simply reuse it return True response = conn.getresponse() mod_header = response.msg.getheader('last-modified') if not mod_header: # server did not return a last-modified, assume cannot cache return False if self._is_outdated(mod_header, local_filename): return False return True | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
if not self._file_is_in_local_cache(local_filename): return False conn = httplib.HTTPConnection(self.host) try: conn.request("GET", self.filename) except socket.gaierror, e: return True response = conn.getresponse() mod_header = response.msg.getheader('last-modified') if not mod_header: return False if self._is_outdated(mod_header, local_filename): return False return True | return self._file_is_in_local_cache(local_filename) | def is_cacheable(self): self.checkInputPort('url') url = self.getInputFromPort('url') local_filename = self._local_filename(url) # If file is not in cache, then we must re-run if not self._file_is_in_local_cache(local_filename): return False conn = httplib.HTTPConnection(self.host) try: conn.request("GET", self.filename) except socket.gaierror, e: # We could not get to the net, but file exists in local # cache, so we'll simply reuse it return True response = conn.getresponse() mod_header = response.msg.getheader('last-modified') if not mod_header: # server did not return a last-modified, assume cannot cache return False if self._is_outdated(mod_header, local_filename): return False return True | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
conn = httplib.HTTPConnection(self.host) | opener = urllib2.build_opener() | def compute(self): self.checkInputPort('url') url = self.getInputFromPort("url") self._parse_url(url) conn = httplib.HTTPConnection(self.host) local_filename = self._local_filename(url) self.setResult("local_filename", local_filename) try: conn.request("GET", self.filename) except socket.gaierror, e: if self._file_is_in_local_cache(local_filename): debug.warning(('A network error occurred. HTTPFile will use' ' cached version of file')) result = core.modules.basic_modules.File() result.name = local_filename self.setResult("file", result) else: raise ModuleError(self, e[1]) else: response = conn.getresponse() mod_header = response.msg.getheader('last-modified') result = core.modules.basic_modules.File() result.name = local_filename if (not self._file_is_in_local_cache(local_filename) or not mod_header or self._is_outdated(mod_header, local_filename)): try: urllib.urlretrieve(url, local_filename) except IOError, e: raise ModuleError(self, ("Invalid URL: %s" % e)) except: raise ModuleError(self, ("Could not create local file '%s'" % local_filename)) conn.close() self.setResult("file", result) | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
conn.request("GET", self.filename) except socket.gaierror, e: | request = urllib2.Request(url) except (socket.gaierror, socket.error), e: | def compute(self): self.checkInputPort('url') url = self.getInputFromPort("url") self._parse_url(url) conn = httplib.HTTPConnection(self.host) local_filename = self._local_filename(url) self.setResult("local_filename", local_filename) try: conn.request("GET", self.filename) except socket.gaierror, e: if self._file_is_in_local_cache(local_filename): debug.warning(('A network error occurred. HTTPFile will use' ' cached version of file')) result = core.modules.basic_modules.File() result.name = local_filename self.setResult("file", result) else: raise ModuleError(self, e[1]) else: response = conn.getresponse() mod_header = response.msg.getheader('last-modified') result = core.modules.basic_modules.File() result.name = local_filename if (not self._file_is_in_local_cache(local_filename) or not mod_header or self._is_outdated(mod_header, local_filename)): try: urllib.urlretrieve(url, local_filename) except IOError, e: raise ModuleError(self, ("Invalid URL: %s" % e)) except: raise ModuleError(self, ("Could not create local file '%s'" % local_filename)) conn.close() self.setResult("file", result) | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
response = conn.getresponse() mod_header = response.msg.getheader('last-modified') | f1 = opener.open(url) mod_header = f1.info().getheader('last-modified') | def compute(self): self.checkInputPort('url') url = self.getInputFromPort("url") self._parse_url(url) conn = httplib.HTTPConnection(self.host) local_filename = self._local_filename(url) self.setResult("local_filename", local_filename) try: conn.request("GET", self.filename) except socket.gaierror, e: if self._file_is_in_local_cache(local_filename): debug.warning(('A network error occurred. HTTPFile will use' ' cached version of file')) result = core.modules.basic_modules.File() result.name = local_filename self.setResult("file", result) else: raise ModuleError(self, e[1]) else: response = conn.getresponse() mod_header = response.msg.getheader('last-modified') result = core.modules.basic_modules.File() result.name = local_filename if (not self._file_is_in_local_cache(local_filename) or not mod_header or self._is_outdated(mod_header, local_filename)): try: urllib.urlretrieve(url, local_filename) except IOError, e: raise ModuleError(self, ("Invalid URL: %s" % e)) except: raise ModuleError(self, ("Could not create local file '%s'" % local_filename)) conn.close() self.setResult("file", result) | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
urllib.urlretrieve(url, local_filename) | mode = 'w' f2 = open(local_filename, mode) f2.write(f1.read()) f2.close() f1.close() | def compute(self): self.checkInputPort('url') url = self.getInputFromPort("url") self._parse_url(url) conn = httplib.HTTPConnection(self.host) local_filename = self._local_filename(url) self.setResult("local_filename", local_filename) try: conn.request("GET", self.filename) except socket.gaierror, e: if self._file_is_in_local_cache(local_filename): debug.warning(('A network error occurred. HTTPFile will use' ' cached version of file')) result = core.modules.basic_modules.File() result.name = local_filename self.setResult("file", result) else: raise ModuleError(self, e[1]) else: response = conn.getresponse() mod_header = response.msg.getheader('last-modified') result = core.modules.basic_modules.File() result.name = local_filename if (not self._file_is_in_local_cache(local_filename) or not mod_header or self._is_outdated(mod_header, local_filename)): try: urllib.urlretrieve(url, local_filename) except IOError, e: raise ModuleError(self, ("Invalid URL: %s" % e)) except: raise ModuleError(self, ("Could not create local file '%s'" % local_filename)) conn.close() self.setResult("file", result) | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
conn.close() | result.name = local_filename | def compute(self): self.checkInputPort('url') url = self.getInputFromPort("url") self._parse_url(url) conn = httplib.HTTPConnection(self.host) local_filename = self._local_filename(url) self.setResult("local_filename", local_filename) try: conn.request("GET", self.filename) except socket.gaierror, e: if self._file_is_in_local_cache(local_filename): debug.warning(('A network error occurred. HTTPFile will use' ' cached version of file')) result = core.modules.basic_modules.File() result.name = local_filename self.setResult("file", result) else: raise ModuleError(self, e[1]) else: response = conn.getresponse() mod_header = response.msg.getheader('last-modified') result = core.modules.basic_modules.File() result.name = local_filename if (not self._file_is_in_local_cache(local_filename) or not mod_header or self._is_outdated(mod_header, local_filename)): try: urllib.urlretrieve(url, local_filename) except IOError, e: raise ModuleError(self, ("Invalid URL: %s" % e)) except: raise ModuleError(self, ("Could not create local file '%s'" % local_filename)) conn.close() self.setResult("file", result) | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
remote_time = datetime.datetime.strptime(remoteHeader, "%a, %d %b %Y %H:%M:%S %Z") | try: remote_time = datetime.datetime.strptime(remoteHeader, "%a, %d %b %Y %H:%M:%S %Z") except: remote_time = datetime.datetime.strptime(remoteHeader, "%a, %d %B %Y %H:%M:%S %Z") | def _is_outdated(self, remoteHeader, localFile): """Checks whether local file is outdated.""" local_time = \ datetime.datetime.utcfromtimestamp(os.path.getmtime(localFile)) remote_time = datetime.datetime.strptime(remoteHeader, "%a, %d %b %Y %H:%M:%S %Z") return remote_time > local_time | 3799edddbb6254c23d46c7398cada557b57fee17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3799edddbb6254c23d46c7398cada557b57fee17/init.py |
def mouseReleaseEvent(self, e): """mousePressEvent(e) -> None Keep the cursor after the last prompt. """ if e.button() == QtCore.Qt.LeftButton: self.copy() cursor = self.textCursor() cursor.movePosition(QtGui.QTextCursor.End) self.setTextCursor(cursor) return | def mouseReleaseEvent(self, e): """mousePressEvent(e) -> None Keep the cursor after the last prompt. """ if e.button() == QtCore.Qt.LeftButton: # copy selection to clipboard self.copy() cursor = self.textCursor() cursor.movePosition(QtGui.QTextCursor.End) self.setTextCursor(cursor) return | e2d804ac154bced7f598736a725b51f28ce20865 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e2d804ac154bced7f598736a725b51f28ce20865/shell.py |
|
except MissingDependency, e: | except self._current_package.MissingDependency, e: | def enable_current_package(self): av = self._available_packages_list inst = self._enabled_packages_list item = av.currentItem() pos = av.indexFromItem(item).row() codepath = str(item.text()) pm = get_package_manager() | e7a563305ef544be68f8fab40de69c9937b781ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e7a563305ef544be68f8fab40de69c9937b781ec/preferences.py |
str(e), QtGuiQMessageBox.Ok, self) | str(e), QtGui.QMessageBox.Ok, self) | def enable_current_package(self): av = self._available_packages_list inst = self._enabled_packages_list item = av.currentItem() pos = av.indexFromItem(item).row() codepath = str(item.text()) pm = get_package_manager() | e7a563305ef544be68f8fab40de69c9937b781ec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e7a563305ef544be68f8fab40de69c9937b781ec/preferences.py |
""" dumpToFile() -> None | """ dumpToFile(filename: str, dump_as_pdf: bool) -> None | def dumpToFile(self, filename): """ dumpToFile() -> None Dumps itself as an image to a file, calling grabWindowPixmap """ pixmap = self.grabWindowPixmap() pixmap.save(filename,"PNG") | 7753a825dd3a497c27165a58245951bf4f1cb9cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/7753a825dd3a497c27165a58245951bf4f1cb9cf/spreadsheet_cell.py |
pixmap = self.grabWindowPixmap() pixmap.save(filename,"PNG") | if not dump_as_pdf: pixmap = self.grabWindowPixmap() pixmap.save(filename,"PNG") | def dumpToFile(self, filename): """ dumpToFile() -> None Dumps itself as an image to a file, calling grabWindowPixmap """ pixmap = self.grabWindowPixmap() pixmap.save(filename,"PNG") | 7753a825dd3a497c27165a58245951bf4f1cb9cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/7753a825dd3a497c27165a58245951bf4f1cb9cf/spreadsheet_cell.py |
def saveToPDF(self, filename): printer = QtGui.QPrinter() printer.setOutputFormat(QtGui.QPrinter.PdfFormat) printer.setOutputFileName(filename) painter = QtGui.QPainter() painter.begin(printer) rect = painter.viewport() pixmap = self.grabWindowPixmap() size = pixmap.size() size.scale(rect.size(), QtCore.Qt.KeepAspectRatio) painter.setViewport(rect.x(), rect.y(), size.width(), size.height()) painter.setWindow(pixmap.rect()) painter.drawPixmap(0, 0, pixmap) painter.end() | 7753a825dd3a497c27165a58245951bf4f1cb9cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/7753a825dd3a497c27165a58245951bf4f1cb9cf/spreadsheet_cell.py |
||
pixmap = self.grabWindowPixmap() size = pixmap.size() | def saveToPDF(self, filename): printer = QtGui.QPrinter() printer.setOutputFormat(QtGui.QPrinter.PdfFormat) printer.setOutputFileName(filename) painter = QtGui.QPainter() painter.begin(printer) rect = painter.viewport() pixmap = self.grabWindowPixmap() size = pixmap.size() size.scale(rect.size(), QtCore.Qt.KeepAspectRatio) painter.setViewport(rect.x(), rect.y(), size.width(), size.height()) painter.setWindow(pixmap.rect()) painter.drawPixmap(0, 0, pixmap) painter.end() | 7753a825dd3a497c27165a58245951bf4f1cb9cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/7753a825dd3a497c27165a58245951bf4f1cb9cf/spreadsheet_cell.py |
|
def create_dict(modules, ns, m, mdesc): md = {} if len(ns) == 0: d = {'_module_desc': mdesc, '_package': pkg,} modules[m] = type('module', (vistrails_module,), d) else: if ns[0] in modules: md = create_dict(modules[ns[0]], ns[1:], m, mdesc) else: md = create_dict(md, ns[1:], m, mdesc) modules[ns[0]] = md return modules def create_namespace_path(root, modules): for k,v in modules.iteritems(): if type(v) == type({}): d = create_namespace_path(k,v) modules[k] = d if root is not None: modules['_package'] = pkg return type(root, (object,), modules)() else: return modules | def load_package(self, pkg_name): reg = core.modules.module_registry.get_module_registry() package = reg.get_package_by_name(pkg_name) | c48e67f02ae8773763ec6171ff25bf4c55661141 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/c48e67f02ae8773763ec6171ff25bf4c55661141/shell.py |
|
d = {'__getattr__': get_module(package)} return type(package.name, (object,), d)() | d = {'__getattr__': get_module(package),} pkg = type(package.name, (object,), d)() modules = {} for (m,ns) in package.descriptors: module_desc = package.descriptors[(m,ns)] modules = create_dict(modules, ns.split('|'), m, module_desc) modules = create_namespace_path(None, modules) for (k,v) in modules.iteritems(): setattr(pkg, k, v) return pkg | def getter(self, attr_name): desc_tuple = (attr_name, '') if desc_tuple in package.descriptors: module_desc = package.descriptors[desc_tuple] d = {'_module_desc': module_desc, '_package': self,} return type('module', (vistrails_module,), d) else: raise AttributeError("type object '%s' has no attribute " "'%s'" % (self.__class__.__name__, attr_name)) | c48e67f02ae8773763ec6171ff25bf4c55661141 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/c48e67f02ae8773763ec6171ff25bf4c55661141/shell.py |
(new_version, pipeline) = \ self.handle_invalid_pipeline(e, new_version, self.vistrail, report_all_errors) | try: (new_version, pipeline) = \ self.handle_invalid_pipeline(e, new_version, self.vistrail, report_all_errors) except InvalidPipeline, e: pipeline = e._pipeline | def switch_version(version, allow_fail=False): if self.current_version != -1 and not self.current_pipeline: debug.warning("current_version is not -1 and " "current_pipeline is None") if version != self.current_pipeline: # clear delayed actions # FIXME: invert the delayed actions and integrate them into # the general_action_chain? if len(self._delayed_actions) > 0: self._delayed_actions = [] self.current_pipeline = Pipeline() self.current_version = 0 if version == -1: return None | aff3408c7a5118bf9f83aa31f3ea184a2fdef2c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/aff3408c7a5118bf9f83aa31f3ea184a2fdef2c4/controller.py |
abs_vistrail, False) | abs_vistrail, False, True) | def initialize(*args, **kwargs): import core.packagemanager manager = core.packagemanager.get_package_manager() reg = core.modules.module_registry.get_module_registry() | e02585e9bdb23745d4c637b2eb648b229c726965 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e02585e9bdb23745d4c637b2eb648b229c726965/abstraction.py |
debug.log("PORT SIG:", port.signature) | debug.log("PORT SIG:" + port.signature) | def getPortPosition(self, port, port_dict, optional_ports, next_pos, next_op, default_sig): """ getPortPosition(port: Port, port_dict: {PortSpec: QGraphicsPortItem}, optional_ports: [PortSpec], next_pos: [float, float], next_op: operator (operator.add, operator.sub), default_sig: str ) -> QPointF Return the scene position of a port matched 'port' in port_dict """ registry = get_module_registry() | abc8f46319b438d32ac4e9f4e9acd282aa36161e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/abc8f46319b438d32ac4e9f4e9acd282aa36161e/pipeline_view.py |
obj_id=old_db_vt_id, user=db_write_user, passwd=db_write_pass) | obj_id=int(old_db_vt_id), user=db_write_user, passwd=db_write_pass) | def merge_vt(self, host, port, db_name, user, new_vt_filepath, old_db_vt_id, is_local=True): """ Merge new_vt (new_vt_filepath) with current vt (old_db_vt_id) | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
except Exception, e: self.server_logger.error(str(e)) return (str(e), 0) def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local)) self.server_logger.info("path_exists_and_not_empty? %s" % self.path_exists_and_not_empty(path_to_figures)) self.server_logger.info(str(self.proxies_queue)) if not is_local: dest_version = "%s_%s_%d_%d_%d" % (host, db_name, int(port), int(vt_id), int(version)) dest_version = hashlib.sha1(dest_version).hexdigest() path_to_figures = os.path.join(media_dir, "wf_execution", dest_version) if (not self.path_exists_and_not_empty(path_to_figures) and self.proxies_queue is not None): self.server_logger.info("will forward request") proxy = self.proxies_queue.get() try: self.server_logger.info("Sending request to %s" % proxy) result = proxy.run_from_db(host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local) self.proxies_queue.put(proxy) self.server_logger.info("returning %s" % result) return result | except xmlrpclib.ProtocolError, err: err_msg = ("A protocol error occurred\n" "URL: %s\n" "HTTP/HTTPS headers: %s\n" "Error code: %d\n" "Error message: %s\n") % (err.url, err.headers, err.errcode, err.errmsg) self.server_logger.error(err_msg) return (str(err), 0) except Exception, e: self.server_logger.error(str(e)) return (str(e), 0) def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local)) self.server_logger.info("path_exists_and_not_empty? %s" % self.path_exists_and_not_empty(path_to_figures)) self.server_logger.info(str(self.proxies_queue)) if not is_local: dest_version = "%s_%s_%d_%d_%d" % (host, db_name, int(port), int(vt_id), int(version)) dest_version = hashlib.sha1(dest_version).hexdigest() path_to_figures = os.path.join(media_dir, "wf_execution", dest_version) if (not self.path_exists_and_not_empty(path_to_figures) and self.proxies_queue is not None): self.server_logger.info("will forward request") proxy = self.proxies_queue.get() try: self.server_logger.info("Sending request to %s" % proxy) result = proxy.run_from_db(host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local) self.proxies_queue.put(proxy) self.server_logger.info("returning %s" % result) return result except xmlrpclib.ProtocolError, err: err_msg = ("A protocol error occurred\n" "URL: %s\n" "HTTP/HTTPS headers: %s\n" "Error code: %d\n" "Error message: %s\n") % (err.url, err.headers, err.errcode, err.errmsg) self.server_logger.error(err_msg) return (str(err), 0) | def executeMedley(self, xml_medley, extra_info=None): self.server_logger.info("executeMedley request received") try: self.server_logger.info(xml_medley) xml_string = xml_medley.replace('\\"','"') root = ElementTree.fromstring(xml_string) try: medley = MedleySimpleGUI.from_xml(root) except: #even if this error occurred there's still a chance of # recovering from it... (the server can find cached images) self.server_logger.error("couldn't instantiate medley") | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local)) | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
||
def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters, is_local)) | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
||
obj_id=vt_id, | obj_id=int(vt_id), | def get_wf_graph_pdf(self, host, port, db_name, vt_id, version, is_local=True): """get_wf_graph_pdf(host:str, port:int, db_name:str, vt_id:int, version:int) -> str Returns the relative url to the generated PDF """ self.server_logger.info("get_wf_graph_pdf(%s,%s,%s,%s,%s) request received" % \ (host, port, db_name, vt_id, version)) try: vt_id = long(vt_id) version = long(version) subdir = 'workflows' filepath = os.path.join(media_dir, 'graphs', subdir) base_fname = "graph_%s_%s.pdf" % (vt_id, version) filename = os.path.join(filepath,base_fname) if ((not os.path.exists(filepath) or os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None): #this server can send requests to other instances proxy = self.proxies_queue.get() try: result = proxy.get_wf_graph_pdf(host,port,db_name, vt_id, version, is_local) self.proxies_queue.put(proxy) self.server_logger.info("get_wf_graph_pdf returning %s"% result) return result except Exception, e: self.server_logger.error(str(e)) return (str(e), 0) | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
obj_id=vt_id, | obj_id=int(vt_id), | def get_wf_graph_png(self, host, port, db_name, vt_id, version, is_local=True): """get_wf_graph_png(host:str, port:int, db_name:str, vt_id:int, version:int) -> str Returns the relative url to the generated image """ self.server_logger.info("get_wf_graph_png(%s,%s,%s,%s,%s) request received" % \ (host, port, db_name, vt_id, version)) try: vt_id = long(vt_id) version = long(version) subdir = 'workflows' filepath = os.path.join(media_dir, 'graphs', subdir) base_fname = "graph_%s_%s.png" % (vt_id, version) filename = os.path.join(filepath,base_fname) if ((not os.path.exists(filepath) or os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None): #this server can send requests to other instances proxy = self.proxies_queue.get() try: self.server_logger.info("Sending request to %s" % proxy) result = proxy.get_wf_graph_png(host, port, db_name, vt_id, version, is_local) self.proxies_queue.put(proxy) self.server_logger.info("returning %s" % result) return result except Exception, e: self.server_logger.error(str(e)) return (str(e), 0) #if it gets here, this means that we will execute on this instance if not os.path.exists(filepath): os.mkdir(filepath) | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
obj_id=vt_id, | obj_id=int(vt_id), | def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """ | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """ | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
||
obj_id=vt_id, | obj_id=int(vt_id), | def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """ | ae757bfa15d5cdd9c97ddf7006e8656337323231 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/ae757bfa15d5cdd9c97ddf7006e8656337323231/application_server.py |
self.setResult("d", d) | self.setResult("value", d) | def dict_compute(self): d = {} if self.hasInputFromPort('value'): Constant.compute(self) d.update(self.outputPorts['value']) if self.hasInputFromPort('addPair'): pairs_list = self.getInputListFromPort('addPair') d.update(pairs_list) if self.hasInputFromPort('addPairs'): d.update(self.getInputFromPort('addPairs')) self.setResult("d", d) | e6370a05c50a81d4187a23eb6a62ceb7f32678bf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e6370a05c50a81d4187a23eb6a62ceb7f32678bf/basic_modules.py |
visibleOptionalPorts = [] | visibleOptionalInputPorts = [] | def setupModule(self, module): """ setupModule(module: Module) -> None Set up the item to reflect the info in 'module' """ # Update module info and visual self.id = module.id self.setZValue(float(self.id)) self.module = module self.center = copy.copy(module.center) if '__desc__' in module.db_annotations_key_index: self.label = module.get_annotation_by_key('__desc__').value.strip() self.description = module.label else: self.label = module.label self.description = '' self.setToolTip(self.description) self.computeBoundingRect() self.resetMatrix() self.translate(module.center.x, -module.center.y) | bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97/pipeline_view.py |
visibleOptionalPorts = [] | visibleOptionalOutputPorts = [] | def setupModule(self, module): """ setupModule(module: Module) -> None Set up the item to reflect the info in 'module' """ # Update module info and visual self.id = module.id self.setZValue(float(self.id)) self.module = module self.center = copy.copy(module.center) if '__desc__' in module.db_annotations_key_index: self.label = module.get_annotation_by_key('__desc__').value.strip() self.description = module.label else: self.label = module.label self.description = '' self.setToolTip(self.description) self.computeBoundingRect() self.resetMatrix() self.translate(module.center.x, -module.center.y) | bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97/pipeline_view.py |
visibleOptionalPorts.append(p) | visibleOptionalInputPorts.append(p) | def setupModule(self, module): """ setupModule(module: Module) -> None Set up the item to reflect the info in 'module' """ # Update module info and visual self.id = module.id self.setZValue(float(self.id)) self.module = module self.center = copy.copy(module.center) if '__desc__' in module.db_annotations_key_index: self.label = module.get_annotation_by_key('__desc__').value.strip() self.description = module.label else: self.label = module.label self.description = '' self.setToolTip(self.description) self.computeBoundingRect() self.resetMatrix() self.translate(module.center.x, -module.center.y) | bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97/pipeline_view.py |
inputPorts += visibleOptionalPorts | inputPorts += visibleOptionalInputPorts | def setupModule(self, module): """ setupModule(module: Module) -> None Set up the item to reflect the info in 'module' """ # Update module info and visual self.id = module.id self.setZValue(float(self.id)) self.module = module self.center = copy.copy(module.center) if '__desc__' in module.db_annotations_key_index: self.label = module.get_annotation_by_key('__desc__').value.strip() self.description = module.label else: self.label = module.label self.description = '' self.setToolTip(self.description) self.computeBoundingRect() self.resetMatrix() self.translate(module.center.x, -module.center.y) | bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97/pipeline_view.py |
visibleOptionalPorts.append(p) | visibleOptionalOutputPorts.append(p) | def setupModule(self, module): """ setupModule(module: Module) -> None Set up the item to reflect the info in 'module' """ # Update module info and visual self.id = module.id self.setZValue(float(self.id)) self.module = module self.center = copy.copy(module.center) if '__desc__' in module.db_annotations_key_index: self.label = module.get_annotation_by_key('__desc__').value.strip() self.description = module.label else: self.label = module.label self.description = '' self.setToolTip(self.description) self.computeBoundingRect() self.resetMatrix() self.translate(module.center.x, -module.center.y) | bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97/pipeline_view.py |
outputPorts += visibleOptionalPorts | outputPorts += visibleOptionalOutputPorts | def setupModule(self, module): """ setupModule(module: Module) -> None Set up the item to reflect the info in 'module' """ # Update module info and visual self.id = module.id self.setZValue(float(self.id)) self.module = module self.center = copy.copy(module.center) if '__desc__' in module.db_annotations_key_index: self.label = module.get_annotation_by_key('__desc__').value.strip() self.description = module.label else: self.label = module.label self.description = '' self.setToolTip(self.description) self.computeBoundingRect() self.resetMatrix() self.translate(module.center.x, -module.center.y) | bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97/pipeline_view.py |
if self.modules[m_id].isSelected: | if self.modules[m_id].isSelected(): | def setupScene(self, pipeline): """ setupScene(pipeline: Pipeline) -> None Construct the scene to view a pipeline """ old_pipeline = self.pipeline self.pipeline = pipeline | bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/bb5e4e6e1f45b2acc9dd36ba0e6d8b580347ac97/pipeline_view.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.