<commit_before>
import numpy as np

from bokeh.sampledata.stocks import AAPL, FB, GOOG, IBM, MSFT
from bokeh.plotting import *

def stocks():

    output_file("stocks.html", title="stocks.py example")

    hold()

    line(np.array(AAPL['date'], dtype=np.datetime64).astype('int'), AAPL['adj_close'],
         x_axis_type = "datetime",
         color='#A6CEE3', tools="pan,zoom,resize",
         legend='AAPL')
    line(np.array(FB['date'], dtype=np.datetime64).astype('int'), FB['adj_close'],
         color='#1F78B4', tools="pan,zoom,resize",
         legend='FB')
    line(np.array(GOOG['date'], dtype=np.datetime64).astype('int'), GOOG['adj_close'],
          olor='#B2DF8A', tools="pan,zoom,resize",
         legend='GOOG')
    line(np.array(IBM['date'], dtype=np.datetime64).astype('int'), IBM['adj_close'],
         color='#33A02C', tools="pan,zoom,resize",
         legend='IBM')
    line(np.array(MSFT['date'], dtype=np.datetime64).astype('int'), MSFT['adj_close'],
         color='#FB9A99', tools="pan,zoom,resize",
         legend='MSFT')

    curplot().title = "Stock Closing Prices"
    xgrid()[0].grid_line_dash=""
    xgrid()[0].grid_line_alpha=0.3
    ygrid()[0].grid_line_dash=""
    ygrid()[0].grid_line_alpha=0.3

    figure()

    aapl = np.array(AAPL['adj_close'])
    aapl_dates = np.array(AAPL['date'], dtype=np.datetime64).astype('int')

    window_size = 30
    window = np.ones(window_size)/float(window_size)
    aapl_avg = np.convolve(aapl, window, 'same')

    scatter(aapl_dates, aapl,
            x_axis_type = "datetime",
            color='#A6CEE3', radius=1, tools="pan,zoom,resize,embed", legend='close')
    line(aapl_dates, aapl_avg,
         color='red', tools="pan,zoom,resize", legend='avg', name="stocks")

    curplot().title = "AAPL One-Month Average"
    xgrid()[0].grid_line_dash=""
    xgrid()[0].grid_line_alpha=0.3
    ygrid()[0].grid_line_dash=""
    ygrid()[0].grid_line_alpha=0.3

    return curplot()

if __name__ == "__main__":
    stocks()
    show()  # open a browser
<commit_msg>removed embed_tool because it isn't applicable to file based plots<commit_after>
import numpy as np

from bokeh.sampledata.stocks import AAPL, FB, GOOG, IBM, MSFT
from bokeh.plotting import *

def stocks():

    output_file("stocks.html", title="stocks.py example")

    hold()

    line(np.array(AAPL['date'], dtype=np.datetime64).astype('int'), AAPL['adj_close'],
         x_axis_type = "datetime",
         color='#A6CEE3', tools="pan,zoom,resize",
         legend='AAPL')
    line(np.array(FB['date'], dtype=np.datetime64).astype('int'), FB['adj_close'],
         color='#1F78B4', tools="pan,zoom,resize",
         legend='FB')
    line(np.array(GOOG['date'], dtype=np.datetime64).astype('int'), GOOG['adj_close'],
          olor='#B2DF8A', tools="pan,zoom,resize",
         legend='GOOG')
    line(np.array(IBM['date'], dtype=np.datetime64).astype('int'), IBM['adj_close'],
         color='#33A02C', tools="pan,zoom,resize",
         legend='IBM')
    line(np.array(MSFT['date'], dtype=np.datetime64).astype('int'), MSFT['adj_close'],
         color='#FB9A99', tools="pan,zoom,resize",
         legend='MSFT')

    curplot().title = "Stock Closing Prices"
    xgrid()[0].grid_line_dash=""
    xgrid()[0].grid_line_alpha=0.3
    ygrid()[0].grid_line_dash=""
    ygrid()[0].grid_line_alpha=0.3

    figure()

    aapl = np.array(AAPL['adj_close'])
    aapl_dates = np.array(AAPL['date'], dtype=np.datetime64).astype('int')

    window_size = 30
    window = np.ones(window_size)/float(window_size)
    aapl_avg = np.convolve(aapl, window, 'same')

    scatter(aapl_dates, aapl,
            x_axis_type = "datetime",
            color='#A6CEE3', radius=1, tools="pan,zoom,resize", legend='close')
    line(aapl_dates, aapl_avg,
         color='red', tools="pan,zoom,resize", legend='avg', name="stocks")

    curplot().title = "AAPL One-Month Average"
    xgrid()[0].grid_line_dash=""
    xgrid()[0].grid_line_alpha=0.3
    ygrid()[0].grid_line_dash=""
    ygrid()[0].grid_line_alpha=0.3

    return curplot()

if __name__ == "__main__":
    stocks()
    show()  # open a browser

{'fraction_non_alphanumeric': 0.18848676220548943, 'fraction_numerical': 0.023317949963565704, 'mean_word_length': 3.8333333333333335, 'pattern_counts': {'":': 2, '<': 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': '6937703', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1495, 'n_words': 225}