aboutsummaryrefslogtreecommitdiff
path: root/wordcount/src/spouts
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2021-10-10 11:13:47 -0600
committerCody Hiar <cody@hiar.ca>2021-10-10 11:13:47 -0600
commit5367edb8b37a6dac76ac7cd608ac3c005b7b225e (patch)
treeff2a381fba100dc1c7961e625f372f63e2998dcd /wordcount/src/spouts
Work in progress
Diffstat (limited to 'wordcount/src/spouts')
-rw-r--r--wordcount/src/spouts/__init__.py0
-rw-r--r--wordcount/src/spouts/words.py14
2 files changed, 14 insertions, 0 deletions
diff --git a/wordcount/src/spouts/__init__.py b/wordcount/src/spouts/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/wordcount/src/spouts/__init__.py
diff --git a/wordcount/src/spouts/words.py b/wordcount/src/spouts/words.py
new file mode 100644
index 0000000..6ba88c1
--- /dev/null
+++ b/wordcount/src/spouts/words.py
@@ -0,0 +1,14 @@
+from itertools import cycle
+
+from streamparse import Spout
+
+
+class WordSpout(Spout):
+ outputs = ["word"]
+
+ def initialize(self, stormconf, context):
+ self.words = cycle(["dog", "cat", "zebra", "elephant"])
+
+ def next_tuple(self):
+ word = next(self.words)
+ self.emit([word])