<commit_before>import re
from trac.web.api import ITemplateStreamFilter
from trac.log import logger_factory
from trac.core import *
from genshi.builder import tag
from trac.web import IRequestHandler
from trac.util import Markup
from trac.web.href import Href
from genshi.filters.transform import Transformer
from trac.web.api import ITemplateStreamFilter


class TicketWebUiAddon(Component):
    implements(ITemplateStreamFilter)
    
    def __init__(self):
        pass

    # ITemplateStreamFilter
    def filter_stream(self, req, method, filename, stream, data):
        self.log.debug("TicketWebUiAddon executing") 
        if not filename == 'ticket.html':
            self.log.debug("TicketWebUiAddon not the correct template")
            return stream
        stream = stream | Transformer('//div[@id="banner"]').before(
            tag.script(type="text/javascript", 
                       src=req.href.chrome("Billing", "ticket.js"))()
            )
        return stream<commit_msg>removed misleading log message re #6478<commit_after>import re
from trac.web.api import ITemplateStreamFilter
from trac.log import logger_factory
from trac.core import *
from genshi.builder import tag
from trac.web import IRequestHandler
from trac.util import Markup
from trac.web.href import Href
from genshi.filters.transform import Transformer
from trac.web.api import ITemplateStreamFilter


class TicketWebUiAddon(Component):
    implements(ITemplateStreamFilter)
    
    def __init__(self):
        pass

    # ITemplateStreamFilter
    def filter_stream(self, req, method, filename, stream, data):
        self.log.debug("TicketWebUiAddon executing") 
        if not filename == 'ticket.html':
            #self.log.debug("TicketWebUiAddon not emitting ticket javascript because we are not on ticket.html")
            return stream
        stream = stream | Transformer('//div[@id="banner"]').before(
            tag.script(type="text/javascript", 
                       src=req.href.chrome("Billing", "ticket.js"))()
            )
        return stream
{'fraction_non_alphanumeric': 0.08887809616318601, 'fraction_numerical': 0.001942690626517727, 'mean_word_length': 3.178498985801217, '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': '1678241', 'n_tokens_mistral': 585, 'n_tokens_neox': 559, 'n_words': 154}