core: improvements for warnings, twitter/rss: try using @warn_if_empty

This commit is contained in:
Dima Gerasimov 2020-05-25 00:56:03 +01:00
parent 616ffb457e
commit 216944b3cd
5 changed files with 35 additions and 17 deletions

View file

@ -3,11 +3,9 @@ Unified Twitter data (merged from the archive and periodic updates)
"""
# NOTE: you can comment out the sources you don't need
from . import twint, archive
from .common import merge_tweets
from .common import merge_tweets
def tweets():
yield from merge_tweets(
@ -15,6 +13,7 @@ def tweets():
archive.tweets(),
)
from .common import merge_tweets
def likes():
yield from merge_tweets(

View file

@ -2,7 +2,9 @@ from itertools import chain
from more_itertools import unique_everseen
from ..core import warn_if_empty
@warn_if_empty
def merge_tweets(*sources):
yield from unique_everseen(
chain(*sources),