From 0ec7ea5451161f20ea8b29d8f50086678ea41b2a Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 3 Nov 2024 20:39:20 -0600 Subject: [PATCH 1/4] chore: update docstrings and type hints (#291) * chore: update docstrings and type hints closes #242 closes #243 * Update skills.py --- ovos_utils/skills.py | 10 +++++++++- ovos_utils/system.py | 28 +++++----------------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/ovos_utils/skills.py b/ovos_utils/skills.py index d38e041e..51b34087 100644 --- a/ovos_utils/skills.py +++ b/ovos_utils/skills.py @@ -26,7 +26,15 @@ def check_class(cls): return set(check_class(obj.__class__)) -def skills_loaded(bus=None): +def skills_loaded(bus=None) -> bool: + """ + Await a reply from mycroft.skills.all_loaded to check if all skills are + loaded. + @param bus: OVOS messagebus client + @return: Are all skills loaded? True/False + """ + if bus is None: + return False reply = wait_for_reply('mycroft.skills.all_loaded', 'mycroft.skills.all_loaded.response', bus=bus) diff --git a/ovos_utils/system.py b/ovos_utils/system.py index 88b9a3a2..959ebfd8 100644 --- a/ovos_utils/system.py +++ b/ovos_utils/system.py @@ -7,7 +7,11 @@ from ovos_utils.log import LOG, deprecated -def is_running_from_module(module_name): +def is_running_from_module(module_name: str) -> bool: + """ + Check and see if the code is being run from a specific module + @param module_name: name of the module to check for + """ # Stack: # [0] - _log() # [1] - debug(), info(), warning(), or error() @@ -91,28 +95,6 @@ def restart_mycroft_service(sudo=True, user=False): """ restart_service("mycroft.service", sudo=sudo, user=user) -def is_running_from_module(module_name): - # Stack: - # [0] - _log() - # [1] - debug(), info(), warning(), or error() - # [2] - caller - stack = inspect.stack() - - # Record: - # [0] - frame object - # [1] - filename - # [2] - line number - # [3] - function - # ... - for record in stack[2:]: - mod = inspect.getmodule(record[0]) - name = mod.__name__ if mod else '' - # module name in file path of caller - # or import name matches module name - if f"/{module_name}/" in record[1] or \ - name.startswith(module_name.replace("-", "_").replace(" ", "_")): - return True - return False def restart_service(service_name, sudo=True, user=False): """ From 05dab28eac82e39083fd6d1d36520476dc8cbef0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:52:22 +0000 Subject: [PATCH 2/4] Update ovos-workshop requirement from <2.0.0,>=0.0.13 to >=0.0.13,<3.0.0 in /requirements (#292) Updates the requirements on [ovos-workshop](https://github.com/OpenVoiceOS/OVOS-workshop) to permit the latest version. - [Release notes](https://github.com/OpenVoiceOS/OVOS-workshop/releases) - [Changelog](https://github.com/OpenVoiceOS/OVOS-workshop/blob/dev/CHANGELOG.md) - [Commits](https://github.com/OpenVoiceOS/OVOS-workshop/compare/0.0.14a1...2.0.0) --- updated-dependencies: - dependency-name: ovos-workshop dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/extras.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/extras.txt b/requirements/extras.txt index 85a9ed9a..50c564cd 100644 --- a/requirements/extras.txt +++ b/requirements/extras.txt @@ -1,5 +1,5 @@ rapidfuzz>=3.6,<4.0 ovos-plugin-manager>=0.0.25,<1.0.0 ovos-config>=0.0.12,<1.0.0 -ovos-workshop>=0.0.13,<2.0.0 +ovos-workshop>=0.0.13,<3.0.0 ovos_bus_client>=0.0.8,<1.0.0 From e52ba0d01b99210cd8e3a9800a2ea10a0ab83af4 Mon Sep 17 00:00:00 2001 From: JarbasAl Date: Mon, 4 Nov 2024 15:52:37 +0000 Subject: [PATCH 3/4] Increment Version to 0.3.7a1 --- ovos_utils/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ovos_utils/version.py b/ovos_utils/version.py index 8ddb69f0..844ba083 100644 --- a/ovos_utils/version.py +++ b/ovos_utils/version.py @@ -1,6 +1,6 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 3 -VERSION_BUILD = 6 -VERSION_ALPHA = 0 +VERSION_BUILD = 7 +VERSION_ALPHA = 1 # END_VERSION_BLOCK From 573cb154ab65f2f6390b7377b4376aced118653e Mon Sep 17 00:00:00 2001 From: JarbasAl Date: Mon, 4 Nov 2024 15:53:04 +0000 Subject: [PATCH 4/4] Update Changelog --- CHANGELOG.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a88952aa..b0595c46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,23 @@ # Changelog -## [0.3.6a1](https://github.com/OpenVoiceOS/ovos-utils/tree/0.3.6a1) (2024-10-21) +## [0.3.7a1](https://github.com/OpenVoiceOS/ovos-utils/tree/0.3.7a1) (2024-11-04) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-utils/compare/0.3.5...0.3.6a1) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-utils/compare/0.3.6...0.3.7a1) + +**Fixed bugs:** + +- Should be 0.1.0; is there a bug in the version automation? [\#244](https://github.com/OpenVoiceOS/ovos-utils/issues/244) + +**Closed issues:** + +- system.py - Added method should get a docstring and type annotation [\#243](https://github.com/OpenVoiceOS/ovos-utils/issues/243) +- skills.py - This should get type annotations and a docstring [\#242](https://github.com/OpenVoiceOS/ovos-utils/issues/242) +- setup.py - This should be updated to an absolute path for automations [\#240](https://github.com/OpenVoiceOS/ovos-utils/issues/240) **Merged pull requests:** -- Update ovos-workshop requirement from \<1.0.0,\>=0.0.13 to \>=0.0.13,\<2.0.0 in /requirements [\#289](https://github.com/OpenVoiceOS/ovos-utils/pull/289) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Update ovos-workshop requirement from \<2.0.0,\>=0.0.13 to \>=0.0.13,\<3.0.0 in /requirements [\#292](https://github.com/OpenVoiceOS/ovos-utils/pull/292) ([dependabot[bot]](https://github.com/apps/dependabot)) +- chore: update docstrings and type hints [\#291](https://github.com/OpenVoiceOS/ovos-utils/pull/291) ([mikejgray](https://github.com/mikejgray))