From dd327b90f0c1666ad604ae1f45dbdf6c543861af Mon Sep 17 00:00:00 2001 From: "Leonard (Lenny) Truong" Date: Thu, 24 Feb 2022 17:00:41 -0800 Subject: [PATCH] Use context manager to avoid ResourceWarning This implicitly will call close to avoid an unclosed file warning. --- pyverilog/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyverilog/__init__.py b/pyverilog/__init__.py index 3b4e375..9ae7004 100644 --- a/pyverilog/__init__.py +++ b/pyverilog/__init__.py @@ -3,4 +3,5 @@ import os -__version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().splitlines()[0] +with open(os.path.join(os.path.dirname(__file__), "VERSION")) as f: + __version__ = f.read().splitlines()[0]