From a2e89221d9745f5804c0e1b855235a971ee0f4b4 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Sat, 15 Feb 2025 13:52:15 +0000 Subject: [PATCH] Fix ``PartialMixin.next_step`` type annotation Also: - Improve annotation of `PartialMixin.data` - Remove unused `user` attribute of `UserMixin`, which may create type annotation conflicts in derived classes: https://github.com/galaxyproject/galaxy/issues/19617 --- social_core/storage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/social_core/storage.py b/social_core/storage.py index 57f583f6..b08479bb 100644 --- a/social_core/storage.py +++ b/social_core/storage.py @@ -7,6 +7,7 @@ import uuid from abc import abstractmethod from datetime import datetime, timedelta, timezone +from typing import Any from openid.association import Association as OpenIdAssociation @@ -20,7 +21,6 @@ class UserMixin: # Consider tokens that expire in 5 seconds as already expired ACCESS_TOKEN_EXPIRED_THRESHOLD = 5 - user = "" provider = "" uid = None extra_data = None @@ -292,8 +292,8 @@ def get_code(cls, code): class PartialMixin: token = "" - data = {} - next_step = "" + data: dict[str, Any] = {} + next_step: int backend = "" @property @@ -328,7 +328,7 @@ def destroy(cls, token): raise NotImplementedError("Implement in subclass") @classmethod - def prepare(cls, backend, next_step, data): + def prepare(cls, backend, next_step: int, data: dict[str, Any]): partial = cls() partial.backend = backend partial.next_step = next_step