Skip to content

Commit 870cbd3

Browse files
authored
Merge pull request #142 from OpenVoiceOS/release-1.0.3a1
Release 1.0.3a1
2 parents 942f63c + ae54a4f commit 870cbd3

File tree

15 files changed

+18
-262
lines changed

15 files changed

+18
-262
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Changelog
22

3-
## [1.0.2a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/1.0.2a1) (2024-11-15)
3+
## [1.0.3a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/1.0.3a1) (2024-11-21)
44

5-
[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/1.0.1...1.0.2a1)
5+
[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/1.0.2...1.0.3a1)
66

77
**Merged pull requests:**
88

9-
- fix: image urls [\#138](https://github.com/OpenVoiceOS/ovos-bus-client/pull/138) ([JarbasAl](https://github.com/JarbasAl))
9+
- fix: remove dead code [\#141](https://github.com/OpenVoiceOS/ovos-bus-client/pull/141) ([JarbasAl](https://github.com/JarbasAl))
1010

1111

1212

ovos_bus_client/client/client.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,8 @@
1818
from ovos_bus_client.message import Message, CollectionMessage, GUIMessage
1919
from ovos_bus_client.session import SessionManager, Session
2020

21-
try:
22-
from mycroft_bus_client import MessageBusClient as _MessageBusClientBase
23-
except ImportError:
24-
# TODO - code in the wild does isinstance checks
25-
# this conditional subclassing should be removed ASAP, it is only here for the migration period
26-
# mycroft_bus_client is abandonware until further notice from MycroftAI
2721

28-
class _MessageBusClientBase:
29-
pass
30-
31-
32-
class MessageBusClient(_MessageBusClientBase):
22+
class MessageBusClient:
3323
"""The Mycroft Messagebus Client
3424
3525
The Messagebus client connects to the Mycroft messagebus service
@@ -435,22 +425,3 @@ def on_message(self, *args):
435425

436426
parsed_message = GUIMessage.deserialize(message)
437427
self.emitter.emit(parsed_message.msg_type, parsed_message)
438-
439-
440-
@deprecated("No direct replacement", "0.1.0")
441-
def echo():
442-
"""
443-
Echo function repeating all input from a user.
444-
"""
445-
446-
from ovos_bus_client.util import create_echo_function
447-
# TODO: Deprecate in 0.1.0
448-
message_bus_client = MessageBusClient()
449-
450-
def repeat_utterance(message):
451-
message.msg_type = 'speak'
452-
message_bus_client.emit(message)
453-
454-
message_bus_client.on('message', create_echo_function(None))
455-
message_bus_client.on('recognizer_loop:utterance', repeat_utterance)
456-
message_bus_client.run_forever()

ovos_bus_client/client/collector.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,8 @@
1616
from uuid import uuid4
1717
import time
1818

19-
try:
20-
from mycroft_bus_client.client.collector import MessageCollector as _MessageCollectorBase
21-
except ImportError:
22-
# TODO - code in the wild does isinstance checks
23-
# this conditional subclassing should be removed ASAP, it is only here for the migration period
24-
# mycroft_bus_client is abandonware until further notice from MycroftAI
2519

26-
class _MessageCollectorBase:
27-
pass
28-
29-
30-
class MessageCollector(_MessageCollectorBase):
20+
class MessageCollector:
3121
"""Collect multiple response.
3222
3323
This class encapsulates the logic for collecting messages from

ovos_bus_client/client/waiter.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,9 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212
#
13-
1413
from threading import Event
1514
from typing import List, Union
1615

17-
try:
18-
from mycroft_bus_client.client.waiter import MessageWaiter as _MessageWaiterBase
19-
except ImportError:
20-
# TODO - code in the wild does isinstance checks
21-
# this conditional subclassing should be removed ASAP, it is only here for the migration period
22-
# mycroft_bus_client is abandonware until further notice from MycroftAI
23-
24-
class _MessageWaiterBase:
25-
pass
26-
2716

2817
class MessageWaiter:
2918
"""Wait for a single message.

ovos_bus_client/message.py

Lines changed: 7 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -30,44 +30,8 @@
3030
from ovos_utils.security import encrypt, decrypt
3131
from ovos_config.config import Configuration
3232

33-
try:
34-
from lingua_franca.parse import normalize
35-
except ImportError:
36-
# optional LF import
37-
def normalize(text, *args, **kwargs):
38-
return text
3933

40-
try:
41-
from mycroft_bus_client.message import Message as _MsgBase, \
42-
CollectionMessage as _CollectionMsgBase
43-
44-
except ImportError:
45-
46-
# TODO - code in the wild does isinstance checks
47-
# this conditional subclassing should be removed ASAP, it is only here for the migration period
48-
# mycroft_bus_client is abandonware until further notice from MycroftAI
49-
50-
class _MsgBase:
51-
pass
52-
53-
54-
class _CollectionMsgBase(_MsgBase):
55-
pass
56-
57-
58-
class _MessageMeta(type):
59-
""" To override isinstance checks we need to use a metaclass """
60-
61-
def __instancecheck__(self, instance):
62-
try:
63-
from mycroft_bus_client.message import Message as _MycroftMessage
64-
return isinstance(instance, _MycroftMessage) or \
65-
super().__instancecheck__(instance)
66-
except:
67-
return super().__instancecheck__(instance)
68-
69-
70-
class Message(_MsgBase, metaclass=_MessageMeta):
34+
class Message:
7135
"""Holds and manipulates data sent over the websocket
7236
7337
Message objects will be used to send information back and forth
@@ -165,7 +129,7 @@ def _json_load(value):
165129
return obj
166130

167131
@staticmethod
168-
def deserialize(value: str) -> _MsgBase:
132+
def deserialize(value: str) -> 'Message':
169133
"""
170134
This takes a string and constructs a message object.
171135
@@ -186,7 +150,7 @@ def deserialize(value: str) -> _MsgBase:
186150
obj.get('data') or {},
187151
obj.get('context') or {})
188152

189-
def forward(self, msg_type: str, data: dict = None) -> _MsgBase:
153+
def forward(self, msg_type: str, data: dict = None) -> 'Message':
190154
"""
191155
Keep context and forward message
192156
@@ -204,8 +168,7 @@ def forward(self, msg_type: str, data: dict = None) -> _MsgBase:
204168
data = data or {}
205169
return Message(msg_type, data, context=self.context)
206170

207-
def reply(self, msg_type: str, data: dict = None,
208-
context: dict = None) -> _MsgBase:
171+
def reply(self, msg_type: str, data: dict = None, context: dict = None) -> 'Message':
209172
"""
210173
Construct a reply message for a given message
211174
@@ -240,7 +203,7 @@ def reply(self, msg_type: str, data: dict = None,
240203
new_context['source'] = s
241204
return Message(msg_type, data, context=new_context)
242205

243-
def response(self, data: dict = None, context: dict = None) -> _MsgBase:
206+
def response(self, data: dict = None, context: dict = None) -> 'Message':
244207
"""
245208
Construct a response message for the message
246209
@@ -255,8 +218,7 @@ def response(self, data: dict = None, context: dict = None) -> _MsgBase:
255218
"""
256219
return self.reply(self.msg_type + '.response', data, context)
257220

258-
def publish(self, msg_type: str, data: dict,
259-
context: dict = None) -> _MsgBase:
221+
def publish(self, msg_type: str, data: dict, context: dict = None) -> 'Message':
260222
"""
261223
Copy the original context and add passed in context. Delete
262224
any target in the new context. Return a new message object with
@@ -280,27 +242,6 @@ def publish(self, msg_type: str, data: dict,
280242

281243
return Message(msg_type, data, context=new_context)
282244

283-
@deprecated("This method is deprecated with no replacement", "0.1.0")
284-
def utterance_remainder(self):
285-
"""
286-
DEPRECATED - mycroft-core hack, used by some skills in the wild
287-
288-
For intents get the portion not consumed by Adapt.
289-
290-
For example: if they say 'Turn on the family room light' and there are
291-
entity matches for "turn on" and "light", then it will leave behind
292-
" the family room " which is then normalized to "family room".
293-
294-
Returns:
295-
str: Leftover words or None if not an utterance.
296-
"""
297-
utt = normalize(self.data.get("utterance", ""))
298-
if utt and "__tags__" in self.data:
299-
for token in self.data["__tags__"]:
300-
# Substitute only whole words matching the token
301-
utt = re.sub(r'\b' + token.get("key", "") + r"\b", "", utt)
302-
return normalize(utt)
303-
304245

305246
def encrypt_as_dict(key: str, data: str, nonce=None) -> dict:
306247
ciphertext, tag, nonce = encrypt(key, data, nonce=nonce)
@@ -340,7 +281,7 @@ def dig_for_message(max_records: int = 10) -> Optional[Message]:
340281
return None
341282

342283

343-
class CollectionMessage(Message, _CollectionMsgBase):
284+
class CollectionMessage(Message):
344285
"""Extension of the Message class for use with collect handlers.
345286
346287
The class provides the convenience methods success and failure to report

ovos_bus_client/util/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from ovos_bus_client.message import dig_for_message, Message
2626
from ovos_bus_client.session import SessionManager
2727
from ovos_bus_client.util.scheduler import EventScheduler
28-
from ovos_bus_client.util.utils import create_echo_function
28+
2929

3030
_DEFAULT_WS_CONFIG = {"host": "0.0.0.0",
3131
"port": 8181,

ovos_bus_client/util/scheduler.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030

3131
from ovos_config.config import Configuration
3232
from ovos_config.locations import get_xdg_data_save_path, get_xdg_config_save_path
33-
from ovos_utils.log import LOG, log_deprecation
34-
from ovos_utils.events import EventContainer as _EventContainer
35-
from ovos_utils.events import EventSchedulerInterface as _SchedulerInterface
33+
from ovos_utils.log import LOG
34+
from ovos_utils.events import EventContainer, EventSchedulerInterface
3635
from ovos_bus_client.message import Message
3736

3837

@@ -349,14 +348,3 @@ def shutdown(self):
349348
self.store()
350349
raise e
351350

352-
353-
class EventContainer(_EventContainer):
354-
def __init__(self, *args, **kwargs):
355-
log_deprecation("Import from `ovos_utils.events`", "0.1.0")
356-
_EventContainer.__init__(self, *args, **kwargs)
357-
358-
359-
class EventSchedulerInterface(_SchedulerInterface):
360-
def __init__(self, *args, **kwargs):
361-
log_deprecation("Import from `ovos_utils.events`", "0.1.0")
362-
_SchedulerInterface.__init__(self, *args, **kwargs)

ovos_bus_client/util/utils.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

ovos_bus_client/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# START_VERSION_BLOCK
22
VERSION_MAJOR = 1
33
VERSION_MINOR = 0
4-
VERSION_BUILD = 2
5-
VERSION_ALPHA = 0
4+
VERSION_BUILD = 3
5+
VERSION_ALPHA = 1
66
# END_VERSION_BLOCK

test/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
pytest
22
pytest-cov
3-
mycroft-messagebus-client

0 commit comments

Comments
 (0)