Concatenate several DataFlow. Produce datapoints from each DataFlow and start the next when one DataFlow is exhausted.
| 494 | |
| 495 | |
| 496 | class ConcatData(DataFlow): |
| 497 | """ |
| 498 | Concatenate several DataFlow. |
| 499 | Produce datapoints from each DataFlow and start the next when one |
| 500 | DataFlow is exhausted. |
| 501 | """ |
| 502 | |
| 503 | def __init__(self, df_lists): |
| 504 | """ |
| 505 | Args: |
| 506 | df_lists (list): a list of DataFlow. |
| 507 | """ |
| 508 | self.df_lists = df_lists |
| 509 | |
| 510 | def reset_state(self): |
| 511 | for d in self.df_lists: |
| 512 | d.reset_state() |
| 513 | |
| 514 | def __len__(self): |
| 515 | return sum(len(x) for x in self.df_lists) |
| 516 | |
| 517 | def __iter__(self): |
| 518 | for d in self.df_lists: |
| 519 | yield from d |
| 520 | |
| 521 | |
| 522 | class JoinData(DataFlow): |