summaryrefslogtreecommitdiff
path: root/src/OpenSSL/_util.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2020-07-23 20:40:46 -0400
committerGitHub <noreply@github.com>2020-07-23 19:40:46 -0500
commit037371861693f26297320dcd5fd8c221b6d8df26 (patch)
treeab18ca46617b0036e137cd6a154726acbab36bdf /src/OpenSSL/_util.py
parent4ca4fb9e8ed3c45f09efab8269e4078d40f39d9b (diff)
downloadpyopenssl-037371861693f26297320dcd5fd8c221b6d8df26.tar.gz
Paint it Black by the Rolling Stones (#920)
Diffstat (limited to 'src/OpenSSL/_util.py')
-rw-r--r--src/OpenSSL/_util.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/OpenSSL/_util.py b/src/OpenSSL/_util.py
index 9f2d724..1beefe6 100644
--- a/src/OpenSSL/_util.py
+++ b/src/OpenSSL/_util.py
@@ -46,10 +46,13 @@ def exception_from_error_queue(exception_type):
error = lib.ERR_get_error()
if error == 0:
break
- errors.append((
- text(lib.ERR_lib_error_string(error)),
- text(lib.ERR_func_error_string(error)),
- text(lib.ERR_reason_error_string(error))))
+ errors.append(
+ (
+ text(lib.ERR_lib_error_string(error)),
+ text(lib.ERR_func_error_string(error)),
+ text(lib.ERR_reason_error_string(error)),
+ )
+ )
raise exception_type(errors)
@@ -59,6 +62,7 @@ def make_assert(error):
Create an assert function that uses :func:`exception_from_error_queue` to
raise an exception wrapped by *error*.
"""
+
def openssl_assert(ok):
"""
If *ok* is not True, retrieve the error from OpenSSL and raise it.
@@ -108,9 +112,13 @@ def path_string(s):
if PY2:
+
def byte_string(s):
return s
+
+
else:
+
def byte_string(s):
return s.encode("charmap")
@@ -141,9 +149,9 @@ def text_to_bytes_and_warn(label, obj):
warnings.warn(
_TEXT_WARNING.format(label),
category=DeprecationWarning,
- stacklevel=3
+ stacklevel=3,
)
- return obj.encode('utf-8')
+ return obj.encode("utf-8")
return obj