docs: подробные docstring перед каждой функцией

This commit is contained in:
Repinoid
2026-06-06 07:22:35 +04:00
parent 0de7e0591c
commit 8da4876cb8
5 changed files with 11 additions and 2 deletions
+3
View File
@@ -28,13 +28,16 @@ class Database:
self._init_schema()
def __enter__(self):
"""Контекстный менеджер: with Database() as db."""
return self
def __exit__(self, exc_type, exc_val, exc_tb):
"""Закрытие соединения при выходе из with-блока."""
self.close()
return False
def close(self):
"""Закрыть соединение с SQLite."""
if self.conn:
self.conn.close()
self.conn = None
+1
View File
@@ -19,6 +19,7 @@ _DTC_PATH = Path(__file__).parent.parent / "doc" / "dtc_codes.txt"
def _load_dtc_dict() -> dict[str, str]:
"""Загрузить справочник DTC-кодов из doc/dtc_codes.txt."""
global _DTC_CODES
if _DTC_CODES:
return _DTC_CODES