Skip to content

Commit 1855567

Browse files
committed
remove typing from docs
1 parent 2d6a298 commit 1855567

149 files changed

Lines changed: 783 additions & 2366 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

spynnaker/pyNN/__init__.py

Lines changed: 19 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,13 @@ def distance(src_cell: IDMixin, tgt_cell: IDMixin,
243243
244244
:param src_cell: Measure from this cell
245245
:param tgt_cell: To this cell
246-
:param ~numpy.ndarray mask:
246+
:param mask:
247247
allows only certain dimensions to be considered, e.g.:
248248
249249
* to ignore the z-dimension, use ``mask=array([0,1])``
250250
* to ignore y, ``mask=array([0,2])``
251251
* to just consider z-distance, ``mask=array([2])``
252-
:param float scale_factor:
252+
:param scale_factor:
253253
allows for different units in the pre- and post-position
254254
(the post-synaptic position is multiplied by this quantity).
255255
:param float offset:
@@ -358,8 +358,6 @@ def setup(timestep: Optional[Union[float, Literal["auto"]]] = None,
358358
def name() -> str:
359359
"""
360360
Returns the name of the simulator.
361-
362-
:rtype: str
363361
"""
364362
return SpynnakerDataView.get_sim_name()
365363

@@ -377,23 +375,16 @@ def Projection(
377375
Used to support PEP 8 spelling correctly.
378376
379377
:param presynaptic_population: the source pop
380-
:type presynaptic_population:
381-
~spynnaker.pyNN.models.populations.Population
382378
:param postsynaptic_population: the destination population
383-
:type postsynaptic_population:
384-
~spynnaker.pyNN.models.populations.Population
385-
:param AbstractConnector connector: the connector type
386-
:param AbstractStaticSynapseDynamics synapse_type: the synapse type
387-
:param None source: Unsupported; must be ``None``
388-
:param str receptor_type: the receptor type
379+
:param connector: the connector type
380+
:param synapse_type: the synapse type
381+
:param source: Unsupported; must be ``None``
382+
:param receptor_type: the receptor type
389383
:param space: the space object
390-
:type space: ~pyNN.space.Space or None
391384
:param label: the label
392-
:type label: str or None
393-
:param bool download_synapses: whether to download synapses
394-
:param str partition_id: the partition id to use for the projection
385+
:param download_synapses: whether to download synapses
386+
:param partition_id: the partition id to use for the projection
395387
:return: a projection object for SpiNNaker
396-
:rtype: ~spynnaker.pyNN.models.projection.Projection
397388
"""
398389
return SpiNNakerProjection(
399390
pre_synaptic_population=presynaptic_population,
@@ -457,8 +448,6 @@ def list_standard_models() -> List[str]:
457448
"""
458449
Return a list of all the StandardCellType classes available for this
459450
simulator.
460-
461-
:rtype: list(str)
462451
"""
463452
return [
464453
key
@@ -482,9 +471,8 @@ def set_number_of_neurons_per_core(
482471
dimensions, it is recommended to set this to `None` here and then
483472
set the maximum on each Population.
484473
485-
:param type(PopulationVertex) neuron_type: neuron type
474+
:param neuron_type: neuron type
486475
:param max_permitted: the number to set to
487-
:type max_permitted: int or tuple or None
488476
"""
489477
if isinstance(neuron_type, str):
490478
raise ConfigurationException(
@@ -546,13 +534,13 @@ def connect(pre: Population, post: Population, weight: float = 0.0,
546534
"""
547535
Builds a projection.
548536
549-
:param ~spynnaker.pyNN.models.populations.Population pre: source pop
550-
:param ~spynnaker.pyNN.models.populations.Population post: destination pop
551-
:param float weight: weight of the connections
552-
:param float delay: the delay of the connections
553-
:param str receptor_type: excitatory / inhibitory
554-
:param float p: probability
555-
:param ~pyNN.random.NumpyRNG rng: random number generator
537+
:param pre: source pop
538+
:param post: destination pop
539+
:param weight: weight of the connections
540+
:param delay: the delay of the connections
541+
:param receptor_type: excitatory / inhibitory
542+
:param p: probability
543+
:param rng: random number generator
556544
"""
557545
SpynnakerDataView.check_user_can_act()
558546
__pynn["connect"](pre, post, weight, delay, receptor_type, p, rng)
@@ -566,10 +554,8 @@ def create(
566554
Builds a population with certain parameters.
567555
568556
:param cellclass: population class
569-
:type cellclass: type or AbstractPyNNModel
570557
:param cellparams: population parameters.
571-
:param int n: number of neurons
572-
:rtype: ~spynnaker.pyNN.models.populations.Population
558+
:param n: number of neurons
573559
"""
574560
SpynnakerDataView.check_user_can_act()
575561
return __pynn["create"](cellclass, cellparams, n)
@@ -580,7 +566,6 @@ def NativeRNG(seed_value: Union[int, List[int], NDArray]) -> None:
580566
Fixes the random number generator's seed.
581567
582568
:param seed_value:
583-
:type seed_value: int or list(int) or ~numpy.ndarray(int32)
584569
"""
585570
__numpy.random.seed(seed_value)
586571

@@ -601,7 +586,6 @@ def get_min_delay() -> int:
601586
least this.
602587
603588
:return: returns the min delay of the simulation
604-
:rtype: int
605589
"""
606590
SpynnakerDataView.check_user_can_act()
607591
return __pynn["get_min_delay"]()
@@ -626,7 +610,6 @@ def get_time_step() -> float:
626610
The integration time step.
627611
628612
:return: get the time step of the simulation (in ms)
629-
:rtype: float
630613
"""
631614
SpynnakerDataView.check_user_can_act()
632615
return float(__pynn["get_time_step"]())
@@ -637,8 +620,6 @@ def initialize(cells: PopulationBase, **initial_values: Any) -> None:
637620
Sets cells to be initialised to the given values.
638621
639622
:param cells: the cells to change parameters on
640-
:type cells: ~spynnaker.pyNN.models.populations.Population or
641-
~spynnaker.pyNN.models.populations.PopulationView
642623
:param initial_values: the parameters and their values to change
643624
"""
644625
SpynnakerDataView.check_user_can_act()
@@ -653,7 +634,6 @@ def num_processes() -> int:
653634
Always 1 on SpiNNaker, which doesn't use MPI.
654635
655636
:return: the number of MPI processes
656-
:rtype: int
657637
"""
658638
SpynnakerDataView.check_user_can_act()
659639
return __pynn["num_processes"]()
@@ -667,7 +647,6 @@ def rank() -> int:
667647
Always 0 on SpiNNaker, which doesn't use MPI.
668648
669649
:return: MPI rank
670-
:rtype: int
671650
"""
672651
SpynnakerDataView.check_user_can_act()
673652
return __pynn["rank"]()
@@ -682,17 +661,12 @@ def record(variables: Union[str, Sequence[str]], source: PopulationBase,
682661
:param variables: may be either a single variable name or a list of
683662
variable names. For a given `celltype` class, `celltype.recordable`
684663
contains a list of variables that can be recorded for that `celltype`.
685-
:type variables: str or list(str)
686664
:param source: where to record from
687-
:type source: ~spynnaker.pyNN.models.populations.Population or
688-
~spynnaker.pyNN.models.populations.PopulationView
689665
:param str filename: file name to write data to
690666
:param sampling_interval:
691667
how often to sample the recording, not ignored so far
692668
:param annotations: the annotations to data writers
693-
:type annotations: dict(str, ...)
694669
:return: neo object
695-
:rtype: ~neo.core.Block
696670
"""
697671
SpynnakerDataView.check_user_can_act()
698672
return __pynn["record"](variables, source, filename, sampling_interval,
@@ -704,7 +678,6 @@ def reset(annotations: Optional[Dict[str, Any]] = None) -> None:
704678
Resets the simulation to t = 0.
705679
706680
:param annotations: the annotations to the data objects
707-
:type annotations: dict(str, ...)
708681
"""
709682
if annotations is None:
710683
annotations = {}
@@ -717,10 +690,9 @@ def run(simtime: float, callbacks: Optional[Callable] = None) -> float:
717690
The run() function advances the simulation for a given number of
718691
milliseconds.
719692
720-
:param float simtime: time to run for (in milliseconds)
693+
:param simtime: time to run for (in milliseconds)
721694
:param callbacks: callbacks to run
722695
:return: the actual simulation time that the simulation stopped at
723-
:rtype: float
724696
"""
725697
SpynnakerDataView.check_user_can_act()
726698
return __pynn["run"](simtime, callbacks)
@@ -735,9 +707,8 @@ def run_until(tstop: float) -> float:
735707
"""
736708
Run until a (simulation) time period has completed.
737709
738-
:param float tstop: the time to stop at (in milliseconds)
710+
:param tstop: the time to stop at (in milliseconds)
739711
:return: the actual simulation time that the simulation stopped at
740-
:rtype: float
741712
"""
742713
SpynnakerDataView.check_user_can_act()
743714
return __pynn["run_until"](tstop, None)
@@ -748,7 +719,6 @@ def get_machine() -> Machine:
748719
Get the SpiNNaker machine in use.
749720
750721
:return: the machine object
751-
:rtype: ~spinn_machine.Machine
752722
"""
753723
SpynnakerDataView.check_user_can_act()
754724
return SpynnakerDataView.get_machine()

spynnaker/pyNN/connections/ethernet_command_connection.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@ def __init__(
3636
local_host: Optional[str] = None,
3737
local_port: Optional[int] = NOTIFY_PORT):
3838
"""
39-
:param AbstractEthernetTranslator translator:
39+
:param translator:
4040
A translator of multicast commands to device commands
4141
:param command_containers:
4242
A list of vertices that have commands to be sent at the start
4343
and end of simulation
44-
:type command_containers:
45-
list(~spinn_front_end_common.abstract_models.AbstractSendMeMulticastCommandsVertex)
46-
:param str local_host:
44+
:param local_host:
4745
The optional host to listen on for the start/resume message
48-
:param int local_port:
46+
:param local_port:
4947
The optional port to listen on for the stop/pause message
5048
"""
5149
super().__init__(
@@ -69,8 +67,6 @@ def add_command_container(
6967
:param command_container:
7068
A vertex that has commands to be sent at the start and end of
7169
simulation
72-
:type command_container:
73-
~spinn_front_end_common.abstract_models.AbstractSendMeMulticastCommandsVertex
7470
"""
7571
if not isinstance(
7672
command_container, AbstractSendMeMulticastCommandsVertex):

spynnaker/pyNN/connections/ethernet_control_connection.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ def __init__(
3030
live_packet_gather_label: str, local_host: Optional[str] = None,
3131
local_port: Optional[int] = None):
3232
"""
33-
:param AbstractEthernetTranslator translator:
34-
The translator of multicast to control commands
35-
:param str label: The label of the vertex to attach the translator to
36-
:param str live_packet_gather_label: The label of the LPG vertex that
33+
:param translator: The translator of multicast to control commands
34+
:param label: The label of the vertex to attach the translator to
35+
:param live_packet_gather_label: The label of the LPG vertex that
3736
this control connection will listen to.
38-
:param str local_host: The optional host to listen on
39-
:param int local_port: The optional port to listen on
37+
:param local_host: The optional host to listen on
38+
:param local_port: The optional port to listen on
4039
"""
4140
super().__init__(
4241
live_packet_gather_label, receive_labels=[label],
@@ -51,9 +50,8 @@ def add_translator(
5150
"""
5251
Add another translator that routes via the LPG.
5352
54-
:param str label: The label of the vertex to attach the translator to
55-
:param AbstractEthernetTranslator translator:
56-
The translator of multicast to control commands
53+
:param label: The label of the vertex to attach the translator to
54+
:param translator: The translator of multicast to control commands
5755
"""
5856
super().add_receive_label(label)
5957
self.__translators[label] = translator

spynnaker/pyNN/connections/spif_live_spikes_connection.py

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,22 @@ def __init__(self, receive_labels: Optional[Iterable[str]],
8585
local_host: Optional[str] = None,
8686
local_port: Optional[int] = None):
8787
"""
88-
:param iterable(str) receive_labels:
88+
:param receive_labels:
8989
Labels of vertices from which live events will be received.
90-
:param str spif_host: The location of the SPIF board receiving packets
91-
:param int spif_port: The port of the SPIF board (default 3332)
92-
:param int events_per_packet:
90+
:param spif_host: The location of the SPIF board receiving packets
91+
:param spif_port: The port of the SPIF board (default 3332)
92+
:param events_per_packet:
9393
The maximum number of events in each packet. SPIF will be
9494
configured to send a packet as soon as it reaches this size if not
9595
before (default is 32)
96-
:param int time_per_packet:
96+
:param time_per_packet:
9797
The maximum time between sending non-empty packets. SPIF will be
9898
configured to send a packet that isn't empty after this many
9999
microseconds (default is 500)
100-
:param str local_host:
100+
:param local_host:
101101
Optional specification of the local hostname or IP address of the
102102
interface to listen on
103-
:param int local_port:
103+
:param local_port:
104104
Optional specification of the local port to listen on. Must match
105105
the port that the toolchain will send the notification on (19999
106106
by default)
@@ -149,15 +149,14 @@ def add_init_callback(self, label: str, init_callback: _INIT) -> None:
149149
"""
150150
Add a callback to be called to initialise a vertex.
151151
152-
:param str label:
152+
:param abel:
153153
The label of the vertex to be notified about. Must be one of the
154154
vertices listed in the constructor
155155
:param init_callback: A function to be called to initialise the
156156
vertex. This should take as parameters the label of the vertex,
157157
the number of neurons in the population, the run time of the
158158
simulation in milliseconds, and the simulation timestep in
159159
milliseconds
160-
:type init_callback: callable(str, int, float, float) -> None
161160
"""
162161
self.__init_callbacks[label].append(init_callback)
163162

@@ -167,13 +166,12 @@ def add_receive_callback(
167166
"""
168167
Add a callback for the reception of live events from a vertex.
169168
170-
:param str label: The label of the vertex to be notified about.
169+
:param label: The label of the vertex to be notified about.
171170
Must be one of the vertices listed in the constructor
172171
:param live_event_callback: A function to be called when events are
173172
received. This should take as parameters the label of the vertex,
174173
and an array-like of atom IDs.
175-
:type live_event_callback: callable(str, list(int)) -> None
176-
:param bool translate_key:
174+
:param translate_key:
177175
True if the key is to be converted to an atom ID, False if the
178176
key should stay a key
179177
"""
@@ -189,14 +187,11 @@ def add_start_resume_callback(
189187
"""
190188
Add a callback for the start and resume state of the simulation.
191189
192-
:param str label: the label of the function to be sent
190+
:param label: the label of the function to be sent
193191
:param start_resume_callback: A function to be called when the start
194192
or resume message has been received. This function should take
195193
the label of the referenced vertex, and an instance of this
196194
class, which can be used to send events.
197-
:type start_resume_callback: callable(str,
198-
~spinn_front_end_common.utilities.connections.LiveEventConnection)
199-
-> None
200195
"""
201196
self.__start_resume_callbacks[label].append(start_resume_callback)
202197

@@ -205,21 +200,15 @@ def add_pause_stop_callback(
205200
"""
206201
Add a callback for the pause and stop state of the simulation.
207202
208-
:param str label: the label of the function to be sent
203+
:param label: the label of the function to be sent
209204
:param pause_stop_callback: A function to be called when the pause
210205
or stop message has been received. This function should take the
211206
label of the referenced vertex, and an instance of this class,
212207
which can be used to send events.
213-
:type pause_stop_callback: callable(str,
214-
~spinn_front_end_common.utilities.connections.LiveEventConnection)
215-
-> None
216208
"""
217209
self.__pause_stop_callbacks[label].append(pause_stop_callback)
218210

219211
def __read_database_callback(self, db_reader: DatabaseReader) -> None:
220-
"""
221-
:param DatabaseReader db_reader:
222-
"""
223212
self.__handle_possible_rerun_state()
224213

225214
vertex_sizes: Dict[str, int] = dict()

0 commit comments

Comments
 (0)