Upload utils.py with huggingface_hub
Browse files
utils.py
CHANGED
@@ -1,11 +1,7 @@
|
|
1 |
-
import abc
|
2 |
|
3 |
-
class Singleton(
|
4 |
_instances = {}
|
5 |
-
|
6 |
-
def __new__(cls, *args, **kwargs):
|
7 |
if cls not in cls._instances:
|
8 |
-
cls._instances[cls] = super(Singleton, cls).
|
9 |
-
return cls._instances[cls]
|
10 |
-
|
11 |
-
|
|
|
|
|
1 |
|
2 |
+
class Singleton(type):
|
3 |
_instances = {}
|
4 |
+
def __call__(cls, *args, **kwargs):
|
|
|
5 |
if cls not in cls._instances:
|
6 |
+
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
|
7 |
+
return cls._instances[cls]
|
|
|
|