# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst

import logging

from cotede.qc import ProfileQC
from . import fCNV
from .exceptions import CNVError


class fProfileQC(ProfileQC):
    """ Apply ProfileQC from CoTeDe straight from a file.
    """
    def __init__(self, inputfile, cfg=None, saveauxiliary=True, verbose=True,
            logger=None):
        """
        """
        self.logger = logging.getLogger(logger or 'seabird.qc.fProfileQC')
        self.name = 'fProfileQC'

        try:
            # Not the best way, but will work for now. I should pass
            #   the reference for the logger being used.
            profile = fCNV(inputfile, logger=None)
        except CNVError as e:
            #self.attributes['filename'] = basename(inputfile)
            logging.error(e.msg)
            raise

        super(fProfileQC, self).__init__(profile, cfg=cfg,
                saveauxiliary=saveauxiliary, verbose=verbose,
                logger=logger)

@@ -96,16 +96,45 @@
  logging
+%0Afrom os.path import basename
 %0A%0Afrom c
@@ -777,17 +777,16 @@
         
-#
 self.att

Add filename in attrs if fails to load it.