diff --git a/lib/galaxy/jobs/actions/post.py b/lib/galaxy/jobs/actions/post.py index 0aa9d22335b..2f7402f399c 100644 --- a/lib/galaxy/jobs/actions/post.py +++ b/lib/galaxy/jobs/actions/post.py @@ -374,8 +374,7 @@ class ActionBox(object): "EmailAction": EmailAction, "DeleteIntermediatesAction": DeleteIntermediatesAction, "TagDatasetAction": TagDatasetAction, - "RemoveTagDatasetAction": RemoveTagDatasetAction, - } + "RemoveTagDatasetAction": RemoveTagDatasetAction} public_actions = ['RenameDatasetAction', 'ChangeDatatypeAction', 'ColumnSetAction', 'EmailAction', 'DeleteIntermediatesAction', 'TagDatasetAction', diff --git a/lib/galaxy/jobs/error_level.py b/lib/galaxy/jobs/error_level.py index 9125103ad8f..e8bce87f06b 100644 --- a/lib/galaxy/jobs/error_level.py +++ b/lib/galaxy/jobs/error_level.py @@ -19,7 +19,6 @@ class StdioErrorLevel(object): @staticmethod def desc(error_level): err_msg = "Unknown error" - if (error_level > 0 and - error_level <= StdioErrorLevel.MAX): + if error_level > 0 and error_level <= StdioErrorLevel.MAX: err_msg = StdioErrorLevel.descs[error_level] return err_msg diff --git a/lib/galaxy/jobs/handler.py b/lib/galaxy/jobs/handler.py index 692f615b3bb..35dfb5d7b3e 100644 --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -400,7 +400,7 @@ class JobHandlerQueue(object): pass # No history, should not happen with an anon user # Check total walltime limits if (state == JOB_READY and - "delta" in self.app.job_config.limits.total_walltime): + "delta" in self.app.job_config.limits.total_walltime): jobs_to_check = self.sa_session.query(model.Job).filter( model.Job.user_id == job.user.id, model.Job.update_time >= datetime.datetime.now() - diff --git a/lib/galaxy/jobs/output_checker.py b/lib/galaxy/jobs/output_checker.py index 3e72323c7cb..14072957a65 100644 --- a/lib/galaxy/jobs/output_checker.py +++ b/lib/galaxy/jobs/output_checker.py @@ -3,6 +3,7 @@ from .error_level import StdioErrorLevel import traceback from logging import getLogger + log = getLogger(__name__) @@ -31,8 +32,7 @@ def check_output(tool, stdout, stderr, tool_exit_code, job): # then we assume that the tool writer overwrote the default # behavior of just setting an error if there is *anything* on # stderr. - if (len(tool.stdio_regexes) > 0 or - len(tool.stdio_exit_codes) > 0): + if len(tool.stdio_regexes) > 0 or len(tool.stdio_exit_codes) > 0: # Check the exit code ranges in the order in which # they were specified. Each exit_code is a StdioExitCode # that includes an applicable range. If the exit code was in @@ -42,23 +42,22 @@ def check_output(tool, stdout, stderr, tool_exit_code, job): if tool_exit_code is not None: for stdio_exit_code in tool.stdio_exit_codes: if (tool_exit_code >= stdio_exit_code.range_start and - tool_exit_code <= stdio_exit_code.range_end): + tool_exit_code <= stdio_exit_code.range_end): # Tack on a generic description of the code # plus a specific code description. For example, # this might prepend "Job 42: Warning (Out of Memory)\n". code_desc = stdio_exit_code.desc - if (None is code_desc): + if None is code_desc: code_desc = "" tool_msg = ("%s: Exit code %d (%s)" % ( - StdioErrorLevel.desc(stdio_exit_code.error_level), - tool_exit_code, - code_desc)) + StdioErrorLevel.desc(stdio_exit_code.error_level), + tool_exit_code, + code_desc)) log.info("Job %s: %s" % (job.get_id_tag(), tool_msg)) stderr = tool_msg + "\n" + stderr max_error_level = max(max_error_level, stdio_exit_code.error_level) - if (max_error_level >= - StdioErrorLevel.FATAL): + if max_error_level >= StdioErrorLevel.FATAL: break if max_error_level < StdioErrorLevel.FATAL: @@ -78,32 +77,30 @@ def check_output(tool, stdout, stderr, tool_exit_code, job): # o If it was fatal, then we're done - break. # Repeat the stdout stuff for stderr. # TODO: Collapse this into a single function. - if (regex.stdout_match): + if regex.stdout_match: regex_match = re.search(regex.match, stdout, re.IGNORECASE) - if (regex_match): + if regex_match: rexmsg = __regex_err_msg(regex_match, regex) log.info("Job %s: %s" % (job.get_id_tag(), rexmsg)) stdout = rexmsg + "\n" + stdout max_error_level = max(max_error_level, regex.error_level) - if (max_error_level >= - StdioErrorLevel.FATAL): + if max_error_level >= StdioErrorLevel.FATAL: break - if (regex.stderr_match): + if regex.stderr_match: regex_match = re.search(regex.match, stderr, re.IGNORECASE) - if (regex_match): + if regex_match: rexmsg = __regex_err_msg(regex_match, regex) log.info("Job %s: %s" % (job.get_id_tag(), rexmsg)) stderr = rexmsg + "\n" + stderr max_error_level = max(max_error_level, regex.error_level) - if (max_error_level >= - StdioErrorLevel.FATAL): + if max_error_level >= StdioErrorLevel.FATAL: break # If we encountered a fatal error, then we'll need to set the diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index d43c325a9d4..b4c5e1fa294 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -1475,14 +1475,13 @@ class History(HasTags, Dictifiable, UsesAnnotations, HasName): if not hasattr(self, '_active_datasets_and_roles'): db_session = object_session(self) query = (db_session.query(HistoryDatasetAssociation) - .filter(HistoryDatasetAssociation.table.c.history_id == self.id) - .filter(not_(HistoryDatasetAssociation.deleted)) - .order_by(HistoryDatasetAssociation.table.c.hid.asc()) - .options(joinedload("dataset"), - joinedload("dataset.actions"), - joinedload("dataset.actions.role"), - joinedload("tags"), - )) + .filter(HistoryDatasetAssociation.table.c.history_id == self.id) + .filter(not_(HistoryDatasetAssociation.deleted)) + .order_by(HistoryDatasetAssociation.table.c.hid.asc()) + .options(joinedload("dataset"), + joinedload("dataset.actions"), + joinedload("dataset.actions.role"), + joinedload("tags"))) self._active_datasets_and_roles = query.all() return self._active_datasets_and_roles diff --git a/lib/galaxy/model/tool_shed_install/mapping.py b/lib/galaxy/model/tool_shed_install/mapping.py index 0fa04d0f6f3..268103833b4 100644 --- a/lib/galaxy/model/tool_shed_install/mapping.py +++ b/lib/galaxy/model/tool_shed_install/mapping.py @@ -111,10 +111,10 @@ mapper(install_model.ToolDependency, install_model.ToolDependency.table) mapper(install_model.ToolVersion, install_model.ToolVersion.table, properties=dict( - parent_tool_association=relation(install_model.ToolVersionAssociation, - primaryjoin=(install_model.ToolVersion.table.c.id == install_model.ToolVersionAssociation.table.c.tool_id)), - child_tool_association=relation(install_model.ToolVersionAssociation, - primaryjoin=(install_model.ToolVersion.table.c.id == install_model.ToolVersionAssociation.table.c.parent_id)))) + parent_tool_association=relation(install_model.ToolVersionAssociation, + primaryjoin=(install_model.ToolVersion.table.c.id == install_model.ToolVersionAssociation.table.c.tool_id)), + child_tool_association=relation(install_model.ToolVersionAssociation, + primaryjoin=(install_model.ToolVersion.table.c.id == install_model.ToolVersionAssociation.table.c.parent_id)))) mapper(install_model.ToolVersionAssociation, install_model.ToolVersionAssociation.table) diff --git a/lib/galaxy/security/__init__.py b/lib/galaxy/security/__init__.py index 4c99e955c16..1bc0a143a85 100644 --- a/lib/galaxy/security/__init__.py +++ b/lib/galaxy/security/__init__.py @@ -626,10 +626,10 @@ class GalaxyRBACAgent(RBACAgent): library_access_action = self.permitted_actions.LIBRARY_ACCESS.action restricted_library_ids = [lp.library_id for lp in trans.sa_session.query(trans.model.LibraryPermissions) .filter(trans.model.LibraryPermissions.table.c.action == library_access_action).distinct()] - accessible_restricted_library_ids = [lp.library_id for lp in trans.sa_session.query( - trans.model.LibraryPermissions).filter( - and_(trans.model.LibraryPermissions.table.c.action == library_access_action, - trans.model.LibraryPermissions.table.c.role_id.in_(current_user_role_ids)))] + accessible_restricted_library_ids = [lp.library_id for lp in trans.sa_session.query(trans.model.LibraryPermissions) + .filter(and_( + trans.model.LibraryPermissions.table.c.action == library_access_action, + trans.model.LibraryPermissions.table.c.role_id.in_(current_user_role_ids)))] # Filter to get libraries accessible by the current user. Get both # public libraries and restricted libraries accessible by the current user. for library in trans.sa_session.query(trans.model.Library) \ @@ -946,14 +946,12 @@ class GalaxyRBACAgent(RBACAgent): accessible_request_types = [] current_user_role_ids = [role.id for role in user.all_roles()] request_type_access_action = self.permitted_actions.REQUEST_TYPE_ACCESS.action - restricted_request_type_ids = [rtp.request_type_id for rtp in trans.sa_session.query( - trans.model.RequestTypePermissions).filter( - trans.model.RequestTypePermissions.table.c.action == request_type_access_action).distinct() - ] - accessible_restricted_request_type_ids = [rtp.request_type_id for rtp in trans.sa_session.query( - trans.model.RequestTypePermissions).filter( - and_(trans.model.RequestTypePermissions.table.c.action == request_type_access_action, - trans.model.RequestTypePermissions.table.c.role_id.in_(current_user_role_ids)))] + restricted_request_type_ids = [rtp.request_type_id for rtp in trans.sa_session.query(trans.model.RequestTypePermissions) + .filter(trans.model.RequestTypePermissions.table.c.action == request_type_access_action).distinct()] + accessible_restricted_request_type_ids = [rtp.request_type_id for rtp in trans.sa_session.query(trans.model.RequestTypePermissions) + .filter(and_( + trans.model.RequestTypePermissions.table.c.action == request_type_access_action, + trans.model.RequestTypePermissions.table.c.role_id.in_(current_user_role_ids)))] # Filter to get libraries accessible by the current user. Get both # public libraries and restricted libraries accessible by the current user. for request_type in trans.sa_session.query(trans.model.RequestType) \ diff --git a/lib/galaxy/tools/imp_exp/__init__.py b/lib/galaxy/tools/imp_exp/__init__.py index 7d9559822d4..33e506727c7 100644 --- a/lib/galaxy/tools/imp_exp/__init__.py +++ b/lib/galaxy/tools/imp_exp/__init__.py @@ -217,8 +217,8 @@ class JobImportHistoryArchiveWrapper(object, UsesAnnotations): """ Hook to 'decode' an HDA; method uses history and HID to get the HDA represented by the encoded object. This only works because HDAs are created above. """ if obj_dct.get('__HistoryDatasetAssociation__', False): - return self.sa_session.query(model.HistoryDatasetAssociation - ).filter_by(history=new_history, hid=obj_dct['hid']).first() + return self.sa_session.query(model.HistoryDatasetAssociation) \ + .filter_by(history=new_history, hid=obj_dct['hid']).first() return obj_dct jobs_attrs = loads(jobs_attr_str, object_hook=as_hda) @@ -276,8 +276,8 @@ class JobImportHistoryArchiveWrapper(object, UsesAnnotations): # Connect jobs to output datasets. for output_hid in job_attrs['output_datasets']: # print "%s job has output dataset %i" % (imported_job.id, output_hid) - output_hda = self.sa_session.query(model.HistoryDatasetAssociation - ).filter_by(history=new_history, hid=output_hid).first() + output_hda = self.sa_session.query(model.HistoryDatasetAssociation) \ + .filter_by(history=new_history, hid=output_hid).first() if output_hda: imported_job.add_output_dataset(output_hda.name, output_hda) diff --git a/lib/galaxy/tools/parser/xml.py b/lib/galaxy/tools/parser/xml.py index 792dbc7cf09..ca313194651 100644 --- a/lib/galaxy/tools/parser/xml.py +++ b/lib/galaxy/tools/parser/xml.py @@ -716,7 +716,7 @@ class StdioParser(object): # the start must be -inf and the end must be +inf. # So at least warn about this situation: if (isinf(exit_code.range_start) and - isinf(exit_code.range_end)): + isinf(exit_code.range_end)): log.warning("Tool exit_code range %s will match on " + "all exit codes" % code_range) self.stdio_exit_codes.append(exit_code) diff --git a/lib/galaxy/visualization/data_providers/genome.py b/lib/galaxy/visualization/data_providers/genome.py index f1ab69a02b3..5690e431758 100644 --- a/lib/galaxy/visualization/data_providers/genome.py +++ b/lib/galaxy/visualization/data_providers/genome.py @@ -328,8 +328,7 @@ class FilterableMixin: 'type': 'number', 'index': filter_col, 'tool_id': 'Filter1', - 'tool_exp_name': 'c5' - }] + 'tool_exp_name': 'c5'}] return filters @@ -838,8 +837,7 @@ class BamDataProvider(GenomeDataProvider, FilterableMixin): filters = [] filters.append({'name': 'Mapping Quality', 'type': 'number', - 'index': filter_col} - ) + 'index': filter_col}) return filters def write_data_to_file(self, regions, filename): @@ -1028,8 +1026,7 @@ class BamDataProvider(GenomeDataProvider, FilterableMixin): qname, [pair['start'], pair['end'], pair['cigar'], pair['strand'], pair['seq']], [read.pos, read.pos + read_len, read.cigar, strand, seq], - None, [pair['mapq'], read.mapq] - ]) + None, [pair['mapq'], read.mapq]]) del paired_pending[qname] else: # Insert first of pair. @@ -1674,8 +1671,7 @@ def package_gff_feature(feature, no_detail=False, filter_cols=[]): # No notion of thick start, end in GFF, so make everything # thick. feature.start, - feature.end - ] + feature.end] # HACK: ignore interval with name 'transcript' from feature. # Cufflinks puts this interval in each of its transcripts, diff --git a/lib/galaxy/web/framework/helpers/grids.py b/lib/galaxy/web/framework/helpers/grids.py index a73032050b2..2d64ca900c7 100644 --- a/lib/galaxy/web/framework/helpers/grids.py +++ b/lib/galaxy/web/framework/helpers/grids.py @@ -654,8 +654,7 @@ class CommunityRatingColumn(GridColumn, UsesItemRatings): # Subquery to get average rating for each item. ave_rating_subquery = trans.sa_session.query(fk_col, func.avg(item_rating_assoc_class.table.c.rating).label('avg_rating')) \ - .group_by(fk_col) \ - .subquery() + .group_by(fk_col).subquery() # Integrate subquery into main query. query = query.outerjoin((ave_rating_subquery, referent_col == ave_rating_subquery.columns[fk_col.name])) # Sort using subquery results; use coalesce to avoid null values. diff --git a/lib/galaxy/webapps/galaxy/api/folder_contents.py b/lib/galaxy/webapps/galaxy/api/folder_contents.py index cea354c51f4..3ff8c2e0629 100644 --- a/lib/galaxy/webapps/galaxy/api/folder_contents.py +++ b/lib/galaxy/webapps/galaxy/api/folder_contents.py @@ -109,8 +109,7 @@ class FolderContentsController(BaseAPIController, UsesLibraryMixin, UsesLibraryM is_unrestricted=is_unrestricted, is_private=is_private, can_manage=can_manage, - file_size=nice_size - )) + file_size=nice_size)) if content_item.library_dataset_dataset_association.message: return_item.update(dict(message=content_item.library_dataset_dataset_association.message)) @@ -120,8 +119,7 @@ class FolderContentsController(BaseAPIController, UsesLibraryMixin, UsesLibraryM name=content_item.name, update_time=update_time, create_time=create_time, - deleted=content_item.deleted - )) + deleted=content_item.deleted)) folder_contents.append(return_item) # Return the reversed path so it starts with the library node. diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 8ce0cd624da..d009bb6a9f9 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -199,8 +199,7 @@ def populate_api_routes(webapp, app): name_prefix="history_", controller='history_contents', path_prefix='/api/histories/{history_id}/contents', - parent_resources=dict(member_name='history', collection_name='histories'), - ) + parent_resources=dict(member_name='history', collection_name='histories')) # Legacy access to HDA details via histories/{history_id}/contents/{hda_id} webapp.mapper.resource('content', 'contents', @@ -981,13 +980,13 @@ def wrap_in_middleware(app, global_conf, application_stack, **local_conf): from galaxy.web.framework.middleware.remoteuser import RemoteUser app = wrap_if_allowed(app, stack, RemoteUser, kwargs=dict( - maildomain=conf.get('remote_user_maildomain', None), - display_servers=util.listify(conf.get('display_servers', '')), - single_user=single_user, - admin_users=conf.get('admin_users', '').split(','), - remote_user_header=conf.get('remote_user_header', 'HTTP_REMOTE_USER'), - remote_user_secret_header=conf.get('remote_user_secret', None), - normalize_remote_user_email=conf.get('normalize_remote_user_email', False))) + maildomain=conf.get('remote_user_maildomain', None), + display_servers=util.listify(conf.get('display_servers', '')), + single_user=single_user, + admin_users=conf.get('admin_users', '').split(','), + remote_user_header=conf.get('remote_user_header', 'HTTP_REMOTE_USER'), + remote_user_secret_header=conf.get('remote_user_secret', None), + normalize_remote_user_email=conf.get('normalize_remote_user_email', False))) # The recursive middleware allows for including requests in other # requests or forwarding of requests, all on the server side. if asbool(conf.get('use_recursive', True)): diff --git a/lib/galaxy/webapps/galaxy/controllers/admin.py b/lib/galaxy/webapps/galaxy/controllers/admin.py index e8c88a92dfd..4c82a359d28 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -590,7 +590,8 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP for typ in trans.app.model.DefaultQuotaAssociation.types.__dict__.values(): default_options.append(('Yes, ' + typ, typ)) return {'title' : 'Create Quota', - 'inputs' : [{ + 'inputs' : [ + { 'name' : 'name', 'label' : 'Name' }, { @@ -610,8 +611,8 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP 'options' : default_options, 'help' : 'Warning: Any users or groups associated with this quota will be disassociated.' }, - build_select_input('in_groups', 'Groups', all_groups, []), - build_select_input('in_users', 'Users', all_users, [])]} + build_select_input('in_groups', 'Groups', all_groups, []), + build_select_input('in_users', 'Users', all_users, [])]} else: try: quota, message = self._create_quota(util.Params(payload), decode_id=trans.security.decode_id) @@ -1518,7 +1519,7 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP in_groups = [] all_groups = [] for role in trans.sa_session.query(trans.app.model.Role).filter(trans.app.model.Role.table.c.deleted == false()) \ - .order_by(trans.app.model.Role.table.c.name): + .order_by(trans.app.model.Role.table.c.name): if role in [x.role for x in user.roles]: in_roles.append(trans.security.encode_id(role.id)) if role.type != trans.app.model.Role.types.PRIVATE: @@ -1528,7 +1529,7 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP # precaution, since for a period of time we were including private roles in the form fields. all_roles.append((role.name, trans.security.encode_id(role.id))) for group in trans.sa_session.query(trans.app.model.Group).filter(trans.app.model.Group.table.c.deleted == false()) \ - .order_by(trans.app.model.Group.table.c.name): + .order_by(trans.app.model.Group.table.c.name): if group in [x.group for x in user.groups]: in_groups.append(trans.security.encode_id(group.id)) all_groups.append((group.name, trans.security.encode_id(group.id))) diff --git a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py index da480667da7..f660f3e9d29 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -199,8 +199,8 @@ class AdminToolshed(AdminGalaxy): } return trans.fill_template('galaxy.panels.mako', config={ - 'title': 'Galaxy Tool Sheds', - 'app': app}) + 'title': 'Galaxy Tool Sheds', + 'app': app}) @web.expose @web.require_admin diff --git a/lib/galaxy/webapps/galaxy/controllers/history.py b/lib/galaxy/webapps/galaxy/controllers/history.py index 0e4847f4bfb..e8f095e6343 100644 --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -49,8 +49,7 @@ class HistoryListGrid(grids.Grid): .filter(model.HistoryDatasetAssociation.history_id == history.id, model.HistoryDatasetAssociation.visible == true(), model.HistoryDatasetAssociation.deleted == false(), - model.Dataset.state.in_(states_to_show)) - ) + model.Dataset.state.in_(states_to_show))) # Create HTML. rval = '' diff --git a/lib/galaxy/webapps/galaxy/controllers/library.py b/lib/galaxy/webapps/galaxy/controllers/library.py index ca101512e54..7dbac8ca561 100644 --- a/lib/galaxy/webapps/galaxy/controllers/library.py +++ b/lib/galaxy/webapps/galaxy/controllers/library.py @@ -87,8 +87,8 @@ class Library(BaseUIController): } return trans.fill_template('galaxy.panels.mako', config={ - 'title': 'Data Libraries', - 'app': app}) + 'title': 'Data Libraries', + 'app': app}) @web.expose def index(self, trans, **kwd): diff --git a/lib/galaxy/webapps/galaxy/controllers/page.py b/lib/galaxy/webapps/galaxy/controllers/page.py index ba312c0180a..13de861ff59 100644 --- a/lib/galaxy/webapps/galaxy/controllers/page.py +++ b/lib/galaxy/webapps/galaxy/controllers/page.py @@ -41,10 +41,9 @@ class PageListGrid(grids.Grid): grids.GridColumn("Last Updated", key="update_time", format=time_ago), ] columns.append(grids.MulticolFilterColumn( - "Search", - cols_to_filter=[columns[0], columns[2]], - key="free-text-search", visible=False, filterable="standard") - ) + "Search", + cols_to_filter=[columns[0], columns[2]], + key="free-text-search", visible=False, filterable="standard")) global_actions = [ grids.GridAction("Add new page", dict(action='create'), target="inbound") ] diff --git a/lib/galaxy/webapps/galaxy/controllers/requests_common.py b/lib/galaxy/webapps/galaxy/controllers/requests_common.py index d04c378de0e..c7325e443cc 100644 --- a/lib/galaxy/webapps/galaxy/controllers/requests_common.py +++ b/lib/galaxy/webapps/galaxy/controllers/requests_common.py @@ -89,8 +89,7 @@ class RequestsGrid(grids.Grid): StateColumn("State", key='state', filterable="advanced", - link=(lambda item: iff(item.deleted, None, dict(operation="view_request_history", id=item.id))) - ) + link=(lambda item: iff(item.deleted, None, dict(operation="view_request_history", id=item.id)))) ] columns.append(grids.MulticolFilterColumn("Search", cols_to_filter=[columns[0], columns[1]], diff --git a/lib/galaxy/webapps/galaxy/controllers/user.py b/lib/galaxy/webapps/galaxy/controllers/user.py index 5be86c1b042..8076aa8b7e3 100644 --- a/lib/galaxy/webapps/galaxy/controllers/user.py +++ b/lib/galaxy/webapps/galaxy/controllers/user.py @@ -1046,8 +1046,7 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Create token=token, status=status, message=message, - display_top=kwd.get('redirect_home', False) - ) + display_top=kwd.get('redirect_home', False)) @web.expose @web.require_admin diff --git a/lib/galaxy/webapps/galaxy/controllers/workflow.py b/lib/galaxy/webapps/galaxy/controllers/workflow.py index d9cd75d1a65..65ccb426fdf 100644 --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -382,8 +382,8 @@ class WorkflowController(BaseUIController, SharableMixin, UsesStoredWorkflowMixi return form(url_for(controller='workflow', action='rename', id=trans.security.encode_id(stored.id)), "Rename workflow", submit_text="Rename", - use_panels=True - ).add_text("new_name", "Workflow Name", value=to_unicode(stored.name)) + use_panels=True) \ + .add_text("new_name", "Workflow Name", value=to_unicode(stored.name)) @web.expose @web.require_login("use Galaxy workflows") diff --git a/lib/galaxy/webapps/reports/controllers/jobs.py b/lib/galaxy/webapps/reports/controllers/jobs.py index 059a15416f0..73dba30fc1b 100644 --- a/lib/galaxy/webapps/reports/controllers/jobs.py +++ b/lib/galaxy/webapps/reports/controllers/jobs.py @@ -412,8 +412,7 @@ class Jobs(BaseUIController, ReportQueryBuilder): jobs.append((row_dayname, row_day, row.total_jobs, - row.date - )) + row.date)) pages_found = ceil(len(jobs) / float(entries)) page_specs = PageSpec(entries, offset, page, pages_found) @@ -515,8 +514,7 @@ class Jobs(BaseUIController, ReportQueryBuilder): jobs.append((row_dayname, row_day, row.total_jobs, - row.date - )) + row.date)) pages_found = ceil(len(jobs) / float(entries)) page_specs = PageSpec(entries, offset, page, pages_found) @@ -993,8 +991,7 @@ class Jobs(BaseUIController, ReportQueryBuilder): model.Job.table.c.tool_id.label('tool_id')), whereclause=sa.and_(model.Job.table.c.state == 'error', model.Job.table.c.user_id != monitor_user_id), - from_obj=[model.Job.table] - ) + from_obj=[model.Job.table]) currday = date.today() trends = dict() diff --git a/lib/galaxy/webapps/tool_shed/buildapp.py b/lib/galaxy/webapps/tool_shed/buildapp.py index 53f621af649..1dd9dcf8f95 100644 --- a/lib/galaxy/webapps/tool_shed/buildapp.py +++ b/lib/galaxy/webapps/tool_shed/buildapp.py @@ -234,12 +234,12 @@ def wrap_in_middleware(app, global_conf, application_stack, **local_conf): from galaxy.webapps.tool_shed.framework.middleware.remoteuser import RemoteUser app = wrap_if_allowed(app, stack, RemoteUser, kwargs=dict( - maildomain=conf.get('remote_user_maildomain', None), - display_servers=util.listify(conf.get('display_servers', '')), - admin_users=conf.get('admin_users', '').split(','), - remote_user_header=conf.get('remote_user_header', 'HTTP_REMOTE_USER'), - remote_user_secret_header=conf.get('remote_user_secret', None), - normalize_remote_user_email=conf.get('normalize_remote_user_email', False))) + maildomain=conf.get('remote_user_maildomain', None), + display_servers=util.listify(conf.get('display_servers', '')), + admin_users=conf.get('admin_users', '').split(','), + remote_user_header=conf.get('remote_user_header', 'HTTP_REMOTE_USER'), + remote_user_secret_header=conf.get('remote_user_secret', None), + normalize_remote_user_email=conf.get('normalize_remote_user_email', False))) # The recursive middleware allows for including requests in other # requests or forwarding of requests, all on the server side. if asbool(conf.get('use_recursive', True)): diff --git a/lib/galaxy/webapps/tool_shed/controllers/groups.py b/lib/galaxy/webapps/tool_shed/controllers/groups.py index a3f6c2ac5a4..78f9572c863 100644 --- a/lib/galaxy/webapps/tool_shed/controllers/groups.py +++ b/lib/galaxy/webapps/tool_shed/controllers/groups.py @@ -16,5 +16,5 @@ class Group(BaseUIController): } return trans.fill_template('/webapps/tool_shed/group/index.mako', config={ - 'title': 'Tool Shed Groups', - 'app': app}) + 'title': 'Tool Shed Groups', + 'app': app}) diff --git a/lib/galaxy/webapps/tool_shed/controllers/user.py b/lib/galaxy/webapps/tool_shed/controllers/user.py index 2c6eb322ee6..1f8bff9cd95 100644 --- a/lib/galaxy/webapps/tool_shed/controllers/user.py +++ b/lib/galaxy/webapps/tool_shed/controllers/user.py @@ -246,5 +246,4 @@ class User(BaseUser): token=token, status=status, message=message, - display_top=kwd.get('redirect_home', False) - ) + display_top=kwd.get('redirect_home', False)) diff --git a/lib/galaxy/webapps/tool_shed/model/mapping.py b/lib/galaxy/webapps/tool_shed/model/mapping.py index e18b55bf08d..5728da9d3ce 100644 --- a/lib/galaxy/webapps/tool_shed/model/mapping.py +++ b/lib/galaxy/webapps/tool_shed/model/mapping.py @@ -213,17 +213,17 @@ mapper(Group, Group.table, mapper(Role, Role.table, properties=dict( - repositories=relation(RepositoryRoleAssociation, - primaryjoin=((Role.table.c.id == RepositoryRoleAssociation.table.c.role_id) & (RepositoryRoleAssociation.table.c.repository_id == Repository.table.c.id))), - users=relation(UserRoleAssociation, - primaryjoin=((Role.table.c.id == UserRoleAssociation.table.c.role_id) & (UserRoleAssociation.table.c.user_id == User.table.c.id))), - groups=relation(GroupRoleAssociation, - primaryjoin=((Role.table.c.id == GroupRoleAssociation.table.c.role_id) & (GroupRoleAssociation.table.c.group_id == Group.table.c.id))))) + repositories=relation(RepositoryRoleAssociation, + primaryjoin=((Role.table.c.id == RepositoryRoleAssociation.table.c.role_id) & (RepositoryRoleAssociation.table.c.repository_id == Repository.table.c.id))), + users=relation(UserRoleAssociation, + primaryjoin=((Role.table.c.id == UserRoleAssociation.table.c.role_id) & (UserRoleAssociation.table.c.user_id == User.table.c.id))), + groups=relation(GroupRoleAssociation, + primaryjoin=((Role.table.c.id == GroupRoleAssociation.table.c.role_id) & (GroupRoleAssociation.table.c.group_id == Group.table.c.id))))) mapper(RepositoryRoleAssociation, RepositoryRoleAssociation.table, properties=dict( - repository=relation(Repository), - role=relation(Role))) + repository=relation(Repository), + role=relation(Role))) mapper(UserGroupAssociation, UserGroupAssociation.table, properties=dict(user=relation(User, backref="groups"), @@ -231,16 +231,16 @@ mapper(UserGroupAssociation, UserGroupAssociation.table, mapper(UserRoleAssociation, UserRoleAssociation.table, properties=dict( - user=relation(User, backref="roles"), - non_private_roles=relation(User, - backref="non_private_roles", - primaryjoin=((User.table.c.id == UserRoleAssociation.table.c.user_id) & (UserRoleAssociation.table.c.role_id == Role.table.c.id) & not_(Role.table.c.name == User.table.c.email))), - role=relation(Role))) + user=relation(User, backref="roles"), + non_private_roles=relation(User, + backref="non_private_roles", + primaryjoin=((User.table.c.id == UserRoleAssociation.table.c.user_id) & (UserRoleAssociation.table.c.role_id == Role.table.c.id) & not_(Role.table.c.name == User.table.c.email))), + role=relation(Role))) mapper(GroupRoleAssociation, GroupRoleAssociation.table, properties=dict( - group=relation(Group, backref="roles"), - role=relation(Role))) + group=relation(Group, backref="roles"), + role=relation(Role))) mapper(GalaxySession, GalaxySession.table, properties=dict(user=relation(User))) @@ -256,21 +256,21 @@ mapper(Category, Category.table, mapper(Repository, Repository.table, properties=dict( - categories=relation(RepositoryCategoryAssociation), - ratings=relation(RepositoryRatingAssociation, order_by=desc(RepositoryRatingAssociation.table.c.update_time), backref="repositories"), - user=relation(User), - downloadable_revisions=relation(RepositoryMetadata, - primaryjoin=((Repository.table.c.id == RepositoryMetadata.table.c.repository_id) & (RepositoryMetadata.table.c.downloadable == true())), - order_by=desc(RepositoryMetadata.table.c.update_time)), - metadata_revisions=relation(RepositoryMetadata, - order_by=desc(RepositoryMetadata.table.c.update_time)), - roles=relation(RepositoryRoleAssociation), - reviews=relation(RepositoryReview, - primaryjoin=((Repository.table.c.id == RepositoryReview.table.c.repository_id))), - reviewers=relation(User, - secondary=RepositoryReview.table, - primaryjoin=(Repository.table.c.id == RepositoryReview.table.c.repository_id), - secondaryjoin=(RepositoryReview.table.c.user_id == User.table.c.id)))) + categories=relation(RepositoryCategoryAssociation), + ratings=relation(RepositoryRatingAssociation, order_by=desc(RepositoryRatingAssociation.table.c.update_time), backref="repositories"), + user=relation(User), + downloadable_revisions=relation(RepositoryMetadata, + primaryjoin=((Repository.table.c.id == RepositoryMetadata.table.c.repository_id) & (RepositoryMetadata.table.c.downloadable == true())), + order_by=desc(RepositoryMetadata.table.c.update_time)), + metadata_revisions=relation(RepositoryMetadata, + order_by=desc(RepositoryMetadata.table.c.update_time)), + roles=relation(RepositoryRoleAssociation), + reviews=relation(RepositoryReview, + primaryjoin=((Repository.table.c.id == RepositoryReview.table.c.repository_id))), + reviewers=relation(User, + secondary=RepositoryReview.table, + primaryjoin=(Repository.table.c.id == RepositoryReview.table.c.repository_id), + secondaryjoin=(RepositoryReview.table.c.user_id == User.table.c.id)))) mapper(RepositoryMetadata, RepositoryMetadata.table, properties=dict(repository=relation(Repository), @@ -306,8 +306,8 @@ mapper(RepositoryRatingAssociation, RepositoryRatingAssociation.table, mapper(RepositoryCategoryAssociation, RepositoryCategoryAssociation.table, properties=dict( - category=relation(Category), - repository=relation(Repository))) + category=relation(Category), + repository=relation(Repository))) def init(file_path, url, engine_options={}, create_tables=False): diff --git a/lib/galaxy/webapps/tool_shed/search/tool_search.py b/lib/galaxy/webapps/tool_shed/search/tool_search.py index a486f986f06..9aba6761231 100644 --- a/lib/galaxy/webapps/tool_shed/search/tool_search.py +++ b/lib/galaxy/webapps/tool_shed/search/tool_search.py @@ -42,10 +42,10 @@ class ToolSearch(object): # http://en.wikipedia.org/wiki/Okapi_BM25 # __Basically__ the higher number the bigger weight. tool_weighting = scoring.BM25F(field_B={ - 'name_B' : boosts.tool_name_boost, - 'description_B' : boosts.tool_description_boost, - 'help_B' : boosts.tool_help_boost, - 'repo_owner_username_B' : boosts.tool_repo_owner_username_boost}) + 'name_B' : boosts.tool_name_boost, + 'description_B' : boosts.tool_description_boost, + 'help_B' : boosts.tool_help_boost, + 'repo_owner_username_B' : boosts.tool_repo_owner_username_boost}) searcher = index.searcher(weighting=tool_weighting) parser = MultifieldParser([ diff --git a/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py b/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py index 6d4ee907790..b5342176723 100644 --- a/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py +++ b/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py @@ -167,8 +167,8 @@ class InstalledRepositoryGrid(grids.Grid): not item.deleted and item.revision_update_available and item.status not in [ - tool_shed_install.ToolShedRepository.installation_status.ERROR, - tool_shed_install.ToolShedRepository.installation_status.NEW]), + tool_shed_install.ToolShedRepository.installation_status.ERROR, + tool_shed_install.ToolShedRepository.installation_status.NEW]), allow_multiple=False, url_args=dict(controller='admin_toolshed', action='browse_repositories', diff --git a/lib/tool_shed/util/admin_util.py b/lib/tool_shed/util/admin_util.py index bbc0d8780e1..93c976f7435 100644 --- a/lib/tool_shed/util/admin_util.py +++ b/lib/tool_shed/util/admin_util.py @@ -916,7 +916,7 @@ class Admin(object): in_groups = [] out_groups = [] for role in trans.sa_session.query(trans.app.model.Role).filter(trans.app.model.Role.table.c.deleted == false()) \ - .order_by(trans.app.model.Role.table.c.name): + .order_by(trans.app.model.Role.table.c.name): if role in [x.role for x in user.roles]: in_roles.append((role.id, role.name)) elif role.type != trans.app.model.Role.types.PRIVATE: @@ -926,7 +926,7 @@ class Admin(object): # precaution, since for a period of time we were including private roles in the form fields. out_roles.append((role.id, role.name)) for group in trans.sa_session.query(trans.app.model.Group).filter(trans.app.model.Group.table.c.deleted == false()) \ - .order_by(trans.app.model.Group.table.c.name): + .order_by(trans.app.model.Group.table.c.name): if group in [x.group for x in user.groups]: in_groups.append((group.id, group.name)) else: diff --git a/lib/tool_shed/utility_containers/__init__.py b/lib/tool_shed/utility_containers/__init__.py index 4d4c12bd8b7..9a6a19a6114 100644 --- a/lib/tool_shed/utility_containers/__init__.py +++ b/lib/tool_shed/utility_containers/__init__.py @@ -239,8 +239,7 @@ class ToolShedUtilityContainerManager(utility_container_manager.UtilityContainer tool_dependencies=None, valid_tools=None, workflows=None, - valid_data_managers=None - ) + valid_data_managers=None) if repository_metadata: metadata = repository_metadata.metadata lock = threading.Lock() diff --git a/lib/tool_shed/utility_containers/utility_container_manager.py b/lib/tool_shed/utility_containers/utility_container_manager.py index 7a26f9f0eed..6d0e098c224 100644 --- a/lib/tool_shed/utility_containers/utility_container_manager.py +++ b/lib/tool_shed/utility_containers/utility_container_manager.py @@ -819,10 +819,10 @@ class UtilityContainerManager(object): key_prior_installation_required = components_list[4] key_only_if_compiling_contained_td = components_list[5] if (repository_name == key_name and - repository_owner == key_owner and - changeset_revision == key_changeset_revision and - prior_installation_required == key_prior_installation_required and - only_if_compiling_contained_td == key_only_if_compiling_contained_td): + repository_owner == key_owner and + changeset_revision == key_changeset_revision and + prior_installation_required == key_prior_installation_required and + only_if_compiling_contained_td == key_only_if_compiling_contained_td): return True return False diff --git a/scripts/microbes/BeautifulSoup.py b/scripts/microbes/BeautifulSoup.py index 6e8a8efd22c..cd104595187 100644 --- a/scripts/microbes/BeautifulSoup.py +++ b/scripts/microbes/BeautifulSoup.py @@ -407,8 +407,7 @@ class Tag(PageElement): "quot": '"', "amp": "&", "lt": "<", - "gt": ">" - } + "gt": ">"} # An RE for finding ampersands that aren't the start of of a # numeric entity. BARE_AMPERSAND = re.compile("&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)") diff --git a/scripts/tool_shed/deprecate_repositories_without_metadata.py b/scripts/tool_shed/deprecate_repositories_without_metadata.py index f9f800e465b..95357ceafbe 100644 --- a/scripts/tool_shed/deprecate_repositories_without_metadata.py +++ b/scripts/tool_shed/deprecate_repositories_without_metadata.py @@ -106,7 +106,7 @@ def deprecate_repositories(app, cutoff_time, days=14, info_only=False, verbose=F # empty, and will not be checked. metadata_records = sa.select([distinct(app.model.RepositoryMetadata.table.c.repository_id)], from_obj=app.model.RepositoryMetadata.table) \ - .execute() + .execute() for metadata_record in metadata_records: repository_ids_to_not_check.append(metadata_record.repository_id) # Get the repositories that are A) not present in the above list, and b) older than the specified time.