<commit_before>from watcher import NotebookWatcher, CodeVisitor
from wrapper import prov, replace
from builder import get_dataset, save_prov, clear_dataset
from viewer import Viewer

from ducktape import Ducktape

import logging

log = logging.getLogger('provomatic.extension')
log.setLevel(logging.DEBUG)





        







def load_ipython_extension(ip):
    # Push the prov and replace wrapper functions
    ip.push('prov')
    ip.push('replace')
    
    # Push the save_prov function (for saving the generated provenance trace to a file)    
    ip.push('save_prov')
    
    # Clear the provenance graph
    # clear_dataset()
    
    ## Initialize the PROV-O-Viz adapter
    viewer = Viewer()
    set_provoviz_url = viewer.set_provoviz_url
    view_prov = viewer.view_prov
    # Push the functions to the IPython Notebook
    ip.push('set_provoviz_url')
    ip.push('view_prov')
    
    ## Initialize the Ducktape loader
    ducktape = Ducktape(ip)
    load_ducktape = ducktape.load
    ip.push('load_ducktape')
    
    ## Initialize the notebookwatcher and code visitor.
    nw = NotebookWatcher(ip)
    cv = CodeVisitor(nw)
    
    ip.events.register('pre_execute', nw.pre_execute)
    ip.events.register('post_execute', nw.post_execute)
    ip.ast_transformers.append(cv)
    
    
<commit_msg>Some debug messages<commit_after>from watcher import NotebookWatcher, CodeVisitor
from wrapper import prov, replace
from builder import get_dataset, save_prov, clear_dataset
from viewer import Viewer

from ducktape import Ducktape

import logging

log = logging.getLogger('provomatic.extension')
log.setLevel(logging.WARNING)










def load_ipython_extension(ip):
    log.debug("Loading PROV-O-Matic extension")
    # Push the prov and replace wrapper functions
    ip.push('prov')
    ip.push('replace')
    
    # Push the save_prov function (for saving the generated provenance trace to a file)    
    ip.push('save_prov')
    
    # Clear the provenance graph
    # clear_dataset()
    
    ## Initialize the PROV-O-Viz adapter
    viewer = Viewer()
    set_provoviz_url = viewer.set_provoviz_url
    view_prov = viewer.view_prov
    view_local_prov = viewer.view_local_prov
    # Push the functions to the IPython Notebook
    ip.push('set_provoviz_url')
    ip.push('view_prov')
    ip.push('view_local_prov')
    
    ## Initialize the Ducktape loader
    ducktape = Ducktape(ip)
    load_ducktape = ducktape.load
    ip.push('load_ducktape')
    
    ## Initialize the notebookwatcher and code visitor.
    nw = NotebookWatcher(ip)
    cv = CodeVisitor(nw)
    
    ip.events.register('pre_execute', nw.pre_execute)
    ip.events.register('post_execute', nw.post_execute)
    ip.ast_transformers.append(cv)
    
    
    

{'fraction_non_alphanumeric': 0.08309037900874636, 'fraction_numerical': 0.0, 'mean_word_length': 3.3364928909952605, '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': '3280475', 'n_tokens_mistral': 899, 'n_tokens_neox': 865, 'n_words': 212}