# AUTOGENERATED! DO NOT EDIT! File to edit: ../00_setup.ipynb.

# %% auto 0
__all__ = ['running_in_colab', 'setup_colab', 'set_retina_mode', 'setup']

# %% ../00_setup.ipynb 2
import IPython

# %% ../00_setup.ipynb 3
def running_in_colab():
    """
    Check whether we are running in a Google Colab notebook.
    """
    try:
        if 'google.colab' in str(get_ipython()):
          return True
    except Exception:
        pass
    return False


def setup_colab():
    "Sets up Colab"
    assert running_in_colab(), "You do not appear to be running in Colab"


def set_retina_mode():
    """
    Does the same thing as this `%config` magic:

    %config InlineBackend.figure_format = 'retina'
    """
    shell = IPython.get_ipython()
    if shell is not None:
        shell.config.InlineBackend.figure_format = "retina"


def setup():
    "Sets up ds_tut. First run `%pip install -Uqq ds_tut` in a cell"
    if running_in_colab():
        setup_colab()
    set_retina_mode()
