Skip to content

Commit

Permalink
Merge branch 'release_20.01' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Feb 24, 2020
2 parents f9b99fc + 41876b0 commit 6622ad1
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 200 deletions.
349 changes: 168 additions & 181 deletions lib/galaxy/datatypes/interval.py

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions lib/galaxy/jobs/dynamic_tool_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ def get_keys_from_dict(dl, keys_list):
"""
This function builds a list using the keys from nest dictionaries
"""
assert isinstance(keys_list, list)
if isinstance(dl, dict):
keys_list += list(dl.keys())
list(map(lambda x: get_keys_from_dict(x, keys_list), dl.values()))
keys_list.extend(dl.keys())
for x in dl.values():
get_keys_from_dict(x, keys_list)
elif isinstance(dl, list):
list(map(lambda x: get_keys_from_dict(x, keys_list), dl))
for x in dl:
get_keys_from_dict(x, keys_list)


class RuleValidator(object):
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/managers/sharable.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def share_with(self, item, user, flush=True):
# precondition: user has been validated
# allow user to be a list and call recursivly
if isinstance(user, list):
return list(map(lambda user: self.share_with(item, user, flush=False), user))
return [self.share_with(item, _, flush=False) for _ in user]
# get or create
existing = self.get_share_assocs(item, user=user)
if existing:
Expand Down Expand Up @@ -181,7 +181,7 @@ def unshare_with(self, item, user, flush=True):
Delete a user share (or list of shares) from the database.
"""
if isinstance(user, list):
return list(map(lambda user: self.unshare_with(item, user, flush=False), user))
return [self.unshare_with(item, _, flush=False) for _ in user]
# Look for and delete sharing relation for user.
user_share_assoc = self.get_share_assocs(item, user=user)[0]
self.session().delete(user_share_assoc)
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/tool_util/verify/interactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def to_dict(self):
return {
"inputs": inputs_dict,
"outputs": self.outputs,
"output_collections": list(map(lambda o: o.to_dict(), self.output_collections)),
"output_collections": [_.to_dict() for _ in self.output_collections],
"num_outputs": self.num_outputs,
"command_line": self.command_line,
"command_version": self.command_version,
Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2638,7 +2638,8 @@ def check_dataset_instance(input_dataset):
if not input_dataset_collection.collection.populated:
raise ToolInputsNotReadyException("An input collection is not populated.")

list(map(check_dataset_instance, input_dataset_collection.dataset_instances))
for dataset_instance in input_dataset_collection.dataset_instances:
check_dataset_instance(dataset_instance)

def _add_datasets_to_history(self, history, elements, datasets_visible=False):
datasets = []
Expand Down
16 changes: 13 additions & 3 deletions lib/galaxy/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from datetime import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from functools import partial
from hashlib import md5
from os.path import relpath
from xml.etree import ElementInclude, ElementTree
Expand Down Expand Up @@ -191,6 +192,14 @@ def caller(*params, **kparams):
return caller


def iter_start_of_line(fh, chunk_size=None):
"""
Iterate over fh and call readline(chunk_size)
"""
for line in iter(partial(fh.readline, chunk_size), ""):
yield line


def file_iter(fname, sep=None):
"""
This generator iterates over a file and yields its lines
Expand All @@ -201,9 +210,10 @@ def file_iter(fname, sep=None):
>>> len(lines) != 0
True
"""
for line in open(fname):
if line and line[0] != '#':
yield line.split(sep)
with open(fname) as fh:
for line in fh:
if line and line[0] != '#':
yield line.split(sep)


def file_reader(fp, chunk_size=CHUNK_SIZE):
Expand Down
8 changes: 4 additions & 4 deletions lib/galaxy/webapps/reports/controllers/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ def filter(self, trans, user, query, column_filter):
# We are either filtering on a date like YYYY-MM-DD or on a month like YYYY-MM,
# so we need to figure out which type of date we have
if column_filter.count('-') == 2: # We are filtering on a date like YYYY-MM-DD
year, month, day = list(map(int, column_filter.split("-")))
year, month, day = map(int, column_filter.split("-"))
start_date = date(year, month, day)
end_date = start_date + timedelta(days=1)
if column_filter.count('-') == 1: # We are filtering on a month like YYYY-MM
year, month = list(map(int, column_filter.split("-")))
year, month = map(int, column_filter.split("-"))
start_date = date(year, month, 1)
end_date = start_date + timedelta(days=calendar.monthrange(year, month)[1])

Expand Down Expand Up @@ -371,7 +371,7 @@ def specified_month_all(self, trans, **kwd):
specified_date = kwd.get('specified_date', datetime.utcnow().strftime("%Y-%m-%d"))
specified_month = specified_date[:7]

year, month = list(map(int, specified_month.split("-")))
year, month = map(int, specified_month.split("-"))
start_date = date(year, month, 1)
end_date = start_date + timedelta(days=calendar.monthrange(year, month)[1])
month_label = start_date.strftime("%B")
Expand Down Expand Up @@ -472,7 +472,7 @@ def specified_month_in_error(self, trans, **kwd):
# If specified_date is not received, we'll default to the current month
specified_date = kwd.get('specified_date', datetime.utcnow().strftime("%Y-%m-%d"))
specified_month = specified_date[:7]
year, month = list(map(int, specified_month.split("-")))
year, month = map(int, specified_month.split("-"))
start_date = date(year, month, 1)
end_date = start_date + timedelta(days=calendar.monthrange(year, month)[1])
month_label = start_date.strftime("%B")
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/webapps/reports/controllers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def specified_month(self, trans, **kwd):
# If specified_date is not received, we'll default to the current month
specified_date = kwd.get('specified_date', datetime.utcnow().strftime("%Y-%m-%d"))
specified_month = specified_date[:7]
year, month = list(map(int, specified_month.split("-")))
year, month = map(int, specified_month.split("-"))
start_date = date(year, month, 1)
end_date = start_date + timedelta(days=calendar.monthrange(year, month)[1])
month_label = start_date.strftime("%B")
Expand Down Expand Up @@ -91,7 +91,7 @@ def specified_date(self, trans, **kwd):
message = escape(util.restore_text(kwd.get('message', '')))
# If specified_date is not received, we'll default to the current month
specified_date = kwd.get('specified_date', datetime.utcnow().strftime("%Y-%m-%d"))
year, month, day = list(map(int, specified_date.split("-")))
year, month, day = map(int, specified_date.split("-"))
start_date = date(year, month, day)
end_date = start_date + timedelta(days=1)
day_of_month = start_date.strftime("%d")
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/webapps/reports/controllers/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ def filter(self, trans, user, query, column_filter):
# so we need to figure out which type of date we have
if column_filter.count('-') == 2:
# We are filtering on a date like YYYY-MM-DD
year, month, day = list(map(int, column_filter.split("-")))
year, month, day = map(int, column_filter.split("-"))
start_date = date(year, month, day)
end_date = start_date + timedelta(days=1)
return query.filter(and_(self.model_class.table.c.create_time >= start_date,
self.model_class.table.c.create_time < end_date))
if column_filter.count('-') == 1:
# We are filtering on a month like YYYY-MM
year, month = list(map(int, column_filter.split("-")))
year, month = map(int, column_filter.split("-"))
start_date = date(year, month, 1)
end_date = start_date + timedelta(days=calendar.monthrange(year, month)[1])
return query.filter(and_(self.model_class.table.c.create_time >= start_date,
Expand Down

0 comments on commit 6622ad1

Please sign in to comment.