Skip to content

Commit

Permalink
Address Feedback for 0.0.32 Release (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Apr 18, 2023
1 parent a0ce781 commit a481a23
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 83 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/publish_AUR.yml

This file was deleted.

4 changes: 3 additions & 1 deletion ovos_utils/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def load_dialogs(dialog_dir: str,
def get_dialog(phrase: str, lang: str = None,
context: Optional[dict] = None) -> str:
"""
Looks up a resource file for the given phrase.
Looks up a resource file for the given phrase in the specified language.
If no file is found, the requested phrase is returned as the string. This
will use the default language for translations.
Expand All @@ -150,6 +150,8 @@ def get_dialog(phrase: str, lang: str = None,
"""

if not lang:
LOG.warning(f"Expected a string lang and got None. This config"
f"fallback behavior will be deprecated in a future release")
try:
from ovos_config.config import read_mycroft_config
conf = read_mycroft_config()
Expand Down
2 changes: 1 addition & 1 deletion ovos_utils/enclosure/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ovos_utils.messagebus import Message
from ovos_utils.messagebus import FakeMessage as Message


class EnclosureAPI:
Expand Down
2 changes: 1 addition & 1 deletion ovos_utils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ovos_utils.intents.intent_service_interface import to_alnum
from ovos_utils.log import LOG
from ovos_utils.messagebus import Message, FakeBus
from ovos_utils.messagebus import FakeBus, FakeMessage as Message


def unmunge_message(message: Message, skill_id: str) -> Message:
Expand Down
4 changes: 3 additions & 1 deletion ovos_utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def resolve_ovos_resource_file(res_name: str) -> Optional[str]:


def resolve_resource_file(res_name: str, root_path: Optional[str] = None,
config: Optional[dict] = None) -> Optional[str]:
config: dict = None) -> Optional[str]:
"""
Convert a resource into an absolute filename.
Expand Down Expand Up @@ -115,6 +115,8 @@ def resolve_resource_file(res_name: str, root_path: Optional[str] = None,
str: path to resource or None if no resource found
"""
if config is None:
LOG.warning(f"Expected a dict config and got None. This config"
f"fallback behavior will be deprecated in a future release")
try:
from ovos_config.config import read_mycroft_config
config = read_mycroft_config()
Expand Down
32 changes: 32 additions & 0 deletions ovos_utils/fingerprinting.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ class MycroftPlatform(str, Enum):


def detect_platform():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
return max(((k, v) for k, v in classify_fingerprint().items()),
key=lambda k: k[1])[0]


def get_config_fingerprint(config=None):
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
if not config:
try:
from ovos_config.config import read_mycroft_config
Expand All @@ -51,6 +55,8 @@ def get_config_fingerprint(config=None):


def get_platform_fingerprint():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
return {
"hostname": socket.gethostname(),
"platform": platform.platform(),
Expand Down Expand Up @@ -78,16 +84,22 @@ def get_platform_fingerprint():


def get_fingerprint():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
finger = get_platform_fingerprint()
finger["configuration"] = get_config_fingerprint()
return finger


def core_supports_xdg():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
return True # no longer optional


def get_mycroft_version():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
try: # ovos
from mycroft.version import OVOS_VERSION_STR
return OVOS_VERSION_STR
Expand Down Expand Up @@ -128,6 +140,8 @@ def get_mycroft_version():


def is_chatterbox_core():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
try:
import chatterbox
return True
Expand All @@ -136,6 +150,8 @@ def is_chatterbox_core():


def is_neon_core():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
try:
import neon_core
return True
Expand All @@ -144,6 +160,8 @@ def is_neon_core():


def is_mycroft_core():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
try:
import mycroft
return True
Expand All @@ -152,22 +170,32 @@ def is_mycroft_core():


def is_vanilla_mycroft_core():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
return is_mycroft_core() and not is_ovos()


def is_holmes():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
return "HolmesV" in (get_mycroft_version() or "") or is_mycroft_lib()


def is_mycroft_lib():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
return "mycroft-lib" in (get_mycroft_version() or "")


def is_ovos():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
return is_running_from_module("ovos-core")


def classify_platform_print(fingerprint=None):
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
fingerprint = fingerprint or get_platform_fingerprint()
# key, val pairs that indicate a certain platform
fingerprints = {
Expand Down Expand Up @@ -327,6 +355,8 @@ def classify_platform_print(fingerprint=None):


def classify_config_print(fingerprint=None):
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
fingerprint = fingerprint or get_config_fingerprint()

# key, val pairs that indicate a certain platform
Expand Down Expand Up @@ -447,6 +477,8 @@ def classify_config_print(fingerprint=None):


def classify_fingerprint():
LOG.warning("fingerprinting utils are deprecated. This submodule "
"will be removed in ovos_utils 0.1.0")
plat = classify_platform_print()
conf = classify_config_print()
for k, v in conf.items():
Expand Down
3 changes: 3 additions & 0 deletions ovos_utils/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ class GUIInterface:

def __init__(self, skill_id, bus=None, remote_server=None, config=None):
if not config:
LOG.warning(f"Expected a dict config and got None. This config"
f"fallback behavior will be deprecated in a future "
f"release")
try:
from ovos_config.config import read_mycroft_config
config = read_mycroft_config().get("gui", {})
Expand Down
2 changes: 1 addition & 1 deletion ovos_utils/intents/converse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from ovos_utils.intents.intent_service_interface import IntentQueryApi
from ovos_utils.log import LOG
from ovos_utils.messagebus import Message
from ovos_utils.messagebus import FakeMessage as Message


class ConverseTracker:
Expand Down
2 changes: 1 addition & 1 deletion ovos_utils/intents/layers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ovos_utils.messagebus import Message, get_mycroft_bus
from ovos_utils.messagebus import get_mycroft_bus, FakeMessage as Message
from ovos_utils.log import LOG
from time import sleep

Expand Down
9 changes: 6 additions & 3 deletions ovos_utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,12 @@ def init_service_logger(service_name):
# this is makes all logs from this service be configured to write to service_name.log file
# if this is not called in every __main__.py entrypoint logs will be written
# to a generic OVOS.log file shared across all services
from ovos_config.config import read_mycroft_config

_cfg = read_mycroft_config()
try:
from ovos_config.config import read_mycroft_config
_cfg = read_mycroft_config()
except ImportError:
LOG.warning("ovos_config not available. Falling back to defaults")
_cfg = dict()
_log_level = _cfg.get("log_level", "INFO")
_logs_conf = _cfg.get("logs") or {}
_logs_conf["level"] = _log_level
Expand Down
Loading

0 comments on commit a481a23

Please sign in to comment.