<commit_before>import os

from invoke import ctask as task, Collection


docs_dir = 'docs'
build_dir = os.path.join(docs_dir, '_build')


@task(aliases=['c'])
def _clean(ctx):
    ctx.run("rm -rf %s" % build_dir)


@task(aliases=['b'])
def _browse(ctx):
    ctx.run("open %s" % os.path.join(build_dir, 'index.html'))


@task(default=True)
def build(ctx, clean=False, browse=False):
    if clean:
        _clean(ctx)
    ctx.run("sphinx-build %s %s" % (docs_dir, build_dir), pty=True)
    if browse:
        _browse(ctx)

ns = Collection(clean=_clean, browse=_browse, build=build)<commit_msg>Make use of new collection config vector<commit_after>import os

from invoke import ctask as task, Collection


@task(aliases=['c'])
def _clean(ctx):
    ctx.run("rm -rf {0}".format(ctx['sphinx.target']))


@task(aliases=['b'])
def _browse(ctx):
    index = os.path.join(ctx['sphinx.target'], 'index.html')
    ctx.run("open {0}".format(index))


@task(default=True)
def build(ctx, clean=False, browse=False):
    if clean:
        _clean(ctx)
    cmd = "sphinx-build {0} {1}".format(
        ctx['sphinx.source'], ctx['sphinx.target']
    )
    ctx.run(cmd, pty=True)
    if browse:
        _browse(ctx)

ns = Collection(clean=_clean, browse=_browse, build=build)
ns.configure({
    'sphinx.source': 'docs',
    # TODO: allow lazy eval so one attr can refer to another?
    'sphinx.target': os.path.join('docs', '_build'),
})
{'fraction_non_alphanumeric': 0.17360621030345802, 'fraction_numerical': 0.0028228652081863093, 'mean_word_length': 4.0462633451957295, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2086842', 'n_tokens_mistral': 546, 'n_tokens_neox': 527, 'n_words': 117}