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

Less strict dictionary merging in core #1507

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 10 additions & 1 deletion fsspec/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,16 @@ def _un_chain(path, kwargs):
kws = kwargs.pop(protocol, {})
if bit is bits[0]:
kws.update(kwargs)
kw = dict(**extra_kwargs, **kws)
if any(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The simpler alternative would be

kw = extra_kwargs | kws

alone (you have this some lines below) without the check.

which does something different, but maybe the right thing?

k_1 == k_2 and v_1 != v_2
for k_1, v_1 in extra_kwargs.items()
for k_2, v_2 in kws.items()
):
raise ValueError(
"Tried to merge dictionaries with same key and different values."
)
else:
kw = extra_kwargs | kws
bit = cls._strip_protocol(bit)
if (
protocol in {"blockcache", "filecache", "simplecache"}
Expand Down