def __init__(self, serializer = None, endpoint = None, topic = None, tweetsPerLine = None): """ """ self.kafka = KafkaTransceiver(endpoint) self.topic = topic self.tweetsPerLine = tweetsPerLine TweetStore.__init__(self, serializer) print("created KTS, tweetsPerLine %d" % self.tweetsPerLine)
def __init__(self, endpoint, classify=True, serializer = None, tweetsPerLine=100): """ """ self.c = RemoteTweetClassifier(endpoint, silent=True) self.meth = self.c.isHarassingTweet if classify else self.c.addHarassingTweet self.tweetsPerLine = tweetsPerLine TweetStore.__init__(self, serializer) print("created CTS, tweetsPerLine %d" % self.tweetsPerLine)
def __init__(self, serializer = None, pathPattern = "%Y-%m-%d/tweets-%05n", maxTweets = -1, maxSize = -1): """ Set policy of how tweets are stored. maxTweets - max # of tweets per file maxSize - tweets will be written to a new file once current one exceeds this limit in bytes pathPattern - a pattern for how files containing tweets will be named. can contain %-directives. %n indicate a file number, all others are as in strftime, which see. a pattern like "%Y-%m-%d/%04n" will put tweets in a file named 2015-01-01/0001. As time passes, those files will move to 2015-01-02. """ TweetStore.__init__(self, serializer) self.pathPattern = pathPattern self.nFiles = 0 self.file = None self._path = None self.maxTweets = maxTweets self.maxSize = maxSize self.once = True if '%n' not in self.pathPattern else None ReentrantMethod(self, self.close)
def __init__(self, serializer = None, tweetsPerLine=100): self.tweetsPerLine = tweetsPerLine TweetStore.__init__(self, serializer)