Example #1
0
 def style_options(self):
     options = StyleOptions(self)
     options.add_option(name='fence',
                        description=("Do we need to wrap in paranthesis: "
                                     "'when forced' or 'never'?"),
                        default='never',
                        related_methods=())
     return options
Example #2
0
 def style_options(self):
     '''
     Return the StyleOptions object for this ExprArray.
     '''
     options = StyleOptions(self)
     options.add_option(
         name='justification',
         description=("justify to the 'left', 'center', or 'right' "
                      "in the array cells"),
         default='center',
         related_methods='with_justification')
     return options
Example #3
0
 def style_options(self):
     options = StyleOptions(self)
     if len(self.entries) > 1:
         options.add_option(
             name='wrap_positions',
             description=("position(s) at which wrapping is to occur; "
                          "'n' is after the nth comma."),
             default='()',
             related_methods=('with_wrapping_at', ))
         options.add_option(
             name='justification',
             description=("if any wrap positions are set, justify to the "
                          "'left', 'center', or 'right'"),
             default='left',
             related_methods=('with_justification', ))
     return options
Example #4
0
 def style_options(self):
     '''
     Return the StyleOptions object for the Operation.
     '''
     from proveit._core_.expression.composite.expr_tuple import ExprTuple
     trivial_op = False
     if (isinstance(self.operands, ExprTuple)
             and len(self.operands.entries) > 0
             and not self.operands.is_single()):
         # 'infix' is only a sensible option when there are
         # multiple operands as an ExprTuple.
         default_op_style = 'infix'
     else:
         # With no operands or 1 operand, infix is not an option.
         trivial_op = True
         default_op_style = 'function'
     options = StyleOptions(self)
     options.add_option(
         name='operation',
         description="'infix' or 'function' style formatting",
         default=default_op_style,
         related_methods=())
     if not trivial_op:
         # Wrapping is only relevant if there is more than one
         # operand.
         options.add_option(
             name='wrap_positions',
             description=("position(s) at which wrapping is to occur; "
                          "'2 n - 1' is after the nth operand, '2 n' is "
                          "after the nth operation."),
             default='()',
             related_methods=('with_wrapping_at',
                              'with_wrap_before_operator',
                              'with_wrap_after_operator', 'wrap_positions'))
         options.add_option(
             name='justification',
             description=(
                 "if any wrap positions are set, justify to the 'left', "
                 "'center', or 'right'"),
             default='center',
             related_methods=('with_justification', ))
     return options
Example #5
0
 def style_options(self):
     '''
     Return the StyleOptions object for the Operation.
     '''
     from proveit._core_.expression.composite.expr_tuple import ExprTuple
     trivial_op = not (isinstance(self.operands, ExprTuple)
                       and len(self.operands.entries) > 0
                       and not self.operands.is_single())
     options = StyleOptions(self)
     # Note: when there are no operands or 1 operand, 'infix'
     # is like the 'function' style except the operator is
     # wrapped in square braces.
     options.add_option(
         name='operation',
         description="'infix' or 'function' style formatting",
         default='infix',
         related_methods=())
     if not trivial_op:
         # Wrapping is only relevant if there is more than one
         # operand.
         options.add_option(
             name='wrap_positions',
             description=("position(s) at which wrapping is to occur; "
                          "'2 n - 1' is after the nth operand, '2 n' is "
                          "after the nth operation."),
             default='()',
             related_methods=('with_wrapping_at',
                              'with_wrap_before_operator',
                              'with_wrap_after_operator',
                              'without_wrapping', 'wrap_positions'))
         options.add_option(
             name='justification',
             description=(
                 "if any wrap positions are set, justify to the 'left', "
                 "'center', or 'right'"),
             default='center',
             related_methods=('with_justification', ))
     return options