@@ -183,30 +183,30 @@ def handle_response(self, response: "GetResponse") -> None:
183183
184184class LazySessionOperations :
185185 def __init__ (self , delegate : DocumentSession ):
186- self ._delegate = delegate
186+ self ._session = delegate
187187
188188 def include (self , path : str ) -> LazyMultiLoaderWithInclude :
189- return LazyMultiLoaderWithInclude (self ._delegate ).include (path )
189+ return LazyMultiLoaderWithInclude (self ._session ).include (path )
190190
191191 def load (
192- self , ids : Union [List [str ], str ], object_type : Type [_T ], on_eval : Callable = None
192+ self , ids : Union [List [str ], str ], object_type : Optional [ Type [_T ]] = None , on_eval : Callable = None
193193 ) -> Optional [Lazy [Union [Dict [str , object ], object ]]]:
194194 if not ids :
195195 return None
196196
197197 if isinstance (ids , str ):
198198 key = ids
199- if self ._delegate .advanced .is_loaded (key ):
200- return Lazy (lambda : self ._delegate .load (key , object_type ))
199+ if self ._session .advanced .is_loaded (key ):
200+ return Lazy (lambda : self ._session .load (key , object_type ))
201201
202202 lazy_load_operation = LazyLoadOperation (
203- object_type , self ._delegate , LoadOperation (self ._delegate ).by_key (key )
203+ object_type , self ._session , LoadOperation (self ._session ).by_key (key )
204204 ).by_key (key )
205205
206- return self ._delegate .add_lazy_operation (object_type , lazy_load_operation , on_eval )
206+ return self ._session .add_lazy_operation (object_type , lazy_load_operation , on_eval )
207207
208208 elif isinstance (ids , list ):
209- return self ._delegate .lazy_load_internal (object_type , ids , [], on_eval )
209+ return self ._session .lazy_load_internal (object_type , ids , [], on_eval )
210210
211211 raise TypeError (f"Expected a 'str' or 'list' of 'str', the document ids. Got '{ type (ids ).__name__ } '." )
212212
@@ -221,24 +221,24 @@ def load_starting_with(
221221 start_after : str = None ,
222222 ) -> Lazy [Dict [str , _T ]]:
223223 operation = LazyStartsWithOperation (
224- object_type , id_prefix , matches , exclude , start , page_size , self ._delegate , start_after
224+ object_type , id_prefix , matches , exclude , start , page_size , self ._session , start_after
225225 )
226226
227- return self ._delegate .add_lazy_operation (dict , operation , None )
227+ return self ._session .add_lazy_operation (dict , operation , None )
228228
229229 def conditional_load (
230- self , key : str , change_vector : str , object_type : Type [_T ] = None
230+ self , key : str , change_vector : str , object_type : Optional [ Type [_T ] ] = None
231231 ) -> Lazy [ConditionalLoadResult [_T ]]:
232232 if not key or key .isspace ():
233233 raise ValueError ("key cannot be None or whitespace" )
234234
235- if self ._delegate .is_loaded (key ):
235+ if self ._session .is_loaded (key ):
236236
237237 def __lazy_factory ():
238- entity = self ._delegate .load (key , object_type )
238+ entity = self ._session .load (key , object_type )
239239 if entity is None :
240240 return ConditionalLoadResult .create (None , None )
241- cv = self ._delegate .advanced .get_change_vector_for (entity )
241+ cv = self ._session .advanced .get_change_vector_for (entity )
242242 return ConditionalLoadResult .create (entity , cv )
243243
244244 return Lazy (__lazy_factory )
@@ -249,8 +249,8 @@ def __lazy_factory():
249249 f"conditional load when change_vector is None or empty"
250250 )
251251
252- lazy_load_operation = LazyConditionalLoadOperation (object_type , key , change_vector , self ._delegate )
253- return self ._delegate .add_lazy_operation (ConditionalLoadResult , lazy_load_operation , None )
252+ lazy_load_operation = LazyConditionalLoadOperation (object_type , key , change_vector , self ._session )
253+ return self ._session .add_lazy_operation (ConditionalLoadResult , lazy_load_operation , None )
254254
255255
256256class LazyLoadOperation (LazyOperation ):
0 commit comments