1- from _typeshed import SliceableBuffer
1+ from _typeshed import SliceableBuffer , Unused
22from collections .abc import Sequence
3- from typing import Literal , Protocol
3+ from typing import Any , Protocol , type_check_only
44from typing_extensions import TypeAlias
55
66_FourIntSequence : TypeAlias = Sequence [int ]
77_TwoIntSequence : TypeAlias = Sequence [int ]
88
9+ @type_check_only
910class _Kid (Protocol ):
1011 def toRaw (self ) -> bytes : ...
1112 def __str__ (self , indent : str = "" , / ) -> str : ...
1213
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
1418class VSVersionInfo :
1519 ffi : FixedFileInfo | None
1620 kids : list [_Kid ]
1721 def __init__ (self , ffi : FixedFileInfo | None = None , kids : list [_Kid ] | None = None ) -> None : ...
1822 def fromRaw (self , data : SliceableBuffer ) -> int : ...
1923 def toRaw (self ) -> bytes : ...
20- def __eq__ (self , other : object ) -> bool : ...
2124 def __str__ (self , indent : str = "" ) -> str : ...
2225
2326class FixedFileInfo :
24- sig : Literal [ 0xFEEF04BD ]
25- strucVersion : Literal [ 0x10000 ]
27+ sig : int
28+ strucVersion : int
2629 fileVersionMS : int
2730 fileVersionLS : int
2831 productVersionMS : int
@@ -36,16 +39,61 @@ class FixedFileInfo:
3639 fileDateLS : int
3740 def __init__ (
3841 self ,
39- filevers : _FourIntSequence = ... ,
40- prodvers : _FourIntSequence = ... ,
42+ filevers : _FourIntSequence = ( 0 , 0 , 0 , 0 ) ,
43+ prodvers : _FourIntSequence = ( 0 , 0 , 0 , 0 ) ,
4144 mask : int = 0x3F ,
4245 flags : int = 0x0 ,
4346 OS : int = 0x40004 ,
4447 fileType : int = 0x1 ,
4548 subtype : int = 0x0 ,
46- date : _TwoIntSequence = ... ,
49+ date : _TwoIntSequence = ( 0 , 0 ) ,
4750 ) -> None : ...
4851 def fromRaw (self , data : SliceableBuffer , i : int ) -> int : ...
4952 def toRaw (self ) -> bytes : ...
50- def __eq__ (self , other : object ) -> bool : ...
5153 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