(expr, indent)
| 2691 | |
| 2692 | |
| 2693 | def _split_expr_info(expr, indent): |
| 2694 | # Returns a string with 'expr' split into its top-level && or || operands, |
| 2695 | # with one operand per line, together with the operand's value. This is |
| 2696 | # usually enough to get something readable for long expressions. A fancier |
| 2697 | # recursive thingy would be possible too. |
| 2698 | # |
| 2699 | # indent: |
| 2700 | # Number of leading spaces to add before the split expression. |
| 2701 | |
| 2702 | if len(split_expr(expr, AND)) > 1: |
| 2703 | split_op = AND |
| 2704 | op_str = "&&" |
| 2705 | else: |
| 2706 | split_op = OR |
| 2707 | op_str = "||" |
| 2708 | |
| 2709 | s = "" |
| 2710 | for i, term in enumerate(split_expr(expr, split_op)): |
| 2711 | s += "{}{} {}".format(indent*" ", |
| 2712 | " " if i == 0 else op_str, |
| 2713 | _expr_str(term)) |
| 2714 | |
| 2715 | # Don't bother showing the value hint if the expression is just a |
| 2716 | # single symbol. _expr_str() already shows its value. |
| 2717 | if isinstance(term, tuple): |
| 2718 | s += " (={})".format(TRI_TO_STR[expr_value(term)]) |
| 2719 | |
| 2720 | s += "\n" |
| 2721 | |
| 2722 | return s |
| 2723 | |
| 2724 | |
| 2725 | def _select_imply_info(sym): |
no test coverage detected