Skip to content

Inherited factory function annotation #1499

Answered by bloussou
bloussou asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,
I think this is not fully fixed. In 1.113 it's possible to remove the #type : ignore but there is still issue in Configuration._from_dict.
To reproduce :

from __future__ import annotations

from typing import Any, Mapping, Type, TypeVar

from abc import ABC, abstractmethod
from typing import Any, Mapping, Type, TypeVar

_FromDict = TypeVar("_FromDict", bound="FromDict")

class FromDict(ABC):

    @classmethod
    @abstractmethod
    def _from_dict(
        cls: Type[_FromDict], data: Mapping[str, Any]
    ) -> _FromDict:
        pass

_Configuration = TypeVar("_Configuration", bound="Configuration")
class Configuration(FromDict):
    @classmethod
    def _create(cls: Type[_Configur…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@erictraut
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@erictraut
Comment options

@bloussou
Comment options

Answer selected by bloussou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants