1
- from _typeshed import SliceableBuffer
1
+ from _typeshed import SliceableBuffer , Unused
2
2
from collections .abc import Sequence
3
- from typing import Literal , Protocol
3
+ from typing import Any , Protocol , type_check_only
4
4
from typing_extensions import TypeAlias
5
5
6
6
_FourIntSequence : TypeAlias = Sequence [int ]
7
7
_TwoIntSequence : TypeAlias = Sequence [int ]
8
8
9
+ @type_check_only
9
10
class _Kid (Protocol ):
10
11
def toRaw (self ) -> bytes : ...
11
12
def __str__ (self , indent : str = "" , / ) -> str : ...
12
13
13
- # Used by other types referenced in https://pyinstaller.org/en/stable/spec-files.html#spec-file-operation
14
+ # All the classes below are used in version_file_info generated by `pyi-grab_version`
15
+ # See: https://pyinstaller.org/en/stable/usage.html#capturing-windows-version-data
16
+
17
+ # VSVersionInfo is also by other types referenced in https://pyinstaller.org/en/stable/spec-files.html#spec-file-operation
14
18
class VSVersionInfo :
15
19
ffi : FixedFileInfo | None
16
20
kids : list [_Kid ]
17
21
def __init__ (self , ffi : FixedFileInfo | None = None , kids : list [_Kid ] | None = None ) -> None : ...
18
22
def fromRaw (self , data : SliceableBuffer ) -> int : ...
19
23
def toRaw (self ) -> bytes : ...
20
- def __eq__ (self , other : object ) -> bool : ...
21
24
def __str__ (self , indent : str = "" ) -> str : ...
22
25
23
26
class FixedFileInfo :
24
- sig : Literal [ 0xFEEF04BD ]
25
- strucVersion : Literal [ 0x10000 ]
27
+ sig : int
28
+ strucVersion : int
26
29
fileVersionMS : int
27
30
fileVersionLS : int
28
31
productVersionMS : int
@@ -36,16 +39,61 @@ class FixedFileInfo:
36
39
fileDateLS : int
37
40
def __init__ (
38
41
self ,
39
- filevers : _FourIntSequence = ... ,
40
- prodvers : _FourIntSequence = ... ,
42
+ filevers : _FourIntSequence = ( 0 , 0 , 0 , 0 ) ,
43
+ prodvers : _FourIntSequence = ( 0 , 0 , 0 , 0 ) ,
41
44
mask : int = 0x3F ,
42
45
flags : int = 0x0 ,
43
46
OS : int = 0x40004 ,
44
47
fileType : int = 0x1 ,
45
48
subtype : int = 0x0 ,
46
- date : _TwoIntSequence = ... ,
49
+ date : _TwoIntSequence = ( 0 , 0 ) ,
47
50
) -> None : ...
48
51
def fromRaw (self , data : SliceableBuffer , i : int ) -> int : ...
49
52
def toRaw (self ) -> bytes : ...
50
- def __eq__ (self , other : object ) -> bool : ...
51
53
def __str__ (self , indent : str = "" ) -> str : ...
54
+
55
+ class StringFileInfo :
56
+ name : str
57
+ kids : list [_Kid ]
58
+ def __init__ (self , kids : list [_Kid ] | None = None ) -> None : ...
59
+ def fromRaw (self , sublen : Unused , vallen : Unused , name : str , data : SliceableBuffer , i : int , limit : int ) -> int : ...
60
+ def toRaw (self ) -> bytes : ...
61
+ def __str__ (self , indent : str = "" ) -> str : ...
62
+
63
+ class StringTable :
64
+ name : str
65
+ kids : list [_Kid ]
66
+ def __init__ (self , name : str | None = None , kids : list [_Kid ] | None = None ) -> None : ...
67
+ def fromRaw (self , data : SliceableBuffer , i : int , limit : int ) -> int : ...
68
+ def toRaw (self ) -> bytes : ...
69
+ def __str__ (self , indent : str = "" ) -> str : ...
70
+
71
+ class StringStruct :
72
+ name : str
73
+ val : str
74
+ def __init__ (self , name : str | None = None , val : str | None = None ) -> None : ...
75
+ def fromRaw (self , data : SliceableBuffer , i : int , limit : int ) -> int : ...
76
+ def toRaw (self ) -> bytes : ...
77
+ def __str__ (self , indent : Unused = "" ) -> str : ...
78
+
79
+ class VarFileInfo :
80
+ kids : list [_Kid ]
81
+ def __init__ (self , kids : list [_Kid ] | None = None ) -> None : ...
82
+ sublen : int
83
+ vallen : int
84
+ name : str
85
+ def fromRaw (self , sublen : int , vallen : int , name : str , data : SliceableBuffer , i : int , limit : int ) -> int : ...
86
+ wType : int
87
+ def toRaw (self ) -> bytes : ...
88
+ def __str__ (self , indent : str = "" ) -> str : ...
89
+
90
+ class VarStruct :
91
+ name : str
92
+ kids : list [Any ] # Whatever can be passed to struct.pack
93
+ def __init__ (self , name : str | None = None , kids : list [Any ] | None = None ) -> None : ...
94
+ def fromRaw (self , data : SliceableBuffer , i : int , limit : Unused ) -> int : ...
95
+ wValueLength : int
96
+ wType : int
97
+ sublen : int
98
+ def toRaw (self ) -> bytes : ...
99
+ def __str__ (self , indent : Unused = "" ) -> str : ...
0 commit comments