diff --git a/mathics/eval/makeboxes.py b/mathics/eval/makeboxes.py index 9ad27229d..d248b48a6 100644 --- a/mathics/eval/makeboxes.py +++ b/mathics/eval/makeboxes.py @@ -54,28 +54,36 @@ def _boxed_string(string: str, **options): return StyleBox(String(string), **options) -def eval_fullform_makeboxes(self, expr, evaluation, f=SymbolStandardForm): +def eval_fullform_makeboxes( + self, expr, evaluation: Evaluation, form=SymbolStandardForm +) -> Expression: """ This function takes the definitions provided by the evaluation object, and produces a boxed form for expr. + + Basically: MakeBoxes[expr // FullForm] """ # This is going to be reimplemented. expr = Expression(SymbolFullForm, expr) - return Expression(SymbolMakeBoxes, expr, f).evaluate(evaluation) + return Expression(SymbolMakeBoxes, expr, form).evaluate(evaluation) -def eval_makeboxes(self, expr, evaluation, f=SymbolStandardForm): +def eval_makeboxes( + self, expr, evaluation: Evaluation, form=SymbolStandardForm +) -> Expression: """ This function takes the definitions provided by the evaluation object, and produces a boxed fullform for expr. + + Basically: MakeBoxes[expr // form] """ # This is going to be reimplemented. - return Expression(SymbolMakeBoxes, expr, f).evaluate(evaluation) + return Expression(SymbolMakeBoxes, expr, form).evaluate(evaluation) def format_element( element: BaseElement, evaluation: Evaluation, form: Symbol, **kwargs -) -> BaseElement: +) -> Type[BaseElement]: """ Applies formats associated to the expression, and then calls Makeboxes """ @@ -95,14 +103,14 @@ def format_element( def do_format( element: BaseElement, evaluation: Evaluation, form: Symbol -) -> BaseElement: +) -> Type[BaseElement]: do_format_method = element_formatters.get(type(element), do_format_element) return do_format_method(element, evaluation, form) def do_format_element( element: BaseElement, evaluation: Evaluation, form: Symbol -) -> BaseElement: +) -> Type[BaseElement]: """ Applies formats associated to the expression and removes superfluous enclosing formats. @@ -220,7 +228,7 @@ def format_expr(expr): def do_format_rational( element: BaseElement, evaluation: Evaluation, form: Symbol -) -> BaseElement: +) -> Type[BaseElement]: if form is SymbolFullForm: return do_format_expression( Expression( @@ -245,7 +253,7 @@ def do_format_rational( def do_format_complex( element: BaseElement, evaluation: Evaluation, form: Symbol -) -> BaseElement: +) -> Type[BaseElement]: if form is SymbolFullForm: return do_format_expression( Expression( @@ -273,7 +281,7 @@ def do_format_complex( def do_format_expression( element: BaseElement, evaluation: Evaluation, form: Symbol -) -> BaseElement: +) -> Type[BaseElement]: # # not sure how much useful is this format_cache # if element._format_cache is None: # element._format_cache = {}