|
1 | 1 | """Data structures module.""" |
2 | 2 |
|
3 | | -from typing import Any, Optional, List, Union |
| 3 | +from typing import Any, Optional, List, Union, Dict, Tuple |
4 | 4 |
|
5 | 5 | import numpy as np # type: ignore |
6 | 6 |
|
7 | 7 |
|
8 | 8 | class EmptyQueueError(Exception): |
9 | | - """Empty queue exception.""" |
10 | | - |
11 | | - def __init__(self, *args, msg="Queue is empty.", **kwargs) -> None: |
12 | | - """Init method. |
13 | | -
|
14 | | - :param msg: exception message |
15 | | - :type msg: str |
16 | | - """ |
17 | | - super().__init__(msg, *args, **kwargs) |
| 9 | + """Empty queue exception. |
| 10 | +
|
| 11 | + :param args: exception arguments |
| 12 | + :type args: Tuple[Any, ...] |
| 13 | + :param msg: exception message, defaults to "Queue is empty." |
| 14 | + :type msg: str |
| 15 | + :param kwargs: exception keyword arguments |
| 16 | + :type kwargs: Dict[str, Dict[str, Any]] |
| 17 | + """ |
| 18 | + |
| 19 | + def __init__( # noqa: D107 |
| 20 | + self, |
| 21 | + *args: Tuple[Any, ...], |
| 22 | + msg: str = "Queue is empty.", |
| 23 | + **kwargs: Dict[str, Dict[str, Any]], |
| 24 | + ) -> None: |
| 25 | + super().__init__( |
| 26 | + msg, |
| 27 | + *args, |
| 28 | + **kwargs, |
| 29 | + ) |
18 | 30 |
|
19 | 31 |
|
20 | 32 | class CircularQueue: |
21 | | - """Class representing a circular queue.""" |
| 33 | + """Class representing a circular queue. |
22 | 34 |
|
23 | | - def __init__(self, max_len: int) -> None: |
24 | | - """Init method. |
| 35 | + :param max_len: maximum capacity |
| 36 | + :type max_len: int |
| 37 | + """ |
25 | 38 |
|
26 | | - :param max_len: maximum capacity |
27 | | - :type max_len: int |
28 | | - """ |
| 39 | + def __init__( # noqa: D107 |
| 40 | + self, |
| 41 | + max_len: int, |
| 42 | + ) -> None: |
29 | 43 | self.count = 0 |
30 | 44 | self.first = 0 |
31 | 45 | self.last = -1 |
@@ -218,14 +232,16 @@ def __getitem__(self, idx: int) -> Any: |
218 | 232 |
|
219 | 233 |
|
220 | 234 | class AccuracyQueue(CircularQueue): |
221 | | - """Class representing an accuracy queue.""" |
| 235 | + """Class representing an accuracy queue. |
222 | 236 |
|
223 | | - def __init__(self, max_len: int) -> None: |
224 | | - """Init method. |
| 237 | + :param max_len: maximum capacity |
| 238 | + :type max_len: int |
| 239 | + """ |
225 | 240 |
|
226 | | - :param max_len: maximum capacity |
227 | | - :type max_len: int |
228 | | - """ |
| 241 | + def __init__( # noqa: D107 |
| 242 | + self, |
| 243 | + max_len: int, |
| 244 | + ) -> None: |
229 | 245 | super().__init__(max_len=max_len) |
230 | 246 | self.num_true = 0 |
231 | 247 |
|
|
0 commit comments