@@ -453,7 +453,7 @@ def test_get_msc2858_login_flows(self):
453
453
self .assertEqual (channel .code , 200 , channel .result )
454
454
455
455
# stick the flows results in a dict by type
456
- flow_results = {} # type : Dict[str, Any]
456
+ flow_results : Dict [str , Any ] = {}
457
457
for f in channel .json_body ["flows" ]:
458
458
flow_type = f ["type" ]
459
459
self .assertNotIn (
@@ -501,7 +501,7 @@ def test_multi_sso_redirect(self):
501
501
p .close ()
502
502
503
503
# there should be a link for each href
504
- returned_idps = [] # type: List[str ]
504
+ returned_idps : List [ str ] = [ ]
505
505
for link in p .links :
506
506
path , query = link .split ("?" , 1 )
507
507
self .assertEqual (path , "pick_idp" )
@@ -582,7 +582,7 @@ def test_login_via_oidc(self):
582
582
# ... and should have set a cookie including the redirect url
583
583
cookie_headers = channel .headers .getRawHeaders ("Set-Cookie" )
584
584
assert cookie_headers
585
- cookies = {} # type : Dict[str, str]
585
+ cookies : Dict [str , str ] = {}
586
586
for h in cookie_headers :
587
587
key , value = h .split (";" )[0 ].split ("=" , maxsplit = 1 )
588
588
cookies [key ] = value
@@ -874,9 +874,7 @@ def make_homeserver(self, reactor, clock):
874
874
875
875
def jwt_encode (self , payload : Dict [str , Any ], secret : str = jwt_secret ) -> str :
876
876
# 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 )
880
878
if isinstance (result , bytes ):
881
879
return result .decode ("ascii" )
882
880
return result
@@ -1084,7 +1082,7 @@ def make_homeserver(self, reactor, clock):
1084
1082
1085
1083
def jwt_encode (self , payload : Dict [str , Any ], secret : str = jwt_privatekey ) -> str :
1086
1084
# 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" )
1088
1086
if isinstance (result , bytes ):
1089
1087
return result .decode ("ascii" )
1090
1088
return result
@@ -1272,7 +1270,7 @@ def test_username_picker(self):
1272
1270
self .assertEqual (picker_url , "/_synapse/client/pick_username/account_details" )
1273
1271
1274
1272
# ... with a username_mapping_session cookie
1275
- cookies = {} # type : Dict[str,str]
1273
+ cookies : Dict [str , str ] = {}
1276
1274
channel .extract_cookies (cookies )
1277
1275
self .assertIn ("username_mapping_session" , cookies )
1278
1276
session_id = cookies ["username_mapping_session" ]
0 commit comments