# Path: onecodex/exceptions.py
# class OneCodexException(Exception):
#     pass
# 
# class UnboundObject(OneCodexException):
#     """To use against the One Codex server, all classes must be derived from an Api() instance."""
# 
#     pass


import click
import inspect
import os
import requests
from onecodex.exceptions import OneCodexException, UnboundObject
    from onecodex.models import OneCodexBase  # in here to prevent circular import
        from requests.adapters import HTTPAdapter
        from requests.packages.urllib3.util.retry import Retry
        Notes
        -----
        If no arguments specified, defaults to download the file as the original filename
        in the current working directory. If `file_obj` given, will write data into the
        passed file-like object. If `path` given, will download the file to the path provided,
        but will not overwrite any existing files.
        """
        return self._download(
            "download_uri",
            self.filename,
            use_potion_session=False,
            path=path,
            file_obj=file_obj,
            progressbar=progressbar,
        )

    def _download(
        self,
        _resource_method,
        _filename=None,
        use_potion_session=False,
        path=None,
        file_obj=None,
        progressbar=False,
    ):

        if hasattr(self._resource, "visibility") and self._resource.visibility == "awaiting data":
            raise OneCodexException("Sample has not finished processing. Please try again later.")

        if path and file_obj:

# Path: onecodex/exceptions.py
# class OneCodexException(Exception):
#     pass
# 
# class UnboundObject(OneCodexException):
#     """To use against the One Codex server, all classes must be derived from an Api() instance."""
# 
#     pass


# Path: onecodex/models/helpers.py
import click
import inspect
import os
import requests
from onecodex.exceptions import OneCodexException, UnboundObject
    from onecodex.models import OneCodexBase  # in here to prevent circular import
        from requests.adapters import HTTPAdapter
        from requests.packages.urllib3.util.retry import Retry

        Notes
        -----
        If no arguments specified, defaults to download the file as the original filename
        in the current working directory. If `file_obj` given, will write data into the
        passed file-like object. If `path` given, will download the file to the path provided,
        but will not overwrite any existing files.
        """
        return self._download(
            "download_uri",
            self.filename,
            use_potion_session=False,
            path=path,
            file_obj=file_obj,
            progressbar=progressbar,
        )

    def _download(
        self,
        _resource_method,
        _filename=None,
        use_potion_session=False,
        path=None,
        file_obj=None,
        progressbar=False,
    ):

        if hasattr(self._resource, "visibility") and self._resource.visibility == "awaiting data":
            raise OneCodexException("Sample has not finished processing. Please try again later.")

        if path and file_obj:

            raise OneCodexException("Please specify only one of: path, file_obj")