summaryrefslogtreecommitdiff
path: root/dotbot/util
diff options
context:
space:
mode:
authorAnish Athalye <me@anishathalye.com>2015-01-26 10:36:36 -0500
committerAnish Athalye <me@anishathalye.com>2015-01-26 10:36:36 -0500
commit69502854aaa7597bca9b341b3ce05efa10b4b9d1 (patch)
treef814ae3393c26201ba82e9eb8b48e371e6cba0e1 /dotbot/util
parentc638e25941d3ce927efa6672f474f3e0c6bf03a7 (diff)
Fix compatibility
This commit fixes usage of the Singleton metaclass so that it is compatible with both Python 2 and Python 3.
Diffstat (limited to 'dotbot/util')
-rw-r--r--dotbot/util/compat.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/dotbot/util/compat.py b/dotbot/util/compat.py
new file mode 100644
index 0000000..b0f8f05
--- /dev/null
+++ b/dotbot/util/compat.py
@@ -0,0 +1,5 @@
+def with_metaclass(meta, *bases):
+ class metaclass(meta):
+ def __new__(cls, name, this_bases, d):
+ return meta(name, bases, d)
+ return type.__new__(metaclass, 'temporary_class', (), {})