mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-11-30 03:46:39 -05:00
Directory/Node: replace some bare open/close's with with's
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
This commit is contained in:
parent
7bc691169a
commit
ad10301569
2 changed files with 8 additions and 12 deletions
|
|
@ -128,9 +128,8 @@ class Node:
|
|||
allowed_input = allowed_result.stdout
|
||||
|
||||
else:
|
||||
fh = open(allowed_path, "rb")
|
||||
allowed_input = fh.read()
|
||||
fh.close()
|
||||
with open(allowed_path, "rb") as fh:
|
||||
allowed_input = fh.read()
|
||||
|
||||
allowed_hash_strs = allowed_input.splitlines()
|
||||
|
||||
|
|
@ -176,9 +175,8 @@ class Node:
|
|||
generated = subprocess.run([file_path], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, env=env_map)
|
||||
return generated.stdout
|
||||
else:
|
||||
fh = open(file_path, "rb")
|
||||
response_data = fh.read()
|
||||
fh.close()
|
||||
with open(file_path, "rb") as fh:
|
||||
response_data = fh.read()
|
||||
return response_data
|
||||
else:
|
||||
RNS.log("Request denied", RNS.LOG_VERBOSE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue