Skip to content

Commit 282a22d

Browse files
committed
Fix Mypy errors
1 parent 7f07a7f commit 282a22d

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

spynnaker/pyNN/__init__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,8 @@ def set_allow_delay_extensions(
484484

485485

486486
def connect(pre: Population, post: Population, weight: float = 0.0,
487-
delay: Optional[float] = None, receptor_type: Optional[str] = None,
488-
p: int = 1, rng: Optional[NumpyRNG] = None) -> None:
487+
delay: Optional[float] = None, receptor_type: str = "excitatory",
488+
p: int = 1, rng: Optional[NumpyRNG] = None) -> Projection:
489489
"""
490490
Builds a projection.
491491
@@ -496,6 +496,7 @@ def connect(pre: Population, post: Population, weight: float = 0.0,
496496
:param receptor_type: excitatory / inhibitory
497497
:param p: probability
498498
:param rng: random number generator (ignored)
499+
:returns: a new Projection
499500
"""
500501
SpynnakerDataView.check_user_can_act()
501502
if isinstance(pre, IDMixin):
@@ -524,7 +525,7 @@ def create(
524525
:returns: A new Population
525526
"""
526527
SpynnakerDataView.check_user_can_act()
527-
return Population(cellclass, cellparams, n)
528+
return Population(n, cellclass, cellparams)
528529

529530

530531
def NativeRNG(seed_value: Union[int, List[int], NDArray]) -> None:
@@ -543,6 +544,7 @@ def get_current_time() -> float:
543544
:return: returns the current time
544545
"""
545546
SpynnakerDataView.check_user_can_act()
547+
assert __simulator is not None
546548
return __simulator.t
547549

548550

@@ -554,6 +556,7 @@ def get_min_delay() -> int:
554556
:return: returns the min delay of the simulation
555557
"""
556558
SpynnakerDataView.check_user_can_act()
559+
assert __simulator is not None
557560
return __simulator.dt
558561

559562

@@ -579,6 +582,7 @@ def get_time_step() -> float:
579582
:return: get the time step of the simulation (in ms)
580583
"""
581584
SpynnakerDataView.check_user_can_act()
585+
assert __simulator is not None
582586
return __simulator.dt
583587

584588

@@ -618,7 +622,7 @@ def rank() -> int:
618622
return 0
619623

620624

621-
def record(variables: Union[str, Sequence[str]], source: PopulationBase,
625+
def record(variables: Union[str, Sequence[str]], source: Population,
622626
filename: str, sampling_interval: Optional[float] = None,
623627
annotations: Optional[Dict[str, Any]] = None) -> Block:
624628
"""
@@ -652,6 +656,7 @@ def reset(annotations: Optional[Dict[str, Any]] = None) -> None:
652656
"""
653657
if annotations is None:
654658
annotations = {}
659+
assert __simulator is not None
655660
for recorder in __simulator.recorders:
656661
recorder.store_to_cache(annotations)
657662
__simulator.reset()
@@ -666,6 +671,7 @@ def _run_until(time_point: float, callbacks: Optional[List[Callable]] = None):
666671
accept the current time as an argument, and return the next time it
667672
wishes to be called.
668673
"""
674+
assert __simulator is not None
669675
now = __simulator.t
670676
# allow for floating point error
671677
if time_point - now < -__simulator.dt / 2.0:
@@ -701,6 +707,7 @@ def run(simtime: float, callbacks: Optional[List[Callable]] = None) -> float:
701707
:return: the actual simulation time that the simulation stopped at
702708
"""
703709
SpynnakerDataView.check_user_can_act()
710+
assert __simulator is not None
704711
return _run_until(__simulator.t + simtime, callbacks)
705712

706713

spynnaker/pyNN/spinnaker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def clear(self) -> None:
192192
"""
193193
Clear the current recordings and reset the simulation.
194194
"""
195-
self.recorders = set()
195+
self.__recorders = set()
196196
self.reset()
197197

198198
# Stop any currently running SpiNNaker application

0 commit comments

Comments
 (0)