text_prompt stringlengths 157 13.1k | code_prompt stringlengths 7 19.8k ⌀ |
|---|---|
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_task(self, ):
"""Create a task and store it in the self.task :returns: None :rtype: None :raises: None """ |
depi = self.dep_cb.currentIndex()
assert depi >= 0
dep = self.deps[depi]
deadline = self.deadline_de.dateTime().toPython()
try:
task = djadapter.models.Task(department=dep, project=self.element.project, element=self.element, deadline=deadline)
task.save()... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_ui(self, ):
"""Create all necessary ui elements for the tool :returns: None :rtype: None :raises: None """ |
log.debug("Setting up the ui")
self.setup_prjs_page()
self.setup_prj_page()
self.setup_seq_page()
self.setup_shot_page()
self.setup_atype_page()
self.setup_asset_page()
self.setup_dep_page()
self.setup_task_page()
self.setup_users_page()
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_prjs_page(self, ):
"""Create and set the model on the projects page :returns: None :rtype: None :raises: None """ |
self.prjs_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
log.debug("Loading projects for projects page.")
rootdata = treemodel.ListItemData(['Name', 'Short', 'Path', 'Created', 'Semester', 'Status', 'Resolution', 'FPS', 'Scale'])
rootitem = treemodel.TreeIte... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_prj_page(self, ):
"""Create and set the model on the project page :returns: None :rtype: None :raises: None """ |
self.prj_seq_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.prj_atype_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.prj_dep_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.prj_user_tabl... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_shot_page(self, ):
"""Create and set the model on the shot page :returns: None :rtype: None :raises: None """ |
self.shot_asset_treev.header().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.shot_task_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_asset_page(self, ):
"""Create and set the model on the asset page :returns: None :rtype: None :raises: None """ |
self.asset_asset_treev.header().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.asset_task_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_users_page(self, ):
"""Create and set the model on the users page :returns: None :rtype: None :raises: None """ |
self.users_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
log.debug("Loading users for users page.")
rootdata = treemodel.ListItemData(['Username', 'First', 'Last', 'Email'])
rootitem = treemodel.TreeItem(rootdata)
users = djadapter.users.all()
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_user_page(self, ):
"""Create and set the model on the user page :returns: None :rtype: None :raises: None """ |
self.user_prj_tablev.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.user_task_treev.header().setResizeMode(QtGui.QHeaderView.ResizeToContents) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_prjs_signals(self, ):
"""Setup the signals for the projects page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up projects page signals.")
self.prjs_prj_view_pb.clicked.connect(self.prjs_view_prj)
self.prjs_prj_create_pb.clicked.connect(self.prjs_create_prj) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_prj_signals(self, ):
"""Setup the signals for the project page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up project page signals.")
self.prj_seq_view_pb.clicked.connect(self.prj_view_seq)
self.prj_seq_create_pb.clicked.connect(self.prj_create_seq)
self.prj_atype_view_pb.clicked.connect(self.prj_view_atype)
self.prj_atype_add_pb.clicked.connect(self.prj_add_atype)... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_seq_signals(self, ):
"""Setup the signals for the sequence page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up sequence page signals.")
self.seq_prj_view_pb.clicked.connect(self.seq_view_prj)
self.seq_shot_view_pb.clicked.connect(self.seq_view_shot)
self.seq_shot_create_pb.clicked.connect(self.seq_create_shot)
self.seq_desc_pte.textChanged.connect(self.seq_save) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_shot_signals(self, ):
"""Setup the signals for the shot page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up shot page signals.")
self.shot_prj_view_pb.clicked.connect(self.shot_view_prj)
self.shot_seq_view_pb.clicked.connect(self.shot_view_seq)
self.shot_asset_view_pb.clicked.connect(self.shot_view_asset)
self.shot_asset_create_pb.clicked.connect(self.shot_create... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_atype_signals(self, ):
"""Setup the signals for the assettype page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up atype page signals.")
self.asset_prj_view_pb.clicked.connect(self.asset_view_prj)
self.asset_atype_view_pb.clicked.connect(self.asset_view_atype)
self.atype_asset_view_pb.clicked.connect(self.atype_view_asset)
self.atype_asset_create_pb.clicked.connect(self... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_asset_signals(self, ):
"""Setup the signals for the asset page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up asset signals.")
self.asset_asset_view_pb.clicked.connect(self.asset_view_asset)
self.asset_asset_create_pb.clicked.connect(self.asset_create_asset)
self.asset_asset_add_pb.clicked.connect(self.asset_add_asset)
self.asset_asset_remove_pb.clicked.connect(sel... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_dep_signals(self, ):
"""Setup the signals for the department page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up department page signals.")
self.dep_prj_view_pb.clicked.connect(self.dep_view_prj)
self.dep_prj_add_pb.clicked.connect(self.dep_add_prj)
self.dep_prj_remove_pb.clicked.connect(self.dep_remove_prj)
self.dep_desc_pte.textChanged.connect(self.dep_save)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_task_signals(self, ):
"""Setup the signals for the task page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up task page signals.")
self.task_user_view_pb.clicked.connect(self.task_view_user)
self.task_user_add_pb.clicked.connect(self.task_add_user)
self.task_user_remove_pb.clicked.connect(self.task_remove_user)
self.task_dep_view_pb.clicked.connect(self.task_view_d... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_users_signals(self, ):
"""Setup the signals for the users page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up users page signals.")
self.users_user_view_pb.clicked.connect(self.users_view_user)
self.users_user_create_pb.clicked.connect(self.create_user) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def setup_user_signals(self, ):
"""Setup the signals for the user page :returns: None :rtype: None :raises: None """ |
log.debug("Setting up user page signals.")
self.user_task_view_pb.clicked.connect(self.user_view_task)
self.user_prj_view_pb.clicked.connect(self.user_view_prj)
self.user_prj_add_pb.clicked.connect(self.user_add_prj)
self.user_prj_remove_pb.clicked.connect(self.user_remove_prj)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prjs_view_prj(self, *args, **kwargs):
"""View the, in the projects table view selected, project. :returns: None :rtype: None :raises: None """ |
i = self.prjs_tablev.currentIndex()
item = i.internalPointer()
if item:
prj = item.internal_data()
self.view_prj(prj) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def view_prj(self, prj):
"""View the given project on the project page :param prj: the project to view :type prj: :class:`jukeboxcore.djadapter.models.Project` :... |
log.debug('Viewing project %s', prj.name)
self.cur_prj = None
self.pages_tabw.setCurrentIndex(1)
self.prj_name_le.setText(prj.name)
self.prj_short_le.setText(prj.short)
self.prj_path_le.setText(prj.path)
self.prj_desc_pte.setPlainText(prj.description)
sel... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_prj(self, atypes=None, deps=None):
"""Create and return a new project :param atypes: add the given atypes to the project :type atypes: list | None :pa... |
dialog = ProjectCreatorDialog(parent=self)
dialog.exec_()
prj = dialog.project
if prj and atypes:
for at in atypes:
at.projects.add(prj)
at.save()
if prj and deps:
for dep in deps:
dep.projects.add(prj)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_view_seq(self, *args, **kwargs):
"""View the, in the prj_seq_tablev selected, sequence. :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
i = self.prj_seq_tablev.currentIndex()
item = i.internalPointer()
if item:
seq = item.internal_data()
self.view_seq(seq) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_create_seq(self, *args, **kwargs):
"""Create a new Sequence for the current project :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
seq = self.create_seq(project=self.cur_prj)
if seq:
seqdata = djitemdata.SequenceItemData(seq)
treemodel.TreeItem(seqdata, self.prj_seq_model.root) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def view_seq(self, seq):
"""View the given sequence on the sequence page :param seq: the sequence to view :type seq: :class:`jukeboxcore.djadapter.models.Sequenc... |
log.debug('Viewing sequence %s', seq.name)
self.cur_seq = None
self.pages_tabw.setCurrentIndex(2)
self.seq_name_le.setText(seq.name)
self.seq_prj_le.setText(seq.project.name)
self.seq_desc_pte.setPlainText(seq.description)
shotrootdata = treemodel.ListItemData([... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_seq(self, project):
"""Create and return a new sequence :param project: the project for the sequence :type deps: :class:`jukeboxcore.djadapter.models.... |
dialog = SequenceCreatorDialog(project=project, parent=self)
dialog.exec_()
seq = dialog.sequence
return seq |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_view_atype(self, *args, **kwargs):
"""View the, in the atype table view selected, assettype. :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
i = self.prj_atype_tablev.currentIndex()
item = i.internalPointer()
if item:
atype = item.internal_data()
self.view_atype(atype) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_add_atype(self, *args, **kwargs):
"""Add more assettypes to the project. :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
dialog = AtypeAdderDialog(project=self.cur_prj)
dialog.exec_()
atypes = dialog.atypes
for atype in atypes:
atypedata = djitemdata.AtypeItemData(atype)
treemodel.TreeItem(atypedata, self.prj_atype_model.root) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_atype(self, projects):
"""Create and return a new atype :param projects: the projects for the atype :type projects: :class:`jukeboxcore.djadapter.mode... |
dialog = AtypeCreatorDialog(projects=projects, parent=self)
dialog.exec_()
atype = dialog.atype
return atype |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def view_atype(self, atype):
"""View the given atype on the atype page :param atype: the atype to view :type atype: :class:`jukeboxcore.djadapter.models.Atype` :... |
if not self.cur_prj:
return
log.debug('Viewing atype %s', atype.name)
self.cur_atype = None
self.pages_tabw.setCurrentIndex(4)
self.atype_name_le.setText(atype.name)
self.atype_desc_pte.setPlainText(atype.description)
assetrootdata = treemodel.ListIt... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_view_dep(self, *args, **kwargs):
"""View the, in the dep table view selected, department. :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
i = self.prj_dep_tablev.currentIndex()
item = i.internalPointer()
if item:
dep = item.internal_data()
self.view_dep(dep) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_add_dep(self, *args, **kwargs):
"""Add more departments to the project. :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
dialog = DepAdderDialog(project=self.cur_prj)
dialog.exec_()
deps = dialog.deps
for dep in deps:
depdata = djitemdata.DepartmentItemData(dep)
treemodel.TreeItem(depdata, self.prj_dep_model.root) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_dep(self, projects):
"""Create and return a new dep :param projects: the projects for the dep :type projects: :class:`jukeboxcore.djadapter.models.Pro... |
dialog = DepCreatorDialog(projects=projects, parent=self)
dialog.exec_()
dep = dialog.dep
return dep |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def view_dep(self, dep):
"""View the given department on the department page :param dep: the dep to view :type dep: :class:`jukeboxcore.djadapter.models.Departme... |
log.debug('Viewing department %s', dep.name)
self.cur_dep = None
self.pages_tabw.setCurrentIndex(6)
self.dep_name_le.setText(dep.name)
self.dep_short_le.setText(dep.short)
self.dep_shot_rb.setChecked(not dep.assetflag)
self.dep_asset_rb.setChecked(dep.assetflag)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_view_user(self, *args, **kwargs):
"""View the, in the user table view selected, user. :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
i = self.prj_user_tablev.currentIndex()
item = i.internalPointer()
if item:
user = item.internal_data()
self.view_user(user) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_add_user(self, *args, **kwargs):
"""Add more users to the project. :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
dialog = UserAdderDialog(project=self.cur_prj)
dialog.exec_()
users = dialog.users
for user in users:
userdata = djitemdata.UserItemData(user)
treemodel.TreeItem(userdata, self.prj_user_model.root)
self.cur_... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_remove_user(self, *args, **kwargs):
"""Remove the, in the user table view selected, user. :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
i = self.prj_user_tablev.currentIndex()
item = i.internalPointer()
if item:
user = item.internal_data()
log.debug("Removing user %s.", user.username)
item.set_parent(None)
self.cur_prj.users.remove(u... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_user(self, projects=None, tasks=None):
"""Create and return a new user :param projects: the projects for the user :type projects: list of :class:`juke... |
projects = projects or []
tasks = tasks or []
dialog = UserCreatorDialog(projects=projects, tasks=tasks, parent=self)
dialog.exec_()
user = dialog.user
if user:
userdata = djitemdata.UserItemData(user)
treemodel.TreeItem(userdata, self.users_model... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_show_path(self, ):
"""Show the dir in the a filebrowser of the project :returns: None :rtype: None :raises: None """ |
f = self.prj_path_le.text()
osinter = ostool.get_interface()
osinter.open_path(f) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prj_save(self):
"""Save the current project :returns: None :rtype: None :raises: None """ |
if not self.cur_prj:
return
desc = self.prj_desc_pte.toPlainText()
semester = self.prj_semester_le.text()
fps = self.prj_fps_dsb.value()
resx = self.prj_res_x_sb.value()
resy = self.prj_res_y_sb.value()
scale = self.prj_scale_cb.currentText()
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def seq_save(self):
"""Save the current sequence :returns: None :rtype: None :raises: None """ |
if not self.cur_seq:
return
desc = self.seq_desc_pte.toPlainText()
self.cur_seq.description = desc
self.cur_seq.save() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def seq_view_shot(self, ):
"""View the shot that is selected in the table view of the sequence page :returns: None :rtype: None :raises: None """ |
if not self.cur_seq:
return
i = self.seq_shot_tablev.currentIndex()
item = i.internalPointer()
if item:
shot = item.internal_data()
self.view_shot(shot) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def view_shot(self, shot):
"""View the given shot :param shot: the shot to view :type shot: :class:`jukeboxcore.djadapter.models.Shot` :returns: None :rtype: Non... |
log.debug('Viewing shot %s', shot.name)
self.cur_shot = None
self.pages_tabw.setCurrentIndex(3)
self.shot_name_le.setText(shot.name)
self.shot_prj_le.setText(shot.project.name)
self.shot_seq_le.setText(shot.sequence.name)
self.shot_start_sb.setValue(shot.startfra... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_shot(self, sequence):
"""Create and return a new shot :param sequence: the sequence for the shot :type sequence: :class:`jukeboxcore.djadapter.models.... |
dialog = ShotCreatorDialog(sequence=sequence, parent=self)
dialog.exec_()
shot = dialog.shot
return shot |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_task(self, element):
"""Create a new task for the given element :param element: the element for the task :type element: :class:`jukeboxcore.djadapter.... |
dialog = TaskCreatorDialog(element=element, parent=self)
dialog.exec_()
task = dialog.task
return task |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def view_asset(self, asset):
"""View the given asset :param asset: the asset to view :type asset: :class:`jukeboxcore.djadapter.models.Asset` :returns: None :rty... |
log.debug('Viewing asset %s', asset.name)
self.cur_asset = None
self.pages_tabw.setCurrentIndex(5)
name = asset.name
prj = asset.project.name
atype = asset.atype.name
desc = asset.description
self.asset_name_le.setText(name)
self.asset_prj_le.set... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def shot_add_asset(self, *args, **kwargs):
"""Add more assets to the shot. :returns: None :rtype: None :raises: None """ |
if not self.cur_shot:
return
dialog = AssetAdderDialog(shot=self.cur_shot)
dialog.exec_()
assets = dialog.assets
atypes = {}
for c in self.shot_asset_model.root.childItems:
atypes[c.internal_data()] = c
for asset in assets:
aty... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_asset(self, project, atype=None, shot=None, asset=None):
"""Create and return a new asset :param project: the project for the asset :type project: :cl... |
element = shot or asset
dialog = AssetCreatorDialog(project=project, atype=atype, parent=self)
dialog.exec_()
asset = dialog.asset
if not atype:
element.assets.add(asset)
return asset |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def view_task(self, task):
"""View the given task :param task: the task to view :type task: :class:`jukeboxcore.djadapter.models.Task` :returns: None :rtype: Non... |
log.debug('Viewing task %s', task.name)
self.cur_task = None
self.pages_tabw.setCurrentIndex(7)
self.task_dep_le.setText(task.name)
statusmap = {"New": 0, "Open": 1, "Done":2}
self.task_status_cb.setCurrentIndex(statusmap.get(task.status, -1))
dt = dt_to_qdateti... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def shot_save(self, ):
"""Save the current shot :returns: None :rtype: None :raises: None """ |
if not self.cur_shot:
return
desc = self.shot_desc_pte.toPlainText()
start = self.shot_start_sb.value()
end = self.shot_end_sb.value()
handle = self.shot_handle_sb.value()
self.cur_shot.description = desc
self.cur_shot.startframe = start
self... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def asset_view_prj(self, ):
"""View the project of the current asset :returns: None :rtype: None :raises: None """ |
if not self.cur_asset:
return
prj = self.cur_asset.project
self.view_prj(prj) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def asset_view_atype(self, ):
"""View the project of the current atype :returns: None :rtype: None :raises: None """ |
if not self.cur_asset:
return
atype = self.cur_asset.atype
self.view_atype(atype) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def atype_view_asset(self, ):
"""View the project of the current assettype :returns: None :rtype: None :raises: None """ |
if not self.cur_atype:
return
i = self.atype_asset_treev.currentIndex()
item = i.internalPointer()
if item:
asset = item.internal_data()
if isinstance(asset, djadapter.models.Asset):
self.view_asset(asset) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def atype_save(self):
"""Save the current atype :returns: None :rtype: None :raises: None """ |
if not self.cur_atype:
return
desc = self.atype_desc_pte.toPlainText()
self.cur_atype.description = desc
self.cur_atype.save() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def asset_add_asset(self, *args, **kwargs):
"""Add more assets to the asset. :returns: None :rtype: None :raises: None """ |
if not self.cur_asset:
return
dialog = AssetAdderDialog(asset=self.cur_asset)
dialog.exec_()
assets = dialog.assets
atypes = {}
for c in self.asset_asset_model.root.childItems:
atypes[c.internal_data()] = c
for asset in assets:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def asset_save(self):
"""Save the current asset :returns: None :rtype: None :raises: None """ |
if not self.cur_asset:
return
desc = self.asset_desc_pte.toPlainText()
self.cur_asset.description = desc
self.cur_asset.save() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def dep_add_prj(self, *args, **kwargs):
"""Add projects to the current department :returns: None :rtype: None :raises: None """ |
if not self.cur_dep:
return
dialog = ProjectAdderDialog(department=self.cur_dep)
dialog.exec_()
prjs = dialog.projects
for prj in prjs:
prjdata = djitemdata.ProjectItemData(prj)
treemodel.TreeItem(prjdata, self.dep_prj_model.root) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def dep_remove_prj(self, *args, **kwargs):
"""Remove the selected project from the department :returns: None :rtype: None :raises: None """ |
if not self.cur_dep:
return
i = self.dep_prj_tablev.currentIndex()
item = i.internalPointer()
if item:
prj = item.internal_data()
self.cur_dep.projects.remove(prj)
item.set_parent(None) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def dep_save(self, ):
"""Save the current department :returns: None :rtype: None :raises: None """ |
if not self.cur_dep:
return
ordervalue = self.dep_ordervalue_sb.value()
desc = self.dep_desc_pte.toPlainText()
self.cur_dep.ordervalue = ordervalue
self.cur_dep.description = desc
self.cur_dep.save() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def task_add_user(self, *args, **kwargs):
"""Add users to the current task :returns: None :rtype: None :raises: None """ |
if not self.cur_task:
return
dialog = UserAdderDialog(task=self.cur_task)
dialog.exec_()
users = dialog.users
for user in users:
userdata = djitemdata.UserItemData(user)
treemodel.TreeItem(userdata, self.task_user_model.root) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def task_remove_user(self, *args, **kwargs):
"""Remove the selected user from the task :returns: None :rtype: None :raises: None """ |
if not self.cur_task:
return
i = self.task_user_tablev.currentIndex()
item = i.internalPointer()
if item:
user = item.internal_data()
self.cur_task.users.remove(user)
item.set_parent(None) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def task_view_link(self, ):
"""View the link of the current task :returns: None :rtype: None :raises: None """ |
if not self.cur_task:
return
e = self.cur_task.element
if isinstance(e, djadapter.models.Asset):
self.view_asset(e)
else:
self.view_shot(e) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def task_save(self, ):
"""Save the current task :returns: None :rtype: None :raises: None """ |
if not self.cur_task:
return
deadline = self.task_deadline_de.dateTime().toPython()
status = self.task_status_cb.currentText()
self.cur_task.deadline = deadline
self.cur_task.status = status
self.cur_task.save() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def user_view_task(self, ):
"""View the task that is selected :returns: None :rtype: None :raises: None """ |
if not self.cur_user:
return
i = self.user_task_treev.currentIndex()
item = i.internalPointer()
if item:
task = item.internal_data()
if isinstance(task, djadapter.models.Task):
self.view_task(task) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def user_add_prj(self, *args, **kwargs):
"""Add projects to the current user :returns: None :rtype: None :raises: None """ |
if not self.cur_user:
return
dialog = ProjectAdderDialog(user=self.cur_user)
dialog.exec_()
prjs = dialog.projects
for prj in prjs:
prjdata = djitemdata.ProjectItemData(prj)
treemodel.TreeItem(prjdata, self.user_prj_model.root) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def user_remove_prj(self, *args, **kwargs):
"""Remove the selected project from the user :returns: None :rtype: None :raises: None """ |
if not self.cur_user:
return
i = self.user_prj_tablev.currentIndex()
item = i.internalPointer()
if item:
prj = item.internal_data()
prj.users.remove(self.cur_user)
item.set_parent(None) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def user_save(self):
"""Save the current user :returns: None :rtype: None :raises: None """ |
if not self.cur_user:
return
username = self.user_username_le.text()
first = self.user_first_le.text()
last = self.user_last_le.text()
email = self.user_email_le.text()
self.cur_user.username = username
self.cur_user.first_name = first
self.c... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def run(self):
"""Run self on provided screen""" |
notice('Starting output thread', self.color)
o = Thread(target=self.__output_thread, name='output')
o.start()
self.threads.append(o)
try:
notice('Starting input thread', self.color)
self.__input_thread()
except KeyboardInterrupt:
self.... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def __get_instructions(self):
"Get info from sockets"
if self.mode == 'c':
c, m = utils.recv(self.__s)
inst = [(c, m, self.__s)]
else:
inst = []
with self.__client_list_lock:
for com in self.clients:
c, m = utils... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def __process_instructions(self, inst):
"Act on instructions recieved"
to_send = []
for cmd, msg, com in inst:
if cmd not in config.CMDS: # ignore if it is not legal
continue
if cmd == 'MSG':
if self.mode == 's':
to_sen... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def __make_server(self):
"Make this node a server"
notice('Making server, getting listening socket', self.color)
self.mode = 's'
sock = utils.get_server_sock()
self.__s = sock
with self.__client_list_lock:
self.clients = deque()
self.threads = deque()
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def __make_client(self):
"Make this node a client"
notice('Making client, getting server connection', self.color)
self.mode = 'c'
addr = utils.get_existing_server_addr()
sock = utils.get_client_sock(addr)
self.__s = sock
with self.__client_list_lock:
s... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def erase_lines(n=1):
""" Erases n lines from the screen and moves the cursor up to follow """ |
for _ in range(n):
print(codes.cursor["up"], end="")
print(codes.cursor["eol"], end="") |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def move_cursor(cols=0, rows=0):
""" Moves the cursor the given number of columns and rows The cursor is moved right when cols is positive and left when negative... |
if cols == 0 and rows == 0:
return
commands = ""
commands += codes.cursor["up" if rows < 0 else "down"] * abs(rows)
commands += codes.cursor["left" if cols < 0 else "right"] * abs(cols)
if commands:
print(commands, end="")
stdout.flush() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def style_format(text, style):
""" Wraps texts in terminal control sequences Style can be passed as either a collection or space delimited string. Valid styles c... |
if not style:
return text
if isinstance(style, str):
style = style.split(" ")
prefix = ""
for s in style:
prefix += codes.colours.get(s, "")
prefix += codes.highlights.get(s, "")
prefix += codes.modes.get(s, "")
return prefix + text + codes.modes["reset"] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def style_print(*values, **kwargs):
""" A convenience function that applies style_format to text before printing """ |
style = kwargs.pop("style", None)
values = [style_format(value, style) for value in values]
print(*values, **kwargs) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def generate(cls, partial_props=None):
""" Generate new connection file props from defaults """ |
partial_props = partial_props or {}
props = partial_props.copy()
props.update(cls.DEFAULT_PROPERTIES)
return cls(props) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def write_file(self):
""" Write a new connection file to disk. and return its path """ |
name = "kernel-{pid}.json".format(pid=os.getpid())
path = os.path.join(jupyter_runtime_dir(), name)
# indentation, because why not.
connection_json = json.dumps(self.connection_props, indent=2)
with open(path, "w") as connection_file:
connection_file.write(connecti... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def gff3_verifier(entries, line=None):
"""Raises error if invalid GFF3 format detected Args: entries (list):
A list of GFF3Entry instances line (int):
Line num... |
regex = r'^[a-zA-Z0-9.:^*$@!+_?-|]+\t.+\t.+\t\d+\t\d+\t' \
+ r'\d*\.?\d*\t[+-.]\t[.0-2]\t.+{0}$'.format(os.linesep)
delimiter = r'\t'
for entry in entries:
try:
entry_verifier([entry.write()], regex, delimiter)
except FormatError as error:
# Format info... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def parse(s, return_type=int):
'''
Parse time string and return seconds.
You can specify the type of return value both int or datetime.timedelta
with 'return_type' argument.
'''
RE_DAY = r'([0-9]+)d(ay)?'
RE_HOUR = r'([0-9]+)h(our)?'
RE_MINUTE = r'([0-9]+)m(in(ute)?)?'
RE_SECOND = r'... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def path(string):
""" Define the 'path' data type that can be used by apps. """ |
if not os.path.exists(string):
msg = "Path %s not found!" % string
raise ArgumentTypeError(msg)
return string |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_argument(self, *args, **kwargs):
""" Add a parameter to this app. """ |
if not (('action' in kwargs) and (kwargs['action'] == 'help')):
# make sure required parameter options were defined
try:
name = kwargs['dest']
param_type = kwargs['type']
optional = kwargs['optional']
except KeyError as e:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def save_json_representation(self, dir_path):
""" Save the app's JSON representation object to a JSON file. """ |
file_name = self.__class__.__name__+ '.json'
file_path = os.path.join(dir_path, file_name)
with open(file_path, 'w') as outfile:
json.dump(self.get_json_representation(), outfile) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def launch(self, args=None):
""" This method triggers the parsing of arguments. """ |
self.options = self.parse_args(args)
if self.options.saveinputmeta:
# save original input options
self.save_input_meta()
if self.options.inputmeta:
# read new options from JSON file
self.options = self.get_options_from_file(self.options.inputmeta)... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_options_from_file(self, file_path):
""" Return the options parsed from a JSON file. """ |
# read options JSON file
with open(file_path) as options_file:
options_dict = json.load(options_file)
options = []
for opt_name in options_dict:
options.append(opt_name)
options.append(options_dict[opt_name])
return self.parse_args(options) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def save_output_meta(self):
""" Save descriptive output meta data to a JSON file. """ |
options = self.options
file_path = os.path.join(options.outputdir, 'output.meta.json')
with open(file_path, 'w') as outfile:
json.dump(self.OUTPUT_META_DICT, outfile) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def load_output_meta(self):
""" Load descriptive output meta data from a JSON file in the input directory. """ |
options = self.options
file_path = os.path.join(options.inputdir, 'output.meta.json')
with open(file_path) as infile:
return json.load(infile) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def print_app_meta_data(self):
""" Print the app's meta data. """ |
l_metaData = dir(self)
l_classVar = [x for x in l_metaData if x.isupper() ]
for str_var in l_classVar:
str_val = getattr(self, str_var)
print("%20s: %s" % (str_var, str_val)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def start(context):
"""Start application server. """ |
config = context.obj["config"]
daemon = select(config, "application.daemon", False)
workspace = select(config, "application.workspace", None)
pidfile = select(config, "application.pidfile", DEFAULT_PIDFILE)
daemon_start(partial(main, config), pidfile, daemon, workspace) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def stop(context):
"""Stop application server. """ |
config = context.obj["config"]
pidfile = select(config, "application.pidfile", DEFAULT_PIDFILE)
daemon_stop(pidfile) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def register_view(self, view):
"""This method is called by the view, that calls it when it is ready to register itself. Here we connect the 'pressed' signal of t... |
# connects the signals:
self.view['main_window'].connect('destroy', gtk.main_quit)
# initializes the text of label:
self.view.set_text("%d" % self.model.counter)
return |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def get_version(svn=False, limit=3):
"Returns the version as a human-format string."
v = '.'.join([str(i) for i in VERSION[:limit]])
if svn and limit >= 3:
from django.utils.version import get_svn_revision
import os
svn_rev = get_svn_revision(os.path.dirname(__file__))
if svn... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def format(self, format_spec='f'):
u""" Formata o CNPJ. Códigos de formatação: r -> raw f -> formatado '58414462000135' '58.414.462/0001-35' """ |
if format_spec == '' or format_spec == 'f':
cnpj = CNPJ.clean(self._cnpj)
return '{0}.{1}.{2}/{3}-{4}'.format(cnpj[0:2], cnpj[2:5], cnpj[5:8], cnpj[8:12], cnpj[12:14])
if format_spec == 'r':
return self._cnpj
raise ValueError(
"Unknown format code... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def format(self, format_spec='f'):
u""" Formata o CPF. Códigos de formatação: r -> raw f -> formatado '58119443659' '581.194.436-59' """ |
if format_spec == '' or format_spec == 'f':
cpf = CPF.clean(self._cpf)
return '{0}.{1}.{2}-{3}'.format(cpf[0:3], cpf[3:6], cpf[6:9], cpf[9:11])
if format_spec == 'r':
return self._cpf
raise ValueError(
"Unknown format code '{0}' for object of type... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_comment_edit(self, ):
"""Create a text edit for comments :returns: the created text edit :rtype: :class:`jukeboxcore.gui.widgets.textedit.JB_PlainText... |
pte = JB_PlainTextEdit(parent=self)
pte.set_placeholder("Enter a comment before saving...")
pte.setMaximumHeight(120)
return pte |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def release_callback(self, *args, **kwargs):
"""Create a new release :returns: None :rtype: None :raises: None """ |
tf = self.browser.get_current_selection()
if not tf:
self.statusbar.showMessage("Select a file to release, please!")
return
tfi = TaskFileInfo.create_from_taskfile(tf)
checks = self.get_checks()
cleanups = self.get_cleanups()
comment = self.get_co... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _do_create(di):
"""Function that interprets a dictionary and creates objects""" |
track = di['track'].strip()
artists = di['artist']
if isinstance(artists, StringType):
artists = [artists]
# todo: handle case where different artists have a song with the same title
tracks = Track.objects.filter(title=track, state='published')
if tracks:
track = tracks[0]
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_jobs_from_argument(self, raw_job_string):
""" return a list of jobs corresponding to the raw_job_string """ |
jobs = []
if raw_job_string.startswith(":"):
job_keys = raw_job_string.strip(" :")
jobs.extend([job for job in self.jobs(job_keys)])
# we assume a job code
else:
assert "/" in raw_job_string, "Job Code {0} is improperly formatted!".format(raw_job_stri... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def eqdate(y):
""" Like eq but compares datetime with y,m,d tuple. Also accepts magic string 'TODAY'. """ |
y = datetime.date.today() if y == 'TODAY' else datetime.date(*y)
return lambda x: x == y |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_grid(start, end, nsteps=100):
""" Generates a equal distanced list of float values with nsteps+1 values, begining start and ending with end. :param start... |
step = (end-start) / float(nsteps)
return [start + i * step for i in xrange(nsteps+1)] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def taskfileinfo_task_data(tfi, role):
"""Return the data for task :param tfi: the :class:`jukeboxcore.filesys.TaskFileInfo` holds the data :type tfi: :class:`ju... |
task = tfi.task
if role == QtCore.Qt.DisplayRole or role == QtCore.Qt.EditRole:
return task.name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.