spynnaker.pyNN.utilities.ranged package¶
Submodules¶
spynnaker.pyNN.utilities.ranged.spynnaker_ranged_dict module¶
-
class
spynnaker.pyNN.utilities.ranged.spynnaker_ranged_dict.
SpynnakerRangeDictionary
(size, defaults=None)[source]¶ Bases:
spinn_utilities.ranged.range_dictionary.RangeDictionary
The Object is set up initially where every ID in the range will share the same value for each key. All keys must be of type str. The default Values can be anything including None.
Parameters: - size (int) – Fixed number of IDs / Length of lists
- defaults (dict) – Default dictionary where all keys must be str
-
list_factory
(size, value, key)[source]¶ Defines which class or subclass of RangedList to use
Main purpose is for subclasses to use a subclass or RangedList All parameters are pass through ones to the List constructor
Parameters: - size – Fixed length of the list
- value – value to given to all elements in the list
- key – The dict key this list covers.
Returns: AbstractList in this case a RangedList
spynnaker.pyNN.utilities.ranged.spynnaker_ranged_list module¶
-
class
spynnaker.pyNN.utilities.ranged.spynnaker_ranged_list.
SpynnakerRangedList
(size=None, value=None, key=None, use_list_as_value=False)[source]¶ Bases:
spinn_utilities.ranged.ranged_list.RangedList
Parameters: - size – Fixed length of the list
- value – value to given to all elements in the list
- key – The dict key this list covers. This is used only for better Exception messages
- use_list_as_value – True if the value is a list
-
static
as_list
(value, size, ids=None)[source]¶ Converts (if required) the value into a list of a given size. An exception is raised if value cannot be given size elements.
Note
This method can be extended to add other conversions to list in which case
is_list()
must also be extended.Parameters: value – Returns: value as a list Raises: Exception – if the number of values and the size do not match
Module contents¶
-
class
spynnaker.pyNN.utilities.ranged.
SpynnakerRangeDictionary
(size, defaults=None)[source]¶ Bases:
spinn_utilities.ranged.range_dictionary.RangeDictionary
The Object is set up initially where every ID in the range will share the same value for each key. All keys must be of type str. The default Values can be anything including None.
Parameters: - size (int) – Fixed number of IDs / Length of lists
- defaults (dict) – Default dictionary where all keys must be str
-
list_factory
(size, value, key)[source]¶ Defines which class or subclass of RangedList to use
Main purpose is for subclasses to use a subclass or RangedList All parameters are pass through ones to the List constructor
Parameters: - size – Fixed length of the list
- value – value to given to all elements in the list
- key – The dict key this list covers.
Returns: AbstractList in this case a RangedList
-
class
spynnaker.pyNN.utilities.ranged.
SpynnakerRangedList
(size=None, value=None, key=None, use_list_as_value=False)[source]¶ Bases:
spinn_utilities.ranged.ranged_list.RangedList
Parameters: - size – Fixed length of the list
- value – value to given to all elements in the list
- key – The dict key this list covers. This is used only for better Exception messages
- use_list_as_value – True if the value is a list
-
static
as_list
(value, size, ids=None)[source]¶ Converts (if required) the value into a list of a given size. An exception is raised if value cannot be given size elements.
Note
This method can be extended to add other conversions to list in which case
is_list()
must also be extended.Parameters: value – Returns: value as a list Raises: Exception – if the number of values and the size do not match