<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from functools import partial <EOL> from six import string_types <EOL> def _validator ( code_or_name , validator_type ) : <EOL> if validator_type == "<STR_LIT:error>" : <EOL> from . errors import codes <EOL> from . errors import EXT <EOL> elif validator_type == "<STR_LIT>" : <EOL> from . warnings import codes <EOL> from . warnings import EXT <EOL> else : <EOL> pass <EOL> def decorator ( func ) : <EOL> def wrapper ( * args , ** kw ) : <EOL> extra = func ( * args , ** kw ) <EOL> if extra is None : return [ ] <EOL> if isinstance ( code_or_name , string_types ) : <EOL> code = EXT <EOL> name = codes [ code ] [ <NUM_LIT:0> ] + "<STR_LIT::>" + code_or_name <EOL> else : <EOL> code = code_or_name <EOL> name = codes [ code ] [ <NUM_LIT:0> ] <EOL> text = codes [ code ] [ <NUM_LIT:1> ] <EOL> return [ ( code , name , text , extra ) ] <EOL> wrapper . validator_type = validator_type <EOL> return wrapper <EOL> return decorator <EOL> error = partial ( _validator , validator_type = "<STR_LIT:error>" ) <EOL> error . __doc__ = '''<STR_LIT>''' <EOL> warning = partial ( _validator , validator_type = "<STR_LIT>" ) <EOL> warning . __doc__ = '''<STR_LIT>''' </s>
