Skip to content

Commit

Permalink
Merge pull request #967 from Mathics3/misc-lint
Browse files Browse the repository at this point in the history
Administrivia and miscellaneous lint
  • Loading branch information
rocky authored Jan 19, 2024
2 parents 8a5a691 + 801cc98 commit 8027c56
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
5 changes: 3 additions & 2 deletions mathics/builtin/box/graphics3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"""
Boxing Symbols for 3D Graphics
"""
# Docs are not yet ready for prime time. Maybe after release 6.0.0.
no_doc = True

import json
import numbers
Expand All @@ -27,6 +25,9 @@
from mathics.core.symbols import Symbol, SymbolTrue
from mathics.eval.nevaluator import eval_N

# Docs are not yet ready for prime time. Maybe after release 7.0.0.
no_doc = True


class Graphics3DBox(GraphicsBox):
"""
Expand Down
11 changes: 6 additions & 5 deletions mathics/core/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def message(self, symbol_name: str, tag, *msgs) -> "Message":
symbol_shortname = self.definitions.shorten_name(symbol)

if settings.DEBUG_PRINT:
print("MESSAGE: %s::%s (%s)" % (symbol_shortname, tag, msgs))
print(f"MESSAGE: {symbol_shortname}::{tag} ({msgs})")

text = self.definitions.get_value(symbol, "System`Messages", pattern, self)
if text is None:
Expand All @@ -481,7 +481,7 @@ def message(self, symbol_name: str, tag, *msgs) -> "Message":
)

if text is None:
text = String("Message %s::%s not found." % (symbol_shortname, tag))
text = String(f"Message {symbol_shortname}::{tag} not found.")

text = self.format_output(
Expression(SymbolStringForm, text, *(from_python(arg) for arg in msgs)),
Expand Down Expand Up @@ -587,8 +587,9 @@ def __init__(self, symbol: Union[Symbol, str], tag: str, text: str) -> None:
use a string.
tag: a short slug string that indicates the kind of message
In Django we need to use a string for symbol, since we need something that is JSON serializable
and a Mathics3 Symbol is not like this.
In Django we need to use a string for symbol, since we need
something that is JSON serializable and a Mathics3 Symbol is not
like this.
"""
super(Message, self).__init__()
self.is_message = True # Why do we need this?
Expand All @@ -607,7 +608,7 @@ def get_data(self):
"message": True,
"symbol": self.symbol,
"tag": self.tag,
"prefix": "%s::%s" % (self.symbol, self.tag),
"prefix": f"{self.symbol}::{self.tag}",
"text": self.text,
}

Expand Down
6 changes: 6 additions & 0 deletions mathics/core/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
"""
Various Exception objects used in Mathics3.
"""


class BoxExpressionError(Exception):
Expand Down Expand Up @@ -35,4 +38,7 @@ def __init__(self, *message):
self._message = message

def message(self, evaluation):
"""
Transfer this exception to evaluation's ``message`` method.
"""
evaluation.message(*self._message)
2 changes: 1 addition & 1 deletion requirements-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ psutil # SystemMemory and MemoryAvailable
pyocr # Used for TextRecognize
scikit-image >= 0.17 # FindMinimum can use this; used by Image as well
unidecode # Used in Transliterate
wordcloud # Used in builtin/image.py by WordCloud()
wordcloud >= 1.9.3 # Used in builtin/image.py by WordCloud(). Previous versions assume "image.textsize" which no longer exists

0 comments on commit 8027c56

Please sign in to comment.