Skip to content

chore: remove unused functions/classes/methods (dead code audit) - #1057

Open
ilayfalach wants to merge 6 commits into
masterfrom
deadcode/remove-unused-definitions
Open

chore: remove unused functions/classes/methods (dead code audit)#1057
ilayfalach wants to merge 6 commits into
masterfrom
deadcode/remove-unused-definitions

Conversation

@ilayfalach

Copy link
Copy Markdown
Collaborator

Summary

The largest cleanup PR: removes unused functions/methods/classes/properties with zero references anywhere in the repo (verified via repo-wide grep, including checks for dynamic dispatch via pydoc.locate/getattr/factories), across datalayer, utils, toolkit.py, GIS, meteorology, experiment, riskassessment, and simulations. Also deletes a few fully self-contained dead files (errorCalculation.py, DropletCloud.py, MeshUtils.py, hydrodynamics/).

Deliberately left in place for human review instead of deleted: TopographyToolkit.toDEM, OFToolkit.xarrayToSetFieldsDictDomain, wrfDatalayer, PANDASDB/DASKDB.

39 files changed, 3,111 deletions. Full detail in the "4. remove-unused-definitions" section of #1022.

Verification: python3 -m py_compile on all touched files; hera/tests/test_experiment.py — 9 passed, 26 skipped (pre-existing skips, missing external argos dependency, unrelated to this change).

This is the biggest-surface-area PR of the 5 — recommend reviewing it last / most carefully.

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

Refs #1022

Ilay Falach and others added 6 commits July 27, 2026 16:59
Removes confirmed-unused functions/methods/properties:
- AbstractCollection.addDocumentFromJSON
- andClause (and its __all__ export)
- add_directory_to_zip (and its __all__ export)
- extractUnumUnitsFromPint (duplicate of pintToUnum body)
- unumToBaseUnits
- abstractToolkit.classLoggerName

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- landcover.py: remove shadowed duplicate roughnesslength2sandgrainroughness
  definition and unused _handleType1
- tiles.py: remove unused tileScaleAtLatLonZoom, listImages, setDefaultTileServer
- buildings/toolkit.py: remove unused get_buildings_height, filter_buildings_in_area
- vector/toolkit.py: remove unused geopandasToGeoJson and TOOLKIT_VECTOR_REGIONNAME
  (plus now-unused io import)
- topography.py: remove unused geoPandasToSTL (toDEM left in place, flagged
  for manual review per task instructions)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- toolkit.py: remove unused DOCTYPE_STATIONS, DOCTYPE_MEASUREMENTS
- meandatacalculator.py: remove unused _UV_to_SpdDir
- turbulencestatistics.py: remove unused class SinglePointStatisticsSpark
  and unused InMemoryRawData.append/read_hdf/to_hdf (plus now-unused
  os/json imports); InMemoryAvgData still works as a plain subclass
- CampbellBinary.py: remove unused instrument/station/firstTime/lastTime
  properties and getRecordByTime method
- abstractcalculator.py: remove unused JoinMethod property (keeps
  internal _joinmethod attribute)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- dataEngine.py: remove broken/unused pandasDataEngineDB, daskDataEngineDB
  classes (PANDASDB/DASKDB constants kept, still referenced by tests);
  factory raises NotImplementedError for those data types; drop now-unused
  pymongo/json imports
- analysis.py: remove unused getDeviceLocations, broken getTurbulenceStatistics,
  and broken getDeviceTypePlannedMessageCount; adjust the normalize=True path
  in getDeviceTypeTransmissionFrequencyOfTrial to raise NotImplementedError
  instead of calling the removed/never-existing helper
- presentation.py: remove broken/unused plotMap, plotDevices, generateLatexTable
  (drop now-unused jinja2 lazy import)
- parsers.py: remove empty Parser_TOA5 stub class
- experiment.py: remove unused experimentDataType, trialsOfDefaultTrialSet,
  _initAnalysisAndPresentation

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Agents.py: remove unused Agent.fullDescription, Agent.effectproperties
- Injury.py: remove unused Injury._postCalculatePointWise (no-op pass) and
  unused Injury.calculatePointWiseFractionInjured
- ProtectionPolicy.py: remove unused top-level ProtectionPolicy.hdfkey
  (per-action hdfkey properties are untouched, still in use)
- riskToolkit.py: remove unused RiskToolkit.listAgentsNames, loadAgent

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Whole-file removals (self-contained, zero references):
- hera/simulations/analysis/errorCalculation.py
- hera/simulations/gaussian/DropletCloud.py
- hera/simulations/gaussian/MeshUtils.py
- hera/simulations/hydrodynamics/ (nearWallFlow.py + __init__.py)

Surgical removals:
- gasCloud.py: remove unused class Continuous ("Yehuda's Code For
  Convolution"), leaving the rest of the file untouched
- Meteorology.py: remove no-op class MeteorologyProfile(pass)
- windProfile/toolkit.py: remove unused _getStationsInRegion
- CLI.py: remove unused workflowNodes_list, workflowNodes_listParameters
  (confirmed not wired into hera-workflows argparse)
- openFoam/toolkit.py: remove unused template_add (no-op pass),
  clearVTKPipelineCache, getVTKPipelineCacheTable, getHermesWorkflow_Flow,
  getMeshFromName, getMeshExtentFromName (getMesh/getMeshExtent kept, still
  used); drop now-unused workflow_Eulerian import.
  xarrayToSetFieldsDictDomain left untouched (flagged for manual review)
- postProcess/VTKPipeline.py: remove unused class registeredVTKPipeLine and
  VTKPipeLine.registerPipeline, deprecated/unused addExistingFilter, and
  broken/unused VTKFilter.fullName; drop now-unused imports
- preprocessOFObjects/OFObject.py: remove unused REGION_INTERNSALFIELD,
  REGION_BOUNDARYFIELD constants and internalField/.processors/
  .processorItems/.dimensionsStr (boundaryField, dimensionsList,
  componentNames, getDimensions kept, still used)
- lagrangian/abstractLagrangianSolver.py: remove unused
  getOriginalFlowFieldMesh, getDispersionDocument, getDispersionFlowDocument
- lagrangian/LSM/toolkit.py: remove unused createRootCaseMeshLink

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant