Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc tweaks... #1072

Merged
merged 2 commits into from
Aug 20, 2024
Merged

Misc tweaks... #1072

merged 2 commits into from
Aug 20, 2024

Conversation

rocky
Copy link
Member

@rocky rocky commented Aug 19, 2024

(These were noticed in working on event tracing)

mathics/builtin/numbers/algebra.py: black changes its autoformatting

mathics/builtin/numbers/numbertheory.py: some linting prefers triples quotes for docstrings

mathics/core/convert/sympy.py: use accurate location for singleton class. This reduces unnecessary sympy imports

CHANGES.rst: document recent SetEnvironment addition and GetEnvironment changes

test/builtin/numbers/__init__.py: needed if testing in this directory is done separately.

@rocky rocky requested a review from mmatera August 19, 2024 10:30
@rocky rocky force-pushed the misc-tweaks-in-prep-for-event-handler branch from 4ab5e81 to 686d375 Compare August 19, 2024 10:46
(These were noticed in working on event tracing)

`mathics/builtin/numbers/algebra.py`: black changes its autoformating

`mathics/builtin/numbers/numbertheory.py`: some linting prefers triples
quotes for docstrings

`mathics/core/convert/sympy.py`: use accurate location for singleton
class. This reduces unnecessary sympy imports

`mathics/core/symbols.py`: shorten prefix and context names for SymPy
variables. In tracing we will see these names a lot. A shorter prefix
makes understanding expressions involving these easier to follow

`CHANGES.rst`: document recent SetEnvironment addition and GetEnvironment
changes

`test/numbers/__init__.py`: needed if test/numbers is tested separately
@rocky rocky force-pushed the misc-tweaks-in-prep-for-event-handler branch from 686d375 to 25f299a Compare August 19, 2024 10:47
# Prefix used for Sympy variables.
# We wan t this to be short to keep variable names short.
# In tracing values, long names make output messy.
sympy_symbol_prefix = "_m_"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rocky, in the test it seems you used _mu_ as the prefix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I am reverting these changes for now, since I forget to update the testing. And the testing isn't catching the change either.

So all of this is more involved. I don't want to hold up other stuff because of these issues. Instead, I'll punt for now.

Symbol("_Mathics_User_x"),
sympy.Symbol("_Mathics_User_System`_Mathics_User_x"),
Symbol("_mu_x"),
sympy.Symbol("_mu`x"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect that if the conversion routines haven't changed, and the prefix is _m_,
"_Mathics_User_System`_Mathics_User_x" should be now "_m_System`_m_x",
with the prefix both in the symbol name and the context.
In any case, it would be reasonable to put the prefix in the context.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above. Not sure why testing works when it shouldn't. Testing is probably a bit weak then.

The issue of shortening context prefixes will be addressed in a more isolated PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good. Then let's merge this when you feel it is ready.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why the tests are "weak" is that we are not checking the result of the comparison. I will put a fix for this in another PR.

mathics/builtin/numbers/algebra.py: black changes its autoformatting

mathics/builtin/numbers/numbertheory.py: some linting prefers triples quotes for docstrings

mathics/core/convert/sympy.py: use accurate location for singleton class. This reduces unnecessary sympy imports

CHANGES.rst: document recent SetEnvironment addition and GetEnvironment changes

test/builtin/numbers/__init__.py: needed if testing in this directory is done separately.
@rocky rocky merged commit fce0ddc into master Aug 20, 2024
10 checks passed
@rocky rocky deleted the misc-tweaks-in-prep-for-event-handler branch August 20, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants