from invoke import run
from invoke import task


@task
def clean(docs=False, bytecode=True, extra=''):
    patterns = ['build']
    if docs:
        patterns.append('docs/_build')
    if bytecode:
        patterns.append('**/*.pyc')
    if extra:
        patterns.append(extra)
    for pattern in patterns:
        run("rm -rf %s" % pattern)


@task
def build(docs=False):
    run("python setup.py build")
    if docs:
        run("sphinx-build docs docs/_build")


@task
def test():
    run("python setup.py test")


@task
def lint():
    run("flake8")

from invoke import run
from invoke import task


@task
def clean(all=False):
    if all:
        flag = "--all"
    else:
        flag = ""
    run("python setup.py clean {}".format(flag))


@task
def build(docs=False):
    run("python setup.py build")
    if docs:
        run("sphinx-build docs docs/_build")


@task
def test():
    run("python setup.py test")


@task
def lint():
    run("flake8")

Change clean task to use setup.py
Change clean task to use setup.py

  from invoke import run
  from invoke import task
  
  
  @task
+ def clean(all=False):
- def clean(docs=False, bytecode=True, extra=''):
-     patterns = ['build']
-     if docs:
-         patterns.append('docs/_build')
-     if bytecode:
-         patterns.append('**/*.pyc')
-     if extra:
+     if all:
-         patterns.append(extra)
-     for pattern in patterns:
-         run("rm -rf %s" % pattern)
+         flag = "--all"
+     else:
+         flag = ""
+     run("python setup.py clean {}".format(flag))
  
  
  @task
  def build(docs=False):
      run("python setup.py build")
      if docs:
          run("sphinx-build docs docs/_build")
  
  
  @task
  def test():
      run("python setup.py test")
  
  
  @task
  def lint():
      run("flake8")
  
Change clean task to use setup.py
## Code Before:
from invoke import run
from invoke import task


@task
def clean(docs=False, bytecode=True, extra=''):
    patterns = ['build']
    if docs:
        patterns.append('docs/_build')
    if bytecode:
        patterns.append('**/*.pyc')
    if extra:
        patterns.append(extra)
    for pattern in patterns:
        run("rm -rf %s" % pattern)


@task
def build(docs=False):
    run("python setup.py build")
    if docs:
        run("sphinx-build docs docs/_build")


@task
def test():
    run("python setup.py test")


@task
def lint():
    run("flake8")

## Instruction:
Change clean task to use setup.py
## Code After:
from invoke import run
from invoke import task


@task
def clean(all=False):
    if all:
        flag = "--all"
    else:
        flag = ""
    run("python setup.py clean {}".format(flag))


@task
def build(docs=False):
    run("python setup.py build")
    if docs:
        run("sphinx-build docs docs/_build")


@task
def test():
    run("python setup.py test")


@task
def lint():
    run("flake8")
