@@ -453,7 +453,7 @@ def test_get_msc2858_login_flows(self):
453453 self .assertEqual (channel .code , 200 , channel .result )
454454
455455 # stick the flows results in a dict by type
456- flow_results = {} # type : Dict[str, Any]
456+ flow_results : Dict [str , Any ] = {}
457457 for f in channel .json_body ["flows" ]:
458458 flow_type = f ["type" ]
459459 self .assertNotIn (
@@ -501,7 +501,7 @@ def test_multi_sso_redirect(self):
501501 p .close ()
502502
503503 # there should be a link for each href
504- returned_idps = [] # type: List[str ]
504+ returned_idps : List [ str ] = [ ]
505505 for link in p .links :
506506 path , query = link .split ("?" , 1 )
507507 self .assertEqual (path , "pick_idp" )
@@ -582,7 +582,7 @@ def test_login_via_oidc(self):
582582 # ... and should have set a cookie including the redirect url
583583 cookie_headers = channel .headers .getRawHeaders ("Set-Cookie" )
584584 assert cookie_headers
585- cookies = {} # type : Dict[str, str]
585+ cookies : Dict [str , str ] = {}
586586 for h in cookie_headers :
587587 key , value = h .split (";" )[0 ].split ("=" , maxsplit = 1 )
588588 cookies [key ] = value
@@ -874,9 +874,7 @@ def make_homeserver(self, reactor, clock):
874874
875875 def jwt_encode (self , payload : Dict [str , Any ], secret : str = jwt_secret ) -> str :
876876 # PyJWT 2.0.0 changed the return type of jwt.encode from bytes to str.
877- result = jwt .encode (
878- payload , secret , self .jwt_algorithm
879- ) # type: Union[str, bytes]
877+ result : Union [str , bytes ] = jwt .encode (payload , secret , self .jwt_algorithm )
880878 if isinstance (result , bytes ):
881879 return result .decode ("ascii" )
882880 return result
@@ -1084,7 +1082,7 @@ def make_homeserver(self, reactor, clock):
10841082
10851083 def jwt_encode (self , payload : Dict [str , Any ], secret : str = jwt_privatekey ) -> str :
10861084 # PyJWT 2.0.0 changed the return type of jwt.encode from bytes to str.
1087- result = jwt .encode (payload , secret , "RS256" ) # type: Union[bytes,str]
1085+ result : Union [ bytes , str ] = jwt .encode (payload , secret , "RS256" )
10881086 if isinstance (result , bytes ):
10891087 return result .decode ("ascii" )
10901088 return result
@@ -1272,7 +1270,7 @@ def test_username_picker(self):
12721270 self .assertEqual (picker_url , "/_synapse/client/pick_username/account_details" )
12731271
12741272 # ... with a username_mapping_session cookie
1275- cookies = {} # type : Dict[str,str]
1273+ cookies : Dict [str , str ] = {}
12761274 channel .extract_cookies (cookies )
12771275 self .assertIn ("username_mapping_session" , cookies )
12781276 session_id = cookies ["username_mapping_session" ]
0 commit comments