# Path: apasvo/utils/futils.py
# def istextfile(filename, blocksize=512):
# def is_little_endian():
# def read_in_chunks(file_object, chunk_size=1024):
# def read_txt_in_chunks(file_object, n=1024, comments='#'):
# def getSize(f):
# def get_delimiter(fileobject, lines=16):
# def get_sample_rate(filename, max_header_lines=64, comments='#'):
# def copytree(src, dst, symlinks=False, ignore=None):


import numpy as np
from apasvo.utils import futils
        """Inits a BinFile object.

        Args:
            filename: Name of the file.
            dtype: Data-type of the data stored in the file.
                Possible values are: 'float16', 'float32' and 'float64'.
                Default value is 'float64'.
            byteorder: Byte-order of the data stored in the file.
                Possible values are: 'little-endian', 'big-endian' and 'native'.
                Default value is 'native'.
        """
        super(BinFile, self).__init__()
        self.dtype = np.dtype(self._byteorders[byteorder] + self._datatypes[dtype])
        self.filename = filename

    def read(self, **kwargs):
        """Constructs a numpy array from the data stored in the file.

        Data-type and byte-order of the returned array are the object's same.
        """
        return np.fromfile(self.filename, dtype=self.dtype)

    def read_in_blocks(self, block_size=1024):
        """Lazy function (generator) that reads a binary file in chunks.

        Default chunk size is 1k.
        Data-type and byte-order of the returned data are the object's same.
        """
        with open(self.filename, 'rb') as f:
            chunk_size = block_size * self.dtype.itemsize

# Path: apasvo/utils/futils.py
# def istextfile(filename, blocksize=512):
# def is_little_endian():
# def read_in_chunks(file_object, chunk_size=1024):
# def read_txt_in_chunks(file_object, n=1024, comments='#'):
# def getSize(f):
# def get_delimiter(fileobject, lines=16):
# def get_sample_rate(filename, max_header_lines=64, comments='#'):
# def copytree(src, dst, symlinks=False, ignore=None):


# Path: apasvo/utils/formats/rawfile.py
import numpy as np
from apasvo.utils import futils

        """Inits a BinFile object.

        Args:
            filename: Name of the file.
            dtype: Data-type of the data stored in the file.
                Possible values are: 'float16', 'float32' and 'float64'.
                Default value is 'float64'.
            byteorder: Byte-order of the data stored in the file.
                Possible values are: 'little-endian', 'big-endian' and 'native'.
                Default value is 'native'.
        """
        super(BinFile, self).__init__()
        self.dtype = np.dtype(self._byteorders[byteorder] + self._datatypes[dtype])
        self.filename = filename

    def read(self, **kwargs):
        """Constructs a numpy array from the data stored in the file.

        Data-type and byte-order of the returned array are the object's same.
        """
        return np.fromfile(self.filename, dtype=self.dtype)

    def read_in_blocks(self, block_size=1024):
        """Lazy function (generator) that reads a binary file in chunks.

        Default chunk size is 1k.
        Data-type and byte-order of the returned data are the object's same.
        """
        with open(self.filename, 'rb') as f:
            chunk_size = block_size * self.dtype.itemsize

            for data in futils.read_in_chunks(f, chunk_size):