@@ -491,11 +491,11 @@ def _upload(self, response):
491491 "The upload was successful, but content_uri wasn't found."
492492 )
493493
494- def _mkroom (self , response = None , room_id_or_alias = None ):
494+ def _mkroom (self , room_id_or_alias = None , response = None ):
495495 if response and "room_id" in response :
496496 room_id_or_alias = response ["room_id" ]
497- self .rooms [room_id_or_alias ] = Room (self , room_id )
498- return self .rooms [room_id ]
497+ self .rooms [room_id_or_alias ] = Room (self , room_id_or_alias )
498+ return self .rooms [room_id_or_alias ]
499499
500500 def _process_state_event (self , state_event , current_room ):
501501 if "type" not in state_event :
@@ -593,14 +593,32 @@ def remove_room_alias(self, room_alias):
593593 return False
594594
595595 def _async_call (self , first_callback , final_callback ):
596- """Call `final_callback` on result of `first_callback` asynchronously"""
596+ """Call `final_callback` on result of `first_callback` asynchronously
597+
598+ Args:
599+ first_callback(callable): Callable with 0 args to be called first
600+ final_callback(callable): Callable with 1 arg whose result will be
601+ returned. Called with output from first_callback.
602+
603+ Returns:
604+ AsyncResult: Promise for the result of final_callback.
605+ """
597606 first_result = AsyncResult ()
598- self .queue .put ((first_callback , first_result ))
607+ self .queue .matrix_put ((first_callback , first_result ))
599608 final_result = AsyncResult ()
600609 # lambda function will wait for first_result to be fulfilled
601- self .queue .put ( lambda : final_callback (first_result .get ()), final_result )
610+ self .queue .matrix_put (( lambda : final_callback (first_result .get ()), final_result ) )
602611 return final_result
603612
604613 def _sync_call (self , first_callback , final_callback ):
605- """Call `final_callback` on result of `first_callback` synchronously"""
614+ """Call `final_callback` on result of `first_callback` synchronously
615+
616+ Args:
617+ first_callback(callable): Callable with 0 args to be called first
618+ final_callback(callable): Callable with 1 arg whose result will be
619+ returned. Called with output from first_callback.
620+
621+ Returns:
622+ Object: Result of final_callback
623+ """
606624 return final_callback (first_callback ())
0 commit comments