Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
saramonzon committed Oct 3, 2023
1 parent 52a0f5b commit e6ac70a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 25 deletions.
8 changes: 4 additions & 4 deletions bu_isciii/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ def new_service(resolution, path, no_create_folder, ask_path):
type=click.Choice(["Service_to_scratch", "Scratch_to_service", "Remove_scratch"]),
multiple=False,
help=(
"Direction of the rsync command. Service_to_scratch "
"from /data/bi/service to /data/bi/scratch_tmp/bi/."
"Scratch_to_service: From /data/bi/scratch_tmp/bi/ to /data/bi/service"
),
"Direction of the rsync command. Service_to_scratch "
"from /data/bi/service to /data/bi/scratch_tmp/bi/."
"Scratch_to_service: From /data/bi/scratch_tmp/bi/ to /data/bi/service"
),
)
def scratch(resolution, path, tmp_dir, direction, ask_path):
"""
Expand Down
46 changes: 29 additions & 17 deletions bu_isciii/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,17 @@ def __init__(
sys.exit()

if (
(date_from is not None)
and (date_until is not None)
and (service_id is not None)
) or (
(date_from is not None)
and (date_until is not None)
and (services_file is not None)
) or (
(services_file) is not None
and (service_id) is not None
(
(date_from is not None)
and (date_until is not None)
and (service_id is not None)
)
or (
(date_from is not None)
and (date_until is not None)
and (services_file is not None)
)
or ((services_file) is not None and (service_id) is not None)
):
stderr.print(
"Both a date and a service ID or service list have been chosen. "
Expand All @@ -134,7 +135,12 @@ def __init__(
date_until = None
service_id = None

if (date_from is None) and (date_until is None) and (service_id is None) and (services_file is None):
if (
(date_from is None)
and (date_until is None)
and (service_id is None)
and (services_file is None)
):
if self.ser_type == "services_and_colaborations":
prompt_response = bu_isciii.utils.prompt_selection(
"Search services by date, or by service ID?",
Expand Down Expand Up @@ -187,19 +193,23 @@ def __init__(
self.date_until = date_until
if service_id:
self.services = (
{service_id: {key: value for key, value in dictionary_template.items()}}
{
service_id: {
key: value for key, value in dictionary_template.items()
}
}
if service_id is not None
else dict()
)
elif services_file:
with open(services_file) as file:
for s_id in file:
self.services[s_id] = {key: value for key, value in dictionary_template.items()}
self.services[s_id] = {
key: value for key, value in dictionary_template.items()
}

if (self.date_from is not None) and (self.date_until is not None):
stderr.print(
"Asking our trusty API about selected services"
)
stderr.print("Asking our trusty API about selected services")
try:
for service in rest_api.get_request(
request_info="services",
Expand Down Expand Up @@ -266,7 +276,9 @@ def __init__(
)
else:
self.services[service]["found_in_system"] = True
import pdb; pdb.set_trace()
import pdb

pdb.set_trace()
self.services[service]["archived_path"] = os.path.join(
bu_isciii.config_json.ConfigJson().get_configuration("global")[
"archived_path"
Expand Down
2 changes: 1 addition & 1 deletion bu_isciii/new_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def create_symbolic_links(self):
stderr.print(
"[red] This regex has not output any file: %s." % regex,
"This maybe because the project is not yet in the fastq repo"
"or because some of the samples are not in the project."
"or because some of the samples are not in the project.",
)
stderr.print(
"[blue] Service has %s number of selected samples in iSkyLIMS"
Expand Down
6 changes: 3 additions & 3 deletions bu_isciii/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ def ask_date(previous_date=None, posterior_date=None, initial_year=2010):
month_list = [[num, month] for num, month in enumerate(calendar.month_name)][1:]
else:
month_list = [[num, month] for num, month in enumerate(calendar.month_name)][
1:datetime.date.today().month + 1
1 : datetime.date.today().month + 1
]

# If there is a previous date
# and year is the same as before, limit the quantity of months
if previous_date is not None and year == previous_date.year:
month_list = month_list[previous_date.month - 1:]
month_list = month_list[previous_date.month - 1 :]

chosen_month_number, chosen_month_name = (
bu_isciii.utils.prompt_selection(
Expand Down Expand Up @@ -377,7 +377,7 @@ def ask_date(previous_date=None, posterior_date=None, initial_year=2010):
and year == previous_date.year
and chosen_month_number == previous_date.month
):
day_list = day_list[previous_date.day - 1:]
day_list = day_list[previous_date.day - 1 :]

# from the list, get the first and last item as limits for the function
day = bu_isciii.utils.prompt_day(
Expand Down

0 comments on commit e6ac70a

Please sign in to comment.