Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting broken in #3080 #3116

Merged
merged 1 commit into from
Nov 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/flake8_lint_include_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ lib/galaxy/webapps/galaxy/api/roles.py
lib/galaxy/webapps/galaxy/api/samples.py
lib/galaxy/webapps/galaxy/api/tools.py
lib/galaxy/webapps/galaxy/api/tours.py
lib/galaxy/webapps/galaxy/api/workflows.py
lib/galaxy/webapps/galaxy/controllers/async.py
lib/galaxy/webapps/galaxy/controllers/data_manager.py
lib/galaxy/webapps/galaxy/controllers/error.py
Expand Down
1 change: 1 addition & 0 deletions .ci/py3_sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ lib/galaxy/web/framework/middleware/error.py
lib/galaxy/web/framework/middleware/static.py
lib/galaxy/web/__init__.py
lib/galaxy/webapps/galaxy/api/tours.py
lib/galaxy/webapps/galaxy/api/workflows.py
lib/galaxy/webapps/galaxy/controllers/userskeys.py
lib/galaxy/webapps/reports/__init__.py
lib/galaxy/webapps/tool_shed/controllers/user.py
Expand Down
46 changes: 28 additions & 18 deletions lib/galaxy/webapps/galaxy/api/workflows.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
"""
API operations for Workflows
"""

from __future__ import absolute_import

import logging
import urllib
from six.moves.urllib.parse import unquote_plus

from sqlalchemy import desc, false, or_, true
from galaxy import exceptions, util

from galaxy import (
exceptions,
model,
util
)
from galaxy.managers import (
histories,
workflows
)
from galaxy.model.item_attrs import UsesAnnotations
from galaxy.managers import histories
from galaxy.managers import workflows
from galaxy.util.sanitize_html import sanitize_html
from galaxy.web import _future_expose_api as expose_api
from galaxy.web.base.controller import BaseAPIController, url_for, UsesStoredWorkflowMixin
from galaxy.web.base.controller import SharableMixin
from galaxy.web.base.controller import (
BaseAPIController,
SharableMixin,
url_for,
UsesStoredWorkflowMixin
)
from galaxy.workflow.extract import extract_workflow
from galaxy.workflow.modules import module_factory
from galaxy.workflow.run import invoke, queue_invoke
from galaxy.workflow.run_request import build_workflow_run_configs
from galaxy.workflow.modules import module_factory
from galaxy import model
from galaxy.util.sanitize_html import sanitize_html

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -161,7 +171,7 @@ def create(self, trans, payload, **kwd):
from_history_id = self.decode_id( from_history_id )
history = self.history_manager.get_accessible( from_history_id, trans.user, current_history=trans.history )

job_ids = map( self.decode_id, payload.get( 'job_ids', [] ) )
job_ids = [ self.decode_id(_) for _ in payload.get( 'job_ids', [] ) ]
dataset_ids = payload.get( 'dataset_ids', [] )
dataset_collection_ids = payload.get( 'dataset_collection_ids', [] )
workflow_name = payload[ 'workflow_name' ]
Expand Down Expand Up @@ -216,7 +226,7 @@ def create(self, trans, payload, **kwd):
rval['outputs'] = []
for step in workflow.steps:
if step.type == 'tool' or step.type is None:
for v in outputs[ step.id ].itervalues():
for v in outputs[ step.id ].values():
rval[ 'outputs' ].append( trans.security.encode_id( v.id ) )

# Newer version of this API just returns the invocation as a dict, to
Expand Down Expand Up @@ -306,27 +316,27 @@ def update( self, trans, id, payload, **kwds ):
name defaults to existing name
* annotation optional string annotation for the workflow, if not present in payload,
annotation defaults to existing annotation
* menu_entry optional boolean marking if the workflow should appear in the user's menu,
if not present, workflow menu entries are not modified
* menu_entry optional boolean marking if the workflow should appear in the user's menu,
if not present, workflow menu entries are not modified

:rtype: dict
:returns: serialized version of the workflow
"""
stored_workflow = self.__get_stored_workflow( trans, id )
if 'workflow' in payload:
stored_workflow.name = sanitize_html(payload['name']) if ('name' in payload) else stored_workflow.name

if 'annotation' in payload:
newAnnotation = sanitize_html(payload['annotation'])
self.add_item_annotation(trans.sa_session, trans.get_user(), stored_workflow, newAnnotation)

if 'menu_entry' in payload:
if payload['menu_entry']:
menuEntry = model.StoredWorkflowMenuEntry()
menuEntry.stored_workflow = stored_workflow
trans.get_user().stored_workflow_menu_entries.append(menuEntry)
else:
#remove if in list
# remove if in list
entries = {x.stored_workflow_id: x for x in trans.get_user().stored_workflow_menu_entries}
if (trans.security.decode_id(id) in entries):
trans.get_user().stored_workflow_menu_entries.remove(entries[trans.security.decode_id(id)])
Expand Down Expand Up @@ -380,7 +390,7 @@ def build_module( self, trans, payload={} ):
# -- Helper methods --
#
def _get_tool( self, id, tool_version=None, user=None ):
id = urllib.unquote_plus( id )
id = unquote_plus( id )
tool = self.app.toolbox.get_tool( id, tool_version )
if not tool or not tool.allow_user_access( user ):
raise exceptions.ObjectNotFound("Could not find tool with id '%s'" % id)
Expand Down