From bf06f467bd363cb9fc9b1ad581b298a99d3d122b Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Tue, 19 Dec 2023 01:32:43 -0800 Subject: [PATCH 1/1] =?utf8?q?Rename:=20fetch=20=E2=86=92=20parse?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- paperdoorknob.py | 6 +++--- paperdoorknob_test.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) 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."]) -- 2.44.1