Skip to content

Commit 9fc1283

Browse files
committed
Merge branch 'master' of https://github.com/biocore/qiita into delete-raw-data
2 parents 36c0157 + 1ca033a commit 9fc1283

File tree

12 files changed

+54
-43
lines changed

12 files changed

+54
-43
lines changed

qiita_core/configuration_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
from os.path import join, dirname, abspath, isdir
1111
from os import environ
1212
from future import standard_library
13-
with standard_library.hooks():
14-
from configparser import ConfigParser
1513

1614
from .exceptions import MissingConfigSection
1715

16+
with standard_library.hooks():
17+
from configparser import ConfigParser
18+
1819

1920
class ConfigurationManager(object):
2021
"""Holds the QIITA configuration

qiita_core/util.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
# -----------------------------------------------------------------------------
88
from smtplib import SMTP, SMTP_SSL, SMTPException
99
from future import standard_library
10-
with standard_library.hooks():
11-
from email.mime.multipart import MIMEMultipart
12-
from email.mime.text import MIMEText
1310

1411
from qiita_core.qiita_settings import qiita_config
1512
from qiita_db.sql_connection import SQLConnectionHandler
1613
from qiita_db.environment_manager import reset_test_database
1714

15+
with standard_library.hooks():
16+
from email.mime.multipart import MIMEMultipart
17+
from email.mime.text import MIMEText
18+
1819

1920
def send_email(to, subject, body):
2021
# create email

qiita_db/commands.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
from future.utils import viewitems
1515
from collections import defaultdict
1616
from shutil import move
17-
with standard_library.hooks():
18-
from configparser import ConfigParser
1917

2018
from .study import Study, StudyPerson
2119
from .user import User
@@ -28,6 +26,10 @@
2826
ProcessedSortmernaParams)
2927
from .sql_connection import SQLConnectionHandler
3028

29+
with standard_library.hooks():
30+
from configparser import ConfigParser
31+
32+
3133
SUPPORTED_PARAMS = ['preprocessed_sequence_illumina_params',
3234
'preprocessed_sequence_454_params',
3335
'processed_params_sortmerna']
@@ -51,7 +53,10 @@ def load_study_from_cmd(owner, title, info):
5153
config.readfp(info)
5254

5355
optional = dict(config.items('optional'))
54-
get_optional = lambda name: optional.get(name, None)
56+
57+
def get_optional(name):
58+
return optional.get(name, None)
59+
5560
get_required = partial(config.get, 'required')
5661
required_fields = ['timeseries_type_id', 'mixs_compliant',
5762
'portal_type_id', 'reprocess', 'study_alias',

qiita_db/environment_manager.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#
66
# The full license is in the file LICENSE, distributed with this software.
77
# -----------------------------------------------------------------------------
8+
9+
from qiita_db.ontology import Ontology
10+
from qiita_db.util import convert_to_id
811
from os.path import abspath, dirname, join, exists, basename, splitext
912
from functools import partial
1013
from os import mkdir
@@ -13,16 +16,16 @@
1316

1417
from future import standard_library
1518
from future.utils import viewitems
16-
with standard_library.hooks():
17-
from urllib.request import urlretrieve
18-
from natsort import natsorted
1919

2020
from qiita_core.exceptions import QiitaEnvironmentError
2121
from qiita_core.qiita_settings import qiita_config
2222
from .sql_connection import SQLConnectionHandler
2323
from .reference import Reference
24-
from qiita_db.ontology import Ontology
25-
from qiita_db.util import convert_to_id
24+
from natsort import natsorted
25+
26+
with standard_library.hooks():
27+
from urllib.request import urlretrieve
28+
2629

2730
get_support_file = partial(join, join(dirname(abspath(__file__)),
2831
'support_files'))

qiita_db/metadata_template.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,13 @@ def __getitem__(self, key):
388388
if key in self._get_categories(conn_handler):
389389
# It's possible that the key is asking for one of the *_id columns
390390
# that we have to do the translation
391-
handler = lambda x: x
391+
def handler(x):
392+
return x
393+
394+
# prevent flake8 from complaining about the function not being
395+
# used and a redefinition happening in the next few lines
396+
handler(None)
397+
392398
if key in self._md_template.translate_cols_dict.values():
393399
handler = (
394400
lambda x: self._md_template.str_cols_handlers[key][x])

qiita_db/test/test_commands.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
from future.utils.six import StringIO
1515
from future import standard_library
1616
from functools import partial
17-
with standard_library.hooks():
18-
import configparser
1917

2018
from qiita_db.commands import (load_study_from_cmd, load_raw_data_cmd,
2119
load_sample_template_from_cmd,
@@ -33,6 +31,9 @@
3331
from qiita_core.util import qiita_test_checker
3432
from qiita_ware.processing_pipeline import generate_demux_file
3533

34+
with standard_library.hooks():
35+
import configparser
36+
3637

3738
@qiita_test_checker()
3839
class TestMakeStudyFromCmd(TestCase):

qiita_db/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,9 @@ def insert_filepaths(filepaths, obj_id, table, filepath_table, conn_handler,
661661
for old_fp, new_fp in zip(filepaths, new_filepaths):
662662
move(old_fp[0], new_fp[0])
663663

664-
str_to_id = lambda x: (x if isinstance(x, (int, long))
665-
else convert_to_id(x, "filepath_type",
666-
conn_handler))
664+
def str_to_id(x):
665+
return (x if isinstance(x, (int, long))
666+
else convert_to_id(x, "filepath_type", conn_handler))
667667
paths_w_checksum = [(relpath(path, base_fp), str_to_id(id),
668668
compute_checksum(path))
669669
for path, id in new_filepaths]

qiita_pet/handlers/compute.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def post(self):
5151
else:
5252
check_access(self.current_user, study, raise_error=True)
5353

54-
_split = lambda x: x.split(',') if x else []
54+
def _split(x):
55+
return x.split(',') if x else []
5556
filepaths, fps = [], []
5657
fps.append((_split(barcodes_str), 'raw_barcodes'))
5758
fps.append((_split(fasta_str), 'raw_fasta'))

qiita_pet/handlers/study_handlers/description_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ def display_template(self, study, user, msg, msg_level, top_tab=None,
523523

524524
# set variable holding if we have all prep templates or not
525525
if available_prep_templates:
526-
_test = lambda item: not item
526+
def _test(item):
527+
return not item
527528
prep_templates = all(
528529
[_test(val) for val in viewvalues(available_prep_templates)])
529530
else:

qiita_ware/wrapper.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
from __future__ import division
22

3-
__author__ = "Jose Antonio Navas Molina"
4-
__copyright__ = "Copyright 2011, The QIIME project"
5-
__credits__ = ["Jose Antonio Navas Molina"]
6-
__license__ = "BSD"
7-
__version__ = "1.8.0-dev"
8-
__maintainer__ = "Jose Navas Antonio Molina"
9-
# Taken from pull request #1616 in qiime, with permission from Jose
10-
# Permission was also given to release this code under the BSD licence
11-
123
from shutil import rmtree
134
from os import remove
145
from sys import stderr

0 commit comments

Comments
 (0)