Skip to content

Conversation

Copy link

Copilot AI commented Nov 10, 2025

Fixed 12 of 199 setDefaults methods that were missing super().setDefaults() calls.

Changes Made

Added super().setDefaults() calls to 12 methods across 5 files:

Flag Selectors (6): CoaddPlotFlagSelector, MatchingFlagSelector, VisitPlotFlagSelector, ParentObjectSelector, InjectedGalaxySelector, InjectedStarSelector in python/lsst/analysis/tools/actions/vector/selectors.py

Multiple Inheritance (3): MatchedRefCoaddDiffTool, MatchedRefCoaddDiffPlot, MatchedRefCoaddCompurityTool in python/lsst/analysis/tools/atools/diffMatched.py - replaced explicit parent class calls with super() for proper cooperative inheritance

Config/Tool (2): CalibrationTool in python/lsst/analysis/tools/atools/calibration.py, AstrometricCatalogMatchVisitConfig in python/lsst/analysis/tools/tasks/astrometricCatalogMatch.py

Test (1): TestAnalysisTool in tests/test_contexts.py

Implementation Details

For simple inheritance cases, added super().setDefaults() at the beginning of each method:

def setDefaults(self):
    super().setDefaults()
    # existing configuration...

For multiple inheritance cases, replaced explicit parent calls with super() to follow Python best practices:

# Before:
def setDefaults(self):
    MagnitudeXTool.setDefaults(self)
    MatchedRefCoaddTool.setDefaults(self)
    # Additional config...

# After:
def setDefaults(self):
    super().setDefaults()
    # Additional config...

Verification

  • ✅ All 12 methods now properly call super().setDefaults()
  • ✅ Python syntax validation passes for all modified files
  • ✅ AST-based verification confirms correct implementation
Original prompt

Go through all instances of setDefaults and list those functions that do not call super().setDefaults()


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Identify functions not calling super().setDefaults() Document setDefaults methods missing super() calls Nov 10, 2025
Copilot AI requested a review from arunkannawadi November 10, 2025 00:15
@arunkannawadi
Copy link
Member

@copilot In the PR you just opened, modify the fix the code directly. Add a call to super().setDefaults() when they are missing from the definition of setDefauls()

Copy link
Author

Copilot AI commented Nov 10, 2025

@copilot In the PR you just opened, modify the fix the code directly. Add a call to super().setDefaults() when they are missing from the definition of setDefauls()

Done. Added super().setDefaults() calls to all 12 methods that were missing them. For the 3 multiple inheritance cases (MatchedRefCoaddDiffTool, MatchedRefCoaddDiffPlot, MatchedRefCoaddCompurityTool), replaced explicit parent class calls with super() for proper cooperative inheritance. Commit: 7a6ffc1

Copilot AI changed the title Document setDefaults methods missing super() calls Add super().setDefaults() calls to methods missing them Nov 10, 2025
@arunkannawadi
Copy link
Member

@copilot Find other cases within all of the repos in https://github.com/lsst organization and just list them here.

Copy link
Author

Copilot AI commented Nov 10, 2025

@copilot Find other cases within all of the repos in https://github.com/lsst organization and just list them here.

I can search for similar setDefaults methods without super() calls across LSST repositories, but I'll need to clarify the scope:

  1. Should I search all public repos in the lsst org, or specific ones you're interested in?
  2. Would you like me to use GitHub's code search API to find these patterns, or clone and analyze specific repositories?
  3. Should I create a comprehensive report similar to what was initially done for this repository?

The search pattern would look for Python files with def setDefaults(self): that don't contain super().setDefaults() calls. With potentially hundreds of repos in the lsst org, this could be a large result set.

If you'd like me to proceed, I can start with the most commonly used LSST repositories (like lsst/pipe_tasks, lsst/meas_algorithms, etc.) and compile a list. Please let me know your preference.

@arunkannawadi
Copy link
Member

