Skip to content

Commit

Permalink
fix stream unstream (#1245)
Browse files Browse the repository at this point in the history
Signed-off-by: jie.hou <[email protected]>
  • Loading branch information
reiase authored May 13, 2022
1 parent 5b36d6c commit 513c9c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions docs/03-User Guides/01-DataCollection/01-data-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ We use a `prime number` example to go through core conceptions in `DataCollectio

```python
>>> dc = DataCollection([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) # use construction method
>>> dc = DataCollection.unstream(range(10)) # use factory method

```

When the inputs are very large (for example, 1M), storing all the input in the memory is not a good idea. We can create `DataCollection` from an iterator for saving runtime memory:

```python
>>> dc = DataCollection(iter(range(10000))) # use construction method
>>> dc = DataCollection.stream(range(10000)) # use factory method

```

Expand Down
8 changes: 4 additions & 4 deletions towhee/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
# pylint: disable=protected-access


def stream(iterable):
return DataCollection.stream(iterable)
# def stream(iterable):
# return DataCollection.stream(iterable)


def unstream(iterable):
return DataCollection.unstream(iterable)
# def unstream(iterable):
# return DataCollection.unstream(iterable)


read_csv = DataCollection.from_csv
Expand Down

0 comments on commit 513c9c2

Please sign in to comment.