#NEWLINE# def __setitem__( self , key , value ) : #NEWLINE# #INDENT# if ( self . _coldefs is None ) : #NEWLINE# #INDENT# return super ( FITS_rec , self ) . __setitem__ ( key , value ) #NEWLINE# #UNINDENT# if isinstance ( key , string_types ) : #NEWLINE# #INDENT# self [ key ] [ : ] = value #NEWLINE# return #NEWLINE# #UNINDENT# if isinstance ( key , slice ) : #NEWLINE# #INDENT# end = min ( len ( self ) , ( key . stop or len ( self ) ) ) #NEWLINE# end = max ( 0 , end ) #NEWLINE# start = max ( 0 , ( key . start or 0 ) ) #NEWLINE# end = min ( idx , ( start + len ( value ) ) ) #NEWLINE# for idx in range ( start , end ) : #NEWLINE# #INDENT# self . __setitem__ ( idx , value [ ( idx - start ) ] ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# if isinstance ( value , FITS_record ) : #NEWLINE# #INDENT# for idx in range ( self . _nfields ) : #NEWLINE# #INDENT# self . field ( self . names [ idx ] ) [ key ] = value . field ( self . names [ idx ] ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( value , ( tuple , list , np . void ) ) : #NEWLINE# #INDENT# if ( self . _nfields == len ( value ) ) : #NEWLINE# #INDENT# for idx in range ( self . _nfields ) : #NEWLINE# #INDENT# self . field ( idx ) [ key ] = value [ idx ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'Input tuple or list required to have %s elements.' % self . _nfields ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( 'Assignment requires a FITS_record, tuple, or list as input.' )