def register_check(check, codes=None):
 def _add_check(check, kind, codes, args):
  if (check in _checks[kind]):
   _checks[kind][check][0].extend((codes or []))
  else:
   _checks[kind][check] = ((codes or ['']), args)
 if inspect.isfunction(check):
  args = inspect.getargspec(check)[0]
  if (args and (args[0] in ('physical_line', 'logical_line'))):
   if (codes is None):
    codes = ERRORCODE_REGEX.findall((check.__doc__ or ''))
   _add_check(check, args[0], codes, args)
 elif inspect.isclass(check):
  if (inspect.getargspec(check.__init__)[0][:2] == ['self', 'tree']):
   _add_check(check, 'tree', codes, None)

def register_check ( check , codes = None ) : def _add_check ( check , kind , codes , args ) : if ( check in _checks [ kind ] ) : _checks [ kind ] [ check ] [ 0 ] . extend ( ( codes or [ ] ) ) else : _checks [ kind ] [ check ] = ( ( codes or [ '' ] ) , args ) if inspect . isfunction ( check ) : args = inspect . getargspec ( check ) [ 0 ] if ( args and ( args [ 0 ] in ( 'physical_line' , 'logical_line' ) ) ) : if ( codes is None ) : codes = ERRORCODE_REGEX . findall ( ( check . __doc__ or '' ) ) _add_check ( check , args [ 0 ] , codes , args ) elif inspect . isclass ( check ) : if ( inspect . getargspec ( check . __init__ ) [ 0 ] [ : 2 ] == [ 'self' , 'tree' ] ) : _add_check ( check , 'tree' , codes , None )
register a new check object .