4 # https://github.com/benjaminp/six/blob/2c3492a9f16d294cd5e6b43d6110c5a3a2e58b4c/six.py#L818
7 def with_metaclass(meta
, *bases
):
8 """Create a base class with a metaclass."""
9 # This requires a bit of explanation: the basic idea is to make a dummy
10 # metaclass for one level of class instantiation that replaces itself with
11 # the actual metaclass.
12 class metaclass(meta
):
14 def __new__(cls
, name
, this_bases
, d
):
15 return meta(name
, bases
, d
)
16 return type.__new
__(metaclass
, 'temporary_class', (), {})
19 # https://github.com/benjaminp/six/blob/2c3492a9f16d294cd5e6b43d6110c5a3a2e58b4c/six.py#L578
20 if sys
.version_info
[0] == 3:
21 viewitems
= operator
.methodcaller("items")
23 viewitems
= operator
.methodcaller("viewitems")