diff options
author | Seth Troisi <sethtroisi@google.com> | 2020-01-21 11:32:58 -0800 |
---|---|---|
committer | Seth Troisi <sethtroisi@google.com> | 2020-01-21 11:34:58 -0800 |
commit | b54108238dbd1ce2673a042b0b270f666ea96e29 (patch) | |
tree | 6299fd6681a589e4f7a58f8acd045e2579827d5c /numpy/f2py | |
parent | 19b96a1635ee93c487d69ab88ac5ea3a6a14e79e (diff) | |
download | numpy-b54108238dbd1ce2673a042b0b270f666ea96e29.tar.gz |
STY: use `with open` when possible
Diffstat (limited to 'numpy/f2py')
-rw-r--r-- | numpy/f2py/tests/util.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py index c430a6608..6dcc2ed12 100644 --- a/numpy/f2py/tests/util.py +++ b/numpy/f2py/tests/util.py @@ -282,9 +282,8 @@ def build_module_distutils(source_files, config_code, module_name, **kw): script = os.path.join(d, get_temp_module_name() + '.py') dst_sources.append(script) - f = open(script, 'wb') - f.write(asbytes(code)) - f.close() + with open(script, 'wb') as f: + f.write(asbytes(code)) # Build cwd = os.getcwd() |