Skip to content

Conversation

sfc-gh-tdwojak
Copy link
Contributor

What does this PR do?

Fixing: #731
Using dashes (or hyphens) is sometimes more common and jsonargparse supports this (see #301). However, when resolving default values for arguments in a nested dataclass, it does not normalize arguments with underscores, which results in NSKeyError (see the issue).

This PR adds the normalization line dest = dest.replace("-", "_") that resolves the problem.

Before submitting

  • Did you read the contributing guideline?
  • [] Did you update the documentation? (readme and public docstrings)
  • Did you write unit tests such that there is 100% coverage on related code? (required for bug fixes and new features)
  • Did you verify that new and existing tests pass locally?
  • Did you make sure that all changes preserve backward compatibility?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

Copy link

codecov bot commented Jul 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6ad1dd6) to head (0c71303).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #736   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         6857      6858    +1     
=========================================
+ Hits          6857      6858    +1     

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

Copy link
Member

@mauvilsa mauvilsa left a comment

Choose a reason for hiding this comment

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

Looks good!

Co-authored-by: Mauricio Villegas <5780272+mauvilsa@users.noreply.github.com>
@mauvilsa mauvilsa merged commit 18779d0 into omni-us:main Jul 15, 2025
27 checks passed
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