Rename SequinExhaustedException to SequinExhaustedError
Marco Ricci

Marco Ricci commited on 2024-06-30 16:37:52
Zeige 3 geänderte Dateien mit 10 Einfügungen und 10 Löschungen.


This is Python, not Java.
... ...
@@ -375,7 +375,7 @@ class Vault:
375 375
                                                      charset)
376 376
                     pos = seq.generate(len(charset))
377 377
                     result.extend(charset[pos:pos+1])
378
-            except sequin.SequinExhaustedException:
378
+            except sequin.SequinExhaustedError:
379 379
                 hash_length *= 2
380 380
             else:
381 381
                 return bytes(result)
... ...
@@ -27,7 +27,7 @@ import math
27 27
 from collections.abc import Iterator, MutableSequence, Sequence
28 28
 from typing import assert_type, Literal, TypeAlias
29 29
 
30
-__all__ = ('Sequin', 'SequinExhaustedException')
30
+__all__ = ('Sequin', 'SequinExhaustedError')
31 31
 __author__ = 'Marco Ricci <m@the13thletter.info>'
32 32
 __version__ = "0.1.0"
33 33
 
... ...
@@ -219,7 +219,7 @@ class Sequin:
219 219
         Raises:
220 220
             ValueError:
221 221
                 The range is empty.
222
-            SequinExhaustedException:
222
+            SequinExhaustedError:
223 223
                 The sequin is exhausted.
224 224
 
225 225
         Examples:
... ...
@@ -236,7 +236,7 @@ class Sequin:
236 236
             >>> seq.generate(5)    # doctest: +IGNORE_EXCEPTION_DETAIL
237 237
             Traceback (most recent call last):
238 238
                 ...
239
-            SequinExhaustedException: Sequin is exhausted
239
+            SequinExhaustedError: Sequin is exhausted
240 240
 
241 241
             Using `n = 1` does not actually consume input bits:
242 242
 
... ...
@@ -248,14 +248,14 @@ class Sequin:
248 248
             >>> seq.generate(1)    # doctest: +IGNORE_EXCEPTION_DETAIL
249 249
             Traceback (most recent call last):
250 250
                 ...
251
-            SequinExhaustedException: Sequin is exhausted
251
+            SequinExhaustedError: Sequin is exhausted
252 252
 
253 253
         """
254 254
         if 2 not in self.bases:
255
-            raise SequinExhaustedException('Sequin is exhausted')
255
+            raise SequinExhaustedError('Sequin is exhausted')
256 256
         value = self._generate_inner(n, base=2)
257 257
         if value == n:
258
-            raise SequinExhaustedException('Sequin is exhausted')
258
+            raise SequinExhaustedError('Sequin is exhausted')
259 259
         return value
260 260
 
261 261
     def _generate_inner(
... ...
@@ -360,7 +360,7 @@ class Sequin:
360 360
             self.bases[base] = collections.deque()
361 361
         self.bases[base].append(value)
362 362
 
363
-class SequinExhaustedException(Exception):
363
+class SequinExhaustedError(Exception):
364 364
     """The sequin is exhausted.
365 365
 
366 366
     No more values can be generated from this sequin.
... ...
@@ -61,9 +61,9 @@ class TestSequin:
61 61
         assert seq.generate(5) == 3
62 62
         assert seq.generate(5) == 3
63 63
         assert seq.generate(5) == 1
64
-        with pytest.raises(sequin.SequinExhaustedException):
64
+        with pytest.raises(sequin.SequinExhaustedError):
65 65
             seq.generate(5)
66
-        with pytest.raises(sequin.SequinExhaustedException):
66
+        with pytest.raises(sequin.SequinExhaustedError):
67 67
             seq.generate(1)
68 68
         seq = sequin.Sequin([1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1],
69 69
                             is_bitstring=True)
70 70