| 86 | ) |
| 87 | |
| 88 | class FileStreamSubject(pw.io.python.ConnectorSubject): |
| 89 | def run(self): |
| 90 | def _get_row(i): |
| 91 | row = {} |
| 92 | for name, fun in value_generators.items(): |
| 93 | row[name] = fun(i) |
| 94 | return row |
| 95 | |
| 96 | if nb_rows is None: |
| 97 | row_index = 0 |
| 98 | while True: |
| 99 | self.next_json(_get_row(row_index)) |
| 100 | row_index = row_index + 1 |
| 101 | time.sleep(1.0 / input_rate) |
| 102 | else: |
| 103 | for row_index in range(nb_rows): |
| 104 | self.next_json(_get_row(row_index)) |
| 105 | time.sleep(1.0 / input_rate) |
| 106 | |
| 107 | table = pw.io.python.read( |
| 108 | FileStreamSubject(datasource_name="demo.custom-stream"), |
no outgoing calls
no test coverage detected