Skip to content

Commit

Permalink
fix docs for new magic command decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
giannisdoukas committed Jul 8, 2020
1 parent b1e4d39 commit 6564cb5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Inside the directory, we create the following file `hello.py`.
from cwlkernel.CWLKernel import CWLKernel
@CWLKernel.register_magic
@CWLKernel.register_magic()
def hello(kernel: CWLKernel, argument_string: str):
kernel.send_response(
kernel.iopub_socket,
Expand All @@ -76,7 +76,7 @@ example, the aforementioned example could be changed to:
from cwlkernel.CWLKernel import CWLKernel
import argparse
@CWLKernel.register_magic
@CWLKernel.register_magic()
def hello(kernel: CWLKernel, argument_string: str):
parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -174,7 +174,7 @@ an empty graph and visualise the empty image.
.. code-block:: python
@staticmethod
@CWLKernel.register_magic
@CWLKernel.register_magic()
def bind_view(kernel: CWLKernel, arg: str):
BindGraph.G = nx.Graph()
image = BindGraph.get_image()
Expand Down Expand Up @@ -205,15 +205,15 @@ to inform him.
.. code-block:: python
@staticmethod
@CWLKernel.register_magic
@CWLKernel.register_magic()
def add_node(kernel: CWLKernel, arg: str):
BindGraph.G.add_node(arg)
image = BindGraph.get_image()
BindGraph.display_image(kernel, image, update=True)
kernel.send_text_to_stdout('Done!\n')
@staticmethod
@CWLKernel.register_magic
@CWLKernel.register_magic()
def add_edge(kernel: CWLKernel, arg: str):
edges = arg.split()
BindGraph.G.add_edge(*edges)
Expand Down Expand Up @@ -259,15 +259,15 @@ Finally, the full code will look like that:
)
@staticmethod
@CWLKernel.register_magic
@CWLKernel.register_magic()
def add_node(kernel: CWLKernel, arg: str):
BindGraph.G.add_node(arg)
image = BindGraph.get_image()
BindGraph.display_image(kernel, image, update=True)
kernel.send_text_to_stdout('Done!\n')
@staticmethod
@CWLKernel.register_magic
@CWLKernel.register_magic()
def add_edge(kernel: CWLKernel, arg: str):
edges = arg.split()
BindGraph.G.add_edge(*edges)
Expand All @@ -287,7 +287,7 @@ Finally, the full code will look like that:
return image
@staticmethod
@CWLKernel.register_magic
@CWLKernel.register_magic()
def bind_view(kernel: CWLKernel, arg: str):
BindGraph.G = nx.Graph()
image = BindGraph.get_image()
Expand Down

0 comments on commit 6564cb5

Please sign in to comment.