Skip to content

Commit

Permalink
Fix mypy for Entry.updated_not_none (for #183).
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon24 committed Jul 17, 2021
1 parent 8a4dfb0 commit 168b3ee
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/reader/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,16 @@ def feed_url(self) -> str:
"""The feed URL."""
return self.feed.url

# TODO: .id and .updated will still be set to some default value if the entry doesn't have them; we should at least document this.
# I'm not sure its useful to expose the original values. If we do it, it would be minimally invasive to add them as new attributes (even if it means id/updated don't always reflect their value in the feed); the names should work with the schemes proposed in #153 and #159.
# TODO: .id will still be set to some default value if the entry doesn't have it; document this.

# NOTE: In #183 (2.0 compat breaking), we made .updated optional,
# to allow it to reflect the feed value.
#
# The code to do so hasn't been changed yet,
# so its value is actually the same as before.
#
# To change that, we need to store/add a `first_updated` attribute,
# and change `updated_not_none` to `updated or first_updated`.

#: The entry id.
id: str
Expand Down Expand Up @@ -260,6 +268,8 @@ def updated_not_none(self) -> datetime:
Identical to the behavior of :attr:`updated` before 2.0.
"""
# for mypy
assert self.updated is not None
return self.updated


Expand Down

0 comments on commit 168b3ee

Please sign in to comment.