From 315a89fb65091acad82f5d5abe14493502ab938f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 23 Jul 2023 23:31:57 +0200 Subject: [PATCH] Added a `default` parameter to `Config.get`. --- platypush/config/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platypush/config/__init__.py b/platypush/config/__init__.py index f109751c8..78748c75a 100644 --- a/platypush/config/__init__.py +++ b/platypush/config/__init__.py @@ -11,7 +11,7 @@ import shutil import socket import sys from urllib.parse import quote -from typing import Dict, Optional, Set +from typing import Any, Dict, Optional, Set import yaml @@ -471,7 +471,7 @@ class Config: return workdir # type: ignore @classmethod - def get(cls, key: Optional[str] = None): + def get(cls, key: Optional[str] = None, default: Optional[Any] = None): """ Get a config value or the whole configuration object. @@ -480,7 +480,7 @@ class Config: # pylint: disable=protected-access config = cls._get_instance()._config.copy() if key: - return config.get(key) + return config.get(key, default) return config