|
2 | 2 |
|
3 | 3 | from functools import cached_property |
4 | 4 | from io import BytesIO |
5 | | -from typing import TYPE_CHECKING, Any, BinaryIO, Union |
| 5 | +from typing import TYPE_CHECKING, Any, BinaryIO |
6 | 6 |
|
7 | 7 | from dissect.util.ts import from_unix, wintimestamp |
8 | 8 |
|
@@ -57,13 +57,13 @@ def __getitem__(self, idx: int | str | c_pe.RT) -> list[Resource] | None: |
57 | 57 | if isinstance(idx, int): |
58 | 58 | return self.resources[idx] |
59 | 59 |
|
60 | | - if isinstance(idx, (str, c_pe.RT)): |
| 60 | + if isinstance(idx, str | c_pe.RT): |
61 | 61 | return self.get(idx) |
62 | 62 |
|
63 | 63 | raise TypeError(f"ResourceDirectory indices must be int, str or RT enum members, not {type(idx).__name__}") |
64 | 64 |
|
65 | 65 | def __contains__(self, idx: str | c_pe.RT) -> bool: |
66 | | - if isinstance(idx, (str, c_pe.RT)): |
| 66 | + if isinstance(idx, str | c_pe.RT): |
67 | 67 | return self.get(idx) is not None |
68 | 68 |
|
69 | 69 | return False |
@@ -108,7 +108,7 @@ def find(self, type: int | str | c_pe.RT, name: str | int) -> Resource | None: |
108 | 108 | if isinstance(name, str): |
109 | 109 | name = TAG_TO_LCID.get(name, name) |
110 | 110 |
|
111 | | - if isinstance(name, (int, c_pe.RT)) and (entry := root.get(name)) is not None: |
| 111 | + if isinstance(name, int | c_pe.RT) and (entry := root.get(name)) is not None: |
112 | 112 | return Resource(type, name, entry) |
113 | 113 |
|
114 | 114 | raise KeyError(f"Resource with type {type.name!r} and name {name!r} not found") |
@@ -268,7 +268,7 @@ def vs_version_info(self, language: str | int | None = None) -> dict | None: |
268 | 268 | if len(version) != 1: |
269 | 269 | raise ValueError(f"Expected exactly one version resource, found {len(version)}") |
270 | 270 |
|
271 | | - _Node: TypeAlias = tuple[str, Union[str, bytes, None], list["_Node"]] |
| 271 | + _Node: TypeAlias = tuple[str, str | bytes | None, list["_Node"]] |
272 | 272 |
|
273 | 273 | def _parse_lvt(fh: BinaryIO) -> _Node | None: |
274 | 274 | start = fh.tell() |
|
0 commit comments