fix: Do not parse the last ReadEra section

This commit is contained in:
Marty Oehme 2025-09-11 18:38:59 +02:00
parent db47ad686d
commit a9ff4152af
Signed by: Marty
GPG key ID: 4E535BC19C61886E
3 changed files with 35 additions and 19 deletions

View file

@ -44,11 +44,10 @@ class ReadEraExtractor:
def run(self, filename: Path) -> list[Annotation]:
"""Extract annotations from readera txt file.
Returns all readable annotations contained in the file
passed in, with highlights and notes if available.
Could theoretically return the annotation color but I
do not have access to a premium version of ReadEra so
I cannot add this feature.
Returns all readable annotations contained in the file passed in, with
highlights and notes if available. Could theoretically return the
annotation color but I do not have access to a premium version of
ReadEra so I cannot add this feature.
"""
content = self._read_file(filename)[2:]
if not content:
@ -56,7 +55,9 @@ class ReadEraExtractor:
annotations: list[Annotation] = []
split = "\n".join(content).split("\n*****\n")
# split for *** separators and remove the last entry since it is always
# empty
split = "\n".join(content).split("\n*****\n")[:-1]
note_pattern = re.compile(r"\n--.*")
for entry in split:
entry = entry.strip()

View file

@ -1,10 +1,27 @@
from pathlib import Path
from papis_extract.annotation import Annotation
from papis_extract.extractors.readera import ReadEraExtractor
valid_file = Path("tests/resources/ReadEra_sample.txt")
invalid_file = Path("tests/resources/Readest_sample.txt")
expected = [
Annotation(
file="tests/resources/ReadEra_sample.txt",
content="digital technologies of the twenty-first century can only exist thanks to this kind of outsourced labor. The relative invisibility of the tech supply chain is part of the ruse; American consumers do not see where smartphones come from.",
),
Annotation(
file="tests/resources/ReadEra_sample.txt",
content="We dont necessarily want our leaders to be average persons like us, even though we often enjoy hearing that famous celebrities eat the same fast food as regular people. ",
note="We continuously demystify our leaders - first through television, now through social media",
),
Annotation(
file="tests/resources/ReadEra_sample.txt",
content="Initially, the Internet was praised as a freer way to encounter information. In the early 1990s, digital theorist George Landow saw hypertext as a liberatory reading strategy.",
),
]
def test_identifies_readera_exports():
ex = ReadEraExtractor()
@ -15,3 +32,9 @@ def test_identifies_readera_exports():
def test_ignores_readest_exports():
ex = ReadEraExtractor()
assert not ex.can_process(invalid_file)
def test_entry_extractions():
ex = ReadEraExtractor()
result = ex.run(valid_file)
assert result == expected

View file

@ -1,25 +1,17 @@
The Circle of the Snake
Grafton Tanner
digital technologies of the twenty-first century can only exist thanks to this kind of outsourced labor. The relative invisibility of the tech supply chain is part of the ruse; American consumers do not see where smartphones come from. They do not see the conflict zones where coltan is mined to be used in electronic devices, or the sweatshops in which digital products are manufactured. The latest technologies arrive instead in pristine condition, as if delivered from on high.
digital technologies of the twenty-first century can only exist thanks to this kind of outsourced labor. The relative invisibility of the tech supply chain is part of the ruse; American consumers do not see where smartphones come from.
*****
We dont necessarily want our leaders to be average persons like us, even though we often enjoy hearing that famous celebrities eat the same fast food as regular people. But in the beginning of the twenty-first century, we carefully watch our public figures to ensure they do not commit an unconscionable act. Doing so helps to rid the public stage of bigots, even as it also threatens the last known walls of privacy. This is an inevitable tension that must be maintained as we open the door on the private lives of others
--We continuously demystify our leaders - first through television, now through social media, streams, docus, etc. this brings them down to our level, which is what this paragraph talks about
We dont necessarily want our leaders to be average persons like us, even though we often enjoy hearing that famous celebrities eat the same fast food as regular people.
--We continuously demystify our leaders - first through television, now through social media
*****
Initially, the Internet was praised as a freer way to encounter information. In the early 1990s, digital theorist George Landow saw hypertext as a liberatory reading strategy.¹⁶ He embraced it as a common good and thought hyperlinks would emancipate readers from the prison of the fixed word, allowing them to flow freely between various information sources. But what Landow never imagined is the exhaustion that could come from the endless, rootless process of reading in this way. Not everyone wants to jump from point to point without any center. Infinity might not always be alluring.
Landow puts the agency in the reader when he writes, anyone who uses hypertext makes his or her own interests the de facto organizing principle (or center) for the investigation at the moment.’¹⁷ But how much agency do we actually have when falling down the rabbit hole? What if we get lost in the hole where the center was? How much attention do we end up losing in a world where we must always multi-task and where reading itself is disrupted by one hyperlink after another? And who
*****
In the Dust of This Planet
Horror of Philosophy vol. 1
Eugene Thacker
In the first of a series of three books on the Horror of Philosophy,In the Dust of This Planetoffers the genre of horror as a way of thinking about the unthinkable.
Paperback: 978-1-84694-676-9 ebook: 978-1-78099-010-1
Initially, the Internet was praised as a freer way to encounter information.
In the early 1990s, digital theorist George Landow saw hypertext as a liberatory reading strategy.
*****