|
3 | 3 | import io |
4 | 4 | from abc import ABC, abstractmethod |
5 | 5 | from enum import IntEnum |
6 | | -from typing import Generic, Type, TypeVar |
| 6 | +from typing import Generic, TypeVar |
7 | 7 |
|
8 | 8 | from dissect.target.helpers.sunrpc import sunrpc |
9 | 9 |
|
@@ -118,7 +118,7 @@ def _read_int32(self, payload: io.BytesIO) -> int: |
118 | 118 | def _read_uint64(self, payload: io.BytesIO) -> int: |
119 | 119 | return int.from_bytes(payload.read(8), byteorder="big", signed=False) |
120 | 120 |
|
121 | | - def _read_enum(self, payload: io.BytesIO, enum: Type[EnumType]) -> EnumType: |
| 121 | + def _read_enum(self, payload: io.BytesIO, enum: type[EnumType]) -> EnumType: |
122 | 122 | value = self._read_int32(payload) |
123 | 123 | return enum(value) |
124 | 124 |
|
@@ -288,9 +288,9 @@ def _read_rejected_reply(self, payload: io.BytesIO) -> sunrpc.RejectedReply: |
288 | 288 | elif reject_stat == sunrpc.RejectStat.AUTH_ERROR: |
289 | 289 | auth_stat = self._read_enum(payload, sunrpc.AuthStat) |
290 | 290 | return sunrpc.RejectedReply(reject_stat, auth_stat) |
291 | | - else: |
292 | | - # assert_never is slightly better, but only available starting from Python 3.11 |
293 | | - raise ValueError(f"Unexpected value for reject_stat: {reject_stat}") |
| 291 | + |
| 292 | + # assert_never is slightly better, but only available starting from Python 3.11 |
| 293 | + raise ValueError(f"Unexpected value for reject_stat: {reject_stat}") |
294 | 294 |
|
295 | 295 | def _read_mismatch(self, payload: io.BytesIO) -> sunrpc.Mismatch: |
296 | 296 | low = self._read_uint32(payload) |
|
0 commit comments