src/melody/search.py
def _check_function(self):
        ''' make some basic checks on the function to make sure it is valid'''
        # note, callable is valid for Python 2 and Python 3.2 onwards but
        # not inbetween
        if not callable(self._function):
            raise RuntimeError(
                "provided function '{0}' is not callable".
                format(str(self._function)))
        from inspect import getargspec
        arg_info = getargspec(self._function)
        if len(arg_info.args) != 1:
            print str(arg_info)
            raise RuntimeError(
                "provided function should have one argument but found "
                "{0}".format(len(arg_info.args)))
def _check_function(self):
        ''' make some basic checks on the function to make sure it is valid'''
        # note, callable is valid for Python 2 and Python 3.2 onwards but
        # not inbetween
        if not callable(self._function):
            raise RuntimeError(
                "provided function '{0}' is not callable".
                format(str(self._function)))
        from inspect import getargspec
        arg_info = getargspec(self._function)
        if len(arg_info.args) != 1:
            print str(arg_info)
            raise RuntimeError(
                "provided function should have one argument but found "
                "{0}".format(len(arg_info.args)))
def _check_function ( self ) : # note, callable is valid for Python 2 and Python 3.2 onwards but # not inbetween if not callable ( self . _function ) : raise RuntimeError ( "provided function '{0}' is not callable" . format ( str ( self . _function ) ) ) from inspect import getargspec arg_info = getargspec ( self . _function ) if len ( arg_info . args ) != 1 : print str ( arg_info ) raise RuntimeError ( "provided function should have one argument but found " "{0}" . format ( len ( arg_info . args ) ) )
make some basic checks on the function to make sure it is valid
make some basic checks on the function to make sure it is valid