Repository navigation
Replace past.utils.old_div with true division - #42
Merged
Merged
Conversation
proteus/richards/ADR.py was the only module still importing the `future` compatibility package (past.utils.old_div), which proteus never declared as a dependency. Every operand at the replaced call sites is a float, so `/` is equivalent. Also drop two commented-out imports and fix scripts/marinExtractHeight.py, which called old_div without importing it. `from builtins import ...` elsewhere is the Python 3 stdlib module and does not need `future`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the last use of the
futurecompatibility package.proteus/richards/ADR.pyimportedpast.utils.old_div, but proteus never declaredfutureas a dependency (not in pyproject.toml, not in the conda-forge recipe). This came up in review of spack/spack-packages#6000.proteus/richards/ADR.py: 7old_divcalls replaced with/. Every operand is a float (maxCFL >= 1e-6, float literals, the float element-diameter array), so the results are identical.scripts/marinExtractHeight.py: calledold_divwithout importing it (NameError); now uses/on the values it already casts to float.past.utilsimports inrichards/Richards.pyandm_comp_co2/m_comp_co2.py.from builtins import ...elsewhere is the Python 3 stdlib module and is unaffected.Note:
proteus.richards.ADRstill cannot be imported after this change, because it doesfrom .cADR import *and setup.py builds only the top-levelproteus.cADR, not aproteus.richards.cADR. No test exercises it (onlytest/richards/adr_1d_p.pyimports it). Out of scope here; tracked in erdc#1285.Testing:
py_compileon the four files, andgit grep old_div|past.utilsis empty.🤖 Generated with Claude Code