Skip to content

Commit ec45e8c

Browse files
committed
* after pre-commit
1 parent 4ab6676 commit ec45e8c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

tests/buffer/file_test.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
from tests.tools import get_template_config, get_unittest_dataset_config
55
from trinity.buffer.buffer import get_buffer_reader
6-
from trinity.common.config import StorageConfig, StorageType
7-
from trinity.buffer.writer.file_writer import JSONWriter
86
from trinity.buffer.reader.file_reader import RawDataReader
7+
from trinity.buffer.writer.file_writer import JSONWriter
8+
from trinity.common.config import StorageConfig, StorageType
99

1010

1111
class TestFileReader(unittest.TestCase):
12-
13-
temp_output_path = 'tmp/test_file_buffer/'
12+
temp_output_path = "tmp/test_file_buffer/"
1413

1514
@classmethod
1615
def setUpClass(cls):
@@ -21,7 +20,7 @@ def setUpClass(cls):
2120
def tearDownClass(cls):
2221
super().tearDownClass()
2322
if os.path.exists(cls.temp_output_path):
24-
os.system(f'rm -rf {cls.temp_output_path}')
23+
os.system(f"rm -rf {cls.temp_output_path}")
2524

2625
def test_file_buffer(self):
2726
meta = StorageConfig(
@@ -31,10 +30,10 @@ def test_file_buffer(self):
3130
raw=True,
3231
)
3332
data = [
34-
{'key1': 1, 'key2': 2},
35-
{'key1': 3, 'key2': 4},
36-
{'key1': 5, 'key2': 6},
37-
{'key1': 7, 'key2': 8},
33+
{"key1": 1, "key2": 2},
34+
{"key1": 3, "key2": 4},
35+
{"key1": 5, "key2": 6},
36+
{"key1": 7, "key2": 8},
3837
]
3938

4039
# test writer
@@ -49,6 +48,7 @@ def test_file_buffer(self):
4948
self.assertEqual(len(loaded_data), 4)
5049
self.assertEqual(loaded_data, data)
5150
self.assertRaises(StopIteration, reader.read)
51+
5252
def test_file_reader(self):
5353
"""Test file reader."""
5454
config = get_template_config()
@@ -74,5 +74,3 @@ def test_file_reader(self):
7474
except StopIteration:
7575
break
7676
self.assertEqual(len(tasks), 16 * 2 - 4)
77-
78-

trinity/buffer/reader/file_reader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ def __init__(self, meta: StorageConfig, config: Optional[BufferConfig]):
271271
def __len__(self):
272272
return len(self.dataset)
273273

274-
def read(self, strategy: Optional[ReadStrategy] = None) -> List:
274+
def read(
275+
self, batch_size: Optional[int] = None, strategy: Optional[ReadStrategy] = None
276+
) -> List:
275277
if self.returned:
276278
raise StopIteration
277279
self.returned = True

0 commit comments

Comments
 (0)