<s> '''<STR_LIT>''' <EOL> import sys <EOL> from StringIO import StringIO <EOL> from hachoir_metadata import extractMetadata <EOL> from hachoir_parser import guessParser <EOL> from hachoir_core . stream import InputIOStream <EOL> def META_OLECF ( s , buff ) : <EOL> META_DICT = { } <EOL> try : <EOL> stream = InputIOStream ( StringIO ( buff ) ) <EOL> parser = guessParser ( stream ) <EOL> meta = extractMetadata ( parser ) <EOL> except : <EOL> return META_DICT <EOL> for data in sorted ( meta ) : <EOL> if data . values : <EOL> if len ( data . values ) == <NUM_LIT:1> : <EOL> META_DICT [ '<STR_LIT:%s>' % data . key ] = data . values [ <NUM_LIT:0> ] . text <EOL> else : <EOL> values = [ ] <EOL> for value in data . values : <EOL> values . append ( value . text ) <EOL> META_DICT [ '<STR_LIT:%s>' % data . key ] = values <EOL> return META_DICT <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> print META_OLECF ( None , sys . stdin . read ( ) ) </s>
