Skip to content

Commit

Permalink
Fix super() compatibility
Browse files Browse the repository at this point in the history
This commit fixes the super() compatibility
between Python 2 and 3 versions. The problem
was resolved by passing the class name and
an instance of self to the super() as arguments.

TODO: There should be an instantiation
checker for the search methods. When calling
assertions() from base., please use
super(ClassName, self).assertions()

Author: ljvmiranda921
Email: ljvmiranda921@gmail.com
  • Loading branch information
ljvmiranda921 committed Sep 15, 2017
1 parent 7444c09 commit 39d8358
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyswarms/utils/search/grid_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, optimizer, n_particles, dimensions, options,
"""Initializes the paramsearch."""

# Assign attributes
super().__init__(optimizer, n_particles, dimensions, options,
super(GridSearch, self).__init__(optimizer, n_particles, dimensions, options,
objective_func, iters, bounds=bounds,
velocity_clamp=velocity_clamp)

Expand Down
2 changes: 1 addition & 1 deletion pyswarms/utils/search/random_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, optimizer, n_particles, dimensions, options,
"""

# Assign attributes
super().__init__(optimizer, n_particles, dimensions, options,
super(RandomSearch, self).__init__(optimizer, n_particles, dimensions, options,
objective_func, iters, bounds=bounds,
velocity_clamp=velocity_clamp)
self.n_selection_iters = n_selection_iters
Expand Down

0 comments on commit 39d8358

Please sign in to comment.