]> git.scottworley.com Git - paperdoorknob/commitdiff
Rename: fetch → parse
authorScott Worley <scottworley@scottworley.com>
Tue, 19 Dec 2023 09:32:43 +0000 (01:32 -0800)
committerScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 04:09:47 +0000 (20:09 -0800)
paperdoorknob.py
paperdoorknob_test.py

index f83c9f869651a0a35fd86fdf11fdb004e5e5ae4d..31ce02c494ea29aadc8794d75f11ee8397729a2c 100644 (file)
@@ -40,8 +40,8 @@ def command_line_parser() -> ArgumentParser:
     return parser
 
 
-def fetch(url: str, fetcher: Fetcher) -> BeautifulSoup:
-    return BeautifulSoup(fetcher.fetch(url), 'html.parser')
+def parse(content: bytes) -> BeautifulSoup:
+    return BeautifulSoup(content, 'html.parser')
 
 
 def clean(html: BeautifulSoup) -> BeautifulSoup:
@@ -81,7 +81,7 @@ def process(
         texout: IO[bytes],
         pandoc: str) -> None:
     texout.write(b'\\documentclass{article}\n\\begin{document}\n')
-    html = clean(fetch(url, fetcher))
+    html = clean(parse(fetcher.fetch(url)))
     for r in replies(html):
         texout.write(html_to_tex(pandoc, r))
     texout.write(b'\\end{document}\n')
index 49bef9f006a699995c47ed1cf5010b53ede8fb4a..9676e286aaae11eb1959cb5868af85e6f3681d25 100644 (file)
@@ -24,7 +24,8 @@ class TestPaperDoorknob(unittest.TestCase):
         with DirectFetcher(TIMEOUT) as f:
             replies = paperdoorknob.replies(
                 paperdoorknob.clean(
-                    paperdoorknob.fetch(f"http://localhost:{self._port}", f)))
+                    paperdoorknob.parse(
+                        f.fetch(f"http://localhost:{self._port}"))))
             self.assertEqual([r.text.strip() for r in replies],
                              ["This is glowfic", "You sure?", "Pretty sure."])