Repository: redis/redis-py
File: redis/commands/core.py (Python)

Code before:

        For more information, see https://redis.io/commands/zremrangebyscore
        """
        return self.execute_command("ZREMRANGEBYSCORE", name, min, max)

    def zrevrank(
        self,
        name: KeyT,
        value: EncodableT,
        withscore: bool = False,
        score_cast_func: Union[type, Callable] = float,
    ) -> ResponseT:
        """
        Returns a 0-based value indicating the descending rank of
        ``value`` in sorted set ``name``.
        The optional ``withscore`` argument supplements the command's
        reply with the score of the element returned.

        For more information, see https://redis.io/commands/zrevrank
        """
        pieces = ["ZREVRANK", name, value]
        if withscore:
            pieces.append("WITHSCORE")

        options = {"withscore": withscore, "score_cast_func": score_cast_func}
        options["keys"] = name

        return self.execute_command(*pieces, **options)

    def zscore(self, name: KeyT, value: EncodableT) -> ResponseT:
        """
        Return the score of element ``value`` in sorted set ``name``

        For more information, see https://redis.io/commands/zscore
        """
        return self.execute_command("ZSCORE", name, value, keys=[name])

    def zunion(
        self,
        keys: Union[Sequence[KeyT], Mapping[AnyKeyT, float]],
        aggregate: Optional[str] = None,
        withscores: bool = False,
        score_cast_func: Union[type, Callable] = float,
    ) -> ResponseT:
        """
        Return the union of multiple sorted sets specified by ``keys``.
        ``keys`` can be provided as dictionary of keys and their weights.
        Scores will be aggregated based on the ``aggregate``, or SUM if
        none is provided.

        For more information, see https://redis.io/commands/zunion

Review comment (suggestion):
The keys option should be a list containing the name, similar to line 4796. This inconsistency could cause issues with command execution.
```suggestion
        options["keys"] = [name]
```

Code after:
        For more information, see https://redis.io/commands/zremrangebyscore
        """
        return self.execute_command("ZREMRANGEBYSCORE", name, min, max)

    def zrevrank(
        self,
        name: KeyT,
        value: EncodableT,
        withscore: bool = False,
        score_cast_func: Union[type, Callable] = float,
    ) -> ResponseT:
        """
        Returns a 0-based value indicating the descending rank of
        ``value`` in sorted set ``name``.
        The optional ``withscore`` argument supplements the command's
        reply with the score of the element returned.

        ``score_cast_func`` a callable used to cast the score return value

        For more information, see https://redis.io/commands/zrevrank
        """
        pieces = ["ZREVRANK", name, value]
        if withscore:
            pieces.append("WITHSCORE")

        options = {"withscore": withscore, "score_cast_func": score_cast_func}

        return self.execute_command(*pieces, **options)

    def zscore(self, name: KeyT, value: EncodableT) -> ResponseT:
        """
        Return the score of element ``value`` in sorted set ``name``

        For more information, see https://redis.io/commands/zscore
        """
        return self.execute_command("ZSCORE", name, value, keys=[name])

    def zunion(
        self,
        keys: Union[Sequence[KeyT], Mapping[AnyKeyT, float]],
        aggregate: Optional[str] = None,
        withscores: bool = False,
        score_cast_func: Union[type, Callable] = float,
    ) -> ResponseT:
        """
        Return the union of multiple sorted sets specified by ``keys``.
        ``keys`` can be provided as dictionary of keys and their weights.
        Scores will be aggregated based on the ``aggregate``, or SUM if
        none is provided.

        ``score_cast_func`` a callable used to cast the score return value