<commit_before>from django.shortcuts import render
from django.http import HttpResponse, JsonResponse

from .stocktwits import get_stock_comments, format_into_table, save_message
from .reddit import (
    get_companies,
    ticker_to_name,
    save_reddit_articles,
    scrape_reddit
)


def index(request):
    return render(request, 'index.html')


def test(request, ticker):
    ticker = ticker.upper()
    messages = get_stock_comments(ticker)
    for index, message in enumerate(messages):
        message = format_into_table(message, ticker)
        messages[index] = message
        save_message(message)
    try:
        import pdb; pdb.set_trace()

        companies = get_companies()
        query = ticker_to_name(companies, ticker)
        reddit_messages = scrape_reddit(ticker, query)
        save_reddit_articles(reddit_messages)
    except KeyError:
        reddit_messages = []
    return JsonResponse(messages + reddit_messages, safe=False)


def detail(request):
    return render(request, 'detail.html')
<commit_msg>Removed pdb<commit_after>from django.shortcuts import render
from django.http import HttpResponse, JsonResponse

from .stocktwits import get_stock_comments, format_into_table, save_message
from .reddit import (
    get_companies,
    ticker_to_name,
    save_reddit_articles,
    scrape_reddit
)


def index(request):
    return render(request, 'index.html')


def test(request, ticker):
    ticker = ticker.upper()
    messages = get_stock_comments(ticker)
    for index, message in enumerate(messages):
        message = format_into_table(message, ticker)
        messages[index] = message
        save_message(message)
    try:
        companies = get_companies()
        query = ticker_to_name(companies, ticker)
        reddit_messages = scrape_reddit(ticker, query)
        save_reddit_articles(reddit_messages)
    except KeyError:
        reddit_messages = []
    return JsonResponse(messages + reddit_messages, safe=False)


def detail(request):
    return render(request, 'detail.html')

{'fraction_non_alphanumeric': 0.08066896212493851, 'fraction_numerical': 0.0, 'mean_word_length': 3.7858823529411763, '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': '1249248', 'n_tokens_mistral': 614, 'n_tokens_neox': 610, 'n_words': 138}