<s> import sys <EOL> import logging <EOL> import lxml . etree as etree <EOL> import antd . garmin as garmin <EOL> import antd . tcx as tcx <EOL> import antd . cfg as cfg <EOL> cfg . init_loggers ( logging . DEBUG , out = sys . stderr ) <EOL> if len ( sys . argv ) != <NUM_LIT:2> : <EOL> print "<STR_LIT>" % sys . argv [ <NUM_LIT:0> ] <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> with open ( sys . argv [ <NUM_LIT:1> ] ) as file : <EOL> host = garmin . MockHost ( file . read ( ) ) <EOL> for idx , pkt in enumerate ( host . reader ) : <EOL> if pkt : <EOL> pid , length , data = garmin . unpack ( pkt ) <EOL> data = "<STR_LIT:\n>" . join ( [ ( d if not idx else ( "<STR_LIT:U+0020>" * <NUM_LIT> ) + d ) for idx , d in enumerate ( garmin . chunk ( data . encode ( "<STR_LIT>" ) , <NUM_LIT:32> ) ) ] ) <EOL> print "<STR_LIT>" % ( idx , pid , length , data ) <EOL> else : <EOL> print "<STR_LIT>" % idx </s>
