mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 05:31:04 +08:00
Fix all E722 errors and ignore E741
Introduced in flake8 3.5.0 Fix import order.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
client/galaxy/style/source_material/circle.py
|
||||
config/
|
||||
contrib/
|
||||
cron/
|
||||
doc/parse_gx_xsd.py
|
||||
@@ -21,22 +22,13 @@ lib/galaxy/jobs/command_factory.py
|
||||
lib/galaxy/jobs/datasets.py
|
||||
lib/galaxy/jobs/deferred/
|
||||
lib/galaxy/jobs/error_level.py
|
||||
lib/galaxy/jobs/handler.py
|
||||
lib/galaxy/jobs/__init__.py
|
||||
lib/galaxy/jobs/manager.py
|
||||
lib/galaxy/jobs/metrics/
|
||||
lib/galaxy/jobs/output_checker.py
|
||||
lib/galaxy/jobs/rules/
|
||||
lib/galaxy/jobs/runners/cli.py
|
||||
lib/galaxy/jobs/runners/condor.py
|
||||
lib/galaxy/jobs/runners/drmaa.py
|
||||
lib/galaxy/jobs/runners/godocker.py
|
||||
lib/galaxy/jobs/runners/kubernetes.py
|
||||
lib/galaxy/jobs/runners/local.py
|
||||
lib/galaxy/jobs/runners/pbs.py
|
||||
lib/galaxy/jobs/runners/pulsar.py
|
||||
lib/galaxy/jobs/runners/slurm.py
|
||||
lib/galaxy/jobs/runners/state_handlers/
|
||||
lib/galaxy/jobs/runners/tasks.py
|
||||
lib/galaxy/jobs/runners/util/
|
||||
lib/galaxy/jobs/runners/
|
||||
lib/galaxy/jobs/splitters/basic.py
|
||||
lib/galaxy/jobs/splitters/__init__.py
|
||||
lib/galaxy/jobs/stock_rules.py
|
||||
@@ -61,9 +53,7 @@ lib/galaxy/objectstore/s3_multipart_upload.py
|
||||
lib/galaxy/objectstore/s3.py
|
||||
lib/galaxy/openid/__init__.py
|
||||
lib/galaxy/quota/
|
||||
lib/galaxy/sample_tracking/data_transfer.py
|
||||
lib/galaxy/sample_tracking/__init__.py
|
||||
lib/galaxy/sample_tracking/sample.py
|
||||
lib/galaxy/sample_tracking/
|
||||
lib/galaxy/security/
|
||||
lib/galaxy/tags/
|
||||
lib/galaxy/tools/
|
||||
@@ -71,6 +61,7 @@ lib/galaxy/util/
|
||||
lib/galaxy/version.py
|
||||
lib/galaxy/visualization/data_providers/basic.py
|
||||
lib/galaxy/visualization/data_providers/cigar.py
|
||||
lib/galaxy/visualization/data_providers/genome.py
|
||||
lib/galaxy/visualization/data_providers/__init__.py
|
||||
lib/galaxy/visualization/data_providers/phyloviz/baseparser.py
|
||||
lib/galaxy/visualization/genome/
|
||||
@@ -99,14 +90,23 @@ lib/galaxy/web/framework/middleware/xforwardedhost.py
|
||||
lib/galaxy/web/framework/webapp.py
|
||||
lib/galaxy/web/__init__.py
|
||||
lib/galaxy/web/params.py
|
||||
lib/galaxy/web/stack/
|
||||
lib/galaxy/webapps/galaxy/api/authenticate.py
|
||||
lib/galaxy/webapps/galaxy/api/forms.py
|
||||
lib/galaxy/webapps/galaxy/api/genomes.py
|
||||
lib/galaxy/webapps/galaxy/api/group_roles.py
|
||||
lib/galaxy/webapps/galaxy/api/group_users.py
|
||||
lib/galaxy/webapps/galaxy/api/groups.py
|
||||
lib/galaxy/webapps/galaxy/api/histories.py
|
||||
lib/galaxy/webapps/galaxy/api/__init__.py
|
||||
lib/galaxy/webapps/galaxy/api/jobs.py
|
||||
lib/galaxy/webapps/galaxy/api/library_contents.py
|
||||
lib/galaxy/webapps/galaxy/api/library_datasets.py
|
||||
lib/galaxy/webapps/galaxy/api/requests.py
|
||||
lib/galaxy/webapps/galaxy/api/request_types.py
|
||||
lib/galaxy/webapps/galaxy/api/roles.py
|
||||
lib/galaxy/webapps/galaxy/api/samples.py
|
||||
lib/galaxy/webapps/galaxy/api/tool_data.py
|
||||
lib/galaxy/webapps/galaxy/api/tools.py
|
||||
lib/galaxy/webapps/galaxy/api/tours.py
|
||||
lib/galaxy/webapps/galaxy/api/users.py
|
||||
@@ -116,6 +116,7 @@ lib/galaxy/webapps/galaxy/config_watchers.py
|
||||
lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
|
||||
lib/galaxy/webapps/galaxy/controllers/async.py
|
||||
lib/galaxy/webapps/galaxy/controllers/data_manager.py
|
||||
lib/galaxy/webapps/galaxy/controllers/dataset.py
|
||||
lib/galaxy/webapps/galaxy/controllers/error.py
|
||||
lib/galaxy/webapps/galaxy/controllers/external_services.py
|
||||
lib/galaxy/webapps/galaxy/controllers/forms.py
|
||||
@@ -124,21 +125,29 @@ lib/galaxy/webapps/galaxy/controllers/__init__.py
|
||||
lib/galaxy/webapps/galaxy/controllers/library_common.py
|
||||
lib/galaxy/webapps/galaxy/controllers/mobile.py
|
||||
lib/galaxy/webapps/galaxy/controllers/page.py
|
||||
lib/galaxy/webapps/galaxy/controllers/requests_admin.py
|
||||
lib/galaxy/webapps/galaxy/controllers/requests_common.py
|
||||
lib/galaxy/webapps/galaxy/controllers/requests.py
|
||||
lib/galaxy/webapps/galaxy/controllers/request_type.py
|
||||
lib/galaxy/webapps/galaxy/controllers/root.py
|
||||
lib/galaxy/webapps/galaxy/controllers/search.py
|
||||
lib/galaxy/webapps/galaxy/controllers/tool_runner.py
|
||||
lib/galaxy/webapps/galaxy/controllers/userskeys.py
|
||||
lib/galaxy/webapps/galaxy/__init__.py
|
||||
lib/galaxy/webapps/__init__.py
|
||||
lib/galaxy/webapps/reports/buildapp.py
|
||||
lib/galaxy/webapps/reports/config.py
|
||||
lib/galaxy/webapps/reports/controllers/__init__.py
|
||||
lib/galaxy/webapps/reports/controllers/query.py
|
||||
lib/galaxy/webapps/reports/controllers/system.py
|
||||
lib/galaxy/webapps/reports/controllers/tools.py
|
||||
lib/galaxy/webapps/reports/__init__.py
|
||||
lib/galaxy/webapps/tool_shed/api/__init__.py
|
||||
lib/galaxy/webapps/tool_shed/buildapp.py
|
||||
lib/galaxy/webapps/tool_shed/config.py
|
||||
lib/galaxy/webapps/tool_shed/controllers/groups.py
|
||||
lib/galaxy/webapps/tool_shed/controllers/__init__.py
|
||||
lib/galaxy/webapps/tool_shed/controllers/repository.py
|
||||
lib/galaxy/webapps/tool_shed/controllers/user.py
|
||||
lib/galaxy/webapps/tool_shed/framework/__init__.py
|
||||
lib/galaxy/webapps/tool_shed/framework/middleware/__init__.py
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
import logging
|
||||
import os
|
||||
from cgi import FieldStorage
|
||||
|
||||
from galaxy.util import Params
|
||||
|
||||
@@ -19,7 +19,7 @@ def add_manual_builds(input_file, build_file, chr_dir):
|
||||
if line.startswith("#"):
|
||||
continue
|
||||
existing_builds.append(line.replace("\n", "").replace("\r", "").split("\t")[0])
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
build_file_out = open(build_file, 'a')
|
||||
for line in open(input_file):
|
||||
@@ -31,7 +31,7 @@ def add_manual_builds(input_file, build_file, chr_dir):
|
||||
name = fields.pop(0)
|
||||
try: # get chrom lens if included in file, otherwise still add build
|
||||
chrs = fields.pop(0).split(",")
|
||||
except:
|
||||
except Exception:
|
||||
chrs = []
|
||||
print>>build_file_out, build + "\t" + name + " (" + build + ")"
|
||||
if chrs: # create len file if provided chrom lens
|
||||
@@ -39,7 +39,7 @@ def add_manual_builds(input_file, build_file, chr_dir):
|
||||
for chr in chrs:
|
||||
print>>chr_len_out, chr.replace("=", "\t")
|
||||
chr_len_out.close()
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
build_file_out.close()
|
||||
|
||||
|
||||
@@ -60,13 +60,13 @@ if __name__ == "__main__":
|
||||
if line.startswith("#"):
|
||||
continue
|
||||
builds.append(line.split("\t")[0])
|
||||
except:
|
||||
except Exception:
|
||||
sys.exit("Bad input file.")
|
||||
else:
|
||||
try:
|
||||
for build in parse_builds.getbuilds("http://genome.cse.ucsc.edu/cgi-bin/das/dsn"):
|
||||
builds.append(build[0])
|
||||
except:
|
||||
except Exception:
|
||||
sys.exit("Unable to retrieve builds.")
|
||||
for build in builds:
|
||||
if build == "?":
|
||||
|
||||
@@ -15,14 +15,14 @@ import requests
|
||||
def getbuilds(url):
|
||||
try:
|
||||
text = requests.get(url).text
|
||||
except:
|
||||
except Exception:
|
||||
print("#Unable to open " + url)
|
||||
print("?\tunspecified (?)")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
tree = ElementTree.fromstring(text)
|
||||
except:
|
||||
except Exception:
|
||||
print("#Invalid xml passed back from " + url)
|
||||
print("?\tunspecified (?)")
|
||||
sys.exit(1)
|
||||
|
||||
@@ -21,13 +21,13 @@ def main():
|
||||
builds = []
|
||||
try:
|
||||
text = requests.get(site).text
|
||||
except:
|
||||
except Exception:
|
||||
print("#Unable to connect to " + site)
|
||||
continue
|
||||
|
||||
try:
|
||||
tree = ElementTree.fromstring(text)
|
||||
except:
|
||||
except Exception:
|
||||
print("#Invalid xml passed back from " + site)
|
||||
continue
|
||||
print("#Harvested from", site)
|
||||
|
||||
@@ -95,7 +95,7 @@ class LDAP(AuthProvider):
|
||||
|
||||
try:
|
||||
import ldap
|
||||
except:
|
||||
except ImportError:
|
||||
log.debug('LDAP authenticate: could not load ldap module')
|
||||
return (failure_mode, '', '')
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ class Configuration(object):
|
||||
self.hours_between_check = 12.0
|
||||
else:
|
||||
self.hours_between_check = 12
|
||||
except:
|
||||
except Exception:
|
||||
self.hours_between_check = 12
|
||||
self.update_integrated_tool_panel = kwargs.get("update_integrated_tool_panel", True)
|
||||
self.enable_data_manager_user_view = string_as_bool(kwargs.get("enable_data_manager_user_view", "False"))
|
||||
@@ -794,7 +794,7 @@ class Configuration(object):
|
||||
|
||||
try:
|
||||
port = config.getint('server:%s' % self.server_name, 'port')
|
||||
except:
|
||||
except Exception:
|
||||
# uWSGI galaxy installations don't use paster and only speak uWSGI not http
|
||||
port = None
|
||||
return port
|
||||
|
||||
@@ -23,7 +23,7 @@ class SnapHmm(Text):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "SNAP HMM model (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
def sniff(self, filename):
|
||||
@@ -54,7 +54,7 @@ class Augustus(CompressedArchive):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Augustus model (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
def sniff(self, filename):
|
||||
|
||||
@@ -63,7 +63,7 @@ class Amos(data.Text):
|
||||
if re.match(r'{(RED|CTG|TLE)$', line):
|
||||
isAmos = True
|
||||
fh.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return isAmos
|
||||
|
||||
@@ -102,7 +102,7 @@ class Sequences(sequence.Fasta):
|
||||
else:
|
||||
break # we found a non-empty line, but it's not a fasta header
|
||||
fh.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
@@ -138,7 +138,7 @@ class Roadmaps(data.Text):
|
||||
else:
|
||||
break # we found a non-empty line, but it's not a fasta header
|
||||
fh.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
@@ -202,7 +202,7 @@ class Velvet(Html):
|
||||
gen_msg = gen_msg + ' Long Reads'
|
||||
if len(gen_msg) > 0:
|
||||
gen_msg = 'Uses: ' + gen_msg
|
||||
except:
|
||||
except Exception:
|
||||
log.debug("Velveth could not read Log file in %s" % efp)
|
||||
log.debug("Velveth log info %s" % gen_msg)
|
||||
rval = ['<html><head><title>Velvet Galaxy Composite Dataset </title></head><p/>']
|
||||
|
||||
@@ -106,7 +106,7 @@ class Ab1(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Binary ab1 sequence file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class Idat(Binary):
|
||||
if header == b'IDAT':
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ class Cel(Binary):
|
||||
if header == b';\x01\x00\x00':
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ class CompressedArchive(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Compressed binary file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ class CompressedZipArchive(CompressedArchive):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Compressed zip file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -425,7 +425,7 @@ class Bam(Binary):
|
||||
dataset.metadata.read_groups = [read_group['ID'] for read_group in dataset.metadata.bam_header.get('RG', []) if 'ID' in read_group]
|
||||
dataset.metadata.sort_order = dataset.metadata.bam_header.get('HD', {}).get('SO', None)
|
||||
dataset.metadata.bam_version = dataset.metadata.bam_header.get('HD', {}).get('VN', None)
|
||||
except:
|
||||
except Exception:
|
||||
# Per Dan, don't log here because doing so will cause datasets that
|
||||
# fail metadata to end in the error state
|
||||
pass
|
||||
@@ -438,7 +438,7 @@ class Bam(Binary):
|
||||
if header == b'BAM\1':
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def set_peek(self, dataset, is_multi_byte=False):
|
||||
@@ -452,7 +452,7 @@ class Bam(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Binary bam alignments file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
def to_archive(self, trans, dataset, name=""):
|
||||
@@ -664,7 +664,7 @@ class CRAM(Binary):
|
||||
if header == b"CRAM":
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -700,7 +700,7 @@ class Bcf(BaseBcf):
|
||||
if header == b'BCF':
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def set_meta(self, dataset, overwrite=True, **kwd):
|
||||
@@ -756,7 +756,7 @@ class BcfUncompressed(Bcf):
|
||||
if header == b'BCF':
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -789,7 +789,7 @@ class H5(Binary):
|
||||
if header == self._magic:
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def set_peek(self, dataset, is_multi_byte=False):
|
||||
@@ -803,7 +803,7 @@ class H5(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Binary HDF5 file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -886,7 +886,7 @@ class Biom2(H5):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Biom2 (HDF5) file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -911,7 +911,7 @@ class Scf(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Binary scf sequence file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -932,7 +932,7 @@ class Sff(Binary):
|
||||
if header == b'.sff':
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def set_peek(self, dataset, is_multi_byte=False):
|
||||
@@ -946,7 +946,7 @@ class Sff(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Binary sff file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -976,7 +976,7 @@ class BigWig(Binary):
|
||||
try:
|
||||
magic = self._unpack("I", open(filename, 'rb'))
|
||||
return magic[0] == self._magic
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def set_peek(self, dataset, is_multi_byte=False):
|
||||
@@ -990,7 +990,7 @@ class BigWig(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Binary UCSC %s file (%s)" % (self._name, nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -1040,7 +1040,7 @@ class TwoBit(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Binary TwoBit format nucleotide file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -1097,7 +1097,7 @@ class SQlite(Binary):
|
||||
if header == b'SQLite format 3\0':
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def set_peek(self, dataset, is_multi_byte=False):
|
||||
@@ -1108,7 +1108,7 @@ class SQlite(Binary):
|
||||
for table in dataset.metadata.tables:
|
||||
try:
|
||||
lines.append('%s [%s]' % (table, dataset.metadata.table_row_count[table]))
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
dataset.peek = '\n'.join(lines)
|
||||
dataset.blurb = nice_size(dataset.get_size())
|
||||
@@ -1119,7 +1119,7 @@ class SQlite(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "SQLite Database (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
@dataproviders.decorators.dataprovider_factory('sqlite', dataproviders.dataset.SQliteDataProvider.settings)
|
||||
@@ -1191,7 +1191,7 @@ class GeminiSQLite(SQlite):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Gemini SQLite Database, version %s" % (dataset.metadata.gemini_version or 'unknown')
|
||||
|
||||
|
||||
@@ -1265,7 +1265,7 @@ class IdpDB(SQlite):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "IDPickerDB SQLite file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -1289,7 +1289,7 @@ class Xlsx(Binary):
|
||||
if "[Content_Types].xml" in tempzip.namelist() and tempzip.read("[Content_Types].xml").find(b'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml') != -1:
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -1320,7 +1320,7 @@ class ExcelXls(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Microsoft Excel XLS file (%s)" % (data.nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -1341,7 +1341,7 @@ class Sra(Binary):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def set_peek(self, dataset, is_multi_byte=False):
|
||||
@@ -1355,7 +1355,7 @@ class Sra(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return 'Binary sra file (%s)' % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -1376,7 +1376,7 @@ class RData(Binary):
|
||||
header = gzip.open(filename).read(7)
|
||||
if header == rdata_header:
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -1612,7 +1612,7 @@ class PostgresqlArchive(CompressedArchive):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "PostgreSQL Archive (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -1669,7 +1669,7 @@ class Fast5Archive(CompressedArchive):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "FAST5 Archive (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -1771,7 +1771,7 @@ class SearchGuiArchive(CompressedArchive):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "SearchGUI Archive, version %s" % (dataset.metadata.searchgui_version or 'unknown')
|
||||
|
||||
|
||||
@@ -1795,7 +1795,7 @@ class NetCDF(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Binary netCDF file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
def sniff(self, filename):
|
||||
@@ -1805,7 +1805,7 @@ class NetCDF(Binary):
|
||||
if header == b'CDF':
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -1838,7 +1838,7 @@ class DMND(Binary):
|
||||
if header == self._magic:
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class Ply(object):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Ply file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ class Vtk(object):
|
||||
dataset.metadata.field_names.append(field_name)
|
||||
try:
|
||||
num_components = int(items[-1])
|
||||
except:
|
||||
except Exception:
|
||||
num_components = 1
|
||||
field_component_indexes = [str(i) for i in range(num_components)]
|
||||
field_components[field_name] = field_component_indexes
|
||||
@@ -319,7 +319,7 @@ class Vtk(object):
|
||||
float(items[0])
|
||||
# Don't process the cell data.
|
||||
# 0.0123457 0.197531
|
||||
except:
|
||||
except Exception:
|
||||
# Line consists of arrayName numComponents numTuples dataType.
|
||||
# Example: surface_field1 1 12 double
|
||||
field_name = items[0]
|
||||
@@ -438,7 +438,7 @@ class Vtk(object):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Vtk file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
|
||||
@@ -30,21 +30,21 @@ def __main__():
|
||||
else:
|
||||
try:
|
||||
feature = elems[3]
|
||||
except:
|
||||
except Exception:
|
||||
feature = 'feature%d' % (i + 1)
|
||||
start = int(elems[1]) + 1
|
||||
end = int(elems[2])
|
||||
try:
|
||||
score = elems[4]
|
||||
except:
|
||||
except Exception:
|
||||
score = '0'
|
||||
try:
|
||||
strand = elems[5]
|
||||
except:
|
||||
except Exception:
|
||||
strand = '+'
|
||||
try:
|
||||
group = elems[3]
|
||||
except:
|
||||
except Exception:
|
||||
group = 'group%d' % (i + 1)
|
||||
if complete_bed:
|
||||
out.write('%s\tbed2gff\t%s\t%d\t%d\t%s\t%s\t.\t%s %s;\n' % (chrom, feature, start, end, score, strand, feature, group))
|
||||
@@ -59,7 +59,7 @@ def __main__():
|
||||
exon_start = int(start) + int(block_starts[j])
|
||||
exon_end = exon_start + int(block_sizes[j]) - 1
|
||||
out.write('%s\tbed2gff\texon\t%d\t%d\t%s\t%s\t.\texon %s;\n' % (chrom, exon_start, exon_end, score, strand, group))
|
||||
except:
|
||||
except Exception:
|
||||
skipped_lines += 1
|
||||
if not first_skipped_line:
|
||||
first_skipped_line = i + 1
|
||||
|
||||
@@ -68,10 +68,10 @@ def __main__():
|
||||
# peek: ascii or digits?
|
||||
val = line.split()[0]
|
||||
|
||||
fastq_integer = True
|
||||
try:
|
||||
int(val)
|
||||
fastq_integer = True
|
||||
except:
|
||||
except ValueError:
|
||||
fastq_integer = False
|
||||
|
||||
if fastq_integer: # digits
|
||||
|
||||
@@ -28,7 +28,7 @@ def __main__():
|
||||
# Replace any spaces in the name with underscores so UCSC will not complain
|
||||
name = elems[2].replace(" ", "_")
|
||||
out.write("%s\t%s\t%s\t%s\t0\t%s\n" % (elems[0], start, elems[4], name, strand))
|
||||
except:
|
||||
except Exception:
|
||||
skipped_lines += 1
|
||||
if not first_skipped_line:
|
||||
first_skipped_line = i + 1
|
||||
|
||||
@@ -19,23 +19,23 @@ def __main__():
|
||||
input_name = sys.argv[2]
|
||||
try:
|
||||
chromCol = int(sys.argv[3]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
stop_err("'%s' is an invalid chrom column, correct the column settings before attempting to convert the data format." % str(sys.argv[3]))
|
||||
try:
|
||||
startCol = int(sys.argv[4]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
stop_err("'%s' is an invalid start column, correct the column settings before attempting to convert the data format." % str(sys.argv[4]))
|
||||
try:
|
||||
endCol = int(sys.argv[5]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
stop_err("'%s' is an invalid end column, correct the column settings before attempting to convert the data format." % str(sys.argv[5]))
|
||||
try:
|
||||
strandCol = int(sys.argv[6]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
strandCol = -1
|
||||
try:
|
||||
nameCol = int(sys.argv[7]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
nameCol = -1
|
||||
skipped_lines = 0
|
||||
first_skipped_line = 0
|
||||
@@ -47,12 +47,12 @@ def __main__():
|
||||
name = region.fields[nameCol]
|
||||
else:
|
||||
raise IndexError
|
||||
except:
|
||||
except Exception:
|
||||
name = "region_%i" % count
|
||||
try:
|
||||
|
||||
out.write("%s\t%i\t%i\t%s\t%i\t%s\n" % (region.chrom, region.start, region.end, name, 0, region.strand))
|
||||
except:
|
||||
except Exception:
|
||||
skipped_lines += 1
|
||||
if not first_skipped_line:
|
||||
first_skipped_line = count + 1
|
||||
|
||||
@@ -41,31 +41,31 @@ def __main__():
|
||||
input_name = sys.argv[2]
|
||||
try:
|
||||
chromCol = int(sys.argv[3]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
stop_err("'%s' is an invalid chrom column, correct the column settings before attempting to convert the data format." % str(sys.argv[3]))
|
||||
try:
|
||||
startCol = int(sys.argv[4]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
stop_err("'%s' is an invalid start column, correct the column settings before attempting to convert the data format." % str(sys.argv[4]))
|
||||
try:
|
||||
endCol = int(sys.argv[5]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
stop_err("'%s' is an invalid end column, correct the column settings before attempting to convert the data format." % str(sys.argv[5]))
|
||||
try:
|
||||
strandCol = int(sys.argv[6]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
strandCol = -1
|
||||
try:
|
||||
nameCol = int(sys.argv[7]) - 1
|
||||
except:
|
||||
except Exception:
|
||||
nameCol = -1
|
||||
try:
|
||||
extension = sys.argv[8]
|
||||
except:
|
||||
except IndexError:
|
||||
extension = 'interval' # default extension
|
||||
try:
|
||||
force_num_columns = int(sys.argv[9])
|
||||
except:
|
||||
except Exception:
|
||||
force_num_columns = None
|
||||
|
||||
skipped_lines = 0
|
||||
@@ -116,7 +116,7 @@ def __main__():
|
||||
fields2 = fields[11].rstrip(",").split(",") # remove trailing comma and split on comma
|
||||
for field in fields2:
|
||||
int(field)
|
||||
except:
|
||||
except Exception:
|
||||
strict_bed = False
|
||||
break
|
||||
if force_num_columns is not None and len(fields) != force_num_columns:
|
||||
@@ -137,14 +137,14 @@ def __main__():
|
||||
name = region.fields[nameCol]
|
||||
else:
|
||||
raise IndexError
|
||||
except:
|
||||
except Exception:
|
||||
name = "region_%i" % count
|
||||
try:
|
||||
fields = [str(item) for item in (region.chrom, region.start, region.end, name, 0, region.strand)]
|
||||
if force_num_columns is not None and len(fields) != force_num_columns:
|
||||
fields = force_bed_field_count(fields, count, force_num_columns)
|
||||
out.write("%s\n" % '\t'.join(fields))
|
||||
except:
|
||||
except Exception:
|
||||
skipped_lines += 1
|
||||
if first_skipped_line is None:
|
||||
first_skipped_line = count + 1
|
||||
|
||||
@@ -127,7 +127,7 @@ if __name__ == "__main__":
|
||||
chr_col_1, start_col_1, end_col_1, strand_col_1 = [int(x) - 1 for x in options.cols1.split(',')]
|
||||
chr_col_2, position_col_2, forward_col_2, reverse_col_2 = [int(x) - 1 for x in options.cols2.split(',')]
|
||||
in_fname, out_fname = args
|
||||
except:
|
||||
except Exception:
|
||||
doc_optparse.exception()
|
||||
|
||||
# Sort through a tempfile first
|
||||
|
||||
@@ -48,7 +48,7 @@ def main():
|
||||
try:
|
||||
float(val)
|
||||
continue
|
||||
except:
|
||||
except ValueError:
|
||||
convert_gff_coords_to_bed(feature)
|
||||
# Value is not a number, so it can be indexed.
|
||||
if val not in name_loc_dict:
|
||||
|
||||
@@ -41,17 +41,17 @@ def rgConv(inpedfilepath, outhtmlname, outfilepath):
|
||||
outfpath = os.path.join(outfilepath, outf) # where to write the fbat format file to
|
||||
try:
|
||||
mf = open(inmap, 'r')
|
||||
except:
|
||||
except Exception:
|
||||
sys.stderr.write('%s cannot open inmap file %s - do you have permission?\n' % (prog, inmap))
|
||||
sys.exit(1)
|
||||
try:
|
||||
rsl = [x.split()[1] for x in mf]
|
||||
except:
|
||||
except Exception:
|
||||
sys.stderr.write('## cannot parse %s' % inmap)
|
||||
sys.exit(1)
|
||||
try:
|
||||
os.makedirs(outfilepath)
|
||||
except:
|
||||
except Exception:
|
||||
pass # already exists
|
||||
head = ' '.join(rsl) # list of rs numbers
|
||||
# TODO add anno to rs but fbat will prolly barf?
|
||||
@@ -64,7 +64,7 @@ def rgConv(inpedfilepath, outhtmlname, outfilepath):
|
||||
lrow = row.split()
|
||||
try:
|
||||
[int(x) for x in lrow[10:50]] # look for non numeric codes
|
||||
except:
|
||||
except Exception:
|
||||
dorecode = 1
|
||||
if dorecode:
|
||||
lrow = row.strip().split()
|
||||
@@ -94,7 +94,7 @@ def main():
|
||||
outfilepath = sys.argv[3]
|
||||
try:
|
||||
os.makedirs(outfilepath)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
rgConv(inpedfilepath, outhtmlname, outfilepath)
|
||||
flist = os.listdir(outfilepath)
|
||||
|
||||
@@ -42,13 +42,13 @@ def getMissval(inped=''):
|
||||
commonmissvals = {'N': 'N', '0': '0', 'n': 'n', '9': '9', '-': '-', '.': '.'}
|
||||
try:
|
||||
f = open(inped, 'r')
|
||||
except:
|
||||
except Exception:
|
||||
return None # signal no in file
|
||||
missval = None
|
||||
while missval is None: # doggedly continue until we solve the mystery
|
||||
try:
|
||||
l = f.readline()
|
||||
except:
|
||||
except Exception:
|
||||
break
|
||||
ll = l.split()[6:] # ignore pedigree stuff
|
||||
for c in ll:
|
||||
@@ -94,7 +94,7 @@ def main():
|
||||
outfilepath = sys.argv[3]
|
||||
try:
|
||||
os.makedirs(outfilepath)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
plink = sys.argv[4]
|
||||
rgConv(inpedfilepath, outhtmlname, outfilepath, plink)
|
||||
|
||||
@@ -48,7 +48,7 @@ def pruneLD(plinktasks=[], cd='./', vclbase=[]):
|
||||
alog += lplog
|
||||
alog.append('\n')
|
||||
os.unlink(plog) # no longer needed
|
||||
except:
|
||||
except Exception:
|
||||
alog.append('### %s Strange - no std out from plink when running command line\n%s\n' % (timenow(), ' '.join(vcl)))
|
||||
return alog
|
||||
|
||||
@@ -92,7 +92,7 @@ def main():
|
||||
outfilepath = sys.argv[6]
|
||||
try:
|
||||
os.makedirs(outfilepath)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
plink = sys.argv[7]
|
||||
makeLDreduced(base_name, infpath=inpedfilepath, outfpath=outfilepath, plinke=plink, forcerebuild=False, returnFname=False,
|
||||
|
||||
@@ -60,7 +60,7 @@ def main():
|
||||
outfilepath = sys.argv[3]
|
||||
try:
|
||||
os.makedirs(outfilepath)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
plink = sys.argv[4]
|
||||
rgConv(inpedfilepath, outhtmlname, outfilepath, plink)
|
||||
|
||||
@@ -179,7 +179,7 @@ class Data(object):
|
||||
def set_max_optional_metadata_filesize(self, max_value):
|
||||
try:
|
||||
max_value = int(max_value)
|
||||
except:
|
||||
except (TypeError, ValueError):
|
||||
return
|
||||
self.__class__._max_optional_metadata_filesize = max_value
|
||||
|
||||
@@ -394,7 +394,7 @@ class Data(object):
|
||||
if not mime:
|
||||
try:
|
||||
mime = trans.app.datatypes_registry.get_mimetype_by_extension(".".split(file_path)[-1])
|
||||
except:
|
||||
except Exception:
|
||||
mime = "text/plain"
|
||||
self._clean_and_set_mime_type(trans, mime)
|
||||
return self._yield_user_file_content(trans, data, file_path)
|
||||
@@ -490,7 +490,7 @@ class Data(object):
|
||||
info = unicodify(info, 'utf-8')
|
||||
|
||||
return info
|
||||
except:
|
||||
except Exception:
|
||||
return "info unavailable"
|
||||
|
||||
def validate(self, dataset):
|
||||
@@ -521,7 +521,7 @@ class Data(object):
|
||||
self.supported_display_apps = self.supported_display_apps.copy()
|
||||
try:
|
||||
del self.supported_display_apps[app_id]
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('Tried to remove display app %s from datatype %s, but this display app is not declared.', type, self.__class__.__name__)
|
||||
|
||||
def clear_display_apps(self):
|
||||
@@ -551,7 +551,7 @@ class Data(object):
|
||||
"""Returns primary label for display app"""
|
||||
try:
|
||||
return self.supported_display_apps[type]['label']
|
||||
except:
|
||||
except Exception:
|
||||
return 'unknown'
|
||||
|
||||
def as_display_type(self, dataset, type, **kwd):
|
||||
@@ -559,7 +559,7 @@ class Data(object):
|
||||
try:
|
||||
if type in self.get_display_types():
|
||||
return getattr(self, self.supported_display_apps[type]['file_function'])(dataset, **kwd)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('Function %s is referred to in datatype %s for displaying as type %s, but is not accessible', self.supported_display_apps[type]['file_function'], self.__class__.__name__, type)
|
||||
return "This display type (%s) is not implemented for this datatype (%s)." % (type, dataset.ext)
|
||||
|
||||
@@ -573,7 +573,7 @@ class Data(object):
|
||||
try:
|
||||
if app.config.enable_old_display_applications and type in self.get_display_types():
|
||||
return target_frame, getattr(self, self.supported_display_apps[type]['links_function'])(dataset, type, app, base_url, **kwd)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('Function %s is referred to in datatype %s for generating links for type %s, but is not accessible',
|
||||
self.supported_display_apps[type]['links_function'], self.__class__.__name__, type)
|
||||
return target_frame, []
|
||||
|
||||
@@ -122,7 +122,7 @@ class DynamicDisplayApplicationBuilder(object):
|
||||
id_col = elem.get('id', None)
|
||||
try:
|
||||
id_col = int(id_col)
|
||||
except:
|
||||
except (TypeError, ValueError):
|
||||
if data_table:
|
||||
if id_col is None:
|
||||
id_col = data_table.columns.get('id', None)
|
||||
@@ -130,14 +130,14 @@ class DynamicDisplayApplicationBuilder(object):
|
||||
id_col = data_table.columns.get('value', None)
|
||||
try:
|
||||
id_col = int(id_col)
|
||||
except:
|
||||
except (TypeError, ValueError):
|
||||
# id is set to a string or None, use column by that name if available
|
||||
id_col = data_table.columns.get(id_col, None)
|
||||
id_col = int(id_col)
|
||||
name_col = elem.get('name', None)
|
||||
try:
|
||||
name_col = int(name_col)
|
||||
except:
|
||||
except (TypeError, ValueError):
|
||||
if data_table:
|
||||
if name_col is None:
|
||||
name_col = data_table.columns.get('name', None)
|
||||
|
||||
@@ -126,7 +126,7 @@ class GenomeGraphs(Tabular):
|
||||
hasheader = 0
|
||||
try:
|
||||
['%f' % x for x in d[0][1:]] # first is name - see if starts all numerics
|
||||
except:
|
||||
except Exception:
|
||||
hasheader = 1
|
||||
# Generate column header
|
||||
out.append('<tr>')
|
||||
@@ -158,7 +158,7 @@ class GenomeGraphs(Tabular):
|
||||
for j, x in enumerate(ll):
|
||||
try:
|
||||
x = float(x)
|
||||
except:
|
||||
except Exception:
|
||||
badvals.append('col%d:%s' % (j + 1, x))
|
||||
if len(badvals) > 0:
|
||||
errors.append('row %d, %s' % (' '.join(badvals)))
|
||||
@@ -331,13 +331,13 @@ class Rgenetics(Html):
|
||||
return True
|
||||
try:
|
||||
efp = dataset.extra_files_path
|
||||
except:
|
||||
except Exception:
|
||||
if verbose:
|
||||
gal_Log.debug('@@@rgenetics set_meta failed %s - dataset %s has no efp ?' % (sys.exc_info()[0], dataset.name))
|
||||
return False
|
||||
try:
|
||||
flist = os.listdir(efp)
|
||||
except:
|
||||
except Exception:
|
||||
if verbose:
|
||||
gal_Log.debug('@@@rgenetics set_meta failed %s - dataset %s has no efp ?' % (sys.exc_info()[0], dataset.name))
|
||||
return False
|
||||
@@ -655,7 +655,7 @@ class RexpBase(Html):
|
||||
pp = os.path.join(dataset.extra_files_path, '%s.pheno' % dataset.metadata.base_name)
|
||||
try:
|
||||
p = open(pp, 'r').readlines()
|
||||
except:
|
||||
except Exception:
|
||||
p = ['##failed to find %s' % pp, ]
|
||||
dataset.peek = ''.join(p[:5])
|
||||
dataset.blurb = 'Galaxy Rexpression composite file'
|
||||
@@ -670,7 +670,7 @@ class RexpBase(Html):
|
||||
pp = os.path.join(dataset.extra_files_path, '%s.pheno' % dataset.metadata.base_name)
|
||||
try:
|
||||
p = open(pp, 'r').readlines()
|
||||
except:
|
||||
except Exception:
|
||||
p = ['##failed to find %s' % pp]
|
||||
return ''.join(p[:5])
|
||||
|
||||
@@ -681,7 +681,7 @@ class RexpBase(Html):
|
||||
h = '## rexpression get_file_peek: no file found'
|
||||
try:
|
||||
h = open(filename, 'r').readlines()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return ''.join(h[:5])
|
||||
|
||||
@@ -713,7 +713,7 @@ class RexpBase(Html):
|
||||
Html.set_meta(self, dataset, **kwd)
|
||||
try:
|
||||
flist = os.listdir(dataset.extra_files_path)
|
||||
except:
|
||||
except Exception:
|
||||
if verbose:
|
||||
gal_Log.debug('@@@rexpression set_meta failed - no dataset?')
|
||||
return False
|
||||
@@ -731,7 +731,7 @@ class RexpBase(Html):
|
||||
dataset.metadata.pheno_path = pp
|
||||
try:
|
||||
pf = open(pp, 'r').readlines() # read the basename.phenodata in the extra_files_path
|
||||
except:
|
||||
except Exception:
|
||||
pf = None
|
||||
if pf:
|
||||
h = pf[0].strip()
|
||||
|
||||
@@ -225,7 +225,7 @@ class Gmaj(data.Data):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "peek unavailable"
|
||||
|
||||
def get_mime(self):
|
||||
@@ -285,5 +285,5 @@ class Laj(data.Text):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "peek unavailable"
|
||||
|
||||
@@ -111,20 +111,20 @@ class Interval(Tabular):
|
||||
int(elems[1])
|
||||
if overwrite or not dataset.metadata.element_is_set('startCol'):
|
||||
dataset.metadata.startCol = 2
|
||||
except:
|
||||
except Exception:
|
||||
pass # Metadata default will be used
|
||||
try:
|
||||
int(elems[2])
|
||||
if overwrite or not dataset.metadata.element_is_set('endCol'):
|
||||
dataset.metadata.endCol = 3
|
||||
except:
|
||||
except Exception:
|
||||
pass # Metadata default will be used
|
||||
# we no longer want to guess that this column is the 'name', name must now be set manually for interval files
|
||||
# we will still guess at the strand, as we can make a more educated guess
|
||||
# if len( elems ) > 3:
|
||||
# try:
|
||||
# int( elems[3] )
|
||||
# except:
|
||||
# except Exception:
|
||||
# if overwrite or not dataset.metadata.element_is_set( 'nameCol' ):
|
||||
# dataset.metadata.nameCol = 4
|
||||
if len(elems) < 6 or elems[5] not in data.valid_strand:
|
||||
@@ -149,7 +149,7 @@ class Interval(Tabular):
|
||||
and dataset.metadata.chromCol \
|
||||
and dataset.metadata.startCol \
|
||||
and dataset.metadata.endCol
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def get_estimated_display_viewport(self, dataset, chrom_col=None, start_col=None, end_col=None):
|
||||
@@ -331,10 +331,10 @@ class Interval(Tabular):
|
||||
# respectively ( for 0 based columns )
|
||||
int(hdr[1])
|
||||
int(hdr[2])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def get_track_resolution(self, dataset, start, end):
|
||||
@@ -458,14 +458,14 @@ class Bed(Interval):
|
||||
fields2 = fields[11].rstrip(",").split(",") # remove trailing comma and split on comma
|
||||
for field in fields2:
|
||||
int(field)
|
||||
except:
|
||||
except Exception:
|
||||
return Interval.as_ucsc_display_file(self, dataset)
|
||||
# only check first line for proper form
|
||||
break
|
||||
|
||||
try:
|
||||
return open(dataset.file_name)
|
||||
except:
|
||||
except Exception:
|
||||
return "This item contains no content"
|
||||
|
||||
def sniff(self, filename):
|
||||
@@ -510,7 +510,7 @@ class Bed(Interval):
|
||||
try:
|
||||
int(hdr[1])
|
||||
int(hdr[2])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if len(hdr) > 4:
|
||||
# hdr[3] is a string, 'name', which defines the name of the BED line - difficult to test for this.
|
||||
@@ -518,7 +518,7 @@ class Bed(Interval):
|
||||
try:
|
||||
if int(hdr[4]) < 0 or int(hdr[4]) > 1000:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if len(hdr) > 5:
|
||||
# hdr[5] is strand
|
||||
@@ -528,48 +528,48 @@ class Bed(Interval):
|
||||
# hdr[6] is thickStart, the starting position at which the feature is drawn thickly.
|
||||
try:
|
||||
int(hdr[6])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if len(hdr) > 7:
|
||||
# hdr[7] is thickEnd, the ending position at which the feature is drawn thickly
|
||||
try:
|
||||
int(hdr[7])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if len(hdr) > 8:
|
||||
# hdr[8] is itemRgb, an RGB value of the form R,G,B (e.g. 255,0,0). However, this could also be an int (e.g., 0)
|
||||
try:
|
||||
int(hdr[8])
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
hdr[8].split(',')
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if len(hdr) > 9:
|
||||
# hdr[9] is blockCount, the number of blocks (exons) in the BED line.
|
||||
try:
|
||||
block_count = int(hdr[9])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if len(hdr) > 10:
|
||||
# hdr[10] is blockSizes - A comma-separated list of the block sizes.
|
||||
# Sometimes the blosck_sizes and block_starts lists end in extra commas
|
||||
try:
|
||||
block_sizes = hdr[10].rstrip(',').split(',')
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if len(hdr) > 11:
|
||||
# hdr[11] is blockStarts - A comma-separated list of block starts.
|
||||
try:
|
||||
block_starts = hdr[11].rstrip(',').split(',')
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if len(block_sizes) != block_count or len(block_starts) != block_count:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -678,15 +678,15 @@ class Gff(Tabular, _RemoteCallMixin):
|
||||
# Try int.
|
||||
int(value)
|
||||
value_type = "int"
|
||||
except:
|
||||
except ValueError:
|
||||
try:
|
||||
# Try float.
|
||||
float(value)
|
||||
value_type = "float"
|
||||
except:
|
||||
except ValueError:
|
||||
pass
|
||||
attribute_types[name] = value_type
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if i + 1 == num_lines:
|
||||
break
|
||||
@@ -708,7 +708,7 @@ class Gff(Tabular, _RemoteCallMixin):
|
||||
int(elems[3])
|
||||
int(elems[4])
|
||||
break
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
Tabular.set_meta(self, dataset, overwrite=overwrite, skip=i)
|
||||
|
||||
@@ -771,7 +771,7 @@ class Gff(Tabular, _RemoteCallMixin):
|
||||
# Make sure we have not spanned chromosomes
|
||||
start = min(start, int(elems[3]))
|
||||
stop = max(stop, int(elems[4]))
|
||||
except:
|
||||
except Exception:
|
||||
# most likely start/stop is not an int or not enough fields
|
||||
pass
|
||||
# make sure we are at the next new line
|
||||
@@ -848,19 +848,19 @@ class Gff(Tabular, _RemoteCallMixin):
|
||||
try:
|
||||
int(hdr[3])
|
||||
int(hdr[4])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if hdr[5] != '.':
|
||||
try:
|
||||
float(hdr[5])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if hdr[6] not in data.valid_strand:
|
||||
return False
|
||||
if hdr[7] not in self.valid_gff_frame:
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
# ------------- Dataproviders
|
||||
@@ -919,13 +919,13 @@ class Gff3(Gff):
|
||||
try:
|
||||
start = int(elems[3])
|
||||
valid_start = True
|
||||
except:
|
||||
except Exception:
|
||||
if elems[3] == '.':
|
||||
valid_start = True
|
||||
try:
|
||||
end = int(elems[4])
|
||||
valid_end = True
|
||||
except:
|
||||
except Exception:
|
||||
if elems[4] == '.':
|
||||
valid_end = True
|
||||
strand = elems[6]
|
||||
@@ -982,18 +982,18 @@ class Gff3(Gff):
|
||||
return False
|
||||
try:
|
||||
int(hdr[3])
|
||||
except:
|
||||
except Exception:
|
||||
if hdr[3] != '.':
|
||||
return False
|
||||
try:
|
||||
int(hdr[4])
|
||||
except:
|
||||
except Exception:
|
||||
if hdr[4] != '.':
|
||||
return False
|
||||
if hdr[5] != '.':
|
||||
try:
|
||||
float(hdr[5])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if hdr[6] not in self.valid_gff3_strand:
|
||||
return False
|
||||
@@ -1001,7 +1001,7 @@ class Gff3(Gff):
|
||||
return False
|
||||
parse_gff3_attributes(hdr[8])
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -1055,12 +1055,12 @@ class Gtf(Gff):
|
||||
try:
|
||||
int(hdr[3])
|
||||
int(hdr[4])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if hdr[5] != '.':
|
||||
try:
|
||||
float(hdr[5])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if hdr[6] not in data.valid_strand:
|
||||
return False
|
||||
@@ -1077,7 +1077,7 @@ class Gtf(Gff):
|
||||
else:
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -1140,7 +1140,7 @@ class Wiggle(Tabular, _RemoteCallMixin):
|
||||
start = min(int(fields[0]), start)
|
||||
end = max(end, int(fields[0]) + span)
|
||||
viewport_feature_count -= 1
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
# make sure we are at the next new line
|
||||
readline_count = VIEWPORT_MAX_READS_PER_LINE
|
||||
@@ -1199,7 +1199,7 @@ class Wiggle(Tabular, _RemoteCallMixin):
|
||||
try:
|
||||
float(elems[0]) # "Wiggle track data values can be integer or real, positive or negative values"
|
||||
break
|
||||
except:
|
||||
except Exception:
|
||||
do_break = False
|
||||
for col_startswith in data.col1_startswith:
|
||||
if elems[0].lower().startswith(col_startswith):
|
||||
@@ -1244,7 +1244,7 @@ class Wiggle(Tabular, _RemoteCallMixin):
|
||||
if len(hdr) > 1 and hdr[0] == 'track' and hdr[1].startswith('type=wiggle'):
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def get_track_resolution(self, dataset, start, end):
|
||||
@@ -1394,7 +1394,7 @@ class CustomTrack (Tabular):
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
@@ -1404,9 +1404,9 @@ class CustomTrack (Tabular):
|
||||
try:
|
||||
int(hdr[1])
|
||||
int(hdr[2])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -1539,7 +1539,7 @@ class ScIdx(Tabular):
|
||||
count += 1
|
||||
if count < 100 and count > 0:
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
finally:
|
||||
fh.close()
|
||||
|
||||
@@ -33,7 +33,7 @@ def count_special_lines(word, filename, invert=False):
|
||||
cmd.extend([word, filename])
|
||||
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||
return int(out.communicate()[0].split()[0])
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return 0
|
||||
|
||||
@@ -48,7 +48,7 @@ def count_lines(filename, non_empty=False):
|
||||
else:
|
||||
out = subprocess.Popen(['wc', '-l', filename], stdout=subprocess.PIPE)
|
||||
return int(out.communicate()[0].split()[0])
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return 0
|
||||
|
||||
@@ -427,7 +427,7 @@ class OBFS(Binary):
|
||||
"""Create HTML content, used for displaying peek."""
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "OpenBabel Fastsearch Index"
|
||||
|
||||
def display_data(self, trans, data, preview=False, filename=None,
|
||||
@@ -702,7 +702,7 @@ class SMILES(Tabular):
|
||||
# if we have atoms, we have a molecule
|
||||
if not len(pybel.readstring('smi', smiles).atoms) > 0:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
# if convert fails its not a smiles string
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -26,7 +26,7 @@ class Hmmer(Text):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "HMMER database (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
@abc.abstractmethod
|
||||
@@ -77,7 +77,7 @@ class HmmerPress(Binary):
|
||||
"""Create HTML content, used for displaying peek."""
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "HMMER3 database (multiple files)"
|
||||
|
||||
def __init__(self, **kwd):
|
||||
|
||||
@@ -55,7 +55,7 @@ class BowtieIndex(Html):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Bowtie index file"
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class Smat(Text):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "ESTScan scores matrices (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
def set_peek(self, dataset, is_multi_byte=False):
|
||||
@@ -98,7 +98,7 @@ class PlantTribesKsComponents(Tabular):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Significant components in the Ks distribution (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
def set_meta(self, dataset, **kwd):
|
||||
|
||||
@@ -285,7 +285,7 @@ class ThermoRAW(Binary):
|
||||
if header.find(finnigan) != -1:
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def set_peek(self, dataset, is_multi_byte=False):
|
||||
@@ -299,7 +299,7 @@ class ThermoRAW(Binary):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Thermo Finnigan RAW file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class QualityScoreSOLiD (QualityScore):
|
||||
if not(readlen):
|
||||
readlen = len(line.split())
|
||||
assert len(line.split()) == readlen # SOLiD reads should be of the same length
|
||||
except:
|
||||
except Exception:
|
||||
break
|
||||
goodblock += 1
|
||||
if goodblock > 10:
|
||||
@@ -64,7 +64,7 @@ class QualityScoreSOLiD (QualityScore):
|
||||
else:
|
||||
break # we found a non-empty line, but it's not a header
|
||||
fh.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
@@ -106,13 +106,13 @@ class QualityScore454 (QualityScore):
|
||||
break
|
||||
try:
|
||||
[int(x) for x in line.split()]
|
||||
except:
|
||||
except Exception:
|
||||
break
|
||||
return True
|
||||
else:
|
||||
break # we found a non-empty line, but it's not a header
|
||||
fh.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class SequenceSplitLocations(data.Text):
|
||||
if 'start' not in section or 'end' not in section or 'sequences' not in section:
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
@@ -376,7 +376,7 @@ class Fasta(Sequence):
|
||||
else:
|
||||
break # we found a non-empty line, but it's not a fasta header
|
||||
fh.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
@@ -543,7 +543,7 @@ class csFasta(Sequence):
|
||||
else:
|
||||
break # we found a non-empty line, but it's not a header
|
||||
fh.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
@@ -634,7 +634,7 @@ class BaseFastq (Sequence):
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def display_data(self, trans, dataset, preview=False, filename=None, to_ext=None, **kwd):
|
||||
@@ -930,7 +930,7 @@ class Maf(Alignment):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -968,7 +968,7 @@ class MafCustomTrack(data.Text):
|
||||
dataset.metadata.vp_chromosome = chrom
|
||||
dataset.metadata.vp_start = forward_strand_start
|
||||
dataset.metadata.vp_end = forward_strand_end
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
@@ -1019,7 +1019,7 @@ class Axt(data.Text):
|
||||
return False
|
||||
try:
|
||||
map(int, [hdr[0], hdr[2], hdr[3], hdr[5], hdr[6], hdr[8]])
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
if hdr[7] not in data.valid_strand:
|
||||
return False
|
||||
@@ -1060,7 +1060,7 @@ class Lav(data.Text):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
@@ -1205,7 +1205,7 @@ class Genbank(data.Text):
|
||||
try:
|
||||
with open(filename, 'r') as handle:
|
||||
return 'LOCUS ' == handle.read(6)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return False
|
||||
@@ -1236,7 +1236,7 @@ class MemePsp(Sequence):
|
||||
for item in l.split():
|
||||
try:
|
||||
float(item)
|
||||
except:
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
try:
|
||||
@@ -1269,7 +1269,7 @@ class MemePsp(Sequence):
|
||||
# We found a non-empty line,
|
||||
# but it's not a psp id width.
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
# We've reached EOF in less than 100 lines.
|
||||
return True
|
||||
|
||||
@@ -54,7 +54,7 @@ def stream_to_open_named_file(stream, fd, filename, source_encoding=None, source
|
||||
is_multi_byte = False
|
||||
try:
|
||||
codecs.lookup(target_encoding)
|
||||
except:
|
||||
except Exception:
|
||||
target_encoding = util.DEFAULT_ENCODING # utf-8
|
||||
if not source_encoding:
|
||||
source_encoding = util.DEFAULT_ENCODING # sys.getdefaultencoding() would mimic old behavior (defaults to ascii)
|
||||
@@ -70,7 +70,7 @@ def stream_to_open_named_file(stream, fd, filename, source_encoding=None, source
|
||||
try:
|
||||
if text_type(chunk[:2]) == text_type(util.gzip_magic):
|
||||
is_compressed = True
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if not is_compressed:
|
||||
# See if we have a multi-byte character file
|
||||
@@ -408,7 +408,7 @@ def guess_ext(fname, sniff_order, is_multi_byte=False):
|
||||
if datatype.sniff(fname):
|
||||
file_ext = datatype.file_ext
|
||||
break
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
# Ugly hack for tsv vs tabular sniffing, we want to prefer tabular
|
||||
# to tsv but it doesn't have a sniffer - is TSV was sniffed just check
|
||||
|
||||
@@ -62,7 +62,7 @@ class TabularData(data.Text):
|
||||
and dataset.state == dataset.states.OK \
|
||||
and dataset.metadata.columns > 0 \
|
||||
and dataset.metadata.data_lines != 0
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def get_chunk(self, trans, dataset, offset=0, ck_size=None):
|
||||
@@ -156,7 +156,7 @@ class TabularData(data.Text):
|
||||
if isinstance(spec.param, metadata.ColumnParameter):
|
||||
try:
|
||||
i = int(getattr(dataset.metadata, name)) - 1
|
||||
except:
|
||||
except Exception:
|
||||
i = -1
|
||||
if 0 <= i < columns and column_headers[i] is None:
|
||||
column_headers[i] = column_parameter_alias.get(name, name)
|
||||
@@ -294,14 +294,14 @@ class Tabular(TabularData):
|
||||
try:
|
||||
int(column_text)
|
||||
return True
|
||||
except:
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
def is_float(column_text):
|
||||
try:
|
||||
float(column_text)
|
||||
return True
|
||||
except:
|
||||
except ValueError:
|
||||
if column_text.strip().lower() == 'na':
|
||||
return True # na is special cased to be a float
|
||||
return False
|
||||
@@ -488,7 +488,7 @@ class Sam(Tabular):
|
||||
fh.close()
|
||||
if count < 5 and count > 0:
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
@@ -650,10 +650,10 @@ class Pileup(Tabular):
|
||||
chrom = int(hdr[1])
|
||||
assert chrom >= 0
|
||||
assert hdr[2] in ['A', 'C', 'G', 'T', 'N', 'a', 'c', 'g', 't', 'n']
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
# Dataproviders
|
||||
@@ -919,14 +919,14 @@ class BaseCSV(TabularData):
|
||||
try:
|
||||
int(column_text)
|
||||
return True
|
||||
except:
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
def is_float(self, column_text):
|
||||
try:
|
||||
float(column_text)
|
||||
return True
|
||||
except:
|
||||
except ValueError:
|
||||
if column_text.strip().lower() == 'na':
|
||||
return True # na is special cased to be a float
|
||||
return False
|
||||
@@ -990,7 +990,7 @@ class BaseCSV(TabularData):
|
||||
if not csv.Sniffer().has_header(open(filename, 'r').read(self.big_peek_size)):
|
||||
return False
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
# Not readable by Python's csv using this dialect
|
||||
return False
|
||||
|
||||
@@ -1137,7 +1137,7 @@ class ConnectivityTable(Tabular):
|
||||
j += 1
|
||||
i += 1
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def get_chunk(self, trans, dataset, chunk):
|
||||
|
||||
@@ -55,7 +55,7 @@ class Html(Text):
|
||||
if hdr and hdr[0].lower().find('<html>') >= 0:
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return True
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ class Json(Text):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "JSON file (%s)" % (nice_size(dataset.get_size()))
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ class Ipynb(Json):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def display_data(self, trans, dataset, preview=False, filename=None, to_ext=None, **kwd):
|
||||
@@ -420,7 +420,7 @@ class SnpEffDb(Text):
|
||||
if m:
|
||||
snpeff_version = m.groups()[0] + m.groups()[1]
|
||||
fh.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return snpeff_version
|
||||
|
||||
@@ -465,7 +465,7 @@ class SnpEffDb(Text):
|
||||
fh.write("annotations: %s\n" % ','.join(annotations))
|
||||
if regulations:
|
||||
fh.write("regulations: %s\n" % ','.join(regulations))
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class UCSCTrackHub(Html):
|
||||
def display_peek(self, dataset):
|
||||
try:
|
||||
return dataset.peek
|
||||
except:
|
||||
except Exception:
|
||||
return "Track Hub structure: Visualization in UCSC Track Hub"
|
||||
|
||||
def sniff(self, filename):
|
||||
|
||||
@@ -14,6 +14,6 @@ def count_special_lines(word, filename, invert=False):
|
||||
cmd.extend([word, filename])
|
||||
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||
return int(out.communicate()[0].split()[0])
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return 0
|
||||
|
||||
@@ -63,7 +63,7 @@ class ConditionalDependencies(object):
|
||||
try:
|
||||
name = name.replace('-', '_').replace('.', '_')
|
||||
return getattr(self, 'check_' + name)()
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def check_psycopg2(self):
|
||||
|
||||
@@ -1166,7 +1166,7 @@ class JobWrapper(object, HasResourceParameters):
|
||||
# TODO: After failing here, consider returning from the function.
|
||||
try:
|
||||
self.reclaim_ownership()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('(%s) Failed to change ownership of %s, failing' % (job.id, self.working_directory))
|
||||
return self.fail(job.info, stdout=stdout, stderr=stderr, exit_code=tool_exit_code)
|
||||
|
||||
@@ -1316,7 +1316,7 @@ class JobWrapper(object, HasResourceParameters):
|
||||
dataset.set_peek(line_count=context['line_count'], is_multi_byte=True)
|
||||
else:
|
||||
dataset.set_peek(line_count=context['line_count'])
|
||||
except:
|
||||
except Exception:
|
||||
if (not dataset.datatype.composite_type and dataset.dataset.is_multi_byte()) or self.tool.is_multi_byte:
|
||||
dataset.set_peek(is_multi_byte=True)
|
||||
else:
|
||||
@@ -1467,7 +1467,7 @@ class JobWrapper(object, HasResourceParameters):
|
||||
galaxy.tools.imp_exp.JobImportHistoryArchiveWrapper(self.app, self.job_id).cleanup_after_job()
|
||||
if delete_files:
|
||||
self.app.object_store.delete(self.get_job(), base_dir='job_work', entire_dir=True, dir_only=True, obj_dir=True)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Unable to cleanup job %d", self.job_id)
|
||||
|
||||
def _collect_extra_files(self, dataset, job_working_directory):
|
||||
@@ -1765,7 +1765,7 @@ class JobWrapper(object, HasResourceParameters):
|
||||
if external_chown_script and job.user is not None:
|
||||
try:
|
||||
self._change_ownership(self.user_system_pwent[0], str(self.user_system_pwent[3]))
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('(%s) Failed to change ownership of %s, making world-writable instead' % (job.id, self.working_directory))
|
||||
os.chmod(self.working_directory, 0o777)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class DeferredJobQueue(object):
|
||||
module_name = 'galaxy.jobs.deferred.' + name
|
||||
try:
|
||||
module = __import__(module_name)
|
||||
except:
|
||||
except ImportError:
|
||||
log.exception('Deferred job plugin appears to exist but is not loadable: %s', module_name)
|
||||
continue
|
||||
for comp in module_name.split(".")[1:]:
|
||||
@@ -76,7 +76,7 @@ class DeferredJobQueue(object):
|
||||
while self.running:
|
||||
try:
|
||||
self.__monitor_step()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('Exception in monitor_step')
|
||||
self.sleeper.sleep(1)
|
||||
log.info('job queue stopped')
|
||||
@@ -100,7 +100,7 @@ class DeferredJobQueue(object):
|
||||
# Recovered jobs are passed in by ID
|
||||
assert type(job) is int
|
||||
job = self.sa_session.query(model.DeferredJob).get(job)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if job.is_check_time:
|
||||
try:
|
||||
|
||||
@@ -1,20 +1,33 @@
|
||||
"""
|
||||
Galaxy job handler, prepares, runs, tracks, and finishes Galaxy jobs
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import time
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
from Queue import Queue, Empty
|
||||
import time
|
||||
from Queue import (
|
||||
Empty,
|
||||
Queue
|
||||
)
|
||||
|
||||
from sqlalchemy.sql.expression import and_, or_, select, func, true, null
|
||||
from sqlalchemy.sql.expression import (
|
||||
and_,
|
||||
func,
|
||||
null,
|
||||
or_,
|
||||
select,
|
||||
true
|
||||
)
|
||||
|
||||
from galaxy import model
|
||||
from galaxy.util.sleeper import Sleeper
|
||||
from galaxy.jobs import JobWrapper, TaskWrapper, JobDestination
|
||||
from galaxy.jobs import (
|
||||
JobDestination,
|
||||
JobWrapper,
|
||||
TaskWrapper
|
||||
)
|
||||
from galaxy.jobs.mapper import JobNotReadyException
|
||||
from galaxy.util.sleeper import Sleeper
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -196,7 +209,7 @@ class JobHandlerQueue(object):
|
||||
# to the sleep.
|
||||
if not self.app.job_manager.job_lock:
|
||||
self.__monitor_step()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Exception in monitor_step")
|
||||
# Sleep
|
||||
self.sleeper.sleep(1)
|
||||
@@ -703,7 +716,7 @@ class JobHandlerStopQueue(object):
|
||||
while self.running:
|
||||
try:
|
||||
self.monitor_step()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Exception in monitor_step")
|
||||
# Sleep
|
||||
self.sleeper.sleep(1)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import re
|
||||
from .error_level import StdioErrorLevel
|
||||
import traceback
|
||||
|
||||
from logging import getLogger
|
||||
|
||||
from .error_level import StdioErrorLevel
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ def check_output(tool, stdout, stderr, tool_exit_code, job):
|
||||
success = True
|
||||
|
||||
# On any exception, return True.
|
||||
except:
|
||||
except Exception:
|
||||
tb = traceback.format_exc()
|
||||
log.warning("Tool check encountered unexpected exception; " +
|
||||
"assuming tool was successful: " + tb)
|
||||
|
||||
@@ -1,28 +1,34 @@
|
||||
"""
|
||||
Base classes for job runner plugins.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
import string
|
||||
import logging
|
||||
import datetime
|
||||
import threading
|
||||
import logging
|
||||
import os
|
||||
import string
|
||||
import subprocess
|
||||
|
||||
from Queue import Queue, Empty
|
||||
import threading
|
||||
import time
|
||||
from Queue import (
|
||||
Empty,
|
||||
Queue
|
||||
)
|
||||
|
||||
import galaxy.jobs
|
||||
from galaxy.jobs.command_factory import build_command
|
||||
from galaxy import model
|
||||
from galaxy.util import DATABASE_MAX_STRING_SIZE, shrink_stream_by_size
|
||||
from galaxy.util import in_directory
|
||||
from galaxy.util import ParamsWithSpecs
|
||||
from galaxy.util import ExecutionTimer
|
||||
from galaxy.util.bunch import Bunch
|
||||
from galaxy.jobs.runners.util.job_script import write_script
|
||||
from galaxy.jobs.runners.util.job_script import job_script
|
||||
from galaxy.jobs.command_factory import build_command
|
||||
from galaxy.jobs.runners.util.env import env_to_statement
|
||||
from galaxy.jobs.runners.util.job_script import (
|
||||
job_script,
|
||||
write_script
|
||||
)
|
||||
from galaxy.util import (
|
||||
DATABASE_MAX_STRING_SIZE,
|
||||
ExecutionTimer,
|
||||
in_directory,
|
||||
ParamsWithSpecs,
|
||||
shrink_stream_by_size
|
||||
)
|
||||
from galaxy.util.bunch import Bunch
|
||||
|
||||
from .state_handler_factory import build_state_handlers
|
||||
|
||||
@@ -94,15 +100,15 @@ class BaseJobRunner(object):
|
||||
else:
|
||||
# arg should be a JobWrapper/TaskWrapper
|
||||
job_id = arg.get_id_tag()
|
||||
except:
|
||||
except Exception:
|
||||
job_id = 'unknown'
|
||||
try:
|
||||
name = method.__name__
|
||||
except:
|
||||
except Exception:
|
||||
name = 'unknown'
|
||||
try:
|
||||
method(arg)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("(%s) Unhandled exception calling %s" % (job_id, name))
|
||||
|
||||
# Causes a runner's `queue_job` method to be called from a worker thread
|
||||
@@ -366,7 +372,7 @@ class BaseJobRunner(object):
|
||||
handler(self.app, self, job_state)
|
||||
if job_state.runner_state_handled:
|
||||
break
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('Caught exception in runner state handler')
|
||||
|
||||
def fail_job(self, job_state, exception=False):
|
||||
@@ -610,14 +616,14 @@ class AsynchronousJobRunner(BaseJobRunner):
|
||||
try:
|
||||
# This should be an 8-bit exit code, but read ahead anyway:
|
||||
exit_code_str = open(job_state.exit_code_file, "r").read(32)
|
||||
except:
|
||||
except Exception:
|
||||
# By default, the exit code is 0, which typically indicates success.
|
||||
exit_code_str = "0"
|
||||
|
||||
try:
|
||||
# Decode the exit code. If it's bogus, then just use 0.
|
||||
exit_code = int(exit_code_str)
|
||||
except:
|
||||
except ValueError:
|
||||
log.warning("(%s/%s) Exit code '%s' invalid. Using 0." % (galaxy_id_tag, external_job_id, exit_code_str))
|
||||
exit_code = 0
|
||||
|
||||
@@ -628,7 +634,7 @@ class AsynchronousJobRunner(BaseJobRunner):
|
||||
|
||||
try:
|
||||
job_state.job_wrapper.finish(stdout, stderr, exit_code)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("(%s/%s) Job wrapper finish method failed" % (galaxy_id_tag, external_job_id))
|
||||
job_state.job_wrapper.fail("Unable to finish job", exception=True)
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class ShellJobRunner(AsynchronousJobRunner):
|
||||
|
||||
try:
|
||||
self.write_executable_script(ajs.job_file, script)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("(%s) failure writing job script" % galaxy_id_tag)
|
||||
job_wrapper.fail("failure preparing job script", exception=True)
|
||||
return
|
||||
|
||||
@@ -105,7 +105,7 @@ class CondorJobRunner(AsynchronousJobRunner):
|
||||
)
|
||||
try:
|
||||
self.write_executable_script(executable, script)
|
||||
except:
|
||||
except Exception:
|
||||
job_wrapper.fail("failure preparing job script", exception=True)
|
||||
log.exception("(%s) failure preparing job script" % galaxy_id_tag)
|
||||
return
|
||||
|
||||
@@ -110,7 +110,7 @@ class DRMAAJobRunner(AsynchronousJobRunner):
|
||||
"""Get any native DRM arguments specified by the site configuration"""
|
||||
try:
|
||||
return url.split('/')[2] or None
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def queue_job(self, job_wrapper):
|
||||
@@ -151,7 +151,7 @@ class DRMAAJobRunner(AsynchronousJobRunner):
|
||||
script = self.get_job_file(job_wrapper, exit_code_path=ajs.exit_code_file)
|
||||
try:
|
||||
self.write_executable_script(ajs.job_file, script)
|
||||
except:
|
||||
except Exception:
|
||||
job_wrapper.fail("failure preparing job script", exception=True)
|
||||
log.exception("(%s) failure writing job script" % galaxy_id_tag)
|
||||
return
|
||||
@@ -183,7 +183,7 @@ class DRMAAJobRunner(AsynchronousJobRunner):
|
||||
log.warning('(%s) drmaa.Session.runJob() failed, will retry: %s', galaxy_id_tag, e)
|
||||
fail_msg = "Unable to run this job due to a cluster error, please retry it later"
|
||||
time.sleep(5)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('(%s) drmaa.Session.runJob() failed unconditionally', galaxy_id_tag)
|
||||
trynum = 5
|
||||
else:
|
||||
|
||||
@@ -336,16 +336,16 @@ class GodockerJobRunner(AsynchronousJobRunner):
|
||||
job_destination = job_wrapper.job_destination
|
||||
try:
|
||||
docker_cpu = int(job_destination.params["docker_cpu"])
|
||||
except:
|
||||
except Exception:
|
||||
docker_cpu = 1
|
||||
try:
|
||||
docker_ram = int(job_destination.params["docker_memory"])
|
||||
except:
|
||||
except Exception:
|
||||
docker_ram = 1
|
||||
try:
|
||||
docker_image = self._find_container(job_wrapper).container_id
|
||||
log.debug("GoDocker runner using container %s.", docker_image)
|
||||
except:
|
||||
except Exception:
|
||||
log.error("Unable to find docker_image for job %s, failing." % job_wrapper.job_id)
|
||||
return False
|
||||
|
||||
@@ -367,7 +367,7 @@ class GodockerJobRunner(AsynchronousJobRunner):
|
||||
for i in volume:
|
||||
temp = dict({"name": i})
|
||||
volumes.append(temp)
|
||||
except:
|
||||
except Exception:
|
||||
log.debug("godocker_volume not set, using default.")
|
||||
|
||||
dt = datetime.now()
|
||||
@@ -379,7 +379,7 @@ class GodockerJobRunner(AsynchronousJobRunner):
|
||||
command = "#!/bin/bash\n" + "cd " + job_wrapper.working_directory + "\n" + venv + "\n" + job_wrapper.runner_command_line
|
||||
else:
|
||||
command = "#!/bin/bash\n" + "cd " + job_wrapper.working_directory + "\n" + job_wrapper.runner_command_line
|
||||
except:
|
||||
except Exception:
|
||||
command = "#!/bin/bash\n" + "cd " + job_wrapper.working_directory + "\n" + job_wrapper.runner_command_line
|
||||
|
||||
# GoDocker Job model schema
|
||||
|
||||
@@ -131,7 +131,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
|
||||
if "k8s_supplemental_group_id" in self.runner_params:
|
||||
try:
|
||||
return int(self.runner_params["k8s_supplemental_group_id"])
|
||||
except:
|
||||
except Exception:
|
||||
log.warning("Supplemental group passed for Kubernetes runner needs to be an integer, value "
|
||||
+ self.runner_params["k8s_supplemental_group_id"] + " passed is invalid")
|
||||
return None
|
||||
@@ -141,7 +141,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
|
||||
if "k8s_fs_group_id" in self.runner_params:
|
||||
try:
|
||||
return int(self.runner_params["k8s_fs_group_id"])
|
||||
except:
|
||||
except Exception:
|
||||
log.warning("FS group passed for Kubernetes runner needs to be an integer, value "
|
||||
+ self.runner_params["k8s_fs_group_id"] + " passed is invalid")
|
||||
return None
|
||||
|
||||
@@ -128,7 +128,7 @@ class LocalJobRunner(BaseJobRunner):
|
||||
# Finish the job!
|
||||
try:
|
||||
job_wrapper.finish(stdout, stderr, exit_code)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Job wrapper finish method failed")
|
||||
self._fail_job_local(job_wrapper, "Unable to finish job")
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ class PBSJobRunner(AsynchronousJobRunner):
|
||||
# stripping the - comes later (in parse_destination_params)
|
||||
for i, opt in enumerate(opts):
|
||||
opts[i] = '-' + opt
|
||||
except:
|
||||
except Exception:
|
||||
opts = []
|
||||
for opt in opts:
|
||||
param, value = opt.split(None, 1)
|
||||
@@ -168,7 +168,7 @@ class PBSJobRunner(AsynchronousJobRunner):
|
||||
arg = PBS_ARGMAP[arg]
|
||||
arg = arg.lstrip('-')
|
||||
args[arg] = value
|
||||
except:
|
||||
except Exception:
|
||||
log.warning('Unrecognized long argument in destination params: %s' % arg)
|
||||
return self.__args_to_attrs(args)
|
||||
|
||||
@@ -371,7 +371,7 @@ class PBSJobRunner(AsynchronousJobRunner):
|
||||
self.check_single_job(pbs_server_name, job_id)
|
||||
log.warning("(%s/%s) PBS job was not in state check list, but was found with individual state check" % (galaxy_job_id, job_id))
|
||||
new_watched.append(pbs_job_state)
|
||||
except:
|
||||
except Exception:
|
||||
errno, text = pbs.error()
|
||||
if errno == 15001:
|
||||
# 15001 == job not in queue
|
||||
@@ -525,7 +525,7 @@ class PBSJobRunner(AsynchronousJobRunner):
|
||||
pbs.pbs_deljob(c, job_id, '')
|
||||
log.debug("%s Removed from PBS queue before job completion"
|
||||
% job_tag)
|
||||
except:
|
||||
except Exception:
|
||||
e = traceback.format_exc()
|
||||
log.debug("%s Unable to stop job: %s" % (job_tag, e))
|
||||
finally:
|
||||
|
||||
@@ -104,7 +104,7 @@ class SlurmJobRunner(DRMAAJobRunner):
|
||||
try:
|
||||
self.queue_job(ajs.job_wrapper)
|
||||
return
|
||||
except:
|
||||
except Exception:
|
||||
ajs.fail_message = "This job failed due to a cluster node failure, and an attempt to resubmit the job failed."
|
||||
elif slurm_state == 'CANCELLED':
|
||||
# Check to see if the job was killed for exceeding memory consumption
|
||||
@@ -164,7 +164,7 @@ class SlurmJobRunner(DRMAAJobRunner):
|
||||
return 'This job was terminated because it used more memory than it was allocated.'
|
||||
elif any(_ in stripped_line for _ in SLURM_MEMORY_LIMIT_EXCEEDED_PARTIAL_WARNINGS):
|
||||
return 'This job was cancelled probably because it used more memory than it was allocated.'
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('Error reading end of %s:', efile_path)
|
||||
|
||||
return False
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import logging
|
||||
|
||||
from galaxy.util.submodules import submodules
|
||||
|
||||
import galaxy.jobs.runners.state_handlers
|
||||
|
||||
from galaxy.util.submodules import submodules
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class TaskedJobRunner(BaseJobRunner):
|
||||
parallelism = job_wrapper.get_parallelism()
|
||||
try:
|
||||
splitter = getattr(__import__('galaxy.jobs.splitters', globals(), locals(), [parallelism.method]), parallelism.method)
|
||||
except:
|
||||
except Exception:
|
||||
job_wrapper.change_state(model.Job.states.ERROR)
|
||||
job_wrapper.fail("Job Splitting Failed, no match for '%s'" % parallelism)
|
||||
return
|
||||
@@ -125,7 +125,7 @@ class TaskedJobRunner(BaseJobRunner):
|
||||
# Finish the job
|
||||
try:
|
||||
job_wrapper.finish(stdout, stderr, job_exit_code)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Job wrapper finish method failed")
|
||||
job_wrapper.fail("Unable to finish job", exception=True)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class Slurm(BaseJobExec):
|
||||
if not k.startswith('-'):
|
||||
k = argmap[k]
|
||||
scriptargs[k] = v
|
||||
except:
|
||||
except Exception:
|
||||
log.warning('Unrecognized long argument passed to Slurm CLI plugin: %s' % k)
|
||||
|
||||
# Generated template.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from logging import getLogger
|
||||
try:
|
||||
import xml.etree.cElementTree as et
|
||||
except:
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as et
|
||||
|
||||
try:
|
||||
|
||||
@@ -147,7 +147,7 @@ class TransferManager(object):
|
||||
# restart the transfer if socket communication fails repeatedly.
|
||||
try:
|
||||
os.kill(tj.pid, 0)
|
||||
except:
|
||||
except Exception:
|
||||
self.sa_session.refresh(tj)
|
||||
if tj.state == tj.states.RUNNING:
|
||||
log.error('Transfer job %s is marked as running but pid %s appears to be dead.' % (tj.id, tj.pid))
|
||||
|
||||
@@ -27,11 +27,11 @@ class ProvidesAppContext(object):
|
||||
action.user = user
|
||||
else:
|
||||
action.user = self.user
|
||||
except:
|
||||
except Exception:
|
||||
action.user = None
|
||||
try:
|
||||
action.session_id = self.galaxy_session.id
|
||||
except:
|
||||
except Exception:
|
||||
action.session_id = None
|
||||
self.sa_session.add(action)
|
||||
self.sa_session.flush()
|
||||
@@ -46,23 +46,23 @@ class ProvidesAppContext(object):
|
||||
event.tool_id = tool_id
|
||||
try:
|
||||
event.message = message % kwargs
|
||||
except:
|
||||
except Exception:
|
||||
event.message = message
|
||||
try:
|
||||
event.history = self.get_history()
|
||||
except:
|
||||
except Exception:
|
||||
event.history = None
|
||||
try:
|
||||
event.history_id = self.history.id
|
||||
except:
|
||||
except Exception:
|
||||
event.history_id = None
|
||||
try:
|
||||
event.user = self.user
|
||||
except:
|
||||
except Exception:
|
||||
event.user = None
|
||||
try:
|
||||
event.session_id = self.galaxy_session.id
|
||||
except:
|
||||
except Exception:
|
||||
event.session_id = None
|
||||
self.sa_session.add(event)
|
||||
self.sa_session.flush()
|
||||
|
||||
@@ -1172,7 +1172,7 @@ class DeferredJob(object):
|
||||
def set_last_check(self, seconds):
|
||||
try:
|
||||
self._last_check = int(seconds)
|
||||
except:
|
||||
except ValueError:
|
||||
self._last_check = time.time()
|
||||
last_check = property(get_last_check, set_last_check)
|
||||
|
||||
@@ -4324,7 +4324,7 @@ class FormDefinition(object, Dictifiable):
|
||||
try:
|
||||
# This field has a saved value.
|
||||
value = str(contents[field['name']])
|
||||
except:
|
||||
except Exception:
|
||||
# If there was an error getting the saved value, we'll still
|
||||
# display the widget, but it will be empty.
|
||||
if field_type == 'AddressField':
|
||||
|
||||
@@ -291,10 +291,10 @@ class MetadataType(JSONType):
|
||||
ret = metadata_pickler.loads(str(value))
|
||||
if ret:
|
||||
ret = dict(ret.__dict__)
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
ret = json_decoder.decode(str(_sniffnfix_pg9_hex(value)))
|
||||
except:
|
||||
except Exception:
|
||||
ret = None
|
||||
return ret
|
||||
|
||||
|
||||
@@ -2534,7 +2534,7 @@ def db_next_hid(self, n=1):
|
||||
table.update(table.c.id == self.id).execute(hid_counter=(next_hid + n))
|
||||
trans.commit()
|
||||
return next_hid
|
||||
except:
|
||||
except Exception:
|
||||
trans.rollback()
|
||||
raise
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class MetadataCollection(object):
|
||||
def get(self, key, default=None):
|
||||
try:
|
||||
return self.__getattr__(key) or default
|
||||
except:
|
||||
except Exception:
|
||||
return default
|
||||
|
||||
def items(self):
|
||||
|
||||
@@ -36,7 +36,7 @@ def create_or_verify_database(url, galaxy_config_file, engine_options={}, app=No
|
||||
try:
|
||||
# Declare the database to be under a repository's version control
|
||||
db_schema = schema.ControlledSchema.create(engine, migrate_repository)
|
||||
except:
|
||||
except Exception:
|
||||
# The database is already under version control
|
||||
db_schema = schema.ControlledSchema(engine, migrate_repository)
|
||||
# Apply all scripts to get to current version
|
||||
|
||||
@@ -692,7 +692,7 @@ def __guess_dataset_by_filename(filename):
|
||||
if fields:
|
||||
if fields[-1].startswith('dataset_') and fields[-1].endswith('.dat'): # dataset_%d.dat
|
||||
return Dataset.get(int(fields[-1][len('dataset_'): -len('.dat')]))
|
||||
except:
|
||||
except Exception:
|
||||
pass # some parsing error, we can't guess Dataset
|
||||
return None
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ def upgrade(migrate_engine):
|
||||
i = Index("ix_page_slug", Page_table.c.slug, unique=False)
|
||||
i.create()
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
|
||||
# Mysql doesn't have a named index, but alter should work
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ def upgrade(migrate_engine):
|
||||
try:
|
||||
i = Index("ix_stored_workflow_slug", StoredWorkflow_table.c.slug, mysql_length=200)
|
||||
i.create()
|
||||
except:
|
||||
except Exception:
|
||||
# Mysql doesn't have a named index, but alter should work
|
||||
StoredWorkflow_table.c.slug.alter(unique=False)
|
||||
|
||||
|
||||
+3
-3
@@ -31,7 +31,7 @@ def upgrade(migrate_engine):
|
||||
try:
|
||||
i = Index("ix_history_published", History_table.c.published)
|
||||
i.create()
|
||||
except:
|
||||
except Exception:
|
||||
# Mysql doesn't have a named index, but alter should work
|
||||
History_table.c.published.alter(unique=False)
|
||||
|
||||
@@ -49,7 +49,7 @@ def upgrade(migrate_engine):
|
||||
try:
|
||||
i = Index("ix_stored_workflow_published", StoredWorkflow_table.c.published)
|
||||
i.create()
|
||||
except:
|
||||
except Exception:
|
||||
# Mysql doesn't have a named index, but alter should work
|
||||
StoredWorkflow_table.c.published.alter(unique=False)
|
||||
|
||||
@@ -67,7 +67,7 @@ def upgrade(migrate_engine):
|
||||
try:
|
||||
i = Index("ix_page_importable", Page_table.c.importable)
|
||||
i.create()
|
||||
except:
|
||||
except Exception:
|
||||
# Mysql doesn't have a named index, but alter should work
|
||||
Page_table.c.importable.alter(unique=False)
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ def upgrade(migrate_engine):
|
||||
for table in tables:
|
||||
try:
|
||||
table.create()
|
||||
except:
|
||||
except Exception:
|
||||
log.warning("Failed to create table '%s', ignoring (might result in wrong schema)" % table.name)
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ def upgrade(migrate_engine):
|
||||
t = Table(table_name, metadata, autoload=True)
|
||||
t.drop()
|
||||
metadata.remove(t)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Failed to drop table '%s', ignoring (might result in wrong schema)" % table_name)
|
||||
|
||||
# 2) Readd
|
||||
@@ -46,7 +46,7 @@ def upgrade(migrate_engine):
|
||||
for table in [WorkflowInvocation_table, WorkflowInvocationStep_table]:
|
||||
try:
|
||||
table.create()
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Failed to create table '%s', ignoring (might result in wrong schema)" % table.name)
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ def upgrade(migrate_engine):
|
||||
for table in tables:
|
||||
try:
|
||||
table.create()
|
||||
except:
|
||||
except Exception:
|
||||
log.warning("Failed to create table '%s', ignoring (might result in wrong schema)" % table.name)
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ def upgrade(migrate_engine):
|
||||
for table in tables:
|
||||
try:
|
||||
table.create()
|
||||
except:
|
||||
except Exception:
|
||||
log.warning("Failed to create table '%s', ignoring (might result in wrong schema)" % table.name)
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ def upgrade(migrate_engine):
|
||||
# Encoding errors? Just to be safe.
|
||||
print("Attempting to fix row %s" % row['id'])
|
||||
print("Prior to replacement: %s" % field_values_str)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
field_values_dict = {}
|
||||
# look for each field name in the values and extract its value (string)
|
||||
@@ -77,7 +77,7 @@ def upgrade(migrate_engine):
|
||||
migrate_engine.execute(cmd)
|
||||
try:
|
||||
print("Post replacement: %s" % json_values)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if corrupted_rows:
|
||||
print('Fixed %i corrupted rows.' % corrupted_rows)
|
||||
|
||||
@@ -13,7 +13,7 @@ def upgrade(migrate_engine):
|
||||
user = Table('galaxy_user', meta, autoload=True)
|
||||
try:
|
||||
user.c.password.alter(type=String(255))
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Altering password column failed")
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ def create_or_verify_database(url, engine_options={}, app=None):
|
||||
try:
|
||||
# Declare the database to be under a repository's version control
|
||||
db_schema = schema.ControlledSchema.create(engine, migrate_repository)
|
||||
except:
|
||||
except Exception:
|
||||
# The database is already under version control
|
||||
db_schema = schema.ControlledSchema(engine, migrate_repository)
|
||||
# Apply all scripts to get to current version
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import os
|
||||
import logging
|
||||
from galaxy.util.odict import odict
|
||||
from galaxy import util, model
|
||||
from galaxy.forms.forms import form_factory
|
||||
import os
|
||||
|
||||
from galaxy import (
|
||||
model,
|
||||
util
|
||||
)
|
||||
from galaxy.external_services.service import ExternalServiceActionsGroup
|
||||
from galaxy.forms.forms import form_factory
|
||||
from galaxy.sample_tracking.data_transfer import data_transfer_factories
|
||||
from galaxy.util.odict import odict
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -20,7 +25,7 @@ class ExternalServiceTypesCollection(object):
|
||||
self.app = app
|
||||
try:
|
||||
self.load_all(config_filename)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("ExternalServiceTypesCollection error reading %s", config_filename)
|
||||
|
||||
def load_all(self, config_filename):
|
||||
@@ -37,7 +42,7 @@ class ExternalServiceTypesCollection(object):
|
||||
log.debug("Loaded external_service_type: %s %s" % (external_service_type.name, external_service_type.config_version))
|
||||
if visible:
|
||||
self.visible_external_service_types.append(external_service_type.id)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("error reading external_service_type from path: %s", file_path)
|
||||
|
||||
def load_external_service_type(self, config_file, visible=True):
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
RequestType
|
||||
"""
|
||||
from galaxy.model import RequestType
|
||||
from sample import sample_state_factory
|
||||
|
||||
from .sample import sample_state_factory
|
||||
|
||||
RENAME_DATASET_OPTIONS = dict([(f_type.lower(), f_descript) for f_type, f_descript in RequestType.rename_dataset_options.items()])
|
||||
|
||||
|
||||
@@ -794,7 +794,7 @@ class Tool(object, Dictifiable):
|
||||
if tests_source:
|
||||
try:
|
||||
self.__tests = parse_tests(self, tests_source)
|
||||
except:
|
||||
except Exception:
|
||||
self.__tests = None
|
||||
log.exception("Failed to parse tool tests")
|
||||
else:
|
||||
@@ -1011,7 +1011,7 @@ class Tool(object, Dictifiable):
|
||||
group.cases.append(case)
|
||||
try:
|
||||
possible_cases.remove(case.value)
|
||||
except:
|
||||
except Exception:
|
||||
log.warning("Tool %s: a when tag has been defined for '%s (%s) --> %s', but does not appear to be selectable." %
|
||||
(self.id, group.name, group.test_param.name, case.value))
|
||||
for unspecified_case in possible_cases:
|
||||
@@ -1131,8 +1131,8 @@ class Tool(object, Dictifiable):
|
||||
self.__help = Template(rst_to_html(help_text), input_encoding='utf-8',
|
||||
output_encoding='utf-8', default_filters=['decode.utf8'],
|
||||
encoding_errors='replace')
|
||||
except:
|
||||
log.exception("error in help for tool %s", self.name)
|
||||
except Exception:
|
||||
log.exception("Exception while parsing help for tool with id '%s'", self.id)
|
||||
|
||||
# Handle deprecated multi-page help text in XML case.
|
||||
if hasattr(tool_source, "root"):
|
||||
@@ -1151,8 +1151,8 @@ class Tool(object, Dictifiable):
|
||||
default_filters=['decode.utf8'],
|
||||
encoding_errors='replace')
|
||||
for x in self.__help_by_page]
|
||||
except:
|
||||
log.exception("error in multi-page help for tool %s", self.name)
|
||||
except Exception:
|
||||
log.exception("Exception while parsing multi-page help for tool with id '%s'", self.id)
|
||||
# Pad out help pages to match npages ... could this be done better?
|
||||
while len(self.__help_by_page) < self.npages:
|
||||
self.__help_by_page.append(self.__help)
|
||||
@@ -1422,7 +1422,7 @@ class Tool(object, Dictifiable):
|
||||
if not prefixed_name.startswith('__'):
|
||||
messages[prefixed_name] = error if previous_value == value else '%s Using default: \'%s\'.' % (error, value)
|
||||
parent[input.name] = value
|
||||
except:
|
||||
except Exception:
|
||||
messages[prefixed_name] = 'Attempt to replace invalid value for \'%s\' failed.' % (prefixed_label)
|
||||
else:
|
||||
messages[prefixed_name] = error
|
||||
|
||||
@@ -542,7 +542,7 @@ class DefaultToolAction(object):
|
||||
try:
|
||||
# For backward compatibility, some tools may not have versions yet.
|
||||
job.tool_version = tool.version
|
||||
except:
|
||||
except AttributeError:
|
||||
job.tool_version = "1.0.0"
|
||||
return job, galaxy_session
|
||||
|
||||
@@ -837,7 +837,7 @@ def determine_output_format(output, parameter_context, input_datasets, input_dat
|
||||
check = '${%s}' % check
|
||||
if str(fill_template(check, context=parameter_context)) == when_elem.get('value', None):
|
||||
ext = when_elem.get('format', ext)
|
||||
except: # bad tag input value; possibly referencing a param within a different conditional when block or other nonexistent grouping construct
|
||||
except Exception: # bad tag input value; possibly referencing a param within a different conditional when block or other nonexistent grouping construct
|
||||
continue
|
||||
else:
|
||||
check = when_elem.get('input_dataset', None)
|
||||
|
||||
@@ -60,7 +60,7 @@ class SetMetadataToolAction(ToolAction):
|
||||
try:
|
||||
# For backward compatibility, some tools may not have versions yet.
|
||||
job.tool_version = tool.version
|
||||
except:
|
||||
except AttributeError:
|
||||
job.tool_version = "1.0.1"
|
||||
job.state = job.states.WAITING # we need to set job state to something other than NEW, or else when tracking jobs in db it will be picked up before we have added input / output parameters
|
||||
job.set_handler(tool.get_job_handler(job_params))
|
||||
|
||||
@@ -176,7 +176,7 @@ def get_precreated_datasets(trans, params, data_obj, controller='root'):
|
||||
for id in async_datasets:
|
||||
try:
|
||||
data = trans.sa_session.query(data_obj).get(int(id))
|
||||
except:
|
||||
except Exception:
|
||||
log.exception('Unable to load precreated dataset (%s) sent in upload form' % id)
|
||||
continue
|
||||
if data_obj is trans.app.model.HistoryDatasetAssociation:
|
||||
|
||||
@@ -54,7 +54,7 @@ class UnlinkedToolShedPackageDependencyResolver(BaseGalaxyPackageDependencyResol
|
||||
else:
|
||||
# Pick the preferred one
|
||||
return self._select_preferred_dependency(possibles).dependency
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Unexpected error hunting for dependency '%s' '%s''%s'", name, version, type)
|
||||
return NullDependency(version=version, name=name)
|
||||
|
||||
@@ -126,7 +126,7 @@ class UnlinkedToolShedPackageDependencyResolver(BaseGalaxyPackageDependencyResol
|
||||
else:
|
||||
#Pick the preferred one
|
||||
return self._select_preferred_dependency(possibles, by_owner=False).dependency
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Unexpected error hunting for dependency '%s' default '%s'", name, type)
|
||||
return NullDependency(version=None, name=name)
|
||||
"""
|
||||
|
||||
@@ -244,7 +244,7 @@ class JobImportHistoryArchiveWrapper(object, UsesAnnotations):
|
||||
try:
|
||||
imported_job.create_time = datetime.datetime.strptime(job_attrs["create_time"], "%Y-%m-%dT%H:%M:%S.%f")
|
||||
imported_job.update_time = datetime.datetime.strptime(job_attrs["update_time"], "%Y-%m-%dT%H:%M:%S.%f")
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
self.sa_session.add(imported_job)
|
||||
self.sa_session.flush()
|
||||
@@ -485,7 +485,7 @@ class JobExportHistoryArchiveWrapper(object, UsesAnnotations):
|
||||
# Get the job's parameters
|
||||
try:
|
||||
params_objects = job.get_param_values(trans.app)
|
||||
except:
|
||||
except Exception:
|
||||
# Could not get job params.
|
||||
continue
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ def visit_input_values(inputs, input_values, callback, name_prefix='', label_pre
|
||||
case_error = None
|
||||
try:
|
||||
input.get_current_case(values[input.test_param.name])
|
||||
except:
|
||||
except Exception:
|
||||
case_error = 'The selected case is unavailable/invalid.'
|
||||
pass
|
||||
callback_helper(input.test_param, values, new_name_prefix, label_prefix, parent_prefix=name_prefix, context=context, error=case_error)
|
||||
|
||||
@@ -153,7 +153,7 @@ class ToolParameter(object, Dictifiable):
|
||||
if ignore_errors:
|
||||
try:
|
||||
return self.to_python(value, app)
|
||||
except:
|
||||
except Exception:
|
||||
return value
|
||||
else:
|
||||
return self.to_python(value, app)
|
||||
@@ -313,7 +313,7 @@ class IntegerToolParameter(TextToolParameter):
|
||||
if self.value:
|
||||
try:
|
||||
int(self.value)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValueError("An integer is required")
|
||||
elif self.value is None and not self.optional:
|
||||
raise ValueError("The settings for the field named '%s' require a 'value' setting and optionally a default value which must be an integer" % self.name)
|
||||
@@ -322,12 +322,12 @@ class IntegerToolParameter(TextToolParameter):
|
||||
if self.min:
|
||||
try:
|
||||
self.min = int(self.min)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValueError("An integer is required")
|
||||
if self.max:
|
||||
try:
|
||||
self.max = int(self.max)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValueError("An integer is required")
|
||||
if self.min is not None or self.max is not None:
|
||||
self.validators.append(validation.InRangeValidator(None, self.min, self.max))
|
||||
@@ -335,7 +335,7 @@ class IntegerToolParameter(TextToolParameter):
|
||||
def from_json(self, value, trans, other_values={}):
|
||||
try:
|
||||
return int(value)
|
||||
except:
|
||||
except (TypeError, ValueError):
|
||||
if contains_workflow_parameter(value) and trans.workflow_building_mode is workflow_building_modes.ENABLED:
|
||||
return value
|
||||
if not value and self.optional:
|
||||
@@ -348,7 +348,7 @@ class IntegerToolParameter(TextToolParameter):
|
||||
def to_python(self, value, app):
|
||||
try:
|
||||
return int(value)
|
||||
except Exception as err:
|
||||
except (TypeError, ValueError) as err:
|
||||
if contains_workflow_parameter(value):
|
||||
return value
|
||||
if not value and self.optional:
|
||||
@@ -391,19 +391,19 @@ class FloatToolParameter(TextToolParameter):
|
||||
if self.value:
|
||||
try:
|
||||
float(self.value)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValueError("A real number is required")
|
||||
elif self.value is None and not self.optional:
|
||||
raise ValueError("The settings for this field require a 'value' setting and optionally a default value which must be a real number")
|
||||
if self.min:
|
||||
try:
|
||||
self.min = float(self.min)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValueError("A real number is required")
|
||||
if self.max:
|
||||
try:
|
||||
self.max = float(self.max)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValueError("A real number is required")
|
||||
if self.min is not None or self.max is not None:
|
||||
self.validators.append(validation.InRangeValidator(None, self.min, self.max))
|
||||
@@ -411,7 +411,7 @@ class FloatToolParameter(TextToolParameter):
|
||||
def from_json(self, value, trans, other_values={}):
|
||||
try:
|
||||
return float(value)
|
||||
except:
|
||||
except (TypeError, ValueError):
|
||||
if contains_workflow_parameter(value) and trans.workflow_building_mode is workflow_building_modes.ENABLED:
|
||||
return value
|
||||
if not value and self.optional:
|
||||
@@ -424,7 +424,7 @@ class FloatToolParameter(TextToolParameter):
|
||||
def to_python(self, value, app):
|
||||
try:
|
||||
return float(value)
|
||||
except Exception as err:
|
||||
except (TypeError, ValueError) as err:
|
||||
if contains_workflow_parameter(value):
|
||||
return value
|
||||
if not value and self.optional:
|
||||
@@ -434,7 +434,7 @@ class FloatToolParameter(TextToolParameter):
|
||||
def get_initial_value(self, trans, other_values):
|
||||
try:
|
||||
return float(self.value)
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
@@ -542,7 +542,7 @@ class FileToolParameter(ToolParameter):
|
||||
# or should we jsonify?
|
||||
try:
|
||||
return value['local_filename']
|
||||
except:
|
||||
except KeyError:
|
||||
return None
|
||||
raise Exception("FileToolParameter cannot be persisted")
|
||||
|
||||
@@ -1147,7 +1147,7 @@ class ColumnListParameter(SelectToolParameter):
|
||||
if len(dataset.metadata.column_types) >= len(cnames):
|
||||
numerics = [i for i, x in enumerate(dataset.metadata.column_types) if x in ['int', 'float']]
|
||||
column_list = [column_list[i] for i in numerics]
|
||||
except:
|
||||
except Exception:
|
||||
column_list = self.get_column_list(trans, other_values)
|
||||
else:
|
||||
column_list = self.get_column_list(trans, other_values)
|
||||
@@ -1582,12 +1582,12 @@ class DataToolParameter(BaseDataToolParameter):
|
||||
if self.min:
|
||||
try:
|
||||
self.min = int(self.min)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValueError("An integer is required for min property.")
|
||||
if self.max:
|
||||
try:
|
||||
self.max = int(self.max)
|
||||
except:
|
||||
except ValueError:
|
||||
raise ValueError("An integer is required for max property.")
|
||||
if not self.multiple and (self.min is not None):
|
||||
raise ValueError("Cannot specify min property on single data parameter '%s'. Set multiple=\"true\" to enable this option." % self.name)
|
||||
@@ -1696,7 +1696,7 @@ class DataToolParameter(BaseDataToolParameter):
|
||||
if value:
|
||||
try:
|
||||
return ", ".join(["%s: %s" % (item.hid, item.name) for item in value])
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return "No dataset."
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class StaticValueFilter(Filter):
|
||||
filter_value = self.value
|
||||
try:
|
||||
filter_value = User.expand_user_properties(trans.user, filter_value)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
for fields in options:
|
||||
if (self.keep and fields[self.column] == filter_value) or (not self.keep and fields[self.column] != filter_value):
|
||||
|
||||
@@ -322,7 +322,7 @@ class UploadDataset(Group):
|
||||
if not dataset_name and 'filename' in data_file:
|
||||
dataset_name = get_file_name(data_file['filename'])
|
||||
return Bunch(type='file', path=data_file['local_filename'], name=dataset_name, purge_source=purge)
|
||||
except:
|
||||
except Exception:
|
||||
# The uploaded file should've been persisted by the upload tool action
|
||||
return Bunch(type=None, path=None, name=None)
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ class MetadataInDataTableColumnValidator(Validator):
|
||||
metadata_column = elem.get("metadata_column", 0)
|
||||
try:
|
||||
metadata_column = int(metadata_column)
|
||||
except:
|
||||
except ValueError:
|
||||
pass
|
||||
message = elem.get("message", "Value for metadata %s was not found in %s." % (metadata_name, table_name))
|
||||
line_startswith = elem.get("line_startswith", None)
|
||||
|
||||
@@ -544,7 +544,7 @@ class BooleanFilter(ToolOutputActionOptionFilter):
|
||||
try:
|
||||
value = fields[self.column]
|
||||
value = self.cast(value)
|
||||
except:
|
||||
except Exception:
|
||||
value = False # unable to cast or access value; treat as false
|
||||
if self.keep == bool(value):
|
||||
rval.append(fields)
|
||||
|
||||
@@ -726,7 +726,7 @@ class StdioParser(object):
|
||||
else:
|
||||
try:
|
||||
exit_code.range_start = int(code_range)
|
||||
except:
|
||||
except Exception:
|
||||
log.error(code_range)
|
||||
log.warning("Invalid range start for tool's exit_code %s: exit_code ignored" % code_range)
|
||||
continue
|
||||
|
||||
@@ -655,7 +655,7 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin, object):
|
||||
panel_dict[key] = workflow
|
||||
# Always load workflows into the integrated_panel_dict.
|
||||
integrated_panel_dict.update_or_append(index, key, workflow)
|
||||
except:
|
||||
except Exception:
|
||||
log.exception("Error loading workflow: %s", workflow_id)
|
||||
|
||||
def _load_label_tag_set(self, item, panel_dict, integrated_panel_dict, load_panel_dict, index=None):
|
||||
|
||||
@@ -168,7 +168,7 @@ class RegionAlignment(object):
|
||||
for name in skip:
|
||||
try:
|
||||
names.remove(name)
|
||||
except:
|
||||
except ValueError:
|
||||
pass
|
||||
return names
|
||||
|
||||
@@ -295,7 +295,7 @@ def maf_index_by_uid(maf_uid, index_location_file):
|
||||
return bx.align.maf.MultiIndexed(maf_files, keep_open=True, parse_e_rows=False)
|
||||
except Exception as e:
|
||||
raise Exception('MAF UID (%s) found, but configuration appears to be malformed: %s' % (maf_uid, e))
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
|
||||
@@ -304,7 +304,7 @@ def maf_index_by_uid(maf_uid, index_location_file):
|
||||
def open_or_build_maf_index(maf_file, index_filename, species=None):
|
||||
try:
|
||||
return (bx.align.maf.Indexed(maf_file, index_filename=index_filename, keep_open=True, parse_e_rows=False), None)
|
||||
except:
|
||||
except Exception:
|
||||
return build_maf_index(maf_file, species=species)
|
||||
|
||||
|
||||
@@ -675,7 +675,7 @@ def parse_species_option(species):
|
||||
def remove_temp_index_file(index_filename):
|
||||
try:
|
||||
os.unlink(index_filename)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Below are methods to deal with FASTA files
|
||||
@@ -713,7 +713,7 @@ def get_attributes_from_fasta_header(header):
|
||||
region = region[1].lstrip(':').split('-')
|
||||
attributes['start'] = int(region[0])
|
||||
attributes['end'] = int(region[1])
|
||||
except:
|
||||
except Exception:
|
||||
# fields 0 is not a region coordinate
|
||||
pass
|
||||
if len(fields) > 2:
|
||||
|
||||
@@ -60,7 +60,7 @@ class RawObjectWrapper(ToolParameterValueWrapper):
|
||||
def __str__(self):
|
||||
try:
|
||||
return "%s:%s" % (self.obj.__module__, self.obj.__class__.__name__)
|
||||
except:
|
||||
except Exception:
|
||||
# Most likely None, which lacks __module__.
|
||||
return str(self.obj)
|
||||
|
||||
@@ -212,7 +212,7 @@ class DatasetFilenameWrapper(ToolParameterValueWrapper):
|
||||
def get(self, key, default=None):
|
||||
try:
|
||||
return getattr(self, key)
|
||||
except:
|
||||
except Exception:
|
||||
return default
|
||||
|
||||
def items(self):
|
||||
@@ -223,7 +223,7 @@ class DatasetFilenameWrapper(ToolParameterValueWrapper):
|
||||
try:
|
||||
# TODO: allow this to work when working with grouping
|
||||
ext = tool.inputs[name].extensions[0]
|
||||
except:
|
||||
except Exception:
|
||||
ext = 'data'
|
||||
self.dataset = wrap_with_safe_string(NoneDataset(datatypes_registry=datatypes_registry, ext=ext), no_wrap_classes=ToolParameterValueWrapper)
|
||||
else:
|
||||
|
||||
+11
-11
@@ -311,11 +311,11 @@ def get_file_size(value, default=None):
|
||||
try:
|
||||
# try built-in
|
||||
return os.path.getsize(value)
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
# try built-in one name attribute
|
||||
return os.path.getsize(value.name)
|
||||
except:
|
||||
except Exception:
|
||||
try:
|
||||
# try tell() of end of object
|
||||
offset = value.tell()
|
||||
@@ -323,7 +323,7 @@ def get_file_size(value, default=None):
|
||||
rval = value.tell()
|
||||
value.seek(offset)
|
||||
return rval
|
||||
except:
|
||||
except Exception:
|
||||
# return default value
|
||||
return default
|
||||
|
||||
@@ -1029,7 +1029,7 @@ def read_dbnames(filename):
|
||||
try: # manual build (i.e. microbes)
|
||||
int(fields[0])
|
||||
man_builds.append((fields[1], fields[0]))
|
||||
except: # UCSC build
|
||||
except Exception: # UCSC build
|
||||
db_base = fields[0].rstrip('0123456789')
|
||||
if db_base not in ucsc_builds:
|
||||
ucsc_builds[db_base] = []
|
||||
@@ -1038,10 +1038,10 @@ def read_dbnames(filename):
|
||||
build_rev = re.compile(r'\d+$')
|
||||
try:
|
||||
build_rev = int(build_rev.findall(fields[0])[0])
|
||||
except:
|
||||
except Exception:
|
||||
build_rev = 0
|
||||
ucsc_builds[db_base].append((build_rev, fields[0], fields[1]))
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
sort_names = sorted(name_to_db_base.keys())
|
||||
for name in sort_names:
|
||||
@@ -1079,9 +1079,9 @@ def read_build_sites(filename, check_builds=True):
|
||||
else:
|
||||
site_dict = {'name': site_name, 'url': site}
|
||||
build_sites.append(site_dict)
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
except:
|
||||
except Exception:
|
||||
log.error("ERROR: Unable to read builds for site file %s", filename)
|
||||
return build_sites
|
||||
|
||||
@@ -1171,7 +1171,7 @@ def umask_fix_perms(path, umask, unmasked_perms, gid=None):
|
||||
try:
|
||||
desired_group = grp.getgrgid(gid)
|
||||
current_group = grp.getgrgid(st.st_gid)
|
||||
except:
|
||||
except Exception:
|
||||
desired_group = gid
|
||||
current_group = st.st_gid
|
||||
log.warning('Unable to honor primary group (%s) for %s, group remains %s, error was: %s' % (desired_group,
|
||||
@@ -1227,7 +1227,7 @@ def nice_size(size):
|
||||
if size < 0:
|
||||
size = abs(size)
|
||||
prefix = '-'
|
||||
except:
|
||||
except Exception:
|
||||
return '??? bytes'
|
||||
for ind, word in enumerate(words):
|
||||
step = 1024 ** (ind + 1)
|
||||
@@ -1246,7 +1246,7 @@ def size_to_bytes(size):
|
||||
# Assume input in bytes if we can convert directly to an int
|
||||
try:
|
||||
return int(size)
|
||||
except:
|
||||
except ValueError:
|
||||
pass
|
||||
# Otherwise it must have non-numeric characters
|
||||
size_re = re.compile('([\d\.]+)\s*([tgmk]b?|b|bytes?)$')
|
||||
|
||||
@@ -71,7 +71,7 @@ def check_gzip(file_path, check_content=True):
|
||||
temp.close()
|
||||
if magic_check != util.gzip_magic:
|
||||
return (False, False)
|
||||
except:
|
||||
except Exception:
|
||||
return (False, False)
|
||||
# We support some binary data types, so check if the compressed binary file is valid
|
||||
# If the file is Bam, it should already have been detected as such, so we'll just check
|
||||
@@ -80,7 +80,7 @@ def check_gzip(file_path, check_content=True):
|
||||
header = gzip.open(file_path).read(4)
|
||||
if header == b'.sff':
|
||||
return (True, True)
|
||||
except:
|
||||
except Exception:
|
||||
return(False, False)
|
||||
|
||||
if not check_content:
|
||||
@@ -103,7 +103,7 @@ def check_bz2(file_path, check_content=True):
|
||||
temp.close()
|
||||
if magic_check != util.bz2_magic:
|
||||
return (False, False)
|
||||
except:
|
||||
except Exception:
|
||||
return(False, False)
|
||||
|
||||
if not check_content:
|
||||
|
||||
@@ -23,7 +23,7 @@ class Dictifiable:
|
||||
# first and then default to to_dict?
|
||||
try:
|
||||
return item.to_dict(view=view, value_mapper=value_mapper)
|
||||
except:
|
||||
except Exception:
|
||||
if key in value_mapper:
|
||||
return value_mapper.get(key)(item)
|
||||
if type(item) == datetime.datetime:
|
||||
|
||||
@@ -44,7 +44,7 @@ def hmac_new(key, value):
|
||||
def is_hashable(value):
|
||||
try:
|
||||
hash(value)
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class Heartbeat(threading.Thread):
|
||||
self.file.write("End dump\n\n")
|
||||
self.file.flush()
|
||||
self.print_nonsleeping(threads)
|
||||
except:
|
||||
except Exception:
|
||||
self.file.write("Caught exception attempting to dump thread states:")
|
||||
traceback.print_exc(None, self.file)
|
||||
self.file.write("\n")
|
||||
|
||||
@@ -9,7 +9,7 @@ try:
|
||||
except ImportError:
|
||||
try:
|
||||
from PIL import Image as PIL
|
||||
except:
|
||||
except ImportError:
|
||||
PIL = None
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -22,7 +22,7 @@ def image_type(filename):
|
||||
im = PIL.open(filename)
|
||||
fmt = im.format
|
||||
im.close()
|
||||
except:
|
||||
except Exception:
|
||||
# We continue to try with imghdr, so this is a rare case of an
|
||||
# exception we expect to happen frequently, so we're not logging
|
||||
pass
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user