Skip to content

Instantly share code, notes, and snippets.

@antvconst
Created November 17, 2019 16:53
Show Gist options
  • Save antvconst/b5e39a9e594a8e1d559400c59f71379c to your computer and use it in GitHub Desktop.
Save antvconst/b5e39a9e594a8e1d559400c59f71379c to your computer and use it in GitHub Desktop.
import functools
class classmethod(object):
def __init__(self, f):
self.f = f
def __get__(self, owner, owner_type):
@functools.wraps(self.f)
def wrapper(*args, **kwargs):
return self.f(owner_type, *args, **kwargs)
return wrapper
class staticmethod(object):
def __init__(self, f):
self.f = f
def __get__(self, owner, owner_type):
@functools.wraps(self.f)
def wrapper(*args, **kwargs):
return self.f(*args, **kwargs)
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment