Refactor read function to use context manager for file handling (#8967)

Co-authored-by: Mahdi <mahdi@Mahdis-MacBook-Pro.local>
This commit is contained in:
Mahdi Rahimi 2023-05-02 19:39:19 +03:30 committed by GitHub
parent f1a11d41cb
commit d14eb7555d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,8 @@ an older version of Django REST Framework:
def read(f): 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): def get_version(package):