mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
SelectType must be Hashable
Because of the internal use of a set for `_legal_values`, only hashable options are allowed.
This commit is contained in:
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
# [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix type hint for SelectType: only hashable types are allowed.
|
||||
|
||||
# [5.3.0] - 2025-08-07
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Generic, Iterable, TypeVar, Union
|
||||
from typing import TYPE_CHECKING, Generic, Hashable, Iterable, TypeVar, Union
|
||||
|
||||
import rich.repr
|
||||
from rich.console import RenderableType
|
||||
@@ -261,7 +261,7 @@ class SelectCurrent(Horizontal):
|
||||
self.post_message(self.Toggle())
|
||||
|
||||
|
||||
SelectType = TypeVar("SelectType")
|
||||
SelectType = TypeVar("SelectType", bound=Hashable)
|
||||
"""The type used for data in the Select."""
|
||||
SelectOption: TypeAlias = "tuple[str, SelectType]"
|
||||
"""The type used for options in the Select."""
|
||||
|
||||
Reference in New Issue
Block a user