MCPcopy Create free account
hub / github.com/modelscope/modelscope / gen_mock_data

Method gen_mock_data

tests/msdatasets/test_ms_dataset.py:43–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41
42 @staticmethod
43 def gen_mock_data() -> (str, str):
44 mock_data_list = [
45 'Title,Content,Label', 'mock title1,mock content1,mock label1',
46 'mock title2,mock content2,mock label2',
47 'mock title3,mock content3,mock label3'
48 ]
49
50 mock_file_name = 'mock_file.csv'
51 md = hashlib.md5()
52 md.update('GenLocalFile.gen_mock_data.out_file_path'.encode('utf-8'))
53 mock_dir = os.path.join(os.getcwd(), md.hexdigest())
54 os.makedirs(mock_dir, exist_ok=True)
55 mock_relative_path = os.path.join(md.hexdigest(), mock_file_name)
56 with open(mock_relative_path, 'w') as f:
57 for line in mock_data_list:
58 f.write(line + '\n')
59
60 return mock_relative_path, md.hexdigest()
61
62 @staticmethod
63 def clear_mock_dir(mock_dir) -> None:

Callers 1

test_load_local_csvMethod · 0.80

Calls 3

updateMethod · 0.45
encodeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected