Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Jan 9, 2025
1 parent 142dacc commit 1deba3f
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 18 deletions.
1 change: 1 addition & 0 deletions spynnaker/gsyn_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# TODO No use case found for this code
# mypy: disable-error-code="no-untyped-def"


def check_gsyn(gsyn1, gsyn2):
"""
Compare two arrays of conductances. For testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from spynnaker.pyNN.models.neuron.neuron_models import (
NeuronModelLeakyIntegrateAndFire)
from spynnaker.pyNN.models.neuron.synapse_types import SynapseTypeExponential
from.abstract_ethernet_translator import AbstractEthernetTranslator
from .abstract_ethernet_translator import AbstractEthernetTranslator
from .abstract_multicast_controllable_device import (
AbstractMulticastControllableDevice)
from .external_device_lif_control_vertex import ExternalDeviceLifControlVertex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MunichMotorDevice(
def __init__(
self, spinnaker_link_id: int, board_address: Optional[str] = None,
speed: int = 30, sample_time: int = 4096, update_time: int = 512,
delay_time: int = 5, delta_threshold: int = 23,
delay_time: int = 5, delta_threshold: int = 23,
continue_if_not_different: bool = True,
label: Optional[str] = None):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Any, List
from typing import List

from spynnaker.pyNN.models.defaults import default_initial_values
from spynnaker.pyNN.external_devices_models.push_bot.ethernet import (
Expand Down Expand Up @@ -50,7 +50,6 @@ class PushBotLifEthernet(ExternalDeviceLifControl):
"""
__slots__ = ()


@default_initial_values({"v", "isyn_exc", "isyn_inh"})
def __init__(
self, protocol: MunichIoSpiNNakerLinkProtocol,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(
self, protocol: MunichIoSpiNNakerLinkProtocol,
device: AbstractPushBotOutputDevice,
uses_payload: bool, time_between_send: Optional[int],
first_send_timestep: Optional[int] =_DEFAULT_FIRST_SEND_TIMESTEP):
first_send_timestep: Optional[int] = _DEFAULT_FIRST_SEND_TIMESTEP):
"""
:param MunichIoSpiNNakerLinkProtocol protocol:
The protocol instance to get commands from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def __init__(
self, speaker: PushBotSpeaker,
protocol: MunichIoSpiNNakerLinkProtocol,
start_active_time: int = 0, start_total_period: int = 0,
start_frequency: Optional[int] = 0, start_melody: Optional[int] = None,
start_frequency: Optional[int] = 0,
start_melody: Optional[int] = None,
timesteps_between_send: Optional[int] = None):
"""
:param PushBotSpeaker speaker: The speaker to control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import cast, Dict, Optional, Union

from typing import Optional

from pacman.model.graphs.application import ApplicationSpiNNakerLinkVertex

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import logging
import os
from typing import Dict, Iterator, Tuple
from typing_extensions import Never
import numpy

from spinn_utilities.log import FormatAdapter
Expand Down
2 changes: 1 addition & 1 deletion spynnaker/pyNN/models/common/local_only_2d_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_div_const(value: int) -> int:


def get_delay_for_source(
incoming: "Projection") -> Tuple[ApplicationVertex, int, int ,str]:
incoming: "Projection") -> Tuple[ApplicationVertex, int, int, str]:
""" Get the vertex which will send data from a given source projection,
along with the delay stage and locally-handled delay value
Expand Down
4 changes: 1 addition & 3 deletions spynnaker/pyNN/models/neuron/abstract_population_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
# limitations under the License.
from __future__ import annotations
from collections import defaultdict
from functools import reduce
import logging
import math
import operator
from typing import (
Any, Collection, Dict, Iterable, List, Optional, Sequence, Tuple, Union,
cast, TYPE_CHECKING)
Expand Down Expand Up @@ -1771,7 +1769,7 @@ def __add_signed_projection(self, proj: Projection) -> None:
d_var = s_dynamics.get_delay_variance(connector, s_info.delays, s_info)

signed_dynamics = cast(AbstractSupportsSignedWeights,
s_info.synapse_dynamics)
s_info.synapse_dynamics)
s_type_pos = signed_dynamics.get_positive_synapse_index(proj)
w_mean_pos = signed_dynamics.get_mean_positive_weight(proj)
w_var_pos = signed_dynamics.get_variance_positive_weight(proj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
self, tau_m: ModelParameter = 9.3667, cm: ModelParameter = 0.281,
v_rest: ModelParameter = -70.6, v_reset: ModelParameter = -70.6,
v_thresh: ModelParameter = -50.4, tau_syn_E: ModelParameter = 5.0,
tau_syn_I: ModelParameter = 0.5, tau_refrac: ModelParameter= 0.1,
tau_syn_I: ModelParameter = 0.5, tau_refrac: ModelParameter = 0.1,
i_offset: ModelParameter = 0.0, a: ModelParameter = 4.0,
b: ModelParameter = 0.0805, v_spike: ModelParameter = -40.0,
tau_w: ModelParameter = 144.0, e_rev_E: ModelParameter = 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
v_rest: ModelParameter = -65.0, v_reset: ModelParameter = -65.0,
v_thresh: ModelParameter = -50.0, tau_syn_E: ModelParameter = 5.0,
tau_syn_E2: ModelParameter = 5.0, tau_syn_I: ModelParameter = 5.0,
tau_refrac: ModelParameter = 0.1, i_offset: ModelParameter =0.0,
tau_refrac: ModelParameter = 0.1, i_offset: ModelParameter = 0.0,
v: ModelParameter = -65.0, isyn_exc: ModelParameter = 0.0,
isyn_exc2: ModelParameter = 0.0, isyn_inh: ModelParameter = 0.0,
multiplicator: ModelParameter = 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def generate_distance_probability_array(

return filtered_probabilities

def distance(
self, x0: ArrayLike, x1: ArrayLike, metric: str) -> NDArray[floating]:
def distance(self, x0: ArrayLike, x1: ArrayLike,
metric: str) -> NDArray[floating]:
"""
Compute the distance between points x0 and x1 place on the grid
using periodic boundary conditions.
Expand Down
3 changes: 2 additions & 1 deletion spynnaker/pyNN/models/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
logger = FormatAdapter(logging.getLogger(__name__))


def _we_dont_do_this_now(*args: Any) -> Never: # pylint: disable=unused-argument
def _we_dont_do_this_now(*args: Any
) -> Never: # pylint: disable=unused-argument
# pragma: no cover
raise NotImplementedError("sPyNNaker does not currently do this")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def get_recording_region(self, name: str) -> int:
raise KeyError(f"Cannot record {name}")
return 0


@overrides(PopulationApplicationVertex.get_neurons_recording)
def get_neurons_recording(
self, name: str, vertex_slice: Slice) -> NDArray[numpy.integer]:
Expand Down

0 comments on commit 1deba3f

Please sign in to comment.