MCPcopy
hub / github.com/langroid/langroid / close

Method close

langroid/utils/logging.py:200–211  ·  view source on GitHub ↗

Decrease ref-count; close FD only when last user is done.

(self)

Source from the content-addressed store, hash-verified

198 self.file.flush()
199
200 def close(self) -> None:
201 """Decrease ref-count; close FD only when last user is done."""
202 with self._class_lock:
203 count = self._ref_counts.get(self.log_file, 0) - 1
204 if count <= 0:
205 self._ref_counts.pop(self.log_file, None)
206 self._instances.pop(self.log_file, None)
207 with self._write_lock:
208 if self._owns_file and not self.file.closed:
209 self.file.close()
210 else:
211 self._ref_counts[self.log_file] = count

Callers 15

silence_stdoutFunction · 0.45
_cleanup_clientsFunction · 0.45
redis_clientMethod · 0.45
iterate_pagesMethod · 0.45
iterate_pagesMethod · 0.45
iterate_pagesMethod · 0.45
__init__Method · 0.45
pdf_split_pagesFunction · 0.45
wait_for_neo4jFunction · 0.45
test_singleton_and_fdFunction · 0.45

Calls 1

getMethod · 0.80

Tested by 13

wait_for_neo4jFunction · 0.36
test_singleton_and_fdFunction · 0.36
mock_db_sessionFunction · 0.36
sessionFunction · 0.36
mock_postgresql_sessionFunction · 0.36