Skip to content

Commit 94239ae

Browse files
adapter: use rename inside of concatenate transform if appropriate (#264)
1 parent 24e70aa commit 94239ae

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

bayesflow/adapters/adapter.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,11 @@ def clear(self):
126126
self.transforms = []
127127
return self
128128

129-
def concatenate(self, keys: Sequence[str], *, into: str, axis: int = -1):
129+
def concatenate(self, keys: str | Sequence[str], *, into: str, axis: int = -1):
130130
if isinstance(keys, str):
131-
# this is a common mistake, and also passes the type checker since str is a sequence of characters
132-
raise ValueError("Keys must be a sequence of strings. To rename a single key, use the `rename` method.")
133-
134-
transform = Concatenate(keys, into=into, axis=axis)
131+
transform = Rename(keys, to_key=into)
132+
else:
133+
transform = Concatenate(keys, into=into, axis=axis)
135134
self.transforms.append(transform)
136135
return self
137136

0 commit comments

Comments
 (0)