Python Package Deprecated: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=External= * https://pypi.org/project/Deprecated/ =Internal= * Python Language =Overview= <syntaxhighlight lang='py'> from deprecated impo...")
 
 
Line 22: Line 22:
obj = SomeClass()
obj = SomeClass()
obj.some_old_method(5, 8)
obj.some_old_method(5, 8)
</syntaxhighlight>
=<tt>requirements.txt</tt>=
<syntaxhighlight lang='text'>
Deprecated == 1.2.13
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 06:05, 30 August 2022

External

Internal

Overview

from deprecated import deprecated


@deprecated(version='1.2.1', reason="You should use another function")
def some_old_function(x, y):
    return x + y


class SomeClass(object):
    @deprecated(version='1.3.0', reason="This method is deprecated")
    def some_old_method(self, x, y):
        return x + y


some_old_function(12, 34)
obj = SomeClass()
obj.some_old_method(5, 8)

requirements.txt

Deprecated == 1.2.13