Code Duplication    Length = 16-16 lines in 2 locations

src/pytest_benchmark/stats.py 2 locations

@@ 125-140 (lines=16) @@
122
        else:  # Method 2
123
            return statistics.median(data[:rounds // 2])
124
125
    @cached_property
126
    def q3(self):
127
        rounds = self.rounds
128
        data = self.sorted_data
129
130
        # See: https://en.wikipedia.org/wiki/Quartile#Computing_methods
131
        if rounds == 1:
132
            return data[0]
133
        elif rounds % 2:  # Method 3
134
            n, q = rounds // 4, rounds % 4
135
            if q == 1:
136
                return 0.75 * data[3 * n] + 0.25 * data[3 * n + 1]
137
            else:
138
                return 0.25 * data[3 * n + 1] + 0.75 * data[3 * n + 2]
139
        else:  # Method 2
140
            return statistics.median(data[rounds // 2:])
141
142
    @cached_property
143
    def iqr(self):
@@ 108-123 (lines=16) @@
105
            else:
106
                return self.sorted_data[pos]
107
108
    @cached_property
109
    def q1(self):
110
        rounds = self.rounds
111
        data = self.sorted_data
112
113
        # See: https://en.wikipedia.org/wiki/Quartile#Computing_methods
114
        if rounds == 1:
115
            return data[0]
116
        elif rounds % 2:  # Method 3
117
            n, q = rounds // 4, rounds % 4
118
            if q == 1:
119
                return 0.25 * data[n - 1] + 0.75 * data[n]
120
            else:
121
                return 0.75 * data[n] + 0.25 * data[n + 1]
122
        else:  # Method 2
123
            return statistics.median(data[:rounds // 2])
124
125
    @cached_property
126
    def q3(self):