
"""Documentation Tasks"""

from fabric.api import lcd, local, task

from .utils import pip, requires


PACKAGE = "src/ccav"


@task()
@requires("sphinx-apidoc")
def api():
    """Generate the API Documentation"""

    if PACKAGE is not None:
        local("sphinx-apidoc -f -T -o docs/source/api {0:s}".format(PACKAGE))


@task()
@requires("make")
def clean():
    """Delete Generated Documentation"""

    with lcd("docs"):
        local("make clean")


@task(default=True)
@requires("make")
def build(**options):
    """Build the Documentation"""

    pip(requirements="docs/requirements.txt")

    with lcd("docs"):
        local("make html")


@task()
@requires("open")
def view(**options):
    """View the Documentation"""

    with lcd("docs"):
        local("open build/html/index.html")


"""Documentation Tasks"""

from fabric.api import lcd, local, task

from .utils import pip, requires


PACKAGE = "src/ccav"


@task()
@requires("sphinx-apidoc")
def api():
    """Generate the API Documentation"""

    if PACKAGE is not None:
        local("sphinx-apidoc -f -T -o docs/source/api {0:s}".format(PACKAGE))


@task()
@requires("make")
def clean():
    """Delete Generated Documentation"""

    with lcd("docs"):
        local("make clean")


@task(default=True)
@requires("make")
def build(**options):
    """Build the Documentation"""

    pip(requirements="docs/requirements.txt")

    with lcd("docs"):
        local("make html")


@task()
def view(**options):
    """View the Documentation"""

    with lcd("docs"):
        import webbrowser
        webbrowser.open_new_tab("build/html/index.html")

Use webbrowser.open_new_tab() instead of platform dependent open
Use webbrowser.open_new_tab() instead of platform dependent open

  
  """Documentation Tasks"""
  
  from fabric.api import lcd, local, task
  
  from .utils import pip, requires
  
  
  PACKAGE = "src/ccav"
  
  
  @task()
  @requires("sphinx-apidoc")
  def api():
      """Generate the API Documentation"""
  
      if PACKAGE is not None:
          local("sphinx-apidoc -f -T -o docs/source/api {0:s}".format(PACKAGE))
  
  
  @task()
  @requires("make")
  def clean():
      """Delete Generated Documentation"""
  
      with lcd("docs"):
          local("make clean")
  
  
  @task(default=True)
  @requires("make")
  def build(**options):
      """Build the Documentation"""
  
      pip(requirements="docs/requirements.txt")
  
      with lcd("docs"):
          local("make html")
  
  
  @task()
- @requires("open")
  def view(**options):
      """View the Documentation"""
  
      with lcd("docs"):
-         local("open build/html/index.html")
+         import webbrowser
+         webbrowser.open_new_tab("build/html/index.html")
  
Use webbrowser.open_new_tab() instead of platform dependent open
## Code Before:

"""Documentation Tasks"""

from fabric.api import lcd, local, task

from .utils import pip, requires


PACKAGE = "src/ccav"


@task()
@requires("sphinx-apidoc")
def api():
    """Generate the API Documentation"""

    if PACKAGE is not None:
        local("sphinx-apidoc -f -T -o docs/source/api {0:s}".format(PACKAGE))


@task()
@requires("make")
def clean():
    """Delete Generated Documentation"""

    with lcd("docs"):
        local("make clean")


@task(default=True)
@requires("make")
def build(**options):
    """Build the Documentation"""

    pip(requirements="docs/requirements.txt")

    with lcd("docs"):
        local("make html")


@task()
@requires("open")
def view(**options):
    """View the Documentation"""

    with lcd("docs"):
        local("open build/html/index.html")

## Instruction:
Use webbrowser.open_new_tab() instead of platform dependent open
## Code After:

"""Documentation Tasks"""

from fabric.api import lcd, local, task

from .utils import pip, requires


PACKAGE = "src/ccav"


@task()
@requires("sphinx-apidoc")
def api():
    """Generate the API Documentation"""

    if PACKAGE is not None:
        local("sphinx-apidoc -f -T -o docs/source/api {0:s}".format(PACKAGE))


@task()
@requires("make")
def clean():
    """Delete Generated Documentation"""

    with lcd("docs"):
        local("make clean")


@task(default=True)
@requires("make")
def build(**options):
    """Build the Documentation"""

    pip(requirements="docs/requirements.txt")

    with lcd("docs"):
        local("make html")


@task()
def view(**options):
    """View the Documentation"""

    with lcd("docs"):
        import webbrowser
        webbrowser.open_new_tab("build/html/index.html")
