Address W503 and E721 errors now enforced by pep8 1.7.

This commit is contained in:
Dannon Baker
2016-01-13 10:41:27 -05:00
parent b559cf303c
commit 2f1dbeee68
9 changed files with 28 additions and 27 deletions
+4 -4
View File
@@ -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
+3 -3
View File
@@ -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] ) ) )
@@ -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),
@@ -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' ]
@@ -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:
+3 -3
View File
@@ -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))
+2 -2
View File
@@ -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)
@@ -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,
+10 -8
View File
@@ -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 ):