<s> from __future__ import absolute_import <EOL> from sentry . utils . strings import truncatechars , strip <EOL> class BaseEvent ( object ) : <EOL> id = None <EOL> def __init__ ( self , data ) : <EOL> self . data = data <EOL> def has_metadata ( self ) : <EOL> raise NotImplementedError <EOL> def get_metadata ( self ) : <EOL> raise NotImplementedError <EOL> class DefaultEvent ( BaseEvent ) : <EOL> key = '<STR_LIT:default>' <EOL> def has_metadata ( self ) : <EOL> return True <EOL> def get_metadata ( self ) : <EOL> message = strip ( self . data . get ( '<STR_LIT:message>' ) ) <EOL> if not message : <EOL> title = '<STR_LIT>' <EOL> else : <EOL> title = truncatechars ( message . splitlines ( ) [ <NUM_LIT:0> ] , <NUM_LIT:100> ) <EOL> return { <EOL> '<STR_LIT:title>' : title , <EOL> } </s>
