File tree 4 files changed +10
-7
lines changed
src/mercury_engine_data_structures
4 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1
1
[options.package_data]
2
2
mercury_engine_data_structures =
3
+ py.typed
3
4
*.bin
4
5
5
6
[options.exclude_package_data]
Original file line number Diff line number Diff line change 1
1
import copy
2
2
import functools
3
3
import typing
4
+ from collections .abc import Sequence
4
5
5
6
import construct
6
7
from construct .core import (
@@ -597,12 +598,13 @@ def copy_fields_from(self, value: ComponentFields):
597
598
if self .target_game == Game .DREAD :
598
599
self .raw .extra_fields = value .parent .raw .extra_fields
599
600
601
+ # FIXME: mypy doesn't support getter/setter with different types: https://github.com/python/mypy/issues/13127
600
602
@property
601
- def functions (self ) -> tuple [ActorDefFunc , ... ]:
603
+ def functions (self ) -> Sequence [ActorDefFunc ]:
602
604
return tuple (ActorDefFunc (func ) for func in self .raw .functions )
603
605
604
606
@functions .setter
605
- def functions (self , value : typing . Iterable [ActorDefFunc ]):
607
+ def functions (self , value : Sequence [ActorDefFunc ]):
606
608
self .raw .functions = ListContainer (
607
609
Container (func .raw ) for func in value
608
610
)
Original file line number Diff line number Diff line change @@ -37,18 +37,18 @@ def system_files_name(cls) -> str:
37
37
38
38
def get_size_for (self , asset_id : NameOrAssetId ) -> Optional [int ]:
39
39
asset_id = resolve_asset_id (asset_id , self .target_game )
40
- return self .raw .files .get (asset_id )
40
+ return self ._raw .files .get (asset_id )
41
41
42
42
def add_file (self , asset_id : NameOrAssetId , file_size : int ):
43
43
asset_id = resolve_asset_id (asset_id , self .target_game )
44
- self .raw .files [asset_id ] = file_size
44
+ self ._raw .files [asset_id ] = file_size
45
45
46
46
def remove_file (self , asset_id : NameOrAssetId ):
47
47
resolved_asset_id = resolve_asset_id (asset_id , self .target_game )
48
- if resolved_asset_id not in self .raw .files :
48
+ if resolved_asset_id not in self ._raw .files :
49
49
raise ValueError (f"Unknown asset_id: { asset_id } " )
50
50
51
- del self .raw .files [resolved_asset_id ]
51
+ del self ._raw .files [resolved_asset_id ]
52
52
53
53
def get_all_asset_id (self ) -> Iterator [int ]:
54
- yield from self .raw .files .keys ()
54
+ yield from self ._raw .files .keys ()
You can’t perform that action at this time.
0 commit comments