@@ -139,15 +139,15 @@ def _link_data_filepaths(self, fp_ids, conn_handler):
139139 "VALUES (%s, %s)" .format (self ._data_filepath_table ,
140140 self ._data_filepath_column ), values )
141141
142- def add_filepaths (self , filepaths , conn_handler = None ):
142+ def add_filepaths (self , filepaths ):
143143 r"""Populates the DB tables for storing the filepaths and connects the
144144 `self` objects with these filepaths"""
145145 # Check that this function has been called from a subclass
146146 self ._check_subclass ()
147147
148148 # Check if the connection handler has been provided. Create a new
149149 # one if not.
150- conn_handler = conn_handler if conn_handler else SQLConnectionHandler ()
150+ conn_handler = SQLConnectionHandler ()
151151
152152 # Update the status of the current object
153153 self ._set_link_filepaths_status ("linking" )
@@ -193,11 +193,11 @@ def get_filepaths(self):
193193 self ._data_filepath_table ,
194194 self ._data_filepath_column ), {'id' : self .id })
195195
196- _ , fb = get_mountpoint (self ._table , conn_handler )[0 ]
196+ _ , fb = get_mountpoint (self ._table )[0 ]
197197 base_fp = partial (join , fb )
198198
199- return [(fpid , base_fp (fp ), convert_from_id (fid , "filepath_type" ,
200- conn_handler )) for fpid , fp , fid in db_paths ]
199+ return [(fpid , base_fp (fp ), convert_from_id (fid , "filepath_type" ))
200+ for fpid , fp , fid in db_paths ]
201201
202202 def get_filepath_ids (self ):
203203 self ._check_subclass ()
@@ -326,7 +326,7 @@ def create(cls, filetype, studies, filepaths=None):
326326
327327 # If file paths have been provided, add them to the raw data object
328328 if filepaths :
329- rd .add_filepaths (filepaths , conn_handler )
329+ rd .add_filepaths (filepaths )
330330
331331 return rd
332332
@@ -465,20 +465,15 @@ def prep_templates(self):
465465 "WHERE raw_data_id = %s ORDER BY prep_template_id" )
466466 return [x [0 ] for x in conn_handler .execute_fetchall (sql , (self ._id ,))]
467467
468- def _is_preprocessed (self , conn_handler = None ):
468+ def _is_preprocessed (self ):
469469 """Returns whether the RawData has been preprocessed or not
470470
471- Parameters
472- ----------
473- conn_handler : SQLConnectionHandler
474- The connection handler object connected to the DB
475-
476471 Returns
477472 -------
478473 bool
479474 whether the RawData has been preprocessed or not
480475 """
481- conn_handler = conn_handler if conn_handler else SQLConnectionHandler ()
476+ conn_handler = SQLConnectionHandler ()
482477 return conn_handler .execute_fetchone (
483478 "SELECT EXISTS(SELECT * FROM qiita.prep_template_preprocessed_data"
484479 " PTPD JOIN qiita.prep_template PT ON PT.prep_template_id = "
@@ -507,7 +502,7 @@ def _remove_filepath(self, fp, conn_handler, queue):
507502 """
508503 # If the RawData has been already preprocessed, we cannot remove any
509504 # file - raise an error
510- if self ._is_preprocessed (conn_handler ):
505+ if self ._is_preprocessed ():
511506 msg = ("Cannot clear all the filepaths from raw data %s, it has "
512507 "been already preprocessed" % self ._id )
513508 self ._set_link_filepaths_status ("failed: %s" % msg )
@@ -525,7 +520,7 @@ def _remove_filepath(self, fp, conn_handler, queue):
525520 raise QiitaDBError (msg )
526521
527522 # Get the filpeath id
528- fp_id = get_filepath_id (self ._table , fp , conn_handler )
523+ fp_id = get_filepath_id (self ._table , fp )
529524 fp_is_mine = conn_handler .execute_fetchone (
530525 "SELECT EXISTS(SELECT * FROM qiita.{0} WHERE filepath_id=%s AND "
531526 "{1}=%s)" .format (self ._data_filepath_table ,
@@ -579,8 +574,7 @@ def clear_filepaths(self):
579574
580575 # Move the files, if they are not used, if you get to this point
581576 # self.studies should only have one element, thus self.studies[0]
582- move_filepaths_to_upload_folder (self .studies [0 ], filepaths ,
583- conn_handler = conn_handler )
577+ move_filepaths_to_upload_folder (self .studies [0 ], filepaths )
584578
585579 def remove_filepath (self , fp ):
586580 """Removes the filepath from the RawData
@@ -614,7 +608,7 @@ def remove_filepath(self, fp):
614608 self ._set_link_filepaths_status ("idle" )
615609
616610 # Delete the files, if they are not used anywhere
617- purge_filepaths (conn_handler )
611+ purge_filepaths ()
618612
619613 def status (self , study ):
620614 """The status of the raw data within the given study
@@ -753,7 +747,7 @@ def create(cls, study, preprocessed_params_table, preprocessed_params_id,
753747 data_type = prep_template .data_type (ret_id = True )
754748 else :
755749 # only data_type, so need id from the text
756- data_type = convert_to_id (data_type , "data_type" , conn_handler )
750+ data_type = convert_to_id (data_type , "data_type" )
757751
758752 # Check that the preprocessed_params_table exists
759753 if not exists_dynamic_table (preprocessed_params_table , "preprocessed_" ,
@@ -804,7 +798,7 @@ def create(cls, study, preprocessed_params_table, preprocessed_params_id,
804798 conn_handler .execute_queue (q )
805799
806800 # Add the filepaths to the database and connect them
807- ppd .add_filepaths (filepaths , conn_handler )
801+ ppd .add_filepaths (filepaths )
808802 return ppd
809803
810804 @classmethod
@@ -1278,7 +1272,7 @@ def create(cls, processed_params_table, processed_params_id, filepaths,
12781272 "You must provide either a preprocessed_data, a "
12791273 "data_type, or both" )
12801274 else :
1281- data_type = convert_to_id (data_type , "data_type" , conn_handler )
1275+ data_type = convert_to_id (data_type , "data_type" )
12821276
12831277 # We first check that the processed_params_table exists
12841278 if not exists_dynamic_table (processed_params_table ,
@@ -1321,7 +1315,7 @@ def create(cls, processed_params_table, processed_params_id, filepaths,
13211315 "(%s, %s)" .format (cls ._study_processed_table ),
13221316 (study_id , pd_id ))
13231317
1324- pd .add_filepaths (filepaths , conn_handler )
1318+ pd .add_filepaths (filepaths )
13251319 return cls (pd_id )
13261320
13271321 @classmethod
@@ -1524,8 +1518,7 @@ def status(self, status):
15241518
15251519 conn_handler = SQLConnectionHandler ()
15261520
1527- status_id = convert_to_id (status , 'processed_data_status' ,
1528- conn_handler = conn_handler )
1521+ status_id = convert_to_id (status , 'processed_data_status' )
15291522
15301523 sql = """UPDATE qiita.{0} SET processed_data_status_id = %s
15311524 WHERE processed_data_id=%s""" .format (self ._table )
0 commit comments