Skip to content

Commit

Permalink
added narek
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Morris committed Dec 26, 2023
1 parent 6385278 commit bf62cd8
Show file tree
Hide file tree
Showing 4 changed files with 865 additions and 120 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
poems
-----

All of the poems in here are good, or interesting. There are currently 6,985 poems by 449 poets.
All of the poems in here are good, or interesting. There are currently 7,078 poems by 452 poets.


usage
Expand Down
28 changes: 1 addition & 27 deletions poemsfromtom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,7 @@ class Author():

@property
def dates(self) -> str:

# this assumes no one born before Christ is still alive
if not self.death:
if not self.birth:
return ""
else:
return f"(born {self.birth})"

birth_is_circa = True if "~" in self.birth else False
death_is_circa = True if "~" in self.death else False

b = int(self.birth.strip("~"))
d = int(self.death.strip("~"))

birth_string, death_string = str(abs(b)), str(abs(d))

birth_string = f'{"c. " if birth_is_circa else ""}{abs(b)}'
death_string = f'{"c. " if death_is_circa else ""}{abs(d)}'

if b < 0:
birth_string += " BC"
if d < 0:
death_string += " BC"
else:
death_string += " AD"

return f"({birth_string} -- {death_string})"
return utils.dates_string(self.birth, self.death)

@dataclass
class Poem():
Expand Down
Loading

0 comments on commit bf62cd8

Please sign in to comment.