"""
@file
@brief API to move files

.. versionadded:: 1.1
"""
import azure
from pyquickhelper.filehelper import TransferAPI
from pyquickhelper.loghelper import fLOG, noLOG
from .azure_drive import AzureDrive


class AzureTransferAPI(TransferAPI):
    """
    defines an API to transfer files over a remote location

    .. versionadded:: 1.1
    """

    def __init__(self, blob, key, fLOG=None, container="backup"):
        """
        constructor

        @param      blob        blob storage
        @param      key         key
        @param      container   container name
        @param      fLOG        logging function
        """
        self.fLOG = fLOG if fLOG else noLOG
        self._azure = AzureDrive(blob, key, fLOG=fLOG, container=container)
        self._azure.connect()

    def transfer(self, path, data):
        """
        we assume a data holds in memory,
        tansfer data to path

        @param      data        bytes
        @param      path        path to remove location
        @return                 boolean
        """
        self._azure.upload_data(path, data)
        return True

    def retrieve(self, path, exc=True):
        """
        retrieve data from path

        @param      path        remove location
        @param      exc         keep exception
        @return                 data
        """
        if exc:
            return self._azure.download_data(path)
        else:
            try:
                return self._azure.download_data(path)
            except azure.common.AzureMissingResourceHttpError:
                return None

@@ -117,20 +117,22 @@
 sferAPI%0A
-from
+import
  pyquick
@@ -152,26 +152,17 @@
 per 
-import fLOG, noLOG
+as pyqlog
 %0Afro
@@ -663,16 +663,23 @@
 OG else 
+pyqlog.
 noLOG%0A  
@@ -725,16 +725,21 @@
 y, fLOG=
+self.
 fLOG, co

fix an issue with logging function