From 6fb36c3d234c42af404666e3f72c24055890b322 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Fri, 28 Jul 2023 16:11:11 -0700 Subject: [PATCH] Add stacklevel parameter to the warnings This makes them come from the code that called the run method with expIdBits. --- python/lsst/ap/association/diaForcedSource.py | 1 + python/lsst/ap/association/packageAlerts.py | 1 + 2 files changed, 2 insertions(+) diff --git a/python/lsst/ap/association/diaForcedSource.py b/python/lsst/ap/association/diaForcedSource.py index 974f08c9..9470301e 100644 --- a/python/lsst/ap/association/diaForcedSource.py +++ b/python/lsst/ap/association/diaForcedSource.py @@ -135,6 +135,7 @@ def run(self, warnings.warn( "'expIdBits' argument is deprecated in favor of 'idGenerator'; will be removed after v26.", category=FutureWarning, + stacklevel=3, # Caller + timeMethod ) if idGenerator is None: diff --git a/python/lsst/ap/association/packageAlerts.py b/python/lsst/ap/association/packageAlerts.py index 45143894..f20a3de1 100644 --- a/python/lsst/ap/association/packageAlerts.py +++ b/python/lsst/ap/association/packageAlerts.py @@ -119,6 +119,7 @@ def run(self, warnings.warn( "The 'ccdExposureIdBits' argument is deprecated and unused; it will be removed after v26.", category=FutureWarning, + stacklevel=3, # Caller + timeMethod ) alerts = [] self._patchDiaSources(diaSourceCat)