]> www.wagner.pp.ru Git - oss/ctypescrypto.git/blobdiff - ctypescrypto/exception.py
Converted tabs to spaces to make pylint happy
[oss/ctypescrypto.git] / ctypescrypto / exception.py
index 30c138e43aa5ba52651243267abe0cdf974244fa..0e6fc438ad8a4dcb6076915eae2470be55191c3f 100644 (file)
@@ -8,41 +8,41 @@ strings_loaded=False
 __all__ = ['LibCryptoError','clear_err_stack']
 
 def _check_null(s):
-       """
-       Handle transparently NULL returned from error reporting functions
-       instead of strings
-       """
-       if s is None:   
-               return ""
-       return s
+    """
+    Handle transparently NULL returned from error reporting functions
+    instead of strings
+    """
+    if s is None:   
+        return ""
+    return s
 
 class LibCryptoError(Exception):
-       """
-               Exception for libcrypto errors. Adds all the info, which can be
-               extracted from internal (per-thread) libcrypto error stack to the message,
-               passed to the constructor.
-       """
-       def __init__(self,msg):
-               global strings_loaded
-               if not strings_loaded:
-                       libcrypto.ERR_load_crypto_strings()
-                       strings_loaded = True
-               e=libcrypto.ERR_get_error()
-               m = msg
-               while e != 0:
-                       m+="\n\t"+_check_null(libcrypto.ERR_lib_error_string(e))+":"+\
-                         _check_null(libcrypto.ERR_func_error_string(e))+":"+\
-                         _check_null(libcrypto.ERR_reason_error_string(e))
-                       e=libcrypto.ERR_get_error()
-               self.args=(m,)
+    """
+        Exception for libcrypto errors. Adds all the info, which can be
+        extracted from internal (per-thread) libcrypto error stack to the message,
+        passed to the constructor.
+    """
+    def __init__(self,msg):
+        global strings_loaded
+        if not strings_loaded:
+            libcrypto.ERR_load_crypto_strings()
+            strings_loaded = True
+        e=libcrypto.ERR_get_error()
+        m = msg
+        while e != 0:
+            m+="\n\t"+_check_null(libcrypto.ERR_lib_error_string(e))+":"+\
+              _check_null(libcrypto.ERR_func_error_string(e))+":"+\
+              _check_null(libcrypto.ERR_reason_error_string(e))
+            e=libcrypto.ERR_get_error()
+        self.args=(m,)
 
 def clear_err_stack():
-       """
-         Clears internal libcrypto err stack. Call it if you've checked
-         return code and processed exceptional situation, so subsequent
-         raising of the LibCryptoError wouldn't list already handled errors
-       """
-       libcrypto.ERR_clear_error()
+    """
+      Clears internal libcrypto err stack. Call it if you've checked
+      return code and processed exceptional situation, so subsequent
+      raising of the LibCryptoError wouldn't list already handled errors
+    """
+    libcrypto.ERR_clear_error()
 
 
 libcrypto.ERR_lib_error_string.restype=c_char_p