aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-12-19 09:35:20 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-12-19 09:35:20 -0600
commite4a0e8ad6ae0322635b47284e5d9ad1725bf9731 (patch)
treec62bff14b13c65f45bb53fe9890efb8f5005a44f
parent850dab4fb7d619e19f12953b9f4952e09e91cb16 (diff)
parent01aa770768e8dcb1c776c7b869d2ec050bf8010b (diff)
downloadcryptography-e4a0e8ad6ae0322635b47284e5d9ad1725bf9731.tar.gz
cryptography-e4a0e8ad6ae0322635b47284e5d9ad1725bf9731.tar.bz2
cryptography-e4a0e8ad6ae0322635b47284e5d9ad1725bf9731.zip
Merge pull request #1554 from alex/reasons-enum
made the internal _Reasons an enum, since we already depend on enum34
-rw-r--r--src/cryptography/exceptions.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/cryptography/exceptions.py b/src/cryptography/exceptions.py
index b0e1a993..102165c7 100644
--- a/src/cryptography/exceptions.py
+++ b/src/cryptography/exceptions.py
@@ -4,17 +4,19 @@
from __future__ import absolute_import, division, print_function
-
-class _Reasons(object):
- BACKEND_MISSING_INTERFACE = object()
- UNSUPPORTED_HASH = object()
- UNSUPPORTED_CIPHER = object()
- UNSUPPORTED_PADDING = object()
- UNSUPPORTED_MGF = object()
- UNSUPPORTED_PUBLIC_KEY_ALGORITHM = object()
- UNSUPPORTED_ELLIPTIC_CURVE = object()
- UNSUPPORTED_SERIALIZATION = object()
- UNSUPPORTED_X509 = object()
+from enum import Enum
+
+
+class _Reasons(Enum):
+ BACKEND_MISSING_INTERFACE = 0
+ UNSUPPORTED_HASH = 1
+ UNSUPPORTED_CIPHER = 2
+ UNSUPPORTED_PADDING = 3
+ UNSUPPORTED_MGF = 4
+ UNSUPPORTED_PUBLIC_KEY_ALGORITHM = 5
+ UNSUPPORTED_ELLIPTIC_CURVE = 6
+ UNSUPPORTED_SERIALIZATION = 7
+ UNSUPPORTED_X509 = 8
class UnsupportedAlgorithm(Exception):