Skip to content

Commit d8d9d1b

Browse files
committed
Apply black
1 parent 63a33af commit d8d9d1b

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

src/hmi_picovoice/server.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,33 @@
1212

1313

1414
class Server(AbstractHMIServer):
15-
def __init__(self, name: str, context_url: str, require_endpoint: bool, rate: float):
15+
def __init__(
16+
self, name: str, context_url: str, require_endpoint: bool, rate: float
17+
):
1618
super(Server, self).__init__(name)
1719

1820
self._context_url = context_url
1921
self._require_endpoint = require_endpoint
2022
self._rate = rate
2123

22-
self._intent_client = actionlib.SimpleActionClient("get_intent", GetIntentAction)
24+
self._intent_client = actionlib.SimpleActionClient(
25+
"get_intent", GetIntentAction
26+
)
2327
rospy.loginfo(f"Waiting for {self._intent_client.action_client.ns} ..")
2428
self._intent_client.wait_for_server()
2529

26-
rospy.loginfo(f"Server initialized (context_url={context_url}, require_endpoint={require_endpoint})")
30+
rospy.loginfo(
31+
f"Server initialized (context_url={context_url}, require_endpoint={require_endpoint})"
32+
)
2733

2834
def _determine_answer(self, description, grammar, target, is_preempt_requested):
29-
self._intent_client.send_goal(GetIntentGoal(
30-
context_url=self._context_url,
31-
require_endpoint=self._require_endpoint,
32-
intents=[grammar]
33-
))
35+
self._intent_client.send_goal(
36+
GetIntentGoal(
37+
context_url=self._context_url,
38+
require_endpoint=self._require_endpoint,
39+
intents=[grammar],
40+
)
41+
)
3442

3543
r = rospy.Rate(self._rate)
3644
while not rospy.is_shutdown():
@@ -41,9 +49,13 @@ def _determine_answer(self, description, grammar, target, is_preempt_requested):
4149

4250
result = self._intent_client.get_result()
4351
if result is not None:
44-
return HMIResult(
45-
semantics={kv.key: kv.value for kv in result.slots},
46-
sentence=result.intent
47-
) if result.is_understood else None
52+
return (
53+
HMIResult(
54+
semantics={kv.key: kv.value for kv in result.slots},
55+
sentence=result.intent,
56+
)
57+
if result.is_understood
58+
else None
59+
)
4860

4961
r.sleep()

0 commit comments

Comments
 (0)