How to use the dotmap.__init__.MyDotMap function in dotmap

To help you get started, we’ve selected a few dotmap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drgrib / dotmap / dotmap / __init__.py View on Github external
print('\n== DotMap subclass ==')


    class MyDotMap(DotMap):
        def __getitem__(self, k):
            return super(MyDotMap, self).__getitem__(k)


    my = MyDotMap()
    my.x.y.z = 3
    print(my)


    # subclass with existing property
    class PropertyDotMap(MyDotMap):
        def __init__(self, *args, **kwargs):
            super(MyDotMap, self).__init__(*args, **kwargs)
            self._myprop = MyDotMap({'nested': 123})

        @property
        def first(self):
            return self._myprop


    p = PropertyDotMap()
    print(p.first)
    print(p.first.nested)
    p.first.second.third = 456
    print(p.first.second.third)

    # final print
github drgrib / dotmap / dotmap / __init__.py View on Github external
print({**d})
    m = DotMap(a=1)
    print({**m.toDict()})
    m = DotMap(a=1)
    print({**m})
    '''

    print('\n== DotMap subclass ==')


    class MyDotMap(DotMap):
        def __getitem__(self, k):
            return super(MyDotMap, self).__getitem__(k)


    my = MyDotMap()
    my.x.y.z = 3
    print(my)


    # subclass with existing property
    class PropertyDotMap(MyDotMap):
        def __init__(self, *args, **kwargs):
            super(MyDotMap, self).__init__(*args, **kwargs)
            self._myprop = MyDotMap({'nested': 123})

        @property
        def first(self):
            return self._myprop


    p = PropertyDotMap()
github drgrib / dotmap / dotmap / __init__.py View on Github external
def __init__(self, *args, **kwargs):
            super(MyDotMap, self).__init__(*args, **kwargs)
            self._myprop = MyDotMap({'nested': 123})
github drgrib / dotmap / dotmap / __init__.py View on Github external
def __init__(self, *args, **kwargs):
            super(MyDotMap, self).__init__(*args, **kwargs)
            self._myprop = MyDotMap({'nested': 123})

dotmap

ordered, dynamically-expandable dot-access dictionary

MIT
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages