|
| 1 | +import copy |
1 | 2 | import re |
2 | 3 | from typing import TextIO, Any |
3 | 4 |
|
@@ -82,6 +83,13 @@ def parse(self, file: TextIO) -> list[Method]: |
82 | 83 | # Starting a new data block, so store the current collected header in a new method |
83 | 84 | method = self.parse_header(header) |
84 | 85 | header = {} |
| 86 | + elif _new_state == ParseState.DATA and _old_state == ParseState.DATA: |
| 87 | + # Starting a new data block, while handling data. No new header, |
| 88 | + # so use the previous method to create a new method of the same type |
| 89 | + if method: |
| 90 | + methods.append(method) |
| 91 | + method = copy.copy(method) |
| 92 | + method.method_data = [] |
85 | 93 | elif _new_state in (ParseState.HEADER, ParseState.METHOD) and _old_state == ParseState.DATA: |
86 | 94 | # Finished populating current method, since new method is starting |
87 | 95 | # Store the current method, and empty the current method |
@@ -143,7 +151,7 @@ def parse_data(self, method: Method, row: str) -> MethodData: |
143 | 151 | row_dict = self._convert_str_to_dict(row) |
144 | 152 | method_data = method.method_data_type.model_validate(row_dict) |
145 | 153 | if hasattr(method_data, "flushing"): |
146 | | - method_data.flushing = method.is_flushing_active(method_data) |
| 154 | + method_data.flushing = method.is_flushing_active(method_data) |
147 | 155 | if hasattr(method_data, "hammering"): |
148 | 156 | method_data.hammering = method.is_hammer_active(method_data) |
149 | 157 | if hasattr(method_data, "increased_rotation_rate"): |
|
0 commit comments