Skip to content

Commit 43f299d

Browse files
committed
[Python 3] Format
1 parent df0aeb6 commit 43f299d

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

src/dynamic_graph/ros/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
from ros_publish import RosPublish
2-
from ros_subscribe import RosSubscribe
3-
4-
# aliases, for retro compatibility
1+
# flake8: noqa
52
from ros import RosPublish as RosImport
63
from ros import RosSubscribe as RosExport
74

8-
5+
from ros_publish import RosPublish
6+
from ros_subscribe import RosSubscribe

src/dynamic_graph/ros/dgcompleter.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,36 @@
3535
3636
"""
3737

38-
import __builtin__
39-
import __main__
4038
import ast
4139

4240
__all__ = ["DGCompleter"]
4341

42+
4443
class DGCompleter:
4544
def __init__(self, client):
4645
"""Create a new completer for the command line.
4746
4847
Completer([client]) -> completer instance.
49-
48+
5049
Client is a ROS proxy to dynamic_graph run_command service.
5150
5251
Completer instances should be used as the completion mechanism of
5352
readline via the set_completer() call:
5453
5554
readline.set_completer(Completer(client).complete)
5655
"""
57-
self.client=client
58-
astr="import readline"
56+
self.client = client
57+
astr = "import readline"
5958
self.client(astr)
60-
astr="from rlcompleter import Completer"
59+
astr = "from rlcompleter import Completer"
6160
self.client(astr)
62-
astr="aCompleter=Completer()"
61+
astr = "aCompleter=Completer()"
6362
self.client(astr)
64-
astr="readline.set_completer(aCompleter.complete)"
63+
astr = "readline.set_completer(aCompleter.complete)"
6564
self.client(astr)
66-
astr="readline.parse_and_bind(\"tab: complete\")"
65+
astr = "readline.parse_and_bind(\"tab: complete\")"
6766
self.client(astr)
68-
67+
6968
def complete(self, text, state):
7069
"""Return the next possible completion for 'text'. readline.parse_and_bind("tab: complete")
7170
@@ -74,14 +73,7 @@ def complete(self, text, state):
7473
returns None. The completion should begin with 'text'.
7574
7675
"""
77-
astr="aCompleter.complete(\""+text+"\","+str(state)+")"
78-
response=self.client(astr);
79-
res2=ast.literal_eval(response.result)
76+
astr = "aCompleter.complete(\"" + text + "\"," + str(state) + ")"
77+
response = self.client(astr)
78+
res2 = ast.literal_eval(response.result)
8079
return res2
81-
82-
83-
84-
85-
86-
87-

src/dynamic_graph/ros/ros.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from ros_subscribe import RosSubscribe
33
from ros_time import RosTime
44

5-
from dynamic_graph import plug
65

76
class Ros(object):
87
device = None
@@ -13,15 +12,14 @@ class Ros(object):
1312
rosImport = None
1413
rosExport = None
1514

16-
def __init__(self, robot, suffix = ''):
15+
def __init__(self, robot, suffix=''):
1716
self.robot = robot
1817
self.rosPublish = RosPublish('rosPublish{0}'.format(suffix))
1918
self.rosSubscribe = RosSubscribe('rosSubscribe{0}'.format(suffix))
20-
self.rosTime = RosTime ('rosTime{0}'.format(suffix))
19+
self.rosTime = RosTime('rosTime{0}'.format(suffix))
2120

22-
self.robot.device.after.addSignal(
23-
'{0}.trigger'.format(self.rosPublish.name))
21+
self.robot.device.after.addSignal('{0}.trigger'.format(self.rosPublish.name))
2422

2523
# aliases, for retro compatibility
26-
self.rosImport=self.rosPublish
27-
self.rosExport=self.rosSubscribe
24+
self.rosImport = self.rosPublish
25+
self.rosExport = self.rosSubscribe

tests/test_import.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

33
from dynamic_graph.ros import RosImport
44

@@ -9,7 +9,19 @@
99
ri.add('matrix', 'matrixS', 'matrixT')
1010

1111
ri.doubleS.value = 42.
12-
ri.vectorS.value = (42., 42.,)
13-
ri.matrixS.value = ((42., 42.,),(42., 42.,),)
12+
ri.vectorS.value = (
13+
42.,
14+
42.,
15+
)
16+
ri.matrixS.value = (
17+
(
18+
42.,
19+
42.,
20+
),
21+
(
22+
42.,
23+
42.,
24+
),
25+
)
1426

1527
ri.trigger.recompute(ri.trigger.time + 1)

0 commit comments

Comments
 (0)