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(plugins): ECMWFSearch strip_quotes implementation for dicts #1483

Merged
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
4 changes: 3 additions & 1 deletion eodag/plugins/search/build_search_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ def strip_quotes(value: Any) -> Any:
'abc'
>>> strip_quotes(["'abc'", '"def'])
['abc', 'def']
>>> strip_quotes({"'abc'": 'def"'})
{'abc': 'def'}

:param value: value from which quotes should be removed (should be either str or list)
:return: value without quotes
Expand All @@ -245,7 +247,7 @@ def strip_quotes(value: Any) -> Any:
if isinstance(value, (list, tuple)):
return [strip_quotes(v) for v in value]
elif isinstance(value, dict):
raise NotImplementedError("Dict value is not supported.")
return {strip_quotes(k): strip_quotes(v) for k, v in value.items()}
else:
return str(value).strip("'\"")

Expand Down
Loading