-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fb9bc7
commit 76be163
Showing
3 changed files
with
30 additions
and
56 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
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,17 +1,19 @@ | ||
from importlib import import_module | ||
from typing import Any, Callable, Dict | ||
|
||
import rospy | ||
from rosbridge_library.internal import message_conversion | ||
|
||
|
||
def lookup_object(object_path, package='mqtt_bridge'): | ||
def lookup_object(object_path: str, package: str='mqtt_bridge') -> Any: | ||
""" lookup object from a some.module:object_name specification. """ | ||
module_name, obj_name = object_path.split(":") | ||
module = import_module(module_name, package) | ||
obj = getattr(module, obj_name) | ||
return obj | ||
|
||
extract_values = message_conversion.extract_values | ||
populate_instance = message_conversion.populate_instance | ||
|
||
extract_values = message_conversion.extract_values # type: Callable[[rospy.Message], Dict] | ||
populate_instance = message_conversion.populate_instance # type: Callable[[Dict, rospy.Message], rospy.Message] | ||
|
||
|
||
__all__ = ['lookup_object', 'extract_values', 'populate_instance'] |