refactor: clean up code by adding missing commas and improving import order
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Dict, Any, Optional
|
||||
from typing import Any
|
||||
|
||||
from authlib.integrations.flask_client import OAuth
|
||||
|
||||
|
||||
@@ -16,23 +17,19 @@ class OAuthProvider(ABC):
|
||||
@abstractmethod
|
||||
def name(self) -> str:
|
||||
"""Provider name (e.g., 'google', 'github')."""
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def display_name(self) -> str:
|
||||
"""Human-readable provider name (e.g., 'Google', 'GitHub')."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_client_config(self) -> Dict[str, Any]:
|
||||
def get_client_config(self) -> dict[str, Any]:
|
||||
"""Return OAuth client configuration."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_user_info(self, token: Dict[str, Any]) -> Dict[str, Any]:
|
||||
def get_user_info(self, token: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Extract user information from OAuth token response."""
|
||||
pass
|
||||
|
||||
def get_client(self):
|
||||
"""Get or create OAuth client."""
|
||||
@@ -52,14 +49,14 @@ class OAuthProvider(ABC):
|
||||
return client.authorize_redirect(redirect_uri).location
|
||||
|
||||
def exchange_code_for_token(
|
||||
self, code: str = None, redirect_uri: str = None
|
||||
) -> Dict[str, Any]:
|
||||
self, code: str = None, redirect_uri: str = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Exchange authorization code for access token."""
|
||||
client = self.get_client()
|
||||
token = client.authorize_access_token()
|
||||
return token
|
||||
|
||||
def normalize_user_data(self, user_info: Dict[str, Any]) -> Dict[str, Any]:
|
||||
def normalize_user_data(self, user_info: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Normalize user data to common format."""
|
||||
return {
|
||||
"id": user_info.get("id"),
|
||||
|
||||
Reference in New Issue
Block a user