Code snippets for page Node ExtensionsΒΆ
Download extensions.py
.
Browse the code snippet index.
# -*- coding: utf-8 -*-
# Generated by codesnippet sphinx extension on 2020-12-16
import mdp
import numpy as np
np.random.seed(0)
mdp.activate_extension("parallel")
mdp.deactivate_extension("parallel")
with mdp.extension("parallel"):
pass
@mdp.with_extension("parallel")
def f():
pass
class ParallelSFANode(mdp.parallel.ParallelExtensionNode,
mdp.nodes.SFANode):
def _fork(self):
# implement the forking for SFANode
return ...
def _join(self):
# implement the joining for SFANode
return ...
@mdp.extension_method("parallel", mdp.nodes.SFANode)
def _fork(self):
return ...
class HTMLExtensionNode(mdp.ExtensionNode, mdp.Node):
"""Extension node for HTML representations of individual nodes."""
extension_name = "html2"
def html_representation(self):
pass
def _html_representation(self):
pass
class TestExtensionNode(mdp.ExtensionNode):
extension_name = "test"
def _execute(self):
return 0
class TestNode(mdp.Node):
def _execute(self):
return 1
class ExtendedTestNode(TestExtensionNode, TestNode):
pass
is_extension_active = False
@mdp.extension_setup("test")
def _test_extension_setup():
global is_extension_active
is_extension_active = True
@mdp.extension_teardown("test")
def _test_extension_teardown():
global is_extension_active
is_extension_active = False