@@ -34,25 +34,27 @@ class AddressError(Error, multiaddr.exceptions.Error): # type: ignore[no-any-un
34
34
"""Raised when the provided daemon location Multiaddr does not match any
35
35
of the supported patterns."""
36
36
__slots__ = ("addr" ,)
37
- #addr: ty.Union[str, bytes]
37
+
38
+ addr : ty .Union [str , bytes ]
38
39
39
40
def __init__ (self , addr : ty .Union [str , bytes ]) -> None :
40
- self .addr = addr # type: ty.Union[str, bytes]
41
+ self .addr = addr
41
42
Error .__init__ (self , "Unsupported Multiaddr pattern: {0!r}" .format (addr ))
42
43
43
44
44
45
class VersionMismatch (Warning ):
45
46
"""Raised when daemon version is not supported by this client version."""
46
47
__slots__ = ("current" , "minimum" , "maximum" )
47
- #current: ty.Sequence[int]
48
- #minimum: ty.Sequence[int]
49
- #maximum: ty.Sequence[int]
48
+
49
+ current : ty .Sequence [int ]
50
+ minimum : ty .Sequence [int ]
51
+ maximum : ty .Sequence [int ]
50
52
51
53
def __init__ (self , current : ty .Sequence [int ], minimum : ty .Sequence [int ],
52
54
maximum : ty .Sequence [int ]) -> None :
53
- self .current = current # type: ty.Sequence[int]
54
- self .minimum = minimum # type: ty.Sequence[int]
55
- self .maximum = maximum # type: ty.Sequence[int]
55
+ self .current = current
56
+ self .minimum = minimum
57
+ self .maximum = maximum
56
58
57
59
msg = "Unsupported daemon version '{}' (not in range: {} ≤ … < {})" .format (
58
60
"." .join (map (str , current )), "." .join (map (str , minimum )), "." .join (map (str , maximum ))
@@ -66,10 +68,11 @@ def __init__(self, current: ty.Sequence[int], minimum: ty.Sequence[int],
66
68
class EncoderError (Error ):
67
69
"""Base class for all encoding and decoding related errors."""
68
70
__slots__ = ("encoder_name" ,)
69
- #encoder_name: str
71
+
72
+ encoder_name : str
70
73
71
74
def __init__ (self , message : str , encoder_name : str ) -> None :
72
- self .encoder_name = encoder_name # type: str
75
+ self .encoder_name = encoder_name
73
76
74
77
super ().__init__ (message )
75
78
@@ -86,10 +89,11 @@ class EncodingError(EncoderError):
86
89
"""Raised when encoding a Python object into a byte string has failed
87
90
due to some problem with the input data."""
88
91
__slots__ = ("original" ,)
89
- #original: Exception
92
+
93
+ original : Exception
90
94
91
95
def __init__ (self , encoder_name : str , original : Exception ) -> None :
92
- self .original = original # type: Exception
96
+ self .original = original
93
97
94
98
super ().__init__ ("Object encoding error: {}" .format (original ), encoder_name )
95
99
@@ -98,10 +102,11 @@ class DecodingError(EncoderError):
98
102
"""Raised when decoding a byte string to a Python object has failed due to
99
103
some problem with the input data."""
100
104
__slots__ = ("original" ,)
101
- #original: Exception
105
+
106
+ original : Exception
102
107
103
108
def __init__ (self , encoder_name : str , original : Exception ) -> None :
104
- self .original = original # type: Exception
109
+ self .original = original
105
110
106
111
super ().__init__ ("Object decoding error: {}" .format (original ), encoder_name )
107
112
@@ -128,13 +133,13 @@ def __init__(self, matcher_class: type, invalid_spec: ty.Any) -> None:
128
133
class CommunicationError (Error ):
129
134
"""Base class for all network communication related errors."""
130
135
__slots__ = ("original" ,)
131
- #original: ty.Optional[Exception]
136
+
137
+ original : ty .Optional [Exception ]
132
138
133
139
def __init__ (self , original : ty .Optional [Exception ],
134
140
_message : ty .Optional [str ] = None ) -> None :
135
- self .original = original # type: ty.Optional[Exception]
141
+ self .original = original
136
142
137
- msg = "" # type: str
138
143
if _message :
139
144
msg = _message
140
145
else :
0 commit comments