Skip to content

pyreverse duplication issue #7634

@WilliamMiteff

Description

@WilliamMiteff

Bug description

When using pyreverse on the below syntax I get the follow output.

from inspect import currentframe, FrameInfo, getouterframes
from random import randint
from time import sleep
from typing import Any, Literal  # pylint: disable=unused-import

from pandas import (  # pylint: disable=unused-import
    concat,
    DataFrame,
    json_normalize,
    NaT,
    read_sql_query,
    Series,
)

from utils.doless import LOG_ERROR  # pylint: disable=unused-import
from utils.errors import (  # pylint: disable=unused-import
    LoggedException,
    NonLoggedException,
)
from utils.loghelper import get_logger, verbose_logging


class baseclass:
    _verbose: bool = False
    _retryable: bool = False
    _msg: str = ''

    def verbose(self) -> None:
        ...

    def __getcallerfunction(self, back: int = 1) -> str:
        ...

    def __init__(self, friendly_name: str, verbose: bool = False) -> None:
        ...

    def _writer(self, message: str, mode: Literal["info", "debug", "warning", "error", "critical"] = "info") -> None:
        ...

    def sleeptimer(self, max_duration: int = 15) -> None:
        ...
class baseclass {
    _log
    _msg
    _msg
    _retryable
    _verbose
    _verbose
    __getcallerfunction(back: int) str
    __init__(friendly_name: str, verbose: bool) None
    _writer(message: str, mode: Literal['info', 'debug', 'warning', 'error', 'critical']) None
    sleeptimer(max_duration: int) None
    verbose() None
  }

Command used

pyreverse -o mmd -d utils -c baseclass utils/baseclass.py -f ALL -my

Pylint output

class baseclass {
    _log
    _msg
    _msg
    _retryable
    _verbose
    _verbose
    __getcallerfunction(back: int) str
    __init__(friendly_name: str, verbose: bool) None
    _writer(message: str, mode: Literal['info', 'debug', 'warning', 'error', 'critical']) None
    sleeptimer(max_duration: int) None
    verbose() None
  }

Expected behavior

class baseclass {
_log
_msg
_retryable
_verbose
__getcallerfunction(back: int) str
init(friendly_name: str, verbose: bool) None
_writer(message: str, mode: Literal['info', 'debug', 'warning', 'error', 'critical']) None
sleeptimer(max_duration: int) None
verbose() None
}

Pylint version

pylint 2.15.4
astroid 2.12.11
Python 3.9.14 (main, Oct  3 2022, 12:55:59)
[GCC 9.4.0]

OS / Environment

ubuntu 20 (windows 10 wsl)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs triage 📥Just created, needs acknowledgment, triage, and proper labellingpyreverseRelated to pyreverse component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions