Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: add set_options to SelectionList#6224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
NSPC911 wants to merge1 commit intoTextualize:main
base:main
Choose a base branch
Loading
fromNSPC911-forks:selection-set-options-clear-selected

Conversation

@NSPC911
Copy link
Contributor

threw me off when this happened to rovr, because the self._selected never got cleared whenset_options was used instead ofclear_options +add_options

Please review the following checklist.

  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

threw me off when this happened to rovr, because the self._selectednever got cleared when `set_options` was used instead of `clear_options`+ `add_options`
NSPC911 added a commit to NSPC911/rovr that referenced this pull requestNov 11, 2025
waiting for a new release that hasTextualize/textual#6224 merged
Copy link
Collaborator

@TomJGoodingTomJGooding left a comment

Choose a reason for hiding this comment

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

Are you sure this is correct?You can build aSelectionList with tuples or Selection objects, but here it looks like you're trying to useSelectionType?

@NSPC911
Copy link
ContributorAuthor

Are you sure this is correct?You can build aSelectionList with tuples or Selection objects, but here it looks like you're trying to useSelectionType?

not really sure which one to use, given thatOptionList'sset_option method only takes in an IterableOptionListContent

@TomJGooding
Copy link
Collaborator

I'm confused, Did you check your code actually worked, or just throw the PR over the wall?

@NSPC911
Copy link
ContributorAuthor

The general code worked, but I'm not sure about which class to use as the type hint for the function

@TomJGooding
Copy link
Collaborator

Sorry, I think I understand the problem now.

I thought the signature would just be similar to theSelectionList.add_options method:

defadd_options(
self,
items:Iterable[
OptionListContent
|Selection[SelectionType]
|tuple[ContentText,SelectionType]
|tuple[ContentText,SelectionType,bool]
],
)->Self:

But of course this doesn't satisfy mypy and friends forsuper().set_options(options).

I realise now that I overlooked that this actually ends up callingSelectionList.add_options. Repeating the same runtime checks in bothset_option andadd_options would definitely be "sort of sub-optimal"!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@TomJGoodingTomJGoodingTomJGooding left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@NSPC911@TomJGooding

[8]ページ先頭

©2009-2025 Movatter.jp