Repository: Rapptz/discord.py
File: discord/ui/select.py (Python)

Code before:
        from ..app_commands import AppCommandChannel, AppCommandThread

        default_type_to_enum: Dict[Type[ValidDefaultValues], SelectDefaultValueType] = {
            User: SelectDefaultValueType.user,
            Member: SelectDefaultValueType.user,
            Role: SelectDefaultValueType.role,
            GuildChannel: SelectDefaultValueType.channel,
            AppCommandChannel: SelectDefaultValueType.channel,
            AppCommandThread: SelectDefaultValueType.channel,
            Thread: SelectDefaultValueType.channel,
        }

        values: List[SelectDefaultValue] = []
        for obj in defaults:
            if isinstance(obj, SelectDefaultValue):
                values.append(obj)
                continue

            if not value_type and isinstance(obj, Object) and obj.type == Object:
                raise ValueError(
                    "Object must have a type specified for the chosen select type. Please pass one using the `type` kwarg."
                )

            if not isinstance(obj, (Object, Role, Member, User, GuildChannel, AppCommandChannel, AppCommandThread, Thread)):
                supported_classes = ', '.join(str(v) for v in default_type_to_enum)
                raise TypeError(f"Invalid type {obj.__class__!r} for default value. Must be one of {supported_classes}")

            values.append(
                SelectDefaultValue(
                    id=obj.id,
                    type=value_type or default_type_to_enum[obj.__class__ if not isinstance(obj, Object) else obj.type],  # type: ignore
                )
            )

        return values


class Select(BaseSelect[V]):
    """Represents a UI select menu with a list of custom options. This is represented
    to the user as a dropdown menu.

    .. versionadded:: 2.0

    Parameters
    ------------
    custom_id: :class:`str`
        The ID of the select menu that gets received during an interaction.
        If not given then one is generated for you.
    placeholder: Optional[:class:`str`]
        The placeholder text that is shown if nothing is selected, if any.
    min_values: :class:`int`

Review comment (suggestion):
```suggestion
                supported_classes = ', '.join(v.__name__ for v in default_type_to_enum)
                raise TypeError(f'Expected one of {supported_classes} not {obj.__class__.__name__}')

Code after:
    def placeholder(self) -> Optional[str]:
        """Optional[:class:`str`]: The placeholder text that is shown if nothing is selected, if any."""
        return self._underlying.placeholder

    @placeholder.setter
    def placeholder(self, value: Optional[str]) -> None:
        if value is not None and not isinstance(value, str):
            raise TypeError('placeholder must be None or str')

        self._underlying.placeholder = value

    @property
    def min_values(self) -> int:
        """:class:`int`: The minimum number of items that must be chosen for this select menu."""
        return self._underlying.min_values

    @min_values.setter
    def min_values(self, value: int) -> None:
        self._underlying.min_values = int(value)

    @property
    def max_values(self) -> int:
        """:class:`int`: The maximum number of items that can be chosen for this select menu."""
        return self._underlying.max_values

    @max_values.setter
    def max_values(self, value: int) -> None:
        self._underlying.max_values = int(value)

    @property
    def disabled(self) -> bool:
        """:class:`bool`: Whether the select is disabled or not."""
        return self._underlying.disabled

    @disabled.setter
    def disabled(self, value: bool) -> None:
        self._underlying.disabled = bool(value)

    @property
    def width(self) -> int:
        return 5

    def to_component_dict(self) -> SelectMenuPayload:
        return self._underlying.to_dict()

    def _refresh_component(self, component: SelectMenu) -> None:
        self._underlying = component

    def _refresh_state(self, interaction: Interaction, data: SelectMessageComponentInteractionData) -> None:
        values = selected_values.get({})
        payload: List[PossibleValue]