(expr)
return has_constant(patsy.parse_formula.parse_formula(expr))
Report whether a model expression has constant specific term.
    That is, a term explicitly specying whether the model should or
    should not include a constant. (e.g. '+ 1' or '- 1'.)

    Parameters
    ----------
    expr : str
        Model expression to check.

    Returns
    -------
    has_constant : bool
Report whether a model expression has constant specific term.
    That is, a term explicitly specying whether the model should or
    should not include a constant. (e.g. '+ 1' or '- 1'.)
Report whether a model expression has constant specific term . That is a term explicitly specying whether the model should or should not include a constant . ( e . g . + 1 or - 1 . )
def has_constant_expr(expr):
    """
    Report whether a model expression has constant specific term.
    That is, a term explicitly specying whether the model should or
    should not include a constant. (e.g. '+ 1' or '- 1'.)

    Parameters
    ----------
    expr : str
        Model expression to check.

    Returns
    -------
    has_constant : bool

    """
    def has_constant(node):
        if node.type == 'ONE':
            return True

        for n in node.args:
            if has_constant(n):
                return True

        return False

    return has_constant(patsy.parse_formula.parse_formula(expr))
def has_constant_expr ( expr ) : def has_constant ( node ) : if node . type == 'ONE' : return True for n in node . args : if has_constant ( n ) : return True return False return has_constant ( patsy . parse_formula . parse_formula ( expr ) )