From e6a312fa77fdbdc6c9c989aa4db7aa69b0040977 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Tue, 24 Sep 2024 16:22:28 -0300 Subject: [PATCH] fix(cte): Close file object in `f29.parse_datos_obj` Fix the following warning: > cl_sii/cte/f29/parse_datos_obj.py:31: > ResourceWarning: unclosed file > <_io.TextIOWrapper name='cl_sii/data/cte/f29_datos_obj_missing_key_fixes.json' mode='r' encoding='UTF-8'> > CTE_F29_DATOS_OBJ_MISSING_KEY_FIXES: SiiCteF29DatosObjType = json.load( --- src/cl_sii/cte/f29/parse_datos_obj.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cl_sii/cte/f29/parse_datos_obj.py b/src/cl_sii/cte/f29/parse_datos_obj.py index 63af92ca..e6b1d6d0 100644 --- a/src/cl_sii/cte/f29/parse_datos_obj.py +++ b/src/cl_sii/cte/f29/parse_datos_obj.py @@ -28,9 +28,8 @@ _CTE_F29_DATOS_OBJ_MISSING_KEY_FIXES_PATH = ( Path(__file__).parent.parent.parent / 'data' / 'cte' / 'f29_datos_obj_missing_key_fixes.json' ) -CTE_F29_DATOS_OBJ_MISSING_KEY_FIXES: SiiCteF29DatosObjType = json.load( - open(_CTE_F29_DATOS_OBJ_MISSING_KEY_FIXES_PATH) -) +with open(_CTE_F29_DATOS_OBJ_MISSING_KEY_FIXES_PATH) as f: + CTE_F29_DATOS_OBJ_MISSING_KEY_FIXES: SiiCteF29DatosObjType = json.load(f) def parse_sii_cte_f29_datos_obj(