Skip to content

Commit

Permalink
Merge pull request #74 from kmdalton/concat_generator
Browse files Browse the repository at this point in the history
add support for generators to rs.concat
  • Loading branch information
JBGreisman authored Jul 28, 2021
2 parents 3e66ad0 + d4c29ec commit 1a1e089
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions reciprocalspaceship/concat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import reciprocalspaceship as rs
from itertools import tee
import pandas as pd

def concat(*args, check_isomorphous=True, **kwargs):
Expand Down Expand Up @@ -29,9 +30,10 @@ def concat(*args, check_isomorphous=True, **kwargs):
DataSet.append : Concatenate DataSets
"""
objs = kwargs.get("objs", args[0])
first = objs[0]
objs,objs_tee = tee(objs)
first = next(objs_tee)
if check_isomorphous and isinstance(first, rs.DataSet):
for obj in objs[1:]:
for obj in objs:
if not first.is_isomorphous(obj):
raise ValueError("Provided DataSets are not isomorphous")

Expand Down

0 comments on commit 1a1e089

Please sign in to comment.