chore: remove unused functions/classes/methods (dead code audit) - #1057
Open
ilayfalach wants to merge 6 commits into
Open
chore: remove unused functions/classes/methods (dead code audit)#1057ilayfalach wants to merge 6 commits into
ilayfalach wants to merge 6 commits into
Conversation
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>
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.
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_compileon all touched files;hera/tests/test_experiment.py— 9 passed, 26 skipped (pre-existing skips, missing externalargosdependency, unrelated to this change).This is the biggest-surface-area PR of the 5 — recommend reviewing it last / most carefully.
Refs #1022