Skip to content

Avoid passing pre-formatted strings to time_this (DM-54999)#1378

Merged
andy-slac merged 2 commits into
mainfrom
tickets/DM-54999
May 19, 2026
Merged

Avoid passing pre-formatted strings to time_this (DM-54999)#1378
andy-slac merged 2 commits into
mainfrom
tickets/DM-54999

Conversation

@andy-slac
Copy link
Copy Markdown
Contributor

That methods expects message string to be a format string for logging.log. When we pre-format that message it could end up with a percent sign in it with causes exceptions in logging.

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes
  • (if changing dimensions.yaml) make a copy of the updated dimensions.yaml in configs/old_dimensions and update the list in doc/lsst.daf.butler/dimensions.rst

Copy link
Copy Markdown
Member

@timj timj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. That's how the API is meant to be used.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.61%. Comparing base (92b2eb9) to head (3b599e0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1378   +/-   ##
=======================================
  Coverage   89.61%   89.61%           
=======================================
  Files         373      373           
  Lines       50776    50780    +4     
  Branches     5913     5913           
=======================================
+ Hits        45505    45509    +4     
  Misses       3880     3880           
  Partials     1391     1391           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andy-slac
Copy link
Copy Markdown
Contributor Author

@timj, I had to add a fix for mypy2, could you check my last commit acf6d5f?

Copy link
Copy Markdown
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could have just removed the cast calls, but I guess with the asserts we get compatibility with new and old.

@andy-slac
Copy link
Copy Markdown
Contributor Author

I think you could have just removed the cast calls, but I guess with the asserts we get compatibility with new and old.

Without assert old mypy complains about .name being None when we want it to str. It's probably going to be the same with mypy2.

@TallJimbo
Copy link
Copy Markdown
Member

I think that suggests that this was triggered by a click annotation upgrade, not MyPy (I think the MyPy 2 updates already happened). But the change is fine either way.

andy-slac added 2 commits May 19, 2026 14:58
That methods expects message string to be a format string
for `logging.log`. When we pre-format that message it could
end up with a percent sign in it with causes exceptions
in `logging`.
@andy-slac andy-slac merged commit 19cdc59 into main May 19, 2026
25 checks passed
@andy-slac andy-slac deleted the tickets/DM-54999 branch May 19, 2026 22:15
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.

3 participants