Skip to content

Commit a1b5eff

Browse files
Fix #943: replace one-line open() calls with context manager (#940)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 31ee42a commit a1b5eff

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

setup.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,20 @@ def build_extension(self, ext):
124124
)
125125

126126

127-
requirements = open("requirements.txt").readlines()
128-
dev_requirements = open("dev-requirements.txt").readlines()
127+
with open("requirements.txt") as f:
128+
requirements = [
129+
line.strip() for line in f if line.strip() and not line.strip().startswith("#")
130+
]
131+
with open("dev-requirements.txt") as f:
132+
dev_requirements = [
133+
line.strip() for line in f if line.strip() and not line.strip().startswith("#")
134+
]
129135

130136
description = "Schrödinger and Schrödinger-Feynman simulators for quantum circuits."
131137

132138
# README file as long_description.
133-
long_description = open("README.md", encoding="utf-8").read()
139+
with open("README.md", encoding="utf-8") as f:
140+
long_description = f.read()
134141

135142
__version__ = runpy.run_path("qsimcirq/_version.py")["__version__"]
136143
if not __version__:

0 commit comments

Comments
 (0)