MCPcopy Create free account
hub / github.com/ContextualAI/HALOs / write_item

Method write_item

train/utils.py:55–62  ·  view source on GitHub ↗

Write a single item to the JSON array.

(self, item: Dict)

Source from the content-addressed store, hash-verified

53 self.file.write('[\n')
54
55 def write_item(self, item: Dict):
56 """Write a single item to the JSON array."""
57 if not self.is_first:
58 self.file.write(',\n')
59 json.dump(item, self.file, indent=2)
60 self.is_first = False
61 # Flush after each write to ensure immediate disk writing
62 self.file.flush()
63
64 def close(self):
65 """Close the JSON array and the file."""

Callers 2

mainFunction · 0.95
mainFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected