MCPcopy Index your code
hub / github.com/pathwaycom/pathway / stream_inputs

Function stream_inputs

python/pathway/tests/test_io.py:83–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81 os.mkdir(inputs_path)
82
83 def stream_inputs():
84 for i in range(n_files):
85 file_path = inputs_path / f"{i}.csv"
86 if data_format == "json":
87 payload = {"k": str(i), "v": i}
88 with open(file_path, "w") as streamed_file:
89 json.dump(payload, streamed_file)
90 elif data_format == "csv":
91 data = """
92 k | v
93 {} | {}
94 """.format(
95 i, i
96 )
97 write_csv(file_path, data)
98 elif data_format == "plaintext":
99 with open(file_path, "w") as f:
100 f.write(f"{i}")
101 else:
102 raise ValueError(f"Unknown format: {data_format}")
103
104 time.sleep(stream_interval)
105
106 inputs_thread = threading.Thread(target=stream_inputs, daemon=True)
107 inputs_thread.start()

Callers

nothing calls this directly

Calls 9

write_csvFunction · 0.90
write_linesFunction · 0.90
wait_result_with_checkerFunction · 0.90
formatMethod · 0.80
writeMethod · 0.80
dumpsMethod · 0.45
removeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected