[data] Make sure the french_lemmas file is closed
authorSimon Chabot <simon.chabot@logilab.fr>
Tue, 01 Oct 2019 09:16:34 +0200
changeset 563 4f3bb5215616
parent 562 700dd41dd9d0
child 564 46dbd714ff87
[data] Make sure the french_lemmas file is closed
nazca/data/__init__.py
--- a/nazca/data/__init__.py	Tue Oct 01 10:43:43 2019 +0200
+++ b/nazca/data/__init__.py	Tue Oct 01 09:16:34 2019 +0200
@@ -4,5 +4,5 @@
 import os.path as osp
 
 HERE = osp.join(osp.abspath(osp.dirname(__file__)))
-FRENCH_LEMMAS = dict([t.strip().split('\t')
-                      for t in open(osp.join(HERE, 'french_lemmas.txt'))])
+with open(osp.join(HERE, "french_lemmas.txt")) as fobj:
+    FRENCH_LEMMAS = dict(t.strip().split('\t') for t in fobj)