<s> """<STR_LIT>""" <EOL> from array import array <EOL> import reprlib <EOL> import math <EOL> class Vector : <EOL> typecode = '<STR_LIT:d>' <EOL> def __init__ ( self , components ) : <EOL> self . _components = array ( self . typecode , components ) <EOL> def __iter__ ( self ) : <EOL> return iter ( self . _components ) <EOL> def __repr__ ( self ) : <EOL> components = reprlib . repr ( self . _components ) <EOL> components = components [ components . find ( '<STR_LIT:[>' ) : - <NUM_LIT:1> ] <EOL> return '<STR_LIT>' . format ( components ) <EOL> def __str__ ( self ) : <EOL> return str ( tuple ( self ) ) <EOL> def __bytes__ ( self ) : <EOL> return ( bytes ( [ ord ( self . typecode ) ] ) + <EOL> bytes ( self . _components ) ) <EOL> def __eq__ ( self , other ) : <EOL> return tuple ( self ) == tuple ( other ) <EOL> def __abs__ ( self ) : <EOL> return math . sqrt ( sum ( x * x for x in self ) ) <EOL> def __bool__ ( self ) : <EOL> return bool ( abs ( self ) ) <EOL> @ classmethod <EOL> def frombytes ( cls , octets ) : <EOL> typecode = chr ( octets [ <NUM_LIT:0> ] ) <EOL> memv = memoryview ( octets [ <NUM_LIT:1> : ] ) . cast ( typecode ) <EOL> return cls ( memv ) </s>
