Skip to content

chore: remove dead code — unused/unimportable files and directories - #1055

Merged
lior-antonov merged 2 commits into
masterfrom
deadcode/remove-dead-files
Aug 30, 2026
Merged

chore: remove dead code — unused/unimportable files and directories#1055
lior-antonov merged 2 commits into
masterfrom
deadcode/remove-dead-files

Conversation

@ilayfalach

Copy link
Copy Markdown
Collaborator

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_compile on all touched/neighboring files; confirmed no remaining imports of deleted module paths anywhere in the repo.

⚠️ Not merged/approved by me — opened for review only.

Refs #1022

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>
Comment thread hera/simulations/LSM/hermesWorkflowToolkit.py Outdated
Comment thread hera/simulations/openFoam/postProcess/VTKPipelineExecutionContext.py Outdated
Comment thread hera/simulations/openFoam/toberewritten/netcdf2of.py
Comment thread hera/simulations/openFoam/toberewritten/xarrayDataset2OF.py
Comment thread hera/simulations/utils/interpolation/interpolations.py Outdated
@lior-antonov

Copy link
Copy Markdown
Collaborator

@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
@ilayfalach

Copy link
Copy Markdown
Collaborator Author

@lior-antonov went through all five comments — replies in each thread. Summary, and one thing I'd ask you to re-check.

Implemented (05f3082a)

netcdf2of.py and xarrayDataset2OF.py — restored. This PR no longer touches them. And the rewrite you asked for is already done: PR #1065 (branch ISSUE1060) implements #1060 — moves both into preprocessOFObjects/datasetToOF.py (904 lines) on foamlib, exposes them as toolkit functions in openFoam/toolkit.py (+232 lines), adds 717 lines of tests, and removes the old scripts there. Deletion now happens in the PR that ships the replacement.

Also removed stale docs entries for the three files this PR still deletes (VTKPipelineExecutionContext, hill2stl, OFList) across 6 files in docs/developer_guide/. Those tables and tree listings were the only place these modules were referenced at all — and I think they're what made them look live.

PR is now 13 files / 1,689 deletions, down from 2,769.

Please re-check these three — I think the paths got crossed

For each of the three remaining objections, the repo contains two files with the same or near-same basename, and this PR deletes only the unreachable one:

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):

  1. LSM/hermesWorkflowToolkit.py defines a class named workflowToolkit, not hermesWorkflowToolkit, with a strict subset of the live API (8 methods vs 20+). Zero references repo-wide; LSM/__init__.py is empty; the LSM registry entry points at LSM.toolkit.LSMToolkit. The central toolkit registered at hera/toolkit.py:658 is untouched.
  2. VTKPipelineExecutionContext.py defines VTKpipelineExecutionContext; zero code references. The live VTKPipeline.py (imported at openFoam/toolkit.py:19) absorbed its _buildFilterLayer logic.
  3. utils/interpolation/interpolations.pyTabError: inconsistent use of tabs and spaces in indentation at 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 is interpulations (typo), unformatted, and a strict older draft of the live utils/interpolations.py that windProfile/toolkit.py:12 imports.

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.md was wrong about hill2stl — 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 write test1.stl to 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: windprofile is declared at line 101 without self, inside spatialInterpolate. 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.)

@lior-antonov
lior-antonov self-requested a review August 30, 2026 06:30
@lior-antonov
lior-antonov merged commit 02d746f into master Aug 30, 2026
1 check passed
@lior-antonov
lior-antonov deleted the deadcode/remove-dead-files branch August 30, 2026 06:31
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