Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif half_time:
modify = op.attrgetter('half_time')
else:
def modify(e):
return e
times = np.empty(
(len(self.hit_objects) - 1, 1),
dtype='timedelta64[ns]',
)
strains = np.empty((len(self.hit_objects) - 1, 2), dtype=np.float64)
hit_objects = map(modify, self.hit_objects)
previous = _DifficultyHitObject(next(hit_objects), radius)
for i, hit_object in enumerate(hit_objects):
new = _DifficultyHitObject(
hit_object,
radius,
previous,
)
times[i] = hit_object.time
strains[i] = new.strains
previous = new
return times, strains
clear_group()
for awk in self._handle_group(group):
count_offsets += 1
rhythm_awkwardness += awk
rhythm_awkwardness /= count_offsets or 1
rhythm_awkwardness *= 82
aim = self._calculate_difficulty(
_DifficultyHitObject.Strain.aim,
difficulty_hit_objects,
)
speed = self._calculate_difficulty(
_DifficultyHitObject.Strain.speed,
difficulty_hit_objects,
)
key = easy, hard_rock, double_time, half_time
self._aim_stars_cache[key] = aim = (
np.sqrt(aim) * self._star_scaling_factor
)
self._speed_stars_cache[key] = speed = (
np.sqrt(speed) * self._star_scaling_factor
)
self._stars_cache[key] = (
aim +
speed +
abs(speed - aim) *
self._extreme_scaling_factor
)
intervals = []
append_interval = intervals.append
if double_time:
modify = op.attrgetter('double_time')
elif half_time:
modify = op.attrgetter('half_time')
else:
def modify(e):
return e
hit_objects = map(modify, self.hit_objects)
previous = _DifficultyHitObject(next(hit_objects), radius)
append_difficulty_hit_object(previous)
for hit_object in hit_objects:
new = _DifficultyHitObject(
hit_object,
radius,
previous,
)
append_interval(new.hit_object.time - previous.hit_object.time)
append_difficulty_hit_object(new)
previous = new
group = []
append_group_member = group.append
clear_group = group.clear
# todo: compute break time from ar
break_threshhold = timedelta(milliseconds=1200)
count_offsets = 0
difficulty_hit_objects = []
append_difficulty_hit_object = difficulty_hit_objects.append
intervals = []
append_interval = intervals.append
if double_time:
modify = op.attrgetter('double_time')
elif half_time:
modify = op.attrgetter('half_time')
else:
def modify(e):
return e
hit_objects = map(modify, self.hit_objects)
previous = _DifficultyHitObject(next(hit_objects), radius)
append_difficulty_hit_object(previous)
for hit_object in hit_objects:
new = _DifficultyHitObject(
hit_object,
radius,
previous,
)
append_interval(new.hit_object.time - previous.hit_object.time)
append_difficulty_hit_object(new)
previous = new
group = []
append_group_member = group.append
clear_group = group.clear
# todo: compute break time from ar
if double_time:
modify = op.attrgetter('double_time')
elif half_time:
modify = op.attrgetter('half_time')
else:
def modify(e):
return e
times = np.empty(
(len(self.hit_objects) - 1, 1),
dtype='timedelta64[ns]',
)
strains = np.empty((len(self.hit_objects) - 1, 2), dtype=np.float64)
hit_objects = map(modify, self.hit_objects)
previous = _DifficultyHitObject(next(hit_objects), radius)
for i, hit_object in enumerate(hit_objects):
new = _DifficultyHitObject(
hit_object,
radius,
previous,
)
times[i] = hit_object.time
strains[i] = new.strains
previous = new
return times, strains