docs/support/requirements_to_rst.py
def op_to_words(item):
    """Translate >=, ==, <= to words."""
    sdicts = [
        {"==": ""},
        {">=": " or newer"},
        {">": "newer than "},
        {"<=": " or older"},
        {"<": "older than "},
        {"!=": "except "},
    ]
    for sdict in sdicts:
        prefix = list(sdict.keys())[0]
        suffix = sdict[prefix]
        if item.startswith(prefix):
            if prefix == "==":
                return item[2:]
            if prefix == "!=":
                return suffix + item[2:]
            if prefix in [">", "<"]:
                return suffix + item[1:]
            return item[2:] + suffix
    raise RuntimeError("Inequality not supported")
def op_to_words(item):
    """Translate >=, ==, <= to words."""
    sdicts = [
        {"==": ""},
        {">=": " or newer"},
        {">": "newer than "},
        {"<=": " or older"},
        {"<": "older than "},
        {"!=": "except "},
    ]
    for sdict in sdicts:
        prefix = list(sdict.keys())[0]
        suffix = sdict[prefix]
        if item.startswith(prefix):
            if prefix == "==":
                return item[2:]
            if prefix == "!=":
                return suffix + item[2:]
            if prefix in [">", "<"]:
                return suffix + item[1:]
            return item[2:] + suffix
    raise RuntimeError("Inequality not supported")
Translate >=, ==, <= to words.