Skip to content
Snippets Groups Projects
Commit c0c7e2a6 authored by Jan Müller's avatar Jan Müller
Browse files

Regenerate files from swagger.yaml

parent f6cd3199
Branches
No related tags found
No related merge requests found
import connexion
import six
from info_node.models.arbor_neuron_properties import ArborNeuronProperties # noqa: E501
from info_node.models.simulation_time_info import SimulationTimeInfo # noqa: E501
from info_node.models.status import Status # noqa: E501
from info_node import util
def arbor_get_attributes(): # noqa: E501
"""Retrieves a list of measurable attributes
# noqa: E501
:rtype: List[str]
"""
return 'do some magic!'
def arbor_get_neuron_ids(): # noqa: E501
"""Retrieves the list of all neuron IDs.
# noqa: E501
:rtype: List[int]
"""
return 'do some magic!'
def arbor_get_neuron_properties(gids=None): # noqa: E501
"""Retrieves the properties of the specified neurons.
# noqa: E501
:param gids: A list of neuron IDs queried for properties.
:type gids: List[int]
:rtype: List[ArborNeuronProperties]
"""
return 'do some magic!'
def arbor_get_simulation_time_info(): # noqa: E501
"""Retrieves the time information of the current simulation.
# noqa: E501
:rtype: SimulationTimeInfo
"""
return 'do some magic!'
def arbor_put_attributes(attributes=None): # noqa: E501
"""Puts the available attributes
# noqa: E501
:param attributes:
:type attributes: List[str]
:rtype: Status
"""
return 'do some magic!'
def arbor_put_neuron_ids(gids, address): # noqa: E501
"""Registers a neuron by ID.
# noqa: E501
:param gids:
:type gids: List[int]
:param address: Address of the node.
:type address: str
:rtype: Status
"""
return 'do some magic!'
def arbor_put_time(time, node_address): # noqa: E501
"""Registers latest time.
# noqa: E501
:param time:
:type time: float
:param node_address:
:type node_address: str
:rtype: Status
"""
return 'do some magic!'
def arbor_set_neuron_properties(properties): # noqa: E501
"""Sends the properties of the specified neurons.
# noqa: E501
:param properties: A list of neuron IDs queried for properties.
:type properties: list | bytes
:rtype: Status
"""
if connexion.request.is_json:
properties = [ArborNeuronProperties.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
return 'do some magic!'
def arbor_set_simulation_time_info(simulation_time_info): # noqa: E501
"""Sends the time information of the current simulation.
# noqa: E501
:param simulation_time_info:
:type simulation_time_info: dict | bytes
:rtype: Status
"""
if connexion.request.is_json:
simulation_time_info = SimulationTimeInfo.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!'
import connexion
import six
from info_node.models.neuron_properties import NeuronProperties # noqa: E501
from info_node.models.multimeter_info import MultimeterInfo # noqa: E501
from info_node.models.nest_neuron_properties import NestNeuronProperties # noqa: E501
from info_node.models.simulation_time_info import SimulationTimeInfo # noqa: E501
from info_node.models.status import Status # noqa: E501
from info_node import util
from info_node.models.storage import Node
from info_node.models.storage import nest_storage
from info_node.models.multimeter_info_inner import MultimeterInfoInner
from flask import request
ok_status = Status(code=200, message='OK')
def get_gids(): # noqa: E501
def nest_get_gids(): # noqa: E501
"""Retrieves the list of all neuron IDs.
# noqa: E501
......@@ -23,7 +25,7 @@ def get_gids(): # noqa: E501
return nest_storage.data.index.values.tolist()
def get_gids_in_population(population_id): # noqa: E501
def nest_get_gids_in_population(population_id): # noqa: E501
"""Retrieves the list of all neuron IDs.
# noqa: E501
......@@ -36,7 +38,32 @@ def get_gids_in_population(population_id): # noqa: E501
return nest_storage.data[nest_storage.data["population"] == population_id].index.values.tolist()
def get_neuron_properties(gids=None): # noqa: E501
def nest_get_multimeter_info(): # noqa: E501
"""Retreives the available multimeters and their properties
# noqa: E501
:rtype: MultimeterInfo
"""
neurons = nest_storage.data.index.values.tolist()
for multimeter in nest_storage.multimeters:
multimeter.gids.clear()
for gid in neurons:
neuron = nest_storage.data.loc[gid]
multimeter_ids = neuron["multimeters"]
for m_id in multimeter_ids:
for multimeter in nest_storage.multimeters:
if multimeter.id == m_id:
multimeter.gids.append(gid)
return nest_storage.multimeters
def nest_get_neuron_properties(gids=None): # noqa: E501
"""Retrieves the properties of the specified neurons.
# noqa: E501
......@@ -44,7 +71,7 @@ def get_neuron_properties(gids=None): # noqa: E501
:param gids: A list of GIDs queried for properties.
:type gids: List[int]
:rtype: List[NeuronProperties]
:rtype: List[NestNeuronProperties]
"""
if gids is None:
gids = nest_storage.data.index.values.tolist()
......@@ -58,7 +85,7 @@ def get_neuron_properties(gids=None): # noqa: E501
return properties
def get_populations(): # noqa: E501
def nest_get_populations(): # noqa: E501
"""Retrieves the list of all populations.
# noqa: E501
......@@ -69,7 +96,7 @@ def get_populations(): # noqa: E501
return nest_storage.data["population"].dropna().unique().tolist()
def get_simulation_time_info(): # noqa: E501
def nest_get_simulation_time_info(): # noqa: E501
"""Retrieves the time information of the current simulation.
# noqa: E501
......@@ -81,7 +108,7 @@ def get_simulation_time_info(): # noqa: E501
return nest_storage.time_info
def put_gids(gids, address): # noqa: E501
def nest_put_gids(gids, address): # noqa: E501
"""Registers a neuron by ID.
# noqa: E501
......@@ -93,17 +120,41 @@ def put_gids(gids, address): # noqa: E501
:rtype: Status
"""
for gid in gids:
if gid in nest_storage.data.index.values:
return Status(code=400, message="At least one gid already registered")
#for gid in gids:
# if gid in nest_storage.data.index.values:
# return Status(code=400, message="At least one gid already registered")
for gid in gids:
nest_storage.data.loc[gid] = [Node(address=address), None, None]
nest_storage.data.loc[gid] = [Node(address=address), None, None, multimeters]
return ok_status
def nest_put_multimeter_info(id, attributes=None, gids=None): # noqa: E501
"""Puts the available multimeters and their properties
# noqa: E501
:param id:
:type id: int
:param attributes:
:type attributes: List[str]
:param gids:
:type gids: List[int]
:rtype: Status
"""
new_mult = MultimeterInfoInner(id, attributes,[])
if new_mult in nest_storage.multimeters:
return Status(code=400, message="Multimeter already registered")
nest_storage.multimeters.append(new_mult)
return ok_status
def put_populations(gids): # noqa: E501
def nest_put_populations(gids): # noqa: E501
"""Registers a new population with given gids.
# noqa: E501
......@@ -126,11 +177,11 @@ def put_populations(gids): # noqa: E501
row["properties"].update({"population": nest_storage.num_populations + 1 })
nest_storage.num_populations += 1
return ok_status
return nest_storage.num_populations
def put_time(time, node_address): # noqa: E501
"""Registers latest timestep.
def nest_put_time(time, node_address): # noqa: E501
"""Registers latest time.
# noqa: E501
......@@ -145,7 +196,7 @@ def put_time(time, node_address): # noqa: E501
return ok_status
def set_neuron_properties(properties): # noqa: E501
def nest_set_neuron_properties(properties): # noqa: E501
"""Sends the properties of the specified neurons.
# noqa: E501
......@@ -153,7 +204,7 @@ def set_neuron_properties(properties): # noqa: E501
:param properties: A list of GIDs queried for properties.
:type properties: list | bytes
:rtype: None
:rtype: Status
"""
if connexion.request.is_json:
properties = [NeuronProperties.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
......@@ -167,7 +218,8 @@ def set_neuron_properties(properties): # noqa: E501
return ok_status
def set_simulation_time_info(simulation_time_info): # noqa: E501
def nest_set_simulation_time_info(simulation_time_info): # noqa: E501
"""Sends the time information of the current simulation.
# noqa: E501
......@@ -175,7 +227,7 @@ def set_simulation_time_info(simulation_time_info): # noqa: E501
:param simulation_time_info:
:type simulation_time_info: dict | bytes
:rtype: None
:rtype: Status
"""
if connexion.request.is_json:
simulation_time_info = SimulationTimeInfo.from_dict(connexion.request.get_json()) # noqa: E501
......
......@@ -3,6 +3,9 @@
# flake8: noqa
from __future__ import absolute_import
# import models into model package
from info_node.models.neuron_properties import NeuronProperties
from info_node.models.arbor_neuron_properties import ArborNeuronProperties
from info_node.models.multimeter_info import MultimeterInfo
from info_node.models.multimeter_info_inner import MultimeterInfoInner
from info_node.models.nest_neuron_properties import NestNeuronProperties
from info_node.models.simulation_time_info import SimulationTimeInfo
from info_node.models.status import Status
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from info_node.models.base_model_ import Model
from info_node import util
class ArborNeuronProperties(Model):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self, gid: int=None, properties: object=None): # noqa: E501
"""ArborNeuronProperties - a model defined in Swagger
:param gid: The gid of this ArborNeuronProperties. # noqa: E501
:type gid: int
:param properties: The properties of this ArborNeuronProperties. # noqa: E501
:type properties: object
"""
self.swagger_types = {
'gid': int,
'properties': object
}
self.attribute_map = {
'gid': 'gid',
'properties': 'properties'
}
self._gid = gid
self._properties = properties
@classmethod
def from_dict(cls, dikt) -> 'ArborNeuronProperties':
"""Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The ArborNeuronProperties of this ArborNeuronProperties. # noqa: E501
:rtype: ArborNeuronProperties
"""
return util.deserialize_model(dikt, cls)
@property
def gid(self) -> int:
"""Gets the gid of this ArborNeuronProperties.
:return: The gid of this ArborNeuronProperties.
:rtype: int
"""
return self._gid
@gid.setter
def gid(self, gid: int):
"""Sets the gid of this ArborNeuronProperties.
:param gid: The gid of this ArborNeuronProperties.
:type gid: int
"""
self._gid = gid
@property
def properties(self) -> object:
"""Gets the properties of this ArborNeuronProperties.
:return: The properties of this ArborNeuronProperties.
:rtype: object
"""
return self._properties
@properties.setter
def properties(self, properties: object):
"""Sets the properties of this ArborNeuronProperties.
:param properties: The properties of this ArborNeuronProperties.
:type properties: object
"""
self._properties = properties
......@@ -6,7 +6,7 @@ from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from info_node.models.base_model_ import Model
from info_node.models.attribute import Attribute # noqa: F401,E501
from info_node.models.multimeter_info_inner import MultimeterInfoInner # noqa: F401,E501
from info_node import util
......@@ -16,32 +16,16 @@ class MultimeterInfo(Model):
Do not edit the class manually.
"""
def __init__(self, name: str=None, interval: float=None, attributes: List[Attribute]=None): # noqa: E501
def __init__(self): # noqa: E501
"""MultimeterInfo - a model defined in Swagger
:param name: The name of this MultimeterInfo. # noqa: E501
:type name: str
:param interval: The interval of this MultimeterInfo. # noqa: E501
:type interval: float
:param attributes: The attributes of this MultimeterInfo. # noqa: E501
:type attributes: List[Attribute]
"""
self.swagger_types = {
'name': str,
'interval': float,
'attributes': List[Attribute]
}
self.attribute_map = {
'name': 'name',
'interval': 'interval',
'attributes': 'attributes'
}
self._name = name
self._interval = interval
self._attributes = attributes
@classmethod
def from_dict(cls, dikt) -> 'MultimeterInfo':
"""Returns the dict as a model
......@@ -52,66 +36,3 @@ class MultimeterInfo(Model):
:rtype: MultimeterInfo
"""
return util.deserialize_model(dikt, cls)
@property
def name(self) -> str:
"""Gets the name of this MultimeterInfo.
:return: The name of this MultimeterInfo.
:rtype: str
"""
return self._name
@name.setter
def name(self, name: str):
"""Sets the name of this MultimeterInfo.
:param name: The name of this MultimeterInfo.
:type name: str
"""
self._name = name
@property
def interval(self) -> float:
"""Gets the interval of this MultimeterInfo.
:return: The interval of this MultimeterInfo.
:rtype: float
"""
return self._interval
@interval.setter
def interval(self, interval: float):
"""Sets the interval of this MultimeterInfo.
:param interval: The interval of this MultimeterInfo.
:type interval: float
"""
self._interval = interval
@property
def attributes(self) -> List[Attribute]:
"""Gets the attributes of this MultimeterInfo.
:return: The attributes of this MultimeterInfo.
:rtype: List[Attribute]
"""
return self._attributes
@attributes.setter
def attributes(self, attributes: List[Attribute]):
"""Sets the attributes of this MultimeterInfo.
:param attributes: The attributes of this MultimeterInfo.
:type attributes: List[Attribute]
"""
self._attributes = attributes
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from info_node.models.base_model_ import Model
from info_node import util
class MultimeterInfoInner(Model):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self, id: int=None, attributes: List[str]=None, gids: List[int]=None): # noqa: E501
"""MultimeterInfoInner - a model defined in Swagger
:param id: The id of this MultimeterInfoInner. # noqa: E501
:type id: int
:param attributes: The attributes of this MultimeterInfoInner. # noqa: E501
:type attributes: List[str]
:param gids: The gids of this MultimeterInfoInner. # noqa: E501
:type gids: List[int]
"""
self.swagger_types = {
'id': int,
'attributes': List[str],
'gids': List[int]
}
self.attribute_map = {
'id': 'id',
'attributes': 'attributes',
'gids': 'gids'
}
self._id = id
self._attributes = attributes
self._gids = gids
@classmethod
def from_dict(cls, dikt) -> 'MultimeterInfoInner':
"""Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The MultimeterInfo_inner of this MultimeterInfoInner. # noqa: E501
:rtype: MultimeterInfoInner
"""
return util.deserialize_model(dikt, cls)
@property
def id(self) -> int:
"""Gets the id of this MultimeterInfoInner.
:return: The id of this MultimeterInfoInner.
:rtype: int
"""
return self._id
@id.setter
def id(self, id: int):
"""Sets the id of this MultimeterInfoInner.
:param id: The id of this MultimeterInfoInner.
:type id: int
"""
self._id = id
@property
def attributes(self) -> List[str]:
"""Gets the attributes of this MultimeterInfoInner.
:return: The attributes of this MultimeterInfoInner.
:rtype: List[str]
"""
return self._attributes
@attributes.setter
def attributes(self, attributes: List[str]):
"""Sets the attributes of this MultimeterInfoInner.
:param attributes: The attributes of this MultimeterInfoInner.
:type attributes: List[str]
"""
self._attributes = attributes
@property
def gids(self) -> List[int]:
"""Gets the gids of this MultimeterInfoInner.
:return: The gids of this MultimeterInfoInner.
:rtype: List[int]
"""
return self._gids
@gids.setter
def gids(self, gids: List[int]):
"""Sets the gids of this MultimeterInfoInner.
:param gids: The gids of this MultimeterInfoInner.
:type gids: List[int]
"""
self._gids = gids
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from info_node.models.base_model_ import Model
from info_node import util
class NestNeuronProperties(Model):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self, gid: int=None, properties: object=None): # noqa: E501
"""NestNeuronProperties - a model defined in Swagger
:param gid: The gid of this NestNeuronProperties. # noqa: E501
:type gid: int
:param properties: The properties of this NestNeuronProperties. # noqa: E501
:type properties: object
"""
self.swagger_types = {
'gid': int,
'properties': object
}
self.attribute_map = {
'gid': 'gid',
'properties': 'properties'
}
self._gid = gid
self._properties = properties
@classmethod
def from_dict(cls, dikt) -> 'NestNeuronProperties':
"""Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The NestNeuronProperties of this NestNeuronProperties. # noqa: E501
:rtype: NestNeuronProperties
"""
return util.deserialize_model(dikt, cls)
@property
def gid(self) -> int:
"""Gets the gid of this NestNeuronProperties.
:return: The gid of this NestNeuronProperties.
:rtype: int
"""
return self._gid
@gid.setter
def gid(self, gid: int):
"""Sets the gid of this NestNeuronProperties.
:param gid: The gid of this NestNeuronProperties.
:type gid: int
"""
self._gid = gid
@property
def properties(self) -> object:
"""Gets the properties of this NestNeuronProperties.
:return: The properties of this NestNeuronProperties.
:rtype: object
"""
return self._properties
@properties.setter
def properties(self, properties: object):
"""Sets the properties of this NestNeuronProperties.
:param properties: The properties of this NestNeuronProperties.
:type properties: object
"""
self._properties = properties
# coding: utf-8
from __future__ import absolute_import
from flask import json
from six import BytesIO
from info_node.models.arbor_neuron_properties import ArborNeuronProperties # noqa: E501
from info_node.models.simulation_time_info import SimulationTimeInfo # noqa: E501
from info_node.models.status import Status # noqa: E501
from info_node.test import BaseTestCase
class TestArborController(BaseTestCase):
"""ArborController integration test stubs"""
def test_arbor_get_attributes(self):
"""Test case for arbor_get_attributes
Retrieves a list of measurable attributes
"""
response = self.client.open(
'//arbor/attributes',
method='GET')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_arbor_get_neuron_ids(self):
"""Test case for arbor_get_neuron_ids
Retrieves the list of all neuron IDs.
"""
response = self.client.open(
'//arbor/neuron_ids',
method='GET')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_arbor_get_neuron_properties(self):
"""Test case for arbor_get_neuron_properties
Retrieves the properties of the specified neurons.
"""
query_string = [('gids', 56)]
response = self.client.open(
'//arbor/neuron_properties',
method='GET',
query_string=query_string)
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_arbor_get_simulation_time_info(self):
"""Test case for arbor_get_simulation_time_info
Retrieves the time information of the current simulation.
"""
response = self.client.open(
'//arbor/simulation_time_info',
method='GET')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_arbor_put_attributes(self):
"""Test case for arbor_put_attributes
Puts the available attributes
"""
query_string = [('attributes', 'attributes_example')]
response = self.client.open(
'//arbor/attributes',
method='PUT',
content_type='application/json',
query_string=query_string)
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_arbor_put_neuron_ids(self):
"""Test case for arbor_put_neuron_ids
Registers a neuron by ID.
"""
query_string = [('gids', 56),
('address', 'address_example')]
response = self.client.open(
'//arbor/neuron_ids',
method='PUT',
content_type='application/json',
query_string=query_string)
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_arbor_put_time(self):
"""Test case for arbor_put_time
Registers latest time.
"""
query_string = [('time', 1.2),
('node_address', 'node_address_example')]
response = self.client.open(
'//arbor/current_time',
method='PUT',
query_string=query_string)
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_arbor_set_neuron_properties(self):
"""Test case for arbor_set_neuron_properties
Sends the properties of the specified neurons.
"""
properties = [ArborNeuronProperties()]
response = self.client.open(
'//arbor/neuron_properties',
method='PUT',
data=json.dumps(properties),
content_type='application/json')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
def test_arbor_set_simulation_time_info(self):
"""Test case for arbor_set_simulation_time_info
Sends the time information of the current simulation.
"""
simulation_time_info = SimulationTimeInfo()
response = self.client.open(
'//arbor/simulation_time_info',
method='PUT',
data=json.dumps(simulation_time_info),
content_type='application/json')
self.assert200(response,
'Response body is : ' + response.data.decode('utf-8'))
if __name__ == '__main__':
import unittest
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment