2020 from typing import TypedDict
2121 from ...interpreterbase import TYPE_var , TYPE_kwargs
2222 from .. import ModuleState
23- from .feature import FeatureKwArgs
2423
2524 class TestKwArgs (TypedDict ):
2625 compiler : Optional [Compiler ]
@@ -109,6 +108,7 @@ def add_target(self, features: Union[FeatureObject, List[FeatureObject]],
109108
110109class Module (NewExtensionModule ):
111110 INFO = ModuleInfo ('features' , '0.1.0' )
111+
112112 def __init__ (self ) -> None :
113113 super ().__init__ ()
114114 self .methods .update ({
@@ -142,7 +142,8 @@ def _set_cache(self, state: 'ModuleState', key: str,
142142 self ._cache_dict (state )[key ] = val
143143
144144 @typed_pos_args ('features.test' , varargs = FeatureObject , min_varargs = 1 )
145- @typed_kwargs ('features.test' ,
145+ @typed_kwargs (
146+ 'features.test' ,
146147 KwargInfo ('compiler' , (NoneType , Compiler )),
147148 KwargInfo ('anyfet' , bool , default = False ),
148149 KwargInfo ('cached' , bool , default = True ),
@@ -255,7 +256,7 @@ def test_any(self, state: 'ModuleState', features: Set[FeatureObject],
255256 features_any = set ()
256257 for fet in all_features :
257258 _ , test_any_result = self .cached_test (
258- state , features = {fet ,},
259+ state , features = {fet , },
259260 compiler = compiler ,
260261 cached = cached ,
261262 anyfet = False ,
@@ -293,7 +294,7 @@ def test(self, state: 'ModuleState', features: Set[FeatureObject],
293294 # Set the highest interested feature
294295 prevalent_features = sorted (features )[- 1 :]
295296
296- prevalent_names = [fet .name for fet in prevalent_features ]
297+ prevalent_names = [fet .name for fet in prevalent_features ]
297298 # prepare the result dict
298299 test_result : 'TestResultKwArgs' = {
299300 'target_name' : '__' .join (prevalent_names ),
@@ -307,6 +308,7 @@ def test(self, state: 'ModuleState', features: Set[FeatureObject],
307308 'is_disabled' : False ,
308309 'fail_reason' : '' ,
309310 }
311+
310312 def fail_result (fail_reason : str , is_disabled : bool = False
311313 ) -> 'TestResultKwArgs' :
312314 test_result .update ({
@@ -337,7 +339,7 @@ def fail_result(fail_reason: str, is_disabled: bool = False
337339 predecessor_features = implied_features .difference (_caller )
338340 for fet in sorted (predecessor_features ):
339341 _ , pred_result = self .cached_test (
340- state , features = {fet ,},
342+ state , features = {fet , },
341343 compiler = compiler ,
342344 cached = cached ,
343345 anyfet = False ,
@@ -431,7 +433,8 @@ def fail_result(fail_reason: str, is_disabled: bool = False
431433 build .GeneratedList , build .StructuredSources , build .ExtractedObjects ,
432434 build .BuildTarget
433435 ))
434- @typed_kwargs ('features.multi_targets' ,
436+ @typed_kwargs (
437+ 'features.multi_targets' ,
435438 KwargInfo (
436439 'dispatch' , (
437440 ContainerTypeInfo (list , (FeatureObject , list )),
@@ -451,8 +454,8 @@ def fail_result(fail_reason: str, is_disabled: bool = False
451454 allow_unknown = True
452455 )
453456 def multi_targets_method (self , state : 'ModuleState' ,
454- args : Tuple [str ], kwargs : 'TYPE_kwargs'
455- ) -> TargetsObject :
457+ args : Tuple [str ], kwargs : 'TYPE_kwargs'
458+ ) -> TargetsObject :
456459 config_name = args [0 ]
457460 sources = args [1 ] # type: ignore
458461 dispatch : List [Union [FeatureObject , List [FeatureObject ]]] = (
@@ -467,7 +470,7 @@ def multi_targets_method(self, state: 'ModuleState',
467470 if not compiler :
468471 compiler = get_compiler (state )
469472
470- baseline_features : Set [FeatureObject ] = set ()
473+ baseline_features : Set [FeatureObject ] = set ()
471474 has_baseline = baseline is not None
472475 if has_baseline :
473476 baseline_features = FeatureObject .get_implicit_combine_multi (baseline )
@@ -488,7 +491,7 @@ def multi_targets_method(self, state: 'ModuleState',
488491 ]] = []
489492 for d in dispatch :
490493 if isinstance (d , FeatureObject ):
491- target = {d ,}
494+ target = {d , }
492495 is_base_part = d in baseline_features
493496 else :
494497 target = set (d )
@@ -647,7 +650,7 @@ def gen_config(self, state: 'ModuleState', config_name: str,
647650 c_detect = '1'
648651 dispatch_calls .append (
649652 f'{ prefix } _MTARGETS_EXPAND('
650- f'EXEC_CB({ c_detect } , { test ["target_name" ]} , __VA_ARGS__)'
653+ f'EXEC_CB({ c_detect } , { test ["target_name" ]} , __VA_ARGS__)'
651654 ')'
652655 )
653656
@@ -683,7 +686,8 @@ def gen_config(self, state: 'ModuleState', config_name: str,
683686 return config_path
684687
685688 @typed_pos_args ('features.sort' , varargs = FeatureObject , min_varargs = 1 )
686- @typed_kwargs ('features.sort' ,
689+ @typed_kwargs (
690+ 'features.sort' ,
687691 KwargInfo ('reverse' , bool , default = False ),
688692 )
689693 def sort_method (self , state : 'ModuleState' ,
0 commit comments