Skip to content
Snippets Groups Projects
Commit 43f299d8 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[Python 3] Format

parent df0aeb6d
No related branches found
No related tags found
No related merge requests found
from ros_publish import RosPublish
from ros_subscribe import RosSubscribe
# aliases, for retro compatibility
# flake8: noqa
from ros import RosPublish as RosImport
from ros import RosSubscribe as RosExport
from ros_publish import RosPublish
from ros_subscribe import RosSubscribe
......@@ -35,18 +35,17 @@ its input.
"""
import __builtin__
import __main__
import ast
__all__ = ["DGCompleter"]
class DGCompleter:
def __init__(self, client):
"""Create a new completer for the command line.
Completer([client]) -> completer instance.
Client is a ROS proxy to dynamic_graph run_command service.
Completer instances should be used as the completion mechanism of
......@@ -54,18 +53,18 @@ class DGCompleter:
readline.set_completer(Completer(client).complete)
"""
self.client=client
astr="import readline"
self.client = client
astr = "import readline"
self.client(astr)
astr="from rlcompleter import Completer"
astr = "from rlcompleter import Completer"
self.client(astr)
astr="aCompleter=Completer()"
astr = "aCompleter=Completer()"
self.client(astr)
astr="readline.set_completer(aCompleter.complete)"
astr = "readline.set_completer(aCompleter.complete)"
self.client(astr)
astr="readline.parse_and_bind(\"tab: complete\")"
astr = "readline.parse_and_bind(\"tab: complete\")"
self.client(astr)
def complete(self, text, state):
"""Return the next possible completion for 'text'. readline.parse_and_bind("tab: complete")
......@@ -74,14 +73,7 @@ class DGCompleter:
returns None. The completion should begin with 'text'.
"""
astr="aCompleter.complete(\""+text+"\","+str(state)+")"
response=self.client(astr);
res2=ast.literal_eval(response.result)
astr = "aCompleter.complete(\"" + text + "\"," + str(state) + ")"
response = self.client(astr)
res2 = ast.literal_eval(response.result)
return res2
......@@ -2,7 +2,6 @@ from ros_publish import RosPublish
from ros_subscribe import RosSubscribe
from ros_time import RosTime
from dynamic_graph import plug
class Ros(object):
device = None
......@@ -13,15 +12,14 @@ class Ros(object):
rosImport = None
rosExport = None
def __init__(self, robot, suffix = ''):
def __init__(self, robot, suffix=''):
self.robot = robot
self.rosPublish = RosPublish('rosPublish{0}'.format(suffix))
self.rosSubscribe = RosSubscribe('rosSubscribe{0}'.format(suffix))
self.rosTime = RosTime ('rosTime{0}'.format(suffix))
self.rosTime = RosTime('rosTime{0}'.format(suffix))
self.robot.device.after.addSignal(
'{0}.trigger'.format(self.rosPublish.name))
self.robot.device.after.addSignal('{0}.trigger'.format(self.rosPublish.name))
# aliases, for retro compatibility
self.rosImport=self.rosPublish
self.rosExport=self.rosSubscribe
self.rosImport = self.rosPublish
self.rosExport = self.rosSubscribe
#!/usr/bin/python
#!/usr/bin/env python
from dynamic_graph.ros import RosImport
......@@ -9,7 +9,19 @@ ri.add('vector', 'vectorS', 'vectorT')
ri.add('matrix', 'matrixS', 'matrixT')
ri.doubleS.value = 42.
ri.vectorS.value = (42., 42.,)
ri.matrixS.value = ((42., 42.,),(42., 42.,),)
ri.vectorS.value = (
42.,
42.,
)
ri.matrixS.value = (
(
42.,
42.,
),
(
42.,
42.,
),
)
ri.trigger.recompute(ri.trigger.time + 1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment