rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
ops.extend( controller.update_annotation_ops(new_module, [(annotation_key, annotation.value)])) local_port_specs = {} | new_annotation = \ Annotation(id=controller.id_scope.getNewId(Annotation.vtType), key=annotation_key, value=annotation.value) new_module.add_annotation(new_annotation) | def replace_generic(controller, pipeline, old_module, new_module, function_remap={}, src_port_remap={}, dst_port_remap={}, annotation_remap={}): ops = [] ops.extend(controller.delete_module_list_ops(pipeline, [old_module.id])) ops.append(('add', new_module)) for annotation in old_module.annotations: if annotation.key ... |
local_port_specs[(new_spec.name, new_spec.type)] = new_spec ops.append(('add', new_spec, 'module', new_module.id)) print local_port_specs | new_module.add_port_spec(new_spec) | def replace_generic(controller, pipeline, old_module, new_module, function_remap={}, src_port_remap={}, dst_port_remap={}, annotation_remap={}): ops = [] ops.extend(controller.delete_module_list_ops(pipeline, [old_module.id])) ops.append(('add', new_module)) for annotation in old_module.annotations: if annotation.key ... |
ops.extend(controller.update_function_ops(new_module, | new_function = controller.create_function(new_module, | def replace_generic(controller, pipeline, old_module, new_module, function_remap={}, src_port_remap={}, dst_port_remap={}, annotation_remap={}): ops = [] ops.extend(controller.delete_module_list_ops(pipeline, [old_module.id])) ops.append(('add', new_module)) for annotation in old_module.annotations: if annotation.key ... |
new_param_vals)) | new_param_vals) new_module.add_function(new_function) ops.append(('add', new_module)) | def replace_generic(controller, pipeline, old_module, new_module, function_remap={}, src_port_remap={}, dst_port_remap={}, annotation_remap={}): ops = [] ops.extend(controller.delete_module_list_ops(pipeline, [old_module.id])) ops.append(('add', new_module)) for annotation in old_module.annotations: if annotation.key ... |
if ((src_port, 'output')) in local_port_specs: output_port_spec = local_port_specs[(src_port, 'output')] else: output_port_spec = \ src_module.get_port_spec(src_port, 'output') | output_port_spec = src_module.get_port_spec(src_port, 'output') | def create_new_connection(src_module, src_port, dst_module, dst_port): # spec -> name, type, signature output_port_id = controller.id_scope.getNewId(Port.vtType) if type(src_port) == type(""): if ((src_port, 'output')) in local_port_specs: output_port_spec = local_port_specs[(src_port, 'output')] else: output_port_spec... |
if ((dst_port, 'input')) in local_port_specs: input_port_spec = local_port_specs[(dst_port, 'input')] else: input_port_spec = \ dst_module.get_port_spec(dst_port, 'input') | input_port_spec = dst_module.get_port_spec(dst_port, 'input') | def create_new_connection(src_module, src_port, dst_module, dst_port): # spec -> name, type, signature output_port_id = controller.id_scope.getNewId(Port.vtType) if type(src_port) == type(""): if ((src_port, 'output')) in local_port_specs: output_port_spec = local_port_specs[(src_port, 'output')] else: output_port_spec... |
self._tf = pickle.loads(param.strValue.decode('hex')) | self._tf = TransferFunction.parse(param.strValue) | def __init__(self, param, parent=None): QtGui.QWidget.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) if not param.strValue: self._tf = copy.copy(default_tf) else: self._tf = pickle.loads(param.strValue.decode('hex')) self._scene = TransferFunctionScene(self._tf, self) layout = QtGui.QVBoxLayo... |
self._view = TransferFunctionView() | self._view = TransferFunctionView(self) | def __init__(self, param, parent=None): QtGui.QWidget.__init__(self, parent) ConstantWidgetMixin.__init__(self, param.strValue) if not param.strValue: self._tf = copy.copy(default_tf) else: self._tf = pickle.loads(param.strValue.decode('hex')) self._scene = TransferFunctionScene(self._tf, self) layout = QtGui.QVBoxLayo... |
return pickle.dumps(self._scene.get_transfer_function()).encode('hex') | return self._scene.get_transfer_function().serialize() | def contents(self): return pickle.dumps(self._scene.get_transfer_function()).encode('hex') |
self._tf = pickle.loads(strValue.decode('hex')) | self._tf = TransferFunction.parse(strValue) | def setContents(self, strValue, silent=True): if not strValue: self._tf = copy.copy(default_tf) else: self._tf = pickle.loads(strValue.decode('hex')) self._scene.reset_transfer_function(self._tf) if not silent: self.update_parent() |
string_conversion = staticmethod(lambda x: pickle.dumps(x).encode('hex')) conversion = staticmethod(lambda x: pickle.loads(x.decode('hex'))) | string_conversion = staticmethod(lambda x: x.serialize()) conversion = staticmethod(lambda x: TransferFunction.parse(x)) | def compute(self): tf = self.getInputFromPort('TransferFunction') new_tf = copy.copy(tf) if self.hasInputFromPort('Input'): port = self.getInputFromPort('Input') algo = port.vtkInstance.GetProducer() output = algo.GetOutput(port.vtkInstance.GetIndex()) (new_tf._min_range, new_tf._max_range) = output.GetScalarRange() el... |
vp = '_%s_void_p' % (hex(display)[2:]) | vp = '_%s_void_p\0x00' % (hex(display)[2:]) | def SetRenderWindow(self,w): """ SetRenderWindow(w: vtkRenderWindow) Set a new render window to QVTKWidget and initialize the interactor as well """ if w == self.mRenWin: return if self.mRenWin: if system.systemType!='Linux': self.mRenWin.SetInteractor(None) if self.mRenWin.GetMapped(): self.mRenWin.Finalize() self.... |
def download(url,filename): """download(url:string, filename: string) -> Boolean Downloads a binary file from url to filename and returns True (success) or False (failure) """ try: furl = urllib2.urlopen(url) f = file(filename,'wb') f.write(furl.read()) f.close() return True except: return False def download_as_tex... | def path_exists_and_not_empty(path): """path_exists_and_not_empty(path:str) -> boolean Returns True if given path exists and it's not empty, otherwise returns False. """ if os.path.exists(path): for root, dirs, file_names in os.walk(path): break if len(file_names) > 0: return True return False | |
port, path_to_figures): | port, path_to_figures, pdf=False, graph=False): | def build_vistrails_cmd_line(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures): """ build_vistrails_cmd_line(path_to_vistrails: str, host: str, db_name: str, vt_id: str, version: str, path_to_figures: str) -> str Build the command line to run vistrails with the given parameters. """ cmd_line = 'p... |
cmd_line = 'python "%s" -b -e "%s" -t %s -f %s -r %s -u %s "%s:%s" > \ vistrails.log' % (vt_user, path_to_vistrails, | if pdf: pdfoption = "-p" else: pdfoption = "" if graph: graphoption = '-I %s'%path_to_figures else: graphoption = "" if version is not None: voption = ":%s"%version else: voption = '' cmd_line = 'python "%s" -b -e "%s" -t %s -f %s -r %s %s %s "%s%s" > \ vistrails.log' % (path_to_vistrails, | def build_vistrails_cmd_line(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures): """ build_vistrails_cmd_line(path_to_vistrails: str, host: str, db_name: str, vt_id: str, version: str, path_to_figures: str) -> str Build the command line to run vistrails with the given parameters. """ cmd_line = 'p... |
version) | voption) | def build_vistrails_cmd_line(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures): """ build_vistrails_cmd_line(path_to_vistrails: str, host: str, db_name: str, vt_id: str, version: str, path_to_figures: str) -> str Build the command line to run vistrails with the given parameters. """ cmd_line = 'p... |
def generate_latex(host, db_name, vt_id, version, port, tag, execute, showspreadsheetonly, path_to_figures, graphics_options): | def generate_latex(download_url, host, db_name, vt_id, version, port, tag, execute, showspreadsheetonly, path_to_figures, graphics_options): | def generate_latex(host, db_name, vt_id, version, port, tag, execute, showspreadsheetonly, path_to_figures, graphics_options): """generate_latex(host: str, db_name:str, vt_id: str, version: str, port:str, tag: str, execute: bool, showspreadsheetonly: bool, path_to_figures: str, graphics_options: str) -> str This gener... |
url_params = "getvt=%s&version=%s&db=%s&host=%s&port=%s&tag=%s&\ | if download_url is not None and download_url != "": url_params = "getvt=%s&db=%s&host=%s&port=%s&tag=%s&\ | def generate_latex(host, db_name, vt_id, version, port, tag, execute, showspreadsheetonly, path_to_figures, graphics_options): """generate_latex(host: str, db_name:str, vt_id: str, version: str, port:str, tag: str, execute: bool, showspreadsheetonly: bool, path_to_figures: str, graphics_options: str) -> str This gener... |
urllib2.quote(version), | def generate_latex(host, db_name, vt_id, version, port, tag, execute, showspreadsheetonly, path_to_figures, graphics_options): """generate_latex(host: str, db_name:str, vt_id: str, version: str, port:str, tag: str, execute: bool, showspreadsheetonly: bool, path_to_figures: str, graphics_options: str) -> str This gener... | |
url_params = url_params.replace("%","\%") url = "http://www.vistrails.org/extensions/download.php?%s"% url_params href = "\href{%s}{" % url | if version is not None: url_params += "&version=%s"%urllib2.quote(version) url_params = url_params.replace("%","\%") url = "%s?%s"%(download_url, url_params) href = "\href{%s}{" % url | def generate_latex(host, db_name, vt_id, version, port, tag, execute, showspreadsheetonly, path_to_figures, graphics_options): """generate_latex(host: str, db_name:str, vt_id: str, version: str, port:str, tag: str, execute: bool, showspreadsheetonly: bool, path_to_figures: str, graphics_options: str) -> str This gener... |
s += "}" return href+s | if download_url is not None and download_url != "": return href + s + "}" else: return s | def generate_latex(host, db_name, vt_id, version, port, tag, execute, showspreadsheetonly, path_to_figures, graphics_options): """generate_latex(host: str, db_name:str, vt_id: str, version: str, port:str, tag: str, execute: bool, showspreadsheetonly: bool, path_to_figures: str, graphics_options: str) -> str This gener... |
tag='', execute=False, showspreadsheetonly=False): | tag='', execute=False, showspreadsheetonly=False, pdf=False): | def run_vistrails_locally(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, build_always=False, tag='', execute=False, showspreadsheetonly=False): """run_vistrails_locally(path_to_vistrails: str, host: str, db_name: str, vt_id: str, version: str, port: str, path_to_figures: str) -> tuple(bool, st... |
version, port, path_to_figures) | version, port, path_to_figures, pdf) | def run_vistrails_locally(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, build_always=False, tag='', execute=False, showspreadsheetonly=False): """run_vistrails_locally(path_to_vistrails: str, host: str, db_name: str, vt_id: str, version: str, port: str, path_to_figures: str) -> tuple(bool, st... |
def run_vistrails_remotely(path_to_vistrails, host, db_name, vt_id, | def get_vt_graph_locally(path_to_vistrails, host, db_name, vt_id, port, path_to_figures, build_always=False, pdf=False): """get_vt_graph_locally(path_to_vistrails: str, host: str, db_name: str, vt_id: str, port: str, path_to_figures: str, build_always: bool, pdf:bool) -> tuple(bool, str) Run vistrails for loading a vis... | def run_vistrails_remotely(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, build_always=False, tag='', execute=False, showspreadsheetonly=False, pdf=False): """run_vistrails_remotely(path_to_vistrails: str, host: str, db_name: str, vt_id: str, version: str, port: str, path_to_figures: str, buil... |
"""run_vistrails_remotely(path_to_vistrails: str, host: str, | """run_vistrails_remotely(path_to_vistrails: str, download_url: str host: str, | def run_vistrails_remotely(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, build_always=False, tag='', execute=False, showspreadsheetonly=False, pdf=False): """run_vistrails_remotely(path_to_vistrails: str, host: str, db_name: str, vt_id: str, version: str, port: str, path_to_figures: str, buil... |
Run vistrails and returns a tuple containing a boolean saying if it was successful or not and the latex code. | Call vistrails remotely to execute a workflow and returns a tuple containing a boolean saying whether it was successful and the latex code. | def run_vistrails_remotely(path_to_vistrails, host, db_name, vt_id, version, port, path_to_figures, build_always=False, tag='', execute=False, showspreadsheetonly=False, pdf=False): """run_vistrails_remotely(path_to_vistrails: str, host: str, db_name: str, vt_id: str, version: str, port: str, path_to_figures: str, buil... |
def download(url,filename): try: furl = urllib2.urlopen(url) f = file(filename,'wb') f.write(furl.read()) f.close() return True except: return False def download_as_text(url): try: furl = urllib2.urlopen(url) s = furl.read() return s except: return None | log("run_vistrails_remotely") | def download(url,filename): try: furl = urllib2.urlopen(url) f = file(filename,'wb') f.write(furl.read()) f.close() return True except: return False |
try: page = download_as_text(url) 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 ... | log("will download from: " + url) | def download_as_text(url): try: furl = urllib2.urlopen(url) s = furl.read() return s except: return None |
except Exception, e: return (False, generate_latex_error(str(e))) | (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, execute, showspreadsheetonly, path_to_figures, graphics_options)) else: log("Error: " + msg) return (result, generate_latex_error(msg)... | def download_as_text(url): try: furl = urllib2.urlopen(url) s = furl.read() return s except: return None |
return (True, generate_latex(host, db_name, vt_id, version, port, tag, execute, | log("using cached files") return (True, generate_latex(download_url, host, db_name, vt_id, version, port, tag, execute, | def download_as_text(url): try: furl = urllib2.urlopen(url) s = furl.read() return s except: return None |
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, ... | def download_as_text(url): try: furl = urllib2.urlopen(url) s = furl.read() return s except: return None | |
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 | |
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(pa... | 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 |
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: r... | 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 |
"%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 |
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 |
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 |
'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.p... |
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 filenam... |
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) |
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 """ |
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 """ |
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 ... | 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 """ | |
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 (candi... | |
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) | |
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() |
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)) |
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)) |
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)) |
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)) |
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)) | |
""" | 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, co... | |
""" | 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, conn... | |
'\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) |
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) > le... |
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' |
_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:... | |
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... |
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') | |
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 |
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 | |
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 |
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 """ |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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... |
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) |
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) |
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) |
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) |
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) | |
expected_count = int(REVISION) - int(last_revision) | pattern = re.compile(r"(^\s*?def vistrails_revision\(\):.*?release = ['\"])([0-9]+?)(['\"].*?return release)", re.DOTALL | re.MULTILINE) | |
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.... |
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 + ':' + sel... |
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 ima... |
}{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 |
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 versio... |
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.filenam... |
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_outd... | 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.filenam... |
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_i... |
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_i... |
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_i... |
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_i... |
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_i... |
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 |
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 | |
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() |
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() |
""" 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") |
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") |
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.KeepAspectR... | |
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 load_package(self, pkg_name): reg = core.modules.module_registry.get_module_registry() package = reg.get_package_by_name(pkg_name) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.