From 01aa770768e8dcb1c776c7b869d2ec050bf8010b Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 18 Dec 2014 19:27:36 -0800 Subject: made the internal _Reasons an enum, since we already depend on enum34 fixes #854 --- src/cryptography/exceptions.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src') 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): -- cgit v1.2.3