parameters: (check, codes=None)
return_statement: return check
docstring: Register a new check object.
docstring_summary: Register a new check object.
docstring_tokens: Register a new check object .
function: def register_check(check, codes=None):
      """Register a new check object."""
      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 = _get_parameters(check)
          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 _get_parameters(check.__init__)[:2] == ['self', 'tree']:
              _add_check(check, 'tree', codes, None)
      return check
function_tokens: 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 = _get_parameters ( check ) 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 _get_parameters ( check . __init__ ) [ : 2 ] == [ 'self' , 'tree' ] : _add_check ( check , 'tree' , codes , None ) return check