|
1 | | -from ..enums import FileType |
2 | | -from ..helpers import ImportHelper |
3 | | -from ..streams import EndianBinaryReader, EndianBinaryWriter |
| 1 | +from __future__ import annotations |
4 | 2 |
|
5 | 3 | from collections import namedtuple |
6 | 4 | from os.path import basename |
| 5 | +from typing import TYPE_CHECKING, Dict, Optional |
| 6 | + |
| 7 | +from ..helpers import ImportHelper |
| 8 | +from ..streams import EndianBinaryReader, EndianBinaryWriter |
| 9 | + |
| 10 | +if TYPE_CHECKING: |
| 11 | + from ..environment import Environment |
7 | 12 |
|
8 | 13 | DirectoryInfo = namedtuple("DirectoryInfo", "path offset size") |
9 | 14 |
|
10 | 15 |
|
11 | 16 | class File(object): |
12 | 17 | name: str |
13 | | - files: dict |
14 | | - environment: "Environment" |
| 18 | + files: Dict[str, File] |
| 19 | + environment: Environment |
15 | 20 | cab_file: str |
16 | 21 | is_changed: bool |
17 | 22 | signature: str |
18 | 23 | packer: str |
19 | 24 | is_dependency: bool |
20 | | - |
21 | | - # parent: File |
22 | | - # environment: Environment |
23 | | - |
24 | | - def __init__(self, parent=None, name: str = None, is_dependency: bool = False): |
| 25 | + parent: Optional[File] |
| 26 | + |
| 27 | + def __init__( |
| 28 | + self, |
| 29 | + parent: Optional[File] = None, |
| 30 | + name: Optional[str] = None, |
| 31 | + is_dependency: bool = False, |
| 32 | + ): |
25 | 33 | self.files = {} |
26 | 34 | self.is_changed = False |
27 | 35 | self.cab_file = "CAB-UnityPy_Mod.resS" |
@@ -154,4 +162,4 @@ def mark_changed(self): |
154 | 162 |
|
155 | 163 |
|
156 | 164 | # recursive import requires the import down here |
157 | | -from . import BundleFile, SerializedFile, WebFile, ObjectReader |
| 165 | +from . import BundleFile, ObjectReader, SerializedFile, WebFile |
0 commit comments