<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> import logging <EOL> import re <EOL> try : <EOL> import six <EOL> text_type = six . text_type <EOL> except ImportError : <EOL> import warnings <EOL> warnings . warn ( '<STR_LIT>' ) <EOL> try : <EOL> from unidecode import unidecode <EOL> except ImportError : <EOL> import warnings <EOL> warnings . warn ( '<STR_LIT>' ) <EOL> logging . basicConfig ( level = logging . INFO ) <EOL> log = logging . getLogger ( __name__ ) <EOL> UNDERSCORES = re . compile ( r'<STR_LIT>' ) <EOL> def humanized_name ( thing ) : <EOL> try : return UNDERSCORES . sub ( '<STR_LIT:U+0020>' , thing . __name__ ) <EOL> except AttributeError : return UNDERSCORES . sub ( '<STR_LIT:U+0020>' , thing ) <EOL> def format_assertion_msg ( assertion_clause , * args ) : <EOL> raw_msg = '<STR_LIT>' <EOL> raw_msg = raw_msg . format ( assertion_clause = assertion_clause ) <EOL> if len ( args ) is <NUM_LIT:2> : <EOL> raw_msg += '<STR_LIT>' <EOL> return raw_msg <EOL> def fix_string ( obj ) : <EOL> if isinstance ( obj , ( six . binary_type , ) ) : <EOL> try : <EOL> return obj . decode ( '<STR_LIT:utf-8>' ) <EOL> except Exception : <EOL> return obj <EOL> return obj <EOL> class AssertionsMap ( dict ) : <EOL> '''<STR_LIT>''' <EOL> def __getitem__ ( self , k ) : <EOL> log . debug ( '<STR_LIT>' . format ( name = k ) ) <EOL> return super ( AssertionsMap , self ) . __getitem__ ( k ) <EOL> def __setitem__ ( self , k , v ) : <EOL> _keys = self . keys ( ) <EOL> if k not in _keys : <EOL> log . debug ( '<STR_LIT>' . format ( name = k , func = v ) ) <EOL> elif self [ k ] is not v : <EOL> log . debug ( '<STR_LIT>' . format ( name = k , func = v ) ) <EOL> elif self [ k ] is v : <EOL> return <EOL> return super ( AssertionsMap , self ) . __setitem__ ( k , v ) <EOL> def __delitem__ ( self , k ) : <EOL> log . debug ( '<STR_LIT>' . format ( name = k ) ) <EOL> return super ( AssertionsMap , self ) . __delitem__ ( k ) </s>
