Skip to content

Commit

Permalink
Use Python 3 only
Browse files Browse the repository at this point in the history
We were using some compatibility functions in nengo.utils.compat
out of habit, but since we are only supporting Python 3 they
were unnecessary.
  • Loading branch information
tbekolay committed Nov 11, 2018
1 parent a0e644d commit f5ffc56
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions nengo_loihi/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from nengo.exceptions import BuildError
from nengo.solvers import NoSolver, Solver
from nengo.utils.builder import default_n_eval_points
from nengo.utils.compat import iteritems
import nengo.utils.numpy as npext

from nengo_loihi.loihi_cx import (
Expand Down Expand Up @@ -841,7 +840,7 @@ def signal_probe(model, key, probe):
@Builder.register(Probe)
def build_probe(model, probe):
# find the right parent class in `objtypes`, using `isinstance`
for nengotype, probeables in iteritems(probemap):
for nengotype, probeables in probemap.items():
if isinstance(probe.obj, nengotype):
break
else:
Expand Down
2 changes: 1 addition & 1 deletion nengo_loihi/loihi_cx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import numpy as np
from nengo.exceptions import BuildError, SimulationError
from nengo.utils.compat import is_iterable, range
from nengo.utils.compat import is_iterable

from nengo_loihi.loihi_api import (
BIAS_MAX,
Expand Down
1 change: 0 additions & 1 deletion nengo_loihi/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from nengo.exceptions import (
BuildError, ReadonlyError, SimulatorClosed, ValidationError)
from nengo.simulator import ProbeDict as NengoProbeDict
from nengo.utils.compat import ResourceWarning

from nengo_loihi.builder import Model
from nengo_loihi.loihi_cx import CxGroup
Expand Down
5 changes: 2 additions & 3 deletions nengo_loihi/splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import nengo
from nengo.exceptions import BuildError, SimulationError
from nengo.utils.compat import iteritems
import numpy as np

from nengo_loihi import loihi_cx
Expand Down Expand Up @@ -74,9 +73,9 @@ def _add(obj, net):
"%s not moved or explicitly removed" % (obj,))

# Process moves and adds
for obj, target in iteritems(self.moves):
for obj, target in self.moves.items():
_add(obj, getattr(self, target))
for obj, target in iteritems(self.adds):
for obj, target in self.adds.items():
_add(obj, getattr(self, target))

def location(self, obj, default=None):
Expand Down
7 changes: 3 additions & 4 deletions nengo_loihi/tests/test_splitter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
import nengo
from nengo.utils.compat import iteritems, itervalues
import numpy as np

from nengo_loihi.config import add_params
Expand Down Expand Up @@ -147,7 +146,7 @@ def test_split_host_neurons_to_chip():
def assert_split_correctly(split_conn):
assert len(networks.adds) == 4
added_types = sorted([(type(obj).__name__, location)
for obj, location in iteritems(networks.adds)])
for obj, location in networks.adds.items()])
assert added_types == [
("ChipReceiveNeurons", "chip"),
("Connection", "chip"),
Expand Down Expand Up @@ -309,9 +308,9 @@ def test_split_host_to_learning_rule():
"Connection", "Connection", "HostSendNode", "HostSendNode",
]
assert off2on_ens in networks.removes
assert "ens_pes_target" in list(itervalues(networks.host2chip_senders))
assert "ens_pes_target" in list(networks.host2chip_senders.values())
assert off2on_neurons in networks.removes
assert "neurons_pes_target" in list(itervalues(networks.host2chip_senders))
assert "neurons_pes_target" in list(networks.host2chip_senders.values())


def test_place_probes():
Expand Down

0 comments on commit f5ffc56

Please sign in to comment.