# -*- coding: utf-8 -*-

"""
    This module provides some default ArgumentExpressions
"""

from radish.argexpregistry import arg_expr


@arg_expr("Number", r"(\+|-)?\d+")
def arg_expr_number(text):
    """
        Argument Expression which expects a valid number

        :param str text: the text which was matched as number

        :returns: integer number
        :rtype: int
    """
    return int(text)


@arg_expr("FloatNumber", r"(\+|-)?\d+(\.\d+)?")
def arg_expr_floatnumber(text):
    """
        Argument Expression which expects a valid floating point number

        :param str text: the text which was matched as floating point number

        :returns: float number
        :rtype: float
    """
    return float(text)


@arg_expr("MathExpression", r"[0-9 +\-*/%.e]+")
def arg_expr_mathexpression(text):
    """
        Argument Expression which expects a valid math expression

        :param str text: the text which was matched as math expression

        :returns: calculated float number from the math expression
        :rtype: float
    """
    return float(eval(text))


@arg_expr("VariableName", r"[A-Za-z_][A-Za-z0-9_]*")
def arg_expr_variablename(text):
    """
        Argument Expression which expects a variable name

        :param str text: the text which was matched as variable name

        :returns: the variable name
        :rtype: str
    """
    return text

@@ -134,608 +134,8 @@
 r%0A%0A%0A
-@arg_expr(%22Number%22, r%22(%5C+%7C-)?%5Cd+%22)%0Adef arg_expr_number(text):%0A    %22%22%22%0A        Argument Expression which expects a valid number%0A%0A        :param str text: the text which was matched as number%0A%0A        :returns: integer number%0A        :rtype: int%0A    %22%22%22%0A    return int(text)%0A%0A%0A@arg_expr(%22FloatNumber%22, r%22(%5C+%7C-)?%5Cd+(%5C.%5Cd+)?%22)%0Adef arg_expr_floatnumber(text):%0A    %22%22%22%0A        Argument Expression which expects a valid floating point number%0A%0A        :param str text: the text which was matched as floating point number%0A%0A        :returns: float number%0A        :rtype: float%0A    %22%22%22%0A    return float(text)%0A%0A%0A
 @arg
@@ -490,309 +490,4 @@
 t))%0A
-%0A%0A@arg_expr(%22VariableName%22, r%22%5BA-Za-z_%5D%5BA-Za-z0-9_%5D*%22)%0Adef arg_expr_variablename(text):%0A    %22%22%22%0A        Argument Expression which expects a variable name%0A%0A        :param str text: the text which was matched as variable name%0A%0A        :returns: the variable name%0A        :rtype: str%0A    %22%22%22%0A    return text%0A

Remove obsolete code