def parse_signal_value(sig):
    if sig is None:
        raise ValueError("invalid signal")

    # value passed is a string
    if isinstance(sig, six.string_types):
        if sig.isdigit():
            # if number in the string, try to parse it
            try:
                return int(sig)
            except ValueError:
                raise ValueError("invalid signal")

        # else try to get the signal number from its name
        signame = sig.upper()
        if not signame.startswith('SIG'):
            signame = "SIG%s" % signame
        try:
            signum = getattr(signal, signame)
        except __HOLE__:
            raise ValueError("invalid signal name")
        return signum

    # signal is a number, just return it
    return sig
dataset/ETHPy150Open benoitc/gaffer/gaffer/util.py/parse_signal_value