import random
import re
-import tweepy
+import tweepy # type: ignore
from typing import Dict, List
import file_writer
def __init__(self, name_to_timeout_dict: Dict[str, int]) -> None:
super(twitter_renderer, self).__init__(name_to_timeout_dict, False)
self.debug = True
- self.tweets_by_author = {}
- self.handles_by_author = {}
+ self.tweets_by_author: Dict[str, List[tweepy.models.Status]] = {}
+ self.handles_by_author: Dict[str, str] = {}
self.filter = profanity_filter.profanity_filter()
self.urlfinder = re.compile(
"((http|https)://[\-A-Za-z0-9\\.]+/[\?\&\-A-Za-z0-9_\\.]+)"
elif key == "Shuffle Tweets":
return self.shuffle_tweets()
else:
- raise error("Unexpected operation")
+ raise Exception("Unexpected operation")
def fetch_tweets(self) -> bool:
try:
# Test
# t = twitter_renderer(
-# {"Fetch Tweets" : 1,
-# "Shuffle Tweets" : 1})
+# {"Fetch Tweets" : 1,
+# "Shuffle Tweets" : 1})
# x = "bla bla bla https://t.co/EjWnT3UA9U bla bla"
# x = t.linkify(x)
-# print x
+# print(x)
# if t.fetch_tweets() == 0:
-# print("Error fetching tweets, none fetched.")
+# print("Error fetching tweets, none fetched.")
# else:
-# t.shuffle_tweets()
+# t.shuffle_tweets()