Skip to content

Commit

Permalink
Minor get_feeds(), get_entries(), search_entries() cleanup. #325
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon24 committed Oct 28, 2023
1 parent 654c83c commit 52e6142
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/reader/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,9 @@ def get_feeds(
if limit is not None:
if not isinstance(limit, numbers.Integral) or limit < 1:
raise ValueError("limit should be a positive integer")
starting_after = _feed_argument(starting_after) if starting_after else None

rv = self._storage.get_feeds(
filter,
sort,
limit,
_feed_argument(starting_after) if starting_after else None,
)
rv = self._storage.get_feeds(filter, sort, limit, starting_after)

for rv_feed in rv:
yield fix_datetime_tzinfo(rv_feed, 'updated', 'added', 'last_updated')
Expand Down Expand Up @@ -1194,16 +1190,12 @@ def get_entries(
if limit is not None:
if not isinstance(limit, numbers.Integral) or limit < 1:
raise ValueError("limit should be a positive integer")
starting_after = _entry_argument(starting_after) if starting_after else None

if starting_after and sort == 'random':
raise ValueError("using starting_after with sort='random' not supported")

rv = self._storage.get_entries(
filter,
sort,
limit,
_entry_argument(starting_after) if starting_after else None,
)
rv = self._storage.get_entries(filter, sort, limit, starting_after)

for rv_entry in rv:
yield fix_datetime_tzinfo(
Expand Down Expand Up @@ -1785,17 +1777,12 @@ def search_entries(
if limit is not None:
if not isinstance(limit, numbers.Integral) or limit < 1:
raise ValueError("limit should be a positive integer")
starting_after = _entry_argument(starting_after) if starting_after else None

if starting_after and sort == 'random':
raise ValueError("using starting_after with sort='random' not supported")

return self._search.search_entries(
query,
filter,
sort,
limit,
_entry_argument(starting_after) if starting_after else None,
)
return self._search.search_entries(query, filter, sort, limit, starting_after)

def search_entry_counts(
self,
Expand Down

0 comments on commit 52e6142

Please sign in to comment.