file_automaton.py
def finalize(self, success, list_path_input, list_path_output):
        """Move files to their final destination"""

        if success is True:
            dir_destination = self.dir_valid
        elif success is False:
            dir_destination = self.dir_invalid
        else:
            raise RuntimeError("Bad return value: %s" % success)

        self.logger.info("Processing returned %s" % success)
        self.logger.info("Input files will be moved to %s" % dir_destination)

        for one_path in list_path_output:
            self.logger.info("Moving %s to %s" % (one_path, self.dir_output))
            shutil.move(one_path, self.dir_output, shutil.copyfile)

        for one_path in list_path_input:
            self.logger.info("Moving %s to %s" % (one_path, dir_destination))
            shutil.move(one_path, dir_destination, shutil.copyfile)

        if success is True:
            self.logger.debug(
                "Removing temporary directory %s" % self.dir_tmp_run)
            shutil.rmtree(self.dir_tmp_run)
Move files to their final destination
Move files to their final destination
Move files to their final destination
def finalize(self, success, list_path_input, list_path_output):
        if success is True:
            dir_destination = self.dir_valid
        elif success is False:
            dir_destination = self.dir_invalid
        else:
            raise RuntimeError("Bad return value: %s" % success)
        self.logger.info("Processing returned %s" % success)
        self.logger.info("Input files will be moved to %s" % dir_destination)
        for one_path in list_path_output:
            self.logger.info("Moving %s to %s" % (one_path, self.dir_output))
            shutil.move(one_path, self.dir_output, shutil.copyfile)
        for one_path in list_path_input:
            self.logger.info("Moving %s to %s" % (one_path, dir_destination))
            shutil.move(one_path, dir_destination, shutil.copyfile)
        if success is True:
            self.logger.debug(
                "Removing temporary directory %s" % self.dir_tmp_run)
            shutil.rmtree(self.dir_tmp_run)
def finalize ( self , success , list_path_input , list_path_output ) : if success is True : dir_destination = self . dir_valid elif success is False : dir_destination = self . dir_invalid else : raise RuntimeError ( "Bad return value: %s" % success ) self . logger . info ( "Processing returned %s" % success ) self . logger . info ( "Input files will be moved to %s" % dir_destination ) for one_path in list_path_output : self . logger . info ( "Moving %s to %s" % ( one_path , self . dir_output ) ) shutil . move ( one_path , self . dir_output , shutil . copyfile ) for one_path in list_path_input : self . logger . info ( "Moving %s to %s" % ( one_path , dir_destination ) ) shutil . move ( one_path , dir_destination , shutil . copyfile ) if success is True : self . logger . debug ( "Removing temporary directory %s" % self . dir_tmp_run ) shutil . rmtree ( self . dir_tmp_run )
Move files to their final destination
Move files to their final destination
"""Move files to their final destination"""
self
success
list_path_input
list_path_output