Skip to content

Commit 2a84e1a

Browse files
committed
✨ Add support for new filetypes
1 parent 0628b50 commit 2a84e1a

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

sdk/nexent/data_process/json_chunk_processor.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,32 @@ def _find_last_top_kv(self, text: str, max_len: int) -> int | None:
174174
if in_str:
175175
continue
176176

177-
# Process structural characters only outside strings
178-
if c in "{[":
179-
depth += 1
180-
elif c in "]}":
181-
depth -= 1
182-
elif c == ',' and depth == 1:
183-
candidate = i + 1
184-
# Only accept if prefix doesn't end with unescaped backslash
185-
if not self._ends_with_unescaped_backslash(text[:candidate]):
186-
last_safe_cut = candidate
177+
depth, last_safe_cut = self._process_structural_char(
178+
text, i, c, depth, last_safe_cut
179+
)
187180

188181
return last_safe_cut
189182

183+
def _process_structural_char(
184+
self,
185+
text: str,
186+
i: int,
187+
c: str,
188+
depth: int,
189+
last_safe_cut: int | None,
190+
) -> tuple[int, int | None]:
191+
# Process structural characters only outside strings
192+
if c in "{[":
193+
return depth + 1, last_safe_cut
194+
if c in "]}":
195+
return depth - 1, last_safe_cut
196+
if c == "," and depth == 1:
197+
candidate = i + 1
198+
# Only accept if prefix doesn't end with unescaped backslash
199+
if not self._ends_with_unescaped_backslash(text[:candidate]):
200+
return depth, candidate
201+
return depth, last_safe_cut
202+
190203
@staticmethod
191204
def _to_text(file_data) -> str:
192205
if isinstance(file_data, (bytes, bytearray)):

0 commit comments

Comments
 (0)