aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/Constants.py
blob: 20107ebc428b0a0fad5cf0d5bee23cb7809fb79b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from .Bucket import Bucket

class Constants(Bucket):
    """
    The purpose of this class is to be hold user defined constants
    """
    def __init__(self):
        Bucket.__init__(self, 'my_constants')

    def __setattr__(self, name, value):
        # Make sure that any constants redefined have a consistent value
        if name in self.argvattrs:
            assert self.argvattrs[name] == value, Exception('An consistent values given for user defined constants')
        Bucket.__setattr__(self, name, value)

my_constants = Constants()