Created
September 16, 2015 17:43
-
-
Save ChrisBeaumont/ebdb98647150e7263bdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import warnings | |
class DeprecatedAttribute(object): | |
def __init__(self, name, value): | |
self.name = name | |
self.value = value | |
def __get__(self, instance, owner): | |
warnings.warn("%s is deprecated" % self.name) | |
return self.value | |
def __set__(self, instance, value): | |
self.value = value | |
class Module(object): | |
client = DeprecatedAttribute('client', 5) | |
sys.modules[__name__] = Module() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment