"""####################
Author: Nathan Mador-House
Title: Positively Twitter 
####################"""

"""####################
Index:
    1. Imports and Readme
    2. Functions 
    3. Main
    4. Testing
####################"""


###################################################################
# 1. IMPORTS AND README
###################################################################

import PositivityCheck
import tweepy
import authentication

###################################################################
# 2. FUNCTIONS
###################################################################

consumer_key = authentication.consumer_key
consumer_secret = authentication.consumer_secret
access_token = authentication.access_token
access_token_secret = authentication.access_secret

def authen():
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)
    api = tweepy.API(auth)
    return api

class tweeter(user_id):
    def __init__(self):
        self.tweets = []
        self.data = {"tweet_len": [], "neg_count": [],
                     "neg_total": [], "pos_count"; [],
                     "pos_total": [], "neutral_count": [],}
        self.analysis = {"most_positive": 0, "most_negative": 0, "average": 0}

        self.get_user_tweets()
        self.analyze_tweets()

    def get_user_tweets(self):
        user_tweets = api.user_timeline(user_id)
        for tweet in user_tweets:
           self.tweets.append(tweet.text)

    def analyze_tweets(self):
        for tweet in self.tweets:
            tweet_object = PositivityCheck.text_block(tweet)
            tweet_object.print_stats()

def get_home_tweets():
    # Change this to be user_timeline
    public_tweets = api.home_timeline(None, None, 1, None)
    for tweet in public_tweets:
        # print(dir(tweet))
        # print(tweet.user.name + " : " + tweet.text)
        return tweet.text

###################################################################
# 1. MAIN
###################################################################

api = authen()

def __main__(name):
    pass


###################################################################
# 1. TESTING
###################################################################

real_test_tweet = "RT @ott_ecodistrict: La famille Germain w @JimWatsonOttawa at the opening of a great, green hotel in the EcoDistrict @cmckenney https://t.c…"

print(get_tweets())

#print(real_test_tweet)
tweet_positivity(real_test_tweet)




@@ -996,301 +996,85 @@
     
-def __init__(self):%0A        self.tweets = %5B%5D%0A        self.data = %7B%22tweet_len%22: %5B%5D, %22neg_count%22: %5B%5D,%0A                     %22neg_total%22: %5B%5D, %22pos_count%22; %5B%5D,%0A                     %22pos_total%22: %5B%5D, %22neutral_count%22: %5B%5D,%7D%0A        self.analysis = %7B%22most_positive%22: 0, %22most_negative%22: 0, %22average%22: 0%7D
+tweet_text_objects = %5B%5D%0A    def __init__(self):%0A        self.tweets_text = %5B%5D
 %0A%0A  
@@ -1269,16 +1269,21 @@
 f.tweets
+_text
 .append(
@@ -1295,16 +1295,67 @@
 .text)%0A%0A
+    # Creates the tweet objects from just the text%0A
     def 
@@ -1467,24 +1467,76 @@
 lock(tweet)%0A
+            tweet_text_objects.append(tweet_object)%0A
             

Add some comments/continue work with objects.