diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index b18d89c..3d46395 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = '8.0.145' +__version__ = '8.0.146' from ultralytics.hub import start from ultralytics.models import RTDETR, SAM, YOLO diff --git a/ultralytics/cfg/__init__.py b/ultralytics/cfg/__init__.py index 05797e7..87b9195 100644 --- a/ultralytics/cfg/__init__.py +++ b/ultralytics/cfg/__init__.py @@ -253,7 +253,7 @@ def handle_yolo_settings(args: List[str]) -> None: SETTINGS_YAML.unlink() # delete the settings file SETTINGS.reset() # create new settings LOGGER.info('Settings reset successfully') # inform the user that settings have been reset - else: + else: # save a new setting new = dict(parse_key_value_pair(a) for a in args) check_dict_alignment(SETTINGS, new) SETTINGS.update(new) diff --git a/ultralytics/utils/__init__.py b/ultralytics/utils/__init__.py index aae007c..a7ada26 100644 --- a/ultralytics/utils/__init__.py +++ b/ultralytics/utils/__init__.py @@ -714,24 +714,6 @@ def set_sentry(): logging.getLogger(logger).setLevel(logging.CRITICAL) -def update_dict_recursive(d, u): - """ - Recursively updates the dictionary `d` with the key-value pairs from the dictionary `u` without overwriting - entire sub-dictionaries. Note that function recursion is intended and not a problem, as this allows for updating - nested dictionaries at any arbitrary depth. - - Args: - d (dict): The dictionary to be updated. - u (dict): The dictionary to update `d` with. - - Returns: - (dict): The recursively updated dictionary. - """ - for k, v in u.items(): - d[k] = update_dict_recursive(d.get(k, {}), v) if isinstance(v, dict) else v - return d - - class SettingsManager(dict): """ Manages Ultralytics settings stored in a YAML file. @@ -792,20 +774,15 @@ class SettingsManager(dict): def load(self): """Loads settings from the YAML file.""" - self.update(yaml_load(self.file)) + super().update(yaml_load(self.file)) def save(self): """Saves the current settings to the YAML file.""" yaml_save(self.file, dict(self)) def update(self, *args, **kwargs): - """Updates a setting value in the current settings and saves the settings.""" - new = dict(*args, **kwargs) - if any(isinstance(v, dict) for v in new.values()): - update_dict_recursive(self, new) - else: - # super().update(*args, **kwargs) - super().update(new) + """Updates a setting value in the current settings.""" + super().update(*args, **kwargs) self.save() def reset(self):