@copilot LImit to pipe_tasks and meas_algorithms for now. Use GitHub's code search API to find these patterns.

Copy link
Author

Copilot AI commented Nov 10, 2025

@copilot LImit to pipe_tasks and meas_algorithms for now. Use GitHub's code search API to find these patterns.

Found 21 setDefaults methods without super() calls across the two repositories:

lsst/pipe_tasks (11 instances)

  1. RepairConfig.setDefaults() - python/lsst/pipe/tasks/repair.py:83
  2. DrpDiaCalculationPipeConfig.setDefaults() - python/lsst/pipe/tasks/drpDiaCalculationPipe.py:77
  3. PhotoCalConfig.setDefaults() - python/lsst/pipe/tasks/photoCal.py:113
  4. MakeDiscreteSkyMapConfig.setDefaults() - python/lsst/pipe/tasks/makeDiscreteSkyMap.py:62
  5. HealSparsePropertyMapConfig.setDefaults() - python/lsst/pipe/tasks/healSparseMapping.py:452
  6. ConsolidateHealSparsePropertyMapConfig.setDefaults() - python/lsst/pipe/tasks/healSparseMapping.py:888
  7. MergeDetectionsConfig.setDefaults() - python/lsst/pipe/tasks/mergeDetections.py:186
  8. SkyCorrectionConfig.setDefaults() - python/lsst/pipe/tasks/skyCorrection.py:193
  9. MaskObjectsConfig.setDefaults() - python/lsst/pipe/tasks/background.py:786
  10. HighResolutionHipsConfig.setDefaults() - python/lsst/pipe/tasks/hips.py:174
  11. HipsPropertiesConfig.setDefaults() - python/lsst/pipe/tasks/hips.py:777

lsst/meas_algorithms (10 instances)

  1. MeasureApCorrConfig.setDefaults() - python/lsst/meas/algorithms/measureApCorr.py:154
  2. ScaleVarianceConfig.setDefaults() - python/lsst/meas/algorithms/scaleVariance.py:70
  3. RequireUnresolved.setDefaults() - python/lsst/meas/algorithms/sourceSelector.py:431
  4. CentroidErrorLimit.setDefaults() - python/lsst/meas/algorithms/sourceSelector.py:653
  5. ScienceSourceSelectorConfig.setDefaults() - python/lsst/meas/algorithms/sourceSelector.py:705
  6. ConvertReferenceCatalogConfig.setDefaults() - python/lsst/meas/algorithms/convertReferenceCatalog.py:414
  7. DynamicDetectionConfig.setDefaults() - python/lsst/meas/algorithms/dynamicDetection.py:116
  8. ComputeNoiseCorrelationConfig.setDefaults() - python/lsst/meas/algorithms/noise_covariance.py:88
  9. SourceDetectionConfig.setDefaults() - python/lsst/meas/algorithms/detection.py:162
  10. FindCosmicRaysConfig.setDefaults() - python/lsst/meas/algorithms/findCosmicRaysConfig.py:73

These results are from analyzing the latest code in both repositories using GitHub's code search API and AST parsing.

@arunkannawadi
Copy link
Member

@copilot Make a PR fixing these. Call the branch name tickets/DM-53225. If a branch already exists, checkout that branch and continue to make changes there.

Copy link
Author

Copilot AI commented Nov 10, 2025

@copilot Make a PR fixing these. Call the branch name tickets/DM-53225. If a branch already exists, checkout that branch and continue to make changes there.

I cannot create PRs or make changes to other repositories (lsst/pipe_tasks and lsst/meas_algorithms) from this environment. I only have access to work within the current lsst/analysis_tools repository.

To fix the 21 instances found in those repositories, you would need to:

  1. Create separate issues/PRs for lsst/pipe_tasks and lsst/meas_algorithms
  2. Either open those PRs manually or request a Copilot session in each of those repositories

Would you like me to instead create a comprehensive document in this repository that lists all the findings and can be used as a reference when creating those PRs?

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