chore: remove dead code — unused/unimportable files and directories - #1055
Conversation
Deletes seven dead files/directories confirmed via repo-wide grep to have zero references outside their own definitions, and/or hard syntax errors making them unimportable: - hera/simulations/utils/interpolation/ — broken duplicate (TabError) of the live hera/simulations/utils/interpolations.py - hera/simulations/LSM/hermesWorkflowToolkit.py — stale diverged fork of hera/simulations/hermesWorkflowToolkit.py - hera/simulations/openFoam/postProcess/VTKPipelineExecutionContext.py — unreferenced class + dangling functions - hera/simulations/openFoam/preprocessOFObjects/OFList.py — imported but never instantiated; internally broken. Also removes the now-dangling `from .OFList import OFList` line from preprocessOFObjects/__init__.py - hera/simulations/openFoam/toberewritten/netcdf2of.py — hard SyntaxError - hera/simulations/openFoam/toberewritten/xarrayDataset2OF.py — hard TabError/IndentationError - hera/measurements/GIS/raster/hill2stl.py — import-time side effect (writes test1.stl to disk), zero references Verified via python3 -m py_compile / ast.parse that neighboring __init__.py files and modules still import cleanly after these removals. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@ilayfalach Please go over the comments and fix |
Per @lior-antonov's review: - Restore toberewritten/netcdf2of.py and toberewritten/xarrayDataset2OF.py. Both are unimportable today (IndentationError), but issue #1060 tracks rewriting them into the OpenFOAM toolkit on foamlib, and that rewrite is already implemented in PR #1065. Removing them belongs to that PR, not this one, so this PR no longer touches them. - Drop stale documentation entries for the files this PR does delete (VTKPipelineExecutionContext, hill2stl, OFList). These docs tables and tree listings were what made the deleted modules look live. Refs #1022, #1060
|
@lior-antonov went through all five comments — replies in each thread. Summary, and one thing I'd ask you to re-check. Implemented (
|
| Your comment | Deleted by this PR | Live — not touched |
|---|---|---|
| "deleting a central toolkit" | simulations/LSM/hermesWorkflowToolkit.py |
simulations/hermesWorkflowToolkit.py |
| "again here..." | postProcess/VTKPipelineExecutionContext.py |
postProcess/VTKPipeline.py |
"clean the __main__ instead" |
utils/interpolation/interpolations.py |
utils/interpolations.py |
Evidence per row (details in the threads):
LSM/hermesWorkflowToolkit.pydefines a class namedworkflowToolkit, nothermesWorkflowToolkit, with a strict subset of the live API (8 methods vs 20+). Zero references repo-wide;LSM/__init__.pyis empty; the LSM registry entry points atLSM.toolkit.LSMToolkit. The central toolkit registered athera/toolkit.py:658is untouched.VTKPipelineExecutionContext.pydefinesVTKpipelineExecutionContext; zero code references. The liveVTKPipeline.py(imported atopenFoam/toolkit.py:19) absorbed its_buildFilterLayerlogic.utils/interpolation/interpolations.py—TabError: inconsistent use of tabs and spaces in indentationat line 137. It cannot be imported at all, so cleaning the__main__block wouldn't make it usable; the failure is in the class body above it. Class name isinterpulations(typo), unformatted, and a strict older draft of the liveutils/interpolations.pythatwindProfile/toolkit.py:12imports.
If you still want any of the three kept after looking at that, say which and I'll restore them — but as they stand all three are unreachable older duplicates of live modules.
Two things I found that are out of scope here
docs/developer_guide/measurements.mdwas wrong abouthill2stl— it claimed "Used by both the raster topography and buildings toolkits." It has zero references in code, and it runs at import: lines 96–101 are module-level and writetest1.stlto disk. Its own docstring reads like a prototype ("We might want to change the code to allow it to use other parts of the repository"). Deletion stands; the false doc claim is gone.- Pre-existing bug in the live
utils/interpolations.py:windprofileis declared at line 101 withoutself, insidespatialInterpolate. Want an issue for it, or should I fix it here?
Heads-up on a future conflict: this PR and #1065 both modify preprocessOFObjects/__init__.py — this one drops from .OFList import OFList (line 2), #1065 appends a datasetToOF import at the end. Git should auto-merge, but whichever lands second is worth a glance.
Verification
py_compile on VTKPipeline.py, all of preprocessOFObjects/*.py, and openFoam/toolkit.py — passes. import hera, toolkitHome, spatialInterpolate, and the GIS raster toolkits — all import cleanly. (openFoam can't be imported in my environment at all because hermes isn't installed — that's the pre-existing gate at OFWorkflow.py:13, a file this PR doesn't touch.)
Summary
Deletes 7 files/directories confirmed to have zero references anywhere in the repo, or that contain hard syntax errors and cannot be imported at all (
netcdf2of.py,xarrayDataset2OF.py). Includes a duplicate-of-a-live-module directory (simulations/utils/interpolation/), a stale diverged fork (LSM/hermesWorkflowToolkit.py), and an import-time side-effect file that writes to disk on import (GIS/raster/hill2stl.py).9 files changed, 2,769 deletions. Full detail in the "2. remove-dead-files" section of #1022.
Verification:
python3 -m py_compileon all touched/neighboring files; confirmed no remaining imports of deleted module paths anywhere in the repo.Refs #1022