summaryrefslogtreecommitdiffstats
path: root/util/dependency_updater/tools/namespace.py
blob: c49377a59d1826c092ed7965f0feabed6c4effd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Copyright (C) 2021 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

class Namespace(object):
    """Inheriting this class enables property-style 'object.attr'
    access to member attributes instead of relying on dict-style
    'object[attr]' and '.get(attr)' accessors.
    """

    def __init__(self, **kwargs): self.__dict__.update(kwargs)

    @property  # For use when serializing, to dump back to JSON
    def as_map(self): return self.__dict__

    def __repr__(self):
        return str(self.as_map)