Exemplo n.º 1
0
    def _check_args(self, args):
        """ _check_args is a helper method for checking the validity
        of the arguments provided.
        """
        if not isinstance(args, list) or not len(args) >= 2:
            raise FunctionArgumentException(
                "Argument of attribute getter "
                "function '%s' must be a list of "
                "indeces; got: '%s'" % (self.name, args)
            )

        if not is_homogeneous(args, (str, int)):
            raise FunctionArgumentException("'%s': argument must be a list of strings; got: '%s'" % (self.name, args))
Exemplo n.º 2
0
    def _check_args(self, args):
        """ _check_args is a helper method for checking the validity
        of the arguments provided.
        """
        if not isinstance(args, list) or not len(args) >= 2:
            raise FunctionArgumentException("Argument of attribute getter "
                                            "function '%s' must be a list of "
                                            "indeces; got: '%s'" %
                                            (self.name, args))

        if not is_homogeneous(args, (str, int)):
            raise FunctionArgumentException(
                "'%s': argument must be a list of strings; got: '%s'" %
                (self.name, args))
Exemplo n.º 3
0
    def _check_args(self, args):
        """ _check_args validates the provided set of arguments. """
        # check if list:
        if not is_homogeneous(args, (str,)):
            raise FunctionArgumentException(
                "Argument of mapping function '%s' must be a list;"
                "of strings; got: '%s'" % (self.name, args)
            )

        # check if list of proper length:
        if not len(args) == 3:
            raise FunctionArgumentException(
                "%s: argument list must have the three elements;"
                " got: '%s'" % (self.name, args)
            )
Exemplo n.º 4
0
    def _check_args(self, args):
        """ _check_args validates the provided set of arguments. """
        if not len(args) == 2:
            raise exceptions.FunctionArgumentException(
                "'%s': expected exactly two arguments (string separator and"
                "list of strings), got: '%s'." % (self.name, args))
        if not isinstance(args[0], str):
            raise exceptions.FunctionArgumentException(
                "First argument of joining function  '%s' must be a string"
                ", got: '%s'" % (self.name, type(args)))

        if not is_homogeneous(args[1], (str, int)):
            raise exceptions.FunctionArgumentException(
                "Second argument of joining function  '%s' must "
                "be a list of strings and/or numbers, got: '%s'" %
                (self.name, args[1]))
Exemplo n.º 5
0
    def _check_args(self, args):
        """ _check_args validates the provided set of arguments. """
        if not len(args) == 2:
            raise exceptions.FunctionArgumentException(
                "'%s': expected exactly two arguments (string separator and"
                "list of strings), got: '%s'." % (self.name, args)
            )
        if not isinstance(args[0], str):
            raise exceptions.FunctionArgumentException(
                "First argument of joining function  '%s' must be a string"
                ", got: '%s'" % (self.name, type(args))
            )

        if not is_homogeneous(args[1], (str, int)):
            raise exceptions.FunctionArgumentException(
                "Second argument of joining function  '%s' must "
                "be a list of strings and/or numbers, got: '%s'" % (
                    self.name, args[1]
                )
            )