How to use the slider.utils.lazyval function in slider

To help you get started, we’ve selected a few slider examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github llllllllll / slider / slider / replay.py View on Github external
    @lazyval
    def performance_points(self):
        return self.beatmap.performance_points(
            count_300=self.count_300,
            count_100=self.count_100,
            count_50=self.count_50,
            count_miss=self.count_miss,
            easy=self.easy,
            hard_rock=self.hard_rock,
            half_time=self.half_time,
            double_time=self.double_time,
            hidden=self.hidden,
            flashlight=self.flashlight,
            spun_out=self.spun_out,
        )
github llllllllll / slider / slider / replay.py View on Github external
    @lazyval
    def failed(self):
        """Did the user fail this attempt?
        """
        for _, value in self.life_bar_graph:
            if not value:
                return True

        return False
github llllllllll / slider / slider / beatmap.py View on Github external
    @lazyval
    def sliders(self):
        """Just the sliders in the beatmap.
        """
        return tuple(e for e in self.hit_objects if isinstance(e, Slider))
github llllllllll / slider / slider / beatmap.py View on Github external
    @lazyval
    def half_time(self):
        """The ``HitObject`` as it would appear with
        :data:`~slider.mod.Mod.half_time` enabled.
        """
        return self._time_modify(4 / 3)
github llllllllll / slider / slider / curve.py View on Github external
    @lazyval
    def hard_rock(self):
        """This curve when played with hard rock.
        """
        return type(self)(
            [Position(p.x, 384 - p.y) for p in self.points],
            self.req_length,
        )
github llllllllll / slider / slider / beatmap.py View on Github external
    @lazyval
    def tick_points(self):
        """The position and time of each slider tick.
        """
        repeat = self.repeat

        time = self.time
        repeat_duration = (self.end_time - time) / repeat

        curve = self.curve

        pre_repeat_ticks = []
        append_tick = pre_repeat_ticks.append

        beats_per_repeat = self.num_beats / repeat
        for t in orange(self.tick_rate, beats_per_repeat, self.tick_rate):
            pos = curve(t / beats_per_repeat)
github llllllllll / slider / slider / beatmap.py View on Github external
    @lazyval
    def double_time(self):
        """The ``HitObject`` as it would appear with
        :data:`~slider.mod.Mod.double_time` enabled.
        """
        return self._time_modify(2 / 3)
github llllllllll / slider / slider / curve.py View on Github external
    @lazyval
    def _ts(self):
        lengths = [c.length for c in self._curves]
        length = sum(lengths)
        out = []
        for i, j in enumerate(accumulate(lengths[:-1])):
            self._curves[i].req_length = lengths[i]
            out.append(j / length)
        self._curves[-1].req_length = max(
            0,
            lengths[-1] - (length - self.req_length),
        )
        out.append(1)
        return out
github llllllllll / slider / slider / beatmap.py View on Github external
    @lazyval
    def bpm(self):
        """The bpm of this timing point.

        If this is an inherited timing point this value will be None.
        """
        ms_per_beat = self.ms_per_beat
        if ms_per_beat < 0:
            return None
        return round(60000 / ms_per_beat)
github llllllllll / slider / slider / replay.py View on Github external
    @lazyval
    def hits(self):
        """Dictionary containing beatmap's hit objects sorted into
        300s, 100s, 50s, misses, slider_breaks as they were hit in the replay

        Each hit object will be in exactly one category except sliders which
        may be in slider_breaks in addition to another category

        Slider calculations are unreliable so some objects may in the wrong
        category.
        Spinners are not yet calculated so are always in the 300s category.
        """
        beatmap = self.beatmap
        actions = self.actions
        scores = {"300s": [],
                  "100s": [],
                  "50s": [],