<commit_before>import os, sys, datetime
import countershape
from countershape import Page, Directory, PythonModule, markup, model
import countershape.template
sys.path.insert(0, "..")
from libmproxy import filt, version

MITMPROXY_SRC = os.path.abspath("..")
ns.VERSION = version.VERSION

if ns.options.website:
    ns.idxpath = "doc/index.html"
    this.layout = countershape.Layout("_websitelayout.html")
else:
    ns.idxpath = "index.html"
    this.layout = countershape.Layout("_layout.html")


ns.title = countershape.template.Template(None, "<h1>@!this.title!@</h1>")
this.titlePrefix = "%s - " % version.NAMEVERSION
this.markup = markup.Markdown(extras=["footnotes"])

ns.docMaintainer = "<NAME>"
ns.docMaintainerEmail = "<EMAIL>"
ns.copyright = u"\u00a9 mitmproxy project, %s" % datetime.date.today().year

def mpath(p):
    p = os.path.join(MITMPROXY_SRC, p)
    return os.path.expanduser(p)

with open(mpath("README.mkd")) as f:
        readme = f.read()
        ns.index_contents = readme.split("\n", 1)[1] #remove first line (contains build status)

def example(s):
    d = file(mpath(s)).read().rstrip()<commit_msg>Optionally take the mitmproxy path for doc rendering from a env variable.<commit_after>import os, sys, datetime
import countershape
from countershape import Page, Directory, PythonModule, markup, model
import countershape.template
sys.path.insert(0, "..")
from libmproxy import filt, version

MITMPROXY_SRC = os.environ.get("MITMPROXY_SRC", os.path.abspath(".."))
ns.VERSION = version.VERSION

if ns.options.website:
    ns.idxpath = "doc/index.html"
    this.layout = countershape.Layout("_websitelayout.html")
else:
    ns.idxpath = "index.html"
    this.layout = countershape.Layout("_layout.html")


ns.title = countershape.template.Template(None, "<h1>@!this.title!@</h1>")
this.titlePrefix = "%s - " % version.NAMEVERSION
this.markup = markup.Markdown(extras=["footnotes"])

ns.docMaintainer = "<NAME>"
ns.docMaintainerEmail = "<EMAIL>"
ns.copyright = u"\u00a9 mitmproxy project, %s" % datetime.date.today().year

def mpath(p):
    p = os.path.join(MITMPROXY_SRC, p)
    return os.path.expanduser(p)

with open(mpath("README.mkd")) as f:
        readme = f.read()
        ns.index_contents = readme.split("\n", 1)[1] #remove first line (contains build status)

def example(s):
    d = file(mpath(s)).read().rstrip()
{'fraction_non_alphanumeric': 0.15495955725840782, 'fraction_numerical': 0.006811409110259685, 'mean_word_length': 4.516431924882629, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7438874', 'n_tokens_mistral': 826, 'n_tokens_neox': 814, 'n_words': 173}