11from __future__ import annotations
22
3+ import itertools
34from abc import ABC , abstractmethod
45from collections import OrderedDict , deque
56from collections .abc import (
4243 runtime_checkable ,
4344)
4445
46+ from type_analyzer import MatchingTypesConfig , matching_types
47+
4548from injection ._core .common .asynchronous import (
4649 AsyncCaller ,
4750 Caller ,
5962 TypeInfo ,
6063 get_return_types ,
6164 get_yield_hint ,
62- standardize_types ,
6365)
6466from injection ._core .injectables import (
6567 AsyncCMScopedInjectable ,
@@ -229,7 +231,6 @@ class Updater[T]:
229231 classes : Iterable [InputType [T ]]
230232 injectable : Injectable [T ]
231233 mode : Mode
232- ignore_none_type : bool
233234
234235 def make_record (self ) -> Record [T ]:
235236 return Record (self .injectable , self .mode )
@@ -241,13 +242,11 @@ def with_basics(
241242 / ,
242243 injectable : Injectable [T ],
243244 mode : Mode | ModeStr ,
244- ignore_none_type : bool = False ,
245245 ) -> Self :
246246 return cls (
247247 classes = get_return_types (on ),
248248 injectable = injectable ,
249249 mode = Mode (mode ),
250- ignore_none_type = ignore_none_type ,
251250 )
252251
253252
@@ -353,18 +352,25 @@ def __keep_new_record[T](
353352
354353 @staticmethod
355354 def __reduce_classes [T ](updater : Updater [T ]) -> frozenset [TypeDef [T ]]:
355+ config = MatchingTypesConfig (ignore_none = True )
356356 return frozenset (
357- standardize_types (
358- * updater .classes ,
359- ignore_none_type = updater .ignore_none_type ,
357+ itertools .chain .from_iterable (
358+ matching_types (cls , config ) for cls in updater .classes
360359 )
361360 )
362361
363362 @staticmethod
364363 def __standardize_inputs [T ](
365364 classes : Iterable [InputType [T ]],
366365 ) -> Iterator [InputType [T ]]:
367- return standardize_types (* classes , with_origin = True )
366+ config = MatchingTypesConfig (
367+ with_bases = True ,
368+ with_origin = True ,
369+ with_type_alias_value = True ,
370+ )
371+
372+ for cls in classes :
373+ yield from matching_types (cls , config )
368374
369375
370376"""
@@ -564,10 +570,9 @@ def reserve_scoped_slot[T](
564570 scope_name : str ,
565571 * ,
566572 mode : Mode | ModeStr = Mode .get_default (),
567- ignore_none_type : bool = False ,
568573 ) -> SlotKey [T ]:
569574 injectable = ScopedSlotInjectable (cls , scope_name )
570- updater = Updater .with_basics (cls , injectable , mode , ignore_none_type )
575+ updater = Updater .with_basics (cls , injectable , mode )
571576 self .update (updater )
572577 return injectable .key
573578
0 commit comments