<commit_before>from twython import Twython, TwythonError
from datetime import date, timedelta
import twitter_settings
import sentiment


OAUTH_TOKEN = twitter_settings.oauth_token
OAUTH_TOKEN_SECRET = twitter_settings.oauth_token_secret

APP_KEY = twitter_settings.consumer_key
APP_SECRET = twitter_settings.consumer_secret

username = twitter_settings.username

twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
try:
    user_timeline = twitter.get_user_timeline(screen_name=username, count=200)
except TwythonError as e:
    print e

date_str = str((date.today() - timedelta(days=0)).strftime('%a %b %d'))
date_key = str((date.today() - timedelta(days=0)).strftime('%y%m%d'))


tweet_count = 0
total_sentiment_score = 0
tweets = ""


for i in range(0, len(user_timeline)):
    if date_str in user_timeline[i]['created_at']:
        tweet_count += 1
        sentiment_score = sentiment.get_sentiment(user_timeline[i]['text'])
        total_sentiment_score += sentiment_score
        tweets += user_timeline[i][
            'text'] + ' - ' + str(sentiment_score) + '\n'
    else:
        break
avg_sentiment_score = total_sentiment_score / tweet_count
print "Today's tweet count for " + username + ": " + str(tweet_count)
print('\nAvg Sentiment Score : %.2f' % avg_sentiment_score)<commit_msg>oops, we don't want to divide by zero 😅<commit_after>from twython import Twython, TwythonError
from datetime import date, timedelta
import twitter_settings
import sentiment


OAUTH_TOKEN = twitter_settings.oauth_token
OAUTH_TOKEN_SECRET = twitter_settings.oauth_token_secret

APP_KEY = twitter_settings.consumer_key
APP_SECRET = twitter_settings.consumer_secret

username = twitter_settings.username

twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
try:
    user_timeline = twitter.get_user_timeline(screen_name=username, count=200)
except TwythonError as e:
    print e

date_str = str((date.today() - timedelta(days=0)).strftime('%a %b %d'))
date_key = str((date.today() - timedelta(days=0)).strftime('%y%m%d'))


tweet_count = 0
total_sentiment_score = 0
tweets = ""


for i in range(0, len(user_timeline)):
    if date_str in user_timeline[i]['created_at']:
        tweet_count += 1
        sentiment_score = sentiment.get_sentiment(user_timeline[i]['text'])
        total_sentiment_score += sentiment_score
        tweets += user_timeline[i][
            'text'] + ' - ' + str(sentiment_score) + '\n'
    else:
        break
if tweet_count > 0:
    avg_sentiment_score = total_sentiment_score / tweet_count
    print "Today's tweet count for " + username + ": " + str(tweet_count)
    print('\nAvg Sentiment Score : %.2f' % avg_sentiment_score)
else:
    print 'No tweets for ' + username + ' @ '
{'fraction_non_alphanumeric': 0.10985401459854015, 'fraction_numerical': 0.007664233576642336, 'mean_word_length': 4.722338204592902, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 4, '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': '5857300', 'n_tokens_mistral': 994, 'n_tokens_neox': 941, 'n_words': 194}