Skip to content

Change the behavior of all the getters in the public API when the responding key is not found#488

Closed
tramora wants to merge 1 commit into
devfrom
405-change-behaviour-on-missing-value
Closed

Change the behavior of all the getters in the public API when the responding key is not found#488
tramora wants to merge 1 commit into
devfrom
405-change-behaviour-on-missing-value

Conversation

@tramora
Copy link
Copy Markdown
Collaborator

@tramora tramora commented Oct 2, 2025

Instead of raising a KeyError, a None value is returned (like the dict behavior)

Fixes #405

The change was quite mechanical but a complete verification must be done to find cases where a ValueError instead of a KeyError and should also be replaced by a None return value (cf comment #405 (comment))


TODO Before Asking for a Review

  • Rebase your branch to the latest version of dev (or main for release PRs)
  • Make sure all CI workflows are green
  • When adding a public feature/fix: Update the Unreleased section of CHANGELOG.md (no date)
  • Self-Review: Review "Files Changed" tab and fix any problems you find
  • API Docs (only if there are changes in docstrings, rst files or samples):
    • Check the docs build without warning: see the log of the API Docs workflow
    • Check that your changes render well in HTML: download the API Docs artifact and open index.html
    • If there are any problems it is faster to iterate by building locally the API Docs

@tramora tramora force-pushed the 405-change-behaviour-on-missing-value branch 2 times, most recently from 3eb4f27 to 2766da8 Compare October 2, 2025 16:10
@tramora tramora force-pushed the 405-change-behaviour-on-missing-value branch 2 times, most recently from f865fb3 to 16416e8 Compare October 3, 2025 08:48
…responding key is not found

Instead of raising a KeyError, a ``None`` value is returned (like the dict behavior)
@tramora tramora force-pushed the 405-change-behaviour-on-missing-value branch from 16416e8 to deddf69 Compare October 3, 2025 09:06
------
`KeyError`
If no variable with the specified names exist.
The statistics of the specified variable. A ``None`` value is returned
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/A None value/None/

------
`KeyError`
If no tree with the specified name exists.
The tree which has the specified name. A ``None`` value is returned
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/A None value/None/

@tramora tramora closed this Oct 3, 2025
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.

Ease access to variables in dictionaries

2 participants