diff --git a/lib/galaxy/jobs/__init__.py b/lib/galaxy/jobs/__init__.py index ec61f01a5ee..ff8c68338a7 100644 --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -1195,8 +1195,8 @@ class JobWrapper( object ): # either use the metadata from originating output dataset, or call set_meta on the copies # it would be quicker to just copy the metadata from the originating output dataset, # but somewhat trickier (need to recurse up the copied_from tree), for now we'll call set_meta() - if ( self.app.config.retry_metadata_internally - and not self.external_output_metadata.external_metadata_set_successfully(dataset, self.sa_session ) ): + if ( self.app.config.retry_metadata_internally and + not self.external_output_metadata.external_metadata_set_successfully(dataset, self.sa_session ) ): # If Galaxy was expected to sniff type and didn't - do so. if dataset.ext == "_sniff_": extension = sniff.handle_uploaded_dataset_file( dataset.dataset.file_name, self.app.datatypes_registry ) @@ -1204,8 +1204,8 @@ class JobWrapper( object ): # call datatype.set_meta directly for the initial set_meta call during dataset creation dataset.datatype.set_meta( dataset, overwrite=False ) - elif ( job.states.ERROR != final_job_state - and not self.external_output_metadata.external_metadata_set_successfully( dataset, self.sa_session ) ): + elif ( job.states.ERROR != final_job_state and + not self.external_output_metadata.external_metadata_set_successfully( dataset, self.sa_session ) ): dataset._state = model.Dataset.states.FAILED_METADATA else: # load metadata from file diff --git a/lib/galaxy/managers/rbac_secured.py b/lib/galaxy/managers/rbac_secured.py index 2d89d6d5e53..2a053b57545 100644 --- a/lib/galaxy/managers/rbac_secured.py +++ b/lib/galaxy/managers/rbac_secured.py @@ -259,6 +259,6 @@ class AccessDatasetRBACPermission( DatasetRBACPermission ): def _role_is_permitted( self, dataset, role ): current_roles = self._roles( dataset ) - return ( self._is_public_from_roles( current_roles ) - # if there's only one role and this is it, let em in - or ( ( len( current_roles ) == 1 ) and ( role == current_roles[0] ) ) ) + return ( self._is_public_from_roles( current_roles ) or + # if there's only one role and this is it, let em in + ( ( len( current_roles ) == 1 ) and ( role == current_roles[0] ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0052_sample_dataset_table.py b/lib/galaxy/model/migrate/versions/0052_sample_dataset_table.py index 098ac204bb8..96eda329fd6 100644 --- a/lib/galaxy/model/migrate/versions/0052_sample_dataset_table.py +++ b/lib/galaxy/model/migrate/versions/0052_sample_dataset_table.py @@ -61,7 +61,7 @@ def upgrade(migrate_engine): if r[1]: dataset_files = loads(r[1]) for df in dataset_files: - if type(df) == type(dict()): + if isinstance(df, dict): cmd = "INSERT INTO sample_dataset VALUES (%s, %s, %s, %s, '%s', '%s', '%s', '%s', '%s')" cmd = cmd % ( nextval(migrate_engine, 'sample_dataset'), localtimestamp(migrate_engine), diff --git a/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py b/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py index 78de6e579d2..ca1dbdd24cf 100644 --- a/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py +++ b/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py @@ -77,7 +77,7 @@ def upgrade(migrate_engine): if not str( row[2] ).strip(): continue fields_list = loads( str( row[2] ).strip() ) - if fields_list and type(values_list) == type(list()): + if fields_list and isinstance(values_list, list): values_dict = {} for field_index, field in enumerate( fields_list ): field_name = field[ 'name' ] diff --git a/lib/galaxy/model/migrate/versions/0067_populate_sequencer_table.py b/lib/galaxy/model/migrate/versions/0067_populate_sequencer_table.py index 5083dc80e81..a34759267e9 100644 --- a/lib/galaxy/model/migrate/versions/0067_populate_sequencer_table.py +++ b/lib/galaxy/model/migrate/versions/0067_populate_sequencer_table.py @@ -136,7 +136,7 @@ def get_sequencer_id( migrate_engine, sequencer_info ): continue values = loads( values ) # proceed only if sequencer_info is a valid list - if values and type( values ) == type( dict() ): + if values and isinstance(values, dict): if sequencer_info.get( 'host', '' ) == values.get( 'field_0', '' ) \ and sequencer_info.get( 'username', '' ) == values.get( 'field_1', '' ) \ and sequencer_info.get( 'password', '' ) == values.get( 'field_2', '' ) \ @@ -236,7 +236,7 @@ def upgrade(migrate_engine): continue sequencer_info = loads( sequencer_info.strip() ) # proceed only if sequencer_info is a valid dict - if sequencer_info and type( sequencer_info ) == type( dict() ): + if sequencer_info and isinstance(sequencer_info, dict): # check if this sequencer has already been added to the sequencer table sequencer_id = get_sequencer_id( migrate_engine, sequencer_info ) if not sequencer_id: diff --git a/lib/galaxy/util/pastescript/loadwsgi.py b/lib/galaxy/util/pastescript/loadwsgi.py index f4ba62ce53f..49a42dfcf9e 100644 --- a/lib/galaxy/util/pastescript/loadwsgi.py +++ b/lib/galaxy/util/pastescript/loadwsgi.py @@ -63,9 +63,9 @@ def fix_type_error(exc_info, callable, varargs, kwargs): """ if exc_info is None: exc_info = sys.exc_info() - if (exc_info[0] != TypeError - or str(exc_info[1]).find('arguments') == -1 - or getattr(exc_info[1], '_type_error_fixed', False)): + if (exc_info[0] != TypeError or + str(exc_info[1]).find('arguments') == -1 or + getattr(exc_info[1], '_type_error_fixed', False)): return exc_info exc_info[1]._type_error_fixed = True argspec = inspect.formatargspec(*inspect.getargspec(callable)) diff --git a/lib/pulsar/client/amqp_exchange.py b/lib/pulsar/client/amqp_exchange.py index 2ede16d8ddb..03ad85ffa95 100644 --- a/lib/pulsar/client/amqp_exchange.py +++ b/lib/pulsar/client/amqp_exchange.py @@ -186,8 +186,8 @@ class PulsarExchange(object): key = self.__queue_name(name) publish_log_prefix = self.__publish_log_prefex(transaction_uuid) log.debug("%sBegin publishing to key %s", publish_log_prefix, key) - if (self.acks_enabled and not name.endswith(ACK_QUEUE_SUFFIX) - and ACK_FORCE_NOACK_KEY not in payload): + if (self.acks_enabled and not name.endswith(ACK_QUEUE_SUFFIX) and + ACK_FORCE_NOACK_KEY not in payload): # Publishing a message on a normal queue and it's not a republish # (or explicitly forced do-not-ack), so add ack keys ack_uuid = str(transaction_uuid) diff --git a/scripts/cleanup_datasets/admin_cleanup_datasets.py b/scripts/cleanup_datasets/admin_cleanup_datasets.py index 0d9f3b8da49..983bfe0d9cc 100755 --- a/scripts/cleanup_datasets/admin_cleanup_datasets.py +++ b/scripts/cleanup_datasets/admin_cleanup_datasets.py @@ -97,7 +97,7 @@ def main(): help="From address to use to send email. " "Default: [read from galaxy ini file]") (options, args) = parser.parse_args() - if len(args) != 1 : + if len(args) != 1: parser.print_help() sys.exit() ini_file = args[0] @@ -177,8 +177,7 @@ def administrative_delete_datasets(app, cutoff_time, cutoff_days, app.model.HistoryDatasetAssociation.table.c.deleted), whereclause=and_( app.model.Dataset.table.c.deleted == false(), - app.model.HistoryDatasetAssociation.table.c.update_time - < cutoff_time, + app.model.HistoryDatasetAssociation.table.c.update_time < cutoff_time, app.model.HistoryDatasetAssociation.table.c.deleted == false()), from_obj=[sa.outerjoin( app.model.Dataset.table, diff --git a/test/casperjs/casperjs_runner.py b/test/casperjs/casperjs_runner.py index cc2ed977194..dee21fb29ec 100644 --- a/test/casperjs/casperjs_runner.py +++ b/test/casperjs/casperjs_runner.py @@ -112,8 +112,10 @@ class CasperJSTestCase( unittest.TestCase ): process_command_list = self.build_command_line( rel_script_path, *args, **kwargs ) log.debug( 'process_command_list: %s', str( process_command_list ) ) try: - process = subprocess.Popen( process_command_list, shell=False, - stdout=subprocess.PIPE, stderr=subprocess.PIPE ) + process = subprocess.Popen( process_command_list, + shell=False, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE ) # output from the browser (stderr only) immediately while process.poll() is None: @@ -145,9 +147,9 @@ class CasperJSTestCase( unittest.TestCase ): # provide information (as it won't be included by default with galaxy) except OSError, os_err: if os_err.errno == errno.ENOENT: - log.error( 'No path to headless browser executable: %s\n' - + 'These tests were designed to use the following headless browser:\n%s', - self.exec_path, self.casper_info ) + log.error( 'No path to headless browser executable: %s\n' + + 'These tests were designed to use the following headless browser:\n%s', + self.exec_path, self.casper_info ) raise return self.handle_js_results( stdout_output ) @@ -206,7 +208,7 @@ class CasperJSTestCase( unittest.TestCase ): js_test_results = json.loads( stdout_output ) last_error = get_error( js_test_results ) err_string = ( "%s\n%s" % ( get_msg( last_error ), - self.browser_backtrace_to_string( get_trace( last_error ) ) ) ) + self.browser_backtrace_to_string( get_trace( last_error ) ) ) ) # if we couldn't parse json from what's returned on the error, dump stdout except ValueError, val_err: @@ -250,8 +252,8 @@ class CasperJSTestCase( unittest.TestCase ): js_test_results = json.loads( results ) failures = js_test_results[ 'failures' ] assert len( failures ) == 0, ( - "%d assertions failed in the headless browser tests" % ( len( failures ) ) - + " (see the log for details)" ) + "%d assertions failed in the headless browser tests" % ( len( failures ) ) + + " (see the log for details)" ) # ---------------------------------------------------------------- TestCase overrides def setUp( self ):