aboutsummaryrefslogtreecommitdiffstats
path: root/netmodel/model/key.py
blob: bc49af032f112d9435ed2db78bf785787879f35d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from netmodel.model.mapper         import ObjectSpecification

class Key(ObjectSpecification):
    def __init__(self, *attributes):
        self._attributes = attributes

    #--------------------------------------------------------------------------
    # Descriptor protocol
    #
    # see. https://docs.python.org/3/howto/descriptor.html
    #--------------------------------------------------------------------------

    def __set_name__(self, owner, name):
        self._name = name
        self._owner = owner

    def __iter__(self):
        for attribute in self._attributes:
            yield attribute