Skip to content

fix: quote dump source, clean CLI errors, single-slash node paths - #325

Merged
henryiii merged 6 commits into
mainfrom
fix/quoting-cli-errors-paths
Nov 21, 2026
Merged

henryiii merged 6 commits into
mainfrom
fix/quoting-cli-errors-paths

Conversation

@henryiii

@henryiii henryiii commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Items 4, 5 and 6 of #322.

  • Dump & Quit: uproot.open(...) and file[...] use repr() for the path and the keys. A Windows path or a key with a quote now gives valid Python. Test expectations change to the '...' quote style.
  • CLI: tree, plot and browse raise a click.ClickException when a file does not open (OSError, ValueError), a key is not found (KeyError), or the object is not plottable (or empty). The message includes the original error. Other errors still show a traceback. plot opens the node with with, so the file closes. browse opens a local spec before the TUI starts and gives the node to the app (new root argument of Browser and UprootTree), so the file opens one time and closes after the app exits. A remote spec still opens in the TUI.
  • Node paths: a child of the top is /key, not //key. _below_root, _plot_label, JumpScreen._label and _path_header do not strip extra slashes now. A new _is_below helper makes the jump prefix test correct for the top node (/).

Refs #322

@henryiii henryiii left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤖 AI text below 🤖

Please reuse the node opened by browse when constructing UprootTree. The new with open_node(spec): pass closes the file after validation, then the tree opens it again. I counted two calls to uproot.open for the same file during one successful local browse invocation. For a file on a network mount, this repeats the open and metadata reads before the tree is usable. Passing the open node to the tree would keep the early CLI error and let the TUI close the file on exit.

@henryiii
henryiii force-pushed the fix/quoting-cli-errors-paths branch from 2bd9cf8 to 52cb0c3 Compare November 21, 2026 00:55
@henryiii

Copy link
Copy Markdown
Member Author

🤖 AI text below 🤖

Fixed. browse now gives the open node to Browser and UprootTree (new root argument), so a local file opens one time. The CLI error before the TUI starts stays. The file closes after the app exits. The new test test_browse_opens_file_once counts the uproot.open calls and checks that the file is closed. I also rebased on main.

@henryiii
henryiii marked this pull request as ready for review November 21, 2026 01:15
@henryiii
henryiii force-pushed the fix/quoting-cli-errors-paths branch from 21cf455 to d4af63c Compare November 21, 2026 01:19
- Dump & Quit writes the file path and the keys with repr(), so a
  backslash or a quote in a name gives valid Python.
- tree, plot and browse show a short error for a file that does not
  open, a key that is not found, or an object that is not plottable.
  plot closes the file after use. browse opens a local spec once
  before the TUI starts, to find these errors.
- A child of the top node has the path "/key", not "//key". The TUI
  callers do not strip slashes now.

Refs #322

Assisted-by: ClaudeCode:claude-opus-5-5
Refs #322

Assisted-by: ClaudeCode:claude-opus-5-5
browse gives the node it opened to the TUI and closes it after the app
exits. Before, it opened the file to find errors, closed it, and the
tree opened it again.

Refs #322

Assisted-by: ClaudeCode:claude-opus-5-5
Refs #322

Assisted-by: ClaudeCode:claude-opus-5-5
Refs #322

Assisted-by: ClaudeCode:claude-opus-5-5
Refs #322

Assisted-by: ClaudeCode:claude-opus-5-5
@henryiii
henryiii force-pushed the fix/quoting-cli-errors-paths branch from d4af63c to ca65478 Compare November 21, 2026 01:26
@henryiii
henryiii merged commit e171dcf into main Nov 21, 2026
12 checks passed
@henryiii
henryiii deleted the fix/quoting-cli-errors-paths branch November 21, 2026 01:39
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.

1 participant