# Path: alvi/client/containers/array.py
# class Array(base.Container):
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self._nodes = []
# 
#     def init(self, size):
#         if self._nodes:
#             raise RuntimeError("Array was already initialized")
#         for i in range(size):
#             self._nodes.append(Node(self))
# 
#     def __getitem__(self, index):
#         return self._nodes[index].value
# 
#     def __setitem__(self, index, value):
#         self._nodes[index].value = value
# 
#     def size(self):
#         return len(self._nodes)
# 
#     def create_marker(self, name, node_id):
#         node = self._nodes[node_id]
#         return Marker(name, node)
# 
#     def swap_nodes(self, index1, index2):
#         array.swap_nodes(
#             self._pipe,
#             node1={'id': self._nodes[index1].id},
#             node2={'id': self._nodes[index2].id}
#         )
#         self._nodes[index1], self._nodes[index2] = self._nodes[index2], self._nodes[index1]
# 
# Path: alvi/client/scenes/base.py
# class Scene(api.BaseScene):
#     """base class for container based scenes"""
#     class Form(forms.Form):
#         pass
# 
#     @classmethod
#     def run_wrapper(cls, scene, pipe, **kwargs):
#         container = cls.container_class()(pipe)
#         kwargs['container'] = container
#         scene.run(**kwargs)
# 
#     @classmethod
#     def container_name(cls):
#         return cls.container_class().name()
# 
#     @classmethod
#     @abc.abstractmethod
#     def container_class(cls):
#         raise NotImplementedError
# 
#     def test(self, container, test_case):
#         logger.warning("skipping test for %s" % self.__class__.__name__)


from alvi.client.containers import Array
from alvi.client.scenes.base import Scene


class ArrayCreateNode(Scene):
    def run(self, **kwargs):
        data_generator = kwargs['data_generator']
        array = kwargs['container']
        array.init(data_generator.quantity())
        for i, value in enumerate(data_generator.values):
            array[i] = value
        array.sync()

    @classmethod
    def container_class(cls):

# Path: alvi/client/containers/array.py
# class Array(base.Container):
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self._nodes = []
# 
#     def init(self, size):
#         if self._nodes:
#             raise RuntimeError("Array was already initialized")
#         for i in range(size):
#             self._nodes.append(Node(self))
# 
#     def __getitem__(self, index):
#         return self._nodes[index].value
# 
#     def __setitem__(self, index, value):
#         self._nodes[index].value = value
# 
#     def size(self):
#         return len(self._nodes)
# 
#     def create_marker(self, name, node_id):
#         node = self._nodes[node_id]
#         return Marker(name, node)
# 
#     def swap_nodes(self, index1, index2):
#         array.swap_nodes(
#             self._pipe,
#             node1={'id': self._nodes[index1].id},
#             node2={'id': self._nodes[index2].id}
#         )
#         self._nodes[index1], self._nodes[index2] = self._nodes[index2], self._nodes[index1]
# 
# Path: alvi/client/scenes/base.py
# class Scene(api.BaseScene):
#     """base class for container based scenes"""
#     class Form(forms.Form):
#         pass
# 
#     @classmethod
#     def run_wrapper(cls, scene, pipe, **kwargs):
#         container = cls.container_class()(pipe)
#         kwargs['container'] = container
#         scene.run(**kwargs)
# 
#     @classmethod
#     def container_name(cls):
#         return cls.container_class().name()
# 
#     @classmethod
#     @abc.abstractmethod
#     def container_class(cls):
#         raise NotImplementedError
# 
#     def test(self, container, test_case):
#         logger.warning("skipping test for %s" % self.__class__.__name__)


# Path: alvi/tests/resources/client/local_python_client/scenes/array/create_node.py
from alvi.client.containers import Array
from alvi.client.scenes.base import Scene



class ArrayCreateNode(Scene):
    def run(self, **kwargs):
        data_generator = kwargs['data_generator']
        array = kwargs['container']
        array.init(data_generator.quantity())
        for i, value in enumerate(data_generator.values):
            array[i] = value
        array.sync()

    @classmethod
    def container_class(cls):

        return Array