moved Singleton class to a better place
work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3958]
This commit is contained in:
parent
6f84732cf6
commit
fe4d66fb52
|
@ -9,15 +9,6 @@ BenchParamType = Union[int, str]
|
|||
BenchmarkConfig = Dict[BenchParamId, BenchParamType]
|
||||
|
||||
|
||||
class Singleton(type):
|
||||
_instances = {}
|
||||
|
||||
def __call__(cls, *args, **kwargs):
|
||||
if cls not in cls._instances:
|
||||
cls._instances[cls] = super(type(cls), cls).__call__(*args, **kwargs) # pylint: disable=bad-super-call, no-member
|
||||
return cls._instances[cls]
|
||||
|
||||
|
||||
class BenchParam():
|
||||
'''a parameter of a benchmark
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from .core import BenchmarkId, IBenchmark, Singleton
|
||||
from .core import BenchmarkId, IBenchmark
|
||||
from .benchmarks.hibench import HiBench
|
||||
from .benchmarks.mamul1 import MaMul1
|
||||
from .util import Singleton
|
||||
import logging
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
|
|
@ -5,6 +5,15 @@ import shutil
|
|||
import logging
|
||||
|
||||
|
||||
class Singleton(type):
|
||||
_instances = {}
|
||||
|
||||
def __call__(cls, *args, **kwargs):
|
||||
if cls not in cls._instances:
|
||||
cls._instances[cls] = super(type(cls), cls).__call__(*args, **kwargs) # pylint: disable=bad-super-call, no-member
|
||||
return cls._instances[cls]
|
||||
|
||||
|
||||
def _extract_res_dir_using_py_3_7(dir_resource_package: str, dest_path: Path):
|
||||
dest_path.mkdir(parents=True, exist_ok=True)
|
||||
dir_contents = importlib.resources.contents(dir_resource_package)
|
||||
|
|
Loading…
Reference in New Issue