Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E1136: Unsubscriptable-object Error #9350

Closed
kzmsdkn opened this issue Jan 8, 2024 · 1 comment
Closed

E1136: Unsubscriptable-object Error #9350

kzmsdkn opened this issue Jan 8, 2024 · 1 comment
Labels
C: unsubscriptable-object Issues related to 'unsubscriptable-object' check Duplicate 🐫 Duplicate of an already existing issue python 3.12 typing

Comments

@kzmsdkn
Copy link

kzmsdkn commented Jan 8, 2024

Bug description

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

Configuration

No response

Command used

vscode pylint extension

Pylint output

Value 'BaseDao' is unsubscriptablePylint[E1136:unsubscriptable-object](https://pylint.readthedocs.io/en/latest/user_guide/messages/error/unsubscriptable-object.html)

Expected behavior

Is this my code wrong, or pylint is not detecting the code correctly?
If I add more methods to UserDao, the error's gone. However, I just want to prevent redundant abstract classes.

Pylint version

v2023.11.13481007

OS / Environment

macos

Additional dependencies

No response

@kzmsdkn kzmsdkn added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jan 8, 2024
@jacobtylerwalls
Copy link
Member

Thanks for the report. Will be closing as a duplicate of a slimmer example reported and triaged in #9406

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2024
@jacobtylerwalls jacobtylerwalls added Duplicate 🐫 Duplicate of an already existing issue typing C: unsubscriptable-object Issues related to 'unsubscriptable-object' check python 3.12 and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: unsubscriptable-object Issues related to 'unsubscriptable-object' check Duplicate 🐫 Duplicate of an already existing issue python 3.12 typing
Projects
None yet
Development

No branches or pull requests

2 participants