Upload generator_utils.py with huggingface_hub
Browse files- generator_utils.py +5 -7
generator_utils.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
import copy
|
2 |
-
import
|
3 |
-
import itertools
|
4 |
-
from typing import Any, Dict, List, Optional
|
5 |
|
6 |
from .dataclass import Dataclass, OptionalField
|
7 |
|
@@ -36,11 +34,11 @@ class CopyingReusableGenerator(ReusableGenerator):
|
|
36 |
|
37 |
# # Using itertools.chain
|
38 |
# chained = list(chain(iterable1, iterable2))
|
39 |
-
#
|
40 |
|
41 |
# # Using itertools.islice
|
42 |
# sliced = list(islice(ReusableGenerator(range, gen_argv=[1, 7]), 1, 4))
|
43 |
-
#
|
44 |
|
45 |
# # now same test with generators
|
46 |
# def generator(start, end):
|
@@ -51,7 +49,7 @@ class CopyingReusableGenerator(ReusableGenerator):
|
|
51 |
# iterable2 = ReusableGenerator(generator, gen_argv=[4, 7])
|
52 |
|
53 |
# chained = list(chain(iterable1, iterable2))
|
54 |
-
#
|
55 |
|
56 |
# sliced = list(islice(ReusableGenerator(generator, gen_argv=[1, 7]), 1, 4))
|
57 |
-
#
|
|
|
1 |
import copy
|
2 |
+
from typing import Any, Dict, List
|
|
|
|
|
3 |
|
4 |
from .dataclass import Dataclass, OptionalField
|
5 |
|
|
|
34 |
|
35 |
# # Using itertools.chain
|
36 |
# chained = list(chain(iterable1, iterable2))
|
37 |
+
# logging.info(chained) # Prints: [1, 2, 3, 4, 5, 6]
|
38 |
|
39 |
# # Using itertools.islice
|
40 |
# sliced = list(islice(ReusableGenerator(range, gen_argv=[1, 7]), 1, 4))
|
41 |
+
# logging.info(sliced) # Prints: [2, 3, 4]
|
42 |
|
43 |
# # now same test with generators
|
44 |
# def generator(start, end):
|
|
|
49 |
# iterable2 = ReusableGenerator(generator, gen_argv=[4, 7])
|
50 |
|
51 |
# chained = list(chain(iterable1, iterable2))
|
52 |
+
# logging.info(chained) # Prints: [1, 2, 3, 4, 5, 6]
|
53 |
|
54 |
# sliced = list(islice(ReusableGenerator(generator, gen_argv=[1, 7]), 1, 4))
|
55 |
+
# logging.info(sliced) # Prints: [2, 3, 4]
|