From d14eb7555da4c8986c8a501836943f9fcbc99fb4 Mon Sep 17 00:00:00 2001 From: Mahdi Rahimi <31624047+mahdirahimi1999@users.noreply.github.com> Date: Tue, 2 May 2023 19:39:19 +0330 Subject: [PATCH] Refactor read function to use context manager for file handling (#8967) Co-authored-by: Mahdi --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d9002fdb9..533ffa97f 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,8 @@ an older version of Django REST Framework: def read(f): - return open(f, 'r', encoding='utf-8').read() + with open(f, 'r', encoding='utf-8') as file: + return file.read() def get_version(package):