Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 8c8fb4b

Browse files
author
Jaquier Aurélien Tristan
committed
replace python2 xrange by python3 range
1 parent 50e7c2c commit 8c8fb4b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bluepyopt/deapext/tools/selIBEA.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""IBEA selector"""
22

3-
from past.builtins import xrange # pylint: disable=W0622
4-
53
"""
64
Copyright (c) 2016-2022, EPFL/Blue Brain Project
75
@@ -75,7 +73,7 @@ def _calc_fitness_components(population, kappa):
7573
box_ranges[box_ranges == 0] = 1.0
7674

7775
components_matrix = numpy.zeros((pop_len, pop_len))
78-
for i in xrange(0, pop_len):
76+
for i in range(0, pop_len):
7977
diff = population_matrix - population_matrix[i, :]
8078
components_matrix[i, :] = numpy.max(
8179
numpy.divide(diff, box_ranges),
@@ -113,9 +111,9 @@ def _mating_selection(population, mu, tournament_n):
113111
"""Returns the n_of_parents individuals with the best fitness"""
114112

115113
parents = []
116-
for _ in xrange(mu):
114+
for _ in range(mu):
117115
winner = _choice(population)
118-
for _ in xrange(tournament_n - 1):
116+
for _ in range(tournament_n - 1):
119117
individual = _choice(population)
120118
# Save winner is element with smallest fitness
121119
if individual.ibea_fitness < winner.ibea_fitness:

0 commit comments

Comments
 (0)