Skip to content

deprecate abstract method  #72

@bertsky

Description

@bertsky

This is a feature request (I think): I would like deprecated to be able to yield warnings on a method call, even when overriding the implementation in a subclass. In particular, I would like to be able to deprecate abstract methods.

Expected Behavior

Running…

from deprecated import deprecated

class Parent:
    @deprecated(reason='try not to laugh')
    def fun(self, arg):
        raise NotImplementedError()

class Child(Parent):
    def fun(self, arg):
        print(arg)
        print('yaye!')

some = Child()
some.fun('whoops')

…I would like to see…

DeprecationWarning: Call to deprecated method fun. (try not to laugh)
  some.fun('whoops')
whoops
yaye!

Actual Behavior

However, since the method is overriden, I can see no warning:

whoops
yaye!

Environment

  • Python version: 3.9
  • Deprecated version: 1.2.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions