Skip to content

Commit 8cf7e45

Browse files
committed
fix minor comments
1 parent 0314b25 commit 8cf7e45

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

dissect/target/helpers/nfs/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from __future__ import annotations
22

33
from contextlib import AbstractContextManager
4-
from types import TracebackType
5-
from typing import Generic, Iterator, NamedTuple, TypeVar
4+
from typing import TYPE_CHECKING, Generic, Iterator, NamedTuple, TypeVar
65

76
from dissect.target.helpers.nfs.nfs3 import (
87
CookieVerf3,
@@ -24,6 +23,9 @@
2423
from dissect.target.helpers.sunrpc.client import AuthScheme
2524
from dissect.target.helpers.sunrpc.client import Client as SunRpcClient
2625

26+
if TYPE_CHECKING:
27+
from types import TracebackType
28+
2729
Credentials = TypeVar("Credentials")
2830
Verifier = TypeVar("Verifier")
2931

dissect/target/helpers/sunrpc/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
import socket
55
from contextlib import AbstractContextManager
66
from dataclasses import dataclass
7-
from types import TracebackType
8-
from typing import Generic, TypeVar
7+
from typing import TYPE_CHECKING, Generic, TypeVar
98

10-
from dissect.target.helpers.nfs.nfs3 import ProcedureDescriptor
119
from dissect.target.helpers.sunrpc import sunrpc
1210
from dissect.target.helpers.sunrpc.serializer import (
1311
AuthNullSerializer,
@@ -18,6 +16,12 @@
1816
XdrSerializer,
1917
)
2018

19+
if TYPE_CHECKING:
20+
from types import TracebackType
21+
22+
from dissect.target.helpers.nfs.nfs3 import ProcedureDescriptor
23+
24+
2125
Credentials = TypeVar("Credentials")
2226
Verifier = TypeVar("Verifier")
2327
Params = TypeVar("Params")

dissect/target/helpers/sunrpc/serializer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import io
44
from abc import ABC, abstractmethod
55
from enum import IntEnum
6-
from typing import Generic, Type, TypeVar
6+
from typing import Generic, TypeVar
77

88
from dissect.target.helpers.sunrpc import sunrpc
99

@@ -118,7 +118,7 @@ def _read_int32(self, payload: io.BytesIO) -> int:
118118
def _read_uint64(self, payload: io.BytesIO) -> int:
119119
return int.from_bytes(payload.read(8), byteorder="big", signed=False)
120120

121-
def _read_enum(self, payload: io.BytesIO, enum: Type[EnumType]) -> EnumType:
121+
def _read_enum(self, payload: io.BytesIO, enum: type[EnumType]) -> EnumType:
122122
value = self._read_int32(payload)
123123
return enum(value)
124124

@@ -288,9 +288,9 @@ def _read_rejected_reply(self, payload: io.BytesIO) -> sunrpc.RejectedReply:
288288
elif reject_stat == sunrpc.RejectStat.AUTH_ERROR:
289289
auth_stat = self._read_enum(payload, sunrpc.AuthStat)
290290
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}")
294294

295295
def _read_mismatch(self, payload: io.BytesIO) -> sunrpc.Mismatch:
296296
low = self._read_uint32(payload)

0 commit comments

Comments
 (0)