Skip to content

Commit 6996788

Browse files
I do love my specifications-based terminological pedantry.
1 parent 5a9598c commit 6996788

File tree

1 file changed

+4
-4
lines changed
  • robot-server/robot_server/service/notifications

1 file changed

+4
-4
lines changed

robot-server/robot_server/service/notifications/topics.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
_TOPIC_BASE = TopicName("robot-server")
1919

2020

21-
def _is_valid_topic_name_segment(segment: str) -> bool:
22-
"""Return whether a string is valid as a segment in an MQTT topic name."""
23-
return not re.match("[/#+]", segment)
21+
def _is_valid_topic_name_level(level: str) -> bool:
22+
"""Return whether a string is valid as a level (segment) in an MQTT topic name."""
23+
return not re.match("[/#+]", level)
2424

2525

2626
MAINTENANCE_RUNS_CURRENT_RUN = TopicName(f"{_TOPIC_BASE}/maintenance_runs/current_run")
@@ -35,7 +35,7 @@ def _is_valid_topic_name_segment(segment: str) -> bool:
3535
def client_data(key: str) -> TopicName:
3636
"""Return the dynamic MQTT topic name for the given clientData key."""
3737
base = f"{_TOPIC_BASE}/clientData"
38-
if _is_valid_topic_name_segment(key):
38+
if _is_valid_topic_name_level(key):
3939
return TopicName(f"{base}/{key}")
4040
else:
4141
raise ValueError(

0 commit comments

Comments
 (0)