1- import sys
1+ import builtins
22import re
3+ import sys
4+ from io import BufferedReader , IOBase
35from struct import Struct , unpack
4- from io import IOBase , BufferedReader
5-
6- import builtins
76from typing import Callable , List , Optional , Tuple , Union
87
98reNot0 = re .compile (b"(.*?)\x00 " , re .S )
109
1110SYS_ENDIAN = "<" if sys .byteorder == "little" else ">"
1211
13- from ..math import Color , Matrix4x4 , Quaternion , Vector2 , Vector3 , Vector4 , Rectangle
12+ from ..math import Color , Matrix4x4 , Quaternion , Rectangle , Vector2 , Vector3 , Vector4
1413
1514# generate unpack and unpack_from functions
1615TYPE_PARAM_SIZE_LIST = [
@@ -127,7 +126,7 @@ def read_double(self) -> float:
127126 def read_boolean (self ) -> bool :
128127 return bool (unpack (self .endian + "?" , self .read (1 ))[0 ])
129128
130- def read_string (self , size = None , encoding = "utf8" ) -> str :
129+ def read_string (self , size : Optional [ int ] = None , encoding : str = "utf8" ) -> str :
131130 if size is None :
132131 ret = self .read_string_to_null ()
133132 else :
@@ -137,7 +136,7 @@ def read_string(self, size=None, encoding="utf8") -> str:
137136 except UnicodeDecodeError :
138137 return ret
139138
140- def read_string_to_null (self , max_length = 32767 ) -> str :
139+ def read_string_to_null (self , max_length : int = 32767 ) -> str :
141140 ret = []
142141 c = b""
143142 while c != b"\0 " and len (ret ) < max_length and self .Position != self .Length :
@@ -232,7 +231,9 @@ def read_long_array(self, length: Optional[int] = None) -> Tuple[int, ...]:
232231 def read_u_long_array (self , length : Optional [int ] = None ) -> Tuple [int , ...]:
233232 return self .read_array_struct ("Q" , length )
234233
235- def read_u_int_array_array (self , length : Optional [int ] = None ) -> List [Tuple [int , ...]]:
234+ def read_u_int_array_array (
235+ self , length : Optional [int ] = None
236+ ) -> List [Tuple [int , ...]]:
236237 return self .read_array (
237238 self .read_u_int_array , length if length is not None else self .read_int ()
238239 )
0 commit comments