Skip to content

docs: fix segment selection in demo notebook - #1088

Open
AKnassa wants to merge 1 commit into
google:masterfrom
AKnassa:rocky/issue-609-jupyter-demo
Open

docs: fix segment selection in demo notebook#1088
AKnassa wants to merge 1 commit into
google:masterfrom
AKnassa:rocky/issue-609-jupyter-demo

Conversation

@AKnassa

@AKnassa AKnassa commented Jul 28, 2026

Copy link
Copy Markdown

Fixes #609

What this does

Fixes one broken line in the Jupyter notebook demo.

Why

The "Select a couple segments" cell called segments.update([...]). That stopped working when layer.segments became a set-like view of the starred segments, so running the cell raised AttributeError: 'VisibleSegments' object has no attribute 'update'.

What changed

  • One line: segments.update([1752, 88847]) becomes segments |= [1752, 88847], which the set view does support and which accepts any iterable.

update itself still exists on StarredSegments, if starring rather than selecting is what is wanted.

How to see it

Run the notebook. The cell now selects the two segments instead of raising an error. This was the only stale call in the notebook — the later segments.add cell is still correct.

`layer.segments` became a `VisibleSegments` view when starred segments
were introduced, and that view is a `MutableSet`, which has no `update`.
Running the cell raised `AttributeError: 'VisibleSegments' object has no
attribute 'update'`.

Use `|=`, which `MutableSet` supports and which accepts any iterable, so
the cell reads much as before.  `update` itself now lives on
`StarredSegments`, if starring rather than selecting is wanted.

This was the only stale call in the notebook; the later `segments.add`
cell is still correct.

Fixes google#609
@AKnassa
AKnassa marked this pull request as ready for review July 30, 2026 05:18
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.

Jupyter Notebook Demo outdated and causes errors

1 participant