<s> """<STR_LIT>""" <EOL> class DNSException ( Exception ) : <EOL> """<STR_LIT>""" <EOL> msg = None <EOL> supp_kwargs = set ( ) <EOL> fmt = None <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> self . _check_params ( * args , ** kwargs ) <EOL> self . _check_kwargs ( ** kwargs ) <EOL> self . kwargs = kwargs <EOL> if self . msg is None : <EOL> self . msg = self . __doc__ <EOL> if args : <EOL> super ( DNSException , self ) . __init__ ( * args ) <EOL> else : <EOL> super ( DNSException , self ) . __init__ ( self . msg ) <EOL> def _check_params ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> if args or kwargs : <EOL> assert bool ( args ) != bool ( kwargs ) , '<STR_LIT>' <EOL> def _check_kwargs ( self , ** kwargs ) : <EOL> if kwargs : <EOL> assert set ( kwargs . keys ( ) ) == self . supp_kwargs , '<STR_LIT>' % ( <EOL> self . supp_kwargs ) <EOL> def _fmt_kwargs ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> fmtargs = { } <EOL> for kw , data in kwargs . items ( ) : <EOL> if isinstance ( data , ( list , set ) ) : <EOL> fmtargs [ kw ] = list ( map ( str , data ) ) <EOL> if len ( fmtargs [ kw ] ) == <NUM_LIT:1> : <EOL> fmtargs [ kw ] = fmtargs [ kw ] . pop ( ) <EOL> else : <EOL> fmtargs [ kw ] = data <EOL> return fmtargs <EOL> def __str__ ( self ) : <EOL> if self . kwargs and self . fmt : <EOL> fmtargs = self . _fmt_kwargs ( ** self . kwargs ) <EOL> return self . fmt . format ( ** fmtargs ) <EOL> else : <EOL> return super ( DNSException , self ) . __str__ ( ) <EOL> class FormError ( DNSException ) : <EOL> """<STR_LIT>""" <EOL> class SyntaxError ( DNSException ) : <EOL> """<STR_LIT>""" <EOL> class UnexpectedEnd ( SyntaxError ) : <EOL> """<STR_LIT>""" <EOL> class TooBig ( DNSException ) : <EOL> """<STR_LIT>""" <EOL> class Timeout ( DNSException ) : <EOL> """<STR_LIT>""" <EOL> supp_kwargs = set ( [ '<STR_LIT>' ] ) <EOL> fmt = "<STR_LIT>" % __doc__ [ : - <NUM_LIT:1> ] </s>
