Skip to content

Commit

Permalink
fix(codacy): fix codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
giangbui committed Feb 8, 2018
1 parent df351b4 commit d3c3714
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions peregrine/resources/submission/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_manifest():
if(bag_path is None):
return flask.jsonify({'bag_path': None, 'errors': 'bag_path is required!!!'}), 400

if peregrine.utils.contain_node_category(export_data,'data_file') == False:
if peregrine.utils.contain_node_with_category(export_data,'data_file') == False:
return flask.jsonify({ 'errors': 'No data_file node'}), 400


Expand All @@ -149,6 +149,6 @@ def get_manifest():
bag_path=bag_path,
bag_info=bag_info,
payload=res)
bag = peregrine.utils.create_bdbag(**args) # bag is a compressed file
peregrine.utils.create_bdbag(**args) # bag is a compressed file

return flask.jsonify({'data': res}), 200
2 changes: 1 addition & 1 deletion peregrine/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .payload import get_variables,jsonify_check_errors,parse_request_json,get_keys,contain_node_category
from .payload import get_variables,jsonify_check_errors,parse_request_json,get_keys,contain_node_with_category
from .pybdbag import create_bdbag
from .scheduling import AsyncPool
from .json2csv import flatten_obj,json2tbl
11 changes: 5 additions & 6 deletions peregrine/utils/pybdbag.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@


def create_bdbag(bag_path, bag_info, payload, max_row=10000):
"""Modify from https://github.com/BD2KGenomics/dcc-dashboard-service/blob/feature/manifest-handover/webservice.py"""
"""Create compressed BDbag file."""
"""Modify from https://github.com/BD2KGenomics/dcc-dashboard-service/blob/feature/manifest-handover/webservice.py
Create compressed BDbag file."""

if len(payload) == 0:
return
Expand All @@ -22,10 +22,9 @@ def create_bdbag(bag_path, bag_info, payload, max_row=10000):
for k in payload[0].keys():
k = k.replace('_data_','')
row.append(k)
writer.writerow(row)

writer.writerow(row)
nrow = 1

for row_dict in payload:
row=[]
for (k,v) in row_dict.iteritems():
Expand All @@ -52,6 +51,6 @@ def create_bdbag(bag_path, bag_info, payload, max_row=10000):
def zipdir(path, ziph):
"""https://github.com/BD2KGenomics/dcc-dashboard-service/blob/feature/manifest-handover/webservice.py"""
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for root, _, files in os.walk(path):
for file in files:
ziph.write(os.path.join(root, file))
ziph.write(os.path.join(root, file))

0 comments on commit d3c3714

Please sign in to comment.