Skip to content

Commit 7eed040

Browse files
author
Charles Larivier
committed
refactor(metabase): remove Singleton metaclass
Signed-off-by: Charles Larivier <charles@dribbble.com>
1 parent 0d6c30a commit 7eed040

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/metabase/metabase.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
from weakref import WeakValueDictionary
2-
31
import requests
42

53
from metabase.exceptions import AuthenticationError
64

75

8-
class Singleton(type):
9-
_instances = WeakValueDictionary()
10-
11-
def __call__(cls, *args, **kw):
12-
if cls not in cls._instances:
13-
instance = super(Singleton, cls).__call__(*args, **kw)
14-
cls._instances[cls] = instance
15-
return cls._instances[cls]
16-
17-
18-
class Metabase(metaclass=Singleton):
6+
class Metabase:
197
def __init__(self, host: str, user: str, password: str, token: str = None):
208
self._host = host
219
self.user = user

0 commit comments

Comments
 (0)