Esempio n. 1
0
 def styleOptions(self):
     options = StyleOptions(self)
     if isinstance(self.var, IndexedVar):
         options.add('multi_indexed_var',
                     ("'flat' or 'nested' to show multipe "
                      "indices or the true nested structure"))
     return options
Esempio n. 2
0
 def styleOptions(self):
     '''
     Return a StyleOptions object that indicates the possible
     styles and values that is available to determine how
     this Expression may be presented.
     '''
     return StyleOptions(self)  # the default is empty
Esempio n. 3
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
Esempio n. 4
0
 def styleOptions(self):
     options = StyleOptions(self)
     options.addOption('wrapPositions',
                       ("position(s) at which wrapping is to occur; 'n' "
                        "is after the nth comma."))
     options.addOption(
         'justification',
         ("if any wrap positions are set, justify to the 'left', "
          "'center', or 'right'"))
     return options
Esempio n. 5
0
 def styleOptions(self):
     options = StyleOptions(self)
     options.addOption(
         'wrapPositions',
         "position(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation."
     )
     options.addOption(
         'justification',
         "if any wrap positions are set, justify to the 'left', 'center', or 'right'"
     )
     return options
Esempio n. 6
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
Esempio n. 7
0
 def styleOptions(self):
     options = StyleOptions(self)
     options.addOption('operation',
                       ("'infix' or 'function' style formatting"))
     options.addOption(
         'wrapPositions',
         ("position(s) at which wrapping is to occur; '2 n - 1' "
          "is after the nth operand, '2 n' is after the nth "
          "operation."))
     options.addOption(
         'justification',
         ("if any wrap positions are set, justify to the 'left', "
          "'center', or 'right'"))
     return options
Esempio n. 8
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
Esempio n. 9
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
Esempio n. 10
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