<s> """<STR_LIT>""" <EOL> __version__ = '<STR_LIT>' <EOL> from _struct import Struct , error <EOL> _MAXCACHE = <NUM_LIT:100> <EOL> _cache = { } <EOL> def _compile ( fmt ) : <EOL> if len ( _cache ) >= _MAXCACHE : <EOL> _cache . clear ( ) <EOL> s = Struct ( fmt ) <EOL> _cache [ fmt ] = s <EOL> return s <EOL> def calcsize ( fmt ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> o = _cache [ fmt ] <EOL> except KeyError : <EOL> o = _compile ( fmt ) <EOL> return o . size <EOL> def pack ( fmt , * args ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> o = _cache [ fmt ] <EOL> except KeyError : <EOL> o = _compile ( fmt ) <EOL> return o . pack ( * args ) <EOL> def pack_into ( fmt , buf , offset , * args ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> o = _cache [ fmt ] <EOL> except KeyError : <EOL> o = _compile ( fmt ) <EOL> return o . pack_into ( buf , offset , * args ) <EOL> def unpack ( fmt , s ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> o = _cache [ fmt ] <EOL> except KeyError : <EOL> o = _compile ( fmt ) <EOL> return o . unpack ( s ) <EOL> def unpack_from ( fmt , buf , offset = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> o = _cache [ fmt ] <EOL> except KeyError : <EOL> o = _compile ( fmt ) <EOL> return o . unpack_from ( buf , offset ) </s>
