Repository navigation
refactor: delete dead and copied code (-2,574 lines) - #417
Merged
Merged
Conversation
LoopStructural/utils/maths.py was a copy of loop_common/math/_maths.py. The code was the same; only the docstrings were different. Move the better docstrings to loop_common and make utils/maths.py a re-export. All public names stay importable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…imports _builders.py was all comments. _constant_norm.py, _discrete_fold_interpolator.py and _interpolatortype.py were old copies. LoopStructural.interpolators imports these classes from loop_interpolation. Also remove their ruff per-file-ignores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a test used The constraint classes in constraints.py do the validation now. The standalone validate_* functions, _fill_nan_weights, _check_shape and _strip_injected_weight_column had no production caller. Delete them and the test that only tested them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing imports utils/linalg.py, utils/config.py or utils/features.py. LoopStructuralConfig in LoopStructural/__init__.py is the one in use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No code, test, doc or other GitHub repository uses it, and API.md does not list it as stable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Delete to_dict/from_dict on the fault profile functions and on FaultDisplacement. Nothing calls them, and FaultDisplacement.to_dict reads attributes that do not exist. Delete FaultDisplacementFeature.evaluate_on_surface (it calls a method that does not exist) and the empty FaultSegment.ellipsoid. In FaultSegment._displacement_fraction, delete the gx_mask lines: the fault function is never None, so block_displacement always overwrites them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Delete write_feat_surfs, _write_feat_surfs_evtk, the copy of
_write_feat_surfs_gocad in exporters.py, and the GOCAD branch of
write_vol with _write_vol_gocad. They used attributes that do not exist
and nothing calls them. Surface.save('.ts') now uses
LoopStructural.export.gocad._write_feat_surfs_gocad. Remove the '.vs'
branch from ValuePoints.save and VectorPoints.save: _write_pointset was
only a comment, so they now raise 'Unknown file extension vs'. Delete
the tests that only checked the broken code, and add one test for
Surface.save('.ts') and '.vs'.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lFeature evaluate_value had its own copy of the region and fault logic. It called each region as r(pos, precomputed_val=...), which fails for a plain function or an UnconformityFeature region. Use BaseFeature._calculate_mask and _apply_faults instead. Also delete the while loop in evaluate_gradient that never ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
get_data_bounding_box and its copy in utils/helper.py fit a PCA and never use the result. In GeologicalModel.evaluate_feature_gradient, get_feature_by_name raises when the feature does not exist, so the else branch never ran. 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.
Deletes code that nothing calls or that copies other code, found in a repo audit. Before each deletion, the whole tree was searched (tests, docs, examples, the API snapshot,
__all__, COMPAT.md, string and dynamic imports). Net change: 29 files, +91 / −2,574.LoopStructural/utils/maths.pyis now a re-export ofloop_common.math._maths. The 13 functions had identical names, signatures, defaults and bodies; only the docstrings differed.LoopStructural/interpolators/that nothing imports:_builders.py(all comments),_constant_norm.py,_discrete_fold_interpolator.py,_interpolatortype.py. Their per-file lint ignores are removed too.loop_interpolation/_builders.py(all comments), and thevalidate_*helpers in_validation.pythat only their own test used.utils/linalg.py,utils/config.py,utils/features.py, and the unusedAnalyticalFoldBuilder.evaluate_on_surface(called a method that does not exist),ellipsoid(bodypass), and theFaultDisplacement/CubicFunction/Compositeto_dict/from_dict.export/exporters.py:write_feat_surfs, the evtk surface writer, the GOCAD volume writer and a duplicate GOCAD surface writer. They used attributes that do not exist, and their tests only checked that they failed.elsebranch.Fixes that come with it:
Surface.save('x.ts')now writes a TSurf. Before, it needed pyevtk and used the old writer, which dropped properties.PointSet.save('x.vs')now raises a clearValueError. Before, it raisedImportError.LambdaGeologicalFeaturenow uses the base class's mask and fault helpers. Values and gradients are identical to master with faults and fault regions. An unconformity region used to raiseTypeError, and now works.Removed public (unlisted) API, please note in the changelog:
CubicFunction.to_dict/from_dictworked for a user-built cubic, andFaultDisplacement.to_dictworked when given explicit profiles. It failed for the defaultBaseFault. Neither is in API.md's stable or provisional lists. Old pickles that reference the deleted interpolator modules will not load, which matches the existingtest_legacy_module_paths_are_removedpolicy.Tests: 188 passed and 8 skipped in tests/unit/io, utils, the fault, lambda-feature and region tests, and the public API contract and stable-surface tests. loop_interpolation
test_constraints*/test_import: 25 passed. loop_commontest_imports: 3 passed.test_exporters.pywith pyevtk installed: 77 passed. Every LoopStructural, loop_interpolation and loop_common submodule imports, except those that need optional dependencies. Reviewed by a second agent: no important findings.🤖 Generated with Claude Code