INNER CODE UNIT · Python

negate

introlab/rtabmap · doxygen/generate_parameters_page.py:49

def negate(condition):
    """Negation of a #if condition, kept readable for the generated page."""
    if condition.startswith('!') and '&&' not in condition and '||' not in condition:
        return condition[1:]
    if re.match(r'^defined\([A-Za-z0-9_]+\)$', condition):
        return '!' + condition
    return '!(%s)' % condition


class Param(object):
    def __init__(self, prefix, name, type_, default, description, branch):
        self.prefix = prefix
        self.name = name
        self.type = type_
        self.description = description
        # (default, branch) pairs: more than one when the parameter is declared
        # in several #if branches. `branch` is the innermost condition only:
        # the branches are read in order, first match wins, so the enclosing

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…