<commit_before>import typing

from werkzeug.contrib.atom import AtomFeed, FeedEntry

from twitter_feed.core.hashtag import Hashtag
from twitter_feed.core.tweet import Tweet
from twitter_feed.core.user import User


def tweets_to_atom(tweets: typing.List[Tweet], title: str=None, url: str = None, host_url: str = None) -> AtomFeed:
    feed = AtomFeed(title or 'My feed', feed_url=url, url=host_url)

    for tweet in tweets:
        feed_content = tweet.text + '<br>'

        feed_content += '<b>Mentions:</b> '
        for mention in tweet.mentions:  # type:User
            feed_content += mention.name + '; '

        feed_content += '<br>'
        feed_content += '<b>Hashtags:</b> '
        for hashtag in tweet.hashtags:  # type:Hashtag
            feed_content += hashtag.text + '; '

        entry = FeedEntry(
            title=str(tweet.date.date) + tweet.user.name,
            id='urn:twitter_id:' + tweet.id_,
            author={'name': tweet.user.screen_name},
            published=tweet.date,
            updated=tweet.date,
            content_type='html',
            content=feed_content
        )

        feed.add(entry)

    return feed<commit_msg>done tweet atom serializer<commit_after>import typing

from werkzeug.contrib.atom import AtomFeed, FeedEntry

from twitter_feed.core.hashtag import Hashtag
from twitter_feed.core.tweet import Tweet
from twitter_feed.core.user import User


def tweets_to_atom(tweets: typing.List[Tweet], title: str=None, url: str = None, host_url: str = None) -> AtomFeed:
    feed = AtomFeed(title or 'My feed', feed_url=url, url=host_url)

    for tweet in tweets:
        feed_content = tweet.text + '<br>'

        feed_content += '<b>Mentions:</b> '
        for mention in tweet.mentions:  # type:User
            feed_content += mention.name + '; '

        feed_content += '<br>'
        feed_content += '<b>Hashtags:</b> '
        for hashtag in tweet.hashtags:  # type:Hashtag
            feed_content += hashtag.text + '; '

        entry = FeedEntry(
            title=tweet.user.name,
            id='urn:twitter_id:' + tweet.id_,
            author={'name': tweet.user.screen_name},
            published=tweet.date,
            updated=tweet.date,
            content_type='html',
            content=feed_content
        )

        feed.add(entry)

    return feed
{'fraction_non_alphanumeric': 0.11610968294772922, 'fraction_numerical': 0.0, 'mean_word_length': 2.485074626865672, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3394940', 'n_tokens_mistral': 770, 'n_tokens_neox': 727, 'n_words': 161}