]> git.scottworley.com Git - paperdoorknob/blobdiff - paperdoorknob.py
entries() convenience method
[paperdoorknob] / paperdoorknob.py
index 0c6ec856b50377f1b895a2dfe2d9681badf93dba..6cc76a2f56d465fdf0c897b601dfbaa25dd86d03 100644 (file)
@@ -6,6 +6,7 @@
 
 
 from argparse import ArgumentParser
+import itertools
 import os.path
 
 from typing import Iterable
@@ -33,6 +34,9 @@ class Post:
         assert all(isinstance(r, Tag) for r in replies)
         return replies
 
+    def entries(self) -> Iterable[Tag]:
+        return itertools.chain([self.text()], self.replies())
+
 
 def command_line_parser() -> ArgumentParser:
     parser = ArgumentParser(prog='paperdoorknob', description='Print glowfic')