Skip to content

Commit 9d66696

Browse files
committed
Remove usage of third party package;
Add with_metaclass function to provide cross-version compatibility without using six module.
1 parent 055f962 commit 9d66696

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cache:
1818

1919
install:
2020
- travis_retry pip install -q coveralls codecov
21-
- pip install flake8 six # eventually worth
21+
- pip install flake8 # eventually worth
2222

2323
script:
2424
# Run tests

flyweight.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
import weakref
77

8-
from six import add_metaclass
9-
108

119
class FlyweightMeta(type):
1210

@@ -67,8 +65,12 @@ def __repr__(self):
6765
return "<Card: %s%s>" % (self.value, self.suit)
6866

6967

70-
@add_metaclass(FlyweightMeta)
71-
class Card2(object):
68+
def with_metaclass(meta, *bases):
69+
""" Provide python cross-version metaclass compatibility. """
70+
return meta("NewBase", bases, {})
71+
72+
73+
class Card2(with_metaclass(FlyweightMeta)):
7274

7375
def __init__(self, *args, **kwargs):
7476
# print('Init {}: {}'.format(self.__class__, (args, kwargs)))

0 commit comments

Comments
 (0)