Skip to content

Commit

Permalink
Merge pull request #3117 from heplesser/fix-pylint-r1730
Browse files Browse the repository at this point in the history
Fix  tests and examples to pass Pylint test R1730
  • Loading branch information
suku248 authored Feb 27, 2024
2 parents 1c4569f + c6507e7 commit d303ecf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
5 changes: 1 addition & 4 deletions pynest/examples/pong/pong.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,7 @@ def propagate_ball_and_paddles(self):
"""Updates ball and paddle coordinates based on direction and velocity."""
for paddle in [self.r_paddle, self.l_paddle]:
paddle.y_pos += paddle.direction * paddle.velocity
if paddle.y_pos < 0:
paddle.y_pos = 0
if paddle.y_pos > self.y_length:
paddle.y_pos = self.y_length
paddle.y_pos = min(max(0, paddle.y_pos), self.y_length)
paddle.update_cell()
self.ball.y_pos += self.ball.velocity * self.ball.direction[1]
self.ball.x_pos += self.ball.velocity * self.ball.direction[0]
Expand Down
3 changes: 1 addition & 2 deletions testsuite/pytests/test_jonke_synapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ def facilitate(self, _delta_t, weight, Kplus):
* Kplus
* np.exp(_delta_t / self.synapse_constants["tau_plus"])
)
if weight > self.synapse_constants["Wmax"]:
weight = self.synapse_constants["Wmax"]
weight = min(weight, self.synapse_constants["Wmax"])
return weight

def depress(self, _delta_t, weight, Kminus):
Expand Down
6 changes: 2 additions & 4 deletions testsuite/pytests/test_stdp_nn_synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ def facilitate(self, _delta_t, w):
* ((1 - w / self.synapse_parameters["Wmax"]) ** self.synapse_parameters["mu_plus"])
* exp(-1 * _delta_t / self.synapse_parameters["tau_plus"])
)
if w > self.synapse_parameters["Wmax"]:
w = self.synapse_parameters["Wmax"]
w = min(w, self.synapse_parameters["Wmax"])
return w

def depress(self, _delta_t, w):
Expand All @@ -273,8 +272,7 @@ def depress(self, _delta_t, w):
* ((w / self.synapse_parameters["Wmax"]) ** self.synapse_parameters["mu_minus"])
* exp(_delta_t / self.neuron_parameters["tau_minus"])
)
if w < 0:
w = 0
w = max(0, w)
return w

def test_nn_symm_synapse(self):
Expand Down

0 comments on commit d303ecf

Please sign in to comment.