<s> """<STR_LIT>""" <EOL> class cidict ( dict ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , default = None ) : <EOL> self . _keys = { } <EOL> super ( cidict , self ) . __init__ ( { } ) <EOL> self . update ( default or { } ) <EOL> def __getitem__ ( self , key ) : <EOL> return super ( cidict , self ) . __getitem__ ( key . lower ( ) ) <EOL> def __setitem__ ( self , key , value ) : <EOL> lower_key = key . lower ( ) <EOL> self . _keys [ lower_key ] = key <EOL> super ( cidict , self ) . __setitem__ ( lower_key , value ) <EOL> def __delitem__ ( self , key ) : <EOL> lower_key = key . lower ( ) <EOL> del self . _keys [ lower_key ] <EOL> super ( cidict , self ) . __delitem__ ( lower_key ) <EOL> def update ( self , dict ) : <EOL> for key in dict : <EOL> self [ key ] = dict [ key ] <EOL> def has_key ( self , key ) : <EOL> return super ( cidict , self ) . has_key ( key . lower ( ) ) <EOL> __contains__ = has_key <EOL> def get ( self , key , * args , ** kwargs ) : <EOL> return super ( cidict , self ) . get ( key . lower ( ) , * args , ** kwargs ) <EOL> def keys ( self ) : <EOL> return self . _keys . values ( ) <EOL> def items ( self ) : <EOL> return [ ( k , self [ k ] ) for k in self . keys ( ) ] </s>
