def build_event_set(event):
    """
    Turn an EventStream event into a set of event types that ORES
    uses internally.
    """
    event_set = set()
    if re.match(r"([^\.]+.)?mediawiki\.revision-create$",
                event['meta']['topic']):
        event_set.add('edit')

        user_groups = event.get('performer', {}).get('user_groups', [])
        if 'bot' in user_groups:
            event_set.add('bot_edit')
        else:
            event_set.add('nonbot_edit')

        if not event.get('rev_parent_id'):
            event_set.add('page_creation')
            if 'bot' in user_groups:
                event_set.add('bot_page_creation')
            else:
                event_set.add('nonbot_page_creation')

    return event_set
def build_event_set ( event ) : event_set = set ( ) if re . match ( r"([^\.]+.)?mediawiki\.revision-create$" , event [ 'meta' ] [ 'topic' ] ) : event_set . add ( 'edit' ) user_groups = event . get ( 'performer' , { } ) . get ( 'user_groups' , [ ] ) if 'bot' in user_groups : event_set . add ( 'bot_edit' ) else : event_set . add ( 'nonbot_edit' ) if not event . get ( 'rev_parent_id' ) : event_set . add ( 'page_creation' ) if 'bot' in user_groups : event_set . add ( 'bot_page_creation' ) else : event_set . add ( 'nonbot_page_creation' ) return event_set
Turn an EventStream event into a set of event types that ORES
    uses internally.