File tree 2 files changed +6
-10
lines changed 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -26,29 +26,26 @@ class DeserializationError(Exception):
26
26
"""Error during deserialization. """
27
27
28
28
29
- class MetadataDeserializer ():
29
+ class MetadataDeserializer (metaclass = abc . ABCMeta ):
30
30
"""Abstract base class for deserialization of Metadata objects. """
31
- __metaclass__ = abc .ABCMeta
32
31
33
32
@abc .abstractmethod
34
33
def deserialize (self , raw_data : bytes ) -> "Metadata" :
35
34
"""Deserialize passed bytes to Metadata object. """
36
35
raise NotImplementedError
37
36
38
37
39
- class MetadataSerializer ():
38
+ class MetadataSerializer (metaclass = abc . ABCMeta ):
40
39
"""Abstract base class for serialization of Metadata objects. """
41
- __metaclass__ = abc .ABCMeta
42
40
43
41
@abc .abstractmethod
44
42
def serialize (self , metadata_obj : "Metadata" ) -> bytes :
45
43
"""Serialize passed Metadata object to bytes. """
46
44
raise NotImplementedError
47
45
48
46
49
- class SignedSerializer ():
47
+ class SignedSerializer (metaclass = abc . ABCMeta ):
50
48
"""Abstract base class for serialization of Signed objects. """
51
- __metaclass__ = abc .ABCMeta
52
49
53
50
@abc .abstractmethod
54
51
def serialize (self , signed_obj : "Signed" ) -> bytes :
Original file line number Diff line number Diff line change 10
10
11
11
"""
12
12
import json
13
- import six
14
13
15
14
from securesystemslib .formats import encode_canonical
16
15
@@ -36,7 +35,7 @@ def deserialize(self, raw_data: bytes) -> Metadata:
36
35
metadata_obj = Metadata .from_dict (json_dict )
37
36
38
37
except Exception as e : # pylint: disable=broad-except
39
- six . raise_from ( DeserializationError , e )
38
+ raise DeserializationError from e
40
39
41
40
return metadata_obj
42
41
@@ -63,7 +62,7 @@ def serialize(self, metadata_obj: Metadata) -> bytes:
63
62
sort_keys = True ).encode ("utf-8" )
64
63
65
64
except Exception as e : # pylint: disable=broad-except
66
- six . raise_from ( SerializationError , e )
65
+ raise SerializationError from e
67
66
68
67
return json_bytes
69
68
@@ -78,6 +77,6 @@ def serialize(self, signed_obj: Signed) -> bytes:
78
77
canonical_bytes = encode_canonical (signed_dict ).encode ("utf-8" )
79
78
80
79
except Exception as e : # pylint: disable=broad-except
81
- six . raise_from ( SerializationError , e )
80
+ raise SerializationError from e
82
81
83
82
return canonical_bytes
You can’t perform that action at this time.
0 commit comments