77
88import datetime
99from calendar import timegm
10- from typing import TYPE_CHECKING , Any , Literal
10+ from typing import TYPE_CHECKING , Any , Literal , cast
1111
1212from social_core .backends .open_id_connect import OpenIdConnectAuth
1313from social_core .exceptions import AuthCanceled , AuthTokenError
@@ -75,7 +75,12 @@ class LinkedinOAuth2(BaseOAuth2):
7575 def user_details_url (self ):
7676 # use set() since LinkedIn fails when values are duplicated
7777 fields_selectors = list (
78- {"id" , "firstName" , "lastName" , * self .setting ("FIELD_SELECTORS" , [])}
78+ {
79+ "id" ,
80+ "firstName" ,
81+ "lastName" ,
82+ * cast ("list[str]" , self .setting ("FIELD_SELECTORS" , [])),
83+ }
7984 )
8085 # user sort to ease the tests URL mocking
8186 fields_selectors .sort ()
@@ -90,7 +95,9 @@ def user_data(self, access_token: str, *args, **kwargs) -> dict[str, Any] | None
9095 self .user_details_url (), headers = self .user_data_headers (access_token )
9196 )
9297
93- if "emailAddress" in set (self .setting ("FIELD_SELECTORS" , [])):
98+ if "emailAddress" in set (
99+ cast ("list[str]" , self .setting ("FIELD_SELECTORS" , []))
100+ ):
94101 emails = self .email_data (access_token , * args , ** kwargs )
95102 if emails :
96103 response ["emailAddress" ] = emails [0 ]
0 commit comments