From bf6778695b5a02590f535c2280e2b38dfe425d07 Mon Sep 17 00:00:00 2001 From: Bennett Meares <38741257+bmeares@users.noreply.github.com> Date: Fri, 14 Oct 2022 00:34:27 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20v1.3.2=20(#79)=20Fixed=20an=20en?= =?UTF-8?q?vironment=20issue=20on=20Ubuntu=2018.04.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change mutable default argument to `None`. * Set to empty list if `keys` is `None`. * Return if the given config is not a dictionary. * Ensure `parsed_config` is a dictionary. * Bump to version 1.3.2 --- meerschaum/config/_read_config.py | 8 ++++++-- meerschaum/config/_version.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/meerschaum/config/_read_config.py b/meerschaum/config/_read_config.py index 2306d7a9..17a6dd07 100644 --- a/meerschaum/config/_read_config.py +++ b/meerschaum/config/_read_config.py @@ -244,7 +244,11 @@ def search_and_substitute_config( """ _links = [] - def _find_symlinks(d, _keys: List[str] = []): + def _find_symlinks(d, _keys: Optional[List[str]] = None): + if _keys is None: + _keys = [] + if not isinstance(d, dict): + return for k, v in d.items(): if isinstance(v, dict): _find_symlinks(v, _keys + [k]) @@ -345,7 +349,7 @@ def _find_symlinks(d, _keys: List[str] = []): haystack = haystack.replace(pattern, str(value)) ### parse back into dict - parsed_config = json.loads(haystack) + parsed_config = json.loads(haystack) or {} symlinks = {} if keep_symlinks: diff --git a/meerschaum/config/_version.py b/meerschaum/config/_version.py index 4178837f..c8073270 100644 --- a/meerschaum/config/_version.py +++ b/meerschaum/config/_version.py @@ -2,4 +2,4 @@ Specify the Meerschaum release version. """ -__version__ = "1.3.1" +__version__ = "1.3.2"