# Path: treeCl/errors.py
# def filecheck(filename):
#     if not os.path.isfile(filename):
#         raise FileError(filename)
#     return filename
# 
# def directorycheck(directory):
#     if not os.path.isdir(directory):
#         raise DirectoryError(directory)
#     return directory


import bz2
import pickle
import glob
import gzip
import io
import os
import shutil
import tempfile
from subprocess import Popen, PIPE
from ..errors import filecheck, directorycheck
        if not self.disable_delete:
            os.remove(self._wrapped_tmp)


class TempDir(object):

    def __init__(self, disable_delete=False):
        self.disable_delete = disable_delete

    def __enter__(self):
        self._wrapped_tmpdir = tempfile.mkdtemp()
        return os.path.abspath(self._wrapped_tmpdir)

    def __exit__(self, type, value, tb):
        if not self.disable_delete:
            shutil.rmtree(self._wrapped_tmpdir)


class TempFileList(object):

    def __init__(self, filelist, disable_delete=False):
        self._filelist = filelist
        self.disable_delete = disable_delete

    def __enter__(self):
        return self._filelist

    def __exit__(self, type, value, tb):
        for fl in self._filelist:
            try:

# Path: treeCl/errors.py
# def filecheck(filename):
#     if not os.path.isfile(filename):
#         raise FileError(filename)
#     return filename
# 
# def directorycheck(directory):
#     if not os.path.isdir(directory):
#         raise DirectoryError(directory)
#     return directory


# Path: treeCl/utils/fileIO.py
import bz2
import pickle
import glob
import gzip
import io
import os
import shutil
import tempfile
from subprocess import Popen, PIPE
from ..errors import filecheck, directorycheck

        if not self.disable_delete:
            os.remove(self._wrapped_tmp)


class TempDir(object):

    def __init__(self, disable_delete=False):
        self.disable_delete = disable_delete

    def __enter__(self):
        self._wrapped_tmpdir = tempfile.mkdtemp()
        return os.path.abspath(self._wrapped_tmpdir)

    def __exit__(self, type, value, tb):
        if not self.disable_delete:
            shutil.rmtree(self._wrapped_tmpdir)


class TempFileList(object):

    def __init__(self, filelist, disable_delete=False):
        self._filelist = filelist
        self.disable_delete = disable_delete

    def __enter__(self):
        return self._filelist

    def __exit__(self, type, value, tb):
        for fl in self._filelist:
            try:

                if not self.disable_delete: