-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update controllers to work with Map based function calls
- Loading branch information
Showing
6 changed files
with
35 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
import numpy as np | ||
|
||
|
||
class CounterController(Controller): | ||
|
||
def create_attributes(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
from malcolm.core.controller import Controller | ||
from malcolm.core.method import Method, takes, returns | ||
from malcolm.core.method import takes, returns | ||
from malcolm.core.mapmeta import REQUIRED | ||
from malcolm.core.stringmeta import StringMeta | ||
|
||
|
||
class HelloController(Controller): | ||
@takes(StringMeta("name", "a name"), REQUIRED) | ||
@returns(StringMeta("greeting", "a greeting"), REQUIRED) | ||
def say_hello(self, args): | ||
def say_hello(self, parameters, return_map): | ||
"""Says Hello to name | ||
Args: | ||
name (str): The name of the person to say hello to | ||
parameters(Map): The name of the person to say hello to | ||
return_map(Map): Return structure to complete and return | ||
Returns: | ||
str: The greeting | ||
Map: The greeting | ||
""" | ||
return dict(greeting="Hello %s" % args["name"]) | ||
|
||
return_map.greeting = "Hello %s" % parameters.name | ||
return return_map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters