Skip to content
Snippets Groups Projects
Commit e14417d6 authored by Moul's avatar Moul
Browse files

[lint] Use 'with * as' and remove close()

parent 22b5bef9
Branches
Tags
2 merge requests!157v1.0.0rc0: merge dev into master,!132Update black to v21.4b2, handle pylint v2.8.0
Pipeline #12186 waiting for manual action
......@@ -257,8 +257,9 @@ class API:
self.connection_handler.proxy, self.connection_handler.http_scheme
)
response = request.urlopen(duniter_request, timeout=15) # type: HTTPResponse
with request.urlopen(
duniter_request, timeout=15
) as response: # type: HTTPResponse
if response.status != 200:
content = response.read().decode("utf-8")
if bma_errors:
......@@ -277,7 +278,6 @@ class API:
# get response content
return_response = copy.copy(response)
content = response.read().decode("utf-8")
response.close()
# if schema supplied...
if schema is not None:
......
......@@ -158,9 +158,8 @@ def main():
)
# save revoke document in a file
fp = open(REVOCATION_DOCUMENT_FILE_PATH, "w")
with open(REVOCATION_DOCUMENT_FILE_PATH, "w") as fp:
fp.write(revocation_signed_raw_document)
fp.close()
# document saved
print("Revocation document saved in %s" % REVOCATION_DOCUMENT_FILE_PATH)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment