From: Scott Worley Date: Tue, 19 Dec 2023 09:32:43 +0000 (-0800) Subject: Rename: fetch → parse X-Git-Url: http://git.scottworley.com/paperdoorknob/commitdiff_plain/bf06f467bd363cb9fc9b1ad581b298a99d3d122b?ds=sidebyside;hp=a64403ac570d0049c7b5a616d19fab37ab5cb4e8 Rename: fetch → parse --- diff --git a/paperdoorknob.py b/paperdoorknob.py index f83c9f8..31ce02c 100644 --- a/paperdoorknob.py +++ b/paperdoorknob.py @@ -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') diff --git a/paperdoorknob_test.py b/paperdoorknob_test.py index 49bef9f..9676e28 100644 --- a/paperdoorknob_test.py +++ b/paperdoorknob_test.py @@ -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."])