Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/remove_broken_patch #107

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions ovos_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ class Configuration(dict):
_callbacks = []

def __init__(self):
# python does not support proper overloading
# when instantiation a Configuration object (new style)
# the get method is replaced for proper dict behaviour
self.get = self._real_get
super().__init__(**self.load_all_configs())

# dict methods
Expand Down Expand Up @@ -378,17 +374,6 @@ def patch_clear(message):
Configuration.__patch = {}

# Backwards compat methods
@staticmethod
def get(configs=None, cache=True, remote=True):
"""DEPRECATED - use Configuration class instead"""
LOG.warning("Configuration.get() has been deprecated, use Configuration() instead")
# NOTE: this is only called if using the class directly
# if using an instance (dict object) self._real_get is called instead
return Configuration.load_config_stack(configs, cache, remote)

def _real_get(self, key, default=None):
return self.__getitem__(key) or default

@staticmethod
def clear_cache(message=None):
"""DEPRECATED - there is no cache anymore """
Expand Down
9 changes: 0 additions & 9 deletions test/unittests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ def tearDown(self):
Configuration.load_config_stack([{}], True)
Configuration._callbacks = []

def test_get(self):
from ovos_config.config import Configuration
d1 = {'a': 1, 'b': {'c': 1, 'd': 2}}
d2 = {'b': {'d': 'changed'}}
d = Configuration.get([d1, d2])
self.assertEqual(d['a'], d1['a'])
self.assertEqual(d['b']['d'], d2['b']['d'])
self.assertEqual(d['b']['c'], d1['b']['c'])

@patch('mycroft.api.DeviceApi')
@skip("requires backend to be enabled, TODO refactor test!")
def test_remote(self, mock_api):
Expand Down
Loading