Skip to content

Update config.py #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
'''

import numpy as np
import threading

class config_error(Exception):
pass


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
Expand Down