-
from abc import ABC, abstractmethod
from typing import TypeVar
from src.internal.core import entities, dtos
Entity = TypeVar("Entity")
CreateDto = TypeVar("CreateDto")
UpdateDto = TypeVar("UpdateDto")
class BaseDao[Entity, CreateDto, UpdateDto](ABC):
@abstractmethod
def create(self, *_, **kwargs: CreateDto) -> Entity | None:
return NotImplemented
@abstractmethod
def find_all(self) -> list[Entity] | None:
return NotImplemented
@abstractmethod
def find_by_id(self, uid: str) -> Entity | None:
return NotImplemented
@abstractmethod
def update(self, uid: str, **kwargs: UpdateDto) -> Entity | None:
return NotImplemented
@abstractmethod
def delete(self, uid: str) -> None:
return NotImplemented
class UserDao(BaseDao[entities.User, dtos.CreateUserDto, dtos.UpdateUserDto]):
pass I extended BaseDao for UserDao, and it's giving me Value 'BaseDao' is unsubscriptablePylint[E1136:unsubscriptable-object](https://pylint.readthedocs.io/en/latest/user_guide/messages/error/unsubscriptable-object.html) Is this my code wrong, or Pylance is not detecting the code correctly? |
Beta Was this translation helpful? Give feedback.
Answered by
rchiodo
Jan 8, 2024
Replies: 1 comment
-
Your error is from pylint, not Pylance. You could ask a question about it here: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kzmsdkn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your error is from pylint, not Pylance.
You could ask a question about it here:
https://github.com/pylint-dev/pylint