rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
4b066402847119c3b3c98e8c95b539d7d86015e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12184/4b066402847119c3b3c98e8c95b539d7d86015e2/handlers.py
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
4b066402847119c3b3c98e8c95b539d7d86015e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12184/4b066402847119c3b3c98e8c95b539d7d86015e2/handlers.py
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
4b066402847119c3b3c98e8c95b539d7d86015e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12184/4b066402847119c3b3c98e8c95b539d7d86015e2/handlers.py
if problem_data["BCs"] != "null":
if problem_data["BCs"]:
def calc_global(problem_data): """ Calculates global stiffness matrix, assembly of elemental systems are included here instead of defining an extra function for assembly """ print("Calculating global system...") global NEN, NEN_range, functions, a, V1, V2, c, f, shape_funcs #Defining global variables NEN = problem_data["NEN"] NEN_range = range(NEN) #Taking coefficient functions of DE out of problem data functions = problem_data["functions"] a = functions["a"] V1 = functions["V1"] V2 = functions["V2"] c = functions["c"] f = functions["f"] #Defining shape functions shape_funcs = problem_data["shapefunc"] print(" * Creating matrixes...") NN = problem_data["NN"] K = sparse.lil_matrix((NN, NN)) F = zeros((NN, 1)) print(" * Calculating K and F matrixes...") for e_nodes in problem_data["LtoG"]: Ke, Fe = calc_elem(problem_data, e_nodes) for i, node_i in enumerate(e_nodes): F[node_i] += Fe[i] for j, node_j in enumerate(e_nodes): K[node_i, node_j] += Ke[i][j] print(" * Freeing up memory (1/2)...") del problem_data["GQ"] del problem_data["UV"] del problem_data["functions"] if problem_data["BCs"] != "null": K, F = apply_bc(problem_data, K, F) print (" * Freeing up memory (2/2)...") del problem_data["LtoG"] del problem_data["BCs"] print(" * Converting LIL to CSR format...") K = K.tocsr() return K, F
8b8580fce0563db97e1b2379c25a2d5ce8f2cc5e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8149/8b8580fce0563db97e1b2379c25a2d5ce8f2cc5e/gsystem.py
get_supported_packages = urllib2.urlopen(url=packages_url)
try: get_supported_packages = urllib2.urlopen(url=packages_url) except urllib2.HTTPError, e: self._repository_status['support_status'] = "" self._repository_status['details'] = "" if e.code == 500: self._repository_status['support_status'] = \ ("Error connecting to repository (server side issues)") else: print str(e) self._push_button.setEnabled(False) self.update_push_information() return
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
e7c6b0bf133698edc6a52d0caa02be19a417ddc0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e7c6b0bf133698edc6a52d0caa02be19a417ddc0/repository.py
self._unrunnable_wfs = {}
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
e7c6b0bf133698edc6a52d0caa02be19a417ddc0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e7c6b0bf133698edc6a52d0caa02be19a417ddc0/repository.py
'branch_from': "" if not branching else repository_vt_id,
'branched_from': "" if not branching else repository_vt_id,
def push_vistrail_to_repository(self, branching=False): """ uploads current VisTrail to web repository """
e7c6b0bf133698edc6a52d0caa02be19a417ddc0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e7c6b0bf133698edc6a52d0caa02be19a417ddc0/repository.py
except:
except Exception, e: log(str(e))
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
79296270cc86eb79b478cec081cf9064a85957f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/79296270cc86eb79b478cec081cf9064a85957f9/includevistrail.py
elif check_url(path_to_vistrails):
elif (not build_always or (build_always and check_url(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
79296270cc86eb79b478cec081cf9064a85957f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/79296270cc86eb79b478cec081cf9064a85957f9/includevistrail.py
generate_latex_error("%s is not a valid url nor a valid path to vistrails.py" %\ (path_to_vistrails)))
generate_latex_error("It is possible that %s is not a valid \ url nor a valid path to vistrails.py or that you don't have an internet connection \ and some workflows have the buildalways option. If you already have cached files, \ try removing the buildalways option from vistrails latex command" %\ (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
79296270cc86eb79b478cec081cf9064a85957f9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/79296270cc86eb79b478cec081cf9064a85957f9/includevistrail.py
r = pkg.report_missing_module(mname, mnamespace)
r = None if pkg.can_handle_missing_modules(): r = pkg.handle_missing_module(controller, module_id, pipeline) d = get_descriptor(mpkg, mname, mnamespace)
def attempt_automatic_upgrade(controller, pipeline, module_id): """attempt_automatic_upgrade(module_id, pipeline): [Action]
c81ad48015ef142ef70a6e43f742b4357258ca46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/c81ad48015ef142ef70a6e43f742b4357258ca46/upgradeworkflow.py
d = get_descriptor(mpkg, mname, mnamespace)
def attempt_automatic_upgrade(controller, pipeline, module_id): """attempt_automatic_upgrade(module_id, pipeline): [Action]
c81ad48015ef142ef70a6e43f742b4357258ca46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/c81ad48015ef142ef70a6e43f742b4357258ca46/upgradeworkflow.py
try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s of module %s " "does not exist." % \ (PortSpec.port_type_map.inverse[port.type], port.name, invalid_module.name)) raise UpgradeWorkflowError(msg)
port_type = PortSpec.port_type_map.inverse[port.type] UpgradeWorkflowHandler.check_port_spec(invalid_module, port.name, port_type, d, port.sigstring)
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
c81ad48015ef142ef70a6e43f742b4357258ca46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/c81ad48015ef142ef70a6e43f742b4357258ca46/upgradeworkflow.py
try: reg_spec = reg.get_port_spec_from_descriptor(d, function.name, 'input') except: raise UpgradeWorkflowError('cannot find function "%s" for' 'upgrade' % function.name) if reg_spec.sigstring != function.sigstring: raise UpgradeWorkflowError('mismatch on function "%s"' % \ function.name)
UpgradeWorkflowHandler.check_port_spec(invalid_module, function.name, 'input', d, function.sigstring)
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
c81ad48015ef142ef70a6e43f742b4357258ca46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/c81ad48015ef142ef70a6e43f742b4357258ca46/upgradeworkflow.py
output_port_spec = \ src_module.get_port_spec(src_port, 'output')
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')
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(""): output_port_spec = \ src_module.get_port_spec(src_port, 'output') output_port = Port(id=output_port_id, spec=output_port_spec, moduleId=src_module.id, moduleName=src_module.name) else: output_port = Port(id=output_port_id, name=src_port.name, type=src_port.type, signature=src_port.signature, moduleId=src_module.id, moduleName=src_module.name)
c81ad48015ef142ef70a6e43f742b4357258ca46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/c81ad48015ef142ef70a6e43f742b4357258ca46/upgradeworkflow.py
input_port_spec = \ dst_module.get_port_spec(dst_port, 'input')
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')
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(""): output_port_spec = \ src_module.get_port_spec(src_port, 'output') output_port = Port(id=output_port_id, spec=output_port_spec, moduleId=src_module.id, moduleName=src_module.name) else: output_port = Port(id=output_port_id, name=src_port.name, type=src_port.type, signature=src_port.signature, moduleId=src_module.id, moduleName=src_module.name)
c81ad48015ef142ef70a6e43f742b4357258ca46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/c81ad48015ef142ef70a6e43f742b4357258ca46/upgradeworkflow.py
self.setWindowTitle('VisTrails messages')
self.setWindowTitle('VisTrails Messages')
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'),
QtCore.SIGNAL('currentItemChanged(QListWidgetItem *, QListWidgetItem *)'),
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
self.msg_box = None self.resize(700, 400)
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
buttons = QtGui.QHBoxLayout()
self.text = QtGui.QTextEdit() self.text.setReadOnly(True) self.text.hide() layout.addWidget(self.text) buttons = QtGui.QGridLayout()
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
close = QtGui.QPushButton('&Hide', self)
leftbuttons = QtGui.QGridLayout() buttons.addLayout(leftbuttons, 0, 0, QtCore.Qt.AlignLeft) rightbuttons = QtGui.QGridLayout() buttons.addLayout(rightbuttons, 0, 1, QtCore.Qt.AlignRight) close = QtGui.QPushButton('&Close', self)
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
buttons.addWidget(close)
leftbuttons.addWidget(close, 0, 0)
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
details = QtGui.QPushButton('&Show details', self) details.setFixedWidth(120) buttons.addWidget(details) self.connect(details, QtCore.SIGNAL('clicked()'), self.details)
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
buttons.addWidget(copy)
rightbuttons.addWidget(copy, 0, 0)
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
buttons.addWidget(copyAll)
rightbuttons.addWidget(copyAll, 0, 1)
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
def details(self): """ call showMessage on selected message """ items = self.list.selectedItems() if len(items)>0: self.showMessage(items[0])
self.msg_box = None self.itemQueue = [] self.resize(700, 400)
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) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
def copyAll(self): """ copy selected message to clipboard """
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
def showMessage(self, item):
def showMessage(self, item, olditem):
def showMessage(self, item): """ show item data in a messagebox """ self.showMessageBox(str(item.data(32).toString()))
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
self.showMessageBox(str(item.data(32).toString()))
s = str(item.data(32).toString()) msgs = s.split('\n') msgs = [cgi.escape(i) for i in msgs] format = {'INFO': 'Message:', 'WARNING': 'Warning message:', 'CRITICAL': 'Critical message:'} text = '<HTML><BODY BGCOLOR=" text += '<H4>%s</H4>' % format.get(msgs[0], 'Message:') text += '<H4>%s<br></H4>' % msgs[3] text += '<table border="0">' if len(msgs)>4: text += '<tr><td>&nbsp;</td><td align=left>%s</td></tr>' % '<br>'.join(msgs[4:]) text += '<tr><td>&nbsp;</td><td>&nbsp;</td></tr>' text += '<tr><td align=right><b>Time:</b></td><td>%s</td></tr>' % msgs[1] text += '<tr><td align=right><b>Location:</b></td><td>%s</td></tr>' % msgs[2] text += '</table></BODY></HTML>' self.text.setHtml(text) self.text.show()
def showMessage(self, item): """ show item data in a messagebox """ self.showMessageBox(str(item.data(32).toString()))
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
def showMessageBox(self, s): s = str(s).strip()
def updateMessageBox(self, item): self.currentItem = item msg_box = self.msg_box s = str(item.data(32).toString())
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
def showMessageBox(self, item): """ Displays the current message in a messagebox if a message is already shown the same message is shown again but with a "next message"-button """ msg_box = self.msg_box if not msg_box or not msg_box.isVisible(): self.old_msg_box = msg_box msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setEscapeButton(QtGui.QMessageBox.Ok) msg_box.addButton('&Show Messages', msg_box.RejectRole) self.manyButton = None self.connect(msg_box, QtCore.SIGNAL('buttonClicked(QAbstractButton *)'), self.messageButtonClicked) self.updateMessageBox(item) else: self.itemQueue.append(item) if self.itemQueue: many = len(self.itemQueue) text = '&Next Message (%s more)' % many if not self.manyButton: self.manyButton=QtGui.QPushButton(text) msg_box.addButton(self.manyButton, msg_box.DestructiveRole) else: self.manyButton.setText(text) else: if self.manyButton: print "removing", self.manyButton msg_box.removeButton(self.manyButton) self.manyButton = None if not msg_box.isVisible(): msg_box.show() msg_box.resize(msg_box.sizeHint()) msg_box.updateGeometry() msg_box.activateWindow() msg_box.raise_() def messageButtonClicked(self, button): role = self.msg_box.buttonRole(button) if role == self.msg_box.RejectRole: self.itemQueue = [] self.show() self.list.setCurrentItem(self.currentItem) self.list.scrollToItem(self.currentItem) elif role == self.msg_box.DestructiveRole: item = self.itemQueue[0] del self.itemQueue[0] self.showMessageBox(item) else: self.itemQueue = []
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
def write(self, s):
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
if msgs[0] == "CRITICAL": self.showMessageBox(s)
def write(self, s):
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
item.setForeground(QtGui.QBrush(QtGui.QColor("
item.setForeground(QtGui.QBrush(QtGui.QColor("
def write(self, s):
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
count = self.list.count() if count: self.list.scrollToItem(self.list.item(count-1))
def showEvent(self, e): """closeEvent(e) -> None Event handler called when the dialog is about to close.""" count = self.list.count() if count: self.list.scrollToItem(self.list.item(count-1)) self.emit(QtCore.SIGNAL("messagesView(bool)"), True)
037568dc5960fe0f55f627faf210c87f5ee28788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/037568dc5960fe0f55f627faf210c87f5ee28788/debug.py
abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail()
from core.vistrail.vistrail import Vistrail abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails)
def load_vistrail(locator, is_abstraction=False): abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails) else: vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
2c0da4bb818c7f85b947da2063b826c12091fc25 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/2c0da4bb818c7f85b947da2063b826c12091fc25/io.py
res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails) else: vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
def load_vistrail(locator, is_abstraction=False): abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails) else: vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
2c0da4bb818c7f85b947da2063b826c12091fc25 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/2c0da4bb818c7f85b947da2063b826c12091fc25/io.py
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) 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) vt_mod_time = locator.get_db_modification_time() self.server_logger.info("image time: %s, vt time: %s"%(image_time, vt_mod_time)) if image_time < vt_mod_time: return True else: return False
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 """
fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b/application_server.py
is_image_stale(filename, host, port, db_name, vt_id)) and
self._is_image_stale(filename, host, port, db_name, vt_id)) and
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) 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) vt_mod_time = locator.get_db_modification_time() self.server_logger.info("image time: %s, vt time: %s"%(image_time, vt_mod_time)) if image_time < vt_mod_time: return True else: return False
fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b/application_server.py
is_image_stale(filename, host, port, db_name, vt_id)):
self._is_image_stale(filename, host, port, db_name, vt_id)):
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) 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) vt_mod_time = locator.get_db_modification_time() self.server_logger.info("image time: %s, vt time: %s"%(image_time, vt_mod_time)) if image_time < vt_mod_time: return True else: return False
fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b/application_server.py
os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None):
(os.path.exists(filepath) and not os.path.exists(filename)) or self._is_image_stale(filename, host, port, db_name, vt_id)) and self.proxies_queue is not None):
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 """
fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b/application_server.py
if not os.path.exists(filepath):
if (not os.path.exists(filepath) or (os.path.exists(filepath) and not os.path.exists(filename)) or self._is_image_stale(filename, host, port, db_name, vt_id)): if os.path.exists(filepath): shutil.rmtree(filepath)
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 """
fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b/application_server.py
if not os.path.exists(filename):
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 """
fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/fc0ab9f1626d3f10561654d52bf7f2e50ff07e4b/application_server.py
def keyPressEvent(self, e): """keyPressEvent(e) -> None Handle user input a key at a time.
694c0a43fbda465938eb5afb2a608e2218c55781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/694c0a43fbda465938eb5afb2a608e2218c55781/shell.py
if (e.modifiers() & QtCore.Qt.ControlModifier or e.modifiers() & QtCore.Qt.ShiftModifier): e.ignore()
if e.modifiers() & QtCore.Qt.ControlModifier: if key == QtCore.Qt.Key_C or key == QtCore.Qt.Key_Insert: self.copy() elif key == QtCore.Qt.Key_V: cursor = self.textCursor() cursor.movePosition(QtGui.QTextCursor.End) cursor.clearSelection() self.setTextCursor(cursor) self.paste() elif key == QtCore.Qt.Key_A: self.selectAll() self.selectMode = True else: e.ignore()
def keyPressEvent(self, e): """keyPressEvent(e) -> None Handle user input a key at a time.
694c0a43fbda465938eb5afb2a608e2218c55781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/694c0a43fbda465938eb5afb2a608e2218c55781/shell.py
def mousePressEvent(self, e): """mousePressEvent(e) -> None Keep the cursor after the last prompt. """ if e.button() == QtCore.Qt.LeftButton: self.selectMode = True QtGui.QTextEdit.mousePressEvent(self, e)
def focusNextPrevChild(self, next): """focusNextPrevChild(next) -> None Suppress tabbing to the next window in multi-line commands. """ if next and self.more: return 0 return QtGui.QTextEdit.focusNextPrevChild(self, next)
694c0a43fbda465938eb5afb2a608e2218c55781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/694c0a43fbda465938eb5afb2a608e2218c55781/shell.py
return
# def mousePressEvent(self, e):
694c0a43fbda465938eb5afb2a608e2218c55781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/694c0a43fbda465938eb5afb2a608e2218c55781/shell.py
self.flush_move_actions()
added_moves = self.flush_move_actions()
def flush_delayed_actions(self): start_version = self.current_version desc_key = Action.ANNOTATION_DESCRIPTION for action in self._delayed_actions: self.vistrail.add_action(action, start_version, self.current_session) # HACK to populate upgrade information if (action.has_annotation_with_key(desc_key) and action.get_annotation_by_key(desc_key).value == 'Upgrade'): self.vistrail.set_upgrade(start_version, str(action.id)) self.current_version = action.id start_version = action.id
d1dbf30054995c6eff4881c34bb07da0403f421c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/d1dbf30054995c6eff4881c34bb07da0403f421c/controller.py
msg = "Problem importing the generated stub files: %s",str(e)
msg = "Problem importing the generated stub files: %s", str(e)
def load_wsdl_with_config(wsdlList): """load_wsdl_with_config(wsdlList: list of urls) -> (bool,list) This loads the wsdl list creating config files. Returns a tuple with two values. The first is a boolean that is True in case of success. The second is a list with problematic urls""" global schema global webServicesmodulesDict global complexsdict reg = core.modules.module_registry.get_module_registry() basic = core.modules.basic_modules not_loaded = [] result = True for w in wsdlList: #Validation if the user introduces a blank space in the list of #web services if w == '': continue complexsdict = {} #This dictionary stores the complex types for #a webservice w w = w.strip() #Check to see if the element is not repeated in the web services list numtimes = 0 for element in wsdlList: if w == element.strip(): numtimes = numtimes + 1 if numtimes > 1: print "The following web service is repeated in the list and won't \
699e8cd0a71ae5f33a332a2c041980715ada93fa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/699e8cd0a71ae5f33a332a2c041980715ada93fa/__init__.py
translate_dict = {'DBGroup': {'workflow': update_workflow}}
translate_dict = {'DBGroup': {'workflow': update_workflow}, 'DBAction': {'operations': update_operations}}
def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict, DBWorkflow())
50b9ce2b28fc0aa91ce57ba3e57737345b815424 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/50b9ce2b28fc0aa91ce57ba3e57737345b815424/v0_9_3.py
translate_dict = {'DBGroup': {'workflow': update_workflow}}
translate_dict = {'DBGroup': {'workflow': update_workflow}, 'DBWorkflow': {'modules': update_modules}}
def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict, DBWorkflow())
50b9ce2b28fc0aa91ce57ba3e57737345b815424 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/50b9ce2b28fc0aa91ce57ba3e57737345b815424/v0_9_3.py
QtCore.SIGNAL('itemClicked(QListWidgetItem *)'), self.updateDBObjectsList) self.connect(self.connectionList,
def connectSignals(self): """ connectSignals() -> None Map signals between GUI components """ self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) self.connect(self.openButton, QtCore.SIGNAL('clicked()'), self.accept) self.connect(self.addAct, QtCore.SIGNAL('triggered()'), self.showConnConfig) self.connect(self.removeAct, QtCore.SIGNAL('triggered()'), self.connectionList.removeConnection) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.connectionList, QtCore.SIGNAL('itemClicked(QListWidgetItem *)'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL("reloadConnections"), self.updateDBObjectsList) self.connect(self.objectList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.saveasEdt, QtCore.SIGNAL('textChanged(QString)'), self.updateButtons) self.connect(self.objectList, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.accept)
1035f85e7be34e55b86c8ed41f0ce5ea4719d50c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/1035f85e7be34e55b86c8ed41f0ce5ea4719d50c/open_db_window.py
def connectSignals(self): """ connectSignals() -> None Map signals between GUI components """ self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) self.connect(self.openButton, QtCore.SIGNAL('clicked()'), self.accept) self.connect(self.addAct, QtCore.SIGNAL('triggered()'), self.showConnConfig) self.connect(self.removeAct, QtCore.SIGNAL('triggered()'), self.connectionList.removeConnection) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.connectionList, QtCore.SIGNAL('itemClicked(QListWidgetItem *)'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL("reloadConnections"), self.updateDBObjectsList) self.connect(self.objectList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.saveasEdt, QtCore.SIGNAL('textChanged(QString)'), self.updateButtons) self.connect(self.objectList, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.accept)
1035f85e7be34e55b86c8ed41f0ce5ea4719d50c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/1035f85e7be34e55b86c8ed41f0ce5ea4719d50c/open_db_window.py
app = gui.application.VistrailsApplication
def __init__(self, parent): QToolWindow.__init__(self, parent=parent) #locals() returns the original dictionary, not a copy as #the docs say app = gui.application.VistrailsApplication self.firstLocals = copy.copy(locals()) self.shell = QShell(self.firstLocals,None) self.setWidget(self.shell) self.setWindowTitle(self.shell.windowTitle()) self.monitorWindowTitle(self.shell) self.vistrails_interpreter = get_default_interpreter()
b521e096f879199631bcc61d8742975db5733adf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/b521e096f879199631bcc61d8742975db5733adf/shell.py
app = gui.application.VistrailsApplication shell_conf = app.configuration.shell
conf = get_vistrails_configuration() shell_conf = conf.shell
def __init__(self, locals=None, parent=None): """Constructor.
b521e096f879199631bcc61d8742975db5733adf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/b521e096f879199631bcc61d8742975db5733adf/shell.py
self.setCurrentFont(font)
self.setFont(font)
def __init__(self, locals=None, parent=None): """Constructor.
b521e096f879199631bcc61d8742975db5733adf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/b521e096f879199631bcc61d8742975db5733adf/shell.py
isoutdated = httpfile.is_outdated(remoteHeader, localFile)
isoutdated = httpfile._is_outdated(remoteHeader, localFile)
def verify_wsdl(wsdlList): """verify_wsdl(wsdlList: list of urls) -> (list,list,list) This checks for the wsdls that need to be updated or the files need to be generated and splits them in 3 lists: files that are outdated, updated and ones that an error was generated. """ outdated_list = [] updated_list = [] error_list = [] for w in wsdlList: if w == '': continue try: s = w.split('/') host = s[2] except: msg = "Malformed URL." error_list.append((w,msg)) continue location = w reader = WSDLTools.WSDLReader() load = reader.loadFromURL try: wsdl = load(location) except Exception, e: msg = "Couldn't load wsdl from the web: %s."%str(e) error_list.append((w,msg)) continue directoryname = urllib.quote_plus(w) directoryname = directoryname.replace(".","_") directoryname = directoryname.replace("%","_") directoryname = directoryname.replace("+","_") package_subdirectory = os.path.join(core.system.default_dot_vistrails(), "webServices", directoryname) wsm = WriteServiceModule(wsdl) client_mod = wsm.getClientModuleName() client_file = os.path.join(package_subdirectory, '%s.py' %client_mod) conn = httplib.HTTPConnection(host) filename = '/' + '/'.join(s[3:]) request = conn.request("GET", filename) response = conn.getresponse() remoteHeader = response.msg.getheader('last-modified') isoutdated = False if remoteHeader != None: localFile = client_file reg = core.modules.module_registry.get_module_registry() httpfile = reg.get_descriptor_by_name('edu.utah.sci.vistrails.http', 'HTTPFile').module() try: isoutdated = httpfile.is_outdated(remoteHeader, localFile) except OSError: print "File doesn't exist" isoutdated = True if isoutdated or remoteHeader == None: outdated_list.append(w) else: updated_list.append(w) return (outdated_list,updated_list, error_list)
5f18512308ef7d642023ff86e06c8ff21d9ef0f5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/5f18512308ef7d642023ff86e06c8ff21d9ef0f5/init.py
qt_super(QVersionTreeScene, self).keyPressEvent(event)
else: qt_super(QVersionTreeScene, self).keyPressEvent(event)
def keyPressEvent(self, event): """ keyPressEvent(event: QKeyEvent) -> None Capture 'Del', 'Backspace' for pruning versions when not editing a tag """ selectedItems = self.selectedItems() versions = [item.id for item in selectedItems if type(item)==QGraphicsVersionItem and not item.text.hasFocus()] if (self.controller and len(versions)>0 and event.key() in [QtCore.Qt.Key_Backspace, QtCore.Qt.Key_Delete]): versions = [item.id for item in selectedItems] res = gui.utils.show_question("VisTrails", "Are you sure that you want to " "prune the selected version(s)?", [gui.utils.YES_BUTTON, gui.utils.NO_BUTTON], gui.utils.NO_BUTTON) if res == gui.utils.YES_BUTTON: self.controller.prune_versions(versions) qt_super(QVersionTreeScene, self).keyPressEvent(event)
cc05bc9e80e518d5d1afefbf46a1e3a4c763e556 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/cc05bc9e80e518d5d1afefbf46a1e3a4c763e556/version_view.py
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L):
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L, pipeline=None):
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
87c98b8c2f3c5efea30bb61bfdcd55bb54d4fc03 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/87c98b8c2f3c5efea30bb61bfdcd55bb54d4fc03/sub_module.py
internal_version: long) -> type
internal_version: long, pipeline: Pipeline) -> type
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
87c98b8c2f3c5efea30bb61bfdcd55bb54d4fc03 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/87c98b8c2f3c5efea30bb61bfdcd55bb54d4fc03/sub_module.py
pipeline = vistrail.getPipeline(internal_version) pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs()
if pipeline is None: pipeline = vistrail.getPipeline(internal_version) pipeline.validate()
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
87c98b8c2f3c5efea30bb61bfdcd55bb54d4fc03 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/87c98b8c2f3c5efea30bb61bfdcd55bb54d4fc03/sub_module.py
repository_vt_id, repository_creator):
repository_vt_id, repository_creator, is_local=True):
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str(or datastream), filename:str, repository_vt_id:int, repository_creator:str) -> (return_status, int) This will add a vistrail in vt_filepath to the the database. If running on a remote machine, vt_filepath will contain vt file data stream. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator.
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
traceback.print_exc()
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str(or datastream), filename:str, repository_vt_id:int, repository_creator:str) -> (return_status, int) This will add a vistrail in vt_filepath to the the database. If running on a remote machine, vt_filepath will contain vt file data stream. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator.
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
old_db_vt_id):
old_db_vt_id, is_local=True):
def merge_vt(self, host, port, db_name, user, new_vt_filepath, old_db_vt_id): """ Merge new_vt (new_vt_filepath) with current vt (old_db_vt_id)
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
version=None, pdf=False, vt_tag='',parameters=''):
version=None, pdf=False, vt_tag='',parameters='', is_local=True):
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))
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
def get_wf_graph_pdf(self, host, port, db_name, vt_id, version):
def get_wf_graph_pdf(self, host, port, db_name, vt_id, version, is_local=True):
def get_wf_graph_pdf(self, host, port, db_name, vt_id, version): """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) 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)
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
def get_wf_graph_png(self, host, port, db_name, vt_id, version):
def get_wf_graph_png(self, host, port, db_name, vt_id, version, is_local=True):
def get_wf_graph_png(self, host, port, db_name, vt_id, version): """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) 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)
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
def get_vt_graph_png(self, host, port, db_name, vt_id):
def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True):
def get_vt_graph_png(self, host, port, db_name, vt_id): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
result = proxy.get_vt_graph_png(host, port, db_name, vt_id)
result = proxy.get_vt_graph_png(host, port, db_name, vt_id, is_local)
def get_vt_graph_png(self, host, port, db_name, vt_id): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
def getPDFWorkflowMedley(self, m_id):
def getPDFWorkflowMedley(self, m_id, is_local=True):
def getPDFWorkflowMedley(self, m_id): """getPDFWorkflowMedley(m_id:int) -> str Returns the relative url to the generated image """ self.server_logger.info("getPDFWorkflowMedley(%s) request received" % m_id) try: m_id = int(m_id) medley = self.medley_objs[m_id] except Exception, e: self.server_logger.error(str(e))
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
def getPNGWorkflowMedley(self, m_id):
def getPNGWorkflowMedley(self, m_id, is_local=True):
def getPNGWorkflowMedley(self, m_id): self.server_logger.info("getPNGWorkflowMedley(%s) request received" % m_id) try: m_id = int(m_id) medley = self.medley_objs[m_id] except Exception, e: self.server_logger.error(str(e))
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
def get_vt_tagged_versions(self, host, port, db_name, vt_id):
def get_vt_tagged_versions(self, host, port, db_name, vt_id, is_local=True):
def get_vt_tagged_versions(self, host, port, db_name, vt_id): self.server_logger.info("Request: get_vt_tagged_versions(%s,%s,%s,%s)" % \ (host, port, db_name, vt_id)) 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)
18bf5085bdc109736e6bd679921e3545cc54a82a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/18bf5085bdc109736e6bd679921e3545cc54a82a/application_server.py
methodBox = self.parent().parent().parent()
methodBox = self.parent().parent().parent().parent()
def updateMethod(self): """ updateMethod() -> None Update the method values to vistrail. We only keep a monotonic version tree of the query pipeline, we can skip the actions here. """ methodBox = self.parent().parent().parent() if methodBox.controller: paramList = [] pipeline = methodBox.controller.current_pipeline f = pipeline.modules[methodBox.module.id].functions[self.fId] p = f.params for i in xrange(len(self.fields)): p[i].strValue = str(self.fields[i].editor.contents()) p[i].queryMethod = self.fields[i].selector.getCurrentMethod()
741b1c0d773741d3472d0488e9703a5834ad3fc6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/741b1c0d773741d3472d0488e9703a5834ad3fc6/query_tab.py
for module in self.pipeline.module_list:
for module in p.module_list:
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in self.pipeline.module_list: action_list.append(('add', module)) for connection in self.pipeline.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
dae8793fcd0a6aee486e37fdd0768fc0f29b34ee /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/dae8793fcd0a6aee486e37fdd0768fc0f29b34ee/application_server.py
for connection in self.pipeline.connection_list:
for connection in p.connection_list:
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in self.pipeline.module_list: action_list.append(('add', module)) for connection in self.pipeline.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
dae8793fcd0a6aee486e37fdd0768fc0f29b34ee /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/dae8793fcd0a6aee486e37fdd0768fc0f29b34ee/application_server.py
def setupScene(self, pipeline): """ setupScene(pipeline: Pipeline) -> None Construct the scene to view a pipeline """ old_pipeline = self.pipeline self.pipeline = pipeline
3e59defe4685e0016745c586ff720933721b9769 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3e59defe4685e0016745c586ff720933721b9769/pipeline_view.py
if tm_item.center != nm.center:
if tm_item.scenePos().x() != nm.center.x or \ -tm_item.scenePos().y() != nm.center.y:
def setupScene(self, pipeline): """ setupScene(pipeline: Pipeline) -> None Construct the scene to view a pipeline """ old_pipeline = self.pipeline self.pipeline = pipeline
3e59defe4685e0016745c586ff720933721b9769 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3e59defe4685e0016745c586ff720933721b9769/pipeline_view.py
type(subworkflow[0]) == type and
type(subworkflow[0]) == str and
def auto_add_subworkflow(self, subworkflow): if type(subworkflow) == str: return self.add_subworkflow(subworkflow) elif (type(subworkflow) == tuple and len(subworkflow) == 2 and type(subworkflow[0]) == type and type(subworkflow[1]) == dict): descriptor = self.add_subworkflow(subworkflow[0], **subworkflow[1]) return descriptor else: raise TypeError("Expected filename or (filename, kwargs)")
4cb7767106db67e05fb8eda59decb9f31146cf89 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/4cb7767106db67e05fb8eda59decb9f31146cf89/module_registry.py
s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type])
port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
def check_connection_port(port): try: s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type]) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name)) raise UpgradeWorkflowError(msg)
864d882bd15544844ea67ad38f382de84168749d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/864d882bd15544844ea67ad38f382de84168749d/upgradeworkflow.py
msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name))
msg = ("%s connection to port %s of module %s " "does not exist." % \ (PortSpec.port_type_map.inverse[port.type], port.name, invalid_module.name))
def check_connection_port(port): try: s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type]) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name)) raise UpgradeWorkflowError(msg)
864d882bd15544844ea67ad38f382de84168749d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/864d882bd15544844ea67ad38f382de84168749d/upgradeworkflow.py
reg_spec = d.get_port_spec(function.name, 'input')
reg_spec = reg.get_port_spec_from_descriptor(d, function.name, 'input')
def check_connection_port(port): try: s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type]) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name)) raise UpgradeWorkflowError(msg)
864d882bd15544844ea67ad38f382de84168749d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/864d882bd15544844ea67ad38f382de84168749d/upgradeworkflow.py
GIT_REVISION_CMD = '%s log --pretty=format:"%%H" HEAD^..' % GIT_BASE_CMD
GIT_REVISION_CMD = "%s rev-parse HEAD" % GIT_BASE_CMD
pattern = re.compile(r"(^\s*?def vistrails_revision\(\):.*?release = ['\"])([a-fA-F0-9]+?)(['\"].*?return release)", re.DOTALL | re.MULTILINE)
e2eb74fc932e3bf8979c1b2c169ef19a832a14b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e2eb74fc932e3bf8979c1b2c169ef19a832a14b9/make-vistrails-src-nightly.py
REVISION = revision_proc.communicate()[0]
REVISION = (revision_proc.communicate()[0]).strip()
def errexit(errcodeobj, showtrace=True, *args): errcode = errcodeobj[0] errmsg = errcodeobj[1] if args: errmsg = errmsg % args if showtrace: errio = StringIO() errio.write(errmsg + "\n") traceio = StringIO() traceback.print_exc(file=traceio) traceio.seek(0) errio.writelines([INDENT + line for line in traceio.readlines()]) errio.seek(0) errmsg = errio.read() error(errmsg) exit(errcode)
e2eb74fc932e3bf8979c1b2c169ef19a832a14b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/e2eb74fc932e3bf8979c1b2c169ef19a832a14b9/make-vistrails-src-nightly.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_wf_modules(self, host, port, db_name, vt_id, version): """get_wf_modules(host:str, port:int, db_name:str, vt_id:int, version:int) -> list of dict Returns a list of information about the modules used in a workflow in a list of dictionaries. The dictionary has the following keys: name, package, documentation. """ self.server_logger.info("Request: get_wf_modules(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
name=filename, user=user, passwd='r3P0:4uTH')
name=filename, user=db_write_user, passwd=db_write_pass)
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str, filename:str, repository_vt_id:int, repository_creator:str) -> int This will add a vistrail in vt_filepath to the the database. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator. """ try: locator = ZIPFileLocator(vt_filepath).load() if repository_vt_id != -1: vistrail = locator.vistrail vistrail.set_annotation('repository_vt_id', repository_vt_id) vistrail.set_annotation('repository_creator', repository_creator) #print "name=%s"%filename db_locator = DBLocator(host=host, port=int(port), database=db_name, name=filename, user=user, passwd='r3P0:4uTH') #print "db_locator %s" % db_locator db_locator.save_as(locator) return db_locator.obj_id except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
config['user'] = user config['passwd'] = 'pass'
config['user'] = db_write_user config['passwd'] = db_write_pass
def remove_vt_from_db(self, host, port, db_name, user, vt_id): """remove_vt_from_db(host:str, port:int, db_name:str, user:str, vt_id:int) -> 0 or 1 Remove a vistrail from the repository """ config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = user config['passwd'] = 'pass' try: conn = db.services.io.open_db_connection(config) db.services.io.delete_entity_from_db(conn,'vistrail', vt_id) db.services.io.close_db_connection(conn) return 1 except Exception, e: self.server_logger.info("Error: %s"%str(e)) if conn: db.services.io.close_db_connection(conn) return "FAILURE: %s" %str(e)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_runnable_workflows(self, host, port, db_name, vt_id): print "get_runnable_workflows" try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_wf_datasets(self, host, port, db_name, vt_id, version): print 'get workflow datasets' 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='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='repository', passwd='r3P0:4uTH',
user=db_write_user, passwd=db_write_pass,
def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, vt_tag='', parameters=''):
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_tag_version(self, host, port, db_name, vt_id, vt_tag): self.server_logger.info("Request: get_tag_version(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, vt_tag)) version = -1 try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_vt_xml(self, host, port, db_name, vt_id): self.server_logger.info("Request: get_vt_xml(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_wf_xml(self, host, port, db_name, vt_id, version): self.server_logger.info("Request: get_wf_xml(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
def getPDFWorkflow(self, m_id): self.server_logger.info( "getPDFWorkflow(%s) request received"%m_id) print "getPDFWorkflow(%s) request received"%m_id try: m_id = int(m_id) medley = self.medley_objs[m_id] except Exception, e: print str(e) try: locator = DBLocator(host=db_host, port=3306, database='vistrails', user='vtserver', passwd='', obj_id=medley._vtid, obj_type=None, connection_id=None) version = long(medley._version) subdir = os.path.join('workflows', hashlib.sha224("%s_%s"%(str(locator),version)).hexdigest()) filepath = os.path.join('/server/crowdlabs/site_media/media/medleys/images', subdir) base_fname = "%s_%s.pdf" % (str(locator.short_name), 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): proxy = self.proxies_queue.get() try: print "Sending request to ", proxy result = proxy.getPDFWorkflow(m_id) self.proxies_queue.put(proxy) print "returning %s"% result self.server_logger.info("returning %s"% result) return result except Exception, e: print "Exception: ", str(e) return "" if not os.path.exists(filepath): os.mkdir(filepath) if not os.path.exists(filename): (v, abstractions , thumbnails) = io.load_vistrail(locator) controller = VistrailController() controller.set_vistrail(v, locator, abstractions, thumbnails) controller.change_selected_version(version) print medley._vtid, " ", medley._version p = controller.current_pipeline from gui.pipeline_view import QPipelineView pipeline_view = QPipelineView() pipeline_view.scene().setupScene(p) pipeline_view.scene().saveToPDF(filename) del pipeline_view else: print "found cached pdf: ", filename return os.path.join(subdir,base_fname) except Exception, e: print "Error when saving pdf: ", str(e) def getPNGWorkflow(self, m_id): self.server_logger.info( "getPNGWorkflow(%s) request received"%m_id) print "getPNGWorkflow(%s) request received"%m_id try: m_id = int(m_id) medley = self.medley_objs[m_id] except Exception, e: print str(e) try: locator = DBLocator(host=db_host, port=3306, database='vistrails', user='vtserver', passwd='', obj_id=medley._vtid, obj_type=None, connection_id=None) version = long(medley._version) subdir = os.path.join('workflows', hashlib.sha224("%s_%s"%(str(locator),version)).hexdigest()) filepath = os.path.join('/server/crowdlabs/site_media/media/medleys/images', subdir) base_fname = "%s_%s.png" % (str(locator.short_name), 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): proxy = self.proxies_queue.get() try: print "Sending request to ", proxy result = proxy.getPNGWorkflow(m_id) self.proxies_queue.put(proxy) print "returning %s"% result self.server_logger.info("returning %s"% result) return result except Exception, e: print "Exception: ", str(e) return "" if not os.path.exists(filepath): os.mkdir(filepath) if not os.path.exists(filename): (v, abstractions , thumbnails) = io.load_vistrail(locator) controller = VistrailController() controller.set_vistrail(v, locator, abstractions, thumbnails) controller.change_selected_version(version) print medley._vtid, " ", medley._version p = controller.current_pipeline from gui.pipeline_view import QPipelineView pipeline_view = QPipelineView() pipeline_view.scene().setupScene(p) pipeline_view.scene().saveToPNG(filename) del pipeline_view else: print "Found cached image: ", filename return os.path.join(subdir,base_fname) except Exception, e: print "Error when saving png: ", str(e)
def get_wf_xml(self, host, port, db_name, vt_id, version): self.server_logger.info("Request: get_wf_xml(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_vt_zip(self, host, port, db_name, vt_id): """get_vt_zip(host:str, port: str, db_name: str, vt_id:str) -> str Returns a .vt file encoded as base64 string """ self.server_logger.info("Request: get_vt_zip(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) save_bundle = locator.load() #create temporary file (fd, name) = tempfile.mkstemp(prefix='vt_tmp', suffix='.vt') os.close(fd) fileLocator = FileLocator(name) fileLocator.save(save_bundle) contents = open(name).read() result = base64.b64encode(contents) os.unlink(name) self.server_logger.info("SUCCESS!") return result except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in p.module_list: action_list.append(('add', module)) for connection in p.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
config['user'] = 'vtserver' config['passwd'] = ''
config['user'] = db_read_user config['passwd'] = db_read_pass
def get_db_vt_list(self, host, port, db_name): self.server_logger.info("Request: get_db_vistrail_list(%s,%s,%s)"%(host, port, db_name)) config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = 'vtserver' config['passwd'] = '' try: rows = io.get_db_vistrail_list(config) return rows except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
config['user'] = 'vtserver' config['passwd'] = ''
config['user'] = db_read_user config['passwd'] = db_read_pass
def get_db_vt_list_xml(self, host, port, db_name): self.server_logger.info("Request: get_db_vistrail_list(%s,%s,%s)"%(host, port, db_name)) config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = 'vtserver' config['passwd'] = '' try: rows = io.get_db_vistrail_list(config) result = '<vistrails>' for (id, name, mod_time) in rows: result += '<vistrail id="%s" name="%s" mod_time="%s" />'%(id,name,mod_time) result += '</vistrails>' return result except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
user='vtserver', passwd='',
user=db_read_user, passwd=db_read_pass,
def get_vt_tagged_versions(self, host, port, db_name, vt_id): self.server_logger.info("Request: get_vt_tagged_versions(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
3ebd431b3e88347283e0d6f951c8fac25465a30e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/3ebd431b3e88347283e0d6f951c8fac25465a30e/application_server.py
self.perm_view.setEnabled(False) self.perm_edit.setEnabled(False) self.perm_download.setEnabled(False)
self._default_perm_label.setText("Default Global Permissions " "(only applicable to branching):")
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
97c0ec7cbaf4d750ca0b818712380d001b34e55d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6341/97c0ec7cbaf4d750ca0b818712380d001b34e55d/repository.py