<commit_before>
import flask
from os.path import join, dirname

from . import wsmanager
from .models import convenience as mconv
from .models import docs

class BokehBlueprint(flask.Blueprint):

    def __init__(self, *args, **kwargs):
        super(BokehBlueprint, self).__init__(*args, **kwargs)
        self.debugjs = None

    def setup(self, backend, backbone_storage, servermodel_storage, 
              authentication, datamanager):
        self.datamanager = datamanager
        self.backend = backend
        self.backbone_storage = backbone_storage
        self.servermodel_storage = servermodel_storage
        self.authentication = authentication
        self.wsmanager = wsmanager.WebSocketManager()

        def auth(auth, docid):
            doc = docs.Doc.load(self.servermodel_storage, docid)
            status = mconv.can_write_doc_api(doc, auth, self)
            return status
        self.wsmanager.register_auth("bokehplot", auth)

        if self.debugjs:
            basedir = dirname(dirname(dirname(__file__)))
            self.bokehjsdir = join(basedir, "bokehjs", "build")
            self.bokehjssrcdir = join(basedir, "bokehjs", "src")
        else:
            self.bokehjsdir = join(dirname(__file__), 'static')
            self.bokehjssrcdir = None

    def current_user(self):
        return self.authentication.current_user()

bokeh_app = BokehBlueprint(
    'bokeh.server',
    'bokeh.server',
    static_folder='static',
    static_url_path='/bokeh/static',
    template_folder='templates'
)<commit_msg>Use absolute server path when setting up bokehjsdir<commit_after>
import flask
from os.path import join, dirname, abspath

from . import wsmanager
from .models import convenience as mconv
from .models import docs

class BokehBlueprint(flask.Blueprint):

    def __init__(self, *args, **kwargs):
        super(BokehBlueprint, self).__init__(*args, **kwargs)
        self.debugjs = None

    def setup(self, backend, backbone_storage, servermodel_storage,
              authentication, datamanager):
        self.datamanager = datamanager
        self.backend = backend
        self.backbone_storage = backbone_storage
        self.servermodel_storage = servermodel_storage
        self.authentication = authentication
        self.wsmanager = wsmanager.WebSocketManager()

        def auth(auth, docid):
            doc = docs.Doc.load(self.servermodel_storage, docid)
            status = mconv.can_write_doc_api(doc, auth, self)
            return status
        self.wsmanager.register_auth("bokehplot", auth)

        server_dir = dirname(abspath(__file__))
        if self.debugjs:
            basedir = dirname(dirname(server_dir))
            self.bokehjsdir = join(basedir, "bokehjs", "build")
            self.bokehjssrcdir = join(basedir, "bokehjs", "src")
        else:
            self.bokehjsdir = join(server_dir, 'static')
            self.bokehjssrcdir = None

    def current_user(self):
        return self.authentication.current_user()

bokeh_app = BokehBlueprint(
    'bokeh.server',
    'bokeh.server',
    static_folder='static',
    static_url_path='/bokeh/static',
    template_folder='templates'
)
{'fraction_non_alphanumeric': 0.0961416824794434, 'fraction_numerical': 0.0, 'mean_word_length': 2.900123304562269, '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': '2441522', 'n_tokens_mistral': 977, 'n_tokens_neox': 956, 'n_words': 198}