Skip to content

Commit 8b6a73e

Browse files
committed
Solving comments and pep8
1 parent 3995ae8 commit 8b6a73e

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

qiita_db/metadata_template/util.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,25 @@ def _parse_mapping_file(lines, strip_quotes=True, suppress_stripping=False):
397397
if strip_quotes:
398398
if suppress_stripping:
399399
# remove quotes but not spaces
400-
strip_f = lambda x: x.replace('"', '')
400+
401+
def strip_f(x):
402+
return x.replace('"', '')
401403
else:
402404
# remove quotes and spaces
403-
strip_f = lambda x: x.replace('"', '').strip()
405+
406+
def strip_f(x):
407+
return x.replace('"', '').strip()
404408
else:
405409
if suppress_stripping:
406410
# don't remove quotes or spaces
407-
strip_f = lambda x: x
411+
412+
def strip_f(x):
413+
return x
408414
else:
409415
# remove spaces but not quotes
410-
strip_f = lambda x: x.strip()
416+
417+
def strip_f(x):
418+
return x.strip()
411419

412420
# Create lists to store the results
413421
mapping_data = []

qiita_pet/handlers/study_handlers/description_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
QiitaDBDuplicateHeaderError, QiitaDBError)
3232
from qiita_ware.metadata_pipeline import (
3333
create_templates_from_qiime_mapping_file)
34+
from qiita_ware.exceptions import QiitaWareError
3435
from qiita_pet.handlers.base_handlers import BaseHandler
3536
from qiita_pet.handlers.util import check_access
3637
from qiita_pet.handlers.study_handlers.listing_handlers import (
@@ -199,7 +200,7 @@ def process_sample_template(self, study, user, callback):
199200
except (TypeError, QiitaDBColumnError, QiitaDBExecutionError,
200201
QiitaDBDuplicateError, IOError, ValueError, KeyError,
201202
CParserError, QiitaDBDuplicateHeaderError,
202-
QiitaDBError) as e:
203+
QiitaDBError, QiitaWareError) as e:
203204
# Some error occurred while processing the sample template
204205
# Show the error to the user so they can fix the template
205206
error_msg = ('parsing the QIIME mapping file'

0 commit comments

Comments
 (0)