#NEWLINE# def encode( self ) : #NEWLINE# #INDENT# pieces = list ( ) #NEWLINE# pieces . append ( struct . pack ( '>H' , self . ticket ) ) #NEWLINE# assert isinstance ( self . queue , str_or_bytes ) , 'A non-string value was supplied for self.queue' #NEWLINE# data . encode_short_string ( pieces , self . queue ) #NEWLINE# bit_buffer = 0 #NEWLINE# if self . if_unused : #NEWLINE# #INDENT# bit_buffer = ( bit_buffer | ( 1 << 0 ) ) #NEWLINE# #UNINDENT# if self . if_empty : #NEWLINE# #INDENT# bit_buffer = ( bit_buffer | ( 1 << 1 ) ) #NEWLINE# #UNINDENT# if self . nowait : #NEWLINE# #INDENT# bit_buffer = ( bit_buffer | ( 1 << 2 ) ) #NEWLINE# #UNINDENT# pieces . append ( struct . pack ( 'B' , bit_buffer ) ) #NEWLINE# return pieces