From 005c9739bca427e33160a55d59ae22cac5b6bfc8 Mon Sep 17 00:00:00 2001 From: mamushi641 <87245618+mamushi641@users.noreply.github.com> Date: Sat, 7 Aug 2021 15:45:39 +0800 Subject: [PATCH 1/2] Update config.py --- config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config.py b/config.py index 1dada77..9182a53 100644 --- a/config.py +++ b/config.py @@ -9,6 +9,16 @@ class config_error(Exception): class Configuration(): + + _instance_lock = threading.Lock() + + def __new__(cls, *args, **kwargs): + if not hasattr(Configuration,"_instance"): + with Configuration._instance_lock: + if not hasattr(Configuration,"_instance"): + Configuration._instance = object.__new__(cls) + return Configuration._instance + def __init__(self, *args, **kwargs): #simulation variables self.verbose = kwargs.get('verbose', True) #whether to print infections, recoveries and fatalities to the terminal From 496a38e5406e0956388c017e53c349773cb96b04 Mon Sep 17 00:00:00 2001 From: mamushi641 <87245618+mamushi641@users.noreply.github.com> Date: Sat, 7 Aug 2021 16:01:26 +0800 Subject: [PATCH 2/2] Update config.py --- config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config.py b/config.py index 9182a53..74adb28 100644 --- a/config.py +++ b/config.py @@ -3,6 +3,7 @@ ''' import numpy as np +import threading class config_error(Exception): pass