diff --git a/thriftpy2/_compat.py b/thriftpy2/_compat.py index 6ace9ad..c52664a 100644 --- a/thriftpy2/_compat.py +++ b/thriftpy2/_compat.py @@ -16,24 +16,3 @@ UNIX = platform.system() in ("Linux", "Darwin") CYTHON = UNIX and not PYPY # Cython always disabled in pypy and windows - - -def with_metaclass(meta, *bases): - """Create a base class with a metaclass for py2 & py3 - - This code snippet is copied from six.""" - # This requires a bit of explanation: the basic idea is to make a - # dummy metaclass for one level of class instantiation that replaces - # itself with the actual metaclass. Because of internal type checks - # we also need to make sure that we downgrade the custom metaclass - # for one level to something closer to type (that's why __call__ and - # __init__ comes back from type etc.). - class metaclass(meta): - __call__ = type.__call__ - __init__ = type.__init__ - - def __new__(cls, name, this_bases, d): - if this_bases is None: - return type.__new__(cls, name, (), d) - return meta(name, bases, d) - return metaclass('temporary_class', None, {}) diff --git a/thriftpy2/thrift.py b/thriftpy2/thrift.py index 6454ea5..e611404 100644 --- a/thriftpy2/thrift.py +++ b/thriftpy2/thrift.py @@ -14,8 +14,6 @@ import types from itertools import zip_longest -from ._compat import with_metaclass - def args_to_kwargs(thrift_spec, *args, **kwargs): for item, value in zip_longest(sorted(thrift_spec.items()), args): @@ -149,7 +147,7 @@ def gen_init(cls, thrift_spec=None, default_spec=None): return cls -class TPayload(with_metaclass(TPayloadMeta, object)): +class TPayload(metaclass=TPayloadMeta): __hash__ = None